Documentation
    Preparing search index...

    The 'wallet_invokeSnap' RPC request handlers

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

    interface FilSnapMethods {
        fil_changeNetwork: (
            ctx: SnapContext,
            params: { network: Network },
        ) => Promise<
            SnapResponse<
                {
                    account: JsonifyObject<
                        {
                            address: string;
                            path: string;
                            publicKey: string;
                            type: "SECP256K1";
                        },
                    >;
                    network: Network;
                },
            >,
        >;
        fil_configure: (
            ctx: SnapContext,
            params: Partial,
        ) => Promise<ConfigureResponse>;
        fil_deriveAccount: (
            ctx: SnapContext,
            params: { index: number },
        ) => Promise<
            SnapResponse<
                JsonifyObject<
                    {
                        address: string;
                        path: string;
                        publicKey: string;
                        type: "SECP256K1";
                    },
                >,
            >,
        >;
        fil_exportPrivateKey: (
            ctx: SnapContext,
        ) => Promise<ExportPrivateKeyResponse>;
        fil_getAccount: (
            ctx: SnapContext,
        ) => Promise<
            SnapResponse<
                JsonifyObject<
                    {
                        address: string;
                        path: string;
                        publicKey: string;
                        type: "SECP256K1";
                    },
                >,
            >,
        >;
        fil_getAccountInfo: (
            ctx: SnapContext,
        ) => Promise<
            | JsonifyObject<{ error: SnapError; result: null }>
            | JsonifyObject<{ error: null; result: AccountInfo }>,
        >;
        fil_getAddress: (snap: SnapsProvider) => Promise<GetAddressResponse>;
        fil_getBalance: (ctx: SnapContext) => Promise<GetBalanceResponse>;
        fil_getConfig: (
            ctx: SnapContext,
        ) => Promise<
            SnapResponse<
                | null
                | {
                    derivationPath: string;
                    network: Network;
                    rpc: { token: string; url: string };
                    unit?: { decimals: number; symbol: "FIL" | "tFIL" };
                },
            >,
        >;
        fil_getGasForMessage: (
            ctx: SnapContext,
            params: {
                maxFee?: string;
                message: {
                    gasFeeCap?: string;
                    gasLimit?: number;
                    gasPremium?: string;
                    method?: number;
                    nonce?: number;
                    params?: string;
                    to: string;
                    value: string;
                    version?: 0;
                };
            },
        ) => Promise<
            | JsonifyObject<{ error: SnapError; result: null }>
            | JsonifyObject<{ error: null; result: MessageGasEstimate }>,
        >;
        fil_getPublicKey: (snap: SnapsProvider) => Promise<GetPublicResponse>;
        fil_sendMessage: (
            ctx: SnapContext,
            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" };
            },
        ) => Promise<SendMessageResponse>;
        fil_setConfig: (
            ctx: SnapContext,
            params: {
                decimals?: number;
                index?: number;
                network: Network;
                rpcToken?: string;
                rpcUrl?: string;
                symbol?: "FIL" | "tFIL";
            },
        ) => Promise<
            SnapResponse<
                {
                    account: JsonifyObject<
                        {
                            address: string;
                            path: string;
                            publicKey: string;
                            type: "SECP256K1";
                        },
                    >;
                    config: {
                        derivationPath: string;
                        network: Network;
                        rpc: { token: string; url: string };
                        unit?: { decimals: number; symbol: "FIL" | "tFIL" };
                    };
                },
            >,
        >;
        fil_sign: (
            ctx: SnapContext,
            params: { data: string },
        ) => Promise<SignMessageRawResponse>;
        fil_signMessage: (
            ctx: SnapContext,
            params: {
                gasFeeCap?: string;
                gasLimit?: number;
                gasPremium?: string;
                method?: number;
                nonce?: number;
                params?: string;
                to: string;
                value: string;
                version?: 0;
            },
        ) => Promise<SignMessageResponse>;
        fil_signMessageRaw: (
            ctx: SnapContext,
            params: { message: string },
        ) => Promise<SignMessageRawResponse>;
    }
    Index

    Properties

    fil_changeNetwork: (
        ctx: SnapContext,
        params: { network: Network },
    ) => Promise<
        SnapResponse<
            {
                account: JsonifyObject<
                    {
                        address: string;
                        path: string;
                        publicKey: string;
                        type: "SECP256K1";
                    },
                >;
                network: Network;
            },
        >,
    >

    Type declaration

      • (
            ctx: SnapContext,
            params: { network: Network },
        ): Promise<
            SnapResponse<
                {
                    account: JsonifyObject<
                        {
                            address: string;
                            path: string;
                            publicKey: string;
                            type: "SECP256K1";
                        },
                    >;
                    network: Network;
                },
            >,
        >
      • RPC method to change the network

        Parameters

        Returns Promise<
            SnapResponse<
                {
                    account: JsonifyObject<
                        {
                            address: string;
                            path: string;
                            publicKey: string;
                            type: "SECP256K1";
                        },
                    >;
                    network: Network;
                },
            >,
        >

    fil_configure: (ctx: SnapContext, params: Partial) => Promise<ConfigureResponse>

    Type declaration

    fil_deriveAccount: (
        ctx: SnapContext,
        params: { index: number },
    ) => Promise<
        SnapResponse<
            JsonifyObject<
                {
                    address: string;
                    path: string;
                    publicKey: string;
                    type: "SECP256K1";
                },
            >,
        >,
    >

    Type declaration

      • (
            ctx: SnapContext,
            params: { index: number },
        ): Promise<
            SnapResponse<
                JsonifyObject<
                    {
                        address: string;
                        path: string;
                        publicKey: string;
                        type: "SECP256K1";
                    },
                >,
            >,
        >
      • RPC method to change the network

        Parameters

        Returns Promise<
            SnapResponse<
                JsonifyObject<
                    {
                        address: string;
                        path: string;
                        publicKey: string;
                        type: "SECP256K1";
                    },
                >,
            >,
        >

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

    Type declaration

    fil_getAccount: (
        ctx: SnapContext,
    ) => Promise<
        SnapResponse<
            JsonifyObject<
                {
                    address: string;
                    path: string;
                    publicKey: string;
                    type: "SECP256K1";
                },
            >,
        >,
    >

    Type declaration

      • (
            ctx: SnapContext,
        ): Promise<
            SnapResponse<
                JsonifyObject<
                    {
                        address: string;
                        path: string;
                        publicKey: string;
                        type: "SECP256K1";
                    },
                >,
            >,
        >
      • RPC method to get the account info of the current account

        Parameters

        Returns Promise<
            SnapResponse<
                JsonifyObject<
                    {
                        address: string;
                        path: string;
                        publicKey: string;
                        type: "SECP256K1";
                    },
                >,
            >,
        >

    fil_getAccountInfo: (
        ctx: SnapContext,
    ) => Promise<
        | JsonifyObject<{ error: SnapError; result: null }>
        | JsonifyObject<{ error: null; result: AccountInfo }>,
    >

    Type declaration

      • (
            ctx: SnapContext,
        ): Promise<
            | JsonifyObject<{ error: SnapError; result: null }>
            | JsonifyObject<{ error: null; result: AccountInfo }>,
        >
      • Get the account info and balance of the current account

        Parameters

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

        Balance of the account in attoFIL

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

    Type declaration

    fil_getConfig: (
        ctx: SnapContext,
    ) => Promise<
        SnapResponse<
            | null
            | {
                derivationPath: string;
                network: Network;
                rpc: { token: string; url: string };
                unit?: { decimals: number; symbol: "FIL" | "tFIL" };
            },
        >,
    >

    Type declaration

      • (
            ctx: SnapContext,
        ): Promise<
            SnapResponse<
                | null
                | {
                    derivationPath: string;
                    network: Network;
                    rpc: { token: string; url: string };
                    unit?: { decimals: number; symbol: "FIL" | "tFIL" };
                },
            >,
        >
      • RPC method to get the current configuration

        Parameters

        Returns Promise<
            SnapResponse<
                | null
                | {
                    derivationPath: string;
                    network: Network;
                    rpc: { token: string; url: string };
                    unit?: { decimals: number; symbol: "FIL" | "tFIL" };
                },
            >,
        >

    fil_getGasForMessage: (
        ctx: SnapContext,
        params: {
            maxFee?: string;
            message: {
                gasFeeCap?: string;
                gasLimit?: number;
                gasPremium?: string;
                method?: number;
                nonce?: number;
                params?: string;
                to: string;
                value: string;
                version?: 0;
            };
        },
    ) => Promise<
        | JsonifyObject<{ error: SnapError; result: null }>
        | JsonifyObject<{ error: null; result: MessageGasEstimate }>,
    >

    Type declaration

      • (
            ctx: SnapContext,
            params: {
                maxFee?: string;
                message: {
                    gasFeeCap?: string;
                    gasLimit?: number;
                    gasPremium?: string;
                    method?: number;
                    nonce?: number;
                    params?: string;
                    to: string;
                    value: string;
                    version?: 0;
                };
            },
        ): Promise<
            | JsonifyObject<{ error: SnapError; result: null }>
            | JsonifyObject<{ error: null; result: MessageGasEstimate }>,
        >
      • Get the gas estimate for a message

        Parameters

        • ctx: SnapContext

          Snap context

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

          Estimate params

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

    fil_getPublicKey: (snap: SnapsProvider) => Promise<GetPublicResponse>
    fil_sendMessage: (
        ctx: SnapContext,
        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" };
        },
    ) => Promise<SendMessageResponse>

    Type declaration

      • (
            ctx: SnapContext,
            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" };
            },
        ): Promise<SendMessageResponse>
      • Send a message to the network

        Parameters

        • ctx: SnapContext

          Snap context

        • 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" };
          }

          The signed message

        Returns Promise<SendMessageResponse>

    fil_setConfig: (
        ctx: SnapContext,
        params: {
            decimals?: number;
            index?: number;
            network: Network;
            rpcToken?: string;
            rpcUrl?: string;
            symbol?: "FIL" | "tFIL";
        },
    ) => Promise<
        SnapResponse<
            {
                account: JsonifyObject<
                    {
                        address: string;
                        path: string;
                        publicKey: string;
                        type: "SECP256K1";
                    },
                >;
                config: {
                    derivationPath: string;
                    network: Network;
                    rpc: { token: string; url: string };
                    unit?: { decimals: number; symbol: "FIL" | "tFIL" };
                };
            },
        >,
    >

    Type declaration

      • (
            ctx: SnapContext,
            params: {
                decimals?: number;
                index?: number;
                network: Network;
                rpcToken?: string;
                rpcUrl?: string;
                symbol?: "FIL" | "tFIL";
            },
        ): Promise<
            SnapResponse<
                {
                    account: JsonifyObject<
                        {
                            address: string;
                            path: string;
                            publicKey: string;
                            type: "SECP256K1";
                        },
                    >;
                    config: {
                        derivationPath: string;
                        network: Network;
                        rpc: { token: string; url: string };
                        unit?: { decimals: number; symbol: "FIL" | "tFIL" };
                    };
                },
            >,
        >
      • RPC method to set the configuration

        Parameters

        • ctx: SnapContext
        • params: {
              decimals?: number;
              index?: number;
              network: Network;
              rpcToken?: string;
              rpcUrl?: string;
              symbol?: "FIL" | "tFIL";
          }

        Returns Promise<
            SnapResponse<
                {
                    account: JsonifyObject<
                        {
                            address: string;
                            path: string;
                            publicKey: string;
                            type: "SECP256K1";
                        },
                    >;
                    config: {
                        derivationPath: string;
                        network: Network;
                        rpc: { token: string; url: string };
                        unit?: { decimals: number; symbol: "FIL" | "tFIL" };
                    };
                },
            >,
        >

    fil_sign: (
        ctx: SnapContext,
        params: { data: string },
    ) => Promise<SignMessageRawResponse>

    Type declaration

    fil_signMessage: (
        ctx: SnapContext,
        params: {
            gasFeeCap?: string;
            gasLimit?: number;
            gasPremium?: string;
            method?: number;
            nonce?: number;
            params?: string;
            to: string;
            value: string;
            version?: 0;
        },
    ) => Promise<SignMessageResponse>

    Type declaration

      • (
            ctx: SnapContext,
            params: {
                gasFeeCap?: string;
                gasLimit?: number;
                gasPremium?: string;
                method?: number;
                nonce?: number;
                params?: string;
                to: string;
                value: string;
                version?: 0;
            },
        ): Promise<SignMessageResponse>
      • Sign a message

        Parameters

        • ctx: SnapContext

          Snap context

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

          The message request

        Returns Promise<SignMessageResponse>

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

    Type declaration