feat_: send tx args type extended with new properties
Added props: - `Version` used to differ old and new usage - `ValueOut` - `FromChainID` - `ToChainID` - `FromTokenID` - `ToTokenID` - `ToContractAddress` - `SlippagePercentage`
This commit is contained in:
parent
741f5d51af
commit
07f26aed20
|
@ -15,6 +15,13 @@ import (
|
||||||
wallet_common "github.com/status-im/status-go/services/wallet/common"
|
wallet_common "github.com/status-im/status-go/services/wallet/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type SendTxArgsVersion uint
|
||||||
|
|
||||||
|
const (
|
||||||
|
SendTxArgsVersion0 SendTxArgsVersion = 0
|
||||||
|
SendTxArgsVersion1 SendTxArgsVersion = 1
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ErrInvalidSendTxArgs is returned when the structure of SendTxArgs is ambigious.
|
// ErrInvalidSendTxArgs is returned when the structure of SendTxArgs is ambigious.
|
||||||
ErrInvalidSendTxArgs = errors.New("transaction arguments are invalid")
|
ErrInvalidSendTxArgs = errors.New("transaction arguments are invalid")
|
||||||
|
@ -41,6 +48,8 @@ type GasCalculator interface {
|
||||||
// This struct is based on go-ethereum's type in internal/ethapi/api.go, but we have freedom
|
// This struct is based on go-ethereum's type in internal/ethapi/api.go, but we have freedom
|
||||||
// over the exact layout of this struct.
|
// over the exact layout of this struct.
|
||||||
type SendTxArgs struct {
|
type SendTxArgs struct {
|
||||||
|
Version SendTxArgsVersion `json:"version"`
|
||||||
|
|
||||||
From types.Address `json:"from"`
|
From types.Address `json:"from"`
|
||||||
To *types.Address `json:"to"`
|
To *types.Address `json:"to"`
|
||||||
Gas *hexutil.Uint64 `json:"gas"`
|
Gas *hexutil.Uint64 `json:"gas"`
|
||||||
|
@ -55,9 +64,17 @@ type SendTxArgs struct {
|
||||||
Input types.HexBytes `json:"input"`
|
Input types.HexBytes `json:"input"`
|
||||||
Data types.HexBytes `json:"data"`
|
Data types.HexBytes `json:"data"`
|
||||||
|
|
||||||
// additional data
|
// additional data - version SendTxArgsVersion0
|
||||||
MultiTransactionID wallet_common.MultiTransactionIDType
|
MultiTransactionID wallet_common.MultiTransactionIDType `json:"multiTransactionID"`
|
||||||
Symbol string
|
Symbol string `json:"-"`
|
||||||
|
// additional data - version SendTxArgsVersion1
|
||||||
|
ValueOut *hexutil.Big `json:"-"`
|
||||||
|
FromChainID uint64 `json:"-"`
|
||||||
|
ToChainID uint64 `json:"-"`
|
||||||
|
FromTokenID string `json:"-"`
|
||||||
|
ToTokenID string `json:"-"`
|
||||||
|
ToContractAddress types.Address `json:"-"` // represents address of the contract that needs to be used in order to send assets, like ERC721 or ERC1155 tx
|
||||||
|
SlippagePercentage float32 `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valid checks whether this structure is filled in correctly.
|
// Valid checks whether this structure is filled in correctly.
|
||||||
|
|
Loading…
Reference in New Issue