flutter_trust_wallet_core icon indicating copy to clipboard operation
flutter_trust_wallet_core copied to clipboard

Add more examples

Open sylvestrevgen opened this issue 3 years ago • 6 comments

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?

sylvestrevgen avatar Sep 18 '21 11:09 sylvestrevgen

I need too. add an ethereum example please.

mahdibagjani avatar Sep 19 '21 12:09 mahdibagjani

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.

weishirongzhen avatar Sep 19 '21 12:09 weishirongzhen

Thank you so much. Waiting for that.

sylvestrevgen avatar Sep 19 '21 12:09 sylvestrevgen

Hello. Any updates about ethereum transaction example?

sylvestrevgen avatar Nov 03 '21 16:11 sylvestrevgen

@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 avatar Jun 24 '22 07:06 edTheGuy00

@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

jalchr avatar Jul 09 '22 17:07 jalchr