forked from chenzhijie/go-web3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
call.go
46 lines (36 loc) · 1000 Bytes
/
call.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package types
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)
const MAX_GAS_LIMIT = 30000000
type CallMsgData []byte
func (a CallMsgData) MarshalText() ([]byte, error) {
return hexutil.Bytes(a[:]).MarshalText()
}
type CallMsgBigInt big.Int
func (a CallMsgBigInt) MarshalText() ([]byte, error) {
b := big.Int(a)
return []byte(hexutil.EncodeBig(&b)), nil
}
func NewCallMsgBigInt(v *big.Int) *CallMsgBigInt {
if v == nil {
return nil
}
i := CallMsgBigInt(*v)
return &i
}
type CallMsg struct {
From common.Address `json:"from,omitempty"`
To common.Address `json:"to"`
Data CallMsgData `json:"data"`
Gas *CallMsgBigInt `json:"gas,omitempty"`
GasPrice *CallMsgBigInt `json:"gasPrice,omitempty"`
Value *CallMsgBigInt `json:"value,omitempty"`
}
type ZeroValueCallMsg struct {
From common.Address `json:"from,omitempty"`
To common.Address `json:"to"`
Data CallMsgData `json:"data"`
}