Client API Reference

Register Event Subscription

function on(
  event: string,
  callback: (error: Error | null, payload: any | null) => void
): void;

Events: connect, disconnect, session_request, session_update, call_request, wc_sessionRequest, wc_sessionUpdate

Create New Session (session_request)

async function createSession(): Promise<void>;

Approve Session Request (connect)

function approveSession({
  chainId: number, // Required
  accounts: string[] // Required
}): void;

Reject Session Request (disconnect)

function rejectSession({
  message: 'OPTIONAL_ERROR_MESSAGE'
}): void;

Update Session (session_update)

function updateSession({
  chainId: number, // Required
  accounts: string[] // Required
}): void;

Kill Session (disconnect)

function killSession(): void;

Send Transaction (eth_sendTransaction)

async function sendTransaction({
  from: string, // Required
  to: string, // Required
  gas: string, // Required
  gasPrice: string, // Required
  value: string, // Required
  data: string, // Required
  nonce: string, // Required
}): Promise<string>;

Returns: Transaction hash

Sign Transaction (eth_signTransaction)

async function signTransaction({
  from: string, // Required
  to: string, // Required
  gas: string, // Required
  gasPrice: string, // Required
  value: string, // Required
  data: string, // Required
  nonce: string, // Required
}): Promise<string>;

Returns: Signed Transaction

Sign Message (eth_sign)

async function signMessage(params: string[]): Promise<string>;

Returns: Signature

Sign Personal Message (personal_sign)

async function signPersonalMessage(params: string[]): Promise<string>;

Returns: Signature

Sign Typed Data (eth_signTypedData)

async function signTypedData(params: any[]): Promise<string>;

Returns: Signature

Send Custom Request

async function sendCustomRequest(payload: IJsonRpcRequest): Promise<any>;

Returns: JSON-RPC Response

Approve Call Request

function approveRequest({
  id: number, // Required
  result: any, // Required
}): void;

Reject Call Request

function rejectRequest({
  id: 1,
  error: {
    message: "OPTIONAL_ERROR_MESSAGE"
  }
}): void;

Last updated