-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send tokens other than ETH #69
Comments
A transaction sending an ERC-20 token needs to have the token contract as the recipient (the to field), and the data field containing encoded instructions to execute its transfer() function along with address of the token receiver and amount. Here's some more information: https://stackoverflow.com/a/70847856/798314 |
I did it but metamask does not recognize the token. I think it is because in wallet_connect send_transaction, the value is always in ETH? |
@LongTien15 You can try and write your own Future<String> sendTransaction({
required String from,
String? to,
Uint8List? data,
int? gas,
BigInt? gasPrice,
BigInt? value,
int? nonce,
}) async {
final result = await connector.sendCustomRequest(
method: 'eth_sendTransaction',
params: [
{
'from': from,
if (data != null) 'data': hex.encode(List<int>.from(data)),
if (to != null) 'to': to,
if (gas != null) 'gas': '0x${gas.toRadixString(16)}',
if (gasPrice != null) 'gasPrice': '0x${gasPrice.toRadixString(16)}',
if (value != null) 'value': '0x${value.toRadixString(16)}',
if (nonce != null) 'nonce': '0x${nonce.toRadixString(16)}',
}
],
);
return result;
} |
I called the transfer from, from my account to the DAI ERC20 smart contract |
Sorry, my bad. My parameters are wrong. Thank you |
Managed to send some DAI to the contract. But i cannot approve it. calling send transaction with the approve function as the data not working. |
any update ? |
hey when i use this result coming null how i can fix this?? |
EthereumWalletConnectProvider send transasction only to send eth, i want to send other tokens in my metamask wallet like DAI,..
The text was updated successfully, but these errors were encountered: