Function handleKeyringRequest

  • Handles a keyring JSON-RPC request.

    This function is meant to be used as a handler for Keyring JSON-RPC requests in an Accounts Snap.

    Parameters

    • keyring: Keyring

      Keyring instance.

    • request: {
          id: null | string | number;
          jsonrpc: "2.0";
          method: string;
          params?: Json[] | Record<string, Json>;
      }

      Keyring JSON-RPC request.

      • id: null | string | number
      • jsonrpc: "2.0"
      • method: string
      • Optional params?: Json[] | Record<string, Json>

    Returns Promise<Json | void>

    A promise that resolves to the keyring response.

    Example

    export const onKeyringRequest: OnKeyringRequestHandler = async ({
    origin,
    request,
    }) => {
    return await handleKeyringRequest(keyring, request);
    };