Eth JSON-RPC API: implement eth_getCode and eth_getStorageAt (#9397)

This commit is contained in:
raulk 2022-09-29 23:55:13 +01:00 committed by Alfonso de la Rocha
parent 9d1208c9ff
commit 653af01235
4 changed files with 26 additions and 26 deletions

View File

@ -7,7 +7,7 @@ import (
mathbig "math/big"
"golang.org/x/crypto/sha3"
xerrors "golang.org/x/xerrors"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
gocrypto "github.com/filecoin-project/go-crypto"
@ -23,19 +23,19 @@ import (
)
type EthTx struct {
ChainID EthInt `json:"chainId"`
Nonce EthInt `json:"nonce"`
ChainID EthUint64 `json:"chainId"`
Nonce EthUint64 `json:"nonce"`
Hash EthHash `json:"hash"`
BlockHash EthHash `json:"blockHash"`
BlockNumber EthInt `json:"blockNumber"`
TransactionIndex EthInt `json:"transacionIndex"`
BlockNumber EthUint64 `json:"blockNumber"`
TransactionIndex EthUint64 `json:"transacionIndex"`
From EthAddress `json:"from"`
To *EthAddress `json:"to"`
Value EthBigInt `json:"value"`
Type EthInt `json:"type"`
Type EthUint64 `json:"type"`
Input EthBytes `json:"input"`
Gas EthInt `json:"gas"`
GasLimit *EthInt `json:"gasLimit,omitempty"`
Gas EthUint64 `json:"gas"`
GasLimit *EthUint64 `json:"gasLimit,omitempty"`
MaxFeePerGas EthBigInt `json:"maxFeePerGas"`
MaxPriorityFeePerGas EthBigInt `json:"maxPriorityFeePerGas"`
V EthBytes `json:"v"`
@ -436,7 +436,7 @@ func parseInt(v interface{}) (int, error) {
var value int64
r := bytes.NewReader(append(make([]byte, 8-len(data)), data...))
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
}