Class Web3Controller

Hierarchy

  • EventEmitter
    • Web3Controller

Properties

options: Partial<Web3ControllerOptions> = {}

Accessors

  • get connected(): boolean
  • Returns if the controller is connected to a signer

    Returns boolean

  • get isCached(): boolean
  • Returns if a provider is cached for the modal

    Returns boolean

  • get name(): string
  • Returns the current application name

    Returns string

  • get provider(): Provider
  • Returns the currently connected provider interface

    Returns Provider

  • get signer(): undefined | Signer
  • Returns the signer if available

    Returns undefined | Signer

Methods

  • Requests to add the specified chain/network to the web3 provider

    Parameters

    Returns Promise<void>

  • Returns the currently connected chain ID

    Returns Promise<number>

  • Connects a wallet directly to the controller

    Parameters

    • wallet: Wallet

    Returns Promise<void>

  • Disconnects the connected instance

    Parameters

    • code: number = -1
    • message: string = 'Disconnected from wallet provider'
    • clearCacheProvider: boolean = true

    Returns Promise<void>

  • Returns the explorer URLs (if available) for the currently connected chain

    Returns Promise<string[]>

  • Attempts to fetch the ABI information for the specified contract from an explorer

    Parameters

    Returns Promise<string>

  • Loads the specified contract using the connected or specified signer || provider

    Parameters

    • contract_address: `0x${string}`
    • Optional contract_abi: ContractInterface
    • options: Partial<ContractLoadOptions> = {}

    Returns Promise<Contract>

  • Execute the specified mutlicall commands

    Type Parameters

    • Type extends any[] = any[]

    Parameters

    Returns Promise<Type>

  • Parameters

    • event: "accountsChanged"
    • listener: ((accounts) => void)
        • (accounts): void
        • Parameters

          • accounts: string[]

          Returns void

    Returns Web3Controller

  • Parameters

    • event: "chainChanged"
    • listener: ((chainId) => void)
        • (chainId): void
        • Parameters

          • chainId: number

          Returns void

    Returns Web3Controller

  • Parameters

    • event: "connect"
    • listener: ((chainId) => void)
        • (chainId): void
        • Parameters

          • chainId: number

          Returns void

    Returns Web3Controller

  • Parameters

    • event: "disconnect"
    • listener: ((error) => void)
        • (error): void
        • Parameters

          • error: {
                code: number;
                message: string;
            }
            • code: number
            • message: string

          Returns void

    Returns Web3Controller

  • Parameters

    • event: "error"
    • listener: ((error) => void)
        • (error): void
        • Parameters

          • error: Error

          Returns void

    Returns Web3Controller

  • Displays a modal to allow a user to connect their wallet

    Parameters

    • forceNetwork: boolean = false

    Returns Promise<void>

  • Signs a message using the connected signer

    Parameters

    • message: string | Bytes

    Returns Promise<string>

  • Requests to switch to the specified chain/network

    Parameters

    • chainId: number = ...

    Returns Promise<void>

  • Requests to add an asset for tracking to the connected wallet

    Parameters

    • contract_address: `0x${string}`
    • options: Partial<AssetOptions> = {}

    Returns Promise<void>

  • Retrieves the explorer URL for the provided chain

    Parameters

    • chainId: number
    • standard: "all" | "none" | "EIP3091" = 'EIP3091'

    Returns Promise<string[]>