Interface FilSnapMethods

The 'wallet_invokeSnap' RPC request handlers

Should always return a promise as this is on the metamask side

interface FilSnapMethods {
    fil_configure: (
        ctx: SnapContext,
        params: Partial<
            {
                derivationPath: string;
                network: "mainnet"
                | "testnet";
                rpc: { token: string; url: string };
                unit?: { decimals: number; symbol: "FIL" | "tFIL" };
            },
        >,
    ) => Promise<ConfigureResponse>;
    fil_exportPrivateKey: (
        ctx: SnapContext,
    ) => Promise<ExportPrivateKeyResponse>;
    fil_getAccountInfo: (
        ctx: SnapContext,
    ) => Promise<Jsonify<GetAccountInfoResponse>>;
    fil_getAddress: (snap: SnapsProvider) => Promise<GetAddressResponse>;
    fil_getBalance: (ctx: SnapContext) => Promise<GetBalanceResponse>;
    fil_getGasForMessage: (
        ctx: SnapContext,
        params: { maxFee?: string; message: {} },
    ) => Promise<Jsonify<GasForMessageResponse>>;
    fil_getPublicKey: (snap: SnapsProvider) => Promise<GetPublicResponse>;
    fil_sendMessage: (
        ctx: SnapContext,
        params: { message: {}; signature: { data: string; type: "SECP256K1" } },
    ) => Promise<SendMessageResponse>;
    fil_signMessage: (
        ctx: SnapContext,
        params: {},
    ) => Promise<SignMessageResponse>;
    fil_signMessageRaw: (
        ctx: SnapContext,
        params: { message: string },
    ) => Promise<SignMessageRawResponse>;
}

Properties

fil_configure: (
    ctx: SnapContext,
    params: Partial<
        {
            derivationPath: string;
            network: "mainnet"
            | "testnet";
            rpc: { token: string; url: string };
            unit?: { decimals: number; symbol: "FIL" | "tFIL" };
        },
    >,
) => Promise<ConfigureResponse>

Type declaration

    • (
          ctx: SnapContext,
          params: Partial<
              {
                  derivationPath: string;
                  network: "mainnet"
                  | "testnet";
                  rpc: { token: string; url: string };
                  unit?: { decimals: number; symbol: "FIL" | "tFIL" };
              },
          >,
      ): Promise<ConfigureResponse>
    • Configures the snap with the provided configuration

      Parameters

      • ctx: SnapContext

        Snap context

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

        overrides for the default configuration

      Returns Promise<ConfigureResponse>

fil_exportPrivateKey: (ctx: SnapContext) => Promise<ExportPrivateKeyResponse>

Type declaration

fil_getAccountInfo: (
    ctx: SnapContext,
) => Promise<Jsonify<GetAccountInfoResponse>>

Type declaration

fil_getAddress: (snap: SnapsProvider) => Promise<GetAddressResponse>
fil_getBalance: (ctx: SnapContext) => Promise<GetBalanceResponse>

Type declaration

fil_getGasForMessage: (
    ctx: SnapContext,
    params: { maxFee?: string; message: {} },
) => Promise<Jsonify<GasForMessageResponse>>

Type declaration

    • (
          ctx: SnapContext,
          params: { maxFee?: string; message: {} },
      ): Promise<Jsonify<GasForMessageResponse>>
    • Get the gas estimate for a message

      Parameters

      • ctx: SnapContext

        Snap context

      • params: { maxFee?: string; message: {} }

        Estimate params

        • OptionalmaxFee?: string

          Max fee in attoFIL

          100000000000000000 - 0.1 FIL
          
        • message: {}

          Message to estimate gas for

      Returns Promise<Jsonify<GasForMessageResponse>>

fil_getPublicKey: (snap: SnapsProvider) => Promise<GetPublicResponse>
fil_sendMessage: (
    ctx: SnapContext,
    params: { message: {}; signature: { data: string; type: "SECP256K1" } },
) => Promise<SendMessageResponse>

Type declaration

    • (
          ctx: SnapContext,
          params: { message: {}; signature: { data: string; type: "SECP256K1" } },
      ): Promise<SendMessageResponse>
    • Send a message to the network

      Parameters

      • ctx: SnapContext

        Snap context

      • params: { message: {}; signature: { data: string; type: "SECP256K1" } }

        The signed message

      Returns Promise<SendMessageResponse>

fil_signMessage: (ctx: SnapContext, params: {}) => Promise<SignMessageResponse>

Type declaration

fil_signMessageRaw: (
    ctx: SnapContext,
    params: { message: string },
) => Promise<SignMessageRawResponse>

Type declaration