Documentation
    Preparing search index...

    Class TonConnect

    Implements

    Index

    Constructors

    Properties

    isInsideWalletBrowser: (walletJSKey: string) => boolean

    Check if the app is opened inside specified wallet's browser.

    Type declaration

      • (walletJSKey: string): boolean
      • Parameters

        • walletJSKey: string

          target wallet's js bridge key.

        Returns boolean

    isWalletInjected: (walletJSKey: string) => boolean

    Check if specified wallet is injected and available to use with the app.

    Type declaration

      • (walletJSKey: string): boolean
      • Parameters

        • walletJSKey: string

          target wallet's js bridge key.

        Returns boolean

    Accessors

    • get account(): null | Account

      Current connected account or null if no account is connected.

      Returns null | Account

    • get connected(): boolean

      Shows if the wallet is connected right now.

      Returns boolean

    • get wallet(): null | Wallet

      Current connected wallet or null if no account is connected.

      Returns null | Wallet

    • set wallet(value: null | Wallet): void

      Current connected wallet or null if no account is connected.

      Parameters

      Returns void

    Methods

    • Disconnect form thw connected wallet and drop current session.

      Parameters

      • Optionaloptions: { signal?: AbortSignal }

      Returns Promise<void>

    • Allows to subscribe to connection status changes and handle connection errors.

      Parameters

      • callback: (wallet: null | Wallet) => void

        will be called after connections status changes with actual wallet or null.

      • OptionalerrorsHandler: (err: TonConnectError) => void

        (optional) will be called with some instance of TonConnectError when connect error is received.

      Returns () => void

      unsubscribe callback.

    • Pause bridge HTTP connection. Might be helpful, if you want to pause connections while browser tab is unfocused, or if you use SDK with NodeJS and want to save server resources.

      Returns void

    • Try to restore existing session and reconnect to the corresponding wallet. Call it immediately when your app is loaded.

      Parameters

      • Optionaloptions: { openingDeadlineMS?: number; signal?: AbortSignal }

      Returns Promise<void>

    • Asks connected wallet to sign and send the transaction.

      Parameters

      • transaction: SendTransactionRequest

        transaction to send.

      • Optionaloptions: { onRequestSent?: () => void; signal?: AbortSignal }

        (optional) onRequestSent will be called after the request was sent to the wallet and signal for the transaction abort.

      Returns Promise<SendTransactionResponse>

      signed transaction boc that allows you to find the transaction in the blockchain. If user rejects transaction, method will throw the corresponding error.

    • Parameters

      Returns Promise<SendTransactionResponse>

      use sendTransaction(transaction, options) instead

    • Unpause bridge HTTP connection if it is paused.

      Returns Promise<void>

    • Returns available wallets list.

      Returns Promise<WalletInfo[]>