Optionaloptions: TonConnectUiCreateOptionsReadonlyconnectionReadonlyconnectorTonConnect 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.
Curren connected wallet app and its info or null.
ExperimentalClose the single wallet modal window.
OptionalcloseReason: WalletsModalCloseReasonDisconnect wallet and clean localstorage.
Optionaloptions: { traceId?: string }Returns available wallets list.
Subscribe to the modal window state changes, returns a 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 behaviour 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 behaviour 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.
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.
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 behaviour 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 behaviour 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 behaviour 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 behaviour settings; set enableEmbeddedRequest: true
to opt into the connect-and-sign flow described above.
Staticget
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 valuetrue/falseindicates if the session was restored successfully.