Optionaloptions: TonConnectUiCreateOptionsReadonlyconnectionPromise that resolves after the connection restoring process ends (it fires after onStatusChange,
so you can read actual wallet and session information once it resolves).
The resolved value true/false indicates whether the session was restored successfully.
ReadonlyconnectorTonConnect instance.
ReadonlymodalManages the modal window state.
Current connected account or null.
Current connection status.
Returns current modal window state.
ExperimentalReturns current single wallet modal window state.
Set and apply new UI options. Object with partial options should be passed. Passed options will be merged with current options.
Current connected wallet app and its info, or null when not connected.
Wallet features the dApp prefers. Non-matching wallets stay selectable but are sorted to the bottom of the picker; unlike TonConnectUI.walletsRequiredFeatures, the match is not enforced at connect time. See RequiredFeatures.
Wallet features the dApp requires. Wallets that do not advertise them are
hidden from the picker and rejected at connect time. Set via the
constructor or the uiOptions setter. See RequiredFeatures.
Closes the modal window.
Optionalreason: WalletsModalCloseReasonoptional WalletsModalCloseReason forwarded to state subscribers.
ExperimentalClose the single wallet modal window.
OptionalcloseReason: WalletsModalCloseReasonOptionaloptions: { traceId?: string }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.
Optionaloptions: { traceId?: string }Returns available wallets list.
array of WalletInfo, merged from the registry and any injected wallets.
Subscribe to the modal window state changes.
callback invoked with the new WalletsModalState on every change.
function which has to be called to unsubscribe.
ExperimentalSubscribe to the single wallet modal window state changes, returns a function which has to be called to unsubscribe.
Subscribe to connection status change.
OptionalerrorsHandler: (err: TonConnectError) => voidfunction which has to be called to unsubscribe.
Opens the modal window, returns a promise that resolves after the modal window is opened.
Optionaloptions: { traceId?: string }ExperimentalOpens the single wallet modal window, returns a promise that resolves after the modal window is opened.
Opens the modal window and handles the transaction sending.
Pass options.enableEmbeddedRequest: true to allow the request to ride along with the
connect URL on mobile, eliminating a round-trip. With that flag, the result is always the
embedded shape:
{ hasResponse: true, response } — the transaction was signed, either folded into connect
by an embedded-request-capable wallet, or via the normal bridge flow.{ hasResponse: false, connectResult: { dispatched } } — the wallet connected but did not
return a signed transaction. The dApp must decide how to recover:
dispatched: false — the request never reached the wallet.dispatched: true — the request was delivered to the wallet inside the connect
URL. The wallet may have already signed and submitted it; you just didn't get the
response. Do not retry silently. Surface an explicit retry button to the user, and
ideally check on-chain state (e.g. the user's transaction history for the destination,
queryId and amount) before re-submitting to avoid a duplicate transaction.Without the flag the method throws if the wallet is not connected and returns the plain
SendTransactionResponse otherwise.
transaction to send.
Optionaloptions: ActionOptionsmodal and notifications behavior settings; set enableEmbeddedRequest: true
to opt into the connect-and-send flow described above.
Opens the modal window and handles the transaction sending.
Pass options.enableEmbeddedRequest: true to allow the request to ride along with the
connect URL on mobile, eliminating a round-trip. With that flag, the result is always the
embedded shape:
{ hasResponse: true, response } — the transaction was signed, either folded into connect
by an embedded-request-capable wallet, or via the normal bridge flow.{ hasResponse: false, connectResult: { dispatched } } — the wallet connected but did not
return a signed transaction. The dApp must decide how to recover:
dispatched: false — the request never reached the wallet.dispatched: true — the request was delivered to the wallet inside the connect
URL. The wallet may have already signed and submitted it; you just didn't get the
response. Do not retry silently. Surface an explicit retry button to the user, and
ideally check on-chain state (e.g. the user's transaction history for the destination,
queryId and amount) before re-submitting to avoid a duplicate transaction.Without the flag the method throws if the wallet is not connected and returns the plain
SendTransactionResponse otherwise.
transaction to send.
Optionaloptions: EmbeddedActionOptionsmodal and notifications behavior settings; set enableEmbeddedRequest: true
to opt into the connect-and-send flow described above.
Set desired network for the connection. Can only be set before connecting. If wallet connects with a different chain, the SDK will throw an error and abort connection.
Optionalnetwork: stringdesired network id (e.g., '-239', '-3', or custom). Pass undefined to allow any network. See ChainId.
Use it to customize ConnectRequest and add tonProof payload.
You can call it multiple times to set an updated tonProof payload if the 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.
Signs the data and returns the signature.
Pass options.enableEmbeddedRequest: true to allow the request to ride along with the
connect URL on mobile, eliminating a round-trip. With that flag, the result is always the
embedded shape:
{ hasResponse: true, response } — the data was signed, either folded into connect by an
embedded-request-capable wallet, or via the normal bridge flow.{ hasResponse: false, connectResult: { dispatched } } — the wallet connected but did not
return a signature. Recovery is the dApp's responsibility:
dispatched: false — the request never reached the wallet.dispatched: true — the request was delivered to the wallet inside the connect
URL. The wallet may have already signed it; you just didn't get the response back.
Do not retry silently. Surface an explicit retry button to the user, and, where it
makes sense, verify that you don't already have the signature you need before
re-submitting.Without the flag the method throws if the wallet is not connected and returns the plain
SignDataResponse otherwise.
data to sign.
Optionaloptions: ActionOptionsmodal and notifications behavior settings; set enableEmbeddedRequest: true
to opt into the connect-and-sign flow described above.
Signs the data and returns the signature.
Pass options.enableEmbeddedRequest: true to allow the request to ride along with the
connect URL on mobile, eliminating a round-trip. With that flag, the result is always the
embedded shape:
{ hasResponse: true, response } — the data was signed, either folded into connect by an
embedded-request-capable wallet, or via the normal bridge flow.{ hasResponse: false, connectResult: { dispatched } } — the wallet connected but did not
return a signature. Recovery is the dApp's responsibility:
dispatched: false — the request never reached the wallet.dispatched: true — the request was delivered to the wallet inside the connect
URL. The wallet may have already signed it; you just didn't get the response back.
Do not retry silently. Surface an explicit retry button to the user, and, where it
makes sense, verify that you don't already have the signature you need before
re-submitting.Without the flag the method throws if the wallet is not connected and returns the plain
SignDataResponse otherwise.
data to sign.
Optionaloptions: EmbeddedActionOptionsmodal and notifications behavior settings; set enableEmbeddedRequest: true
to opt into the connect-and-sign flow described above.
Signs a message built from a transaction request and returns the signed internal message BoC.
Pass options.enableEmbeddedRequest: true to allow the request to ride along with the
connect URL on mobile, eliminating a round-trip. With that flag, the result is always the
embedded shape:
{ hasResponse: true, response } — the message was signed, either folded into connect by
an embedded-request-capable wallet, or via the normal bridge flow.{ hasResponse: false, connectResult: { dispatched } } — the wallet connected but did not
return a signed message. Recovery is the dApp's responsibility:
dispatched: false — the request never reached the wallet. Calling signMessage(msg)
again (over the bridge) is safe.dispatched: true — the request was delivered to the wallet inside the connect
URL. The wallet may have already signed (and, for gasless flows, even submitted) it;
you just didn't get the BoC back. Do not retry silently. Surface an explicit retry
button to the user, and for transfer-style payloads check on-chain (the destination
and amount in recent transaction history) before re-submitting to avoid a double
send.Without the flag the method throws if the wallet is not connected and returns the plain
SignMessageResponse otherwise.
transaction-like request describing the internal message to sign.
Optionaloptions: ActionOptionsmodal and notifications behavior settings; set enableEmbeddedRequest: true
to opt into the connect-and-sign flow described above.
Signs a message built from a transaction request and returns the signed internal message BoC.
Pass options.enableEmbeddedRequest: true to allow the request to ride along with the
connect URL on mobile, eliminating a round-trip. With that flag, the result is always the
embedded shape:
{ hasResponse: true, response } — the message was signed, either folded into connect by
an embedded-request-capable wallet, or via the normal bridge flow.{ hasResponse: false, connectResult: { dispatched } } — the wallet connected but did not
return a signed message. Recovery is the dApp's responsibility:
dispatched: false — the request never reached the wallet. Calling signMessage(msg)
again (over the bridge) is safe.dispatched: true — the request was delivered to the wallet inside the connect
URL. The wallet may have already signed (and, for gasless flows, even submitted) it;
you just didn't get the BoC back. Do not retry silently. Surface an explicit retry
button to the user, and for transfer-style payloads check on-chain (the destination
and amount in recent transaction history) before re-submitting to avoid a double
send.Without the flag the method throws if the wallet is not connected and returns the plain
SignMessageResponse otherwise.
transaction-like request describing the internal message to sign.
Optionaloptions: EmbeddedActionOptionsmodal and notifications behavior settings; set enableEmbeddedRequest: true
to opt into the connect-and-sign flow described above.
StaticgetFetch the wallets-list registry without instantiating a TonConnectUI.
Equivalent to the instance method but usable in code that runs before
the connector exists.
UI-aware TON Connect connector. Wraps a
TonConnectinstance from@tonconnect/sdkand adds the wallet-selection modal, the "connect-wallet" button, notification toasts, and auiOptionssetter for runtime theming.In a React app prefer
<TonConnectUIProvider>from@tonconnect/ui-react, which manages a singletonTonConnectUIfor you.Example
See
Connect a wallet (docs)