Open
Description
i have "total_balance_formatted": "0.000528902815064832",
here is code
double amount = 0.000128902815064832;
BigInt bigIntValue = BigInt.from(amount * pow(10, 18));
EtherAmount ethAmount =
EtherAmount.fromBigInt(EtherUnit.wei, bigIntValue);
var apiUrl =
"https://eth-sepolia.g.alchemy.com/v2/XXXmy_APi_KeyXXX";
var httpClient = http.Client();
var ethClient = Web3Client(apiUrl, httpClient);
EthPrivateKey credentials = EthPrivateKey.fromHex('0x$XXXMy_private_KeyXXX');
EtherAmount etherAmount = await ethClient.getBalance(credentials.address);
EtherAmount gasPrice = await ethClient.getGasPrice();
log('SSS amount is -= $etherAmount');
print('Balance in Wei: ${etherAmount.getInWei}');
print('Balance in Ether: ${etherAmount.getValueInUnit(EtherUnit.ether)}');
{
this is out put why is 0.0 ??
flutter: Balance in Wei: 0
flutter: Balance in Ether: 0.0
}
await ethClient.sendTransaction(
credentials,
Transaction(
to: EthereumAddress.fromHex(XXX_receiver_XXX),
gasPrice: gasPrice,
value: txValue,
),
chainId: 11155111,
);
{
error is => RPCError: got code -32000 with msg "insufficient funds for transfer".
}
but I have amount in wallet but it's showing 0.0 and get this error
Metadata
Metadata
Assignees
Labels
No labels