flutter_trust_wallet_core
flutter_trust_wallet_core copied to clipboard
Add more examples
Hello. Thank you for this plugin, it is very great and useful. Can you add more examples for different cois and ethereum transaction example, please?
I need too. add an ethereum example please.
Will do, but it will not be so fast, currently I'm using this lib for my product, a lots api may have breaking changes due to requirements, I'll add more eth example in few days. Btw the best tutorial please refer to trust wallet core official test case.
Thank you so much. Waiting for that.
Hello. Any updates about ethereum transaction example?
@sylvestrevgen @mahdibagjani The official tests are a really good reference, I got basic ETH transactions signed and submitted to network like this:
Note: need to convert hex into byte arrays for the protobuf messages with the convert package hex.decode(myHex)
final input = SigningInput(
privateKey: privateKey.data(),
chainId: hex.decode('0539'), // 1337 for ganache
nonce: hex.decode('01'),
gasPrice: hex.decode('04a817c800'), // 20000000000
gasLimit: hex.decode('5208'), // 21000
toAddress: receiverAddress,
transaction: Transaction(
transfer: Transaction_Transfer(
amount: hex.decode('0de0b6b3a7640000'), // 1 ETH
),
),
);
final signed = AnySigner.sign(
input.writeToBuffer(),
TWCoinType.TWCoinTypeEthereum,
);
final output = SigningOutput.fromBuffer(signed);
// Now you can submit the encoded output to the network
output.encoded
@edTheGuy00 perfect... Any tips how are you submitting this to the network using Flutter ? Are you using any third party endpoints or APIs?
Appreciate any feedback