AppKit
Action
Balances
getBalance
Read the Toncoin balance of the currently selected wallet, returning null when no wallet is selected (use getBalanceByAddress for an arbitrary address).
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options | GetBalanceOptions | Optional network override. |
options.network | Network | Network to read the balance from. Defaults to the selected wallet's network. |
Returns: Promise<GetBalanceReturnType> — Balance in TON as a human-readable decimal string, or null when no wallet is selected.
Example
const balance = await getBalance(appKit);
if (balance) {
console.log('Balance:', balance);
}getBalanceByAddress
Read the Toncoin balance of an arbitrary address — useful for wallets that aren't selected in AppKit (use getBalance for the selected wallet).
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetBalanceByAddressOptions | Target address and optional network. |
options.address* | UserFriendlyAddress | Address | Wallet address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
options.network | Network | Network to read the balance from. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
Returns: Promise<GetBalanceByAddressReturnType> — Balance in TON as a human-readable decimal string.
Example
const balanceByAddress = await getBalanceByAddress(appKit, {
address: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
});
console.log('Balance by address:', balanceByAddress);watchBalance
Subscribe to Toncoin balance updates for the currently selected wallet, automatically rebinding whenever the selected wallet changes or the connected-wallets list updates (use watchBalanceByAddress for a fixed address). Requires a streaming provider registered for the network — call throws when none is configured. Use hasStreamingProvider to check first.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | WatchBalanceOptions | Update callback and optional network override. |
options.network | Network | Network to watch on. Defaults to the selected wallet's network. |
options.onChange* | (update: BalanceUpdate) => void | Callback fired on every balance update from the streaming provider. |
Returns: WatchBalanceReturnType — Unsubscribe function — call it to stop receiving updates.
Example
const unsubscribe = watchBalance(appKit, {
onChange: (update) => {
console.log('Balance updated:', update.balance);
},
});
// Later: unsubscribe();watchBalanceByAddress
Subscribe to Toncoin balance updates for an arbitrary address — useful for monitoring wallets that aren't selected in AppKit (use watchBalance for the selected wallet). Requires a streaming provider registered for the network — call throws when none is configured. Use hasStreamingProvider to check first.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | WatchBalanceByAddressOptions | Target address, update callback and optional network override. |
options.address* | UserFriendlyAddress | Address | Wallet address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
options.network | Network | Network to watch on. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
options.onChange* | (update: BalanceUpdate) => void | Callback fired on every balance update from the streaming provider. |
Returns: WatchBalanceByAddressReturnType — Unsubscribe function — call it to stop receiving updates.
Example
const unsubscribe = watchBalanceByAddress(appKit, {
address: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
onChange: (update) => {
console.log('Balance by address updated:', update.balance);
},
});
// Later: unsubscribe();Client
getApiClient
Read the ApiClient configured for a specific Network — throws when the network has no client registered.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetApiClientOptions | Network to look up. |
options.network* | Network | Network whose configured ApiClient should be returned. |
Returns: GetApiClientReturnType — The configured ApiClient for the requested network.
Example
const apiClient = getApiClient(appKit, {
network: Network.mainnet(),
});
console.log('API Client:', apiClient);Connectors
addConnector
Register a wallet connector at runtime — equivalent to passing it via AppKitConfig's connectors at construction, but available after AppKit is up.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
connector* | AddConnectorParameters | Connector instance or factory to register. |
Returns: AddConnectorReturnType — Function that unregisters the connector when called.
Example
const unregister = addConnector(
appKit,
createTonConnectConnector({
tonConnectOptions: {
manifestUrl: 'https://tonconnect-sdk-demo-dapp.vercel.app/tonconnect-manifest.json',
},
}),
);
// Later: unregister();connect
Trigger the connection flow on a registered connector by id — drives it against AppKit's default network (set via setDefaultNetwork). Throws when no connector with that id exists.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | ConnectParameters | Connector to connect through. |
parameters.connectorId* | string | ID of the registered connector to drive the connection through (e.g., 'tonconnect'). |
Returns: Promise<ConnectReturnType> — Resolves once the connector's connect flow completes. If a wallet was successfully connected, it becomes available via getSelectedWallet.
Example
await connect(appKit, {
connectorId: 'tonconnect',
});createConnector
Identity helper for typing a ConnectorFactory inline — returns the factory unchanged so authors get parameter inference without spelling the type out.
| Parameter | Type | Description |
|---|---|---|
factory* | ConnectorFactory | Factory to wrap. |
Returns: ConnectorFactory — The same factory, typed as ConnectorFactory.
createTonConnectConnector
Build a TonConnect-backed Connector for AppKit. Pass the result to AppKitConfig's connectors or addConnector.
| Parameter | Type | Description |
|---|---|---|
config* | TonConnectConnectorConfig | Connector ID, metadata override and TonConnect options or pre-built UI instance. |
config.id | string | Connector ID. Defaults to TONCONNECT_DEFAULT_CONNECTOR_ID ('tonconnect'). Set this when you need to register multiple TonConnect-flavoured connectors side by side. |
config.metadata | ConnectorMetadata | Display metadata override. Merged on top of TonConnect's default name and icon. |
config.tonConnectOptions | TonConnectUiCreateOptions | Options forwarded to the underlying TonConnectUI constructor (manifest URL, etc.). Ignored when tonConnectUI is supplied. |
config.tonConnectUI | TonConnectUI | Pre-built TonConnectUI instance to reuse. When set, the connector skips its own instantiation and tonConnectOptions is ignored. |
Returns: ConnectorFactory — Factory function consumed by AppKit at registration time.
Example
// 1. Create TonConnectUI instance
const tonConnectUI = new TonConnectUI({
manifestUrl: 'https://my-app.com/tonconnect-manifest.json',
});
// 2. Initialize AppKit
const appKit = new AppKit({
networks: {
[Network.mainnet().chainId]: {
apiClient: {
url: 'https://toncenter.com',
key: 'your-key',
},
},
},
connectors: [createTonConnectConnector({ tonConnectUI })],
});disconnect
Tear down the session on a registered connector — disconnects the wallet currently connected through it, if any. Throws when no connector with that id exists.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | DisconnectParameters | Connector to disconnect. |
parameters.connectorId* | string | ID of the registered connector whose wallet should be disconnected. |
Returns: Promise<DisconnectReturnType> — Resolves once the connector tears down its session.
Example
await disconnect(appKit, {
connectorId: 'tonconnect',
});getConnectorById
Look up a registered connector by its id.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetConnectorByIdOptions | ID of the connector to find. |
options.id* | string | ID of the connector to look up. |
Returns: GetConnectorByIdReturnType — The matching Connector, or undefined if none with that id is registered.
Example
const connector = getConnectorById(appKit, {
id: 'tonconnect',
});
if (connector) {
console.log('Found connector:', connector.id);
}getConnectors
List every connector registered on this AppKit instance — both those passed via AppKitConfig's connectors and those added later through addConnector.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
Returns: GetConnectorsReturnType — Read-only array of registered Connectors.
Example
const connectors = getConnectors(appKit);
connectors.forEach((connector) => {
console.log('Connector:', connector.id);
});watchConnectorById
Subscribe to register/unregister events for a connector with the given id — the callback fires when the connector is added or removed, so callers can react to its presence. Use watchConnectedWallets if you want to react to wallet connect/disconnect events instead.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | WatchConnectorByIdParameters | Connector ID and update callback. |
parameters.id* | string | ID of the connector to watch. |
parameters.onChange* | (connector: Connector | undefined) => void | Callback invoked when the connector with the watched id is registered or unregistered — receives the connector itself, or undefined when none is registered under that id. |
Returns: WatchConnectorByIdReturnType — Unsubscribe function — call it to stop receiving updates.
Example
const unsubscribe = watchConnectorById(appKit, {
id: 'tonconnect',
onChange: (connector) => {
console.log('Connector updated:', connector);
},
});
// Later: unsubscribe();watchConnectors
Subscribe to changes in the registered-connectors list — the callback fires when a connector is added (via addConnector or AppKit's constructor) or removed, and receives the current list. Use watchConnectedWallets if you want to react to wallet connect/disconnect events instead.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | WatchConnectorsParameters | Update callback. |
parameters.onChange* | (connectors: readonly Connector[]) => void | Callback invoked when the list of registered connectors changes — receives the current list. |
Returns: WatchConnectorsReturnType — Unsubscribe function — call it to stop receiving updates.
Example
const unsubscribe = watchConnectors(appKit, {
onChange: (connectors) => {
console.log('Connectors updated:', connectors);
},
});
// Later: unsubscribe();Crypto Onramp
createCryptoOnrampDeposit
Create a crypto-onramp deposit from a quote previously obtained via getCryptoOnrampQuote — the returned CryptoOnrampDeposit carries the address and amount the user must send on the source chain.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | CreateCryptoOnrampDepositOptions | Quote, refund address, and optional provider override. |
options.quote* | CryptoOnrampQuote<TQuoteMetadata = unknown> | Quote to execute the deposit against (contains recipientAddress and provider metadata) |
options.refundAddress* | string | Address to refund the crypto to in case of failure. |
options.providerOptions | TProviderOptions = unknown | Provider-specific options. |
options.providerId | string | Provider to create the deposit through. Defaults to quote.providerId, then to the default provider. |
Returns: CreateCryptoOnrampDepositReturnType — Deposit details the UI should show to the user (address, amount, optional memo/expiresAt).
createLayerswapProvider
Build a Layerswap-backed CryptoOnrampProvider for AppKit. Pass the result to AppKitConfig's providers or registerProvider.
| Parameter | Type | Description |
|---|---|---|
config | LayerswapProviderConfig | Optional LayerswapProviderConfig. Defaults are filled in for any field left undefined. |
Returns: ProviderFactory<LayerswapCryptoOnrampProvider>.
createSwapsXyzProvider
Build a swaps.xyz-backed CryptoOnrampProvider for AppKit. Pass the result to AppKitConfig's providers or registerProvider.
| Parameter | Type | Description |
|---|---|---|
config* | SwapsXyzProviderConfig | Configuration carrying the required apiKey plus optional URL/sender overrides. |
Returns: ProviderFactory<SwapsXyzCryptoOnrampProvider>.
getCryptoOnrampProvider
Get a registered crypto-onramp provider by id, or the default provider when no id is given. Throws when no provider matches — or when no id is passed and no default has been registered.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options | GetCryptoOnrampProviderOptions | Optional provider id. |
options.id | string | Provider ID to look up. When omitted, returns the registered default provider. |
Returns: GetCryptoOnrampProviderReturnType — The matching CryptoOnrampProviderInterface.
Example
const provider = getCryptoOnrampProvider(appKit, { id: 'layerswap' });
console.log('Crypto onramp provider:', provider.providerId);getCryptoOnrampProviders
List every crypto-onramp provider registered on this AppKit instance — both those passed via AppKitConfig's providers and those added later through registerProvider.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
Returns: GetCryptoOnrampProvidersReturnType — Array of registered CryptoOnrampProviderInterfaces.
Example
const providers = getCryptoOnrampProviders(appKit);
console.log(
'Registered crypto onramp providers:',
providers.map((p) => p.providerId),
);getCryptoOnrampQuote
Quote a crypto-to-TON onramp — given a source asset/chain and target TON asset, returns the rate, expected amount, and provider metadata needed to call createCryptoOnrampDeposit.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetCryptoOnrampQuoteOptions | Source asset, target asset, amount and optional provider override. |
options.amount* | string | Amount to onramp (either source or target crypto, depending on isSourceAmount) |
options.sourceCurrencyAddress* | string | Source crypto currency address (contract address or 0x0... for native) |
options.sourceChain* | string | Source chain identifier in CAIP-2 format (e.g. 'eip155:1' for Ethereum mainnet, 'eip155:42161' for Arbitrum One). Providers map this to their own chain identifiers internally. |
options.targetCurrencyAddress* | string | Target crypto currency address on TON (contract address or 0x0... for native) |
options.recipientAddress* | string | TON address that will receive the target crypto. |
options.refundAddress | string | Refund address for the source crypto. |
options.isSourceAmount | boolean | If true, amount is the source amount to spend. If false, amount is the target amount to receive. Defaults to true when omitted. |
options.providerOptions | TProviderOptions = unknown | Provider-specific options. |
options.providerId | string | Provider to quote against. Defaults to the registered default provider. |
Returns: GetCryptoOnrampQuoteReturnType — Quote with pricing details and the provider metadata required to create a deposit.
getCryptoOnrampStatus
Read the current status of a crypto-onramp deposit by id — typically polled until the result is 'success' or 'failed'.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetCryptoOnrampStatusOptions | Deposit id, originating provider id and optional provider override. |
options.depositId* | string | Deposit id. |
options.providerId* | string | Identifier of the provider that issued this deposit. |
Returns: GetCryptoOnrampStatusReturnType — Current CryptoOnrampStatus of the deposit.
watchCryptoOnrampProviders
Subscribe to crypto-onramp provider lifecycle — fires onChange whenever a new provider is registered or the default crypto-onramp provider switches.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | WatchCryptoOnrampProvidersParameters | Update callback. |
parameters.onChange* | () => void | Callback fired whenever a crypto-onramp provider is registered or the default crypto-onramp provider changes. |
Returns: WatchCryptoOnrampProvidersReturnType — Unsubscribe function — call it to stop receiving updates.
DeFi
registerProvider
Register a DeFi / onramp provider at runtime — equivalent to passing it via AppKitConfig's providers at construction, but available after AppKit is up. AppKit emits provider:registered, picked up by domain-specific subscribers like watchSwapProviders and watchCryptoOnrampProviders.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
provider* | RegisterProviderOptions | Provider instance or factory to register. |
Returns: void.
Example
registerProvider(
appKit,
createOmnistonProvider({
defaultSlippageBps: 100, // 1%
}),
);Jettons
createTransferJettonTransaction
Build a jetton transfer TransactionRequest for the selected wallet without sending it — useful when the UI needs to inspect or batch transactions before signing. Throws Error('Wallet not connected') if no wallet is currently selected.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | CreateTransferJettonTransactionParameters | Jetton, recipient, amount, decimals and optional comment. |
parameters.jettonAddress* | UserFriendlyAddress | Jetton master contract address being transferred. |
parameters.recipientAddress* | UserFriendlyAddress | Recipient who should receive the jettons. |
parameters.amount* | string | Amount in jetton units as a human-readable decimal string (e.g., "1.5"). |
parameters.jettonDecimals* | number | Decimals declared by the jetton master. Used to convert amount into raw smallest units. |
parameters.comment | string | Optional human-readable comment attached to the transfer. |
Returns: Promise<CreateTransferJettonTransactionReturnType> — Transaction request ready to pass to sendTransaction.
Example
const tx = await createTransferJettonTransaction(appKit, {
jettonAddress: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs',
recipientAddress: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
amount: '100', // 100 USDT
comment: 'Hello Jetton',
jettonDecimals: 6,
});
console.log('Transfer Transaction:', tx);getJettonBalance
Read a jetton balance for a given owner — derives the owner's jetton-wallet address from the master, then fetches and formats the balance using the supplied decimals.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetJettonBalanceOptions | Jetton master, owner address, decimals and optional network override. |
options.jettonAddress* | UserFriendlyAddress | Jetton master contract address (the token, not the user's wallet for it). |
options.ownerAddress* | UserFriendlyAddress | Owner of the jetton wallet — typically the connected user's address. |
options.jettonDecimals* | number | Decimals declared by the jetton master. Used to format the raw balance into a human-readable string. |
options.network | Network | Network to read the balance from. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
Returns: Promise<GetJettonBalanceReturnType> — Balance as a human-readable decimal string in the jetton's units.
Example
const selectedWallet = getSelectedWallet(appKit);
if (!selectedWallet) {
console.log('No wallet selected');
return;
}
const balance = await getJettonBalance(appKit, {
jettonAddress: 'EQDBE420tTQIkoWcZ9pEOTKY63WVmwyIl3hH6yWl0r_h51Tl',
ownerAddress: selectedWallet.getAddress(),
jettonDecimals: 6,
});
console.log('Jetton Balance:', balance);getJettonInfo
Fetch token metadata for a jetton master — name, symbol, decimals, image and description as reported by the indexer. Returns null when the indexer has no record for that master address.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetJettonInfoOptions | Jetton master address and optional network override. |
options.address* | UserFriendlyAddress | Jetton master contract address whose metadata is being fetched. |
options.network | Network | Network to query. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
Returns: Promise<GetJettonInfoReturnType> — Jetton metadata, or null if the indexer has no record.
Example
const info = await getJettonInfo(appKit, {
address: 'EQDBE420tTQIkoWcZ9pEOTKY63WVmwyIl3hH6yWl0r_h51Tl',
});
console.log('Jetton Info:', info);getJettonWalletAddress
Derive the jetton-wallet address for a given owner — the per-owner contract that actually holds the jetton balance for jettonAddress.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetJettonWalletAddressOptions | Jetton master, owner address and optional network override. |
options.jettonAddress* | UserFriendlyAddress | Jetton master contract address. |
options.ownerAddress* | UserFriendlyAddress | Owner whose jetton wallet should be derived. |
options.network | Network | Network to query. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
Returns: Promise<GetJettonWalletAddressReturnType> — User-friendly address of the owner's jetton wallet.
Example
const selectedWallet = getSelectedWallet(appKit);
if (!selectedWallet) {
console.log('No wallet selected');
return;
}
const address = await getJettonWalletAddress(appKit, {
jettonAddress: 'EQDBE420tTQIkoWcZ9pEOTKY63WVmwyIl3hH6yWl0r_h51Tl',
ownerAddress: selectedWallet.getAddress(),
});
console.log('Jetton Wallet Address:', address);getJettons
List jettons held by the currently selected wallet, returning null when no wallet is selected (use getJettonsByAddress for an arbitrary address).
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options | GetJettonsOptions | Optional network override and pagination. |
options.network | Network | Network to read jettons from. Defaults to the selected wallet's network. |
options.limit | number | Maximum number of jettons to return. |
options.offset | number | Number of jettons to skip before returning results — used for pagination. |
Returns: Promise<GetJettonsReturnType> — Jettons response for the selected wallet, or null when none is selected.
Example
const response = await getJettons(appKit);
if (!response) {
console.log('No wallet selected or no jettons found');
return;
}
console.log('Jettons:', response.jettons.length);
response.jettons.forEach((j) => console.log(`- ${j.info.name}: ${j.balance}`));getJettonsByAddress
List jettons held by an arbitrary address — useful for inspecting wallets that aren't selected in AppKit (use getJettons for the selected wallet). Raw balances are formatted with each jetton's declared decimals, and entries without decimals are dropped.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetJettonsByAddressOptions | Owner address, optional network override and pagination. |
options.address* | UserFriendlyAddress | Address | Owner address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
options.network | Network | Network to read the jettons from. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
options.limit | number | Maximum number of jettons to return. |
options.offset | number | Number of jettons to skip before returning results — used for pagination. |
Returns: Promise<GetJettonsByAddressReturnType> — Jettons response with formatted balances.
Example
const selectedWallet = getSelectedWallet(appKit);
if (!selectedWallet) {
console.log('No wallet selected');
return;
}
const response = await getJettonsByAddress(appKit, {
address: selectedWallet.getAddress(),
});
console.log('Jettons by Address:', response.jettons.length);
response.jettons.forEach((j) => console.log(`- ${j.info.name}: ${j.balance}`));transferJetton
Build and send a jetton transfer from the selected wallet in one step (use createTransferJettonTransaction + sendTransaction if you need to inspect the transaction first). Throws Error('Wallet not connected') if no wallet is currently selected.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | TransferJettonParameters | Jetton, recipient, amount, decimals and optional comment. |
parameters.jettonAddress* | UserFriendlyAddress | Jetton master contract address being transferred. |
parameters.recipientAddress* | UserFriendlyAddress | Recipient who should receive the jettons. |
parameters.amount* | string | Amount in jetton units as a human-readable decimal string (e.g., "1.5"). |
parameters.jettonDecimals* | number | Decimals declared by the jetton master. Used to convert amount into raw smallest units. |
parameters.comment | string | Optional human-readable comment attached to the transfer. |
Returns: Promise<TransferJettonReturnType> — Wallet response carrying the BoC of the sent transaction.
Example
const result = await transferJetton(appKit, {
jettonAddress: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs',
recipientAddress: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
amount: '100',
jettonDecimals: 6,
});
console.log('Transfer Result:', result);watchJettons
Subscribe to jetton-balance updates for the currently selected wallet, automatically rebinding when the user connects, switches, or disconnects (use watchJettonsByAddress for a fixed address). Requires a streaming provider registered for the network — call throws when none is configured. Use hasStreamingProvider to check first.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | WatchJettonsOptions | Update callback and optional network override. |
options.onChange* | (update: JettonUpdate) => void | Callback fired on every jetton-balance update from the streaming provider. |
options.network | Network | Network to watch on. Defaults to the selected wallet's network. |
Returns: WatchJettonsReturnType — Unsubscribe function — call it to stop receiving updates.
watchJettonsByAddress
Subscribe to jetton-balance updates for an arbitrary owner address (use watchJettons for the selected wallet). Requires a streaming provider registered for the network — call throws when none is configured. Use hasStreamingProvider to check first.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | WatchJettonsByAddressOptions | Owner address, update callback and optional network override. |
options.address* | UserFriendlyAddress | Address | Owner address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
options.onChange* | (update: JettonUpdate) => void | Callback fired on every jetton-balance update from the streaming provider. |
options.network | Network | Network to watch on. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
Returns: WatchJettonsByAddressReturnType — Unsubscribe function — call it to stop receiving updates.
NFTs
createTransferNftTransaction
Build an NFT transfer TransactionRequest for the selected wallet without sending it — useful when the UI needs to inspect or batch transactions before signing. Throws Error('Wallet not connected') if no wallet is currently selected.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | CreateTransferNftTransactionParameters | NFT, recipient, optional gas amount and comment. |
parameters.nftAddress* | UserFriendlyAddress | NFT contract address to transfer. |
parameters.recipientAddress* | UserFriendlyAddress | New owner address. |
parameters.amount | string | Amount of TON to attach to the transfer for gas. Defaults to AppKit's NFT gas-fee constant when omitted. |
parameters.comment | string | Optional human-readable comment attached to the transfer. |
Returns: Promise<CreateTransferNftTransactionReturnType> — Transaction request ready to pass to sendTransaction.
Example
const tx = await createTransferNftTransaction(appKit, {
nftAddress: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
recipientAddress: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
comment: 'Gift NFT',
});
console.log('NFT Transfer Transaction:', tx);getNft
Fetch metadata and ownership for a single NFT by its contract address. Returns null when the indexer has no record.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetNftOptions | NFT address and optional network override. |
options.address* | UserFriendlyAddress | Address | NFT contract address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
options.network | Network | Network to query. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
Returns: Promise<GetNftReturnType> — NFT data, or null if the indexer has no record.
Example
const nft = await getNft(appKit, {
address: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
});
if (nft) {
console.log('NFT Name:', nft.info?.name);
console.log('NFT Collection:', nft.collection?.name);
}getNfts
List NFTs held by the currently selected wallet, returning null when no wallet is selected (use getNftsByAddress for an arbitrary address).
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options | GetNftsOptions | Optional network override and pagination. |
options.network | Network | Network to read NFTs from. Defaults to the selected wallet's network. |
options.limit | number | Maximum number of NFTs to return. |
options.offset | number | Number of NFTs to skip before returning results — used for pagination. |
Returns: Promise<GetNftsReturnType> — NFTs response for the selected wallet, or null when none is selected.
Example
const response = await getNfts(appKit);
if (response) {
console.log('Total NFTs:', response.nfts.length);
response.nfts.forEach((nft) => console.log(`- ${nft.info?.name}`));
}getNftsByAddress
List NFTs held by an arbitrary address — useful for inspecting wallets that aren't selected in AppKit (use getNfts for the selected wallet).
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetNftsByAddressOptions | Owner address, optional network override and pagination. |
options.address* | UserFriendlyAddress | Address | Owner address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
options.network | Network | Network to read NFTs from. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
options.limit | number | Maximum number of NFTs to return. |
options.offset | number | Number of NFTs to skip before returning results — used for pagination. |
Returns: Promise<GetNftsByAddressReturnType> — NFTs response with the owner's items.
Example
const response = await getNftsByAddress(appKit, {
address: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
});
console.log('NFTs by address:', response.nfts.length);transferNft
Build and send an NFT transfer from the selected wallet in one step (use createTransferNftTransaction + sendTransaction if you need to inspect the transaction first). Throws Error('Wallet not connected') if no wallet is currently selected.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | TransferNftParameters | NFT, recipient, optional gas amount and comment. |
parameters.nftAddress* | UserFriendlyAddress | NFT contract address to transfer. |
parameters.recipientAddress* | UserFriendlyAddress | New owner address. |
parameters.amount | string | Amount of TON to attach to the transfer for gas. Defaults to AppKit's NFT gas-fee constant when omitted. |
parameters.comment | string | Optional human-readable comment attached to the transfer. |
Returns: Promise<TransferNftReturnType> — Wallet response carrying the BoC of the sent transaction.
Example
const result = await transferNft(appKit, {
nftAddress: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
recipientAddress: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
});
console.log('NFT Transfer Result:', result);Networks
getBlockNumber
Read the latest masterchain seqno (block number) for a network — useful for pagination cursors and freshness checks. Defaults to mainnet when no network is given.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options | GetBlockNumberOptions | Optional network override. |
options.network | Network | Network to query. Defaults to mainnet when omitted. |
Returns: Promise<GetBlockNumberReturnType> — Current masterchain seqno as a number.
Example
const blockNumber = await getBlockNumber(appKit);
console.log('Current block number:', blockNumber);getDefaultNetwork
Read AppKit's currently configured default network — the one connectors enforce on new wallet connections. undefined means any registered network is allowed.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
Returns: GetDefaultNetworkReturnType — The default Network, or undefined if none is set.
Example
const defaultNetwork = getDefaultNetwork(appKit);
console.log('Default network:', defaultNetwork);getNetwork
Read the Network the selected wallet is connected to, or null when no wallet is selected (use getDefaultNetwork for AppKit's configured default).
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
Returns: GetNetworkReturnType — Network of the selected wallet, or null when none is selected.
Example
const network = getNetwork(appKit);
if (network) {
console.log('Current network:', network);
}getNetworks
List every network configured on this AppKit instance via AppKitConfig's networks.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
Returns: GetNetworksReturnType — Array of configured Networks.
Example
const networks = getNetworks(appKit);
console.log('Configured networks:', networks);hasStreamingProvider
Check whether a streaming provider is registered for a network — required by watchBalance, watchJettons and other live-update actions.
Returns: HasStreamingProviderReturnType — true when a streaming provider is registered for that network.
Example
const isSupported = hasStreamingProvider(appKit, Network.mainnet());
console.log('Mainnet streaming support:', isSupported);setDefaultNetwork
Set or clear the default network — connectors enforce it on new wallet connections. Emits NETWORKS_EVENTS.DEFAULT_CHANGED so watchDefaultNetwork subscribers fire. Pass undefined to remove the constraint and allow any registered network.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | SetDefaultNetworkParameters | Network to enforce, or undefined to clear. |
parameters.network* | Network | undefined | Network to enforce on new wallet connections. Pass undefined to allow any registered network. |
Returns: SetDefaultNetworkReturnType.
Example
// Enforce testnet for all new wallet connections
setDefaultNetwork(appKit, { network: Network.testnet() });
// Allow any network (clear default)
setDefaultNetwork(appKit, { network: undefined });watchDefaultNetwork
Subscribe to default-network changes — fires when setDefaultNetwork is called.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | WatchDefaultNetworkParameters | Update callback. |
parameters.onChange* | (network: Network | undefined) => void | Callback fired whenever setDefaultNetwork updates the default — receives the new value (or undefined when cleared). |
Returns: WatchDefaultNetworkReturnType — Unsubscribe function — call it to stop receiving updates.
Example
const unsubscribe = watchDefaultNetwork(appKit, {
onChange: (network) => {
console.log('Default network changed:', network);
},
});
// Later: unsubscribe();watchNetworks
Subscribe to changes of the configured-networks list — fires when AppKit's network manager registers or replaces a network's API client.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | WatchNetworksParameters | Update callback. |
parameters.onChange* | (networks: Network[]) => void | Callback fired whenever the configured-networks list changes — receives the latest snapshot. |
Returns: WatchNetworksReturnType — Unsubscribe function — call it to stop receiving updates.
Example
const unsubscribe = watchNetworks(appKit, {
onChange: (networks) => {
console.log('Networks updated:', networks);
},
});
// Later: unsubscribe();Signing
signBinary
Ask the selected wallet to sign a binary blob. Throws Error('Wallet not connected') if no wallet is currently selected.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | SignBinaryParameters | Binary content and optional network override. |
parameters.bytes* | Base64String | Binary blob the user is asked to sign, encoded as Base64. |
parameters.network | Network | Network to issue the sign request against. Defaults to AppKit's configured default network. When none is set, the wallet falls back to its current network. |
Returns: Promise<SignBinaryReturnType> — Signature and signed payload, as returned by the wallet.
Example
// Example: sign "Hello" in base64
const result = await signBinary(appKit, {
bytes: 'SGVsbG8=' as Base64String,
});
console.log('Binary Signature:', result.signature);signCell
Ask the selected wallet to sign a TON cell — typically used so the signature can later be verified on-chain. Throws Error('Wallet not connected') if no wallet is currently selected.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | SignCellParameters | Cell content, TL-B schema and optional network override. |
parameters.cell* | Base64String | TON cell content encoded as Base64 (BoC). |
parameters.schema* | string | TL-B-style schema describing the cell layout so the wallet can render the payload to the user. |
parameters.network | Network | Network to issue the sign request against. Defaults to AppKit's configured default network. When none is set, the wallet falls back to its current network. |
Returns: Promise<SignCellReturnType> — Signature and signed payload, as returned by the wallet.
Example
const result = await signCell(appKit, {
cell: 'te6ccgEBAQEAAgAAGA==' as Base64String, // Example BoC
schema: 'transfer#abc123 amount:uint64 = Transfer',
});
console.log('Cell Signature:', result.signature);signText
Ask the selected wallet to sign a plain text message. Throws Error('Wallet not connected') if no wallet is currently selected.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | SignTextParameters | Text to sign and optional network override. |
parameters.text* | string | UTF-8 text the user is asked to sign. |
parameters.network | Network | Network to issue the sign request against. Defaults to AppKit's configured default network. When none is set, the wallet falls back to its current network. |
Returns: Promise<SignTextReturnType> — Signature and signed payload, as returned by the wallet.
Example
const result = await signText(appKit, {
text: 'Hello, TON!',
});
console.log('Signature:', result.signature);Staking
buildStakeTransaction
Build a TransactionRequest that executes a stake or unstake previously quoted by getStakingQuote — returns it without sending so the UI can inspect or batch before signing.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | BuildStakeTransactionOptions | Quote and optional provider override. |
options.quote* | StakingQuote | The staking quote based on which the transaction is built. |
options.userAddress* | UserFriendlyAddress | Address of the user performing the staking. |
options.providerOptions | TProviderOptions = unknown | Provider-specific options. |
options.providerId | string | Provider to stake/unstake through. Defaults to the registered default staking provider. |
Returns: BuildStakeTransactionReturnType — Transaction request ready to pass to sendTransaction.
Example
const txRequest = await buildStakeTransaction(appKit, {
quote,
userAddress,
});
console.log('Stake Transaction:', txRequest);createTonstakersProvider
Build a Tonstakers-backed StakingProvider for AppKit. Pass the result to AppKitConfig's providers or registerProvider.
| Parameter | Type | Description |
|---|---|---|
config | TonStakersProviderConfig | Optional TonStakersProviderConfig. Defaults are filled in for any field left undefined. |
Returns: (ctx: ProviderFactoryContext) => TonStakersStakingProvider.
getStakedBalance
Read a user's staked balance from a staking provider — total staked plus, depending on the provider, any instant-unstake balance available right now.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetStakedBalanceOptions | Owner address and optional network/provider override. |
options.userAddress* | UserFriendlyAddress | Owner whose staked balance should be read. |
options.network | Network | Network to query. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
options.providerId | string | Provider to query. Defaults to the registered default staking provider. |
Returns: GetStakedBalanceReturnType — Staked-balance breakdown (StakingBalance) for the user on the resolved network/provider.
Example
const balance = await getStakedBalance(appKit, {
userAddress,
});
console.log('Staked Balance:', balance);getStakingManager
Read AppKit's StakingManager — the runtime that owns registered staking providers and dispatches quote/stake/balance calls. Apps usually use the higher-level actions (getStakingQuote, buildStakeTransaction, getStakedBalance) instead of touching the manager directly.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
Returns: GetStakingManagerReturnType — The StakingManager bound to this AppKit instance.
getStakingProvider
Get a registered staking provider by id, or the default staking provider when no id is given. Throws when no provider matches — or when no id is passed and no default has been registered.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options | GetStakingProviderOptions | Optional provider id. |
options.id | string | Provider ID to look up. When omitted, returns the registered default staking provider. |
Returns: GetStakingProviderReturnType — The matching staking provider instance.
getStakingProviderInfo
Read live staking-pool info for a provider — APY, instant-unstake liquidity and (for liquid staking) the current exchange rate between stake and receive tokens. Use getStakingProviderMetadata for static metadata (display name, stake/receive tokens, supported unstake modes).
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options | GetStakingProviderInfoOptions | Optional network and provider override. |
options.network | Network | Network whose staking pool should be inspected. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
options.providerId | string | Provider to query. Defaults to the registered default staking provider. |
Returns: GetStakingProviderInfoReturnType — Live staking-provider info for the resolved network.
Example
const providerInfo = await getStakingProviderInfo(appKit, {
providerId: 'tonstakers',
});
console.log('Provider Info:', providerInfo);getStakingProviderMetadata
Read static metadata for a staking provider — display name, stake/receive tokens, supported unstake modes, contract address. Use getStakingProviderInfo for live values (APY, instant-unstake liquidity, exchange rate).
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options | GetStakingProviderMetadataOptions | Optional network and provider override. |
options.network | Network | Network whose provider metadata should be read. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
options.providerId | string | Provider to query. Defaults to the registered default staking provider. |
Returns: GetStakingProviderMetadataReturnType — Static StakingProviderMetadata for the resolved provider.
Example
const providerMetadata = getStakingProviderMetadata(appKit, {
providerId: 'tonstakers',
});
console.log('Provider Metadata:', providerMetadata);getStakingProviders
List every staking provider registered on this AppKit instance — both those passed via AppKitConfig's providers and those added later through registerProvider.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
Returns: GetStakingProvidersReturnType — Array of registered staking providers.
Example
const providers = getStakingProviders(appKit);
console.log('Available Staking Providers:', providers);getStakingQuote
Quote a stake or unstake — given the amount, direction and target asset, returns the rate, expected output and provider metadata needed to call buildStakeTransaction.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetStakingQuoteOptions | Quote parameters and optional provider override. |
options.direction* | StakingQuoteDirection | Direction of the quote (stake or unstake) |
options.amount* | string | Amount of tokens to stake or unstake. |
options.userAddress | UserFriendlyAddress | Address of the user. |
options.network | Network | Network on which the staking will be executed. |
options.unstakeMode | UnstakeModes | Unstake-timing mode the quote should target — see UnstakeMode for the supported flavours ('INSTANT', 'WHEN_AVAILABLE', 'ROUND_END'). Only meaningful when direction === 'unstake' and the provider lists the mode in supportedUnstakeModes. |
options.isReversed | boolean | If true, for unstake requests the amount is specified in the staking coin (e.g. TON) instead of the Liquid Staking Token (e.g. tsTON). |
options.providerOptions | TProviderOptions = unknown | Provider-specific options. |
options.providerId | string | Provider to quote against. Defaults to the registered default staking provider. |
Returns: GetStakingQuoteReturnType — Quote with pricing details and provider metadata.
Example
const quote = await getStakingQuote(appKit, {
amount: '1000000000',
direction: 'stake',
});
console.log('Staking Quote:', quote);setDefaultStakingProvider
Set the default staking provider — subsequent getStakingQuote and buildStakeTransaction calls without an explicit providerId route through it. Emits provider:default-changed, picked up by watchStakingProviders.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | SetDefaultStakingProviderParameters | ID of the provider to make default. |
parameters.providerId* | string | ID of the provider to make default — must already be registered. |
Returns: SetDefaultStakingProviderReturnType.
watchStakingProviders
Subscribe to staking provider lifecycle — fires onChange whenever a new provider is registered or the default staking provider switches.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | WatchStakingProvidersParameters | Update callback. |
parameters.onChange* | () => void | Callback fired whenever a staking provider is registered or the default staking provider changes. |
Returns: WatchStakingProvidersReturnType — Unsubscribe function — call it to stop receiving updates.
Swap
buildSwapTransaction
Build a TransactionRequest that executes a swap previously quoted by getSwapQuote — returns it without sending so the UI can inspect or batch before signing.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | BuildSwapTransactionOptions | Quote and provider-specific options. |
options.quote* | SwapQuote | The swap quote based on which the transaction is built. |
options.userAddress* | UserFriendlyAddress | Address of the user performing the swap. |
options.destinationAddress | UserFriendlyAddress | Address to receive the swapped tokens (defaults to userAddress) |
options.slippageBps | number | Slippage tolerance in basis points (1 bp = 0.01%) |
options.deadline | number | Unix timestamp (in seconds) after which the swap transaction must not be executed. |
options.providerOptions | TProviderOptions = unknown | Provider-specific options. |
Returns: BuildSwapTransactionReturnType — Transaction request ready to pass to sendTransaction.
Example
const transactionRequest = await buildSwapTransaction(appKit, {
quote,
userAddress: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
slippageBps: 100, // 1%
});
const transactionResponse = await sendTransaction(appKit, transactionRequest);
console.log('Swap Transaction:', transactionResponse);createDeDustProvider
Build a DeDust-backed SwapProvider for AppKit. Pass the result to AppKitConfig's providers or registerProvider.
| Parameter | Type | Description |
|---|---|---|
config | DeDustSwapProviderConfig | Optional DeDustSwapProviderConfig. Defaults are filled in for any field left undefined. |
Returns: (ctx: ProviderFactoryContext) => DeDustSwapProvider.
createOmnistonProvider
Build an Omniston-backed SwapProvider for AppKit. Pass the result to AppKitConfig's providers or registerProvider.
| Parameter | Type | Description |
|---|---|---|
config | OmnistonSwapProviderConfig | Optional OmnistonSwapProviderConfig. Defaults are filled in for any field left undefined. |
Returns: (ctx: ProviderFactoryContext) => OmnistonSwapProvider.
getSwapManager
Read AppKit's SwapManager — the runtime that owns registered swap providers and dispatches quote/build calls. Apps usually use the higher-level actions (getSwapQuote, buildSwapTransaction) instead of touching the manager directly.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
Returns: GetSwapManagerReturnType — The SwapManager bound to this AppKit instance.
Example
const swapManager = getSwapManager(appKit);getSwapProvider
Get a registered swap provider by id, or the default swap provider when no id is given. Throws when no provider matches — or when no id is passed and no default has been registered.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options | GetSwapProviderOptions | Optional provider id. |
options.id | string | Provider ID to look up. When omitted, returns the registered default swap provider. |
Returns: GetSwapProviderReturnType — The matching swap provider instance.
Example
const swapProvider = getSwapProvider(appKit, { id: 'stonfi' });getSwapProviders
List every swap provider registered on this AppKit instance — both those passed via AppKitConfig's providers and those added later through registerProvider.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
Returns: GetSwapProvidersReturnType — Array of registered swap providers.
Example
const swapProviders = getSwapProviders(appKit);
console.log(
'Registered providers:',
swapProviders.map((p) => p.providerId),
);getSwapQuote
Quote a swap — given source/target tokens and an amount, returns the rate, expected output and provider metadata needed to call buildSwapTransaction.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | GetSwapQuoteOptions | Source and target tokens, amount, optional network and provider override. |
options.amount* | string | Amount of tokens to swap (incoming or outgoing depending on isReverseSwap) |
options.from* | SwapToken | Token to swap from. |
options.to* | SwapToken | Token to swap to. |
options.network* | Network | Network on which the swap will be executed. |
options.slippageBps | number | Slippage tolerance in basis points (1 bp = 0.01%) |
options.maxOutgoingMessages | number | Maximum number of outgoing messages |
options.providerOptions | TProviderOptions = unknown | Provider-specific options. |
options.isReverseSwap | boolean | If true, amount is the amount to receive (buy). If false, amount is the amount to spend (sell). |
options.providerId | string | Provider to quote against. Defaults to the registered default swap provider. |
Returns: GetSwapQuoteReturnType — Quote with pricing details and the provider metadata required to build a transaction.
Example
const quote = await getSwapQuote(appKit, {
from: {
address: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs',
decimals: 6,
},
to: { address: 'ton', decimals: 9 },
amount: '1000000000', // nanotons as string
network: Network.mainnet(),
});
console.log('Swap Quote:', quote);setDefaultSwapProvider
Set the default swap provider — subsequent getSwapQuote and buildSwapTransaction calls without an explicit providerId route through it. Emits provider:default-changed, picked up by watchSwapProviders.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | SetDefaultSwapProviderParameters | ID of the provider to make default. |
parameters.providerId* | string | ID of the provider to make default — must already be registered. |
Returns: SetDefaultSwapProviderReturnType.
Example
setDefaultSwapProvider(appKit, { providerId: 'stonfi' });watchSwapProviders
Subscribe to swap provider lifecycle — fires onChange whenever a new provider is registered or the default swap provider switches.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | WatchSwapProvidersParameters | Update callback. |
parameters.onChange* | () => void | Callback fired whenever a swap provider is registered or the default swap provider changes. |
Returns: WatchSwapProvidersReturnType — Unsubscribe function — call it to stop receiving updates.
Example
const unsubscribe = watchSwapProviders(appKit, {
onChange: () => console.log('Swap providers updated'),
});
unsubscribe();Transactions
createTransferTonTransaction
Build a TON transfer TransactionRequest for the selected wallet without sending it — useful when the UI needs to inspect or batch transactions before signing. Throws Error('Wallet not connected') if no wallet is currently selected.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | CreateTransferTonTransactionParameters | Recipient, amount and optional payload/comment/stateInit. |
parameters.recipientAddress* | UserFriendlyAddress | Recipient address. |
parameters.amount* | string | Amount in TON as a human-readable decimal string (e.g., "1.5"). Converted to nano-TON internally. |
parameters.comment | string | Human-readable text comment. Converted to a Base64 payload when no payload is supplied. |
parameters.payload | Base64String | Raw Base64 message payload — wins over comment when both are set. |
parameters.stateInit | Base64String | Initial state for deploying a new contract, encoded as Base64. |
Returns: CreateTransferTonTransactionReturnType — Transaction request ready to pass to sendTransaction.
Example
const tx = createTransferTonTransaction(appKit, {
recipientAddress: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
amount: '0.1', // 0.1 TON (human-readable format)
comment: 'Draft transaction',
});
console.log('Transaction Request:', tx);getTransactionStatus
Read the status of a sent transaction by its BoC or normalized hash. In TON a single external message triggers a tree of internal messages — the transaction is 'completed' only when the entire trace finishes. Until then it stays 'pending'. Throws when neither boc nor normalizedHash is provided.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | GetTransactionStatusParameters | Exactly one of boc or normalizedHash, plus an optional network override. |
Returns: Promise<GetTransactionStatusReturnType> — Status response with current state, completed/total message counts and trace details.
sendTransaction
Hand a pre-built TransactionRequest to the selected wallet for signing and broadcast — usually the second step after createTransferTonTransaction, buildSwapTransaction or buildStakeTransaction. Throws Error('Wallet not connected') if no wallet is currently selected.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | SendTransactionParameters | Transaction request to broadcast. |
Returns: Promise<SendTransactionReturnType> — Wallet response carrying the BoC of the sent transaction.
Example
const result = await sendTransaction(appKit, {
messages: [
{
address: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
amount: '100000000', // 0.1 TON in nanotons (raw format)
},
],
});
console.log('Transaction Result:', result);transferTon
Build and send a TON transfer from the selected wallet in one step (use createTransferTonTransaction + sendTransaction if you need to inspect the transaction first). Throws Error('Wallet not connected') if no wallet is currently selected.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | TransferTonParameters | Recipient, amount and optional payload/comment/stateInit. |
parameters.recipientAddress* | UserFriendlyAddress | Recipient address. |
parameters.amount* | string | Amount in TON as a human-readable decimal string (e.g., "1.5"). Converted to nano-TON internally. |
parameters.comment | string | Human-readable text comment. Converted to a Base64 payload when no payload is supplied. |
parameters.payload | Base64String | Raw Base64 message payload — wins over comment when both are set. |
parameters.stateInit | Base64String | Initial state for deploying a new contract, encoded as Base64. |
Returns: Promise<TransferTonReturnType> — Wallet response carrying the BoC of the sent transaction.
Example
const result = await transferTon(appKit, {
recipientAddress: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
amount: '0.1', // 0.1 TON (human-readable format)
comment: 'Hello from AppKit!',
});
console.log('Transfer Result:', result);watchTransactions
Subscribe to incoming-transaction events for the currently selected wallet, automatically rebinding when the user connects, switches, or disconnects (use watchTransactionsByAddress for a fixed address). Requires a streaming provider registered for the network — call throws when none is configured. Use hasStreamingProvider to check first.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | WatchTransactionsOptions | Update callback and optional network override. |
options.onChange* | (update: TransactionsUpdate) => void | Callback fired on every transactions update from the streaming provider. |
options.network | Network | Network to watch on. Defaults to the selected wallet's network. |
Returns: WatchTransactionsReturnType — Unsubscribe function — call it to stop receiving updates.
watchTransactionsByAddress
Subscribe to incoming-transaction events for an arbitrary address (use watchTransactions for the selected wallet). Requires a streaming provider registered for the network — call throws when none is configured. Use hasStreamingProvider to check first.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
options* | WatchTransactionsByAddressOptions | Address, update callback and optional network override. |
options.address* | UserFriendlyAddress | Address | Address to watch — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
options.onChange* | (update: TransactionsUpdate) => void | Callback fired on every transactions update from the streaming provider. |
options.network | Network | Network to watch on. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
Returns: WatchTransactionsByAddressReturnType — Unsubscribe function — call it to stop receiving updates.
Wallets
getConnectedWallets
List every wallet currently connected through any registered Connector.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
Returns: GetConnectedWalletsReturnType — Read-only array of WalletInterfaces.
Example
const wallets = getConnectedWallets(appKit);
console.log('Connected wallets:', wallets);getSelectedWallet
Read the wallet AppKit treats as "active" — most actions (getBalance, signText, transferTon) target this wallet implicitly. Returns null when no wallet is connected or selected.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
Returns: GetSelectedWalletReturnType — Selected WalletInterface, or null when none is selected.
Example
const wallet = getSelectedWallet(appKit);
if (wallet) {
console.log('Selected wallet:', wallet.getWalletId());
console.log('Address:', wallet.getAddress());
}setSelectedWalletId
Switch which connected wallet AppKit treats as selected — emits WALLETS_EVENTS.SELECTION_CHANGED so watchSelectedWallet subscribers fire. Pass null to clear the selection.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | SetSelectedWalletIdParameters | Wallet ID to select, or null to clear. |
parameters.walletId* | string | null | Wallet ID (as returned by WalletInterface's getWalletId()) to select. Pass null to clear the selection. |
Returns: SetSelectedWalletIdReturnType.
Example
setSelectedWalletId(appKit, {
walletId: 'my-wallet-id',
});watchConnectedWallets
Subscribe to the list of connected wallets — fires whenever a wallet connects or disconnects through any registered Connector.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | WatchConnectedWalletsParameters | Update callback. |
parameters.onChange* | (wallets: WalletInterface[]) => void | Callback fired whenever the list of connected wallets changes — receives the latest snapshot. |
Returns: WatchConnectedWalletsReturnType — Unsubscribe function — call it to stop receiving updates.
Example
const unsubscribe = watchConnectedWallets(appKit, {
onChange: (wallets) => {
console.log('Connected wallets updated:', wallets.length);
},
});
// Later: unsubscribe();watchSelectedWallet
Subscribe to selected-wallet changes — fires when setSelectedWalletId runs, when the wallet manager auto-selects the first wallet because no prior selection survived a connector update, or when it clears the selection because no connected wallets remain.
| Parameter | Type | Description |
|---|---|---|
appKit* | AppKit | Runtime instance. |
parameters* | WatchSelectedWalletParameters | Update callback. |
parameters.onChange* | (wallet: WalletInterface | null) => void | Callback fired whenever the selected wallet changes — receives the new wallet, or null when the selection was cleared. |
Returns: WatchSelectedWalletReturnType — Unsubscribe function — call it to stop receiving updates.
Example
const unsubscribe = watchSelectedWallet(appKit, {
onChange: (wallet) => {
if (wallet) {
console.log('Selected wallet changed:', wallet.getWalletId());
} else {
console.log('Wallet deselected');
}
},
});
// Later: unsubscribe();Class
Client
ApiClientTonApi
ApiClient implementation backed by the TonAPI indexer.
Constructor: new ApiClientTonApi(config)
| Parameter | Type | Description |
|---|---|---|
config | BaseApiClientConfig | TonAPI client config — endpoint URL and API key. Defaults to TonAPI mainnet/testnet URLs based on config.network. |
config.endpoint | string | Base URL of the indexer endpoint. Defaults to the provider's mainnet/testnet URL based on network. |
config.apiKey | string | API key forwarded to the indexer for higher rate limits. |
config.timeout | number | Per-request timeout in milliseconds. Defaults to a provider-specific value. |
config.fetchApi | typeof fetch | Custom fetch implementation. Defaults to the global fetch. |
config.network | Network | Network the client should target. Determines the default endpoint when one isn't supplied. |
config.disableNetworkSend | boolean | When true, swallow sendBoc calls instead of broadcasting them — useful for local development and tests. |
ApiClientToncenter
ApiClient implementation backed by the Toncenter API.
Constructor: new ApiClientToncenter(config)
| Parameter | Type | Description |
|---|---|---|
config | ApiClientToncenterConfig | Toncenter client config — endpoint URL, API key and optional DNS resolver override. Defaults to mainnet/testnet Toncenter URLs based on config.network. |
config.dnsResolver | string | Override the contract address used to resolve TON DNS records. Defaults to the network's standard root resolver. |
config.endpoint | string | Base URL of the indexer endpoint. Defaults to the provider's mainnet/testnet URL based on network. |
config.apiKey | string | API key forwarded to the indexer for higher rate limits. |
config.timeout | number | Per-request timeout in milliseconds. Defaults to a provider-specific value. |
config.fetchApi | typeof fetch | Custom fetch implementation. Defaults to the global fetch. |
config.network | Network | Network the client should target. Determines the default endpoint when one isn't supplied. |
config.disableNetworkSend | boolean | When true, swallow sendBoc calls instead of broadcasting them — useful for local development and tests. |
Core
AppKit
Runtime that wires connectors, networks, providers and the event emitter for a TON dApp. Construct once at startup and reuse for the app's lifetime.
Constructor: new AppKit(config)
| Parameter | Type | Description |
|---|---|---|
config* | AppKitConfig | Networks, connectors, providers and runtime flags. |
config.networks | NetworkAdapters | Map of chain ID to NetworkConfig (which holds the api-client setup). If omitted, AppKit defaults to mainnet only. |
config.connectors | ConnectorInput[] | Wallet connectors registered at startup. |
config.defaultNetwork | Network | Default network. |
config.providers | ProviderInput[] | Providers registered at startup. |
Example
// Initialize AppKit
const appKit = new AppKit({
networks: {
[Network.mainnet().chainId]: {
apiClient: {
url: 'https://toncenter.com',
key: 'your-key',
},
},
// Optional: add testnet
// [Network.testnet().chainId]: {
// apiClient: {
// url: 'https://testnet.toncenter.com',
// key: 'your-key',
// },
// },
},
connectors: [
createTonConnectConnector({
tonConnectOptions: {
manifestUrl: 'https://tonconnect-sdk-demo-dapp.vercel.app/tonconnect-manifest.json',
},
}),
],
});EventEmitter
Strongly-typed event emitter built on a string event name → payload type map. Type of appKit.emitter and the base for any custom emitters apps create. See AppKitEvents for the full list of events AppKit emits. appKit.emitter.on(name, handler) returns an unsubscribe function.
Constructor: new EventEmitter()
Crypto Onramp
CryptoOnrampError
Error thrown by CryptoOnrampManager and crypto-onramp providers — extends DefiError with name: 'CryptoOnrampError' and a typed CryptoOnrampErrorCode on code.
Constructor: new CryptoOnrampError(message, code, details)
| Parameter | Type | Description |
|---|---|---|
message* | string | Human-readable description, forwarded to Error. |
code* | CryptoOnrampErrorCode | Stable error code for branching logic. |
details | unknown | Optional provider-specific context for diagnostics. |
CryptoOnrampManager
Runtime that owns registered CryptoOnrampProviders and dispatches quote/deposit/status calls. Usually accessed through the higher-level actions (getCryptoOnrampQuote, createCryptoOnrampDeposit, getCryptoOnrampStatus).
Constructor: new CryptoOnrampManager()
CryptoOnrampProvider
Abstract base class implemented by crypto-onramp providers (Layerswap, swaps.xyz, custom integrations). Apps don't use it directly — they consume providers through CryptoOnrampManager and the getCryptoOnramp* / createCryptoOnrampDeposit actions.
Constructor: new CryptoOnrampProvider()
LayerswapCryptoOnrampProvider
CryptoOnrampProvider implementation backed by Layerswap. Prefer the createLayerswapProvider factory over instantiating this class directly — the factory returns a ProviderInput ready to pass to AppKitConfig's providers or registerProvider.
Constructor: new LayerswapCryptoOnrampProvider(config)
| Parameter | Type | Description |
|---|---|---|
config | LayerswapProviderConfig | Optional LayerswapProviderConfig. Defaults are filled in for any field left undefined. |
config.apiKey | string | Optional API key. Forwarded as X-LS-APIKEY when provided. |
config.apiUrl | string | Override the base API URL. Defaults to https://api.layerswap.io/api/v2 (see Layerswap API V2). |
SwapsXyzCryptoOnrampProvider
CryptoOnrampProvider implementation backed by swaps.xyz. Prefer the createSwapsXyzProvider factory over instantiating this class directly — the factory returns a ProviderInput ready to pass to AppKitConfig's providers or registerProvider.
Constructor: new SwapsXyzCryptoOnrampProvider(config)
| Parameter | Type | Description |
|---|---|---|
config* | SwapsXyzProviderConfig | Configuration carrying the required apiKey plus optional URL/sender overrides. |
config.apiKey* | string | API key issued by swaps.xyz (passed as x-api-key) |
config.apiUrl | string | Override the base API URL. Defaults to https://api-v2.swaps.xyz/api (see Swaps API Documentation. |
config.defaultSender | string | EVM address used as sender on getAction requests. Required by the API even for deposit flows where the actual payer is unknown. Defaults to a null address when omitted. |
DeFi
DefiError
Base error thrown across all DeFi domains (swap, staking, onramp, crypto-onramp). Subclassed by SwapError, StakingError, CryptoOnrampError and the internal onramp error — catch the base when you don't care which domain produced the failure.
Constructor: new DefiError(message, code, details)
| Parameter | Type | Description |
|---|---|---|
message* | string | Human-readable description, forwarded to Error. |
code* | DefiErrorCode | Stable error code for branching logic. |
details | unknown | Optional provider-specific context for diagnostics. |
Networks
AppKitNetworkManager
Network manager that extends walletkit's KitNetworkManager with a default-network setter and AppKit event emission. Usually accessed through the higher-level actions (getDefaultNetwork, setDefaultNetwork, watchDefaultNetwork, getNetworks, watchNetworks).
Constructor: new AppKitNetworkManager(options, emitter)
| Parameter | Type | Description |
|---|---|---|
options* | TonWalletKitOptions | Forwarded to the KitNetworkManager base — chiefly the networks map keyed by chain ID. |
emitter* | AppKitEmitter | Emitter the manager publishes networks:default-changed / networks:updated events through. |
KitNetworkManager
Walletkit-side network manager that AppKitNetworkManager extends, adding default-network state and AppKit event emission. Apps usually interact with the AppKitNetworkManager subclass.
Constructor: new KitNetworkManager(options)
| Parameter | Type | Description |
|---|---|---|
options* | TonWalletKitOptions | Configuration carrying the networks map keyed by chain ID. At least one network must be configured. |
Staking
StakingError
Error thrown by StakingManager and staking providers — extends DefiError with name: 'StakingError' and a typed StakingErrorCode on code.
Constructor: new StakingError(message, code, details)
| Parameter | Type | Description |
|---|---|---|
message* | string | Human-readable description, forwarded to Error. |
code* | StakingErrorCode | Stable error code for branching logic. |
details | unknown | Optional provider-specific context for diagnostics. |
StakingManager
Runtime that owns registered StakingProviders and dispatches quote/stake/balance calls. Usually accessed through the higher-level actions (getStakingQuote, buildStakeTransaction, getStakedBalance).
Constructor: new StakingManager(createFactoryContext)
| Parameter | Type | Description |
|---|---|---|
createFactoryContext* | () => ProviderFactoryContext | Lazy provider of the ProviderFactoryContext the manager passes into provider factories at registration time. |
StakingProvider
Abstract base class implemented by staking providers (Tonstakers, custom integrations, …). Apps don't use it directly — they consume providers through StakingManager and the getStaking* / buildStakeTransaction actions.
Constructor: new StakingProvider(providerId)
| Parameter | Type | Description |
|---|---|---|
providerId* | string | Stable id the provider registers with — must be unique within StakingManager. |
TonStakersStakingProvider
StakingProvider implementation backed by Tonstakers. The constructor is private — always go through the createTonstakersProvider factory and pass the result to AppKitConfig's providers or registerProvider.
Constructor: new TonStakersStakingProvider()
Swap
DeDustSwapProvider
SwapProvider implementation backed by DeDust. Prefer the createDeDustProvider factory over instantiating this class directly — the factory returns a ProviderInput ready to pass to AppKitConfig's providers or registerProvider.
Constructor: new DeDustSwapProvider(config)
| Parameter | Type | Description |
|---|---|---|
config | DeDustSwapProviderConfig | Optional DeDustSwapProviderConfig. Defaults are filled in for any field left undefined. |
config.providerId | string | Custom provider ID (defaults to 'dedust') |
config.defaultSlippageBps | number | Default slippage tolerance in basis points (1 bp = 0.01%) |
config.apiUrl | string | API base URL |
config.onlyVerifiedPools | boolean | Only use verified pools |
config.maxSplits | number | Maximum number of route splits |
config.maxLength | number | Maximum route length (hops) |
config.minPoolUsdTvl | string | Minimum pool TVL in USD |
config.metadata | SwapProviderMetadataOverride | Custom metadata for the provider. |
config.referralAddress | string | The address of the referrer. |
config.referralFeeBps | number | Referral fee in basis points (max 100 = 1%) |
Example
kit.registerProvider(
createDeDustProvider({
defaultSlippageBps: 100, // 1%
referralAddress: 'EQ...',
referralFeeBps: 50, // 0.5%
}),
);OmnistonSwapProvider
SwapProvider implementation backed by Omniston. Prefer the createOmnistonProvider factory over instantiating this class directly — the factory returns a ProviderInput ready to pass to AppKitConfig's providers or registerProvider.
Constructor: new OmnistonSwapProvider(config)
| Parameter | Type | Description |
|---|---|---|
config | OmnistonSwapProviderConfig | Optional OmnistonSwapProviderConfig. Defaults are filled in for any field left undefined. |
config.apiUrl | string | Optional URL for the Omniston API |
config.defaultSlippageBps | number | Default slippage tolerance in basis points (1 bp = 0.01%) |
config.quoteTimeoutMs | number | Timeout for quote requests in milliseconds |
config.providerId | string | Identifier for the provider. |
config.metadata | SwapProviderMetadataOverride | Custom metadata for the provider. |
config.referrerAddress | string | The address of the referrer. |
config.referrerFeeBps | number | Referrer fee in basis points (1 bp = 0.01%) |
config.flexibleReferrerFee | boolean | Whether a flexible referrer fee is allowed. |
Example
kit.registerProvider(
createOmnistonProvider({
defaultSlippageBps: 100, // 1%
quoteTimeoutMs: 10000,
}),
);SwapError
Error thrown by SwapManager and swap providers — extends DefiError with name: 'SwapError' and a typed SwapErrorCode on code.
Constructor: new SwapError(message, code, details)
| Parameter | Type | Description |
|---|---|---|
message* | string | Human-readable description, forwarded to Error. |
code* | SwapErrorCode | Stable error code for branching logic. |
details | unknown | Optional provider-specific context for diagnostics. |
SwapManager
Runtime that owns registered SwapProviders and dispatches quote/swap calls. Usually accessed through the higher-level actions (getSwapQuote, buildSwapTransaction).
Constructor: new SwapManager(createFactoryContext)
| Parameter | Type | Description |
|---|---|---|
createFactoryContext* | () => ProviderFactoryContext | Lazy provider of the ProviderFactoryContext the manager passes into provider factories at registration time. |
SwapProvider
Abstract base class implemented by swap providers (DeDust, Omniston, custom integrations). Apps don't use it directly — they consume providers through SwapManager and the getSwap* / buildSwapTransaction actions.
Constructor: new SwapProvider()
Wallets
TonConnectWalletAdapter
WalletInterface implementation backed by a TonConnect wallet. Prefer the createTonConnectConnector factory over instantiating this class directly — the connector builds the adapter for every wallet it tracks and apps interact with it through standard AppKit actions (sendTransaction, signText/signBinary/signCell). On-chain reads (balance, jettons, NFTs) live on separate actions (getBalance, getJettons, getNfts) and don't go through this adapter.
Constructor: new TonConnectWalletAdapter(config)
| Parameter | Type | Description |
|---|---|---|
config* | TonConnectWalletAdapterConfig | TonConnect wallet + UI instance and the id of the connector that produced them. |
config.connectorId* | string | ID of the connector that produced this wallet — surfaced as WalletInterface.connectorId. |
config.tonConnectWallet* | TonConnectWallet | Underlying TonConnect wallet object. |
config.tonConnectUI* | TonConnectUI | TonConnect UI instance used to drive sendTransaction and signData calls. |
Type
Balances
BalanceUpdate
Update payload delivered to watchBalance / watchBalanceByAddress subscribers when the watched address's TON balance changes.
| Field | Type | Description |
|---|---|---|
type* | 'balance' | The update type field. |
address* | UserFriendlyAddress | The account address. |
rawBalance* | TokenAmount | The account balance in nano units. |
balance* | string | The formatted balance. |
status* | StreamingUpdateStatus | Finality stage of the update — see StreamingUpdateStatus. |
GetBalanceByAddressOptions
Options for getBalanceByAddress.
| Field | Type | Description |
|---|---|---|
address* | UserFriendlyAddress | Address | Wallet address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
network | Network | Network to read the balance from. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
GetBalanceByAddressReturnType
Return type of getBalanceByAddress.
type GetBalanceByAddressReturnType = TokenAmount;GetBalanceOptions
Options for getBalance.
| Field | Type | Description |
|---|---|---|
network | Network | Network to read the balance from. Defaults to the selected wallet's network. |
GetBalanceReturnType
Return type of getBalance.
type GetBalanceReturnType = TokenAmount | null;StreamingUpdateStatus
Finality stage carried by every streaming update — 'pending' (in mempool), 'confirmed' (included in a block), 'finalized' (irreversible), or 'invalidated' (rolled back).
type StreamingUpdateStatus = 'pending' | 'confirmed' | 'finalized' | 'invalidated';WatchBalanceByAddressOptions
Options for watchBalanceByAddress.
| Field | Type | Description |
|---|---|---|
address* | UserFriendlyAddress | Address | Wallet address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
network | Network | Network to watch on. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
onChange* | (update: BalanceUpdate) => void | Callback fired on every balance update from the streaming provider. |
WatchBalanceByAddressReturnType
Return type of watchBalanceByAddress — call to stop receiving updates.
type WatchBalanceByAddressReturnType = () => void;WatchBalanceOptions
Options for watchBalance.
| Field | Type | Description |
|---|---|---|
network | Network | Network to watch on. Defaults to the selected wallet's network. |
onChange* | (update: BalanceUpdate) => void | Callback fired on every balance update from the streaming provider. |
WatchBalanceReturnType
Return type of watchBalance — call to stop receiving updates.
type WatchBalanceReturnType = () => void;Client
AddressBook
Map of raw addresses to their resolved metadata, returned alongside indexed lists (e.g. JettonsResponse, NFTsResponse) so consumers can render labels without extra lookups.
type AddressBook = {
[key: UserFriendlyAddress]: AddressBookEntry;
};AddressBookEntry
Single entry inside an AddressBook — pairs the user-friendly address with optional domain name and the list of contract interfaces it implements.
| Field | Type | Description |
|---|---|---|
address | UserFriendlyAddress | The human-readable representation of the blockchain address. |
domain | string | The domain name associated with the address if available. |
interfaces* | string[] | List of supported interfaces by the address. |
ApiClient
Indexer/RPC client interface used by AppKit to read on-chain state — balance, jettons, NFTs, etc. Each Network resolves to its own ApiClient via AppKitNetworkManager. Apps usually pull one through getApiClient rather than constructing it directly.
| Field | Type | Description |
|---|---|---|
nftItemsByAddress* | (request: NFTsRequest) => Promise<NFTsResponse> | Look up specific NFT items by address. |
nftItemsByOwner* | (request: UserNFTsRequest) => Promise<NFTsResponse> | List NFT items held by an owner. Supports pagination. |
fetchEmulation* | (messageBoc: Base64String, ignoreSignature?: boolean) => Promise<ToncenterEmulationResult> | Run an emulation pass on a Base64-encoded BoC. Returns the predicted account-state changes and emitted events without sending the message. |
sendBoc* | (boc: Base64String) => Promise<string> | Broadcast a signed BoC to the network and return the message hash. |
runGetMethod* | (address: UserFriendlyAddress, method: string, stack?: RawStackItem[], seqno?: number) => Promise<GetMethodResult> | Run an on-chain get method against a contract and read its TVM stack output. |
getAccountState* | (address: UserFriendlyAddress, seqno?: number) => Promise<FullAccountState> | Read the full on-chain account state (code, data, status, balance) for an address. |
getBalance* | (address: UserFriendlyAddress, seqno?: number) => Promise<TokenAmount> | Read the TON balance of an address in raw nanotons. |
getAccountTransactions* | (request: TransactionsByAddressRequest) => Promise<TransactionsResponse> | List transactions for an address. Ordered newest-first, paginated via LimitRequest. |
getTransactionsByHash* | (request: GetTransactionByHashRequest) => Promise<TransactionsResponse> | Fetch a transaction by its message or body hash. |
getPendingTransactions* | (request: GetPendingTransactionsRequest) => Promise<TransactionsResponse> | List pending (unconfirmed) transactions by accounts or trace ids. Useful for "in-flight" UIs. |
getTrace* | (request: GetTraceRequest) => Promise<ToncenterTracesResponse> | Fetch a confirmed trace (the tree of internal messages spawned by an external one). |
getPendingTrace* | (request: GetPendingTraceRequest) => Promise<ToncenterTracesResponse> | Fetch a pending trace by external-message hash, while it's still in flight. |
resolveDnsWallet* | (domain: string) => Promise<string | null> | Resolve a TON DNS domain to the wallet address it points at. null when unset. |
backResolveDnsWallet* | (address: UserFriendlyAddress) => Promise<string | null> | Reverse-resolve a wallet address to a TON DNS domain that points at it. null when none. |
jettonsByAddress* | (request: GetJettonsByAddressRequest) => Promise<ToncenterResponseJettonMasters> | Look up jetton masters by address — returns indexer metadata for the requested jettons. |
jettonsByOwnerAddress* | (request: GetJettonsByOwnerRequest) => Promise<JettonsResponse> | List jetton holdings owned by an address — returns balances + jetton-master metadata. |
getEvents* | (request: GetEventsRequest) => Promise<GetEventsResponse> | List parsed account events (jetton transfers, NFT moves, swaps, …) for an address. |
getMasterchainInfo* | () => Promise<MasterchainInfo> | Read the latest masterchain info — last seqno, shards, time. |
ApiClientConfig
Configuration accepted by NetworkConfig's apiClient — picks an ApiClient implementation (Toncenter / TonAPI) and supplies its endpoint URL plus optional API key.
| Field | Type | Description |
|---|---|---|
url | string | Base URL of the indexer endpoint. Defaults to 'https://toncenter.com' for mainnet, 'https://testnet.toncenter.com' for testnet. |
key | string | API key forwarded to the indexer for higher rate limits. |
ApiClientToncenterConfig
Configuration accepted by ApiClientToncenter — endpoint, API key, request timeout, custom fetch, target network, and optional DNS-resolver override.
| Field | Type | Description |
|---|---|---|
dnsResolver | string | Override the contract address used to resolve TON DNS records. Defaults to the network's standard root resolver. |
endpoint | string | Base URL of the indexer endpoint. Defaults to the provider's mainnet/testnet URL based on network. |
apiKey | string | API key forwarded to the indexer for higher rate limits. |
timeout | number | Per-request timeout in milliseconds. Defaults to a provider-specific value. |
fetchApi | typeof fetch | Custom fetch implementation. Defaults to the global fetch. |
network | Network | Network the client should target. Determines the default endpoint when one isn't supplied. |
disableNetworkSend | boolean | When true, swallow sendBoc calls instead of broadcasting them — useful for local development and tests. |
BaseApiClientConfig
Configuration shared by every ApiClient subclass — endpoint, API key, request timeout, custom fetch, target network and a disableNetworkSend dev toggle. Accepted directly by ApiClientTonApi; extended by ApiClientToncenterConfig.
| Field | Type | Description |
|---|---|---|
endpoint | string | Base URL of the indexer endpoint. Defaults to the provider's mainnet/testnet URL based on network. |
apiKey | string | API key forwarded to the indexer for higher rate limits. |
timeout | number | Per-request timeout in milliseconds. Defaults to a provider-specific value. |
fetchApi | typeof fetch | Custom fetch implementation. Defaults to the global fetch. |
network | Network | Network the client should target. Determines the default endpoint when one isn't supplied. |
disableNetworkSend | boolean | When true, swallow sendBoc calls instead of broadcasting them — useful for local development and tests. |
GetApiClientOptions
Options for getApiClient.
GetApiClientReturnType
Return type of getApiClient.
type GetApiClientReturnType = ApiClient;TokenInfo
Display metadata for a token (TON, jetton, or NFT) — name, symbol, image and animation as reported by the indexer. Surfaced as Jetton's info and NFT's info.
| Field | Type | Description |
|---|---|---|
name | string | Display name of the token. |
description | string | Human-readable description of the token. |
image | TokenImage | Token image in various sizes. |
animation | TokenAnimation | Animated media associated with the token. |
symbol | string | Ticker symbol of the token (e.g., "TON", "USDT") |
Connectors
AddConnectorParameters
Connector instance or factory accepted by addConnector — same shape used in AppKitConfig's connectors.
type AddConnectorParameters = ConnectorInput;AddConnectorReturnType
Return type of addConnector — call to remove the connector from AppKit.
type AddConnectorReturnType = () => void;ConnectParameters
Parameters accepted by connect.
| Field | Type | Description |
|---|---|---|
connectorId* | string | ID of the registered connector to drive the connection through (e.g., 'tonconnect'). |
ConnectReturnType
Return type of connect.
type ConnectReturnType = void;Connector
Wallet connector contract — the protocol-specific bridge (TonConnect, embedded wallet, …) AppKit drives once you register it via AppKitConfig's connectors.
| Field | Type | Description |
|---|---|---|
id* | string | Stable connector identifier, unique within an AppKit instance. |
type* | string | Protocol type (e.g. 'tonconnect'). Multiple connectors can share the same type. |
metadata* | ConnectorMetadata | Display metadata (name, icon) shown in connect UIs. |
destroy* | () => void | Release any resources held by the connector. Call on app teardown. |
connectWallet* | (network?: Network) => Promise<void> | Initiate a wallet connection flow on the given network. |
disconnectWallet* | () => Promise<void> | Disconnect the currently connected wallet, if any. |
getConnectedWallets* | () => WalletInterface[] | Wallets currently connected through this connector. |
ConnectorFactory
Factory that builds a Connector from ConnectorFactoryContext. AppKit calls it at registration time.
type ConnectorFactory = (ctx: ConnectorFactoryContext) => Connector;ConnectorFactoryContext
Context that AppKit injects into a ConnectorFactory when building the connector at registration time.
| Field | Type | Description |
|---|---|---|
networkManager* | AppKitNetworkManager | Network manager the connector should use for client lookups and default-network reads. |
eventEmitter* | AppKitEmitter | Event emitter the connector should publish wallet/connection events to. |
ConnectorInput
Either a ready-made Connector or a ConnectorFactory that produces one — the value accepted by addConnector and AppKitConfig's connectors.
type ConnectorInput = Connector | ConnectorFactory;ConnectorMetadata
Display metadata for a Connector, surfaced in connect UIs to help users pick the right wallet.
| Field | Type | Description |
|---|---|---|
name* | string | Human-readable connector name (e.g., 'TonConnect'). |
iconUrl | string | Optional URL of an icon shown next to the name. |
DisconnectParameters
Parameters accepted by disconnect.
| Field | Type | Description |
|---|---|---|
connectorId* | string | ID of the registered connector whose wallet should be disconnected. |
DisconnectReturnType
Return type of disconnect.
type DisconnectReturnType = void;GetConnectorByIdOptions
Options for getConnectorById.
| Field | Type | Description |
|---|---|---|
id* | string | ID of the connector to look up. |
GetConnectorByIdReturnType
Return type of getConnectorById — undefined when no connector with that id is registered.
type GetConnectorByIdReturnType = Connector | undefined;GetConnectorsReturnType
Return type of getConnectors — read-only view of the registered-connectors array.
type GetConnectorsReturnType = readonly Connector[];TonConnectConnector
Connector produced by createTonConnectConnector — extends the base interface with the underlying TonConnectUI instance for advanced flows that need direct access (e.g., custom modals).
| Field | Type | Description |
|---|---|---|
id* | string | Stable connector identifier, unique within an AppKit instance. |
type* | string | Protocol type (e.g. 'tonconnect'). Multiple connectors can share the same type. |
metadata* | ConnectorMetadata | Display metadata (name, icon) shown in connect UIs. |
destroy* | () => void | Release any resources held by the connector. Call on app teardown. |
connectWallet* | (network?: Network) => Promise<void> | Initiate a wallet connection flow on the given network. |
disconnectWallet* | () => Promise<void> | Disconnect the currently connected wallet, if any. |
getConnectedWallets* | () => WalletInterface[] | Wallets currently connected through this connector. |
tonConnectUI* | TonConnectUI | null | Underlying TonConnectUI instance — null during SSR or before the connector has been initialized. Apps that need to drive the modal directly (e.g. custom UI flows) can read this and call its methods. |
TonConnectConnectorConfig
Configuration accepted by createTonConnectConnector.
| Field | Type | Description |
|---|---|---|
id | string | Connector ID. Defaults to TONCONNECT_DEFAULT_CONNECTOR_ID ('tonconnect'). Set this when you need to register multiple TonConnect-flavoured connectors side by side. |
metadata | ConnectorMetadata | Display metadata override. Merged on top of TonConnect's default name and icon. |
tonConnectOptions | TonConnectUiCreateOptions | Options forwarded to the underlying TonConnectUI constructor (manifest URL, etc.). Ignored when tonConnectUI is supplied. |
tonConnectUI | TonConnectUI | Pre-built TonConnectUI instance to reuse. When set, the connector skips its own instantiation and tonConnectOptions is ignored. |
WatchConnectorByIdParameters
Parameters accepted by watchConnectorById.
| Field | Type | Description |
|---|---|---|
id* | string | ID of the connector to watch. |
onChange* | (connector: Connector | undefined) => void | Callback invoked when the connector with the watched id is registered or unregistered — receives the connector itself, or undefined when none is registered under that id. |
WatchConnectorByIdReturnType
Return type of watchConnectorById — call to stop receiving updates.
type WatchConnectorByIdReturnType = () => void;WatchConnectorsParameters
Parameters accepted by watchConnectors.
| Field | Type | Description |
|---|---|---|
onChange* | (connectors: readonly Connector[]) => void | Callback invoked when the list of registered connectors changes — receives the current list. |
WatchConnectorsReturnType
Return type of watchConnectors — call to stop receiving updates.
type WatchConnectorsReturnType = () => void;Core
AppKitConfig
Constructor options for AppKit — networks, connectors, providers and runtime flags.
| Field | Type | Description |
|---|---|---|
networks | NetworkAdapters | Map of chain ID to NetworkConfig (which holds the api-client setup). If omitted, AppKit defaults to mainnet only. |
connectors | ConnectorInput[] | Wallet connectors registered at startup. |
defaultNetwork | Network | Default network. |
providers | ProviderInput[] | Providers registered at startup. |
AppKitEmitter
Strongly-typed event emitter accessed through appKit.emitter. appKit.emitter.on(name, handler) returns an unsubscribe function.
type AppKitEmitter = EventEmitter<AppKitEvents>;AppKitEvents
Map of every event name AppKit can emit to its payload type, used to type listeners on AppKitEmitter.
| Field | Type | Description |
|---|---|---|
connector:added* | ConnectorAddedPayload | Fired by addConnector when a connector is registered with AppKit. |
connector:removed* | ConnectorRemovedPayload | Fired when a connector is unregistered from AppKit — typically by calling the unregister function returned from addConnector. |
connector:wallets-updated* | ConnectorWalletsUpdatedPayload | Fired by a connector whenever its connected-wallets list changes (connect, disconnect, or account switch inside the wallet). |
wallets:updated* | { wallets: WalletInterface[] } | Fired by AppKit's wallet manager after re-aggregating connectors — wallets is the full current set. |
wallets:selection-changed* | { walletId: string | null } | Fired when the selected wallet changes — walletId is the new selection, or null when cleared. |
networks:updated* | Record<string, never> | Fired by the network manager when a network's API client is registered or replaced via setClient. |
networks:default-changed* | DefaultNetworkChangedPayload | Fired by setDefaultNetwork — carries the new default network, or undefined when the constraint was cleared. |
streaming:balance-update* | BalanceUpdate | Fired by a streaming provider when a watched address's TON balance changes. |
streaming:transactions* | TransactionsUpdate | Fired by a streaming provider when new transactions land for a watched address. |
streaming:jettons-update* | JettonUpdate | Fired by a streaming provider when a watched address's jetton holdings change. |
provider:registered* | BaseProviderUpdate | Fired by a DeFi manager when a provider is registered through it (carries the provider's id and kind). |
provider:default-changed* | BaseProviderUpdate | Fired by a DeFi manager when its default provider is set or cleared (carries the new default's id and kind). |
BaseProviderUpdate
Payload of provider:registered and provider:default-changed events — carries the affected provider's id and kind.
| Field | Type | Description |
|---|---|---|
providerId* | string | Stable id of the affected provider — same as the providerId it was registered with. |
type* | string | Provider-kind discriminator (e.g., 'swap', 'staking', 'onramp', 'crypto-onramp') — same as the provider's type. |
ConnectorAddedPayload
Payload of connector:added events — the connector that was just registered.
ConnectorRemovedPayload
Payload of connector:removed events — the connector that was just unregistered.
| Field | Type | Description |
|---|---|---|
connector* | Connector | The Connector that was just unregistered from AppKit (already torn down via destroy()). |
ConnectorWalletsUpdatedPayload
Payload of connector:wallets-updated events — fired by a connector when its connected-wallets list changes (connect, disconnect, or account switch inside the wallet).
| Field | Type | Description |
|---|---|---|
connectorId* | string | ID of the Connector whose wallets just changed. |
wallets* | WalletInterface[] | Wallets currently exposed by the connector — empty when the wallet was just disconnected. |
DefaultNetworkChangedPayload
Payload of networks:default-changed events — the new default network, or undefined when cleared.
| Field | Type | Description |
|---|---|---|
network* | Network | undefined | New default network, or undefined when the constraint is cleared. |
EventListener
Listener callback signature accepted by EventEmitter's on — receives a KitEvent for the given event type and may return a Promise the emitter awaits.
type EventListener = (event: KitEvent<T>) => void | Promise<void>;EventPayload
Generic event-payload constraint — an object that the typed event-name → payload map maps to.
type EventPayload = object;KitEvent
Envelope every EventEmitter listener receives — type is the event name, payload is the event-specific data, source identifies who emitted it, and timestamp is the wall-clock millisecond mark.
| Field | Type | Description |
|---|---|---|
type* | string | Event name (e.g., 'connector:wallets-updated'). |
payload* | T = any | Event-specific payload — typed via the emitter's event-name → payload map. |
source | string | Identifier of the component that emitted the event (connector id, manager name, etc.). Useful for filtering listeners. |
timestamp* | number | Wall-clock timestamp in milliseconds when the event was emitted. |
SharedKitEvents
Event-name → payload map shared between AppKit and walletkit. AppKit extends it with its own connector, wallet and network events to type AppKitEmitter.
| Field | Type | Description |
|---|---|---|
streaming:balance-update* | BalanceUpdate | Fired by a streaming provider when a watched address's TON balance changes. |
streaming:transactions* | TransactionsUpdate | Fired by a streaming provider when new transactions land for a watched address. |
streaming:jettons-update* | JettonUpdate | Fired by a streaming provider when a watched address's jetton holdings change. |
provider:registered* | BaseProviderUpdate | Fired by a DeFi manager when a provider is registered through it (carries the provider's id and kind). |
provider:default-changed* | BaseProviderUpdate | Fired by a DeFi manager when its default provider is set or cleared (carries the new default's id and kind). |
Crypto Onramp
CreateCryptoOnrampDepositOptions
Options for createCryptoOnrampDeposit — extends CryptoOnrampDepositParams with an optional provider override.
| Field | Type | Description |
|---|---|---|
quote* | CryptoOnrampQuote<TQuoteMetadata = unknown> | Quote to execute the deposit against (contains recipientAddress and provider metadata) |
refundAddress* | string | Address to refund the crypto to in case of failure. |
providerOptions | TProviderOptions = unknown | Provider-specific options. |
providerId | string | Provider to create the deposit through. Defaults to quote.providerId, then to the default provider. |
CreateCryptoOnrampDepositReturnType
Return type of createCryptoOnrampDeposit.
type CreateCryptoOnrampDepositReturnType = Promise<CryptoOnrampDeposit>;CryptoOnrampDeposit
Deposit details returned by a crypto onramp provider.
The user must send amount of sourceCurrencyAddress to address on sourceChain
to complete the onramp. The provider then delivers the target crypto to the user's TON address.
| Field | Type | Description |
|---|---|---|
depositId* | string | Deposit id. |
address* | string | Deposit address on the source chain. |
amount* | string | Exact amount of source crypto the user must send. |
sourceCurrencyAddress* | string | Source crypto currency address (contract address or 0x0... for native) |
sourceChain* | string | Source chain identifier in CAIP-2 format (e.g. 'eip155:42161'). |
memo | string | Optional memo / tag required by some chains (e.g. XRP, TON comment) |
expiresAt | number | Unix timestamp (ms) after which the deposit offer is no longer valid. |
chainWarning | string | Chain-specific warning to show the user (e.g. "send only on Solana") |
providerId* | string | Identifier of the provider that issued this deposit. |
CryptoOnrampDepositParams
Parameters for creating a crypto onramp deposit.
The recipient is taken from quote.recipientAddress set at quote time.
| Field | Type | Description |
|---|---|---|
quote* | CryptoOnrampQuote<TQuoteMetadata = unknown> | Quote to execute the deposit against (contains recipientAddress and provider metadata) |
refundAddress* | string | Address to refund the crypto to in case of failure. |
providerOptions | TProviderOptions = unknown | Provider-specific options. |
CryptoOnrampProviderInterface
Interface that all crypto onramp providers must implement
| Field | Type | Description |
|---|---|---|
type* | 'crypto-onramp' | Provider kind discriminator pinned to 'crypto-onramp' so registerProvider routes it to the crypto-onramp manager. |
providerId* | string | Unique identifier for the provider |
getMetadata* | () => CryptoOnrampProviderMetadata | Get static metadata for the provider (display name, logo, url). |
getQuote* | (params: CryptoOnrampQuoteParams<TQuoteOptions>) => Promise<CryptoOnrampQuote> | Get a quote for onramping from another crypto asset into a TON asset |
createDeposit* | (params: CryptoOnrampDepositParams<TDepositOptions>) => Promise<CryptoOnrampDeposit> | Create a deposit for a previously obtained quote |
getStatus* | (params: CryptoOnrampStatusParams) => Promise<CryptoOnrampStatus> | Get the status of a deposit |
getSupportedNetworks* | () => Network[] | Networks this provider can operate on. Consumers should check before calling provider methods. Implementations may return a static list or compute it dynamically (e.g. from runtime config). |
CryptoOnrampProviderMetadata
Static metadata for a crypto-onramp provider.
| Field | Type | Description |
|---|---|---|
name* | string | Human-readable provider name (e.g. 'Swaps.xyz') |
logo | string | URL to the provider's logo image. |
url | string | URL to the provider's website. |
isRefundAddressRequired | boolean | Whether this provider requires a refund address on the source chain. When true, the UI must collect a refund address before creating a deposit. |
isReversedAmountSupported | boolean | Whether this provider supports reversed (target-amount) quotes. When false, the UI should hide the direction toggle and only allow source-amount input. |
CryptoOnrampProviderMetadataOverride
Used in provider configuration to override fields of the provider's metadata.
| Field | Type | Description |
|---|---|---|
name | string | Override the provider's display name. |
logo | string | Override the provider's logo URL. |
url | string | Override the provider's website URL. |
CryptoOnrampQuote
Crypto onramp quote response with pricing information.
| Field | Type | Description |
|---|---|---|
sourceCurrencyAddress* | string | Source crypto currency address (contract address or 0x0... for native) |
sourceChain* | string | Source chain identifier in CAIP-2 format (e.g. 'eip155:42161'). |
targetCurrencyAddress* | string | Target crypto currency address on TON (contract address or 0x0... for native) |
sourceAmount* | string | Amount of source crypto to send. |
targetAmount* | string | Amount of target crypto to receive. |
rate* | string | Exchange rate (amount of target per 1 unit of source) |
recipientAddress* | string | TON address that will receive the target crypto. |
providerId* | string | Identifier of the crypto onramp provider. |
metadata | TMetadata = unknown | Provider-specific metadata for the quote (e.g. raw response needed to execute) |
CryptoOnrampQuoteParams
Parameters for requesting a crypto-to-crypto onramp quote.
The target network is always TON, so only the source side is parameterised.
| Field | Type | Description |
|---|---|---|
amount* | string | Amount to onramp (either source or target crypto, depending on isSourceAmount) |
sourceCurrencyAddress* | string | Source crypto currency address (contract address or 0x0... for native) |
sourceChain* | string | Source chain identifier in CAIP-2 format (e.g. 'eip155:1' for Ethereum mainnet, 'eip155:42161' for Arbitrum One). Providers map this to their own chain identifiers internally. |
targetCurrencyAddress* | string | Target crypto currency address on TON (contract address or 0x0... for native) |
recipientAddress* | string | TON address that will receive the target crypto. |
refundAddress | string | Refund address for the source crypto. |
isSourceAmount | boolean | If true, amount is the source amount to spend. If false, amount is the target amount to receive. Defaults to true when omitted. |
providerOptions | TProviderOptions = unknown | Provider-specific options. |
CryptoOnrampStatus
Final state of a crypto-onramp deposit returned by getCryptoOnrampStatus — 'success' (delivered to the recipient), 'pending' (still in flight), or 'failed' (provider could not complete the deposit).
type CryptoOnrampStatus = 'success' | 'pending' | 'failed';CryptoOnrampStatusParams
Parameters accepted by getCryptoOnrampStatus — identifies a previously created deposit and the provider that issued it.
| Field | Type | Description |
|---|---|---|
depositId* | string | Deposit id. |
providerId* | string | Identifier of the provider that issued this deposit. |
GetCryptoOnrampProviderOptions
Options for getCryptoOnrampProvider.
| Field | Type | Description |
|---|---|---|
id | string | Provider ID to look up. When omitted, returns the registered default provider. |
GetCryptoOnrampProviderReturnType
Return type of getCryptoOnrampProvider.
type GetCryptoOnrampProviderReturnType = CryptoOnrampProviderInterface;GetCryptoOnrampProvidersReturnType
Return type of getCryptoOnrampProviders.
type GetCryptoOnrampProvidersReturnType = CryptoOnrampProviderInterface[];GetCryptoOnrampQuoteOptions
Options for getCryptoOnrampQuote — extends CryptoOnrampQuoteParams with an optional provider override.
| Field | Type | Description |
|---|---|---|
amount* | string | Amount to onramp (either source or target crypto, depending on isSourceAmount) |
sourceCurrencyAddress* | string | Source crypto currency address (contract address or 0x0... for native) |
sourceChain* | string | Source chain identifier in CAIP-2 format (e.g. 'eip155:1' for Ethereum mainnet, 'eip155:42161' for Arbitrum One). Providers map this to their own chain identifiers internally. |
targetCurrencyAddress* | string | Target crypto currency address on TON (contract address or 0x0... for native) |
recipientAddress* | string | TON address that will receive the target crypto. |
refundAddress | string | Refund address for the source crypto. |
isSourceAmount | boolean | If true, amount is the source amount to spend. If false, amount is the target amount to receive. Defaults to true when omitted. |
providerOptions | TProviderOptions = unknown | Provider-specific options. |
providerId | string | Provider to quote against. Defaults to the registered default provider. |
GetCryptoOnrampQuoteReturnType
Return type of getCryptoOnrampQuote.
type GetCryptoOnrampQuoteReturnType = Promise<CryptoOnrampQuote>;GetCryptoOnrampStatusOptions
Options for getCryptoOnrampStatus — extends CryptoOnrampStatusParams with an optional provider override.
| Field | Type | Description |
|---|---|---|
depositId* | string | Deposit id. |
providerId* | string | Identifier of the provider that issued this deposit. |
GetCryptoOnrampStatusReturnType
Return type of getCryptoOnrampStatus.
type GetCryptoOnrampStatusReturnType = Promise<CryptoOnrampStatus>;LayerswapProviderConfig
Configuration accepted by createLayerswapProvider.
| Field | Type | Description |
|---|---|---|
apiKey | string | Optional API key. Forwarded as X-LS-APIKEY when provided. |
apiUrl | string | Override the base API URL. Defaults to https://api.layerswap.io/api/v2 (see Layerswap API V2. |
LayerswapQuoteMetadata
Provider-specific metadata returned on a CryptoOnrampQuote's metadata from Layerswap — carries the swap id and deposit action that createCryptoOnrampDeposit reads to build the deposit.
| Field | Type | Description |
|---|---|---|
swapId* | string | Layerswap swap id created at quote time and reused by createDeposit / getStatus. |
depositAddress* | string | Pre-computed deposit address on the source chain that the user must send funds to. |
sourceAmountBaseUnits* | string | Source-chain amount the user must send, in raw base units (e.g., wei). |
targetAmountBaseUnits* | string | Target-chain amount the user receives, in raw base units (e.g., nanotons). |
SwapsXyzProviderConfig
Configuration accepted by createSwapsXyzProvider.
| Field | Type | Description |
|---|---|---|
apiKey* | string | API key issued by swaps.xyz (passed as x-api-key) |
apiUrl | string | Override the base API URL. Defaults to https://api-v2.swaps.xyz/api (see Swaps API Documentation. |
defaultSender | string | EVM address used as sender on getAction requests. Required by the API even for deposit flows where the actual payer is unknown. Defaults to a null address when omitted. |
SwapsXyzQuoteMetadata
Provider-specific metadata returned on a CryptoOnrampQuote's metadata from swaps.xyz — carries the resolved action and bridge route that createCryptoOnrampDeposit needs.
| Field | Type | Description |
|---|---|---|
sender* | string | EVM sender address swaps.xyz was quoted for. Required when later calling createDeposit. |
response* | SwapsXyzGetActionResponse | Raw getAction response cached at quote time so createDeposit doesn't need an extra round-trip. |
SwapsXyzQuoteOptions
swaps.xyz-specific options forwarded through providerOptions on CryptoOnrampQuoteParams.
| Field | Type | Description |
|---|---|---|
slippageBps | number | Slippage tolerance in basis points (0-10000). Defaults to 100 (1%). |
WatchCryptoOnrampProvidersParameters
Parameters accepted by watchCryptoOnrampProviders.
| Field | Type | Description |
|---|---|---|
onChange* | () => void | Callback fired whenever a crypto-onramp provider is registered or the default crypto-onramp provider changes. |
WatchCryptoOnrampProvidersReturnType
Return type of watchCryptoOnrampProviders — call to stop receiving updates.
type WatchCryptoOnrampProvidersReturnType = () => void;DeFi
DefiManagerAPI
Shape every DeFi domain manager (swap, staking, onramp, crypto-onramp) satisfies — provider registration, default-provider selection and lookups. Mostly relevant when authoring a new domain manager.
| Field | Type | Description |
|---|---|---|
createFactoryContext* | () => ProviderFactoryContext | Build a fresh ProviderFactoryContext the manager hands to provider factories at registration time. |
registerProvider* | (provider: ProviderInput<T>) => void | Register a new provider. If a provider with the same id is already registered, it is replaced. |
removeProvider* | (provider: T) => void | Remove a previously registered provider. No-op if the provider was not registered. |
setDefaultProvider* | (providerId: string) => void | Set the default provider |
getProvider* | (providerId?: string) => T | Get a registered provider |
getProviders* | () => T[] | Get all registered providers. The returned array keeps a stable reference until the provider list changes. |
hasProvider* | (providerId: string) => boolean | Check if a provider is registered |
DefiProvider
Base interface implemented by every DeFi provider (swap, staking, onramp, crypto-onramp) — exposes providerId, type and getSupportedNetworks. Domain-specific provider interfaces extend this with quote/build/status methods.
| Field | Type | Description |
|---|---|---|
type* | DefiProviderType | Provider kind discriminator narrowed to the DeFi-domain literals so the right manager picks it up at registration time. |
getSupportedNetworks* | () => Network[] | Networks this provider can operate on. Consumers should check before calling provider methods. Implementations may return a static list or compute it dynamically (e.g. from runtime config). |
providerId* | string | Stable provider identifier, unique within the manager that registered it. |
DefiProviderType
Discriminator that tags every DefiProvider with its kind — 'swap', 'staking', 'onramp', or 'crypto-onramp'. Used by registerProvider to dispatch to the right manager.
type DefiProviderType = 'swap' | 'staking' | 'onramp' | 'crypto-onramp';ProviderFactoryContext
Context that AppKit's DeFi managers inject into a ProviderInput factory at registration time — gives the provider access to AppKit's network manager and event emitter.
| Field | Type | Description |
|---|---|---|
networkManager* | NetworkManager | Network manager the provider should use for client lookups and default-network reads. |
eventEmitter* | EventEmitter<Events = SharedKitEvents> | Event emitter the provider should publish its events to. |
ProviderInput
Either a ready-made DeFi/onramp provider instance or a factory that produces one — the value accepted by AppKitConfig's providers and registerProvider.
type ProviderInput = T | ProviderFactory<T>;RegisterProviderOptions
Provider instance or factory accepted by registerProvider — same shape used in AppKitConfig's providers. AppKit dispatches it to the right manager based on provider.type ('swap', 'staking', 'onramp', 'crypto-onramp').
type RegisterProviderOptions = ProviderInput;Jettons
CreateTransferJettonTransactionParameters
Parameters accepted by createTransferJettonTransaction and transferJetton.
| Field | Type | Description |
|---|---|---|
jettonAddress* | UserFriendlyAddress | Jetton master contract address being transferred. |
recipientAddress* | UserFriendlyAddress | Recipient who should receive the jettons. |
amount* | string | Amount in jetton units as a human-readable decimal string (e.g., "1.5"). |
jettonDecimals* | number | Decimals declared by the jetton master. Used to convert amount into raw smallest units. |
comment | string | Optional human-readable comment attached to the transfer. |
CreateTransferJettonTransactionReturnType
Return type of createTransferJettonTransaction.
type CreateTransferJettonTransactionReturnType = TransactionRequest;GetJettonBalanceOptions
Options for getJettonBalance.
| Field | Type | Description |
|---|---|---|
jettonAddress* | UserFriendlyAddress | Jetton master contract address (the token, not the user's wallet for it). |
ownerAddress* | UserFriendlyAddress | Owner of the jetton wallet — typically the connected user's address. |
jettonDecimals* | number | Decimals declared by the jetton master. Used to format the raw balance into a human-readable string. |
network | Network | Network to read the balance from. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
GetJettonBalanceReturnType
Return type of getJettonBalance.
type GetJettonBalanceReturnType = TokenAmount;GetJettonInfoOptions
Options for getJettonInfo.
| Field | Type | Description |
|---|---|---|
address* | UserFriendlyAddress | Jetton master contract address whose metadata is being fetched. |
network | Network | Network to query. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
GetJettonInfoReturnType
Return type of getJettonInfo — null when the indexer has no record for that master address.
type GetJettonInfoReturnType = JettonInfo | null;GetJettonWalletAddressOptions
Options for getJettonWalletAddress.
| Field | Type | Description |
|---|---|---|
jettonAddress* | UserFriendlyAddress | Jetton master contract address. |
ownerAddress* | UserFriendlyAddress | Owner whose jetton wallet should be derived. |
network | Network | Network to query. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
GetJettonWalletAddressReturnType
Return type of getJettonWalletAddress.
type GetJettonWalletAddressReturnType = UserFriendlyAddress;GetJettonsByAddressOptions
Options for getJettonsByAddress.
| Field | Type | Description |
|---|---|---|
address* | UserFriendlyAddress | Address | Owner address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
network | Network | Network to read the jettons from. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
limit | number | Maximum number of jettons to return. |
offset | number | Number of jettons to skip before returning results — used for pagination. |
GetJettonsByAddressReturnType
Return type of getJettonsByAddress.
type GetJettonsByAddressReturnType = JettonsResponse;GetJettonsOptions
Options for getJettons.
| Field | Type | Description |
|---|---|---|
network | Network | Network to read jettons from. Defaults to the selected wallet's network. |
limit | number | Maximum number of jettons to return. |
offset | number | Number of jettons to skip before returning results — used for pagination. |
GetJettonsReturnType
Return type of getJettons — null when no wallet is currently selected.
type GetJettonsReturnType = JettonsResponse | null;Jetton
Fungible TEP-74 token held in the user's TON wallet — carries the master contract address, the user's jetton-wallet address, current balance, and token metadata.
| Field | Type | Description |
|---|---|---|
address* | UserFriendlyAddress | The jetton master contract address (the token itself). |
walletAddress* | UserFriendlyAddress | The owner's jetton-wallet contract address — the per-owner contract that actually holds this balance. |
balance* | TokenAmount | The current jetton balance. |
info* | TokenInfo | Information about the token. |
decimalsNumber | number | The number of decimal places used by the token |
isVerified* | boolean | Indicates if the jetton is verified. |
prices* | JettonPrice[] | Current prices of the jetton in various currencies. |
extra | { [key: string]: unknown; } | Additional arbitrary data related to the jetton. |
JettonInfo
Token metadata for a jetton master — name, symbol, decimals, image, and verification status as reported by the indexer.
| Field | Type | Description |
|---|---|---|
address* | string | Jetton master contract address. |
name* | string | Display name of the jetton (e.g., "Tether USD"). |
symbol* | string | Ticker symbol (e.g., "USDT"). |
description* | string | Free-form description set by the issuer. |
decimals | number | Number of decimal places used to format raw amounts (e.g., 6 for USDT). |
totalSupply | string | Total supply in raw smallest units. |
image | string | URL of the jetton's image. |
image_data | string | Inline image data (Base64) when no image URL is published. |
uri | string | Off-chain metadata URI (TEP-64). |
verification | JettonVerification | Verification status reported by the indexer. |
metadata | Record<string, unknown> | Additional indexer-supplied metadata that doesn't fit the canonical fields. |
JettonUpdate
Update payload delivered to watchJettons / watchJettonsByAddress subscribers when the watched owner's jetton balance changes.
| Field | Type | Description |
|---|---|---|
type* | 'jettons' | The update type field. |
masterAddress* | UserFriendlyAddress | The master jetton contract address. |
walletAddress* | UserFriendlyAddress | The jetton wallet contract address. |
ownerAddress* | UserFriendlyAddress | The owner of the jetton wallet. |
rawBalance* | TokenAmount | Balance in raw smallest units (e.g. nano) |
decimals | number | Decimals mapped from metadata if available |
balance | string | Human readable formatted balance if decimals are known. |
status* | StreamingUpdateStatus | Finality stage of the update — see StreamingUpdateStatus. |
JettonVerification
Verification metadata reported by the indexer for a JettonInfo — verified flag plus optional verifier source.
| Field | Type | Description |
|---|---|---|
verified* | boolean | true when the indexer has verified this jetton against an allow-list. |
source | 'toncenter' | 'community' | 'manual' | Origin of the verification claim. |
warnings | string[] | Free-form warnings the UI should surface (e.g., scam indicators). |
JettonsResponse
Response payload of getJettons / getJettonsByAddress — the list of Jettons plus the address book that resolves raw addresses inside it.
| Field | Type | Description |
|---|---|---|
addressBook* | AddressBook | Address book mapping. |
jettons* | Jetton[] | List of Jettons. |
TransferJettonParameters
Parameters accepted by transferJetton — same shape as CreateTransferJettonTransactionParameters.
type TransferJettonParameters = CreateTransferJettonTransactionParameters;TransferJettonReturnType
Return type of transferJetton.
type TransferJettonReturnType = SendTransactionResponse;WatchJettonsByAddressOptions
Options for watchJettonsByAddress.
| Field | Type | Description |
|---|---|---|
address* | UserFriendlyAddress | Address | Owner address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
onChange* | (update: JettonUpdate) => void | Callback fired on every jetton-balance update from the streaming provider. |
network | Network | Network to watch on. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
WatchJettonsByAddressReturnType
Return type of watchJettonsByAddress — call to stop receiving updates.
type WatchJettonsByAddressReturnType = () => void;WatchJettonsOptions
Options for watchJettons.
| Field | Type | Description |
|---|---|---|
onChange* | (update: JettonUpdate) => void | Callback fired on every jetton-balance update from the streaming provider. |
network | Network | Network to watch on. Defaults to the selected wallet's network. |
WatchJettonsReturnType
Return type of watchJettons — call to stop receiving updates.
type WatchJettonsReturnType = () => void;NFTs
CreateTransferNftTransactionParameters
Parameters accepted by createTransferNftTransaction and transferNft.
| Field | Type | Description |
|---|---|---|
nftAddress* | UserFriendlyAddress | NFT contract address to transfer. |
recipientAddress* | UserFriendlyAddress | New owner address. |
amount | string | Amount of TON to attach to the transfer for gas. Defaults to AppKit's NFT gas-fee constant when omitted. |
comment | string | Optional human-readable comment attached to the transfer. |
CreateTransferNftTransactionReturnType
Return type of createTransferNftTransaction.
type CreateTransferNftTransactionReturnType = TransactionRequest;GetNftOptions
Options for getNft.
| Field | Type | Description |
|---|---|---|
address* | UserFriendlyAddress | Address | NFT contract address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
network | Network | Network to query. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
GetNftReturnType
Return type of getNft — null when the indexer has no record for that address.
type GetNftReturnType = NFT | null;GetNftsByAddressOptions
Options for getNftsByAddress.
| Field | Type | Description |
|---|---|---|
address* | UserFriendlyAddress | Address | Owner address — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
network | Network | Network to read NFTs from. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
limit | number | Maximum number of NFTs to return. |
offset | number | Number of NFTs to skip before returning results — used for pagination. |
GetNftsByAddressReturnType
Return type of getNftsByAddress.
type GetNftsByAddressReturnType = NFTsResponse;GetNftsOptions
Options for getNfts.
| Field | Type | Description |
|---|---|---|
network | Network | Network to read NFTs from. Defaults to the selected wallet's network. |
limit | number | Maximum number of NFTs to return. |
offset | number | Number of NFTs to skip before returning results — used for pagination. |
GetNftsReturnType
Return type of getNfts — null when no wallet is currently selected.
type GetNftsReturnType = NFTsResponse | null;NFT
Non-fungible TEP-62 token held in the user's TON wallet — carries the contract address, optional collection link, owner, sale state, and on-chain metadata.
| Field | Type | Description |
|---|---|---|
address* | UserFriendlyAddress | Contract address of the NFT item. |
index | string | Index of the item within its collection. |
info | TokenInfo | Display information about the NFT (name, description, images) |
attributes | NFTAttribute[] | Custom attributes/traits of the NFT (e.g., rarity, properties) |
collection | NFTCollection | Information about the collection this item belongs to. |
auctionContractAddress | UserFriendlyAddress | Address of the auction contract, if the NFT is being auctioned. |
codeHash | Hex | Hash of the NFT smart contract code. |
dataHash | Hex | Hash of the NFT's on-chain data. |
isInited | boolean | Whether the NFT contract has been initialized. |
isSoulbound | boolean | Whether the NFT is soulbound (non-transferable) |
isOnSale | boolean | Whether the NFT is currently listed for sale. |
ownerAddress | UserFriendlyAddress | Current owner address of the NFT. |
realOwnerAddress | UserFriendlyAddress | Real owner address when NFT is on sale (sale contract becomes temporary owner) |
saleContractAddress | UserFriendlyAddress | Address of the sale contract, if the NFT is listed for sale. |
extra | { [key: string]: unknown; } | Additional arbitrary data related to the NFT. |
NFTAttribute
Single trait of an NFT — traitType names the category (e.g., "Background"), value carries the trait's value (e.g., "Blue").
| Field | Type | Description |
|---|---|---|
traitType | string | Category or type of the trait (e.g., "Background", "Eyes") |
displayType | string | Indexer-supplied hint for how the attribute should be rendered. Optional and indexer-specific. |
value | string | Value of the attribute (e.g., "Blue", "Rare") |
NFTCollection
NFT collection (TEP-62) — surfaced as NFT's collection and carries the collection's name, image, owner and minting cursor.
| Field | Type | Description |
|---|---|---|
address* | UserFriendlyAddress | The blockchain address of the NFT collection contract. |
name | string | The name of the NFT collection. |
image | TokenImage | The image representing the NFT collection. |
description | string | A brief description of the NFT collection. |
nextItemIndex | string | The index value for the next item to be minted in the collection. |
codeHash | Hex | The hash of the collection's smart contract code. |
dataHash | Hex | The hash of the collection's data in the blockchain. |
ownerAddress | UserFriendlyAddress | The blockchain address of the collection owner. |
extra | { [key: string]: unknown; } | Additional arbitrary data related to the NFT collection. |
NFTsResponse
Response payload of getNfts / getNftsByAddress — the list of NFTs plus an address book that resolves raw addresses inside it.
| Field | Type | Description |
|---|---|---|
addressBook | AddressBook | Address book entries related to the NFTs. |
nfts* | NFT[] | List of NFTs. |
TransferNftParameters
Parameters accepted by transferNft — same shape as CreateTransferNftTransactionParameters.
type TransferNftParameters = CreateTransferNftTransactionParameters;TransferNftReturnType
Return type of transferNft.
type TransferNftReturnType = SendTransactionResponse;Networks
GetBlockNumberOptions
Options for getBlockNumber.
| Field | Type | Description |
|---|---|---|
network | Network | Network to query. Defaults to mainnet when omitted. |
GetBlockNumberReturnType
Return type of getBlockNumber.
type GetBlockNumberReturnType = number;GetDefaultNetworkReturnType
Return type of getDefaultNetwork — undefined when no default has been set (apps may operate on any registered network).
type GetDefaultNetworkReturnType = Network | undefined;GetNetworkReturnType
Return type of getNetwork — null when no wallet is currently selected.
type GetNetworkReturnType = Network | null;GetNetworksReturnType
Return type of getNetworks.
type GetNetworksReturnType = Network[];HasStreamingProviderReturnType
Return type of hasStreamingProvider.
type HasStreamingProviderReturnType = boolean;Network
TON blockchain network identifier.
| Field | Type | Description |
|---|---|---|
chainId* | string | Chain ID of the network (e.g., "-239" for mainnet, "-3" for testnet) |
NetworkAdapters
Multi-network configuration keyed by chain ID — each entry maps a chain ID (e.g. Network.mainnet().chainId) to its own NetworkConfig carrying the api-client setup.
type NetworkAdapters = {
[key: string]: NetworkConfig | undefined;
};NetworkConfig
Network configuration for a specific chain.
| Field | Type | Description |
|---|---|---|
apiClient | ApiClientConfig | ApiClient | API client configuration or instance. |
SetDefaultNetworkParameters
Parameters accepted by setDefaultNetwork.
| Field | Type | Description |
|---|---|---|
network* | Network | undefined | Network to enforce on new wallet connections. Pass undefined to allow any registered network. |
SetDefaultNetworkReturnType
Return type of setDefaultNetwork.
type SetDefaultNetworkReturnType = void;TonWalletKitOptions
Walletkit-side options shape consumed by KitNetworkManager's constructor — chiefly the networks map keyed by chain ID. AppKit constructs the manager for you, so apps rarely instantiate this directly.
| Field | Type | Description |
|---|---|---|
walletManifest | WalletInfo | TonConnect wallet manifest published by the dApp. Required for the wallet to recognize the integration. |
deviceInfo | DeviceInfo | Device fingerprint forwarded with TonConnect requests so wallets can recognize the host. |
sessionManager | TONConnectSessionManager | Custom session manager implementation. If not provided, TONConnectStoredSessionManager will be used. |
networks | NetworkAdapters | Network configuration. |
bridge | BridgeConfig | Bridge settings. |
storage | StorageConfig | StorageAdapter | Storage settings. |
validation | { strictMode?: boolean; allowUnknownWalletVersions?: boolean; } | Validation settings. |
eventProcessor | EventProcessorConfig | Event processor settings. |
analytics | AnalyticsManagerOptions & { enabled?: boolean; } | Analytics manager options merged with an enabled toggle. Off by default. |
dev | { disableNetworkSend?: boolean; disableManifestDomainCheck?: boolean; } | Diagnostic toggles useful during local development. Should not be set in production builds. |
WatchDefaultNetworkParameters
Parameters accepted by watchDefaultNetwork.
| Field | Type | Description |
|---|---|---|
onChange* | (network: Network | undefined) => void | Callback fired whenever setDefaultNetwork updates the default — receives the new value (or undefined when cleared). |
WatchDefaultNetworkReturnType
Return type of watchDefaultNetwork — call to stop receiving updates.
type WatchDefaultNetworkReturnType = () => void;WatchNetworksParameters
Parameters accepted by watchNetworks.
| Field | Type | Description |
|---|---|---|
onChange* | (networks: Network[]) => void | Callback fired whenever the configured-networks list changes — receives the latest snapshot. |
WatchNetworksReturnType
Return type of watchNetworks — call to stop receiving updates.
type WatchNetworksReturnType = () => void;Primitives
Base64String
Base64-encoded byte string — used for transaction payloads, BoCs, signatures, and other opaque binary blobs that travel through TonConnect and the indexer APIs.
type Base64String = string & {
readonly [base64StringBrand]: never;
};ExtraCurrencies
Map of extra-currency ids to raw amounts attached to a transaction message — TON's mechanism for transferring non-jetton native tokens (e.g., wrapped or testnet currencies). Keys are the extra-currency ids defined by the masterchain configuration.
type ExtraCurrencies = {
[key: string]: string;
};Hex
0x-prefixed hexadecimal string used for public keys and other hashes.
type Hex = `0x${string}` & {
readonly [hashBrand]: never;
};MutationOptionsOverride
TanStack Query useMutation options forwarded by AppKit's use*Mutation hooks via parameters.mutation — mutationFn, mutationKey and throwOnError are managed by the wrapper and stripped from this shape.
type MutationOptionsOverride = LooseOmit<
Query.MutationOptions<data, error, Compute<variables>, context>,
'mutationFn' | 'mutationKey' | 'throwOnError'
>;QueryOptionsOverride
TanStack Query useQuery options forwarded by AppKit's use*Query hooks via parameters.query — queryKey and queryFn are managed by the wrapper and stripped from this shape.
type QueryOptionsOverride = UnionLooseOmit<QueryOptions<queryFnData, error, data, queryKey>, 'queryKey' | 'queryFn'>;TokenAmount
Decimal string carrying a token amount. Preserves precision and avoids floating-point rounding (e.g., "1.5" TON, or raw nano units depending on the API).
type TokenAmount = string;UserFriendlyAddress
User-friendly TON wallet address as a base64url string (e.g., "EQDtFp...4q2").
type UserFriendlyAddress = string;Signing
SignBinaryParameters
Parameters accepted by signBinary.
| Field | Type | Description |
|---|---|---|
bytes* | Base64String | Binary blob the user is asked to sign, encoded as Base64. |
network | Network | Network to issue the sign request against. Defaults to AppKit's configured default network. When none is set, the wallet falls back to its current network. |
SignBinaryReturnType
Return type of signBinary.
type SignBinaryReturnType = SignDataResponse;SignCellParameters
Parameters accepted by signCell.
| Field | Type | Description |
|---|---|---|
cell* | Base64String | TON cell content encoded as Base64 (BoC). |
schema* | string | TL-B-style schema describing the cell layout so the wallet can render the payload to the user. |
network | Network | Network to issue the sign request against. Defaults to AppKit's configured default network. When none is set, the wallet falls back to its current network. |
SignCellReturnType
Return type of signCell.
type SignCellReturnType = SignDataResponse;SignData
Payload the user is asked to sign — discriminated union over 'text', 'binary', and 'cell'. Nested under SignDataRequest's data.
type SignData = | { type: 'text'; value: SignDataText }
| { type: 'binary'; value: SignDataBinary }
| { type: 'cell'; value: SignDataCell };SignDataBinary
Binary variant of SignData — opaque byte content the user is asked to sign.
| Field | Type | Description |
|---|---|---|
content* | Base64String | Raw binary content encoded as Base64. |
SignDataCell
TON cell variant of SignData — Base64-encoded cell payload paired with the schema needed to parse it.
| Field | Type | Description |
|---|---|---|
schema* | string | TL-B-style schema describing the cell layout so the wallet can render the payload to the user. |
content* | Base64String | Cell content encoded as Base64. |
SignDataRequest
Sign-data payload sent to WalletInterface's signData — discriminated by data.type ('text', 'binary', or 'cell').
| Field | Type | Description |
|---|---|---|
network | Network | Network to issue the sign request against. Defaults to the wallet's current network. |
from | string | Sender address in raw format. Usually omitted, the wallet fills it in. |
data* | SignData | Payload the user is asked to sign. |
SignDataResponse
Wallet response to a SignDataRequest — carries the signature plus the canonicalized address, timestamp, and domain the wallet committed to.
| Field | Type | Description |
|---|---|---|
signature* | string | Base64-encoded signature. |
address* | string | Wallet address that signed, in user-friendly format. |
timestamp* | number | Unix timestamp the wallet stamped onto the signature. |
domain* | string | dApp domain the wallet bound the signature to. |
payload* | SignDataRequest | Original payload that was signed, echoed back for binding. |
SignDataText
Plain-text variant of SignData — UTF-8 string the user is asked to sign.
| Field | Type | Description |
|---|---|---|
content* | string | UTF-8 text the user signs. |
SignTextParameters
Parameters accepted by signText.
| Field | Type | Description |
|---|---|---|
text* | string | UTF-8 text the user is asked to sign. |
network | Network | Network to issue the sign request against. Defaults to AppKit's configured default network. When none is set, the wallet falls back to its current network. |
SignTextReturnType
Return type of signText.
type SignTextReturnType = SignDataResponse;Staking
BuildStakeTransactionOptions
Options for buildStakeTransaction — extends StakeParams with an optional provider override.
| Field | Type | Description |
|---|---|---|
quote* | StakingQuote | The staking quote based on which the transaction is built. |
userAddress* | UserFriendlyAddress | Address of the user performing the staking. |
providerOptions | TProviderOptions = unknown | Provider-specific options. |
providerId | string | Provider to stake/unstake through. Defaults to the registered default staking provider. |
BuildStakeTransactionReturnType
Return type of buildStakeTransaction.
type BuildStakeTransactionReturnType = Promise<TransactionRequest>;GetStakedBalanceOptions
Options for getStakedBalance.
| Field | Type | Description |
|---|---|---|
userAddress* | UserFriendlyAddress | Owner whose staked balance should be read. |
network | Network | Network to query. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
providerId | string | Provider to query. Defaults to the registered default staking provider. |
GetStakedBalanceReturnType
Return type of getStakedBalance.
type GetStakedBalanceReturnType = Promise<StakingBalance>;GetStakingManagerReturnType
Return type of getStakingManager.
type GetStakingManagerReturnType = StakingManager;GetStakingProviderInfoOptions
Options for getStakingProviderInfo.
| Field | Type | Description |
|---|---|---|
network | Network | Network whose staking pool should be inspected. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
providerId | string | Provider to query. Defaults to the registered default staking provider. |
GetStakingProviderInfoReturnType
Return type of getStakingProviderInfo.
type GetStakingProviderInfoReturnType = Promise<StakingProviderInfo>;GetStakingProviderMetadataOptions
Options for getStakingProviderMetadata.
| Field | Type | Description |
|---|---|---|
network | Network | Network whose provider metadata should be read. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
providerId | string | Provider to query. Defaults to the registered default staking provider. |
GetStakingProviderMetadataReturnType
Return type of getStakingProviderMetadata.
type GetStakingProviderMetadataReturnType = StakingProviderMetadata;GetStakingProviderOptions
Options for getStakingProvider.
| Field | Type | Description |
|---|---|---|
id | string | Provider ID to look up. When omitted, returns the registered default staking provider. |
GetStakingProviderReturnType
Return type of getStakingProvider.
type GetStakingProviderReturnType = StakingProviderInterface;GetStakingProvidersReturnType
Return type of getStakingProviders.
type GetStakingProvidersReturnType = StakingProviderInterface[];GetStakingQuoteOptions
Options for getStakingQuote — extends StakingQuoteParams with an optional provider override.
| Field | Type | Description |
|---|---|---|
direction* | StakingQuoteDirection | Direction of the quote (stake or unstake) |
amount* | string | Amount of tokens to stake or unstake. |
userAddress | UserFriendlyAddress | Address of the user. |
network | Network | Network on which the staking will be executed. |
unstakeMode | UnstakeModes | Unstake-timing mode the quote should target — see UnstakeMode for the supported flavours ('INSTANT', 'WHEN_AVAILABLE', 'ROUND_END'). Only meaningful when direction === 'unstake' and the provider lists the mode in supportedUnstakeModes. |
isReversed | boolean | If true, for unstake requests the amount is specified in the staking coin (e.g. TON) instead of the Liquid Staking Token (e.g. tsTON). |
providerOptions | TProviderOptions = unknown | Provider-specific options. |
providerId | string | Provider to quote against. Defaults to the registered default staking provider. |
GetStakingQuoteReturnType
Return type of getStakingQuote.
type GetStakingQuoteReturnType = Promise<StakingQuote>;SetDefaultStakingProviderParameters
Parameters accepted by setDefaultStakingProvider.
| Field | Type | Description |
|---|---|---|
providerId* | string | ID of the provider to make default — must already be registered. |
SetDefaultStakingProviderReturnType
Return type of setDefaultStakingProvider.
type SetDefaultStakingProviderReturnType = void;StakeParams
Parameters for staking TON.
| Field | Type | Description |
|---|---|---|
quote* | StakingQuote | The staking quote based on which the transaction is built. |
userAddress* | UserFriendlyAddress | Address of the user performing the staking. |
providerOptions | TProviderOptions = unknown | Provider-specific options. |
StakingAPI
Staking API interface exposed by StakingManager
| Field | Type | Description |
|---|---|---|
getQuote* | (params: StakingQuoteParams, providerId?: string) => Promise<StakingQuote> | Get a quote for staking or unstaking |
buildStakeTransaction* | (params: StakeParams, providerId?: string) => Promise<TransactionRequest> | Build a transaction for staking |
getStakedBalance* | (userAddress: UserFriendlyAddress, network?: Network, providerId?: string) => Promise<StakingBalance> | Get user's staked balance |
getStakingProviderInfo* | (network?: Network, providerId?: string) => Promise<StakingProviderInfo> | Get staking provider information |
getStakingProviderMetadata* | (network?: Network, providerId?: string) => StakingProviderMetadata | Get static metadata for a staking provider |
createFactoryContext* | () => ProviderFactoryContext | Build a fresh ProviderFactoryContext the manager hands to provider factories at registration time. |
registerProvider* | (provider: ProviderInput<StakingProviderInterface>) => void | Register a new provider. If a provider with the same id is already registered, it is replaced. |
removeProvider* | (provider: StakingProviderInterface) => void | Remove a previously registered provider. No-op if the provider was not registered. |
setDefaultProvider* | (providerId: string) => void | Set the default provider |
getProvider* | (providerId?: string) => StakingProviderInterface | Get a registered provider |
getProviders* | () => Array<StakingProviderInterface> | Get all registered providers. The returned array keeps a stable reference until the provider list changes. |
hasProvider* | (providerId: string) => boolean | Check if a provider is registered |
StakingBalance
Staking balance information for a user.
| Field | Type | Description |
|---|---|---|
rawStakedBalance* | TokenAmount | Amount currently staked, in raw smallest units of the stake token (e.g., nano-TON). |
stakedBalance* | string | Amount currently staked, formatted to the stake token's decimals as a human-readable decimal string (e.g., "12.5"). |
rawInstantUnstakeAvailable* | TokenAmount | Amount available for instant unstake, in raw smallest units of the stake token (e.g., nano-TON). |
instantUnstakeAvailable* | string | Amount available for instant unstake, formatted to the stake token's decimals as a human-readable decimal string (e.g., "12.5"). |
providerId* | string | Identifier of the staking provider. |
StakingProviderInfo
Dynamic staking information for a provider.
| Field | Type | Description |
|---|---|---|
apy* | number | Annual Percentage Yield in basis points (100 = 1%) |
rawInstantUnstakeAvailable | TokenAmount | Amount available for instant unstake right now, in raw smallest units of the stake token (e.g., nano-TON). |
instantUnstakeAvailable | string | Amount available for instant unstake right now, formatted to the stake token's decimals as a human-readable decimal string (e.g., "12.5"). |
exchangeRate | string | Exchange rate between stakeToken and receiveToken (e.g. 1 TON = 0.95 tsTON). Undefined when there is no receiveToken (direct/custodial staking). |
StakingProviderMetadata
Static metadata for a staking provider.
| Field | Type | Description |
|---|---|---|
name* | string | Human-readable provider name (e.g. "Tonstakers") |
supportedUnstakeModes* | UnstakeModes[] | Supported unstake modes for this provider. |
supportsReversedQuote* | boolean | Whether provider supports reversed quote format (e.g., passing TON instead of tsTON for unstake) |
stakeToken* | StakingTokenInfo | Token that the user sends when staking (e.g. TON) |
receiveToken | StakingTokenInfo | Token that the user receives when staking (e.g. tsTON for liquid staking). Absent for direct/custodial staking. |
contractAddress | UserFriendlyAddress | Provider contract address (optional — custodial providers may not have one) |
StakingProviderMetadataOverride
Partial overrides applied on top of a provider's built-in StakingProviderMetadata. Used in provider configuration (e.g. TonStakersChainConfig.metadata) when an integrator needs to tweak the display name, token info or supported modes for a specific chain.
| Field | Type | Description |
|---|---|---|
name | string | Override the human-readable provider name surfaced in UIs. |
stakeToken | StakingTokenInfo | Override the StakingTokenInfo of the token the user sends when staking. |
receiveToken | StakingTokenInfo | Override the StakingTokenInfo of the token the user receives when staking (e.g. liquid-staking receipt). |
contractAddress | UserFriendlyAddress | Override the provider contract address (user-friendly format). |
supportedUnstakeModes | UnstakeModes[] | Override the list of supported unstake-timing modes. See UnstakeMode. |
supportsReversedQuote | boolean | Override whether the provider supports reversed-amount quotes (e.g., specifying TON instead of tsTON on an unstake quote). |
StakingQuote
Staking quote response with pricing information.
| Field | Type | Description |
|---|---|---|
direction* | StakingQuoteDirection | Direction of the quote (stake or unstake) |
rawAmountIn* | TokenAmount | Amount of tokens being provided. |
rawAmountOut* | TokenAmount | Estimated amount of tokens to be received. |
amountIn* | string | Formatted amount of tokens being provided. |
amountOut* | string | Formatted estimated amount of tokens to be received. |
network* | Network | Network on which the staking will be executed. |
providerId* | string | Identifier of the staking provider. |
unstakeMode | UnstakeModes | Unstake-timing mode the quote was produced for. Only meaningful when direction === 'unstake' — for 'stake' it is ignored. |
metadata | unknown | Provider-specific metadata for the quote. |
StakingQuoteDirection
Direction of the staking quote.
type StakingQuoteDirection = 'stake' | 'unstake';StakingQuoteParams
Parameters for getting a staking quote.
| Field | Type | Description |
|---|---|---|
direction* | StakingQuoteDirection | Direction of the quote (stake or unstake) |
amount* | string | Amount of tokens to stake or unstake. |
userAddress | UserFriendlyAddress | Address of the user. |
network | Network | Network on which the staking will be executed. |
unstakeMode | UnstakeModes | Unstake-timing mode the quote should target — see UnstakeMode for the supported flavours ('INSTANT', 'WHEN_AVAILABLE', 'ROUND_END'). Only meaningful when direction === 'unstake' and the provider lists the mode in supportedUnstakeModes. |
isReversed | boolean | If true, for unstake requests the amount is specified in the staking coin (e.g. TON) instead of the Liquid Staking Token (e.g. tsTON). |
providerOptions | TProviderOptions = unknown | Provider-specific options. |
StakingTokenInfo
Display metadata for a staking-pool token — ticker, decimals and address (or 'ton' for native TON). Carried on StakingProviderMetadata's stakeToken and receiveToken so the UI can render the pool's input/output assets.
| Field | Type | Description |
|---|---|---|
ticker* | string | Ticker symbol (e.g., "TON", "tsTON"). |
decimals* | number | Number of decimal places used to format raw amounts. |
address* | string | 'ton' for native TON, otherwise the token contract address in user-friendly format. |
TonStakersChainConfig
Per-chain Tonstakers config — optional TonAPI key for APY reads and an optional staking-provider metadata override.
| Field | Type | Description |
|---|---|---|
tonApiToken | string | TonAPI key used for APY reads. Optional — APY still works without it, but providing one is recommended when you already use TonAPI elsewhere. |
metadata | StakingProviderMetadataOverride | Optional StakingProviderMetadataOverride applied on top of the built-in Tonstakers metadata for this chain. |
TonStakersProviderConfig
Configuration accepted by createTonstakersProvider — map of chain ID (e.g. Network.mainnet().chainId) to its per-chain TonStakersChainConfig.
type TonStakersProviderConfig = {
[chainId: string]: TonStakersChainConfig;
};UnstakeModes
Union of UnstakeMode values. Carried on StakingQuoteParams's unstakeMode and on StakingProviderMetadata's supportedUnstakeModes to discriminate 'INSTANT' / 'WHEN_AVAILABLE' / 'ROUND_END' flows.
type UnstakeModes = (typeof UnstakeMode)[keyof typeof UnstakeMode];WatchStakingProvidersParameters
Parameters accepted by watchStakingProviders.
| Field | Type | Description |
|---|---|---|
onChange* | () => void | Callback fired whenever a staking provider is registered or the default staking provider changes. |
WatchStakingProvidersReturnType
Return type of watchStakingProviders — call to stop receiving updates.
type WatchStakingProvidersReturnType = () => void;Swap
BuildSwapTransactionOptions
Options for buildSwapTransaction — same shape as SwapParams.
type BuildSwapTransactionOptions = SwapParams<T>;BuildSwapTransactionReturnType
Return type of buildSwapTransaction.
type BuildSwapTransactionReturnType = Promise<TransactionRequest>;DeDustProviderOptions
DeDust-specific options forwarded through providerOptions on SwapQuoteParams / SwapParams.
| Field | Type | Description |
|---|---|---|
protocols | string[] | Protocols to use for routing. Available values: 'dedust', 'dedust_v3', 'dedust_v3_memepad', 'stonfi_v1', 'stonfi_v2', 'tonco', 'memeslab', 'tonfun'. Defaults to all protocols when omitted. |
excludeProtocols | string[] | Protocols to exclude from routing. |
onlyVerifiedPools | boolean | Only use verified pools. |
maxSplits | number | Maximum number of route splits |
maxLength | number | Maximum route length (hops) |
excludeVolatilePools | boolean | Exclude volatile pools. |
referralAddress | string | The address of the referrer. |
referralFeeBps | number | Referral fee in basis points (max 100 = 1%) |
DeDustQuoteMetadata
Provider-specific metadata returned on a SwapQuote's metadata from DeDust — carries the resolved route, fees and swapData payload that buildSwapTransaction needs.
| Field | Type | Description |
|---|---|---|
quoteResponse* | DeDustQuoteResponse | Raw quote response from API |
slippageBps* | number | Slippage used for the quote in basis points |
DeDustReferralOptions
Optional referral metadata attached to DeDust swaps so the provider can attribute them.
| Field | Type | Description |
|---|---|---|
referralAddress | string | The address of the referrer. |
referralFeeBps | number | Referral fee in basis points (max 100 = 1%) |
DeDustSwapProviderConfig
Configuration accepted by createDeDustProvider.
| Field | Type | Description |
|---|---|---|
providerId | string | Custom provider ID (defaults to 'dedust') |
defaultSlippageBps | number | Default slippage tolerance in basis points (1 bp = 0.01%) |
apiUrl | string | API base URL |
onlyVerifiedPools | boolean | Only use verified pools |
maxSplits | number | Maximum number of route splits |
maxLength | number | Maximum route length (hops) |
minPoolUsdTvl | string | Minimum pool TVL in USD |
metadata | SwapProviderMetadataOverride | Custom metadata for the provider. |
referralAddress | string | The address of the referrer. |
referralFeeBps | number | Referral fee in basis points (max 100 = 1%) |
GetSwapManagerReturnType
Return type of getSwapManager.
type GetSwapManagerReturnType = SwapManager;GetSwapProviderOptions
Options for getSwapProvider.
| Field | Type | Description |
|---|---|---|
id | string | Provider ID to look up. When omitted, returns the registered default swap provider. |
GetSwapProviderReturnType
Return type of getSwapProvider.
type GetSwapProviderReturnType = SwapProviderInterface;GetSwapProvidersReturnType
Return type of getSwapProviders.
type GetSwapProvidersReturnType = SwapProviderInterface[];GetSwapQuoteOptions
Options for getSwapQuote — extends SwapQuoteParams with an optional provider override.
| Field | Type | Description |
|---|---|---|
amount* | string | Amount of tokens to swap (incoming or outgoing depending on isReverseSwap) |
from* | SwapToken | Token to swap from. |
to* | SwapToken | Token to swap to. |
network* | Network | Network on which the swap will be executed. |
slippageBps | number | Slippage tolerance in basis points (1 bp = 0.01%) |
maxOutgoingMessages | number | Maximum number of outgoing messages |
providerOptions | TProviderOptions = unknown | Provider-specific options. |
isReverseSwap | boolean | If true, amount is the amount to receive (buy). If false, amount is the amount to spend (sell). |
providerId | string | Provider to quote against. Defaults to the registered default swap provider. |
GetSwapQuoteReturnType
Return type of getSwapQuote.
type GetSwapQuoteReturnType = Promise<SwapQuote>;OmnistonProviderOptions
Omniston-specific options forwarded through providerOptions on SwapQuoteParams / SwapParams.
| Field | Type | Description |
|---|---|---|
settlementMethods | SettlementMethodValue[] | Settlement methods to use for the swap. |
referrerAddress | string | The address of the referrer. |
referrerFeeBps | number | Referrer fee in basis points (1 bp = 0.01%) |
flexibleReferrerFee | boolean | Whether a flexible referrer fee is allowed. |
OmnistonQuoteMetadata
Provider-specific metadata returned on a SwapQuote's metadata from Omniston — carries the resolved route and signed quote payload that buildSwapTransaction needs.
| Field | Type | Description |
|---|---|---|
omnistonQuote* | Quote | The actual Omniston quote object |
OmnistonReferrerOptions
Optional referrer metadata attached to Omniston swaps so the provider can attribute them.
| Field | Type | Description |
|---|---|---|
referrerAddress | string | The address of the referrer. |
referrerFeeBps | number | Referrer fee in basis points (1 bp = 0.01%) |
flexibleReferrerFee | boolean | Whether a flexible referrer fee is allowed. |
OmnistonSwapProviderConfig
Configuration accepted by createOmnistonProvider.
| Field | Type | Description |
|---|---|---|
apiUrl | string | Optional URL for the Omniston API |
defaultSlippageBps | number | Default slippage tolerance in basis points (1 bp = 0.01%) |
quoteTimeoutMs | number | Timeout for quote requests in milliseconds |
providerId | string | Identifier for the provider. |
metadata | SwapProviderMetadataOverride | Custom metadata for the provider. |
referrerAddress | string | The address of the referrer. |
referrerFeeBps | number | Referrer fee in basis points (1 bp = 0.01%) |
flexibleReferrerFee | boolean | Whether a flexible referrer fee is allowed. |
SetDefaultSwapProviderParameters
Parameters accepted by setDefaultSwapProvider.
| Field | Type | Description |
|---|---|---|
providerId* | string | ID of the provider to make default — must already be registered. |
SetDefaultSwapProviderReturnType
Return type of setDefaultSwapProvider.
type SetDefaultSwapProviderReturnType = void;SwapAPI
API surface exposed by SwapManager — quote and build-transaction calls (plus the provider-management methods inherited from DefiManagerAPI). Mostly relevant when authoring a swap manager replacement.
| Field | Type | Description |
|---|---|---|
getQuote* | (params: SwapQuoteParams, providerId?: string) => Promise<SwapQuote> | Get a quote for swapping tokens |
buildSwapTransaction* | (params: SwapParams) => Promise<TransactionRequest> | Build a transaction for a swap. Provider is taken from params.quote.providerId, or the manager default. |
createFactoryContext* | () => ProviderFactoryContext | Build a fresh ProviderFactoryContext the manager hands to provider factories at registration time. |
registerProvider* | (provider: ProviderInput<SwapProviderInterface<unknown, unknown>>) => void | Register a new provider. If a provider with the same id is already registered, it is replaced. |
removeProvider* | (provider: SwapProviderInterface<unknown, unknown>) => void | Remove a previously registered provider. No-op if the provider was not registered. |
setDefaultProvider* | (providerId: string) => void | Set the default provider |
getProvider* | (providerId?: string) => SwapProviderInterface<unknown, unknown> | Get a registered provider |
getProviders* | () => Array<SwapProviderInterface<unknown, unknown>> | Get all registered providers. The returned array keeps a stable reference until the provider list changes. |
hasProvider* | (providerId: string) => boolean | Check if a provider is registered |
SwapParams
Parameters consumed by buildSwapTransaction — the previously obtained SwapQuote plus optional provider-specific options (TProviderOptions).
| Field | Type | Description |
|---|---|---|
quote* | SwapQuote | The swap quote based on which the transaction is built. |
userAddress* | UserFriendlyAddress | Address of the user performing the swap. |
destinationAddress | UserFriendlyAddress | Address to receive the swapped tokens (defaults to userAddress) |
slippageBps | number | Slippage tolerance in basis points (1 bp = 0.01%) |
deadline | number | Unix timestamp (in seconds) after which the swap transaction must not be executed. |
providerOptions | TProviderOptions = unknown | Provider-specific options. |
SwapQuote
Quote returned by getSwapQuote — source/target tokens, expected amounts, rate, slippage, fees and the provider-specific metadata that buildSwapTransaction needs to construct the transaction.
| Field | Type | Description |
|---|---|---|
fromToken* | SwapToken | Token being sold. |
toToken* | SwapToken | Token being bought. |
rawFromAmount* | TokenAmount | Amount of fromToken to sell, in raw smallest units (e.g., nano-TON). |
rawToAmount* | TokenAmount | Amount of toToken to buy, in raw smallest units (e.g., nano-TON). |
fromAmount* | string | Amount of fromToken to sell, formatted to the token's decimals as a human-readable decimal string (e.g., "1.5"). |
toAmount* | string | Amount of toToken to buy, formatted to the token's decimals as a human-readable decimal string (e.g., "1.5"). |
rawMinReceived* | TokenAmount | Minimum amount of toToken to receive after slippage, in raw smallest units (e.g., nano-TON). |
minReceived* | string | Minimum amount of toToken to receive after slippage, formatted to the token's decimals as a human-readable decimal string (e.g., "1.5"). |
network* | Network | Network on which the swap will be executed. |
priceImpact | number | Price impact of the swap in basis points (100 = 1%) |
providerId* | string | Identifier of the swap provider. |
expiresAt | number | Unix timestamp in seconds when the quote expires |
metadata | unknown | Provider-specific metadata for the quote. |
SwapQuoteParams
Parameters consumed by getSwapQuote — source/target tokens and an amount that is interpreted as either the spend side or the receive side (isReverseSwap flag), plus optional slippage and provider-specific options.
| Field | Type | Description |
|---|---|---|
amount* | string | Amount of tokens to swap (incoming or outgoing depending on isReverseSwap) |
from* | SwapToken | Token to swap from. |
to* | SwapToken | Token to swap to. |
network* | Network | Network on which the swap will be executed. |
slippageBps | number | Slippage tolerance in basis points (1 bp = 0.01%) |
maxOutgoingMessages | number | Maximum number of outgoing messages |
providerOptions | TProviderOptions = unknown | Provider-specific options. |
isReverseSwap | boolean | If true, amount is the amount to receive (buy). If false, amount is the amount to spend (sell). |
SwapToken
Token descriptor passed to getSwapQuote via SwapQuoteParams's from and to fields (and surfaced on the resulting SwapQuote) — address, decimals plus optional symbol/name/image used by swap-input UIs.
| Field | Type | Description |
|---|---|---|
address* | string | Token contract address. 'ton' is used for native TON on the TON chain. |
decimals* | number | Number of decimal places used to format raw amounts. |
name | string | Display name (e.g., "Tether USD"). |
symbol | string | Ticker symbol (e.g., "USDT"). |
image | string | URL of the token's image. |
chainId | string | Chain id in CAIP-2 format when the token lives outside TON. |
WatchSwapProvidersParameters
Parameters accepted by watchSwapProviders.
| Field | Type | Description |
|---|---|---|
onChange* | () => void | Callback fired whenever a swap provider is registered or the default swap provider changes. |
WatchSwapProvidersReturnType
Return type of watchSwapProviders — call to stop receiving updates.
type WatchSwapProvidersReturnType = () => void;Transactions
CreateTransferTonTransactionParameters
Parameters accepted by createTransferTonTransaction and transferTon.
| Field | Type | Description |
|---|---|---|
recipientAddress* | UserFriendlyAddress | Recipient address. |
amount* | string | Amount in TON as a human-readable decimal string (e.g., "1.5"). Converted to nano-TON internally. |
comment | string | Human-readable text comment. Converted to a Base64 payload when no payload is supplied. |
payload | Base64String | Raw Base64 message payload — wins over comment when both are set. |
stateInit | Base64String | Initial state for deploying a new contract, encoded as Base64. |
CreateTransferTonTransactionReturnType
Return type of createTransferTonTransaction.
type CreateTransferTonTransactionReturnType = TransactionRequest;GetTransactionStatusParameters
Parameters accepted by getTransactionStatus — must carry exactly one of boc or normalizedHash, plus an optional network override.
type GetTransactionStatusParameters = {
/** Network to check the transaction on. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. */
network?: Network;
} & (
| {
/** Base64-encoded BoC of the sent transaction (returned by {@link sendTransaction}). */
boc: string;
normalizedHash?: never;
}
| {
boc?: never;
/** Hex-encoded normalized hash of the external-in message (returned by {@link sendTransaction} as `normalizedHash`). */
normalizedHash: string;
}
);GetTransactionStatusReturnType
Return type of getTransactionStatus.
type GetTransactionStatusReturnType = TransactionStatusResponse;SendTransactionParameters
Parameters accepted by sendTransaction — same shape as TransactionRequest.
type SendTransactionParameters = TransactionRequest;SendTransactionResponse
Wallet response carrying the BoC (bag of cells) of the external message that was signed and broadcast — used to track or hash the resulting transaction.
| Field | Type | Description |
|---|---|---|
boc* | Base64String | BoC of the sent transaction. |
normalizedBoc* | Base64String | Normalized BoC of the external-in message. |
normalizedHash* | Hex | Hash of the normalized external-in message. |
SendTransactionReturnType
Return type of sendTransaction.
type SendTransactionReturnType = SendTransactionResponse;Transaction
Single transaction record carried inside TransactionsUpdate's transactions — account, lt/hash, in/out messages and emulation result.
| Field | Type | Description |
|---|---|---|
account* | UserFriendlyAddress | Account of the transaction. |
accountStateBefore | AccountState | The state of the account before the transaction was executed. |
accountStateAfter | AccountState | The state of the account after the transaction has been applied. |
description | TransactionDescription | The detailed breakdown of the transaction execution. |
hash* | Hex | Hash of the transaction. |
logicalTime* | LogicalTime | The logical time of the transaction. |
now* | number | Unix timestamp of the transaction. |
mcBlockSeqno* | number | Masterchain block sequence number |
traceExternalHash* | Hex | External hash of the trace. |
traceId | string | ID of the trace. |
previousTransactionHash | string | The hash of the previous transaction. |
previousTransactionLogicalTime | LogicalTime | The logical time of the previous transaction. |
origStatus | AccountStatus | Original status of the transaction. |
endStatus | AccountStatus | End status of the transaction. |
totalFees | TokenAmount | Total fees of the transaction. |
totalFeesExtraCurrencies | ExtraCurrencies | Extra currencies in the total fees. |
blockRef | TransactionBlockRef | The reference to the block in which the transaction was included. |
inMessage | TransactionMessage | The incoming message associated with the transaction. |
outMessages* | TransactionMessage[] | The list of outgoing messages produced by the transaction. |
isEmulated* | boolean | Emulated state of the transaction. |
TransactionRequest
Transaction payload passed to WalletInterface's sendTransaction — one or more messages, optional network override and validUntil deadline.
| Field | Type | Description |
|---|---|---|
messages* | TransactionRequestMessage[] | Messages to include in the transaction. |
network | Network | Network to execute the transaction on. |
validUntil | number | Unix timestamp (seconds) after which the transaction becomes invalid. |
fromAddress | string | Sender wallet address — accepts either raw or user-friendly format. |
TransactionRequestMessage
Individual message inside a TransactionRequest — recipient, amount, optional payload and contract stateInit.
| Field | Type | Description |
|---|---|---|
address* | string | Recipient wallet address — accepts either raw or user-friendly format. |
amount* | TokenAmount | Amount to transfer, in nano-TON (1 TON = 10⁹ nano-TON). |
extraCurrency | ExtraCurrencies | Additional currencies to include in the transfer. |
stateInit | string | Initial state for deploying a new contract, encoded as Base64. |
payload | string | Message payload, encoded as Base64. |
TransactionsUpdate
Update payload delivered to watchTransactions / watchTransactionsByAddress subscribers when transactions land for the watched address.
| Field | Type | Description |
|---|---|---|
type* | 'transactions' | Discriminator pinned to 'transactions' — identifies this update as a transactions stream payload. |
address* | UserFriendlyAddress | Account address the transactions belong to (the watched address). |
transactions* | Transaction[] | Transactions that landed for address in this update. |
traceHash* | Hex | Hash of the trace that produced these transactions — the root external-message hash that spawned them. |
addressBook | AddressBook | Pre-resolved address-book entries for raw addresses referenced inside transactions, so the UI can render labels without extra lookups. |
metadata | TransactionAddressMetadata | Pre-fetched address metadata (interfaces, domain) for the watched address. |
status* | StreamingUpdateStatus | Finality stage of the update — see StreamingUpdateStatus. |
TransferTonParameters
Parameters accepted by transferTon — same shape as CreateTransferTonTransactionParameters.
type TransferTonParameters = CreateTransferTonTransactionParameters;TransferTonReturnType
Return type of transferTon.
type TransferTonReturnType = SendTransactionResponse;WatchTransactionsByAddressOptions
Options for watchTransactionsByAddress.
| Field | Type | Description |
|---|---|---|
address* | UserFriendlyAddress | Address | Address to watch — pass a UserFriendlyAddress string or an Address instance from @ton/core. |
onChange* | (update: TransactionsUpdate) => void | Callback fired on every transactions update from the streaming provider. |
network | Network | Network to watch on. Defaults to the selected wallet's network. If no wallet is selected, falls back to AppKit's default network, or mainnet when none is set. |
WatchTransactionsByAddressReturnType
Return type of watchTransactionsByAddress — call to stop receiving updates.
type WatchTransactionsByAddressReturnType = () => void;WatchTransactionsOptions
Options for watchTransactions.
| Field | Type | Description |
|---|---|---|
onChange* | (update: TransactionsUpdate) => void | Callback fired on every transactions update from the streaming provider. |
network | Network | Network to watch on. Defaults to the selected wallet's network. |
WatchTransactionsReturnType
Return type of watchTransactions — call to stop receiving updates.
type WatchTransactionsReturnType = () => void;Wallets
GetConnectedWalletsReturnType
Return type of getConnectedWallets — read-only view of the connected-wallets array.
type GetConnectedWalletsReturnType = readonly WalletInterface[];GetSelectedWalletReturnType
Return type of getSelectedWallet — null when no wallet is currently selected.
type GetSelectedWalletReturnType = WalletInterface | null;SetSelectedWalletIdParameters
Parameters accepted by setSelectedWalletId.
| Field | Type | Description |
|---|---|---|
walletId* | string | null | Wallet ID (as returned by WalletInterface's getWalletId()) to select. Pass null to clear the selection. |
SetSelectedWalletIdReturnType
Return type of setSelectedWalletId.
type SetSelectedWalletIdReturnType = void;TonConnectWalletAdapterConfig
Configuration accepted by TonConnectWalletAdapter when wrapping a TonConnect wallet for AppKit.
| Field | Type | Description |
|---|---|---|
connectorId* | string | ID of the connector that produced this wallet — surfaced as WalletInterface.connectorId. |
tonConnectWallet* | TonConnectWallet | Underlying TonConnect wallet object. |
tonConnectUI* | TonConnectUI | TonConnect UI instance used to drive sendTransaction and signData calls. |
WalletInterface
Wallet contract surfaced by every Connector — covers identity (address, public key, network) and signing operations. Reads (balance, jettons, NFTs) go through AppKit actions instead.
| Field | Type | Description |
|---|---|---|
connectorId* | string | ID of the Connector that produced this wallet. |
getAddress* | () => UserFriendlyAddress | Wallet address as a user-friendly base64url string. |
getPublicKey* | () => Hex | Wallet public key as a 0x-prefixed hex string. |
getNetwork* | () => Network | Network the wallet is currently connected to. |
getWalletId* | () => string | Stable identifier combining address and network — unique across AppKit's connected wallets. |
sendTransaction* | (request: TransactionRequest) => Promise<SendTransactionResponse> | Send a transaction — the wallet signs and broadcasts it. |
signData* | (payload: SignDataRequest) => Promise<SignDataResponse> | Sign arbitrary data — text, binary or TON cell — through the wallet's sign-data flow. |
WatchConnectedWalletsParameters
Parameters accepted by watchConnectedWallets.
| Field | Type | Description |
|---|---|---|
onChange* | (wallets: WalletInterface[]) => void | Callback fired whenever the list of connected wallets changes — receives the latest snapshot. |
WatchConnectedWalletsReturnType
Return type of watchConnectedWallets — call to stop receiving updates.
type WatchConnectedWalletsReturnType = () => void;WatchSelectedWalletParameters
Parameters accepted by watchSelectedWallet.
| Field | Type | Description |
|---|---|---|
onChange* | (wallet: WalletInterface | null) => void | Callback fired whenever the selected wallet changes — receives the new wallet, or null when the selection was cleared. |
WatchSelectedWalletReturnType
Return type of watchSelectedWallet — call to stop receiving updates.
type WatchSelectedWalletReturnType = () => void;Constants
Connectors
CONNECTOR_EVENTS
Event names AppKit emits for connector-list and connector-wallet changes. Payloads are ConnectorAddedPayload, ConnectorRemovedPayload and ConnectorWalletsUpdatedPayload.
const CONNECTOR_EVENTS = {
/** A connector was registered via {@link addConnector} (or AppKit's constructor). */
ADDED: 'connector:added',
/** A connector was unregistered — typically by calling the unregister function returned from {@link addConnector}, or as part of the connector's own teardown. */
REMOVED: 'connector:removed',
/** A connector's connected-wallets list changed (connect, disconnect, or account switch inside the wallet). */
WALLETS_UPDATED: 'connector:wallets-updated',
} as const;TONCONNECT_DEFAULT_CONNECTOR_ID
Default id assigned to the TonConnect connector when none is supplied to createTonConnectConnector. Pass this to connect / disconnect to drive the TonConnect flow without hard-coding the literal.
const TONCONNECT_DEFAULT_CONNECTOR_ID = 'tonconnect';Crypto Onramp
CryptoOnrampErrorCode
Discriminator carried on every CryptoOnrampError's code — covers provider/quote/deposit failures and refund-address validation.
| Field | Type | Description |
|---|---|---|
ProviderError* | "PROVIDER_ERROR" | Provider's upstream API rejected the call (unexpected response, auth failure, internal error). |
QuoteFailed* | "QUOTE_FAILED" | Provider could not produce a quote for the supplied parameters. |
DepositFailed* | "DEPOSIT_FAILED" | Provider could not create a deposit for the previously obtained quote. |
RefundAddressRequired* | "REFUND_ADDRESS_REQUIRED" | Provider requires a refund address that the caller did not supply. |
InvalidRefundAddress* | "INVALID_REFUND_ADDRESS" | Supplied refund address is not valid for the source chain. |
ReversedAmountNotSupported* | "REVERSED_AMOUNT_NOT_SUPPORTED" | Provider does not support specifying the amount on the target side of the swap. |
InvalidParams* | "INVALID_PARAMS" | Caller passed parameters that fail provider-level validation. |
DeFi
DefiErrorCode
Discriminator carried on DefiError's code for codes shared by every DeFi domain — provider lookup, default-provider state, and shared transport/validation failures. Subclass codes (SwapErrorCode, StakingErrorCode, CryptoOnrampErrorCode) cover domain-specific failures.
| Field | Type | Description |
|---|---|---|
ProviderNotFound* | "PROVIDER_NOT_FOUND" | Provider with the requested id is not registered with the manager. |
NoDefaultProvider* | "NO_DEFAULT_PROVIDER" | No default provider is configured and the caller did not specify one. |
NetworkError* | "NETWORK_ERROR" | Provider rejected the request because of an upstream/network failure. |
UnsupportedNetwork* | "UNSUPPORTED_NETWORK" | Provider does not support the network selected for the operation. |
InvalidParams* | "INVALID_PARAMS" | Caller passed parameters that fail provider-level validation. |
InvalidProvider* | "INVALID_PROVIDER" | Provider failed its own internal validation and cannot be used. |
Networks
NETWORKS_EVENTS
Event names AppKit emits on network changes. DEFAULT_CHANGED carries a DefaultNetworkChangedPayload.
const NETWORKS_EVENTS = {
UPDATED: 'networks:updated',
DEFAULT_CHANGED: 'networks:default-changed',
} as const;Staking
StakingErrorCode
Discriminator carried on every StakingError's code — 'INVALID_PARAMS' (the request was malformed) or 'UNSUPPORTED_OPERATION' (the provider doesn't support this call).
| Field | Type | Description |
|---|---|---|
InvalidParams* | "INVALID_PARAMS" | Caller passed parameters that fail provider-level validation. |
UnsupportedOperation* | "UNSUPPORTED_OPERATION" | Provider doesn't support the requested operation (e.g., reversed quote on a unidirectional pool). |
UnstakeMode
Allowed unstake-timing flavours referenced by UnstakeModes and StakingProviderMetadata's supportedUnstakeModes — 'INSTANT' (immediate withdrawal when the pool has liquidity, otherwise the funds are returned), 'WHEN_AVAILABLE' (paid out as soon as liquidity is available — instantly or at round end), 'ROUND_END' (paid out at the end of the staking round, typically for the best rate).
const UnstakeMode = { readonly INSTANT: "INSTANT"; readonly WHEN_AVAILABLE: "WHEN_AVAILABLE"; readonly ROUND_END: "ROUND_END"; };Swap
SwapErrorCode
Discriminator carried on every SwapError's code — covers quote / liquidity / transaction-build failures plus the shared NETWORK_ERROR for upstream-API faults.
| Field | Type | Description |
|---|---|---|
InvalidQuote* | "INVALID_QUOTE" | Provider returned malformed or missing quote data. |
InsufficientLiquidity* | "INSUFFICIENT_LIQUIDITY" | No route or pool has enough liquidity to satisfy the requested swap. |
QuoteExpired* | "QUOTE_EXPIRED" | Quote payload is too old to use. Fetch a new one before building the transaction. |
BuildTxFailed* | "BUILD_TX_FAILED" | Provider failed to produce a swap transaction from the supplied quote. |
NetworkError* | "NETWORK_ERROR" | Provider rejected the request because of an upstream/network failure. |
Wallets
WALLETS_EVENTS
Event names AppKit emits when the available wallet list (UPDATED) or the active wallet (SELECTION_CHANGED) changes.
const WALLETS_EVENTS = {
UPDATED: 'wallets:updated',
SELECTION_CHANGED: 'wallets:selection-changed',
} as const;Last updated on