-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[Breaking] Refactor Ethereum token transfer signing input #1210
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1210 +/- ##
==========================================
+ Coverage 95.24% 95.27% +0.03%
==========================================
Files 432 433 +1
Lines 12968 13034 +66
==========================================
+ Hits 12351 12418 +67
+ Misses 617 616 -1
Continue to review full report at Codecov.
|
I would not change, only because of type change. |
After some considerations, I reverted Aeternity and Aion changes, because they just create more clutter, and does not add more clarity. |
@catenocrypt @vikmeup If we merge this, we need to update TrustSDK + iOS app at the same time, and ask 3rd party apps to update SDK as well |
…t#1210) * Factor out Transfer from Eth SigningInput. * Make with oneof, Transfer and ContractGeneric. * Remove amount from generic contract. * Special ERC20 contract type (empty so far) * Various factory methods for Transaction class. * Add new ERC20 test. * Add ERC20 handling, building. * ABI comment * Update iOS tests. * Add ERC20 iOS test * Update android tests * Update typescript test. * Special handling for invalid Address case. * Additional low-level signer test. * Small refactor in transaction building. * Support ERC721 * ERC20 kotlin test * Swift and Kotlin tests for ERC721 * iOS test fix * Rename in proto * Comment in proto, expose ERC20 call building * Add optional payload to plain Transfer. * ContractGeneric rename. * Minor exception leak fix in Solana * Payload -> Transaction rename. * Add ERC20 Approve * ERC20 approve iOS test * Rename, remove transfer_ prefix * Typescript test fix Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
Description
BREAKING change. Change in Eth signing input message, introducing specialized messages for different transfers:
native coin, ERC20, generic smart contract, etc.
Fixes #1176 .
Breaking Change
SigningInput for ETH transfer: The
amount
field is now moved to sub-message namedcontractTransfer
of typeTransferContract
. This is a breaking change!Pay attention especially to JSON version, as the breaking change will not come out at compile time (signJSON()).
SigningInput for ERC20 transfer: This is a new addition; sub-message named
contractErc20
of typeERC20TransferContract
should be used, with memberstoAddress
andamount
. Building of the smart contract call is done by wallet-core, not the caller/app.SigningInput for smart contract call: This is a new addition; for smart contract calls (except the special case of ERC20 above) a new sub-message named
contractGeneric
of typeGenericContract
should be used, with memberpayload
.See files for examples:
Testing instructions
Unit tests, esp. iOS&Android.
Types of changes
Checklist
[WIP]
if necessary.