Eth JSON-RPC API: implement eth_getCode and eth_getStorageAt (#9397)
This commit is contained in:
parent
9d1208c9ff
commit
653af01235
@ -7,7 +7,7 @@ import (
|
|||||||
mathbig "math/big"
|
mathbig "math/big"
|
||||||
|
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
xerrors "golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
gocrypto "github.com/filecoin-project/go-crypto"
|
gocrypto "github.com/filecoin-project/go-crypto"
|
||||||
@ -23,19 +23,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type EthTx struct {
|
type EthTx struct {
|
||||||
ChainID EthInt `json:"chainId"`
|
ChainID EthUint64 `json:"chainId"`
|
||||||
Nonce EthInt `json:"nonce"`
|
Nonce EthUint64 `json:"nonce"`
|
||||||
Hash EthHash `json:"hash"`
|
Hash EthHash `json:"hash"`
|
||||||
BlockHash EthHash `json:"blockHash"`
|
BlockHash EthHash `json:"blockHash"`
|
||||||
BlockNumber EthInt `json:"blockNumber"`
|
BlockNumber EthUint64 `json:"blockNumber"`
|
||||||
TransactionIndex EthInt `json:"transacionIndex"`
|
TransactionIndex EthUint64 `json:"transacionIndex"`
|
||||||
From EthAddress `json:"from"`
|
From EthAddress `json:"from"`
|
||||||
To *EthAddress `json:"to"`
|
To *EthAddress `json:"to"`
|
||||||
Value EthBigInt `json:"value"`
|
Value EthBigInt `json:"value"`
|
||||||
Type EthInt `json:"type"`
|
Type EthUint64 `json:"type"`
|
||||||
Input EthBytes `json:"input"`
|
Input EthBytes `json:"input"`
|
||||||
Gas EthInt `json:"gas"`
|
Gas EthUint64 `json:"gas"`
|
||||||
GasLimit *EthInt `json:"gasLimit,omitempty"`
|
GasLimit *EthUint64 `json:"gasLimit,omitempty"`
|
||||||
MaxFeePerGas EthBigInt `json:"maxFeePerGas"`
|
MaxFeePerGas EthBigInt `json:"maxFeePerGas"`
|
||||||
MaxPriorityFeePerGas EthBigInt `json:"maxPriorityFeePerGas"`
|
MaxPriorityFeePerGas EthBigInt `json:"maxPriorityFeePerGas"`
|
||||||
V EthBytes `json:"v"`
|
V EthBytes `json:"v"`
|
||||||
@ -436,7 +436,7 @@ func parseInt(v interface{}) (int, error) {
|
|||||||
var value int64
|
var value int64
|
||||||
r := bytes.NewReader(append(make([]byte, 8-len(data)), data...))
|
r := bytes.NewReader(append(make([]byte, 8-len(data)), data...))
|
||||||
if err := binary.Read(r, binary.BigEndian, &value); err != nil {
|
if err := binary.Read(r, binary.BigEndian, &value); err != nil {
|
||||||
return 0, xerrors.Errorf("cannot parse interface to EthInt: %w", err)
|
return 0, xerrors.Errorf("cannot parse interface to EthUint64: %w", err)
|
||||||
}
|
}
|
||||||
return int(value), nil
|
return int(value), nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user