Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more examples #27

Open
sylvestrevgen opened this issue Sep 18, 2021 · 6 comments
Open

Add more examples #27

sylvestrevgen opened this issue Sep 18, 2021 · 6 comments

Comments

@sylvestrevgen
Copy link

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?

@mahdibagjani
Copy link

I need too. add an ethereum example please.

@weishirongzhen
Copy link
Owner

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.

@sylvestrevgen
Copy link
Author

Thank you so much. Waiting for that.

@sylvestrevgen
Copy link
Author

Hello. Any updates about ethereum transaction example?

@edTheGuy00
Copy link

@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

@jalchr
Copy link

jalchr commented Jul 9, 2022

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants