Skip to content

Latest commit

 

History

History
171 lines (122 loc) · 12.5 KB

File metadata and controls

171 lines (122 loc) · 12.5 KB

SignatureOperations

(signatureOperations)

Overview

Available Operations

validate

Checks if Order's signature is valid and returns 'true' if it so, 'false' otherwise

Example Usage

import { RaribleProtocolMcp } from "@rarible/protocol-mcp";

const raribleProtocolMcp = new RaribleProtocolMcp({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const result = await raribleProtocolMcp.signatureOperations.validate({
    signer: "ETHEREUM:0x4765273c477c2dc484da4f1984639e943adccfeb",
    message: "<value>",
    signature: "<value>",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { RaribleProtocolMcpCore } from "@rarible/protocol-mcp/core.js";
import { signatureOperationsValidate } from "@rarible/protocol-mcp/funcs/signatureOperationsValidate.js";

// Use `RaribleProtocolMcpCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raribleProtocolMcp = new RaribleProtocolMcpCore({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const res = await signatureOperationsValidate(raribleProtocolMcp, {
    signer: "ETHEREUM:0x4765273c477c2dc484da4f1984639e943adccfeb",
    message: "<value>",
    signature: "<value>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request models.SignatureValidationForm ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<boolean>

Errors

Error Type Status Code Content Type
errors.UnionApiErrorBadRequest 400 application/json
errors.UnionApiErrorServerError 500 application/json
errors.APIError 4XX, 5XX */*

getInput

Generate input string to sign operation

Example Usage

import { RaribleProtocolMcp } from "@rarible/protocol-mcp";

const raribleProtocolMcp = new RaribleProtocolMcp({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const result = await raribleProtocolMcp.signatureOperations.getInput({
    signature: "0xf3104d38a35c59d2612a6128c9e2bbfabf16f26b2db393801cc20398f10079f2",
    blockchain: "ETHEREUM",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { RaribleProtocolMcpCore } from "@rarible/protocol-mcp/core.js";
import { signatureOperationsGetInput } from "@rarible/protocol-mcp/funcs/signatureOperationsGetInput.js";

// Use `RaribleProtocolMcpCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raribleProtocolMcp = new RaribleProtocolMcpCore({
  apiKeyAuth: process.env["RARIBLE_API_KEY"] ?? "",
});

async function run() {
  const res = await signatureOperationsGetInput(raribleProtocolMcp, {
    signature: "0xf3104d38a35c59d2612a6128c9e2bbfabf16f26b2db393801cc20398f10079f2",
    blockchain: "ETHEREUM",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
request models.SignatureInputForm ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.SignatureInput>

Errors

Error Type Status Code Content Type
errors.UnionApiErrorBadRequest 400 application/json
errors.UnionApiErrorServerError 500 application/json
errors.APIError 4XX, 5XX */*