'web3j java. How to send transaction in selected currency (not in wei)
I use below code for sending transaction in MATIC in Matic Mumbai network.
BigInteger gasPrice = client.ethGasPrice().send().getGasPrice();
BigInteger nonce = client.ethGetTransactionCount(credentials.getAddress(),
DefaultBlockParameterName.LATEST).send().getTransactionCount();
RawTransaction rawTransaction = RawTransaction.createEtherTransaction(nonce, gasPrice, GAS_LIMIT, "0x9f58989539B8c90cdDE06Cb568e41e3DeB73df90", new BigInteger("1"));
byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, 80001l, credentials);
String hexValue = Numeric.toHexString(signedMessage);
EthSendTransaction response = client.ethSendRawTransaction(hexValue).sendAsync().get();
At https://mumbai.polygonscan.com/ I see that transaction was performed in wei. But wallet currency is MATIC.
How can I select currency in transaction using web3j. Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
