Documentation ¶
Overview ¶
Package ethapi implements the general Ethereum API functions.
Index ¶
- func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrHash, ...) (acl types.AccessList, gasUsed uint64, vmErr error, err error)
- func DoCall(ctx context.Context, b Backend, args TransactionArgs, ...) (*evmcore.ExecutionResult, error)
- func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, ...) (hexutil.Uint64, error)
- func GetAPIs(apiBackend Backend) []rpc.API
- func RPCMarshalBlock(block *evmcore.EvmBlock, ext extBlockApi, inclTx bool, fullTx bool) (map[string]interface{}, error)
- func RPCMarshalDelegation(it sfcapi.SfcDelegationAndID) map[string]interface{}
- func RPCMarshalHeader(head *evmcore.EvmHeader, ext extBlockApi) map[string]interface{}
- func RPCMarshalStaker(it sfcapi.SfcStakerAndID) map[string]interface{}
- func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (common.Hash, error)
- type AccountResult
- type AddrLocker
- type Backend
- type ExecutionResult
- type OverrideAccount
- type PeerProgress
- type PrivateAccountAPI
- func (s *PrivateAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error)
- func (s *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error)
- func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string) (common.Address, error)
- func (s *PrivateAccountAPI) InitializeWallet(ctx context.Context, url string) (string, error)
- func (s *PrivateAccountAPI) ListAccounts() []common.Address
- func (s *PrivateAccountAPI) ListWallets() []RawWallet
- func (s *PrivateAccountAPI) LockAccount(addr common.Address) bool
- func (s *PrivateAccountAPI) NewAccount(password string) (common.Address, error)
- func (s *PrivateAccountAPI) OpenWallet(url string, passphrase *string) error
- func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args TransactionArgs, passwd string) (common.Hash, error)
- func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error)
- func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args TransactionArgs, passwd string) (common.Hash, error)
- func (s *PrivateAccountAPI) SignTransaction(ctx context.Context, args TransactionArgs, passwd string) (*SignTransactionResult, error)
- func (s *PrivateAccountAPI) UnlockAccount(ctx context.Context, addr common.Address, password string, duration *uint64) (bool, error)
- func (s *PrivateAccountAPI) Unpair(ctx context.Context, url string, pin string) error
- type PrivateDebugAPI
- type PublicAbftAPI
- func (s *PublicAbftAPI) GetDowntime(ctx context.Context, validatorID hexutil.Uint) (map[string]interface{}, error)
- func (s *PublicAbftAPI) GetEpochUptime(ctx context.Context, validatorID hexutil.Uint) (hexutil.Uint64, error)
- func (s *PublicAbftAPI) GetOriginatedEpochFee(ctx context.Context, validatorID hexutil.Uint) (*hexutil.Big, error)
- type PublicAccountAPI
- type PublicBlockChainAPI
- func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64
- func (s *PublicBlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, ...) (hexutil.Bytes, error)
- func (api *PublicBlockChainAPI) ChainId() (*hexutil.Big, error)
- func (s *PublicBlockChainAPI) CreateAccessList(ctx context.Context, args TransactionArgs, ...) (*accessListResult, error)
- func (s *PublicBlockChainAPI) CurrentEpoch(ctx context.Context) hexutil.Uint64
- func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, ...) (hexutil.Uint64, error)
- func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, ...) (*hexutil.Big, error)
- func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, ...) (hexutil.Bytes, error)
- func (s *PublicBlockChainAPI) GetEpochStats(ctx context.Context, requestedEpoch rpc.BlockNumber) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) map[string]interface{}
- func (s *PublicBlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, ...) (*AccountResult, error)
- func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, key string, ...) (hexutil.Bytes, error)
- func (s *PublicBlockChainAPI) GetUncleByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (s *PublicBlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
- type PublicDAGChainAPI
- func (s *PublicDAGChainAPI) GetEvent(ctx context.Context, shortEventID string) (map[string]interface{}, error)
- func (s *PublicDAGChainAPI) GetEventPayload(ctx context.Context, shortEventID string, inclTx bool) (map[string]interface{}, error)
- func (s *PublicDAGChainAPI) GetHeads(ctx context.Context, epoch rpc.BlockNumber) ([]hexutil.Bytes, error)
- type PublicDebugAPI
- func (api *PublicDebugAPI) BlocksTransactionTimes(ctx context.Context, untilBlock rpc.BlockNumber, maxBlocks hexutil.Uint64) (map[hexutil.Uint64]hexutil.Uint, error)
- func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (string, error)
- func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error)
- func (api *PublicDebugAPI) SeedHash(ctx context.Context, number uint64) (string, error)
- func (api *PublicDebugAPI) TestSignCliqueBlock(ctx context.Context, address common.Address, number uint64) (common.Address, error)
- type PublicEthereumAPI
- func (s *PublicEthereumAPI) FeeHistory(ctx context.Context, blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, ...) (*feeHistoryResult, error)
- func (s *PublicEthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)
- func (s *PublicEthereumAPI) MaxPriorityFeePerGas(ctx context.Context) (*hexutil.Big, error)
- func (s *PublicEthereumAPI) Syncing() (interface{}, error)
- type PublicNetAPI
- type PublicSfcAPI
- func (s *PublicSfcAPI) GetDelegation(ctx context.Context, addr common.Address, stakerID hexutil.Uint, ...) (map[string]interface{}, error)
- func (s *PublicSfcAPI) GetDelegationClaimedRewards(ctx context.Context, addr common.Address, stakerID hexutil.Uint) (*hexutil.Big, error)
- func (s *PublicSfcAPI) GetDelegationsByAddress(ctx context.Context, addr common.Address, verbosity hexutil.Uint64) ([]interface{}, error)
- func (s *PublicSfcAPI) GetDelegationsOf(ctx context.Context, stakerID hexutil.Uint64, verbosity hexutil.Uint64) ([]interface{}, error)
- func (s *PublicSfcAPI) GetDowntime(ctx context.Context, stakerID hexutil.Uint) (map[string]interface{}, error)
- func (s *PublicSfcAPI) GetOriginationScore(ctx context.Context, stakerID hexutil.Uint) (*hexutil.Big, error)
- func (s *PublicSfcAPI) GetRewardWeights(ctx context.Context, stakerID hexutil.Uint) (map[string]interface{}, error)
- func (s *PublicSfcAPI) GetStaker(ctx context.Context, stakerID hexutil.Uint, verbosity hexutil.Uint64) (map[string]interface{}, error)
- func (s *PublicSfcAPI) GetStakerByAddress(ctx context.Context, address common.Address, verbosity hexutil.Uint64) (map[string]interface{}, error)
- func (s *PublicSfcAPI) GetStakerClaimedRewards(ctx context.Context, stakerID hexutil.Uint64) (*hexutil.Big, error)
- func (s *PublicSfcAPI) GetStakerDelegationsClaimedRewards(ctx context.Context, stakerID hexutil.Uint64) (*hexutil.Big, error)
- func (s *PublicSfcAPI) GetStakerPoI(ctx context.Context, stakerID hexutil.Uint) (*hexutil.Big, error)
- func (s *PublicSfcAPI) GetStakers(ctx context.Context, verbosity hexutil.Uint64) ([]interface{}, error)
- func (s *PublicSfcAPI) GetValidationScore(ctx context.Context, stakerID hexutil.Uint) (*hexutil.Big, error)
- type PublicTransactionPoolAPI
- func (s *PublicTransactionPoolAPI) FillTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error)
- func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
- func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes
- func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes
- func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction
- func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction
- func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
- func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, address common.Address, ...) (*hexutil.Uint64, error)
- func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
- func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error)
- func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs TransactionArgs, gasPrice *hexutil.Big, ...) (common.Hash, error)
- func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error)
- func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args TransactionArgs) (common.Hash, error)
- func (s *PublicTransactionPoolAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error)
- func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error)
- type PublicTxPoolAPI
- func (s *PublicTxPoolAPI) Content() map[string]map[string]map[string]*RPCTransaction
- func (s *PublicTxPoolAPI) ContentFrom(addr common.Address) map[string]map[string]*RPCTransaction
- func (s *PublicTxPoolAPI) Inspect() map[string]map[string]map[string]string
- func (s *PublicTxPoolAPI) Status() map[string]hexutil.Uint
- type RPCTransaction
- type RawWallet
- type SignTransactionResult
- type StateOverride
- type StorageResult
- type StructLogRes
- type TransactionArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessList ¶
func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrHash, args TransactionArgs) (acl types.AccessList, gasUsed uint64, vmErr error, err error)
AccessList creates an access list for the given transaction. If the accesslist creation fails an error is returned. If the transaction itself fails, an vmErr is returned.
func DoCall ¶
func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, timeout time.Duration, globalGasCap uint64) (*evmcore.ExecutionResult, error)
func DoEstimateGas ¶
func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, gasCap uint64) (hexutil.Uint64, error)
DoEstimateGas - binary search the gas requirement, as it may be higher than the amount used
func RPCMarshalBlock ¶
func RPCMarshalBlock(block *evmcore.EvmBlock, ext extBlockApi, inclTx bool, fullTx bool) (map[string]interface{}, error)
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 RPCMarshalDelegation ¶
func RPCMarshalDelegation(it sfcapi.SfcDelegationAndID) map[string]interface{}
RPCMarshalDelegation converts the given delegation to the RPC output .
func RPCMarshalHeader ¶
RPCMarshalHeader converts the given header to the RPC output .
func RPCMarshalStaker ¶
func RPCMarshalStaker(it sfcapi.SfcStakerAndID) map[string]interface{}
RPCMarshalStaker converts the given staker to the RPC output .
func SubmitTransaction ¶
SubmitTransaction is a helper function that submits tx to txPool and logs a message.
Types ¶
type AccountResult ¶
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"` }
AccountResult is result struct for GetProof
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 { // General Ethereum API Progress() PeerProgress SuggestGasTipCap(ctx context.Context) (*big.Int, error) ChainDb() ethdb.Database AccountManager() *accounts.Manager ExtRPCEnabled() bool RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection RPCTxFeeCap() float64 // global tx fee cap for all transaction related APIs UnprotectedAllowed() bool // allows only for EIP155 transactions. CalcBlockExtApi() bool // Blockchain API HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*evmcore.EvmHeader, error) HeaderByHash(ctx context.Context, hash common.Hash) (*evmcore.EvmHeader, error) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*evmcore.EvmBlock, error) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *evmcore.EvmHeader, error) ResolveRpcBlockNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (idx.Block, error) BlockByHash(ctx context.Context, hash common.Hash) (*evmcore.EvmBlock, error) GetReceiptsByNumber(ctx context.Context, number rpc.BlockNumber) (types.Receipts, error) GetTd(hash common.Hash) *big.Int GetEVM(ctx context.Context, msg evmcore.Message, state *state.StateDB, header *evmcore.EvmHeader, vmConfig *vm.Config) (*vm.EVM, func() error, error) MinGasPrice() *big.Int MaxGasLimit() uint64 // Transaction pool API SendTx(ctx context.Context, signedTx *types.Transaction) error GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, uint64, uint64, error) GetPoolTransactions() (types.Transactions, error) GetPoolTransaction(txHash common.Hash) *types.Transaction GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) Stats() (pending int, queued int) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) TxPoolContentFrom(addr common.Address) (types.Transactions, types.Transactions) SubscribeNewTxsNotify(chan<- evmcore.NewTxsNotify) notify.Subscription ChainConfig() *params.ChainConfig CurrentBlock() *evmcore.EvmBlock // Forest DAG API GetEventPayload(ctx context.Context, shortEventID string) (*inter.EventPayload, error) GetEvent(ctx context.Context, shortEventID string) (*inter.Event, error) GetHeads(ctx context.Context, epoch rpc.BlockNumber) (hash.Events, error) CurrentEpoch(ctx context.Context) idx.Epoch SealedEpochTiming(ctx context.Context) (start inter.Timestamp, end inter.Timestamp) // Forest SFC API GetValidators(ctx context.Context) *pos.Validators GetUptime(ctx context.Context, stakerID idx.ValidatorID) (*big.Int, error) GetOriginatedFee(ctx context.Context, stakerID idx.ValidatorID) (*big.Int, error) GetRewardWeights(ctx context.Context, stakerID idx.ValidatorID) (*big.Int, *big.Int, error) GetStakerPoI(ctx context.Context, stakerID idx.ValidatorID) (*big.Int, error) GetDowntime(ctx context.Context, stakerID idx.ValidatorID) (idx.Block, inter.Timestamp, error) GetDelegationClaimedRewards(ctx context.Context, id sfcapi.DelegationID) (*big.Int, error) GetStakerClaimedRewards(ctx context.Context, stakerID idx.ValidatorID) (*big.Int, error) GetStakerDelegationsClaimedRewards(ctx context.Context, stakerID idx.ValidatorID) (*big.Int, error) GetStaker(ctx context.Context, stakerID idx.ValidatorID) (*sfcapi.SfcStaker, error) GetStakerID(ctx context.Context, addr common.Address) (idx.ValidatorID, error) GetStakers(ctx context.Context) ([]sfcapi.SfcStakerAndID, error) GetDelegationsOf(ctx context.Context, stakerID idx.ValidatorID) ([]sfcapi.SfcDelegationAndID, error) GetDelegationsByAddress(ctx context.Context, addr common.Address) ([]sfcapi.SfcDelegationAndID, error) GetDelegation(ctx context.Context, id sfcapi.DelegationID) (*sfcapi.SfcDelegation, error) }
Backend interface provides the common API services (that are provided by both full and light clients) with access to necessary functions.
type ExecutionResult ¶
type ExecutionResult struct { Gas uint64 `json:"gas"` Failed bool `json:"failed"` ReturnValue string `json:"returnValue"` StructLogs []StructLogRes `json:"structLogs"` }
ExecutionResult groups all structured logs emitted by the EVM while replaying a transaction in debug mode as well as transaction execution status, the amount of gas used and the return value
type OverrideAccount ¶
type OverrideAccount 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"` }
OverrideAccount 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 PeerProgress ¶
type PeerProgress struct { CurrentEpoch idx.Epoch CurrentBlock idx.Block CurrentBlockHash hash.Event CurrentBlockTime inter.Timestamp HighestBlock idx.Block HighestEpoch idx.Epoch }
PeerProgress is synchronization status of a peer
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) EcRecover ¶
func (s *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error)
EcRecover returns the address for the account that was used to create the signature. Note, this function is compatible with eth_sign and personal_sign. As such it recovers the address of: hash = keccak256("\x19Ethereum Signed Message:\n"${message length}${message}) addr = ecrecover(hash, signature)
Note, the signature must conform to the secp256k1 curve R, S and V values, where the V value must be 27 or 28 for legacy reasons.
https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover
func (*PrivateAccountAPI) ImportRawKey ¶
ImportRawKey stores the given hex encoded ECDSA key into the key directory, encrypting it with the passphrase.
func (*PrivateAccountAPI) InitializeWallet ¶
InitializeWallet initializes a new wallet at the provided URL, by generating and returning a new private key.
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) (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 TransactionArgs, 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.From. If the given passwd isn't able to decrypt the key it fails.
func (*PrivateAccountAPI) Sign ¶
func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error)
Sign calculates an Ethereum ECDSA signature for: keccack256("\x19Ethereum Signed Message:\n" + len(message) + message))
Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons.
The key used to calculate the signature is decrypted with the given password.
https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign
func (*PrivateAccountAPI) SignAndSendTransaction ¶
func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args TransactionArgs, 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 TransactionArgs, passwd string) (*SignTransactionResult, error)
SignTransaction will create a transaction from the given arguments and tries to sign it with the key associated with args.From. If the given passwd isn't able to decrypt the key it fails. The transaction is returned in RLP-form, not broadcast to other nodes
func (*PrivateAccountAPI) UnlockAccount ¶
func (s *PrivateAccountAPI) UnlockAccount(ctx context.Context, 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 PrivateDebugAPI ¶
type PrivateDebugAPI struct {
// contains filtered or unexported fields
}
PrivateDebugAPI is the collection of Ethereum APIs exposed over the private debugging endpoint.
func NewPrivateDebugAPI ¶
func NewPrivateDebugAPI(b Backend) *PrivateDebugAPI
NewPrivateDebugAPI creates a new API definition for the private debug methods of the Ethereum service.
func (*PrivateDebugAPI) ChaindbCompact ¶
func (api *PrivateDebugAPI) ChaindbCompact() error
ChaindbCompact flattens the entire key-value database into a single level, removing all unused slots and merging all keys.
func (*PrivateDebugAPI) ChaindbProperty ¶
func (api *PrivateDebugAPI) ChaindbProperty(property string) (string, error)
ChaindbProperty returns leveldb properties of the key-value database.
type PublicAbftAPI ¶
type PublicAbftAPI struct {
// contains filtered or unexported fields
}
PublicAbftAPI provides an API to access consensus related information. It offers only methods that operate on public data that is freely available to anyone.
func NewPublicAbftAPI ¶
func NewPublicAbftAPI(b Backend) *PublicAbftAPI
NewPublicAbftAPI creates a new SFC protocol API.
func (*PublicAbftAPI) GetDowntime ¶
func (s *PublicAbftAPI) GetDowntime(ctx context.Context, validatorID hexutil.Uint) (map[string]interface{}, error)
GetDowntime returns validator's downtime.
func (*PublicAbftAPI) GetEpochUptime ¶
func (s *PublicAbftAPI) GetEpochUptime(ctx context.Context, validatorID hexutil.Uint) (hexutil.Uint64, error)
GetEpochUptime returns validator's epoch uptime in nanoseconds.
func (*PublicAbftAPI) GetOriginatedEpochFee ¶
func (s *PublicAbftAPI) GetOriginatedEpochFee(ctx context.Context, validatorID hexutil.Uint) (*hexutil.Big, error)
GetOriginatedEpochFee returns validator's originated epoch fee.
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) BlockNumber ¶
func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64
BlockNumber returns the block number of the chain head.
func (*PublicBlockChainAPI) Call ¶
func (s *PublicBlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Bytes, error)
Call executes the given transaction on the state for the given block number.
Additionally, the caller can specify a batch of contract for fields overriding.
Note, this function doesn't make and changes in the state/blockchain and is useful to execute and retrieve values.
func (*PublicBlockChainAPI) ChainId ¶
func (api *PublicBlockChainAPI) ChainId() (*hexutil.Big, error)
ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
func (*PublicBlockChainAPI) CreateAccessList ¶
func (s *PublicBlockChainAPI) CreateAccessList(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (*accessListResult, error)
CreateAccessList creates a EIP-2930 type AccessList for the given transaction. Reexec and BlockNrOrHash can be specified to create the accessList on top of a certain state.
func (*PublicBlockChainAPI) CurrentEpoch ¶
func (s *PublicBlockChainAPI) CurrentEpoch(ctx context.Context) hexutil.Uint64
CurrentEpoch returns current epoch number.
func (*PublicBlockChainAPI) EstimateGas ¶
func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (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) GetBalance ¶
func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, 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) GetBlockByHash ¶
func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]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, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
GetBlockByNumber returns the requested canonical block.
- When blockNr is -1 the chain head is returned.
- When blockNr is -2 the pending chain head is returned.
- When fullTx is true all transactions in the block are returned, otherwise only the transaction hash is returned.
func (*PublicBlockChainAPI) GetCode ¶
func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
GetCode returns the code stored at the given address in the state for the given block number.
func (*PublicBlockChainAPI) GetEpochStats ¶
func (s *PublicBlockChainAPI) GetEpochStats(ctx context.Context, requestedEpoch rpc.BlockNumber) (map[string]interface{}, error)
GetEpochStats returns epoch statistics. * When epoch is -2 the statistics for latest epoch is returned. * When epoch is -1 the statistics for latest sealed epoch is returned.
func (*PublicBlockChainAPI) GetHeaderByHash ¶
func (s *PublicBlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) map[string]interface{}
GetHeaderByHash returns the requested header by hash.
func (*PublicBlockChainAPI) GetHeaderByNumber ¶
func (s *PublicBlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)
GetHeaderByNumber returns the requested canonical block header. * When blockNr is -1 the chain head is returned. * When blockNr is -2 the pending chain head is returned.
func (*PublicBlockChainAPI) GetProof ¶
func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash) (*AccountResult, error)
GetProof returns the Merkle-proof for a given account and optionally some storage keys.
func (*PublicBlockChainAPI) GetStorageAt ¶
func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNr rpc.BlockNumberOrHash) (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) GetUncleByBlockHashAndIndex ¶
func (s *PublicBlockChainAPI) GetUncleByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (map[string]interface{}, error)
GetUncleByBlockHashAndIndex returns the uncle block for the given block hash and index. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.
func (*PublicBlockChainAPI) GetUncleByBlockNumberAndIndex ¶
func (s *PublicBlockChainAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error)
GetUncleByBlockNumberAndIndex returns the uncle block for the given block hash and index. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.
func (*PublicBlockChainAPI) GetUncleCountByBlockHash ¶
func (s *PublicBlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
GetUncleCountByBlockHash returns number of uncles in the block for the given block hash
func (*PublicBlockChainAPI) GetUncleCountByBlockNumber ¶
func (s *PublicBlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
GetUncleCountByBlockNumber returns number of uncles in the block for the given block number
type PublicDAGChainAPI ¶
type PublicDAGChainAPI struct {
// contains filtered or unexported fields
}
PublicDAGChainAPI provides an API to access the directed acyclic graph chain. It offers only methods that operate on public data that is freely available to anyone.
func NewPublicDAGChainAPI ¶
func NewPublicDAGChainAPI(b Backend) *PublicDAGChainAPI
NewPublicDAGChainAPI creates a new DAG chain API.
func (*PublicDAGChainAPI) GetEvent ¶
func (s *PublicDAGChainAPI) GetEvent(ctx context.Context, shortEventID string) (map[string]interface{}, error)
GetEvent returns the Forest event header by hash or short ID.
func (*PublicDAGChainAPI) GetEventPayload ¶
func (s *PublicDAGChainAPI) GetEventPayload(ctx context.Context, shortEventID string, inclTx bool) (map[string]interface{}, error)
GetEventPayload returns Forest event by hash or short ID.
func (*PublicDAGChainAPI) GetHeads ¶
func (s *PublicDAGChainAPI) GetHeads(ctx context.Context, epoch rpc.BlockNumber) ([]hexutil.Bytes, error)
GetHeads returns IDs of all the epoch events with no descendants. * When epoch is -2 the heads for latest epoch are returned. * When epoch is -1 the heads for latest sealed epoch are returned.
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) BlocksTransactionTimes ¶
func (api *PublicDebugAPI) BlocksTransactionTimes(ctx context.Context, untilBlock rpc.BlockNumber, maxBlocks hexutil.Uint64) (map[hexutil.Uint64]hexutil.Uint, error)
BlocksTransactionTimes returns the map time => number of transactions This data may be used to draw a histogram to calculate a peak TPS of a range of blocks
func (*PublicDebugAPI) GetBlockRlp ¶
GetBlockRlp retrieves the RLP encoded for of a single block.
func (*PublicDebugAPI) PrintBlock ¶
PrintBlock retrieves a block and returns its pretty printed form.
func (*PublicDebugAPI) TestSignCliqueBlock ¶
func (api *PublicDebugAPI) TestSignCliqueBlock(ctx context.Context, address common.Address, number uint64) (common.Address, error)
TestSignCliqueBlock fetches the given block number, and attempts to sign it as a clique header with the given address, returning the address of the recovered signature
This is a temporary method to debug the externalsigner integration,
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) FeeHistory ¶ added in v1.0.2
func (s *PublicEthereumAPI) FeeHistory(ctx context.Context, blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*feeHistoryResult, error)
func (*PublicEthereumAPI) GasPrice ¶
GasPrice returns a suggestion for a gas price for legacy transactions.
func (*PublicEthereumAPI) MaxPriorityFeePerGas ¶ added in v1.0.2
MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions.
func (*PublicEthereumAPI) Syncing ¶
func (s *PublicEthereumAPI) Syncing() (interface{}, error)
Syncing returns true if node is syncing
type PublicNetAPI ¶
type PublicNetAPI struct {
// contains filtered or unexported fields
}
PublicNetAPI offers network related RPC methods
func NewPublicNetAPI ¶
func NewPublicNetAPI(net *p2p.Server, networkVersion uint64) *PublicNetAPI
NewPublicNetAPI creates a new net API instance.
func (*PublicNetAPI) Listening ¶
func (s *PublicNetAPI) Listening() bool
Listening returns an indication if the node is listening for network connections.
func (*PublicNetAPI) PeerCount ¶
func (s *PublicNetAPI) PeerCount() hexutil.Uint
PeerCount returns the number of connected peers
func (*PublicNetAPI) Version ¶
func (s *PublicNetAPI) Version() string
Version returns the current ethereum protocol version.
type PublicSfcAPI ¶
type PublicSfcAPI struct {
// contains filtered or unexported fields
}
PublicSfcAPI provides an API to access SFC related information. It offers only methods that operate on public data that is freely available to anyone.
func NewPublicSfcAPI ¶
func NewPublicSfcAPI(b Backend) *PublicSfcAPI
NewPublicSfcAPI creates a new SFC protocol API.
func (*PublicSfcAPI) GetDelegation ¶
func (s *PublicSfcAPI) GetDelegation(ctx context.Context, addr common.Address, stakerID hexutil.Uint, verbosity hexutil.Uint64) (map[string]interface{}, error)
GetDelegation returns SFC delegation info Verbosity. Number. If >= 1, then include base fields. If >= 2, then include metrics.
func (*PublicSfcAPI) GetDelegationClaimedRewards ¶
func (s *PublicSfcAPI) GetDelegationClaimedRewards(ctx context.Context, addr common.Address, stakerID hexutil.Uint) (*hexutil.Big, error)
GetDelegationClaimedRewards returns sum of claimed rewards in past, by this delegation
func (*PublicSfcAPI) GetDelegationsByAddress ¶
func (s *PublicSfcAPI) GetDelegationsByAddress(ctx context.Context, addr common.Address, verbosity hexutil.Uint64) ([]interface{}, error)
GetDelegationsByAddress returns SFC delegations by address Verbosity. Number. If >= 1, then include base fields. If >= 2, then include metrics.
func (*PublicSfcAPI) GetDelegationsOf ¶
func (s *PublicSfcAPI) GetDelegationsOf(ctx context.Context, stakerID hexutil.Uint64, verbosity hexutil.Uint64) ([]interface{}, error)
GetDelegationsOf returns SFC delegations who delegated to a staker Verbosity. Number. If 0, then include only addresses. If >= 1, then include base fields. If >= 2, then include metrics.
func (*PublicSfcAPI) GetDowntime ¶
func (s *PublicSfcAPI) GetDowntime(ctx context.Context, stakerID hexutil.Uint) (map[string]interface{}, error)
GetDowntime returns staker's Downtime.
func (*PublicSfcAPI) GetOriginationScore ¶
func (s *PublicSfcAPI) GetOriginationScore(ctx context.Context, stakerID hexutil.Uint) (*hexutil.Big, error)
GetOriginationScore returns staker's OriginationScore.
func (*PublicSfcAPI) GetRewardWeights ¶
func (s *PublicSfcAPI) GetRewardWeights(ctx context.Context, stakerID hexutil.Uint) (map[string]interface{}, error)
GetRewardWeights returns staker's reward weights.
func (*PublicSfcAPI) GetStaker ¶
func (s *PublicSfcAPI) GetStaker(ctx context.Context, stakerID hexutil.Uint, verbosity hexutil.Uint64) (map[string]interface{}, error)
GetStaker returns SFC staker's info Verbosity. Number. If >= 1, then include base field. If >= 2, then include metrics.
func (*PublicSfcAPI) GetStakerByAddress ¶
func (s *PublicSfcAPI) GetStakerByAddress(ctx context.Context, address common.Address, verbosity hexutil.Uint64) (map[string]interface{}, error)
GetStakerByAddress returns SFC staker's info by address Verbosity. Number. If 0, then include only stakerID. If >= 1, then include base field. If >= 2, then include metrics.
func (*PublicSfcAPI) GetStakerClaimedRewards ¶
func (s *PublicSfcAPI) GetStakerClaimedRewards(ctx context.Context, stakerID hexutil.Uint64) (*hexutil.Big, error)
GetStakerClaimedRewards returns sum of claimed rewards in past, by this staker
func (*PublicSfcAPI) GetStakerDelegationsClaimedRewards ¶
func (s *PublicSfcAPI) GetStakerDelegationsClaimedRewards(ctx context.Context, stakerID hexutil.Uint64) (*hexutil.Big, error)
GetStakerDelegationsClaimedRewards returns sum of claimed rewards in past, by this delegations of this staker
func (*PublicSfcAPI) GetStakerPoI ¶
func (s *PublicSfcAPI) GetStakerPoI(ctx context.Context, stakerID hexutil.Uint) (*hexutil.Big, error)
GetStakerPoI returns staker's PoI.
func (*PublicSfcAPI) GetStakers ¶
func (s *PublicSfcAPI) GetStakers(ctx context.Context, verbosity hexutil.Uint64) ([]interface{}, error)
GetStakers returns SFC stakers info Verbosity. Number. If 0, then include only stakerIDs. If >= 1, then include base field. If >= 2, then include metrics (including downtime if validator).
func (*PublicSfcAPI) GetValidationScore ¶
func (s *PublicSfcAPI) GetValidationScore(ctx context.Context, stakerID hexutil.Uint) (*hexutil.Big, error)
GetValidationScore returns staker's ValidationScore.
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) FillTransaction ¶
func (s *PublicTransactionPoolAPI) FillTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error)
FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields) on a given unsigned transaction, and returns it to the caller for further processing (signing + broadcast).
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) *RPCTransaction
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) *RPCTransaction
GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.
func (*PublicTransactionPoolAPI) GetTransactionByHash ¶
func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
GetTransactionByHash returns the transaction for the given hash
func (*PublicTransactionPoolAPI) GetTransactionCount ¶
func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*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) PendingTransactions ¶
func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error)
PendingTransactions returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.
func (*PublicTransactionPoolAPI) Resend ¶
func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error)
Resend accepts an existing transaction and a new gas price and limit. It will remove the given transaction from the pool and reinsert it with the new gas price and limit.
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) SendTransaction ¶
func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args TransactionArgs) (common.Hash, error)
SendTransaction creates a transaction for the given argument, sign it and submit it to the transaction pool.
func (*PublicTransactionPoolAPI) Sign ¶
func (s *PublicTransactionPoolAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error)
Sign calculates an ECDSA signature for: keccack256("\x19Ethereum Signed Message:\n" + len(message) + message).
Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons.
The account associated with addr must be unlocked.
func (*PublicTransactionPoolAPI) SignTransaction ¶
func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error)
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.
type PublicTxPoolAPI ¶
type PublicTxPoolAPI struct {
// contains filtered or unexported fields
}
PublicTxPoolAPI offers and API for the transaction pool. It only operates on data that is non confidential.
func NewPublicTxPoolAPI ¶
func NewPublicTxPoolAPI(b Backend) *PublicTxPoolAPI
NewPublicTxPoolAPI creates a new tx pool service that gives information about the transaction pool.
func (*PublicTxPoolAPI) Content ¶
func (s *PublicTxPoolAPI) Content() map[string]map[string]map[string]*RPCTransaction
Content returns the transactions contained within the transaction pool.
func (*PublicTxPoolAPI) ContentFrom ¶ added in v1.0.2
func (s *PublicTxPoolAPI) ContentFrom(addr common.Address) map[string]map[string]*RPCTransaction
ContentFrom returns the transactions contained within the transaction pool.
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"` GasFeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"` GasTipCap *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"` 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"` Type hexutil.Uint64 `json:"type"` Accesses *types.AccessList `json:"accessList,omitempty"` ChainID *hexutil.Big `json:"chainId,omitempty"` 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 RawWallet ¶
type RawWallet struct { URL string `json:"url"` Status string `json:"status"` Failure string `json:"failure,omitempty"` Accounts []accounts.Account `json:"accounts,omitempty"` }
RawWallet is a JSON representation of an accounts.Wallet interface, with its data contents extracted into plain fields.
type SignTransactionResult ¶
type SignTransactionResult struct { Raw hexutil.Bytes `json:"raw"` Tx *types.Transaction `json:"tx"` }
SignTransactionResult represents a RLP encoded signed transaction.
type StateOverride ¶
type StateOverride map[common.Address]OverrideAccount
StateOverride is the collection of overridden accounts.
type StorageResult ¶
type StorageResult struct { Key string `json:"key"` Value *hexutil.Big `json:"value"` Proof []string `json:"proof"` }
StorageResult is result struct for GetProof
type StructLogRes ¶
type StructLogRes struct { Pc uint64 `json:"pc"` Op string `json:"op"` Gas uint64 `json:"gas"` GasCost uint64 `json:"gasCost"` Depth int `json:"depth"` Error string `json:"error,omitempty"` Stack *[]string `json:"stack,omitempty"` Memory *[]string `json:"memory,omitempty"` Storage *map[string]string `json:"storage,omitempty"` }
StructLogRes stores a structured log emitted by the EVM while replaying a transaction in debug mode
func FormatLogs ¶
func FormatLogs(logs []vm.StructLog) []StructLogRes
FormatLogs formats EVM returned structured logs for json output
type TransactionArgs ¶ added in v1.0.2
type TransactionArgs struct { From *common.Address `json:"from"` To *common.Address `json:"to"` Gas *hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` 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. // Issue detail: https://github.com/ethereum/go-ethereum/issues/15628 Data *hexutil.Bytes `json:"data"` Input *hexutil.Bytes `json:"input"` // Introduced by AccessListTxType transaction. AccessList *types.AccessList `json:"accessList,omitempty"` ChainID *hexutil.Big `json:"chainId,omitempty"` }
TransactionArgs represents the arguments to construct a new transaction or a message call.
func (*TransactionArgs) ToMessage ¶ added in v1.0.2
func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (types.Message, error)
ToMessage converts the transaction arguments to the Message type used by the core evm. This method is used in calls and traces that do not require a real live transaction.
func (*TransactionArgs) ToTransaction ¶ added in v1.0.2
func (args *TransactionArgs) ToTransaction() *types.Transaction
ToTransaction converts the arguments to a transaction. This assumes that setDefaults has been called.