You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
Please add a button that sends an erc20 token so I can test if the wallets works or not. I'm trying to build a code that sends erc20 tokens through walletconnect but it's not working and I couldn't find any sample, tests or anything about it, always only native transactions which are not the same.
The text was updated successfully, but these errors were encountered:
Somehow Trust Wallet made a lot of problems, at least for MetaMask no problem.
// Some preparation ...// DISCLAIMER: No compiler used right now, please check on your own.// Get the wallet address that is connected.// Check official example ...constconnectedWalletAddress="0xFFFF..."// ERC-20 information based on USDT on Ethereum// Check: https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7consterc20ContractAddress="0xdac17f958d2ee523a2206206994597c13d831ec7"consterc20Decimals=6// Define recipient addressletrecipientAddress="0xABCDEFG..."// Remove the "0x" part if available.// The reason is that the data string// we build below expects a format without that.if(recipientAddress.indexOf("0x")>=0)recipientAddress=recipientAddress.replace("0x","")// Our data string starts with "0x"letdataStr="0x"// Add the function signature of "transfer"dataStr+="a9059cbb"// Add some padding ...dataStr+="000000000000000000000000"// Then, add our prepared recipient addressdataStr+=recipientAddress// Use tokenAmountletpaddedTokenAmount=pad(tokenAmount,erc20Decimals)lethexTokenAmount=BigInt(paddedTokenAmount).toString(16)dataStr+=pad(hexTokenAmount,64)myTx={from: connectedWalletAddress,to: erc20ContractAddress,value: "0x0",data: dataStr}awaitconnector.sendTransaction(myTx);
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Please add a button that sends an erc20 token so I can test if the wallets works or not. I'm trying to build a code that sends erc20 tokens through walletconnect but it's not working and I couldn't find any sample, tests or anything about it, always only native transactions which are not the same.
The text was updated successfully, but these errors were encountered: