TON Jetton Transfer Application
A React application that enables Jetton transfers using the TONX SDK. Refer to this sample project's GitHub repository.
Environment Setup
- Install pnpm globally:
npm install -g pnpm
- Install project dependencies:
pnpm install
Important Configuration Notes
Network Configuration
- The application is configured for testnet use. Ensure correct network setting:
const provider = new TONXJsonRpcProvider({
network: "testnet", // Keep this as testnet for development
apiKey: import.meta.env.VITE_TONXAPI_KEY,
});
Wallet Configuration
This application uses WalletContractV4. You need to:
- Configure your mnemonic phrases:
const MNEMONIC = ['your', 'mnemonic']; // Replace with your mnemonic phrases
- Important: The wallet must be deployed before attempting transfers
if (!contractDeployed) {
throw new Error("Wallet not deployed");
}
Required Addresses
The application requires three inputs:
- Your Jetton Wallet Address
- Recipient's TON Address
- Amount of Jettons to transfer (will be multiplied by 10^6)
API Key Setup
- Get your API key from dashboard.tonxapi.com
- Important: Use a testnet API key
Features
- Transfer Jettons between addresses
- Support for WalletContractV4
- Real-time transfer status updates
- Error handling and validation
- Loading state management
Running the Application
Start the development server:
pnpm dev
Access the application (usually at http://localhost:4000
)
Component Functionality
Transfer Process
- Input validation
- Wallet deployment check
- Create jetton transfer message with forward payload
- Transaction execution
- Status updates
Security Best Practices
- Never commit mnemonics or API keys to version control
- Validate all input addresses
- Handle API errors appropriately
- Implement proper error handling for failed transfers
Common Issues and Troubleshooting
-
Wallet Not Deployed Error
- Ensure your wallet is properly deployed on testnet
- Verify mnemonic phrases are correct
- Check if you have sufficient balance for deployment
-
Transfer Failures
- Verify Jetton wallet address is correct
- Ensure recipient address is valid
- Check if amount is within valid range
-
API Key Issues
- Verify you're using a testnet API key
- Ensure proper network connectivity