forked from cerc-io/laconicd-deprecated
86 lines
3.3 KiB
Go
86 lines
3.3 KiB
Go
|
package types
|
||
|
|
||
|
import (
|
||
|
"github.com/ethereum/go-ethereum/common"
|
||
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||
|
)
|
||
|
|
||
|
// Copied the Account and StorageResult types since they are registered under an
|
||
|
// internal pkg on geth.
|
||
|
|
||
|
// AccountResult struct for account proof
|
||
|
type AccountResult struct {
|
||
|
Address common.Address `json:"address"`
|
||
|
AccountProof []string `json:"accountProof"`
|
||
|
Balance *hexutil.Big `json:"balance"`
|
||
|
CodeHash common.Hash `json:"codeHash"`
|
||
|
Nonce hexutil.Uint64 `json:"nonce"`
|
||
|
StorageHash common.Hash `json:"storageHash"`
|
||
|
StorageProof []StorageResult `json:"storageProof"`
|
||
|
}
|
||
|
|
||
|
// StorageResult defines the format for storage proof return
|
||
|
type StorageResult struct {
|
||
|
Key string `json:"key"`
|
||
|
Value *hexutil.Big `json:"value"`
|
||
|
Proof []string `json:"proof"`
|
||
|
}
|
||
|
|
||
|
// Transaction represents a transaction returned to RPC clients.
|
||
|
type Transaction struct {
|
||
|
BlockHash *common.Hash `json:"blockHash"`
|
||
|
BlockNumber *hexutil.Big `json:"blockNumber"`
|
||
|
From common.Address `json:"from"`
|
||
|
Gas hexutil.Uint64 `json:"gas"`
|
||
|
GasPrice *hexutil.Big `json:"gasPrice"`
|
||
|
Hash common.Hash `json:"hash"`
|
||
|
Input hexutil.Bytes `json:"input"`
|
||
|
Nonce hexutil.Uint64 `json:"nonce"`
|
||
|
To *common.Address `json:"to"`
|
||
|
TransactionIndex *hexutil.Uint64 `json:"transactionIndex"`
|
||
|
Value *hexutil.Big `json:"value"`
|
||
|
V *hexutil.Big `json:"v"`
|
||
|
R *hexutil.Big `json:"r"`
|
||
|
S *hexutil.Big `json:"s"`
|
||
|
}
|
||
|
|
||
|
// SendTxArgs represents the arguments to submit a new transaction into the transaction pool.
|
||
|
// Duplicate struct definition since geth struct is in internal package
|
||
|
// Ref: https://github.com/ethereum/go-ethereum/blob/release/1.9/internal/ethapi/api.go#L1346
|
||
|
type SendTxArgs struct {
|
||
|
From common.Address `json:"from"`
|
||
|
To *common.Address `json:"to"`
|
||
|
Gas *hexutil.Uint64 `json:"gas"`
|
||
|
GasPrice *hexutil.Big `json:"gasPrice"`
|
||
|
Value *hexutil.Big `json:"value"`
|
||
|
Nonce *hexutil.Uint64 `json:"nonce"`
|
||
|
// We accept "data" and "input" for backwards-compatibility reasons. "input" is the
|
||
|
// newer name and should be preferred by clients.
|
||
|
Data *hexutil.Bytes `json:"data"`
|
||
|
Input *hexutil.Bytes `json:"input"`
|
||
|
}
|
||
|
|
||
|
// CallArgs represents the arguments for a call.
|
||
|
type CallArgs struct {
|
||
|
From *common.Address `json:"from"`
|
||
|
To *common.Address `json:"to"`
|
||
|
Gas *hexutil.Uint64 `json:"gas"`
|
||
|
GasPrice *hexutil.Big `json:"gasPrice"`
|
||
|
Value *hexutil.Big `json:"value"`
|
||
|
Data *hexutil.Bytes `json:"data"`
|
||
|
}
|
||
|
|
||
|
// Account indicates the overriding fields of account during the execution of
|
||
|
// a message call.
|
||
|
// NOTE: state and stateDiff can't be specified at the same time. If state is
|
||
|
// set, message execution will only use the data in the given state. Otherwise
|
||
|
// if statDiff is set, all diff will be applied first and then execute the call
|
||
|
// message.
|
||
|
type Account struct {
|
||
|
Nonce *hexutil.Uint64 `json:"nonce"`
|
||
|
Code *hexutil.Bytes `json:"code"`
|
||
|
Balance **hexutil.Big `json:"balance"`
|
||
|
State *map[common.Hash]common.Hash `json:"state"`
|
||
|
StateDiff *map[common.Hash]common.Hash `json:"stateDiff"`
|
||
|
}
|