From 9e0c010931a95424c7a4a8766cc4cd87be1f4ff2 Mon Sep 17 00:00:00 2001 From: Margarita Skomorokh Date: Wed, 1 Jul 2026 10:23:38 +0200 Subject: [PATCH 1/5] added walletkit updates --- content/applications/appkit/howto/staking.mdx | 2 +- .../applications/walletkit/android/events.mdx | 2 +- .../walletkit/android/wallets.mdx | 2 +- .../walletkit/android/webview.mdx | 2 +- content/applications/walletkit/ios/events.mdx | 2 +- content/applications/walletkit/ios/init.mdx | 2 +- .../applications/walletkit/ios/wallets.mdx | 2 +- .../applications/walletkit/ios/webview.mdx | 2 +- content/applications/walletkit/overview.mdx | 4 +- .../applications/walletkit/web/configure.mdx | 335 ++++++++++++ .../walletkit/web/connections.mdx | 12 +- content/applications/walletkit/web/events.mdx | 8 +- content/applications/walletkit/web/gram.mdx | 10 +- .../walletkit/web/init-wallet.mdx | 299 +++++++++++ content/applications/walletkit/web/init.mdx | 491 +++++------------- .../applications/walletkit/web/jettons.mdx | 6 +- content/applications/walletkit/web/meta.json | 5 +- content/applications/walletkit/web/nfts.mdx | 6 +- .../applications/walletkit/web/staking.mdx | 135 +++++ .../applications/walletkit/web/wallets.mdx | 296 +---------- 20 files changed, 941 insertions(+), 682 deletions(-) create mode 100644 content/applications/walletkit/web/configure.mdx create mode 100644 content/applications/walletkit/web/init-wallet.mdx create mode 100644 content/applications/walletkit/web/staking.mdx diff --git a/content/applications/appkit/howto/staking.mdx b/content/applications/appkit/howto/staking.mdx index 39f1a659d..2066a309d 100644 --- a/content/applications/appkit/howto/staking.mdx +++ b/content/applications/appkit/howto/staking.mdx @@ -7,7 +7,7 @@ Quote a stake or unstake, build the transaction, and send it through the connect ## How it works -The `StakingManager` routes each quote and build call to a single registered staking provider — by default the first one you registered, or the one you pass as `providerId`. `setDefaultProvider` on the manager overrides the default; an unknown `providerId` throws. A quote describes the intent (`direction: 'stake' | 'unstake'`, `amount`, optional `unstakeMode`), and `useBuildStakeTransaction` turns an accepted quote into a `TransactionRequest`. +The `StakingManager` routes each quote and builds a call to a single registered staking provider — by default the first one you registered, or the one you pass as `providerId`. `setDefaultProvider` on the manager overrides the default; an unknown `providerId` throws. A quote describes the intent (`direction: 'stake' | 'unstake'`, `amount`, optional `unstakeMode`), and `useBuildStakeTransaction` turns an accepted quote into a `TransactionRequest`. The protocol shape — derivative jetton, unstake modes, settlement timing, pool model — is provider-specific. Tonstakers, the bundled provider, issues `tsTON` and supports `INSTANT`, `WHEN_AVAILABLE`, and `ROUND_END` unstake modes. Read the user's staked-token balance with `useStakedBalance`, or query the jetton balance directly. `apy` and `instantUnstakeAvailable` from `useStakingProviderInfo` are provider-supplied display data, not guarantees of future yield or withdrawal timing. diff --git a/content/applications/walletkit/android/events.mdx b/content/applications/walletkit/android/events.mdx index a46ebe17b..6a4c4c384 100644 --- a/content/applications/walletkit/android/events.mdx +++ b/content/applications/walletkit/android/events.mdx @@ -39,7 +39,7 @@ walletKit.removeEventsHandler(eventsHandler) ### Establishing connection with dApp -To establish a connection with a dApp, one needs a connection request URL from any source: copy/paste, QR code, deep link, etc. Send it to the WalletKit to initiate a connection request. +To establish a connection with a dApp, one needs a connection request URL from any source: copy/paste, QR code, deep link, etc. Send it to WalletKit to initiate a connection request. ```kotlin wallet.connect(/* connection url */) diff --git a/content/applications/walletkit/android/wallets.mdx b/content/applications/walletkit/android/wallets.mdx index 98ecfa593..4466c0d54 100644 --- a/content/applications/walletkit/android/wallets.mdx +++ b/content/applications/walletkit/android/wallets.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Manage wallets" --- - Initialize the WalletKit before managing wallets. See the [initialization guide](/applications/walletkit/android/init) for details. + Initialize WalletKit before managing wallets. See the [initialization guide](/applications/walletkit/android/init) for details. The SDK provides a comprehensive API for creating, retrieving, and managing wallets. All wallet operations follow a three-step pattern. diff --git a/content/applications/walletkit/android/webview.mdx b/content/applications/walletkit/android/webview.mdx index 3163ae7fc..a8fe9a856 100644 --- a/content/applications/walletkit/android/webview.mdx +++ b/content/applications/walletkit/android/webview.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Inject WebView" --- - Initialize the WalletKit before injecting it into WebView. See the [initialization guide](/applications/walletkit/android/init) for details. + Initialize WalletKit before injecting it into WebView. See the [initialization guide](/applications/walletkit/android/init) for details. Injecting WalletKit into WebView allows integrating the wallet service with a dApp running in a native WebView and handling its events. diff --git a/content/applications/walletkit/ios/events.mdx b/content/applications/walletkit/ios/events.mdx index b74d54032..16907cda2 100644 --- a/content/applications/walletkit/ios/events.mdx +++ b/content/applications/walletkit/ios/events.mdx @@ -37,7 +37,7 @@ try await walletKit.remove(eventsHandler: eventsHandler) ### Establishing connection with dApp -To establish a connection with a dApp, one needs a connection request URL from any source: copy/paste, QR code, deep link, etc. Send it to the WalletKit to initiate a connection request. +To establish a connection with a dApp, one needs a connection request URL from any source: copy/paste, QR code, deep link, etc. Send it to WalletKit to initiate a connection request. ```swift try await walletKit.connect(url: /* connection url */) diff --git a/content/applications/walletkit/ios/init.mdx b/content/applications/walletkit/ios/init.mdx index 917f18911..fa92fe3b2 100644 --- a/content/applications/walletkit/ios/init.mdx +++ b/content/applications/walletkit/ios/init.mdx @@ -56,7 +56,7 @@ Once you have a configuration, create an instance of the kit: ```swift import TONWalletKit -// Instructs how to store intermediate events and other data from the WalletKit. +// Instructs how to store intermediate events and other data from WalletKit. let storage: TONWalletKitStorageType = .memory // .keychain or .custom(/* custom storage */) // Instance diff --git a/content/applications/walletkit/ios/wallets.mdx b/content/applications/walletkit/ios/wallets.mdx index c33dd630f..80e15ae3b 100644 --- a/content/applications/walletkit/ios/wallets.mdx +++ b/content/applications/walletkit/ios/wallets.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Manage wallets" --- - Initialize the WalletKit before managing wallets. See the [initialization guide](/applications/walletkit/ios/init) for details. + Initialize WalletKit before managing wallets. See the [initialization guide](/applications/walletkit/ios/init) for details. The SDK provides a comprehensive API for creating, retrieving, and managing wallets. All wallet operations follow a three-step pattern. diff --git a/content/applications/walletkit/ios/webview.mdx b/content/applications/walletkit/ios/webview.mdx index 358d4db13..bea2c0e48 100644 --- a/content/applications/walletkit/ios/webview.mdx +++ b/content/applications/walletkit/ios/webview.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Inject into WebView" --- - Initialize the WalletKit before injecting it into WebView. See the [initialization guide](/applications/walletkit/ios/init) for details. + Initialize WalletKit before injecting it into WebView. See the [initialization guide](/applications/walletkit/ios/init) for details. Injecting WalletKit into WebView allows integrating the wallet service with a dApp running in a native WebView and handling its events. diff --git a/content/applications/walletkit/overview.mdx b/content/applications/walletkit/overview.mdx index f7a54357f..92b00895a 100644 --- a/content/applications/walletkit/overview.mdx +++ b/content/applications/walletkit/overview.mdx @@ -54,7 +54,7 @@ Explore the complete demo wallets on GitHub: You can integrate your custodial wallet with TON or partially build a basic wallet from scratch. -To get started, select your framework or environment and install WalletKit: +To get started, select your framework and follow usage recipes in the respective sections: -Then, follow usage recipes in the respective sections. - ## See also To implement custom wallet logic, you may need to explore in-depth topics: diff --git a/content/applications/walletkit/web/configure.mdx b/content/applications/walletkit/web/configure.mdx new file mode 100644 index 000000000..e17e13359 --- /dev/null +++ b/content/applications/walletkit/web/configure.mdx @@ -0,0 +1,335 @@ +--- +id: applications/walletkit/web/configure +title: "Configure WalletKit parameters" +sidebarTitle: "Configure parameters" +description: "" +--- + +WalletKit parameters are settings added when initializing the kit. This includes network configuration, wallet information, bridge settings, and more. + +This guide provides a full list of supported parameters and explains how to add them. + +For the minimum functional setup and initialization instructions, see [Get started guide](/applications/walletkit/web/init). + +### Networks (required) + + + For one or more TON networks, configure their respective API or RPC providers to interact with. + + ```ts + import { Network } from '@ton/walletkit'; + + new TonWalletKit({ + networks: { + // Production network. All contracts and funds are real. + [Network.mainnet().chainId]: { // "-239" + apiClient: { + // Most commonly used, official API provider. + // + // To self-host, see: + // * Real-time API: https://github.com/toncenter/ton-http-api-cpp + // * Indexer: https://github.com/toncenter/ton-indexer + // It is important to put real-time API under `/api/v2` route and indexer API under `/api/v3` route. + url: 'https://toncenter.com', + + // Optional key to access higher RPS limits. + key: '', + }, + }, + // Testing network. For experiments, beta tests, and feature previews. + [Network.testnet().chainId]: { // "-3" + apiClient: { + url: 'https://testnet.toncenter.com', + key: '', + }, + }, + }, + // ...later fields... + }); + ``` + + It is also possible to provide an entirely custom provider with its own `ApiClient` interface implementation. + + ```ts + import { Network } from '@ton/walletkit'; + + new TonWalletKit({ + networks: { + [Network.testnet().chainId]: { // "-3" + apiClient: /* A complete ApiClient interface implementation */, + }, + }, + // ...later fields... + }); + ``` + + +### Core settings + + + Core information and constraints of the given wallet. If not provided, defaults will be used. + + ```ts + interface DeviceInfo { + // Name of the wallet. + appName: string; + + // The platform it works on. Select 'browser' for the web wallets. + platform: 'iphone' | 'ipad' | 'android' | 'windows' | 'mac' | 'linux' | 'browser'; + + // The current wallet version. + appVersion: string; + + // Latest protocol version to use. + maxProtocolVersion: number; + + // Which features are supported in the wallet. + features: Feature[]; + } + ``` + + There, `Feature` type is defined as: + + ```ts + type Feature = + | { + // Wallet can send transactions. + name: "SendTransaction"; + + // Max number of messages that can be sent in a single transaction. + // Depends on the TON wallet used, because different kinds can handle + // different number of messages. For example, + // - ledger wallet would only handle 1 message per transaction + // - wallet v4r2 handles up to 4 messages + // - wallet v5r1 handles up to 255 messages + maxMessages: number; + + // Are messages sending extra-currencies supported? + extraCurrencySupported?: boolean; + } + | { + // Wallet can sign data. + name: "SignData"; + + // A type of data to sign. + // Either of: "text", "binary", "cell". + types: SignDataType[]; + } + ``` + + The `maxMessages` number depends on the TON wallet used, because every wallet has its own limit on the volume of messages. + + For example, + + - Ledger wallet would only handle 1 message per transaction + - Wallet `v4r2` handles up to 4 messages + - Wallet `v5r1` handles up to 255 messages + + +### Wallet info + + + How your wallet interacts with the TON Connect. If not provided, defaults will be used. This field is closely related to the [corresponding JSON manifest file](/applications/ton-connect/core-concepts#manifest). + + ```ts expandable + interface WalletInfo { + /** + * Human-readable name of the wallet. + */ + name: string; + + /** + * ID of the wallet, equals to the `appName` property of the `deviceInfo`. + */ + appName: string; + + /** + * Url to the icon of the wallet. Resolution 288×288px. On a non-transparent background, without rounded corners. PNG format. + */ + imageUrl: string; + + /** + * Will be used in the protocol later. + */ + tondns?: string; + + /** + * Info or landing page of your wallet. It may be useful for TON newcomers. + */ + aboutUrl: string; + + /** + * List of features supported by the wallet. + */ + features?: Feature[]; + + /** + * OS and browsers where the wallet could be installed + */ + platforms: ('ios' | 'android' | 'macos' | 'windows' | 'linux' | 'chrome' | 'firefox' | 'safari')[]; + + /** + * Base part of the wallet universal url. The link should support TON Connect parameters: https://github.com/ton-blockchain/ton-connect/blob/main/spec/bridge.md#universal-link. + */ + universalLink: string; + + /** + * Native wallet app deep link. The link should support TON Connect parameters: https://github.com/ton-blockchain/ton-connect/blob/main/spec/bridge.md#universal-link. + */ + deepLink?: string; + + /** + * Url of the wallet's implementation of the HTTP bridge: https://github.com/ton-blockchain/ton-connect/blob/main/spec/bridge.md#http-bridge. + */ + bridgeUrl: string; + + // JS-injectable wallet information + + /** + * If the wallet handles JS Bridge connection, specifies the binding for the bridge object accessible through window. Example: the key "tonkeeper" means the bridge can be accessed as window.tonkeeper. + */ + jsBridgeKey: string; + + /** + * Indicates if the wallet currently is injected to the webpage. + */ + injected: boolean; + + /** + * Indicates if the dapp is opened inside this wallet's browser. + */ + embedded: boolean; + } + ``` + + +### Bridge + + + Connectivity options: either an HTTP or JavaScript bridge setup. The former's `bridgeUrl` points to the publicly exposed bridge URL, while the latter's `jsBridgeKey` points to the property name within the `window` object on the same web page. + + Bridges are used for dApp communication — if the dApp exists in the same web environment as the wallet, then the JavaScript bridge is enough. Otherwise, use an HTTP bridge setup. + + + For HTTP bridge setups, use a publicly available and production-ready bridge deployed at `https://connect.ton.org/bridge`. + + + ```ts + interface BridgeConfig { + // Defaults to `walletInfo`'s `bridgeUrl`, if it exists + bridgeUrl?: string; + + // Defaults to true if `walletInfo`'s `jsBridgeKey` exists + enableJsBridge?: boolean; + + // Defaults to `walletInfo`'s `jsBridgeKey`, if it exists + jsBridgeKey?: string; + + // Defaults to false + disableHttpConnection?: boolean; + + // Settings for bridge-sdk + heartbeatInterval?: number; + reconnectInterval?: number; + maxReconnectAttempts?: number; + } + ``` + + +### Storage + + + How to store intermediate events. + + ```ts + // Either a small object: + interface StorageConfig { + prefix?: string; + maxRetries?: number; + retryDelay?: number; + allowMemory?: boolean; + } + + // Or a complete StorageAdapter interface implementation: + interface StorageAdapter { + get(key: string): Promise; + set(key: string, value: string): Promise; + remove(key: string): Promise; + clear(): Promise; + } + ``` + + +### Event processing + + + How TON Connect events are processed. This is useful for background scripts in browser extensions that process incoming events and log them, but do so outside a queue. + + ```ts + interface EventProcessorConfig { + disableEvents?: boolean; + + // If true, transaction events will not be emulated, + // and their `preview` field will be undefined. + disableTransactionEmulation?: boolean; + } + ``` + + +### Analytics + + + Collect and gather analytical data. + + ```ts + interface AnalyticsConfig { + enabled?: boolean; + + // A web URL to send analytics data to. + endpoint?: string; + } + ``` + + +### Extra config + + + Extra configuration used when developing WalletKit itself. Irrelevant in other cases. + + It supports the following properties: + + - `disableNetworkSend` — WalletKit will not send transactions to the network. Use this if your wallet handles broadcasting itself, or to run tests without submitting real transactions. + - `disableManifestDomainCheck` — Disables the manifest validation error. Useful when testing manifest-related behavior in your app if the kit throws a validation error before you can proceed. + + + +## Next steps + +After configuring WalletKit, you can do this: + +- [Initialize a wallet](/applications/walletkit/web/init-wallet): This step is required for working with transactions. diff --git a/content/applications/walletkit/web/connections.mdx b/content/applications/walletkit/web/connections.mdx index af47a7b9c..56d8a01ba 100644 --- a/content/applications/walletkit/web/connections.mdx +++ b/content/applications/walletkit/web/connections.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Handle connections" --- - [Initialize the WalletKit](/applications/walletkit/web/init) and [set up at least one TON wallet](/applications/walletkit/web/wallets) before using examples on this page. + [Initialize WalletKit](/applications/walletkit/web/init) and [set up at least one TON wallet](/applications/walletkit/web/init-wallet) before using examples on this page. To use a wallet service for initiating blockchain transactions and signing data, dApps need to set up a connection over the bridge first. Connection is established via `connect` requests and terminated via `disconnect` requests. @@ -24,11 +24,11 @@ Standard flow looks as follows: If the connection was approved, the dApp could proceed to send various transaction or data sign requests. If it was rejected, the dApp can repeat the flow. -If a user decides to disconnect a wallet at any point, the `disconnect` request will be issued and the `onDisconnect()` method of the WalletKit will handle it. +If a user decides to disconnect a wallet at any point, the `disconnect` request will be issued and the `onDisconnect()` method of WalletKit will handle it. ## Handlers -To work with connection-specific requests, the WalletKit offers three methods which expect processing functions as callbacks: +To work with connection-specific requests, WalletKit offers three methods which expect processing functions as callbacks: - The `onConnectRequest()` method processes connection requests - The `onDisconnect()` method processes disconnection requests @@ -36,7 +36,7 @@ To work with connection-specific requests, the WalletKit offers three methods wh ### Handle `onConnectRequest` -When a user wants to connect a TON wallet from the dApp, the dApp fires the `connect` request over the bridge. The wallet service then handles it with the `onConnectRequest` method of the WalletKit. +When a user wants to connect a TON wallet from the dApp, the dApp fires the `connect` request over the bridge. The wallet service then handles it with the `onConnectRequest` method of WalletKit. On the dApp side, this flow is often initiated by pressing the "Connect a wallet" button, followed by selecting the user's wallet service. Additionally, a dApp can produce a [QR code or a deep link](#qr-codes-and-deep-links), which initiate the connection flow from within the wallet service. @@ -120,7 +120,7 @@ kit.onConnectRequest(async (event) => { #### QR codes and deep links -The `handleTonConnectUrl()` method of the WalletKit parses a TON Connect link and creates a new [connection request event](#handle-onconnectrequest). +The `handleTonConnectUrl()` method of WalletKit parses a TON Connect link and creates a new [connection request event](#handle-onconnectrequest). Usually, this link comes from a QR code generated on the dApp side, but it can also be provided within the mobile dApp as a deep link. @@ -152,7 +152,7 @@ async function handleDeepLink(url: string) { ### Handle `onDisconnect` -When a user disconnects a wallet service and its TON wallet from the dApp, the dApp fires the `disconnect` request over the bridge. The wallet service then handles it with the `onDisconnect` method of the WalletKit. +When a user disconnects a wallet service and its TON wallet from the dApp, the dApp fires the `disconnect` request over the bridge. The wallet service then handles it with the `onDisconnect` method of WalletKit. ```ts title="TypeScript" kit.onDisconnect(async (event) => { diff --git a/content/applications/walletkit/web/events.mdx b/content/applications/walletkit/web/events.mdx index 93515c71b..a9cd9e846 100644 --- a/content/applications/walletkit/web/events.mdx +++ b/content/applications/walletkit/web/events.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Handle other events" --- - [Initialize the WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/wallets) and [handle connection requests](/applications/walletkit/web/connections) before using examples on this page. + [Initialize WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/init-wallet), and [handle connection requests](/applications/walletkit/web/connections) before using examples on this page. In total, there are five distinct kinds of incoming requests from the TON Connect bridge. They form the corresponding events and their handlers: @@ -20,12 +20,12 @@ In total, there are five distinct kinds of incoming requests from the TON Connec ## Handle `onTransactionRequest` -If a dApp is connected to the wallet service, the former can request to initiate a blockchain transaction, which fires the `transaction` request over the bridge. The wallet service then handles it with the `onTransactionRequest` method of the WalletKit. +If a dApp is connected to the wallet service, the former can request to initiate a blockchain transaction, which fires the `transaction` request over the bridge. The wallet service then handles it with the `onTransactionRequest` method of WalletKit. On TON, transactions are initiated by sending an external message to the TON wallet contract, which then processes it and sends internal messages as requested. To estimate money flows for planned transactions, WalletKit uses emulation via the configured API client, if supported. - The API client in use is determined by the required [`networks` configuration parameter](/applications/walletkit/web/init#param-networks) during [WalletKit initialization](/applications/walletkit/web/init#initialization). + The API client in use is determined by the required [`networks` configuration parameter](/applications/walletkit/configure#networks-required) during [WalletKit initialization](/applications/walletkit/web/init#initialization). ```ts title="TypeScript" @@ -58,7 +58,7 @@ kit.onTransactionRequest(async (event) => { ## Handle `onSignDataRequest` -If a dApp is connected to the wallet service, the former can request to sign data with the private key used by the selected TON wallet, which fires the `signData` request over the bridge. The wallet service then handles it with the `onSignDataRequest` method of the WalletKit. +If a dApp is connected to the wallet service, the former can request to sign data with the private key used by the selected TON wallet, which fires the `signData` request over the bridge. The wallet service then handles it with the `onSignDataRequest` method of WalletKit. The data to sign can be of several kinds: `text`, `binary`, or a raw [`cell`](/foundations/serialization/cells). diff --git a/content/applications/walletkit/web/gram.mdx b/content/applications/walletkit/web/gram.mdx index bdd251c51..ddd3059ac 100644 --- a/content/applications/walletkit/web/gram.mdx +++ b/content/applications/walletkit/web/gram.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Work with Gram" --- - [Initialize the WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/wallets), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. + [Initialize WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/nit-wallet), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. To work with Gram, the wallet service needs to handle [contract balances](#balances) and perform transfers initiated [from dApps](#transfers-from-dapps) and [from within the wallet service itself](#transfers-from-the-wallet-service). @@ -16,7 +16,7 @@ Blockchain state changes constantly as new blocks are produced. This has implica - [Discrete one-off checks](#on-demand-balance-check) have almost no value on their own — the state might change immediately after the query completes, invalidating its results. Thus, such checks are only practical when handling `transaction` requests. - [Continuous monitoring](#continuous-balance-monitoring) is useful for UI display, showing the most recent balance to users, but should not be used for transaction confirmations. -Notice that both cases require querying the blockchain data via the API client set during the [WalletKit initialization](/applications/walletkit/web/init#param-networks). Obtain and provide the key from the selected client to access higher requests-per-second limits. +Notice that both cases require querying the blockchain data via the API client set during the [WalletKit initialization](/applications/walletkit/web/configure#networks-required). Obtain and provide the key from the selected client to access higher requests-per-second limits. ### On-demand balance check @@ -188,7 +188,7 @@ kit.onTransactionRequest(async (event) => { ``` - Emulation uses the API client configured during [WalletKit initialization](/applications/walletkit/web/init#param-networks). + Emulation uses the API client configured during [WalletKit initialization](/applications/walletkit/web/configure#networks-required). ### Approve or reject @@ -268,7 +268,7 @@ That said, the wallet service should not block the UI while waiting for such con ## Transfers in the wallet service -Transactions can be created directly from the wallet service (not from dApps) and fed into the regular approval flow via `handleNewTransaction()` method of the WalletKit. It creates a new [transaction request event](/applications/walletkit/web/events#handle-ontransactionrequest), enabling the same UI confirmation-to-transaction flow for both dApp-initiated and wallet-initiated transactions. +Transactions can be created directly from the wallet service (not from dApps) and fed into the regular approval flow via `handleNewTransaction()` method of WalletKit. It creates a new [transaction request event](/applications/walletkit/web/events#handle-ontransactionrequest), enabling the same UI confirmation-to-transaction flow for both dApp-initiated and wallet-initiated transactions. This example should be modified according to the wallet service's logic: @@ -316,7 +316,7 @@ async function sendGram( ``` - To avoid triggering the `onTransactionRequest()` handler and send the transaction directly, use the `sendTransaction()` method of the wallet instead of the `handleNewTransaction()` method of the WalletKit, modifying the last part of the previous code snippet: + To avoid triggering the `onTransactionRequest()` handler and send the transaction directly, use the `sendTransaction()` method of the wallet instead of the `handleNewTransaction()` method of WalletKit, modifying the last part of the previous code snippet: ```ts title="TypeScript" // Instead of calling kit.handleNewTransaction(fromWallet, tx) diff --git a/content/applications/walletkit/web/init-wallet.mdx b/content/applications/walletkit/web/init-wallet.mdx new file mode 100644 index 000000000..2f32d6ea7 --- /dev/null +++ b/content/applications/walletkit/web/init-wallet.mdx @@ -0,0 +1,299 @@ +--- +id: applications/walletkit/web/init-wallet +title: "Initialize a TON wallet" +sidebarTitle: "Initialize a TON wallet" +description: "" +--- + + + Before using examples on this page, initialize WalletKit. See [Get started](/applications/walletkit/web/init). + + +After initializing WalletKit, set up at least one TON wallet contract. This will prepare your project for working with transactions. + +You can find a full example code in the [Example code section](#example-code). + +## 1. Create a signer + +First, create a **cryptographic signer** for your wallet. There are three options: + +- [Mnemonic phrase](#mnemonic-phrase) +- [Private key](#private-key) +- [Custom signer](#custom-signer) + +### Mnemonic phrase + +You can create a signer from a **mnemonic phrase** — a 12 or 24-word seed phrase obtained with general BIP-39 or TON-specific derivation. + + + Never specify the mnemonic phrase directly in your code. It's a "password" to your wallet and all its funds. + + Instead, prefer sourcing the seed phrase from a secure storage, backend environment variables, or a special `.env` file that is Git-ignored and handled with care. + + +To create a signer, call the `fromMnemonic()` method of the `Signer` class, passing the following parameters: + +- The mnemonic: In this example, it's saved in the local storage as the MNEMONIC entry. The value is a single string containing the 24 seed phrase words, separated by spaces. +- `type`: The type of derivation used to produce a mnemonic, defaults to `ton`. If you used a pure BIP-39 derivation, specify `bip-39`. + +```ts title="TypeScript" +import { + Signer +} from '@ton/walletkit'; + +const signer = await Signer.fromMnemonic( + localStorage.getItem('MNEMONIC')!.split(' '), + { + type: 'ton', + }, +); +``` + + + If you do not yet have a mnemonic for an existing TON wallet or you want to create a new one, you can generate a TON-specific mnemonic with the `CreateTonMnemonic()` function. However, it's crucial to use that function only **once per wallet** and then save it securely. + + You **must NOT** invoke this function amidst the rest of your project code. + + The following is an example of a simple one-off standalone script to produce a new mnemonic that then should be saved somewhere private: + + ```ts + import { CreateTonMnemonic } from '@ton/walletkit'; + + console.log(await CreateTonMnemonic()); // word1, word2, ..., word24 + ``` + + +### Private key + +You can create a signer from a **private key** — a hex-encoded string or Uint8Array of bytes. + + + Handle private keys carefully. Use test keys, keep them in a secure keystore, and avoid logs or commits. + + +Call the `fromPrivateKey()` method of the `Signer` class, passing the private key as a parameter. In this example, the key is saved in the local storage as the PRIVATE_KEY entry containing a hex-encoded string: + +```ts title="TypeScript" +import { + Signer +} from '@ton/walletkit'; + +const signer = await Signer.fromPrivateKey( + localStorage.getItem('PRIVATE_KEY')!, +); +``` + + + The `MnemonicToKeyPair()` function of WalletKit allows converting a [mnemonic](#mnemonic-phrase) to an Ed25519 private/public key pair. + + +### Custom signer + +You can also create a **custom signer**. This option is useful to maintain complete control over the signing process — for example, when using a hardware wallet or signing data on the backend. + +Create a `WalletSigner` object with these fields: + +- A signer function that takes bytes and returns an Ed25519 signature as the `Hex` type +- The corresponding Ed25519 public key as `Hex` + + + The signer function takes an iterable bytes object, such as `array`, `Uint8Array`, or `Buffer`. Then it asynchronously produces an Ed25519-encoded signature of the input as `Hex` — a string containing a hexadecimal value that starts with an explicit `0x` prefix. + + The following example uses the `MnemonicToKeyPair()` function to derive a key pair from a [mnemonic](#mnemonic) saved in the local storage. In production, replace this with your actual signing mechanism. + + +```ts title="TypeScript" +import { + MnemonicToKeyPair, + Uint8ArrayToHex, + DefaultSignature, + type WalletSigner, + type Hex +} from '@ton/walletkit'; + +const keyPair = await MnemonicToKeyPair( + localStorage.getItem('MNEMONIC')!.split(' '), + 'ton', +); + +const signer: WalletSigner = { + sign: async (bytes: Iterable): Promise => { + return DefaultSignature(Uint8Array.from(bytes), keyPair.secretKey); + }, + + publicKey: Uint8ArrayToHex(keyPair.publicKey) as Hex, +}; +``` + +## 2. Create a wallet adapter + +A **wallet adapter** wraps a signer and connects it to a specific TON wallet contract. + +Currently, WalletKit provides two adapters: `WalletV4R2Adapter` and `WalletV5R1Adapter` (recommended). The example below shows how to create a `WalletV5R1Adapter` adapter. + +To add an adapter, call its `create()` function, passing the `network` and `client` parameters. Optionally, add `workchain` and `walletId`. + +```ts title="TypeScript" +import { + Network, + WalletV5R1Adapter, + defaultWalletIdV5R1 // optional: the default wallet ID +} from '@ton/walletkit'; + +const walletAdapter = await WalletV5R1Adapter.create(signer, { + network: Network.mainnet(), + client: kit.getApiClient(Network.mainnet()), + workchain: 0, // optional + walletId: defaultWalletIdV5R1 // optional +}); +``` + +- `network`: The TON network where you're going to initialize a wallet: `Network.mainnet()`, `Network.testnet()`, or `Network.custom(chainId)`. +- `client`: The API client to communicate with the blockchain. Use `kit.getApiClient(network)` to get the client for the specified network. +- (optional) `walletId`: The wallet ID used to distinguish multiple wallets created from the same key pair. If you only have one wallet per key, use the default value or omit the parameter. +- (optional) `workchain`: The workchain. Set it to either `0` for the basechain (default),or `-1` for the masterchain. + + + The available networks and their API clients are configured during [WalletKit initialization](/applications/walletkit/web/init#2-initialize-the-kit). + + + + For `WalletV4R2Adapter`, use these imports: + + ```ts title="TypeScript" + import { + Network, + WalletV4R2Adapter, + defaultWalletIdV4R2 + } from '@ton/walletkit'; + ``` + + +## 3. Initialize the wallet + +Finally, pass the adapter from the previous step to the `addWallet()` method of the kit to complete the wallet initialization process: + +```ts title="TypeScript" +const wallet = await kit.addWallet(walletAdapter); +console.log('Wallet address:', wallet.getAddress()); +``` + + + The `addWallet()` method returns an initialized TON wallet, which can be used on its own elsewhere. + + +## 4. Add multiple wallets + +You can add multiple TON wallets to WalletKit and switch between them as needed. + +```ts title="TypeScript" +const wallet1 = await kit.addWallet(walletAdapter1); +const wallet2 = await kit.addWallet(walletAdapter2); +// ... +const walletN = await kit.addWallet(walletAdapterN); +``` + +Providing the same wallet adapter to the kit multiple times will return the wallet that was already added in the first attempt. + +## Example code + +Below, you can find complete sample codes for initializing a wallet with different signers: + + + + ```ts + import { + Signer, + WalletV5R1Adapter, + Network + } from '@ton/walletkit'; + + // 1. Create a signer + const signer = await Signer.fromMnemonic( + localStorage.getItem('MNEMONIC')!.split(' '), + { + type: 'ton', + }, + ); + + // 2. Create a wallet adapter + const walletAdapter = await WalletV5R1Adapter.create(signer, { + network: Network.mainnet(), + client: kit.getApiClient(Network.mainnet()), + }); + + // 3. Initialize the wallet + const wallet = await kit.addWallet(walletAdapter); + ``` + + + ```ts + import { + Signer, + WalletV5R1Adapter, + Network + } from '@ton/walletkit'; + + // 1. Create a signer + const signer = await Signer.fromPrivateKey( + localStorage.getItem('PRIVATE_KEY')!, + ); + + // 2. Create a wallet adapter + const walletAdapter = await WalletV5R1Adapter.create(signer, { + network: Network.mainnet(), + client: kit.getApiClient(Network.mainnet()), + }); + + // 3. Initialize the wallet + const wallet = await kit.addWallet(walletAdapter); + ``` + + + ```ts + import { + MnemonicToKeyPair, + Uint8ArrayToHex, + DefaultSignature, + type WalletSigner, + type Hex, + WalletV5R1Adapter, + Network + } from '@ton/walletkit'; + + // Get the key pair + const keyPair = await MnemonicToKeyPair( + localStorage.getItem('MNEMONIC')!.split(' '), + 'ton', + ); + + // 1. Create a signer + const signer: WalletSigner = { + sign: async (bytes: Iterable): Promise => { + return DefaultSignature(Uint8Array.from(bytes), keyPair.secretKey); + }, + + publicKey: Uint8ArrayToHex(keyPair.publicKey) as Hex, + } + + // 2. Create a wallet adapter + const walletAdapter = await WalletV5R1Adapter.create(signer, { + network: Network.mainnet(), + client: kit.getApiClient(Network.mainnet()), + }); + + // 3. Initialize the wallet + const wallet = await kit.addWallet(walletAdapter); + ``` + + + +## Next steps + +After initializing a wallet, you can do the following: + +- [Manage wallets](/applications/walletkit/web/wallets): Get, remove, and clear wallets. +- [Handle connections](/applications/walletkit/web/connections): This will allow you to work with transactions. diff --git a/content/applications/walletkit/web/init.mdx b/content/applications/walletkit/web/init.mdx index 1483666c8..52ba8a413 100644 --- a/content/applications/walletkit/web/init.mdx +++ b/content/applications/walletkit/web/init.mdx @@ -1,13 +1,15 @@ --- -title: "How to initialize the WalletKit on the Web platform" -sidebarTitle: "Initialize the kit" +title: "Get started with WalletKit on the Web platform" +sidebarTitle: "Get started" --- -Before initializing the TON Connect's WalletKit, install it in the web project: +This guide explains how to get started with WalletKit on the Web platform: -```shell -npm i @ton/walletkit -``` +- Install WalletKit +- Initialize it +- Configure basic parameters + +You can find a full example code in the [Example code section](#example-code). Alternatively, explore the complete demo wallet with WalletKit integration: @@ -29,39 +31,137 @@ Alternatively, explore the complete demo wallet with WalletKit integration: /> -## Initialization +## Prerequisites + +For reading blockchain data, WalletKit uses API providers. If you need to access higher RPS limits, obtain API keys from your preferred provider. + +For example, you can use the official provider, TON Center: [Get your TON Center API key](https://docs.ton.org/applications/api/toncenter/get-api-key). + +It's recommended to get API keys for both TON networks: **mainnet** and **testnet**. + +## 1. Install WalletKit + +Install WalletKit in your web project: + +```shell +npm i @ton/walletkit +``` + +## 2. Initialize the kit + +To initialize WalletKit with the minimum required setup, take these steps: + +1. Import the main class `TonWalletKit` and the `Network` object for the mandatory network configuration: + + ```ts title="TypeScript" + import { + TonWalletKit, + Network + } from '@ton/walletkit'; + ``` +2. Initialize the kit by creating an instance of the `TonWalletKit` object and passing it the `networks` parameter: a list of networks to operate on. For each network, specify the preferred API provider and its key obtained in [Prerequisites](#prerequisites): + + ```ts title="TypeScript" + const kit = new TonWalletKit({ + networks: { + [Network.mainnet().chainId]: { + apiClient: { + url: 'https://toncenter.com', + key: '', + }, + }, + [Network.testnet().chainId]: { + apiClient: { + url: 'https://testnet.toncenter.com', + key: '', + }, + }, + }, + }); + ``` + + + API providers allow WalletKit to read blockchain data — for example, to fetch account balances and query jettons and NFTs. API keys allow you to access to higher RPS limits. + + + + The mainnet is a production network: contracts and funds are real. Use the testnet for experiments, beta tests, and feature previews + + +3. Wait for the initialization to complete: + + ```ts title="TypeScript" + await kit.waitForReady(); + ``` + +## 3. Add parameters + +In the previous step, you initialized WalletKit with the only required parameter: network configuration. There are also optional parameters you can pass on initialization — for a full list, see [Configure parameters](/applications/walletkit/web/configure). + +It's useful to add some of the optional settings right away. Add them to the same TonWalletKit call from [Step 2](3-initialize-the-kit): + +- `deviceInfo`: Core information and constraints of the wallet. Specify the wallet version: + + ```ts title="TypeScript" + import { + createDeviceInfo + } from '@ton/walletkit'; + + const kit = new TonWalletKit({ + // ...other parameters... + deviceInfo: createDeviceInfo({ + appVersion: '0.0.1', + }), + }); + ``` + + For other settings, WalletKit will use default values. This includes supported wallet features, the maximum supported TON Connect protocol version, the human-readable name of your wallet, and the current platform ('browser'). + + +- `walletManifest`: The TON Connect's wallet manifest. To add it, call `createWalletManifest()`. This function provides initial defaults, but you may want to specify some custom values, such as the human-readable name of your wallet or its icon image URL. Learn more: [Manifest](/applications/ton-connect/core-concepts#manifest). + + ```ts title="TypeScript" + import { + createWalletManifest, + } from '@ton/walletkit'; + + const kit = new TonWalletKit({ + // ...other parameters... + walletManifest: createWalletManifest(), + }); + ``` + +- `bridge`: TON Connect's bridge settings. This is the main bridge for communication with dApps, capable of handling significant load. To self-host, see [TON Connect bridge on GitHub](https://github.com/ton-connect/bridge). + + ```ts title="TypeScript" + const kit = new TonWalletKit({ + // ...other parameters... + bridge: { + bridgeUrl: 'https://connect.ton.org/bridge', + }, + }); + ``` -The basic kit initialization consists of creating a corresponding object by passing it a minimal set of necessary arguments: TON networks to operate on. +## Example code -Yet, it is often useful to configure optional parameters right away — the following example also specifies core wallet information, TON Connect manifest, and bridge settings. +Here is the full example code for initializing WalletKit with the minimum functional setup: -```ts +```ts title="TypeScript" import { - // Main class TonWalletKit, - // Network object - Network, - // Helper functions + Network, createDeviceInfo, createWalletManifest, } from '@ton/walletkit'; -// 0. Create a kit object. const kit = new TonWalletKit({ - // 1. Configure networks. networks: { - // Production network. All contracts and funds are real. [Network.mainnet().chainId]: { apiClient: { - // Most commonly used, official API provider. url: 'https://toncenter.com', - - // A key to access higher RPS limits. - // Get it from https://t.me/toncenter key: '', }, }, - // Testing network. For experiments, beta tests, and feature previews. [Network.testnet().chainId]: { apiClient: { url: 'https://testnet.toncenter.com', @@ -70,40 +170,20 @@ const kit = new TonWalletKit({ }, }, - // 2. Specify core information and constraints of the given wallet. deviceInfo: createDeviceInfo({ - // Version of your wallet appVersion: '0.0.1', - - // The rest of the params will have default values set for you, - // including the features your wallet should support, - // maximum supported TON Connect protocol version, - // human-readable name of your wallet, - // and a current platform ('browser'). }), - // 3. Specify the TON Connect's wallet manifest. - // The following function provides initial defaults, - // but you may want to specify some custom values, - // such as the human-readable name of your wallet or its icon image url. walletManifest: createWalletManifest(), - // 4. Specify the TON Connect's bridge settings bridge: { - // The main TON Connect bridge for dApp communication. - // It is capable to withstand significant load. - // - // To self-host, see https://github.com/ton-connect/bridge bridgeUrl: 'https://connect.ton.org/bridge', }, }); -// 5. Finally, wait for the initialization to complete await kit.waitForReady(); ``` -See also: [TON Connect's wallet manifest](/applications/ton-connect/core-concepts#manifest). - -## Configuration parameters - -### Required - - - For one or more TON networks, configure their respective API or RPC providers to interact with. - - ```ts - import { Network } from '@ton/walletkit'; - - new TonWalletKit({ - networks: { - // Production network. All contracts and funds are real. - [Network.mainnet().chainId]: { // "-239" - apiClient: { - // Most commonly used, official API provider. - // - // To self-host, see: - // * Real-time API: https://github.com/toncenter/ton-http-api-cpp - // * Indexer: https://github.com/toncenter/ton-indexer - // It is important to put real-time API under `/api/v2` route and indexer API under `/api/v3` route. - url: 'https://toncenter.com', - - // Optional key to access higher RPS limits. - key: '', - }, - }, - // Testing network. For experiments, beta tests, and feature previews. - [Network.testnet().chainId]: { // "-3" - apiClient: { - url: 'https://testnet.toncenter.com', - key: '', - }, - }, - }, - // ...later fields... - }); - ``` - - It is also possible to provide an entirely custom provider with its own `ApiClient` interface implementation. - - ```ts - import { Network } from '@ton/walletkit'; - - new TonWalletKit({ - networks: { - [Network.testnet().chainId]: { // "-3" - apiClient: /* A complete ApiClient interface implementation */, - }, - }, - // ...later fields... - }); - ``` - - -### Optional - - - Core information and constraints of the given wallet. If not provided, defaults will be used. - - ```ts - interface DeviceInfo { - // Name of the wallet. - appName: string; - - // The platform it works on. Select 'browser' for the web wallets. - platform: 'iphone' | 'ipad' | 'android' | 'windows' | 'mac' | 'linux' | 'browser'; - - // The current wallet version. - appVersion: string; - - // Latest protocol version to use. - maxProtocolVersion: number; - - // Which features are supported in the wallet. - features: Feature[]; - } - ``` - - There, `Feature` type is defined as: - - ```ts - type Feature = - | { - // Wallet can send transactions. - name: "SendTransaction"; - - // Max number of messages that can be sent in a single transaction. - // Depends on the TON wallet used, because different kinds can handle - // different number of messages. For example, - // - ledger wallet would only handle 1 message per transaction - // - wallet v4r2 handles up to 4 messages - // - wallet v5r1 handles up to 255 messages - maxMessages: number; - - // Are messages sending extra-currencies supported? - extraCurrencySupported?: boolean; - } - | { - // Wallet can sign data. - name: "SignData"; - - // A type of data to sign. - // Either of: "text", "binary", "cell". - types: SignDataType[]; - } - ``` - - The `maxMessages` number depends on the TON wallet used, because every wallet has its own limit on the volume of messages. - - For example, - - - Ledger wallet would only handle 1 message per transaction - - Wallet `v4r2` handles up to 4 messages - - Wallet `v5r1` handles up to 255 messages - - - - How your wallet interacts with the TON Connect. If not provided, defaults will be used. This field is closely related to the [corresponding JSON manifest file](/applications/ton-connect/core-concepts#manifest). - - ```ts expandable - interface WalletInfo { - /** - * Human-readable name of the wallet. - */ - name: string; - - /** - * ID of the wallet, equals to the `appName` property of the `deviceInfo`. - */ - appName: string; - - /** - * Url to the icon of the wallet. Resolution 288×288px. On a non-transparent background, without rounded corners. PNG format. - */ - imageUrl: string; - - /** - * Will be used in the protocol later. - */ - tondns?: string; - - /** - * Info or landing page of your wallet. It may be useful for TON newcomers. - */ - aboutUrl: string; - - /** - * List of features supported by the wallet. - */ - features?: Feature[]; - - /** - * OS and browsers where the wallet could be installed - */ - platforms: ('ios' | 'android' | 'macos' | 'windows' | 'linux' | 'chrome' | 'firefox' | 'safari')[]; - - /** - * Base part of the wallet universal url. The link should support TON Connect parameters: https://github.com/ton-blockchain/ton-connect/blob/main/spec/bridge.md#universal-link. - */ - universalLink: string; - - /** - * Native wallet app deep link. The link should support TON Connect parameters: https://github.com/ton-blockchain/ton-connect/blob/main/spec/bridge.md#universal-link. - */ - deepLink?: string; - - /** - * Url of the wallet's implementation of the HTTP bridge: https://github.com/ton-blockchain/ton-connect/blob/main/spec/bridge.md#http-bridge. - */ - bridgeUrl: string; - - // JS-injectable wallet information - - /** - * If the wallet handles JS Bridge connection, specifies the binding for the bridge object accessible through window. Example: the key "mytonwallet" means the bridge can be accessed as window.mytonwallet. - */ - jsBridgeKey: string; - - /** - * Indicates if the wallet currently is injected to the webpage. - */ - injected: boolean; - - /** - * Indicates if the dapp is opened inside this wallet's browser. - */ - embedded: boolean; - } - ``` - - - - Connectivity options: either an HTTP or JavaScript bridge setup. The former's `bridgeUrl` points to the publicly exposed bridge URL, while the latter's `jsBridgeKey` points to the property name within the `window` object on the same web page. - - Bridges are used for dApp communication — if the dApp exists in the same web environment as the wallet, then the JavaScript bridge is enough. Otherwise, use an HTTP bridge setup. - - - For HTTP bridge setups, use a publicly available and production-ready bridge deployed at `https://connect.ton.org/bridge`. - - - ```ts - interface BridgeConfig { - // Defaults to `walletInfo`'s `bridgeUrl`, if it exists - bridgeUrl?: string; - - // Defaults to true if `walletInfo`'s `jsBridgeKey` exists - enableJsBridge?: boolean; - - // Defaults to `walletInfo`'s `jsBridgeKey`, if it exists - jsBridgeKey?: string; - - // Defaults to false - disableHttpConnection?: boolean; - - // Settings for bridge-sdk - heartbeatInterval?: number; - reconnectInterval?: number; - maxReconnectAttempts?: number; - } - ``` - - - - How to store intermediate events. - - ```ts - // Either a small object: - interface StorageConfig { - prefix?: string; - maxRetries?: number; - retryDelay?: number; - allowMemory?: boolean; - } - - // Or a complete StorageAdapter interface implementation: - interface StorageAdapter { - get(key: string): Promise; - set(key: string, value: string): Promise; - remove(key: string): Promise; - clear(): Promise; - } - ``` - - - - How TON Connect events are processed. This is useful for background scripts in browser extensions that process incoming events and log them, but do so outside a queue. - - ```ts - interface EventProcessorConfig { - disableEvents?: boolean; - - // If true, transaction events will not be emulated, - // and their `preview` field will be undefined. - disableTransactionEmulation?: boolean; - } - ``` - - - - Collect and gather analytical data. - - ```ts - interface AnalyticsConfig { - enabled?: boolean; - - // A web URL to send analytics data to. - endpoint?: string; - } - ``` - - - - Extra configuration used when developing WalletKit itself. Irrelevant in other cases. - - ## Next steps - - - - - - -## See also +After initializing WalletKit, you can do the following: -- [WalletKit overview](/applications/walletkit/overview) -- [TON Connect's wallet manifest](/applications/ton-connect/core-concepts#manifest) -- [TON Connect overview](/applications/ton-connect/overview) +- [Configure more parameters](/applications/walletkit/web/configure): This guide covers all available parameters. +- [Initialize a wallet](/applications/walletkit/web/init-wallet): This step is required for working with transactions. diff --git a/content/applications/walletkit/web/jettons.mdx b/content/applications/walletkit/web/jettons.mdx index 292f36735..cfcb01685 100644 --- a/content/applications/walletkit/web/jettons.mdx +++ b/content/applications/walletkit/web/jettons.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Work with Jettons" --- - [Initialize the WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/wallets), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. + [Initialize WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/nit-wallet), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. [Jettons](/contracts/standard/tokens/jettons/overview) are fungible tokens on TON, similar to ERC-20 tokens on Ethereum. Unlike Gram, which is the native TON currency used in all transfers, each Jetton has a separate master (minter) contract and an individual wallet contract for each holder. @@ -199,7 +199,7 @@ As with Gram transfers, the wallet service should not block the UI while waiting ## Transfers in the wallet service -Jetton transactions can be created directly from the wallet service (not from dApps) and fed into the regular approval flow via the `handleNewTransaction()` method of the WalletKit. It creates a new [transaction request event](/applications/walletkit/web/events#handle-ontransactionrequest), enabling the same UI confirmation-to-transaction flow for both dApp-initiated and wallet-initiated transactions. +Jetton transactions can be created directly from the wallet service (not from dApps) and fed into the regular approval flow via the `handleNewTransaction()` method of WalletKit. It creates a new [transaction request event](/applications/walletkit/web/events#handle-ontransactionrequest), enabling the same UI confirmation-to-transaction flow for both dApp-initiated and wallet-initiated transactions. - To avoid triggering the `onTransactionRequest()` handler and send the transaction directly, use the `sendTransaction()` method of the wallet instead of the `handleNewTransaction()` method of the WalletKit, modifying the last part of the previous code snippet: + To avoid triggering the `onTransactionRequest()` handler and send the transaction directly, use the `sendTransaction()` method of the wallet instead of the `handleNewTransaction()` method of WalletKit, modifying the last part of the previous code snippet: ```ts title="TypeScript" // Instead of calling kit.handleNewTransaction(fromWallet, tx) diff --git a/content/applications/walletkit/web/meta.json b/content/applications/walletkit/web/meta.json index b971cb913..93306a659 100644 --- a/content/applications/walletkit/web/meta.json +++ b/content/applications/walletkit/web/meta.json @@ -3,11 +3,14 @@ "title": "Web", "pages": [ "init", + "configure", + "init-wallet", "wallets", "connections", "events", "gram", "jettons", - "nfts" + "nfts", + "staking" ] } diff --git a/content/applications/walletkit/web/nfts.mdx b/content/applications/walletkit/web/nfts.mdx index 4903413f1..46675974f 100644 --- a/content/applications/walletkit/web/nfts.mdx +++ b/content/applications/walletkit/web/nfts.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Work with NFTs" --- - [Initialize the WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/wallets), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. + [Initialize WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/nit-wallet), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. [NFTs](/contracts/standard/tokens/nft/overview) (non-fungible tokens) are unique digital assets on TON, similar to ERC-721 tokens on Ethereum. Unlike [jettons](/contracts/standard/tokens/jettons/overview), which are fungible and interchangeable, each NFT is unique and represents ownership of a specific item. NFTs consist of a collection contract and individual NFT item contracts for each token. @@ -197,7 +197,7 @@ As with Gram transfers, the wallet service should not block the UI while waiting ## Transfers in the wallet service -NFT transactions can be created directly from the wallet service (not from dApps) and fed into the regular approval flow via the `handleNewTransaction()` method of the WalletKit. It creates a new [transaction request event](/applications/walletkit/web/events#handle-ontransactionrequest), enabling the same UI confirmation-to-transaction flow for both dApp-initiated and wallet-initiated transactions. +NFT transactions can be created directly from the wallet service (not from dApps) and fed into the regular approval flow via the `handleNewTransaction()` method of WalletKit. It creates a new [transaction request event](/applications/walletkit/web/events#handle-ontransactionrequest), enabling the same UI confirmation-to-transaction flow for both dApp-initiated and wallet-initiated transactions. - To avoid triggering the `onTransactionRequest()` handler and send the transaction directly, use the `sendTransaction()` method of the wallet instead of the `handleNewTransaction()` method of the WalletKit, modifying the last part of the previous code snippet: + To avoid triggering the `onTransactionRequest()` handler and send the transaction directly, use the `sendTransaction()` method of the wallet instead of the `handleNewTransaction()` method of WalletKit, modifying the last part of the previous code snippet: ```ts title="TypeScript" // Instead of calling kit.handleNewTransaction(fromWallet, tx) diff --git a/content/applications/walletkit/web/staking.mdx b/content/applications/walletkit/web/staking.mdx new file mode 100644 index 000000000..ed4cc7ed3 --- /dev/null +++ b/content/applications/walletkit/web/staking.mdx @@ -0,0 +1,135 @@ +--- +title: "Stake and unstake" +sidebarTitle: "Stake and unstake" +--- + +Manage staking and unstaking in a wallet service: read staking balances, calculate quotes, and send stakes through a wallet. + +## How it works + +WalletKit exposes the `StakingManager` class as `kit.staking`. It accepts the user intent, calculates a stake/unstake quote, and builds a call to the staking provider. Stakes are derivative jettons, such as tsTON. + +The staking flow includes these steps: + +1. Read the user's staking balance with `getStakedBalance()` or query the jetton balance directly. +2. If you need to override the default provider, use `setDefaultProvider()`. WalletKit ships a bundled provider — **Tonstakers**, but you can configure a custom one. +3. Use `getQuote()` to calculate a quote for a stake/unstake based on the user intent and the current state of the liquidity pool. The intent includes the direction (stake or unstake), the amount, and other parameters. +4. Use the `buildStakeTransaction()` method to turn the accepted quote into a `TransactionRequest`. + +The protocol shape is provider-specific. This includes the derivative jetton, unstake modes, the settlement timing, and the pool model. + +## Before you begin + +You need a connected wallet and a staking provider registered on the WalletKit instance. + +By default, the provider is the first one you registered. To override it for a specific call, pass `providerId` to any method. To change the default globally, use `setDefaultProvider()`. Note that passing an unknown `providerId` throws an error. + +WalletKit ships a bundled provider — **Tonstakers**, but you can configure a custom one. Extend the `StakingProvider` class. Implement `getQuote()`, `buildStakeTransaction()`, `getStakedBalance()`, `getStakingProviderInfo()`, and `getSupportedUnstakeModes()`. + +## Methods + +| Method | Description | +|-------------------------------------------------------------- | ------------------------------------------------------ | +| `registerProvider()`, `setDefaultProvider()`, `getProvider()` | Manage the staking provider. | +| `getStakingProviderInfo(network?, providerId?)` | Read the provider's APY and instant-unstake liquidity. | +| `getSupportedUnstakeModes(providerId?)` | Read unstake modes supported by the provider. | +| `getQuote(params, providerId?)` | Calculate a quote for a stake/unstake. | +| `getStakedBalance(userAddress, network?, providerId?)` | Read the user's staked-token balance (e.g. `tsTON`). | +| `buildStakeTransaction(params, providerId?)` | Build a `TransactionRequest` from a quote. | + +## Read the staking balance + +The `getStakedBalance()` method returns `StakingBalance` for a given user address: `{ stakedBalance, rawStakedBalance, instantUnstakeAvailable, rawInstantUnstakeAvailable, providerId }`. + + + The `stakedBalance` value is the user's tsTON amount, and `instantUnstakeAvailable` represents the pool's liquid TON. + + +```ts title="TypeScript" +import { Network } from '@ton/walletkit'; + +const network = Network.mainnet(); +const fromWallet = kit.getWallet(walletId); + +if (!fromWallet) { + console.error('No wallet contract found'); + return; +} +const userAddress = fromWallet.getAddress(); +const userBalance = await kit.staking.getStakedBalance(userAddress, network); +``` + +## Quote a stake or unstake + +The `getQuote()` accepts the user intent and returns settlement amounts. + +```ts title="TypeScript" +const quote = await kit.staking.getQuote( + { + direction: 'stake', + amount: '1000000000', + userAddress, + network, + } +); +``` + +For an unstake, swap `direction` to `unstake`. + +If the provider accepts more than one unstake mode, pass `unstakeMode`. For example, Tonstakers supports the following modes: `UnstakeMode.INSTANT`, `UnstakeMode.WHEN_AVAILABLE`, and `UnstakeMode.ROUND_END`. + +```ts title="TypeScript" +import { UnstakeMode } from '@ton/walletkit/staking/tonstakers'; + +const unstakeMode = UnstakeMode.INSTANT; + +const quote = await kit.staking.getQuote( + { + direction: 'unstake', + amount: '1000000000', + userAddress, + network, + unstakeMode, + } +); +``` + +## Build and send the transaction + +The `buildStakeTransaction()` method turns an accepted quote into a `TransactionRequest`. + +You can use it for both staking and unstaking: the operation is selected depending on the `direction` parameter from the [quote](#quote-a-stake-or-unstake). + +```ts title="TypeScript" +const tx = await kit.staking.buildStakeTransaction({ + quote, + userAddress, +}); + +await kit.handleNewTransaction(fromWallet, tx); +``` + +To send the transaction directly, without triggering the `onTransactionRequest()` handler, use the `sendTransaction()` method of the wallet instead of the `handleNewTransaction()` method of WalletKit: + +```ts title="TypeScript" +await fromWallet.sendTransaction(tx); +``` + + + Do not use this approach unless it is imperative to complete a transaction without the user's direct consent. Funds at risk: test this approach on the testnet and proceed with utmost caution. + + +## After the send + +If you used `sendTransaction()` directly, it returns a response with `boc` and `normalizedHash`. +Pass either value to `getTransactionStatus()` to confirm settlement. + +If you used `handleNewTransaction()`, capture `signedBoc` from the return value of `approveTransactionRequest()` and pass it to `getTransactionStatus()` as `boc`. For handler setup, see [Handle `onTransactionRequest`](/applications/walletkit/web/events#handle-ontransactionrequest). + +Then call `getStakedBalance()` to see the updated staking balance. + +## Tips + +- The `apy` and `instantUnstakeAvailable` values returned by `getStakingProviderInfo()` are provider-supplied display data, not guarantees of future yield or withdrawal timing. +- You can quote by expected output rather than input — for example, "I want to receive exactly 100 TON, how much tsTON do I need to unstake?". To do this, set `isReversed: true` in the quote params. The `amount` then specifies the desired output, and `amountIn` in the returned quote gives the required input. +- When using Tonstakers unstake modes, keep in mind that `INSTANT` and `WHEN_AVAILABLE` use the spot rate, `ROUND_END` uses the projected rate, and omitting `unstakeMode` defaults to `INSTANT`. diff --git a/content/applications/walletkit/web/wallets.mdx b/content/applications/walletkit/web/wallets.mdx index a9b2392e8..07c85035e 100644 --- a/content/applications/walletkit/web/wallets.mdx +++ b/content/applications/walletkit/web/wallets.mdx @@ -1,280 +1,18 @@ --- -title: "How to manage TON wallets with WalletKit on the Web platform" +title: "Manage TON wallets" sidebarTitle: "Manage wallets" +description: "" --- - - [Initialize the WalletKit](/applications/walletkit/web/init) before using examples on this page. - - -The [basic configuration earlier](/applications/walletkit/web/init#initialization) is enough to outline necessary wallet information and initialize the WalletKit, but it isn't enough for deeper interactions with the blockchain. For that, you need to set up at least one TON wallet contract. - -## Initialization - -1. First, obtain the signer. It can be instantiated [from a mnemonic](#from-mnemonic), from [a private key](#from-private-key), or be [made custom](#from-custom-signer). - -1. Then, select a wallet adapter — it is an implementation of the `WalletInterface` type for a particular TON wallet contract. Currently, WalletKit provides two: `WalletV5R1Adapter` (recommended) and `WalletV4R2Adapter`. - - Adapter takes in a signer from the previous step and a number of options, namely: - - - `network` — TON Blockchain network: `Network.mainnet()`, `Network.testnet()`, or `Network.custom(chainId)`. - - `client` — API client to communicate with TON Blockchain. Use `kit.getApiClient(network)` to get the client for the specified network from the `networks` configuration passed during [WalletKit initialization](/applications/walletkit/web/init). - - `walletId` — identifier of the new wallet, which is used to make its smart contract address unique. - - `workchain` — either `0` for the basechain (default), or `-1` for the masterchain. - - ```ts title="TypeScript" - import { - // Network object - Network, - // Latest wallet version (recommended) - WalletV5R1Adapter, - defaultWalletIdV5R1, - // Legacy wallet version - WalletV4R2Adapter, - defaultWalletIdV4R2, - } from '@ton/walletkit'; - - const walletAdapter = await WalletV5R1Adapter.create(signer, { - network: Network.mainnet(), - client: kit.getApiClient(Network.mainnet()), - - // Either 0 for the basechain (default), - // or -1 for the masterchain - workchain: 0, - - // Specify an ID for this wallet when you plan - // on adding more than one wallet to the kit - // under the same mnemonic or private key. - // - // In such cases, ID is used to make wallet addresses unique, - // because the same ID for the same mnemonic results in wallets - // with the same address, i.e., the same smart contract. - walletId: defaultWalletIdV5R1, // 2147483409 - }); - ``` - -1. Finally, pass the adapter to the `addWallet()` method of the kit to complete the wallet initialization process: - - ```ts title="TypeScript" - // Notice that addWallet() method returns an initialized TON wallet, - // which can be used on its own elsewhere. - const wallet = await kit.addWallet(walletAdapter); - console.log('Wallet address:', wallet.getAddress()); - ``` - - - Apart from adding a new wallet, an adapter is also helpful when [removing one](#remove-a-single-wallet) too. - - -See the complete example for each signer kind: - - - - - +## Overview - - - -### From mnemonic - -To initialize a TON wallet from an existing BIP-39 or TON-specific mnemonic seed phrase, the signer should be instantiated with the `fromMnemonic()` method of the utility `Signer` class of the WalletKit. - - - Never specify the mnemonic phrase directly in your code. It is a "password" to your wallet and all its funds. - - Instead, prefer sourcing the seed phrase from a secure storage, backend environment variables, or a special `.env` file that is Git-ignored and handled with care. - - -```ts title="TypeScript" expandable -import { - // Handles cryptographic signing - Signer, - // Latest wallet version (recommended) - WalletV5R1Adapter, - // Network object - Network, -} from '@ton/walletkit'; - -// 1. -const signer = await Signer.fromMnemonic( - // (REQUIRED) - // A 12 or 24-word seed phrase obtained with general BIP-39 or TON-specific derivation. - // The following value assumes a corresponding MNEMONIC localStorage entry - // that contains 24 space-separated seed phrase words as a single string: - localStorage.getItem('MNEMONIC')!.split(' '), // list of 24 strings - { - // Type of derivation used to produce a mnemonic. - // If you've used a pure BIP-39 derivation, specify 'bip-39'. - // Otherwise, specify 'ton'. - // Defaults to: 'ton' - type: 'ton', - }, -); - -// 2. -const walletAdapter = await WalletV5R1Adapter.create(signer, { - network: Network.mainnet(), - client: kit.getApiClient(Network.mainnet()), -}); - -// 3. -const wallet = await kit.addWallet(walletAdapter); -``` - - - If you do not yet have a mnemonic for an existing TON wallet or you want to create a new one, you can generate a TON-specific mnemonic with the `CreateTonMnemonic()` function. However, it is crucial to use that function only **once per wallet** and then save it securely. - - You **must NOT** invoke this function amidst the rest of your project code. - - The following is an example of a simple one-off standalone script to produce a new mnemonic that then should be saved somewhere private: - - ```ts - import { CreateTonMnemonic } from '@ton/walletkit'; - - console.log(await CreateTonMnemonic()); // word1, word2, ..., word24 - ``` - - -### From private key - -To initialize a TON wallet from an existing private key, the signer should be instantiated with the `fromPrivateKey()` method of the utility `Signer` class of the WalletKit. - -If there is a [mnemonic](#from-mnemonic), one can convert it to an Ed25519 key pair with public and private key by using the `MnemonicToKeyPair()` function. - - - Handle private keys carefully. Use test keys, keep them in a secure keystore, and avoid logs or commits. + + Before using examples on this page, [initialize WalletKit](/applications/walletkit/web/init) and [initialize a TON wallet](/applications/walletkit/web/init-wallet). -```ts title="TypeScript" expandable -import { - // Handles cryptographic signing - Signer, - // Latest wallet version (recommended) - WalletV5R1Adapter, - // Conversion function - MnemonicToKeyPair, - // Network object - Network, -} from '@ton/walletkit'; - -// 1. -const signer = await Signer.fromPrivateKey( - // Private key as a hex-encoded string or Uint8Array of bytes. - // The following value assumes a corresponding PRIVATE_KEY localStorage entry - // that contains the private key as a hex-encoded string: - localStorage.getItem('PRIVATE_KEY')!, -); - -// 2. -const walletAdapter = await WalletV5R1Adapter.create(signer, { - network: Network.mainnet(), - client: kit.getApiClient(Network.mainnet()), -}); - -// 3. -const wallet = await kit.addWallet(walletAdapter); -``` - -### From custom signer - -To provide a custom signing mechanism as an alternative to using a [mnemonic phrase](#from-mnemonic) or a [private key](#from-private-key), create an object of type `WalletSigner` and then pass it to the target wallet adapter's `create()` method. - -The signer object has to have two fields: - -- Signing function of type `ISigner`, which takes an iterable bytes object, such as `array`, `Uint8Array`, or `Buffer`, and asynchronously produces an Ed25519-encoded signature of the input as `Hex`. The `Hex` type is a string containing a hexadecimal value that starts with an explicit `0x` prefix. - - ```ts title="TypeScript" - type ISigner = (bytes: Iterable) => Promise; - ``` - -- Relevant Ed25519 public key of type `Hex`. - - ```ts title="TypeScript" - type Hex = `0x${string}`; - ``` +After initializing a TON wallet or multiple wallets, you can manage them: get, remove, and clear all wallets. -A custom signer is useful to maintain complete control over the signing process, such as when using a hardware wallet or signing data on the backend. - -```ts title="TypeScript" expandable -import { - // Network object - Network, - // Latest wallet version (recommended) - WalletV5R1Adapter, - // Conversion function - MnemonicToKeyPair, - // Utility function to convert an array of bytes into a string of type Hex - Uint8ArrayToHex, - // Utilify function to obtain an Ed25519 signature - DefaultSignature, - // Handles cryptographic signing - type WalletSigner, - // String with a hexadecimal value, which starts with the `0x` prefix - type Hex, -} from '@ton/walletkit'; - -// A Ed25519 key pair from a mnemonic -const keyPair = await MnemonicToKeyPair( - // The following value assumes a corresponding MNEMONIC localStorage entry - // that contains 24 space-separated seed phrase words as a single string: - localStorage.getItem('MNEMONIC')!.split(' '), - 'ton', -); - -// 1. -const signer: WalletSigner = { - // The following is a simple demo of a signing function. - // Make sure to replace it with a production-ready one! - sign: async (bytes: Iterable): Promise => { - return DefaultSignature(Uint8Array.from(bytes), keyPair.secretKey); - }, - - // Public key as a Hex - publicKey: Uint8ArrayToHex(keyPair.publicKey) as Hex, -}; - -// 2. -const walletAdapter = await WalletV5R1Adapter.create(signer, { - network: Network.mainnet(), - client: kit.getApiClient(Network.mainnet()), -}); - -// 3. -const wallet = await kit.addWallet(walletAdapter); -``` - -### Multiple wallets - -You can add multiple TON wallets to WalletKit and switch between them as needed. - -```ts title="TypeScript" -const wallet1 = await kit.addWallet(walletAdapter1); -const wallet2 = await kit.addWallet(walletAdapter2); -// ... -const walletN = await kit.addWallet(walletAdapterN); -``` - -Providing the same wallet adapter to the kit multiple times will return the wallet that was already added in the first attempt. - -## Methods - -### Get a single wallet +## Get a single wallet The `getWallet()` method expects a wallet identifier string. Note that the same wallet on different chains must have different identifiers. Compose it via the `createWalletId()` helper function: @@ -293,7 +31,7 @@ if (wallet) { } ``` -### Get all wallets +## Get all wallets To obtain all added wallets, use the `getWallets()` method of the initialized kit. @@ -302,7 +40,7 @@ const wallets: Wallet[] = kit.getWallets(); wallets.forEach(w => console.log('TON wallet address:', w.getAddress())); ``` -### Remove a single wallet +## Remove a single wallet The `kit.removeWallet()` method accepts either a `walletId` or the adapter instance itself. Compose the identifier via the `createWalletId()` helper function or pass the adapter used when adding the wallet: @@ -320,7 +58,7 @@ await kit.removeWallet(walletId); await kit.removeWallet(walletAdapter); ``` -### Clear all wallets +## Clear all wallets To remove all previously added wallets from the kit, use the `clearWallets()` method of the initialized kit. @@ -330,16 +68,6 @@ await kit.clearWallets(); ## Next steps - - - - -## See also +To prepare for working with transactions, follow this guide: -- [WalletKit overview](/applications/walletkit/overview) -- [TON Connect overview](/applications/ton-connect/overview) +- [Handle connections](/applications/walletkit/web/connections) From 6c202bf3c5967290ce4dc154dbdd1d79277282be Mon Sep 17 00:00:00 2001 From: Margarita Skomorokh Date: Wed, 1 Jul 2026 10:37:48 +0200 Subject: [PATCH 2/5] fixed formatting and spelling --- .../applications/walletkit/web/configure.mdx | 3 --- .../walletkit/web/init-wallet.mdx | 27 ++++++++++++------- content/applications/walletkit/web/init.mdx | 15 ++++++----- .../applications/walletkit/web/staking.mdx | 14 +++++----- 4 files changed, 34 insertions(+), 25 deletions(-) diff --git a/content/applications/walletkit/web/configure.mdx b/content/applications/walletkit/web/configure.mdx index e17e13359..dfcebb343 100644 --- a/content/applications/walletkit/web/configure.mdx +++ b/content/applications/walletkit/web/configure.mdx @@ -1,8 +1,6 @@ --- -id: applications/walletkit/web/configure title: "Configure WalletKit parameters" sidebarTitle: "Configure parameters" -description: "" --- WalletKit parameters are settings added when initializing the kit. This includes network configuration, wallet information, bridge settings, and more. @@ -325,7 +323,6 @@ For the minimum functional setup and initialization instructions, see [Get start - `disableNetworkSend` — WalletKit will not send transactions to the network. Use this if your wallet handles broadcasting itself, or to run tests without submitting real transactions. - `disableManifestDomainCheck` — Disables the manifest validation error. Useful when testing manifest-related behavior in your app if the kit throws a validation error before you can proceed. - ## Next steps diff --git a/content/applications/walletkit/web/init-wallet.mdx b/content/applications/walletkit/web/init-wallet.mdx index 2f32d6ea7..f70bd1fc0 100644 --- a/content/applications/walletkit/web/init-wallet.mdx +++ b/content/applications/walletkit/web/init-wallet.mdx @@ -1,5 +1,4 @@ --- -id: applications/walletkit/web/init-wallet title: "Initialize a TON wallet" sidebarTitle: "Initialize a TON wallet" description: "" @@ -74,7 +73,7 @@ You can create a signer from a **private key** — a hex-encoded string or Uint8 Handle private keys carefully. Use test keys, keep them in a secure keystore, and avoid logs or commits. -Call the `fromPrivateKey()` method of the `Signer` class, passing the private key as a parameter. In this example, the key is saved in the local storage as the PRIVATE_KEY entry containing a hex-encoded string: +Call the `fromPrivateKey()` method of the `Signer` class, passing the private key as a parameter. In this example, the key is saved in the local storage as the PRIVATE\_KEY entry containing a hex-encoded string: ```ts title="TypeScript" import { @@ -99,7 +98,9 @@ Create a `WalletSigner` object with these fields: - A signer function that takes bytes and returns an Ed25519 signature as the `Hex` type - The corresponding Ed25519 public key as `Hex` - + The signer function takes an iterable bytes object, such as `array`, `Uint8Array`, or `Buffer`. Then it asynchronously produces an Ed25519-encoded signature of the input as `Hex` — a string containing a hexadecimal value that starts with an explicit `0x` prefix. The following example uses the `MnemonicToKeyPair()` function to derive a key pair from a [mnemonic](#mnemonic) saved in the local storage. In production, replace this with your actual signing mechanism. @@ -162,7 +163,7 @@ const walletAdapter = await WalletV5R1Adapter.create(signer, { For `WalletV4R2Adapter`, use these imports: - + ```ts title="TypeScript" import { Network, @@ -203,7 +204,9 @@ Providing the same wallet adapter to the kit multiple times will return the wall Below, you can find complete sample codes for initializing a wallet with different signers: - + ```ts import { Signer, @@ -229,7 +232,10 @@ Below, you can find complete sample codes for initializing a wallet with differe const wallet = await kit.addWallet(walletAdapter); ``` - + + ```ts import { Signer, @@ -247,12 +253,15 @@ Below, you can find complete sample codes for initializing a wallet with differe network: Network.mainnet(), client: kit.getApiClient(Network.mainnet()), }); - + // 3. Initialize the wallet const wallet = await kit.addWallet(walletAdapter); ``` - + + ```ts import { MnemonicToKeyPair, @@ -278,7 +287,7 @@ Below, you can find complete sample codes for initializing a wallet with differe publicKey: Uint8ArrayToHex(keyPair.publicKey) as Hex, } - + // 2. Create a wallet adapter const walletAdapter = await WalletV5R1Adapter.create(signer, { network: Network.mainnet(), diff --git a/content/applications/walletkit/web/init.mdx b/content/applications/walletkit/web/init.mdx index 52ba8a413..2f8abb47d 100644 --- a/content/applications/walletkit/web/init.mdx +++ b/content/applications/walletkit/web/init.mdx @@ -59,7 +59,8 @@ To initialize WalletKit with the minimum required setup, take these steps: Network } from '@ton/walletkit'; ``` -2. Initialize the kit by creating an instance of the `TonWalletKit` object and passing it the `networks` parameter: a list of networks to operate on. For each network, specify the preferred API provider and its key obtained in [Prerequisites](#prerequisites): + +1. Initialize the kit by creating an instance of the `TonWalletKit` object and passing it the `networks` parameter: a list of networks to operate on. For each network, specify the preferred API provider and its key obtained in [Prerequisites](#prerequisites): ```ts title="TypeScript" const kit = new TonWalletKit({ @@ -81,14 +82,14 @@ To initialize WalletKit with the minimum required setup, take these steps: ``` - API providers allow WalletKit to read blockchain data — for example, to fetch account balances and query jettons and NFTs. API keys allow you to access to higher RPS limits. + API providers allow WalletKit to read blockchain data — for example, to fetch account balances and query jettons and NFTs. API keys allow you to access to higher RPS limits. - The mainnet is a production network: contracts and funds are real. Use the testnet for experiments, beta tests, and feature previews + The mainnet is a production network: contracts and funds are real. Use the testnet for experiments, beta tests, and feature previews -3. Wait for the initialization to complete: +1. Wait for the initialization to complete: ```ts title="TypeScript" await kit.waitForReady(); @@ -106,7 +107,7 @@ It's useful to add some of the optional settings right away. Add them to the sam import { createDeviceInfo } from '@ton/walletkit'; - + const kit = new TonWalletKit({ // ...other parameters... deviceInfo: createDeviceInfo({ @@ -114,6 +115,7 @@ It's useful to add some of the optional settings right away. Add them to the sam }), }); ``` + For other settings, WalletKit will use default values. This includes supported wallet features, the maximum supported TON Connect protocol version, the human-readable name of your wallet, and the current platform ('browser'). @@ -124,7 +126,7 @@ It's useful to add some of the optional settings right away. Add them to the sam import { createWalletManifest, } from '@ton/walletkit'; - + const kit = new TonWalletKit({ // ...other parameters... walletManifest: createWalletManifest(), @@ -197,6 +199,7 @@ await kit.waitForReady(); // ...later fields... }); ``` + Remember to disable this adapter in web environments or provide a dedicated [storage adapter](/applications/walletkit/web/configure#storage) wrapper to switch between environments. diff --git a/content/applications/walletkit/web/staking.mdx b/content/applications/walletkit/web/staking.mdx index ed4cc7ed3..e5ec60e11 100644 --- a/content/applications/walletkit/web/staking.mdx +++ b/content/applications/walletkit/web/staking.mdx @@ -12,11 +12,11 @@ WalletKit exposes the `StakingManager` class as `kit.staking`. It accepts the us The staking flow includes these steps: 1. Read the user's staking balance with `getStakedBalance()` or query the jetton balance directly. -2. If you need to override the default provider, use `setDefaultProvider()`. WalletKit ships a bundled provider — **Tonstakers**, but you can configure a custom one. -3. Use `getQuote()` to calculate a quote for a stake/unstake based on the user intent and the current state of the liquidity pool. The intent includes the direction (stake or unstake), the amount, and other parameters. -4. Use the `buildStakeTransaction()` method to turn the accepted quote into a `TransactionRequest`. +1. If you need to override the default provider, use `setDefaultProvider()`. WalletKit ships a bundled provider — **Tonstakers**, but you can configure a custom one. +1. Use `getQuote()` to calculate a quote for a stake/unstake based on the user intent and the current state of the liquidity pool. The intent includes the direction (stake or unstake), the amount, and other parameters. +1. Use the `buildStakeTransaction()` method to turn the accepted quote into a `TransactionRequest`. -The protocol shape is provider-specific. This includes the derivative jetton, unstake modes, the settlement timing, and the pool model. +The protocol shape is provider-specific. This includes the derivative jetton, unstake modes, the settlement timing, and the pool model. ## Before you begin @@ -29,7 +29,7 @@ WalletKit ships a bundled provider — **Tonstakers**, but you can configure a c ## Methods | Method | Description | -|-------------------------------------------------------------- | ------------------------------------------------------ | +| ------------------------------------------------------------- | ------------------------------------------------------ | | `registerProvider()`, `setDefaultProvider()`, `getProvider()` | Manage the staking provider. | | `getStakingProviderInfo(network?, providerId?)` | Read the provider's APY and instant-unstake liquidity. | | `getSupportedUnstakeModes(providerId?)` | Read unstake modes supported by the provider. | @@ -59,7 +59,7 @@ const userAddress = fromWallet.getAddress(); const userBalance = await kit.staking.getStakedBalance(userAddress, network); ``` -## Quote a stake or unstake +## Quote a stake or unstake The `getQuote()` accepts the user intent and returns settlement amounts. @@ -96,7 +96,7 @@ const quote = await kit.staking.getQuote( ## Build and send the transaction -The `buildStakeTransaction()` method turns an accepted quote into a `TransactionRequest`. +The `buildStakeTransaction()` method turns an accepted quote into a `TransactionRequest`. You can use it for both staking and unstaking: the operation is selected depending on the `direction` parameter from the [quote](#quote-a-stake-or-unstake). From dfe22ac8016ebfd5e4a81d19f76b84a4afc1f065 Mon Sep 17 00:00:00 2001 From: Margarita Skomorokh Date: Tue, 7 Jul 2026 10:07:22 +0200 Subject: [PATCH 3/5] improvements after the review --- content/applications/appkit/howto/staking.mdx | 2 +- content/applications/walletkit/web/events.mdx | 2 +- content/applications/walletkit/web/gram.mdx | 2 +- content/applications/walletkit/web/init-wallet.mdx | 2 +- content/applications/walletkit/web/init.mdx | 2 +- content/applications/walletkit/web/jettons.mdx | 2 +- content/applications/walletkit/web/nfts.mdx | 2 +- content/applications/walletkit/web/staking.mdx | 6 +++--- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/content/applications/appkit/howto/staking.mdx b/content/applications/appkit/howto/staking.mdx index 2066a309d..62302b67b 100644 --- a/content/applications/appkit/howto/staking.mdx +++ b/content/applications/appkit/howto/staking.mdx @@ -7,7 +7,7 @@ Quote a stake or unstake, build the transaction, and send it through the connect ## How it works -The `StakingManager` routes each quote and builds a call to a single registered staking provider — by default the first one you registered, or the one you pass as `providerId`. `setDefaultProvider` on the manager overrides the default; an unknown `providerId` throws. A quote describes the intent (`direction: 'stake' | 'unstake'`, `amount`, optional `unstakeMode`), and `useBuildStakeTransaction` turns an accepted quote into a `TransactionRequest`. +The `StakingManager` routes each quote-and-build call to a single registered staking provider — by default the first one you registered, or the one you pass as `providerId`. `setDefaultProvider` on the manager overrides the default; an unknown `providerId` throws. A quote describes the intent (`direction: 'stake' | 'unstake'`, `amount`, optional `unstakeMode`), and `useBuildStakeTransaction` turns an accepted quote into a `TransactionRequest`. The protocol shape — derivative jetton, unstake modes, settlement timing, pool model — is provider-specific. Tonstakers, the bundled provider, issues `tsTON` and supports `INSTANT`, `WHEN_AVAILABLE`, and `ROUND_END` unstake modes. Read the user's staked-token balance with `useStakedBalance`, or query the jetton balance directly. `apy` and `instantUnstakeAvailable` from `useStakingProviderInfo` are provider-supplied display data, not guarantees of future yield or withdrawal timing. diff --git a/content/applications/walletkit/web/events.mdx b/content/applications/walletkit/web/events.mdx index a9cd9e846..70336ffb9 100644 --- a/content/applications/walletkit/web/events.mdx +++ b/content/applications/walletkit/web/events.mdx @@ -25,7 +25,7 @@ If a dApp is connected to the wallet service, the former can request to initiate On TON, transactions are initiated by sending an external message to the TON wallet contract, which then processes it and sends internal messages as requested. To estimate money flows for planned transactions, WalletKit uses emulation via the configured API client, if supported. - The API client in use is determined by the required [`networks` configuration parameter](/applications/walletkit/configure#networks-required) during [WalletKit initialization](/applications/walletkit/web/init#initialization). + The API client in use is determined by the required [`networks` configuration parameter](/applications/walletkit/web/configure#networks-required) during [WalletKit initialization](/applications/walletkit/web/init#initialization). ```ts title="TypeScript" diff --git a/content/applications/walletkit/web/gram.mdx b/content/applications/walletkit/web/gram.mdx index ddd3059ac..8d261bf37 100644 --- a/content/applications/walletkit/web/gram.mdx +++ b/content/applications/walletkit/web/gram.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Work with Gram" --- - [Initialize WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/nit-wallet), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. + [Initialize WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/init-wallet), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. To work with Gram, the wallet service needs to handle [contract balances](#balances) and perform transfers initiated [from dApps](#transfers-from-dapps) and [from within the wallet service itself](#transfers-from-the-wallet-service). diff --git a/content/applications/walletkit/web/init-wallet.mdx b/content/applications/walletkit/web/init-wallet.mdx index f70bd1fc0..0612c7f29 100644 --- a/content/applications/walletkit/web/init-wallet.mdx +++ b/content/applications/walletkit/web/init-wallet.mdx @@ -103,7 +103,7 @@ Create a `WalletSigner` object with these fields: > The signer function takes an iterable bytes object, such as `array`, `Uint8Array`, or `Buffer`. Then it asynchronously produces an Ed25519-encoded signature of the input as `Hex` — a string containing a hexadecimal value that starts with an explicit `0x` prefix. - The following example uses the `MnemonicToKeyPair()` function to derive a key pair from a [mnemonic](#mnemonic) saved in the local storage. In production, replace this with your actual signing mechanism. + The following example uses the `MnemonicToKeyPair()` function to derive a key pair from a [mnemonic](#mnemonic-phrase) saved in the local storage. In production, replace this with your actual signing mechanism. ```ts title="TypeScript" diff --git a/content/applications/walletkit/web/init.mdx b/content/applications/walletkit/web/init.mdx index 2f8abb47d..788c3896a 100644 --- a/content/applications/walletkit/web/init.mdx +++ b/content/applications/walletkit/web/init.mdx @@ -99,7 +99,7 @@ To initialize WalletKit with the minimum required setup, take these steps: In the previous step, you initialized WalletKit with the only required parameter: network configuration. There are also optional parameters you can pass on initialization — for a full list, see [Configure parameters](/applications/walletkit/web/configure). -It's useful to add some of the optional settings right away. Add them to the same TonWalletKit call from [Step 2](3-initialize-the-kit): +It's useful to add some of the optional settings right away. Add them to the same TonWalletKit call from [Step 2](2-initialize-the-kit): - `deviceInfo`: Core information and constraints of the wallet. Specify the wallet version: diff --git a/content/applications/walletkit/web/jettons.mdx b/content/applications/walletkit/web/jettons.mdx index cfcb01685..1e5521b33 100644 --- a/content/applications/walletkit/web/jettons.mdx +++ b/content/applications/walletkit/web/jettons.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Work with Jettons" --- - [Initialize WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/nit-wallet), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. + [Initialize WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/init-wallet), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. [Jettons](/contracts/standard/tokens/jettons/overview) are fungible tokens on TON, similar to ERC-20 tokens on Ethereum. Unlike Gram, which is the native TON currency used in all transfers, each Jetton has a separate master (minter) contract and an individual wallet contract for each holder. diff --git a/content/applications/walletkit/web/nfts.mdx b/content/applications/walletkit/web/nfts.mdx index 46675974f..318964241 100644 --- a/content/applications/walletkit/web/nfts.mdx +++ b/content/applications/walletkit/web/nfts.mdx @@ -4,7 +4,7 @@ sidebarTitle: "Work with NFTs" --- - [Initialize WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/nit-wallet), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. + [Initialize WalletKit](/applications/walletkit/web/init), [set up at least one TON wallet](/applications/walletkit/web/init-wallet), handle [connection requests](/applications/walletkit/web/connections) and [transaction requests](/applications/walletkit/web/events) before using examples on this page. [NFTs](/contracts/standard/tokens/nft/overview) (non-fungible tokens) are unique digital assets on TON, similar to ERC-721 tokens on Ethereum. Unlike [jettons](/contracts/standard/tokens/jettons/overview), which are fungible and interchangeable, each NFT is unique and represents ownership of a specific item. NFTs consist of a collection contract and individual NFT item contracts for each token. diff --git a/content/applications/walletkit/web/staking.mdx b/content/applications/walletkit/web/staking.mdx index e5ec60e11..919d0de48 100644 --- a/content/applications/walletkit/web/staking.mdx +++ b/content/applications/walletkit/web/staking.mdx @@ -24,7 +24,7 @@ You need a connected wallet and a staking provider registered on the WalletKit i By default, the provider is the first one you registered. To override it for a specific call, pass `providerId` to any method. To change the default globally, use `setDefaultProvider()`. Note that passing an unknown `providerId` throws an error. -WalletKit ships a bundled provider — **Tonstakers**, but you can configure a custom one. Extend the `StakingProvider` class. Implement `getQuote()`, `buildStakeTransaction()`, `getStakedBalance()`, `getStakingProviderInfo()`, and `getSupportedUnstakeModes()`. +WalletKit ships a bundled provider — **Tonstakers**, but you can configure a custom one. Extend the `StakingProvider` class. Implement `getQuote()`, `buildStakeTransaction()`, `getStakedBalance()`, `getStakingProviderInfo()`, and `getStakingProviderMetadata()`, and `getSupportedNetworks()`. ## Methods @@ -32,7 +32,7 @@ WalletKit ships a bundled provider — **Tonstakers**, but you can configure a c | ------------------------------------------------------------- | ------------------------------------------------------ | | `registerProvider()`, `setDefaultProvider()`, `getProvider()` | Manage the staking provider. | | `getStakingProviderInfo(network?, providerId?)` | Read the provider's APY and instant-unstake liquidity. | -| `getSupportedUnstakeModes(providerId?)` | Read unstake modes supported by the provider. | +| `getStakingProviderMetadata(network?, providerId?)` | Read the provider's full static metadata. | | `getQuote(params, providerId?)` | Calculate a quote for a stake/unstake. | | `getStakedBalance(userAddress, network?, providerId?)` | Read the user's staked-token balance (e.g. `tsTON`). | | `buildStakeTransaction(params, providerId?)` | Build a `TransactionRequest` from a quote. | @@ -79,7 +79,7 @@ For an unstake, swap `direction` to `unstake`. If the provider accepts more than one unstake mode, pass `unstakeMode`. For example, Tonstakers supports the following modes: `UnstakeMode.INSTANT`, `UnstakeMode.WHEN_AVAILABLE`, and `UnstakeMode.ROUND_END`. ```ts title="TypeScript" -import { UnstakeMode } from '@ton/walletkit/staking/tonstakers'; +import { UnstakeMode } from '@ton/walletkit'; const unstakeMode = UnstakeMode.INSTANT; From 380763f88af3ba4d3492c695c148e677551cf179 Mon Sep 17 00:00:00 2001 From: Alejandbel Date: Wed, 8 Jul 2026 11:24:30 +0300 Subject: [PATCH 4/5] fix: small inconsistency fixes --- content/applications/appkit/howto/staking.mdx | 2 +- content/applications/walletkit/web/configure.mdx | 2 +- content/applications/walletkit/web/init.mdx | 8 ++++---- content/applications/walletkit/web/staking.mdx | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/content/applications/appkit/howto/staking.mdx b/content/applications/appkit/howto/staking.mdx index 62302b67b..72cd1b67d 100644 --- a/content/applications/appkit/howto/staking.mdx +++ b/content/applications/appkit/howto/staking.mdx @@ -7,7 +7,7 @@ Quote a stake or unstake, build the transaction, and send it through the connect ## How it works -The `StakingManager` routes each quote-and-build call to a single registered staking provider — by default the first one you registered, or the one you pass as `providerId`. `setDefaultProvider` on the manager overrides the default; an unknown `providerId` throws. A quote describes the intent (`direction: 'stake' | 'unstake'`, `amount`, optional `unstakeMode`), and `useBuildStakeTransaction` turns an accepted quote into a `TransactionRequest`. +The `StakingManager` routes each quote call and each build call to a single registered staking provider — by default the first one you registered, or the one you pass as `providerId`. `setDefaultProvider` on the manager overrides the default; an unknown `providerId` throws. A quote describes the intent (`direction: 'stake' | 'unstake'`, `amount`, optional `unstakeMode`), and `useBuildStakeTransaction` turns an accepted quote into a `TransactionRequest`. The protocol shape — derivative jetton, unstake modes, settlement timing, pool model — is provider-specific. Tonstakers, the bundled provider, issues `tsTON` and supports `INSTANT`, `WHEN_AVAILABLE`, and `ROUND_END` unstake modes. Read the user's staked-token balance with `useStakedBalance`, or query the jetton balance directly. `apy` and `instantUnstakeAvailable` from `useStakingProviderInfo` are provider-supplied display data, not guarantees of future yield or withdrawal timing. diff --git a/content/applications/walletkit/web/configure.mdx b/content/applications/walletkit/web/configure.mdx index dfcebb343..32435693f 100644 --- a/content/applications/walletkit/web/configure.mdx +++ b/content/applications/walletkit/web/configure.mdx @@ -327,6 +327,6 @@ For the minimum functional setup and initialization instructions, see [Get start ## Next steps -After configuring WalletKit, you can do this: +After configuring WalletKit, you can do this: - [Initialize a wallet](/applications/walletkit/web/init-wallet): This step is required for working with transactions. diff --git a/content/applications/walletkit/web/init.mdx b/content/applications/walletkit/web/init.mdx index 788c3896a..5cb23355a 100644 --- a/content/applications/walletkit/web/init.mdx +++ b/content/applications/walletkit/web/init.mdx @@ -82,7 +82,7 @@ To initialize WalletKit with the minimum required setup, take these steps: ``` - API providers allow WalletKit to read blockchain data — for example, to fetch account balances and query jettons and NFTs. API keys allow you to access to higher RPS limits. + API providers allow WalletKit to read blockchain data — for example, to fetch account balances and query jettons and NFTs. API keys allow you to access higher RPS limits. @@ -99,7 +99,7 @@ To initialize WalletKit with the minimum required setup, take these steps: In the previous step, you initialized WalletKit with the only required parameter: network configuration. There are also optional parameters you can pass on initialization — for a full list, see [Configure parameters](/applications/walletkit/web/configure). -It's useful to add some of the optional settings right away. Add them to the same TonWalletKit call from [Step 2](2-initialize-the-kit): +It's useful to add some of the optional settings right away. Add them to the same TonWalletKit call from [Step 2](#2-initialize-the-kit): - `deviceInfo`: Core information and constraints of the wallet. Specify the wallet version: @@ -117,10 +117,10 @@ It's useful to add some of the optional settings right away. Add them to the sam ``` - For other settings, WalletKit will use default values. This includes supported wallet features, the maximum supported TON Connect protocol version, the human-readable name of your wallet, and the current platform ('browser'). + For other settings, WalletKit will use default values. This includes supported wallet features, the maximum supported TON Connect protocol version, the human-readable name of your wallet, and the current platform ('browser'). -- `walletManifest`: The TON Connect's wallet manifest. To add it, call `createWalletManifest()`. This function provides initial defaults, but you may want to specify some custom values, such as the human-readable name of your wallet or its icon image URL. Learn more: [Manifest](/applications/ton-connect/core-concepts#manifest). +- `walletManifest`: The TON Connect's wallet manifest. To add it, call `createWalletManifest()`. This function provides initial defaults, but you may want to specify some custom values, such as the human-readable name of your wallet or its icon image URL. Learn more: [Manifest](/applications/ton-connect/core-concepts#manifest). ```ts title="TypeScript" import { diff --git a/content/applications/walletkit/web/staking.mdx b/content/applications/walletkit/web/staking.mdx index 919d0de48..c41196c28 100644 --- a/content/applications/walletkit/web/staking.mdx +++ b/content/applications/walletkit/web/staking.mdx @@ -24,7 +24,7 @@ You need a connected wallet and a staking provider registered on the WalletKit i By default, the provider is the first one you registered. To override it for a specific call, pass `providerId` to any method. To change the default globally, use `setDefaultProvider()`. Note that passing an unknown `providerId` throws an error. -WalletKit ships a bundled provider — **Tonstakers**, but you can configure a custom one. Extend the `StakingProvider` class. Implement `getQuote()`, `buildStakeTransaction()`, `getStakedBalance()`, `getStakingProviderInfo()`, and `getStakingProviderMetadata()`, and `getSupportedNetworks()`. +WalletKit ships a bundled provider — **Tonstakers**, but you can configure a custom one. Extend the `StakingProvider` class. Implement `getQuote()`, `buildStakeTransaction()`, `getStakedBalance()`, `getStakingProviderInfo()`, `getStakingProviderMetadata()`, and `getSupportedNetworks()`. ## Methods From 764c2ae917719e50f4da5f320979572959522e93 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Wed, 8 Jul 2026 11:37:31 +0200 Subject: [PATCH 5/5] Apply minor edits to unify `title`s for discoverability --- content/applications/walletkit/web/configure.mdx | 2 +- content/applications/walletkit/web/init-wallet.mdx | 7 +++---- content/applications/walletkit/web/staking.mdx | 2 +- content/applications/walletkit/web/wallets.mdx | 4 +--- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/content/applications/walletkit/web/configure.mdx b/content/applications/walletkit/web/configure.mdx index 32435693f..eea89b790 100644 --- a/content/applications/walletkit/web/configure.mdx +++ b/content/applications/walletkit/web/configure.mdx @@ -1,5 +1,5 @@ --- -title: "Configure WalletKit parameters" +title: "Configure WalletKit parameters on the Web platform" sidebarTitle: "Configure parameters" --- diff --git a/content/applications/walletkit/web/init-wallet.mdx b/content/applications/walletkit/web/init-wallet.mdx index 0612c7f29..94901132e 100644 --- a/content/applications/walletkit/web/init-wallet.mdx +++ b/content/applications/walletkit/web/init-wallet.mdx @@ -1,7 +1,6 @@ --- -title: "Initialize a TON wallet" +title: "Initialize a TON wallet with WalletKit on the Web platform" sidebarTitle: "Initialize a TON wallet" -description: "" --- @@ -220,7 +219,7 @@ Below, you can find complete sample codes for initializing a wallet with differe { type: 'ton', }, - ); + ); // 2. Create a wallet adapter const walletAdapter = await WalletV5R1Adapter.create(signer, { @@ -294,7 +293,7 @@ Below, you can find complete sample codes for initializing a wallet with differe client: kit.getApiClient(Network.mainnet()), }); - // 3. Initialize the wallet + // 3. Initialize the wallet const wallet = await kit.addWallet(walletAdapter); ``` diff --git a/content/applications/walletkit/web/staking.mdx b/content/applications/walletkit/web/staking.mdx index c41196c28..c109a5b31 100644 --- a/content/applications/walletkit/web/staking.mdx +++ b/content/applications/walletkit/web/staking.mdx @@ -1,5 +1,5 @@ --- -title: "Stake and unstake" +title: "Stake and unstake with WalletKit on the Web platform" sidebarTitle: "Stake and unstake" --- diff --git a/content/applications/walletkit/web/wallets.mdx b/content/applications/walletkit/web/wallets.mdx index 07c85035e..cfa9fa344 100644 --- a/content/applications/walletkit/web/wallets.mdx +++ b/content/applications/walletkit/web/wallets.mdx @@ -1,11 +1,9 @@ --- -title: "Manage TON wallets" +title: "Manage TON wallets with WalletKit on the Web platform" sidebarTitle: "Manage wallets" description: "" --- -## Overview - Before using examples on this page, [initialize WalletKit](/applications/walletkit/web/init) and [initialize a TON wallet](/applications/walletkit/web/init-wallet).