Conversation
enriquesouza
left a comment
There was a problem hiding this comment.
enum TransactionType {
TRANSACTION_TYPE_UNSPECIFIED = 0;
TRANSACTION_TYPE_VOTE = 1;
TRANSACTION_TYPE_PROPOSAL = 2;
}
TransactionType transaction_type = 7;
Maybe we can use this and add swap, send, and deposit to all chains, in case we need to add more options in the future.
The problem is |
| string to_address = 2; | ||
| string to_amount = 3; |
There was a problem hiding this comment.
maybe we should add coin, to_address, to_amount to a KeysignPayload, and reuse it from there? Seems like it repeated for each Transaction
There was a problem hiding this comment.
Yup, quite a bunch of the information is repeated for each Transaction , if I move it to KeysignPayload , then it will end up more like v1
There was a problem hiding this comment.
yeah, is it bad though for these two fields?
| uint64 account_number = 4; | ||
| uint64 sequence = 5; | ||
| uint64 fee = 6; | ||
| string is_deposit = 7; // probably don't need it , because when `to_address` is empty , it's a deposit , still keep it to make it specific |
There was a problem hiding this comment.
if to address can be empty, would be great to mark it as optional
There was a problem hiding this comment.
All fields in protobuf is optional by default
There was a problem hiding this comment.
agree, we can deprecate isDeposit
There was a problem hiding this comment.
All fields in protobuf is optional by default
Code generators may not know that, so it's probably better to specify it, also that's self documenting
There was a problem hiding this comment.
That's part of protobuf standard
| optional string memo = 10; | ||
| } | ||
|
|
||
| // SwapInfo is mostly for display purpose |
There was a problem hiding this comment.
is there any usecase for them when constructing transaction?
There was a problem hiding this comment.
yes, for example , when we construct a swap transaction , swap itself will be put into transaction, for example , EVM chain swaps , at the end of the day , it is a standard transaction , or a smart contract call , which is also a standard transaction , but has some special data field
However , on the UI part , we often need to show user some additional information , like provider , fee , slippage , and final output amount etc. Those will go to swap_info.
swap_info is also optional , when it is empty , then it is just a standard send transaction
| int64 nonce = 6; | ||
| string gas_limit = 7; | ||
| optional string memo = 8; | ||
| optional vultisig.keysign.v1.Erc20ApprovePayload erc20_approve_payload = 9; |
There was a problem hiding this comment.
Something wrong here ig. ERC20 approve also regular evm tx. We need to cover case when we're need to generate two keysing messages. First - erc20 approve and second - erc20 transfer.
There was a problem hiding this comment.
connected with comment: https://github.com/vultisig/commondata/pull/11/files#r1703993420
| // when swap_info is not empty , then the pair device shoudl treat it as a swap | ||
| // 1. Show swap verify screen | ||
| // 2. for EVM chain , need to construct a generic smart contract transaction | ||
| optional SwapInfo swap_info = 20; |
There was a problem hiding this comment.
let's make enum for display purposes that we can use for all UI cases?
enum Action {
case transfer(TransferInfo)
case swap(SwapInfo)
case transferWithApproval(TransferWithApprovalInfo)
case thorchainDeposit(ThorchainDepositInfo)
}There was a problem hiding this comment.
We probably should save space for transactions, where this info is not needed. (e.g.: if all info for send tx available from already existing payload, we don't want to store more info)
There was a problem hiding this comment.
exactly as what @yvebe mentioned , for Send , all the information is already in the transaction , only for swap , we need to have some additional information.
For those information already in the send transaction , we don't want to store it again here
| string target_amount = 5; | ||
| } | ||
| message KeysignPayload { | ||
| oneof transaction { |
There was a problem hiding this comment.
should this be an array of oneof transaction to support multiple signatures? Eg. erc20 transfer with approve or any other multiple tx signings
There was a problem hiding this comment.
We can't do that , because if it is an array , it need to be the same type , but in our case , the transaction are all different types
This is the first design draft of
KeysignMessagev2 , the goal of