Constructors

Properties

config:
    | undefined
    | {
        derivationPath: string;
        network: "mainnet"
        | "testnet";
        rpc: { token: string; url: string };
        unit?: { decimals: number; symbol: "FIL" | "tFIL" };
    }
provider: EIP1193Provider
snap: Snap

Methods

  • Estimate the gas for a message

    maxFee is optional and defaults to 100000000000000000 attoFIL (0.1 FIL)

    Parameters

    • params: {
          maxFee?: string;
          message: {
              gasFeeCap?: string;
              gasLimit?: number;
              gasPremium?: string;
              method?: number;
              nonce?: number;
              params?: string;
              to: string;
              value: string;
              version?: 0;
          };
      }

      fil_getGasForMessage RPC method params

    Returns Promise<
        | JsonifyObject<{ error: SnapError; result: null }>
        | JsonifyObject<{ error: null; result: MessageGasEstimate }>,
    >

  • Change the chain

    Parameters

    • chain: string | number

      Chain to switch to

    Returns Promise<ConfigureResponse>

  • Configure the snap

    Parameters

    • Optionalparams: Partial<
          {
              derivationPath: string;
              network: "mainnet"
              | "testnet";
              rpc: { token: string; url: string };
              unit?: { decimals: number; symbol: "FIL" | "tFIL" };
          },
      >

    Returns Promise<ConfigureResponse>

  • Returns Promise<void>

  • Request account info from the snap

    Returns Promise<
        | JsonifyObject<{ error: SnapError; result: null }>
        | JsonifyObject<{ error: null; result: AccountInfo }>,
    >

  • Get the RPC instance configured by Filsnap

    Returns RPC

    RPC instance

  • Send a signed message

    Parameters

    • params: {
          message: {
              from: string;
              gasFeeCap: string;
              gasLimit: number;
              gasPremium: string;
              method: number;
              nonce: number;
              params: string;
              to: string;
              value: string;
              version: 0;
          };
          signature: { data: string; type: "SECP256K1" };
      }

    Returns Promise<SendMessageResponse>

  • Sign a message

    Parameters

    • params: {
          gasFeeCap?: string;
          gasLimit?: number;
          gasPremium?: string;
          method?: number;
          nonce?: number;
          params?: string;
          to: string;
          value: string;
          version?: 0;
      }

    Returns Promise<SignMessageResponse>