Documentation ¶
Overview ¶
package jsonrpc implements JSON-RPC endpoints according to https://eth.wiki/json-rpc/API
Index ¶
- func NewServer(evmChain *EVMChain, accountManager *AccountManager) *rpc.Server
- func RPCMarshalBlock(block *types.Block, inclTx, fullTx bool) (map[string]interface{}, error)
- func RPCMarshalHeader(head *types.Header) map[string]interface{}
- func RPCMarshalLog(r *types.Receipt, logIndex uint) map[string]interface{}
- func RPCMarshalLogs(r *types.Receipt) []interface{}
- func RPCMarshalReceipt(r *types.Receipt, tx *types.Transaction) map[string]interface{}
- type AccountManager
- type ChainBackend
- type EVMChain
- func (e *EVMChain) Balance(address common.Address, blockNumberOrHash rpc.BlockNumberOrHash) (*big.Int, error)
- func (e *EVMChain) BlockByHash(hash common.Hash) (*types.Block, error)
- func (e *EVMChain) BlockByNumber(blockNumber *big.Int) (*types.Block, error)
- func (e *EVMChain) BlockNumber() (*big.Int, error)
- func (e *EVMChain) BlockTransactionCountByHash(blockHash common.Hash) (uint64, error)
- func (e *EVMChain) BlockTransactionCountByNumber(blockNumber *big.Int) (uint64, error)
- func (e *EVMChain) CallContract(args ethereum.CallMsg, blockNumberOrHash rpc.BlockNumberOrHash) ([]byte, error)
- func (e *EVMChain) Code(address common.Address, blockNumberOrHash rpc.BlockNumberOrHash) ([]byte, error)
- func (e *EVMChain) EstimateGas(args ethereum.CallMsg) (uint64, error)
- func (e *EVMChain) FeeColor() (colored.Color, error)
- func (e *EVMChain) GasLimitFee(tx *types.Transaction) (colored.Color, uint64, error)
- func (e *EVMChain) GasPerIota() (uint64, error)
- func (e *EVMChain) GetOnChainBalance() (colored.Balances, error)
- func (e *EVMChain) Logs(q *ethereum.FilterQuery) ([]*types.Log, error)
- func (e *EVMChain) SendTransaction(tx *types.Transaction) error
- func (e *EVMChain) Signer() types.Signer
- func (e *EVMChain) StorageAt(address common.Address, key common.Hash, ...) ([]byte, error)
- func (e *EVMChain) TransactionByBlockHashAndIndex(hash common.Hash, index uint64) (tx *types.Transaction, blockHash common.Hash, blockNumber, indexRet uint64, ...)
- func (e *EVMChain) TransactionByBlockNumberAndIndex(blockNumber *big.Int, index uint64) (tx *types.Transaction, blockHash common.Hash, blockNumberRet, indexRet uint64, ...)
- func (e *EVMChain) TransactionByHash(hash common.Hash) (tx *types.Transaction, blockHash common.Hash, blockNumber, index uint64, ...)
- func (e *EVMChain) TransactionCount(address common.Address, blockNumberOrHash rpc.BlockNumberOrHash) (uint64, error)
- func (e *EVMChain) TransactionReceipt(txHash common.Hash) (*types.Receipt, error)
- type EthService
- func (e *EthService) Accounts() []common.Address
- func (e *EthService) BlockNumber() (*hexutil.Big, error)
- func (e *EthService) Call(args *RPCCallArgs, blockNumberOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
- func (e *EthService) ChainId() hexutil.Uint
- func (e *EthService) Coinbase() common.Address
- func (e *EthService) EstimateGas(args *RPCCallArgs) (hexutil.Uint64, error)
- func (e *EthService) GasPrice() *hexutil.Big
- func (e *EthService) GetBalance(address common.Address, blockNumberOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error)
- func (e *EthService) GetBlockByHash(hash common.Hash, full bool) (map[string]interface{}, error)
- func (e *EthService) GetBlockByNumber(blockNumber rpc.BlockNumber, full bool) (map[string]interface{}, error)
- func (e *EthService) GetBlockTransactionCountByHash(blockHash common.Hash) (hexutil.Uint, error)
- func (e *EthService) GetBlockTransactionCountByNumber(blockNumber rpc.BlockNumber) (hexutil.Uint, error)
- func (e *EthService) GetCode(address common.Address, blockNumberOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
- func (e *EthService) GetCompilers() []string
- func (e *EthService) GetLogs(q *RPCFilterQuery) ([]*types.Log, error)
- func (e *EthService) GetStorageAt(address common.Address, key common.Hash, ...) (hexutil.Bytes, error)
- func (e *EthService) GetTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (*RPCTransaction, error)
- func (e *EthService) GetTransactionByBlockNumberAndIndex(blockNumberOrTag rpc.BlockNumber, index hexutil.Uint) (*RPCTransaction, error)
- func (e *EthService) GetTransactionByHash(hash common.Hash) (*RPCTransaction, error)
- func (e *EthService) GetTransactionCount(address common.Address, blockNumberOrHash rpc.BlockNumberOrHash) (hexutil.Uint64, error)
- func (e *EthService) GetTransactionReceipt(txHash common.Hash) (map[string]interface{}, error)
- func (e *EthService) GetUncleByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) map[string]interface{}
- func (e *EthService) GetUncleByBlockNumberAndIndex(blockNumberOrTag rpc.BlockNumber, index hexutil.Uint) map[string]interface{}
- func (e *EthService) GetUncleCountByBlockHash(blockHash common.Hash) hexutil.Uint
- func (e *EthService) GetUncleCountByBlockNumber(blockNumber rpc.BlockNumber) hexutil.Uint
- func (e *EthService) Hashrate() float64
- func (e *EthService) Mining() bool
- func (e *EthService) ProtocolVersion() hexutil.Uint
- func (e *EthService) SendRawTransaction(txBytes hexutil.Bytes) (common.Hash, error)
- func (e *EthService) SendTransaction(args *SendTxArgs) (common.Hash, error)
- func (e *EthService) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error)
- func (e *EthService) SignTransaction(args *SendTxArgs) (hexutil.Bytes, error)
- func (e *EthService) Syncing() bool
- type NetService
- type RPCCallArgs
- type RPCFilterQuery
- type RPCTransaction
- type SendTxArgs
- type SoloBackend
- func (s *SoloBackend) CallView(scName, funName string, args dict.Dict) (dict.Dict, error)
- func (s *SoloBackend) PostOffLedgerRequest(scName, funName string, transfer colored.Balances, args dict.Dict) error
- func (s *SoloBackend) PostOnLedgerRequest(scName, funName string, transfer colored.Balances, args dict.Dict) error
- func (s *SoloBackend) Signer() *ed25519.KeyPair
- type TxPoolService
- type WaspClientBackend
- func (w *WaspClientBackend) CallView(scName, funName string, args dict.Dict) (dict.Dict, error)
- func (w *WaspClientBackend) PostOffLedgerRequest(scName, funName string, transfer colored.Balances, args dict.Dict) error
- func (w *WaspClientBackend) PostOnLedgerRequest(scName, funName string, transfer colored.Balances, args dict.Dict) error
- func (w *WaspClientBackend) Signer() *ed25519.KeyPair
- type Web3Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RPCMarshalBlock ¶
RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain transaction hashes.
func RPCMarshalHeader ¶
RPCMarshalHeader converts the given header to the RPC output .
func RPCMarshalLogs ¶
func RPCMarshalReceipt ¶
func RPCMarshalReceipt(r *types.Receipt, tx *types.Transaction) map[string]interface{}
Types ¶
type AccountManager ¶
type AccountManager struct {
// contains filtered or unexported fields
}
func NewAccountManager ¶
func NewAccountManager(accounts []*ecdsa.PrivateKey) *AccountManager
func (*AccountManager) Add ¶
func (a *AccountManager) Add(keyPair *ecdsa.PrivateKey)
func (*AccountManager) Addresses ¶
func (a *AccountManager) Addresses() []common.Address
func (*AccountManager) Get ¶
func (a *AccountManager) Get(addr common.Address) *ecdsa.PrivateKey
type ChainBackend ¶
type ChainBackend interface { PostOnLedgerRequest(scName string, funName string, transfer colored.Balances, args dict.Dict) error PostOffLedgerRequest(scName string, funName string, transfer colored.Balances, args dict.Dict) error CallView(scName string, funName string, args dict.Dict) (dict.Dict, error) Signer() *ed25519.KeyPair }
type EVMChain ¶
type EVMChain struct {
// contains filtered or unexported fields
}
func NewEVMChain ¶
func NewEVMChain(backend ChainBackend, chainID int, contractName string) *EVMChain
func (*EVMChain) BlockByHash ¶
func (*EVMChain) BlockByNumber ¶
func (*EVMChain) BlockTransactionCountByHash ¶
func (*EVMChain) BlockTransactionCountByNumber ¶
func (*EVMChain) CallContract ¶
func (e *EVMChain) CallContract(args ethereum.CallMsg, blockNumberOrHash rpc.BlockNumberOrHash) ([]byte, error)
func (*EVMChain) EstimateGas ¶
func (*EVMChain) GasLimitFee ¶
func (*EVMChain) GasPerIota ¶
func (*EVMChain) GetOnChainBalance ¶ added in v0.2.1
func (*EVMChain) SendTransaction ¶
func (e *EVMChain) SendTransaction(tx *types.Transaction) error
func (*EVMChain) TransactionByBlockHashAndIndex ¶
func (*EVMChain) TransactionByBlockNumberAndIndex ¶
func (*EVMChain) TransactionByHash ¶
func (*EVMChain) TransactionCount ¶
type EthService ¶
type EthService struct {
// contains filtered or unexported fields
}
func NewEthService ¶
func NewEthService(evmChain *EVMChain, accounts *AccountManager) *EthService
func (*EthService) Accounts ¶
func (e *EthService) Accounts() []common.Address
func (*EthService) BlockNumber ¶
func (e *EthService) BlockNumber() (*hexutil.Big, error)
func (*EthService) Call ¶
func (e *EthService) Call(args *RPCCallArgs, blockNumberOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
func (*EthService) ChainId ¶
func (e *EthService) ChainId() hexutil.Uint
ChainID implements the eth_chainId method according to https://eips.ethereum.org/EIPS/eip-695
func (*EthService) Coinbase ¶
func (e *EthService) Coinbase() common.Address
func (*EthService) EstimateGas ¶
func (e *EthService) EstimateGas(args *RPCCallArgs) (hexutil.Uint64, error)
func (*EthService) GasPrice ¶
func (e *EthService) GasPrice() *hexutil.Big
func (*EthService) GetBalance ¶
func (e *EthService) GetBalance(address common.Address, blockNumberOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error)
func (*EthService) GetBlockByHash ¶
func (*EthService) GetBlockByNumber ¶
func (e *EthService) GetBlockByNumber(blockNumber rpc.BlockNumber, full bool) (map[string]interface{}, error)
func (*EthService) GetBlockTransactionCountByHash ¶
func (*EthService) GetBlockTransactionCountByNumber ¶
func (e *EthService) GetBlockTransactionCountByNumber(blockNumber rpc.BlockNumber) (hexutil.Uint, error)
func (*EthService) GetCode ¶
func (e *EthService) GetCode(address common.Address, blockNumberOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
func (*EthService) GetCompilers ¶
func (e *EthService) GetCompilers() []string
func (*EthService) GetLogs ¶
func (e *EthService) GetLogs(q *RPCFilterQuery) ([]*types.Log, error)
func (*EthService) GetStorageAt ¶
func (e *EthService) GetStorageAt(address common.Address, key common.Hash, blockNumberOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
func (*EthService) GetTransactionByBlockHashAndIndex ¶
func (e *EthService) GetTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (*RPCTransaction, error)
func (*EthService) GetTransactionByBlockNumberAndIndex ¶
func (e *EthService) GetTransactionByBlockNumberAndIndex(blockNumberOrTag rpc.BlockNumber, index hexutil.Uint) (*RPCTransaction, error)
func (*EthService) GetTransactionByHash ¶
func (e *EthService) GetTransactionByHash(hash common.Hash) (*RPCTransaction, error)
func (*EthService) GetTransactionCount ¶
func (e *EthService) GetTransactionCount(address common.Address, blockNumberOrHash rpc.BlockNumberOrHash) (hexutil.Uint64, error)
func (*EthService) GetTransactionReceipt ¶
func (e *EthService) GetTransactionReceipt(txHash common.Hash) (map[string]interface{}, error)
func (*EthService) GetUncleByBlockHashAndIndex ¶
func (*EthService) GetUncleByBlockNumberAndIndex ¶
func (e *EthService) GetUncleByBlockNumberAndIndex(blockNumberOrTag rpc.BlockNumber, index hexutil.Uint) map[string]interface{}
func (*EthService) GetUncleCountByBlockHash ¶
func (e *EthService) GetUncleCountByBlockHash(blockHash common.Hash) hexutil.Uint
func (*EthService) GetUncleCountByBlockNumber ¶
func (e *EthService) GetUncleCountByBlockNumber(blockNumber rpc.BlockNumber) hexutil.Uint
func (*EthService) Hashrate ¶
func (e *EthService) Hashrate() float64
func (*EthService) Mining ¶
func (e *EthService) Mining() bool
func (*EthService) ProtocolVersion ¶
func (e *EthService) ProtocolVersion() hexutil.Uint
func (*EthService) SendRawTransaction ¶
func (*EthService) SendTransaction ¶
func (e *EthService) SendTransaction(args *SendTxArgs) (common.Hash, error)
func (*EthService) SignTransaction ¶
func (e *EthService) SignTransaction(args *SendTxArgs) (hexutil.Bytes, error)
func (*EthService) Syncing ¶
func (e *EthService) Syncing() bool
type NetService ¶
type NetService struct {
// contains filtered or unexported fields
}
func NewNetService ¶
func NewNetService(chainID int) *NetService
func (*NetService) Listening ¶
func (s *NetService) Listening() bool
func (*NetService) PeerCount ¶
func (s *NetService) PeerCount() hexutil.Uint
func (*NetService) Version ¶
func (s *NetService) Version() string
type RPCCallArgs ¶
type RPCFilterQuery ¶
type RPCFilterQuery ethereum.FilterQuery
func (*RPCFilterQuery) UnmarshalJSON ¶
func (q *RPCFilterQuery) UnmarshalJSON(data []byte) error
UnmarshalJSON sets *args fields with given data.
type RPCTransaction ¶
type RPCTransaction 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"` }
RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction
type SendTxArgs ¶
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"` }
SendTxArgs represents the arguments to sumbit a new transaction into the transaction pool.
type SoloBackend ¶
type SoloBackend struct { Env *solo.Solo Chain *solo.Chain // contains filtered or unexported fields }
func NewSoloBackend ¶
func (*SoloBackend) PostOffLedgerRequest ¶
func (*SoloBackend) PostOnLedgerRequest ¶
func (*SoloBackend) Signer ¶
func (s *SoloBackend) Signer() *ed25519.KeyPair
type TxPoolService ¶
type TxPoolService struct{}
func NewTxPoolService ¶
func NewTxPoolService() *TxPoolService
func (*TxPoolService) Content ¶
func (s *TxPoolService) Content() map[string]map[string]map[string]*RPCTransaction
type WaspClientBackend ¶
type WaspClientBackend struct {
ChainClient *chainclient.Client
}
func NewWaspClientBackend ¶
func NewWaspClientBackend(chainClient *chainclient.Client) *WaspClientBackend
func (*WaspClientBackend) PostOffLedgerRequest ¶
func (*WaspClientBackend) PostOnLedgerRequest ¶
func (*WaspClientBackend) Signer ¶
func (w *WaspClientBackend) Signer() *ed25519.KeyPair
type Web3Service ¶
type Web3Service struct{}
func NewWeb3Service ¶
func NewWeb3Service() *Web3Service
func (*Web3Service) ClientVersion ¶
func (s *Web3Service) ClientVersion() string