Hierarchy

  • FilsnapAdapter

Constructors

Properties

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

Type declaration

  • derivationPath: string
  • network: "mainnet" | "testnet"
  • rpc: {
        token: string;
        url: string;
    }
    • token: string
    • url: string
  • Optional unit?: {
        decimals: number;
        symbol: "FIL" | "tFIL";
    }
    • decimals: number
    • symbol: "FIL" | "tFIL"
snapId: string
snapVersion: string

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

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

    Returns Promise<GasForMessageResponse>

  • Configure the snap

    Parameters

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

    Returns Promise<ConfigureResponse>

  • Check dapp is connected to Filsnap

    Returns boolean

    true if connected to Filsnap, false otherwise

  • Sign a message

    Parameters

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

    Returns Promise<SignMessageResponse>

  • Switch to or add a different network

    Parameters

    • network: Network

      Network to switch to. Defaults to mainnet

    Returns Promise<void>

  • Installs and connects to Filsnap

    Parameters

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

      Snap config

    • snapId: string = 'npm:filsnap'

      Snap ID to check for. Defaults to npm:filsnap which is the default ID for the Filsnap snap.

    • snapVersion: string = '*'

      Snap version to check for. Defaults to * which matches any version.

    Returns Promise<FilsnapAdapter>

    Throws

    Error if Metamask is not installed

  • Check if Filsnap is installed and enabled

    Parameters

    • snapId: string = 'npm:filsnap'

      Snap ID to check for. Defaults to npm:filsnap which is the default ID for the Filsnap snap.

    • snapVersion: string = '*'

      Snap version to check for. Defaults to * which matches any version.

    Returns Promise<boolean>

Generated using TypeDoc