Closed TransFormes closed 2 years ago
final transfer = contract.function('transfer'); var res1 = await client.sendTransaction( credentials, Transaction.callContract( contract: contract, function: transfer, from: EthereumAddress(credentials.address.addressBytes), parameters: [ EthereumAddress(credentials.address.addressBytes), BigInt.from(1) ], value: EtherAmount.fromUnitAndValue(EtherUnit.ether, '0.01')), chainId: 4);
I can send 0.01 ETH using Web3
var result = await client.transfer( privateKey: 'privateKey', toAddress: 'toAddress', amount: 0.1);
Using doubles as a monetary amount isn't a great idea. You can use EtherAmount.fromUnitAndValue(EtherUnit.finney, 10)
though.
I can change to 1ETH, but I want to change to 0.01, but the error is reported, how should I change