Documentation
    Preparing search index...

    Class TonConnectUI

    Index

    Constructors

    Properties

    connectionRestored: Promise<boolean> = ...

    Promise that resolves after end of th connection restoring process (promise will fire after onStatusChange, so you can get actual information about wallet and session after when promise resolved). Resolved value true/false indicates if the session was restored successfully.

    connector: ITonConnect

    TonConnect instance.

    Manages the modal window state.

    Accessors

    • get account(): null | Account

      Current connected account or null.

      Returns null | Account

    • get connected(): boolean

      Current connection status.

      Returns boolean

    • get singleWalletModalState(): SingleWalletModalState
      Experimental

      Returns current single wallet modal window state.

      Returns SingleWalletModalState

    • set uiOptions(options: TonConnectUiOptions): void

      Set and apply new UI options. Object with partial options should be passed. Passed options will be merged with current options.

      Parameters

      Returns void

    • get wallet(): null | Wallet | (Wallet & WalletInfoWithOpenMethod)

      Curren connected wallet app and its info or null.

      Returns null | Wallet | (Wallet & WalletInfoWithOpenMethod)

    Methods

    • Experimental

      Close the single wallet modal window.

      Parameters

      Returns void

    • Returns Promise<ConnectedWallet>

      Connected wallet.

      Use tonConnectUI.openModal() instead. Will be removed in the next major version. Opens the modal window and handles a wallet connection.

      TonConnectUIError if connection was aborted.

    • Disconnect wallet and clean localstorage.

      Returns Promise<void>

    • Returns available wallets list.

      Returns Promise<WalletInfo[]>

    • Subscribe to the modal window state changes, returns a function which has to be called to unsubscribe.

      Parameters

      Returns () => void

    • Experimental

      Subscribe to the single wallet modal window state changes, returns a function which has to be called to unsubscribe.

      Parameters

      • onChange: (state: SingleWalletModalState) => void

      Returns () => void

    • Subscribe to connection status change.

      Parameters

      Returns () => void

      function which has to be called to unsubscribe.

    • Opens the modal window, returns a promise that resolves after the modal window is opened.

      Returns Promise<void>

    • Experimental

      Opens the single wallet modal window, returns a promise that resolves after the modal window is opened.

      Parameters

      • wallet: string

      Returns Promise<void>

    • Use it to customize ConnectRequest and add tonProof payload. You can call it multiply times to set updated tonProof payload if previous one is outdated. If connectRequestParameters.state === 'loading' loader will appear instead of the qr code in the wallets modal. If connectRequestParameters.state was changed to 'ready' or it's value has been changed, QR will be re-rendered.

      Parameters

      Returns void

    • Signs the data and returns the signature.

      Parameters

      • data: SignDataPayload

        data to sign.

      • Optionaloptions: { onRequestSent?: (redirectToWallet: () => void) => void }

      Returns Promise<SignDataResponse>

    • Returns Promise<WalletInfo[]>