ethapi

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package ethapi implements the general Ethereum API functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAPIs

func GetAPIs(apiBackend Backend) []rpc.API

Types

type AddrLocker

type AddrLocker struct {
	// contains filtered or unexported fields
}

func (*AddrLocker) LockAddr

func (l *AddrLocker) LockAddr(address common.Address)

LockAddr locks an account's mutex. This is used to prevent another tx getting the same nonce until the lock is released. The mutex prevents the (an identical nonce) from being read again during the time that the first transaction is being signed.

func (*AddrLocker) UnlockAddr

func (l *AddrLocker) UnlockAddr(address common.Address)

UnlockAddr unlocks the mutex of the given account.

type Backend

type Backend interface {
	EVMAllowed() bool
	// General Ethereum API
	ProtocolVersion() string
	SuggestPrice(ctx context.Context) (*big.Int, error)
	AccountManager() *accounts.Manager
	Coinbase() common.Address

	// Consensus API
	StopTheWorld() bool
	StartTheWorld() bool
	ConsensusState() (*rtypes.ResultConsensusState, error)
	DumpConsensusState() (*rtypes.ResultDumpConsensusState, error)
	Validators(heightPtr *uint64) (*rtypes.ResultValidators, error)
	Status() (*rtypes.ResultStatus, error)

	// BlockChain API
	GetTx(hash common.Hash) (types.Tx, *types.TxEntry)
	GetTransactionReceipt(hash common.Hash) (*types.Receipt, common.Hash, uint64, uint64)
	HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
	BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)
	BalanceRecordByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.BlockBalanceRecords, error)
	StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)
	GetBlock(ctx context.Context, blockHash common.Hash) (*types.Block, error)
	GetReceipts(ctx context.Context, blockNr uint64) types.Receipts
	GetVM(ctx context.Context, msg types.Message, state *state.StateDB, header *types.Header, vmCfg evm.Config) (vm.VmInterface, func() error, error)
	Block(heightPtr *uint64) (*rtypes.ResultBlock, error)
	GetMaxOutputIndex(ctx context.Context, token common.Address) int64
	GetBlockTokenOutputSeq(ctx context.Context, blockHeight uint64) map[string]int64
	GetOutput(ctx context.Context, token common.Address, index uint64) (*types.UTXOOutputData, error)
	GetUTXOGas() uint64
	GetTxsResult(ctx context.Context, blockNr uint64) (*types.TxsResult, error)

	// TxPool API
	SendTx(ctx context.Context, signedTx types.Tx) error
	GetPoolTx(txHash common.Hash) types.Tx
	GetPoolTransaction(txHash common.Hash) *types.Transaction
	GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)
	Stats() (int, int, int)

	// NetAPI
	NetInfo() (*rtypes.ResultNetInfo, error)
	GetSeeds() []rtypes.Node
	PrometheusMetrics() string
}

Backend interface provides the common API services (that are provided by both full and light clients) with access to necessary functions.

type CallArgs

type CallArgs struct {
	From         common.Address     `json:"from"`
	TokenAddress common.Address     `json:"tokenAddress"`
	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"`
	Nonce        hexutil.Uint64     `json:"nonce"`
	UTXOKind     types.UTXOKind     `json:"utxokind"`
	Outputs      []types.OutputData `json:"outputs"`
}

CallArgs represents the arguments for a call.

type MockBackend

type MockBackend struct {
	mock.Mock
}

MockBackend is an autogenerated mock type for the MockBackend type

func (*MockBackend) AccountManager

func (_m *MockBackend) AccountManager() *accounts.Manager

AccountManager provides a mock function with given fields:

func (*MockBackend) BalanceRecordByNumber

func (_m *MockBackend) BalanceRecordByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.BlockBalanceRecords, error)

BalanceRecordByNumber provides a mock function with given fields: ctx, blockNr

func (*MockBackend) Block

func (_m *MockBackend) Block(heightPtr *uint64) (*rtypes.ResultBlock, error)

Block provides a mock function with given fields: heightPtr

func (*MockBackend) BlockByNumber

func (_m *MockBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)

BlockByNumber provides a mock function with given fields: ctx, blockNr

func (*MockBackend) Coinbase

func (_m *MockBackend) Coinbase() common.Address

Coinbase provides a mock function with given fields:

func (*MockBackend) ConsensusState

func (_m *MockBackend) ConsensusState() (*rtypes.ResultConsensusState, error)

ConsensusState provides a mock function with given fields:

func (*MockBackend) DumpConsensusState

func (_m *MockBackend) DumpConsensusState() (*rtypes.ResultDumpConsensusState, error)

DumpConsensusState provides a mock function with given fields:

func (*MockBackend) EVMAllowed

func (_m *MockBackend) EVMAllowed() bool

EVMAllowed provides a mock function with given fields:

func (*MockBackend) GetBlock

func (_m *MockBackend) GetBlock(ctx context.Context, blockHash common.Hash) (*types.Block, error)

GetBlock provides a mock function with given fields: ctx, blockHash

func (*MockBackend) GetBlockTokenOutputSeq

func (_m *MockBackend) GetBlockTokenOutputSeq(ctx context.Context, blockHeight uint64) map[string]int64

GetBlockTokenOutputSeq provides a mock function with given fields: ctx, blockHeight

func (*MockBackend) GetMaxOutputIndex

func (_m *MockBackend) GetMaxOutputIndex(ctx context.Context, token common.Address) int64

GetMaxOutputIndex provides a mock function with given fields: ctx, token

func (*MockBackend) GetOutput

func (_m *MockBackend) GetOutput(ctx context.Context, token common.Address, index uint64) (*types.UTXOOutputData, error)

GetOutput provides a mock function with given fields: ctx, token, index

func (*MockBackend) GetPoolNonce

func (_m *MockBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)

GetPoolNonce provides a mock function with given fields: ctx, addr

func (*MockBackend) GetPoolTransaction

func (_m *MockBackend) GetPoolTransaction(txHash common.Hash) *types.Transaction

GetPoolTransaction provides a mock function with given fields: txHash

func (*MockBackend) GetPoolTx

func (_m *MockBackend) GetPoolTx(txHash common.Hash) types.Tx

GetPoolTx provides a mock function with given fields: txHash

func (*MockBackend) GetReceipts

func (_m *MockBackend) GetReceipts(ctx context.Context, blockNr uint64) types.Receipts

GetReceipts provides a mock function with given fields: ctx, blockNr

func (*MockBackend) GetSeeds added in v0.1.2

func (_m *MockBackend) GetSeeds() []rtypes.Node

GetSeeds provides a mock function with given fields:

func (*MockBackend) GetTransactionReceipt

func (_m *MockBackend) GetTransactionReceipt(hash common.Hash) (*types.Receipt, common.Hash, uint64, uint64)

GetTransactionReceipt provides a mock function with given fields: hash

func (*MockBackend) GetTx

func (_m *MockBackend) GetTx(hash common.Hash) (types.Tx, *types.TxEntry)

GetTx provides a mock function with given fields: hash

func (*MockBackend) GetTxsResult

func (_m *MockBackend) GetTxsResult(ctx context.Context, blockNr uint64) (*types.TxsResult, error)

GetTxsResult provides a mock function with given fields: ctx, blockNr

func (*MockBackend) GetUTXOGas

func (_m *MockBackend) GetUTXOGas() uint64

GetUTXOGas provides a mock function with given fields:

func (*MockBackend) GetVM

func (_m *MockBackend) GetVM(ctx context.Context, msg types.Message, _a2 *state.StateDB, header *types.Header, vmCfg evm.Config) (vm.VmInterface, func() error, error)

GetVM provides a mock function with given fields: ctx, msg, _a2, header, vmCfg

func (*MockBackend) HeaderByNumber

func (_m *MockBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)

HeaderByNumber provides a mock function with given fields: ctx, blockNr

func (*MockBackend) NetInfo

func (_m *MockBackend) NetInfo() (*rtypes.ResultNetInfo, error)

NetInfo provides a mock function with given fields:

func (*MockBackend) PrometheusMetrics

func (_m *MockBackend) PrometheusMetrics() string

PrometheusMetrics provides a mock function with given fields:

func (*MockBackend) ProtocolVersion

func (_m *MockBackend) ProtocolVersion() string

ProtocolVersion provides a mock function with given fields:

func (*MockBackend) SendTx

func (_m *MockBackend) SendTx(ctx context.Context, signedTx types.Tx) error

SendTx provides a mock function with given fields: ctx, signedTx

func (*MockBackend) StartTheWorld

func (_m *MockBackend) StartTheWorld() bool

StartTheWorld provides a mock function with given fields:

func (*MockBackend) StateAndHeaderByNumber

func (_m *MockBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)

StateAndHeaderByNumber provides a mock function with given fields: ctx, blockNr

func (*MockBackend) Stats

func (_m *MockBackend) Stats() (int, int, int)

Stats provides a mock function with given fields:

func (*MockBackend) Status

func (_m *MockBackend) Status() (*rtypes.ResultStatus, error)

Status provides a mock function with given fields:

func (*MockBackend) StopTheWorld

func (_m *MockBackend) StopTheWorld() bool

StopTheWorld provides a mock function with given fields:

func (*MockBackend) SuggestPrice

func (_m *MockBackend) SuggestPrice(ctx context.Context) (*big.Int, error)

SuggestPrice provides a mock function with given fields: ctx

func (*MockBackend) Validators

func (_m *MockBackend) Validators(heightPtr *uint64) (*rtypes.ResultValidators, error)

Validators provides a mock function with given fields: heightPtr

type OutputArg

type OutputArg struct {
	Token common.Address `json:"token"`
	Index hexutil.Uint64 `json:"index"`
}

type PrivateAccountAPI

type PrivateAccountAPI struct {
	// contains filtered or unexported fields
}

PrivateAccountAPI provides an API to access accounts managed by this node. It offers methods to create, (un)lock en list accounts. Some methods accept passwords and are therefore considered private by default.

func NewPrivateAccountAPI

func NewPrivateAccountAPI(b Backend, nonceLock *AddrLocker) *PrivateAccountAPI

NewPrivateAccountAPI create a new PrivateAccountAPI.

func (*PrivateAccountAPI) DeriveAccount

func (s *PrivateAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error)

DeriveAccount requests a HD wallet to derive a new account, optionally pinning it for later reuse.

func (*PrivateAccountAPI) ListAccounts

func (s *PrivateAccountAPI) ListAccounts() []common.Address

ListAccounts will return a list of addresses for accounts this node manages.

func (*PrivateAccountAPI) ListWallets

func (s *PrivateAccountAPI) ListWallets() []rawWallet

ListWallets will return a list of wallets this node manages.

func (*PrivateAccountAPI) LockAccount

func (s *PrivateAccountAPI) LockAccount(addr common.Address) bool

LockAccount will lock the account associated with the given address when it's unlocked.

func (*PrivateAccountAPI) NewAccount

func (s *PrivateAccountAPI) NewAccount(password string, cue string) (common.Address, error)

NewAccount will create a new account and returns the address for the new account.

func (*PrivateAccountAPI) OpenWallet

func (s *PrivateAccountAPI) OpenWallet(url string, passphrase *string) error

OpenWallet initiates a hardware wallet opening procedure, establishing a USB connection and attempting to authenticate via the provided passphrase. Note, the method may return an extra challenge requiring a second open (e.g. the Trezor PIN matrix challenge).

func (*PrivateAccountAPI) SendTransaction

func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args rtypes.SendTxArgs, passwd string) (common.Hash, error)

SendTransaction will create a transaction from the given arguments and tries to sign it with the key associated with args.To. If the given passwd isn't able to decrypt the key it fails.

func (*PrivateAccountAPI) SignAndSendTransaction

func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args rtypes.SendTxArgs, passwd string) (common.Hash, error)

SignAndSendTransaction was renamed to SendTransaction. This method is deprecated and will be removed in the future. It primary goal is to give clients time to update.

func (*PrivateAccountAPI) SignTransaction

func (s *PrivateAccountAPI) SignTransaction(ctx context.Context, args rtypes.SendTxArgs, passwd string) (*rtypes.SignTransactionResult, error)

SignTransaction will create a transaction from the given arguments and tries to sign it with the key associated with args.To. If the given passwd isn't able to decrypt the key it fails. The transaction is returned in SER-form, not broadcast to other nodes

func (*PrivateAccountAPI) UnlockAccount

func (s *PrivateAccountAPI) UnlockAccount(addr common.Address, password string, duration *uint64) (bool, error)

UnlockAccount will unlock the account associated with the given address with the given password for duration seconds. If duration is nil it will use a default of 300 seconds. It returns an indication if the account was unlocked.

type PublicAccountAPI

type PublicAccountAPI struct {
	// contains filtered or unexported fields
}

PublicAccountAPI provides an API to access accounts managed by this node. It offers only methods that can retrieve accounts.

func NewPublicAccountAPI

func NewPublicAccountAPI(am *accounts.Manager) *PublicAccountAPI

NewPublicAccountAPI creates a new PublicAccountAPI.

func (*PublicAccountAPI) Accounts

func (s *PublicAccountAPI) Accounts() []common.Address

Accounts returns the collection of accounts this node manages

type PublicBlockChainAPI

type PublicBlockChainAPI struct {
	// contains filtered or unexported fields
}

PublicBlockChainAPI provides an API to access the Ethereum blockchain. It offers only methods that operate on public data that is freely available to anyone.

func NewPublicBlockChainAPI

func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI

NewPublicBlockChainAPI creates a new Ethereum blockchain API.

func (*PublicBlockChainAPI) Blacklist added in v0.1.1

func (s *PublicBlockChainAPI) Blacklist() []common.Address

Get current black list

func (*PublicBlockChainAPI) BlockNumber

func (s *PublicBlockChainAPI) BlockNumber() *big.Int

BlockNumber returns the block number of the chain head.

func (*PublicBlockChainAPI) Call

func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber) (hexutil.Bytes, error)

Call executes the given transaction on the state for the given block number. It doesn't make and changes in the state/blockchain and is useful to execute and retrieve values.

func (*PublicBlockChainAPI) ConsensusState

func (s *PublicBlockChainAPI) ConsensusState() (*rtypes.ResultConsensusState, error)

func (*PublicBlockChainAPI) DumpConsensusState

func (s *PublicBlockChainAPI) DumpConsensusState() (*rtypes.ResultDumpConsensusState, error)

func (*PublicBlockChainAPI) EstimateGas

func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error)

EstimateGas returns an estimate of the amount of gas needed to execute the given transaction against the current pending block.

func (*PublicBlockChainAPI) EstimateSweepGas added in v0.1.2

func (s *PublicBlockChainAPI) EstimateSweepGas(ctx context.Context, address common.Address) (*types.SweepGas, error)

EstimateSweepGas returns an estimate of the amount of gas needed to execute the sweep transaction against the current latest block.

func (*PublicBlockChainAPI) GenesisBlockNumber added in v0.1.1

func (s *PublicBlockChainAPI) GenesisBlockNumber(ctx context.Context) hexutil.Uint64

GenesisBlockNumber returns the genesis block number

func (*PublicBlockChainAPI) GetAllBalances

func (s *PublicBlockChainAPI) GetAllBalances(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (map[common.Address]*hexutil.Big, error)

GetAllBalances GetBalance of all tokens.

func (*PublicBlockChainAPI) GetAllCandidates

func (s *PublicBlockChainAPI) GetAllCandidates(ctx context.Context, blockNr rpc.BlockNumber) ([]*types.CandidateState, error)

GetAllCandidates get inner CandidateState from contract

func (*PublicBlockChainAPI) GetBalance

func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*big.Int, error)

GetBalance returns the amount of wei for the given address in the state of the given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.

func (*PublicBlockChainAPI) GetBlockBalanceRecordsByNumber

func (s *PublicBlockChainAPI) GetBlockBalanceRecordsByNumber(ctx context.Context, blockNr rpc.BlockNumber) (interface{}, error)

func (*PublicBlockChainAPI) GetBlockByHash

func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, blockHash common.Hash, fullTx bool) (interface{}, error)

GetBlockByHash returns the requested block. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

func (*PublicBlockChainAPI) GetBlockByNumber

func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber, fullTx bool) (interface{}, error)

GetBlockByNumber returns the requested block. When blockNr is -1 the chain head is returned. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

func (*PublicBlockChainAPI) GetBlockUTXOsByNumber

func (s *PublicBlockChainAPI) GetBlockUTXOsByNumber(ctx context.Context, blockNr rpc.BlockNumber, fullTx bool) (interface{}, error)

GetBlockUTXOsByNumber returns the requested block. When blockNr is -1 the chain head is returned. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

func (*PublicBlockChainAPI) GetChainVersion

func (s *PublicBlockChainAPI) GetChainVersion(ctx context.Context) (string, error)

GetChainVersion return chain version

func (*PublicBlockChainAPI) GetCode

func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (hexutil.Bytes, error)

GetCode returns the code stored at the given address in the state for the given block number.

func (*PublicBlockChainAPI) GetMaxOutputIndex

func (s *PublicBlockChainAPI) GetMaxOutputIndex(ctx context.Context, token common.Address) hexutil.Uint64

GetMaxOutputIndex get max UTXO output index by token

func (*PublicBlockChainAPI) GetOutputs

func (s *PublicBlockChainAPI) GetOutputs(ctx context.Context, args []OutputArg) ([]*rtypes.RPCOutput, error)

GetOutputs get UTXO outputs

func (*PublicBlockChainAPI) GetStorageAt

func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNr rpc.BlockNumber) (hexutil.Bytes, error)

GetStorageAt returns the storage from the state at the given address, key and block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.

func (*PublicBlockChainAPI) GetStorageRoot

func (s *PublicBlockChainAPI) GetStorageRoot(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (string, error)

func (*PublicBlockChainAPI) GetTokenBalance

func (s *PublicBlockChainAPI) GetTokenBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber, tokenAddress common.Address) (*big.Int, error)

GetTokenBalance GetBalance of token.

func (*PublicBlockChainAPI) GetTxsResult

func (s *PublicBlockChainAPI) GetTxsResult(ctx context.Context, blockNr uint64) (*types.TxsResult, error)

GetTxsResult get txsResult

func (*PublicBlockChainAPI) GetUTXOChangeRate added in v0.1.3

func (s *PublicBlockChainAPI) GetUTXOChangeRate(ctx context.Context, addr common.Address) (hexutil.Uint64, error)

GetUTXOChangeRate returns utxo change rate of target contract

func (*PublicBlockChainAPI) GetUTXOGas

func (s *PublicBlockChainAPI) GetUTXOGas(ctx context.Context) (hexutil.Uint64, error)

GetUTXOGas return the gas value of UTXO transaction

func (*PublicBlockChainAPI) GetWhiteValidators added in v0.1.1

func (s *PublicBlockChainAPI) GetWhiteValidators(ctx context.Context, blockNr rpc.BlockNumber) ([]*types.Validator, error)

GetWhiteValidators get inner validators in whiteList contract

func (*PublicBlockChainAPI) IsBlackAddress added in v0.1.1

func (s *PublicBlockChainAPI) IsBlackAddress(ctx context.Context, address common.Address) bool

Check address is black address

func (*PublicBlockChainAPI) StartTheWorld

func (s *PublicBlockChainAPI) StartTheWorld() bool

func (*PublicBlockChainAPI) Status

func (s *PublicBlockChainAPI) Status() (*rtypes.ResultStatus, error)

func (*PublicBlockChainAPI) StopTheWorld

func (s *PublicBlockChainAPI) StopTheWorld() bool

func (*PublicBlockChainAPI) TokenCall

func (s *PublicBlockChainAPI) TokenCall(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber) (hexutil.Bytes, error)

TokenCall executes the given tokenTransaction on the state for the given block number. It doesn't make and changes in the state/blockchain and is useful to execute and retrieve values.

func (*PublicBlockChainAPI) Validators

type PublicDebugAPI

type PublicDebugAPI struct {
	// contains filtered or unexported fields
}

PublicDebugAPI is the collection of Ethereum APIs exposed over the public debugging endpoint.

func NewPublicDebugAPI

func NewPublicDebugAPI(b Backend) *PublicDebugAPI

NewPublicDebugAPI creates a new API definition for the public debug methods of the Ethereum service.

func (*PublicDebugAPI) GetBlockBinary

func (s *PublicDebugAPI) GetBlockBinary(ctx context.Context, number rpc.BlockNumber) (*rtypes.ResultBlock, error)

func (*PublicDebugAPI) GetBlockHeader

func (s *PublicDebugAPI) GetBlockHeader(ctx context.Context, number rpc.BlockNumber) (*rtypes.ResultBlockHeader, error)

func (*PublicDebugAPI) GetBlockSer

func (s *PublicDebugAPI) GetBlockSer(ctx context.Context, number uint64) (string, error)

GetBlockSer retrieves the SER encoded for of a single block.

func (*PublicDebugAPI) PrintBlock

func (s *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error)

PrintBlock retrieves a block and returns its pretty printed form.

type PublicEthereumAPI

type PublicEthereumAPI struct {
	// contains filtered or unexported fields
}

PublicEthereumAPI provides an API to access Ethereum related information. It offers only methods that operate on public data that is freely available to anyone.

func NewPublicEthereumAPI

func NewPublicEthereumAPI(b Backend) *PublicEthereumAPI

NewPublicEthereumAPI creates a new Ethereum protocol API.

func (*PublicEthereumAPI) GasPrice

func (s *PublicEthereumAPI) GasPrice(ctx context.Context) (*big.Int, error)

GasPrice returns a suggestion for a gas price.

func (*PublicEthereumAPI) ProtocolVersion

func (s *PublicEthereumAPI) ProtocolVersion() string

ProtocolVersion returns the current Ethereum protocol version this node supports

type PublicMempoolAPI

type PublicMempoolAPI struct {
	// contains filtered or unexported fields
}

func NewPublicMempoolAPI

func NewPublicMempoolAPI(b Backend) *PublicMempoolAPI

func (*PublicMempoolAPI) Status

func (s *PublicMempoolAPI) Status() map[string]hexutil.Uint

type PublicNetAPI

type PublicNetAPI struct {
	// contains filtered or unexported fields
}

func NewPublicNetAPI

func NewPublicNetAPI(b Backend, netVersion uint64) *PublicNetAPI

func (*PublicNetAPI) GetSeeds added in v0.1.1

func (s *PublicNetAPI) GetSeeds() []rtypes.Node

func (*PublicNetAPI) Info

func (s *PublicNetAPI) Info() (*rtypes.ResultNetInfo, error)

func (*PublicNetAPI) Listening

func (s *PublicNetAPI) Listening() bool

func (*PublicNetAPI) Version

func (s *PublicNetAPI) Version() string

Version returns the current ethereum protocol version.

type PublicPrometheusMetricsAPI

type PublicPrometheusMetricsAPI struct {
	// contains filtered or unexported fields
}

func NewPublicPrometheusMetricsAPI

func NewPublicPrometheusMetricsAPI(b Backend) *PublicPrometheusMetricsAPI

func (*PublicPrometheusMetricsAPI) PrometheusMetrics

func (s *PublicPrometheusMetricsAPI) PrometheusMetrics() string

type PublicTransactionPoolAPI

type PublicTransactionPoolAPI struct {
	// contains filtered or unexported fields
}

PublicTransactionPoolAPI exposes methods for the RPC interface

func NewPublicTransactionPoolAPI

func NewPublicTransactionPoolAPI(b Backend, nonceLock *AddrLocker) *PublicTransactionPoolAPI

NewPublicTransactionPoolAPI creates a new RPC service with methods specific for the transaction pool.

func (*PublicTransactionPoolAPI) GetBlockTransactionCountByHash

func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint

GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.

func (*PublicTransactionPoolAPI) GetBlockTransactionCountByNumber

func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint

GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.

func (*PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex

func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes

GetRawTransactionByBlockHashAndIndex returns the bytes of the transaction for the given block hash and index.

func (*PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex

func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes

GetRawTransactionByBlockNumberAndIndex returns the bytes of the transaction for the given block number and index.

func (*PublicTransactionPoolAPI) GetRawTransactionByHash

func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

GetRawTransactionByHash returns the bytes of the transaction for the given hash.

func (*PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex

func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) interface{}

GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.

func (*PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex

func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) interface{}

GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.

func (*PublicTransactionPoolAPI) GetTransactionByHash

func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) interface{}

GetTransactionByHash returns the transaction for the given hash

func (*PublicTransactionPoolAPI) GetTransactionCount

func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)

GetTransactionCount returns the number of transactions the given address has sent for the given block number

func (*PublicTransactionPoolAPI) GetTransactionReceipt

func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)

GetTransactionReceipt returns the transaction receipt for the given transaction hash.

func (*PublicTransactionPoolAPI) SendRawTokenTransaction

func (s *PublicTransactionPoolAPI) SendRawTokenTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error)

SendRawTokenTransaction will add the signed transaction to the transaction pool. The sender is responsible for signing the transaction and using the correct nonce.

func (*PublicTransactionPoolAPI) SendRawTransaction

func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error)

SendRawTransaction will add the signed transaction to the transaction pool. The sender is responsible for signing the transaction and using the correct nonce.

func (*PublicTransactionPoolAPI) SendRawTx

func (s *PublicTransactionPoolAPI) SendRawTx(ctx context.Context, encodedTx hexutil.Bytes, txType string) (common.Hash, error)

SendRawTx will add the signed tx to the transaction pool.

func (*PublicTransactionPoolAPI) SendRawUTXOTransaction

func (s *PublicTransactionPoolAPI) SendRawUTXOTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error)

SendRawUTXOTransaction add the signed UTXO transaction to the transaction pool.

func (*PublicTransactionPoolAPI) SendTransaction

func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args rtypes.SendTxArgs) (common.Hash, error)

SendTransaction creates a transaction for the given argument, sign it and submit it to the transaction pool.

func (*PublicTransactionPoolAPI) SignSpecTx

func (*PublicTransactionPoolAPI) SignTransaction

SignTransaction will sign the given transaction with the from account. The node needs to have the private key of the account corresponding with the given from address and it needs to be unlocked.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL