Tutorials and Examples
import { TMAWalletClient } from '@tmawallet/sdk'; (async () => { const tmaWallet = new TMAWalletClient('your_project_public_token'); await tmaWallet.init(); if (!tmaWallet.isBundleExists) { await tmaWallet.createBundle(); } console.log('Wallet address:', tmaWallet.walletAddress); })();import { TMAWalletClient } from '@tmawallet/sdk'; (async () => { const tmaWallet = new TMAWalletClient('your_project_public_token'); await tmaWallet.init(); if (tmaWallet.isBundleExists) { console.log('Restored wallet address:', tmaWallet.walletAddress); } else { console.log('No existing wallet found.'); } })();import { TMAWalletClient } from '@tmawallet/sdk'; import { ethers } from 'ethers'; (async () => { const tmaWallet = new TMAWalletClient('your_project_public_token'); await tmaWallet.init(); if (tmaWallet.isBundleExists) { const wallet = new ethers.Wallet(tmaWallet.privateKey); const provider = ethers.getDefaultProvider('ropsten'); const signer = wallet.connect(provider); const tx = { to: 'recipient_address', value: ethers.utils.parseEther('0.01'), gasLimit: 21000, }; const transactionResponse = await signer.sendTransaction(tx); console.log('Transaction Hash:', transactionResponse.hash); } else { console.log('No wallet found to make a transaction.'); } })();
Last updated