Configuration
Configuration options and settings for @tetherto/wdk-wallet-ton-gasless
Wallet Configuration
import WalletManagerTonGasless from '@tetherto/wdk-wallet-ton-gasless'
const config = {
// Required parameters
tonClient: {
url: 'https://toncenter.com/api/v3',
secretKey: 'your-api-key' // Optional
},
gasFreeProvider: 'https://your-gasfree-provider.com',
gasFreeApiKey: 'your-gasfree-api-key',
gasFreeApiSecret: 'your-gasfree-api-secret',
serviceProvider: 'EQ...', // Service provider's TON address
verifyingContract: 'EQ...', // Verifying contract address
chainId: '1', // TON chain ID
// Optional parameters
transferMaxFee: 10000000 // Maximum fee in token base units
}
const wallet = new WalletManagerTonGasless(seedPhrase, config)Account Configuration
import { WalletAccountTonGasless } from '@tetherto/wdk-wallet-ton-gasless'
const accountConfig = {
// Required parameters
tonClient: {
url: 'https://toncenter.com/api/v3',
secretKey: 'your-api-key' // Optional
},
gasFreeProvider: 'https://your-gasfree-provider.com',
gasFreeApiKey: 'your-gasfree-api-key',
gasFreeApiSecret: 'your-gasfree-api-secret',
serviceProvider: 'EQ...', // Service provider's TON address
verifyingContract: 'EQ...', // Verifying contract address
chainId: '1', // TON chain ID
// Optional parameters
transferMaxFee: 10000000 // Maximum fee in token base units
}
const account = new WalletAccountTonGasless(seedPhrase, "0'/0/0", accountConfig)Configuration Options
tonClient
The tonClient option configures the TON Center API client for blockchain interactions.
Type:
interface TonClientConfig {
/**
* TON Center API endpoint URL
* @example 'https://toncenter.com/api/v3'
*/
url: string;
/**
* Optional API key for TON Center
* Required for higher rate limits
*/
secretKey?: string;
}gasFreeProvider
The gasFreeProvider option specifies the gas-free service endpoint.
Type: string
Required: Yes
Example:
const config = {
gasFreeProvider: 'https://your-gasfree-provider.com'
}gasFreeApiKey and gasFreeApiSecret
API credentials for the gas-free service.
Type: string
Required: Yes
Example:
const config = {
gasFreeApiKey: 'your-gasfree-api-key',
gasFreeApiSecret: 'your-gasfree-api-secret'
}serviceProvider
The TON address of the service provider that handles gas-free transactions.
Type: string
Required: Yes
Example:
const config = {
serviceProvider: 'EQ...' // TON address
}verifyingContract
The TON address of the contract that verifies gas-free transactions.
Type: string
Required: Yes
Example:
const config = {
verifyingContract: 'EQ...' // TON address
}chainId
The blockchain's identifier.
Type: string
Required: Yes
Example:
const config = {
chainId: '1' // TON mainnet
}transferMaxFee
The transferMaxFee option sets the maximum allowed fee in token base units for transfer operations.
Type: number
Required: No
Example:
const config = {
transferMaxFee: 10000000 // Maximum fee in token base units
}Complete Configuration Example
Here's a complete configuration example with all options:
const config = {
// TON Client (Required)
tonClient: {
url: 'https://toncenter.com/api/v3',
secretKey: 'your-api-key'
},
// Gas-free Service (Required)
gasFreeProvider: 'https://your-gasfree-provider.com',
gasFreeApiKey: 'your-gasfree-api-key',
gasFreeApiSecret: 'your-gasfree-api-secret',
// Contract Addresses (Required)
serviceProvider: 'EQ...', // Service provider's address
verifyingContract: 'EQ...', // Verifying contract address
// Chain Configuration (Required)
chainId: '1', // TON mainnet
// Fee Limits (Optional)
transferMaxFee: 10000000 // Maximum fee in token base units
}Security Considerations
Keep API keys and secrets secure and never expose them in client-side code
Use environment variables for sensitive configuration values
Always use HTTPS URLs for API endpoints
Set appropriate
transferMaxFeelimits to prevent excessive feesValidate contract addresses before using them in configuration
</tbody>
