rpcapi

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecAuthRPC

func ExecAuthRPC[R any](ctx context.Context, w *services.Services, cfg *AuthExecCfg, method string, args ...any) (*R, error)

func RPCMarshalHeader added in v0.26.0

func RPCMarshalHeader(head *types.Header) map[string]interface{}

RPCMarshalHeader converts the given header to the RPC output . duplicated from go-ethereum

func SafeGenericToString added in v0.28.0

func SafeGenericToString[R any](r *R) string

func SendRawTx added in v1.3.0

func SendRawTx(ctx context.Context, w *services.Services, input hexutil.Bytes) (gethcommon.Hash, error)

func UnauthenticatedTenRPCCall

func UnauthenticatedTenRPCCall[R any](ctx context.Context, w *services.Services, cfg *cache.Cfg, method string, args ...any) (*R, error)

Types

type AccountResult

type AccountResult struct {
	Address      gethcommon.Address `json:"address"`
	AccountProof []string           `json:"accountProof"`
	Balance      *hexutil.Big       `json:"balance"`
	CodeHash     gethcommon.Hash    `json:"codeHash"`
	Nonce        hexutil.Uint64     `json:"nonce"`
	StorageHash  gethcommon.Hash    `json:"storageHash"`
	StorageProof []StorageResult    `json:"storageProof"`
}

Result structs for GetProof

type AuthExecCfg added in v1.0.0

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

type BlockChainAPI

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

func NewBlockChainAPI

func NewBlockChainAPI(we *services.Services) *BlockChainAPI

func (*BlockChainAPI) BlockNumber

func (api *BlockChainAPI) BlockNumber() hexutil.Uint64

func (*BlockChainAPI) Call

func (api *BlockChainAPI) Call(ctx context.Context, args gethapi.TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, blockOverrides *BlockOverrides) (hexutil.Bytes, error)

func (*BlockChainAPI) ChainId

func (api *BlockChainAPI) ChainId() *hexutil.Big

func (*BlockChainAPI) CreateAccessList

func (api *BlockChainAPI) CreateAccessList(ctx context.Context, args gethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (*accessListResult, error)

func (*BlockChainAPI) EstimateGas

func (api *BlockChainAPI) EstimateGas(ctx context.Context, args gethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Uint64, error)

func (*BlockChainAPI) GetBalance

func (api *BlockChainAPI) GetBalance(ctx context.Context, address gethcommon.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error)

func (*BlockChainAPI) GetBlockByHash

func (api *BlockChainAPI) GetBlockByHash(ctx context.Context, hash gethcommon.Hash, fullTx bool) (map[string]interface{}, error)

func (*BlockChainAPI) GetBlockByNumber

func (api *BlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)

func (*BlockChainAPI) GetBlockReceipts

func (api *BlockChainAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]map[string]interface{}, error)

func (*BlockChainAPI) GetCode

func (api *BlockChainAPI) GetCode(ctx context.Context, address gethcommon.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

func (*BlockChainAPI) GetHeaderByHash

func (api *BlockChainAPI) GetHeaderByHash(ctx context.Context, hash gethcommon.Hash) map[string]interface{}

func (*BlockChainAPI) GetHeaderByNumber

func (api *BlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)

func (*BlockChainAPI) GetProof

func (api *BlockChainAPI) GetProof(ctx context.Context, address gethcommon.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash) (*AccountResult, error)

func (*BlockChainAPI) GetStorageAt

func (api *BlockChainAPI) GetStorageAt(ctx context.Context, address gethcommon.Address, params string, _ rpc.BlockNumberOrHash) (hexutil.Bytes, error)

GetStorageAt - This method signature matches eth_getStorageAt, but we use the address field to specify the custom query method, the hex-encoded position field to specify the parameters json, and nil for the block number.

type BlockOverrides

type BlockOverrides struct {
	Number     *hexutil.Big
	Difficulty *hexutil.Big
	Time       *hexutil.Uint64
	GasLimit   *hexutil.Uint64
	Coinbase   *gethcommon.Address
	Random     *gethcommon.Hash
	BaseFee    *hexutil.Big
}

type CircularBuffer

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

CircularBuffer is a data structure that uses a single, fixed-size buffer as if it was connected end-to-end.

func NewCircularBuffer

func NewCircularBuffer(size int) *CircularBuffer

NewCircularBuffer initializes a new CircularBuffer of the given size.

func (*CircularBuffer) Contains

func (cb *CircularBuffer) Contains(key LogKey) bool

Contains checks if the given LogKey exists in the buffer

func (*CircularBuffer) Push

func (cb *CircularBuffer) Push(key LogKey)

Push adds a new LogKey to the end of the buffer. If the buffer is full, it overwrites the oldest data with the new LogKey.

type ConfigResponseJson added in v0.27.0

type ConfigResponseJson struct {
	NetworkConfigAddress            string            `json:"NetworkConfig"`
	EnclaveRegistryAddress          string            `json:"EnclaveRegistry"`
	DataAvailabilityRegistryAddress string            `json:"DataAvailabilityRegistry"`
	CrossChainAddress               string            `json:"CrossChain"`
	L1MessageBusAddress             string            `json:"L1MessageBus"`
	L2MessageBusAddress             string            `json:"L2MessageBus"`
	TransactionPostProcessorAddress string            `json:"TransactionsPostProcessor"`
	L1Bridge                        string            `json:"L1Bridge"`
	L2Bridge                        string            `json:"L2Bridge"`
	L1CrossChainMessenger           string            `json:"L1CrossChainMessenger"`
	L2CrossChainMessenger           string            `json:"L2CrossChainMessenger"`
	SystemContractsUpgrader         string            `json:"SystemContractsUpgrader"`
	L1StartHash                     string            `json:"L1StartHash"`
	PublicSystemContracts           map[string]string `json:"PublicSystemContracts"`
	AdditionalContracts             interface{}       `json:"AdditionalContracts"`
}

type CrossChainProof added in v1.0.0

type CrossChainProof struct {
	Proof []byte
	Root  gethcommon.Hash
}

type DebugAPI

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

func NewDebugAPI

func NewDebugAPI(we *services.Services) *DebugAPI

func (*DebugAPI) ChaindbCompact

func (api *DebugAPI) ChaindbCompact() error

func (*DebugAPI) ChaindbProperty

func (api *DebugAPI) ChaindbProperty(property string) (string, error)

func (*DebugAPI) EventLogRelevancy

func (api *DebugAPI) EventLogRelevancy(ctx context.Context, crit common.FilterCriteria) ([]*common.DebugLogVisibility, error)

EventLogRelevancy - specific to TEN the FilterCriteria must have a single contract address and only the topics on the position 0 ( event signatures) the caller must be the contract deployer Intended for debug purposes for the owner of a contract. It doesn't reveal any user information.

func (*DebugAPI) GetRawBlock

func (api *DebugAPI) GetRawBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

func (*DebugAPI) GetRawHeader

func (api *DebugAPI) GetRawHeader(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

func (*DebugAPI) GetRawReceipts

func (api *DebugAPI) GetRawReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]hexutil.Bytes, error)

func (*DebugAPI) GetRawTransaction

func (api *DebugAPI) GetRawTransaction(ctx context.Context, hash gethcommon.Hash) (hexutil.Bytes, error)

func (*DebugAPI) PrintBlock

func (api *DebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error)

func (*DebugAPI) SetHead

func (api *DebugAPI) SetHead(number hexutil.Uint64)

type EthereumAPI

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

func NewEthereumAPI

func NewEthereumAPI(we *services.Services,
) *EthereumAPI

func (*EthereumAPI) FeeHistory

func (api *EthereumAPI) FeeHistory(ctx context.Context, blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*FeeHistoryResult, error)

func (*EthereumAPI) GasPrice

func (api *EthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)

func (*EthereumAPI) MaxPriorityFeePerGas

func (api *EthereumAPI) MaxPriorityFeePerGas(ctx context.Context) (*hexutil.Big, error)

func (*EthereumAPI) Syncing

func (api *EthereumAPI) Syncing() (interface{}, error)

type FeeHistoryResult

type FeeHistoryResult struct {
	OldestBlock  *hexutil.Big     `json:"oldestBlock"`
	Reward       [][]*hexutil.Big `json:"reward,omitempty"`
	BaseFee      []*hexutil.Big   `json:"baseFeePerGas,omitempty"`
	GasUsedRatio []float64        `json:"gasUsedRatio"`
}

type FilterAPI

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

func NewFilterAPI

func NewFilterAPI(we *services.Services) *FilterAPI

func (*FilterAPI) GetFilterChanges

func (api *FilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error)

func (*FilterAPI) GetFilterLogs

func (api *FilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*types.Log, error)

func (*FilterAPI) GetLogs

func (api *FilterAPI) GetLogs(ctx context.Context, crit common.FilterCriteria) ([]*types.Log, error)

func (*FilterAPI) Logs

func (*FilterAPI) NewBlockFilter

func (api *FilterAPI) NewBlockFilter() rpc.ID

func (*FilterAPI) NewFilter

func (api *FilterAPI) NewFilter(crit common.FilterCriteria) (rpc.ID, error)

func (*FilterAPI) NewHeads

func (api *FilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error)

func (*FilterAPI) NewPendingTransactionFilter

func (api *FilterAPI) NewPendingTransactionFilter(_ *bool) rpc.ID

func (*FilterAPI) NewPendingTransactions

func (api *FilterAPI) NewPendingTransactions(ctx context.Context, fullTx *bool) (*rpc.Subscription, error)

func (*FilterAPI) UninstallFilter

func (api *FilterAPI) UninstallFilter(id rpc.ID) bool

type LogKey

type LogKey struct {
	BlockHash common.Hash // Not necessary, but can be helpful in edge case of block reorg.
	TxHash    common.Hash
	Index     uint
}

LogKey uniquely represents a log (consists of BlockHash, TxHash, and Index)

type NetAPI added in v0.24.2

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

func NewNetAPI added in v0.24.2

func NewNetAPI(we *services.Services) *NetAPI

func (*NetAPI) Config added in v0.27.0

func (api *NetAPI) Config(ctx context.Context) (*ConfigResponseJson, error)

func (*NetAPI) Version added in v0.24.2

func (api *NetAPI) Version(ctx context.Context) (*string, error)

type OverrideAccount

type OverrideAccount struct {
	Nonce     *hexutil.Uint64                      `json:"nonce"`
	Code      *hexutil.Bytes                       `json:"code"`
	Balance   **hexutil.Big                        `json:"balance"`
	State     *map[gethcommon.Hash]gethcommon.Hash `json:"state"`
	StateDiff *map[gethcommon.Hash]gethcommon.Hash `json:"stateDiff"`
}

type SessionKeyAPI added in v1.0.0

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

func NewSessionKeyAPI added in v1.0.0

func NewSessionKeyAPI(we *services.Services) *SessionKeyAPI

func (*SessionKeyAPI) Activate added in v1.0.0

func (api *SessionKeyAPI) Activate(ctx context.Context) (bool, error)

func (*SessionKeyAPI) Create added in v1.0.0

func (api *SessionKeyAPI) Create(ctx context.Context) (string, error)

Create - returns hex-encoded checksum address of the newly created SK

func (*SessionKeyAPI) Deactivate added in v1.0.0

func (api *SessionKeyAPI) Deactivate(ctx context.Context) (bool, error)

func (*SessionKeyAPI) Delete added in v1.0.0

func (api *SessionKeyAPI) Delete(ctx context.Context) (bool, error)

type SignTransactionResult

type SignTransactionResult struct {
	Raw hexutil.Bytes      `json:"raw"`
	Tx  *types.Transaction `json:"tx"`
}

type StateOverride

type StateOverride map[gethcommon.Address]OverrideAccount

type StorageResult

type StorageResult struct {
	Key   string       `json:"key"`
	Value *hexutil.Big `json:"value"`
	Proof []string     `json:"proof"`
}

type TenAPI added in v1.0.0

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

func NewTenAPI added in v1.0.0

func NewTenAPI(we *services.Services) *TenAPI

func (*TenAPI) GetCrossChainProof added in v1.0.0

func (api *TenAPI) GetCrossChainProof(ctx context.Context, messageType string, crossChainMessage gethcommon.Hash) (*CrossChainProof, error)

type TransactionAPI

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

func NewTransactionAPI

func NewTransactionAPI(we *services.Services) *TransactionAPI

func (*TransactionAPI) FillTransaction

func (*TransactionAPI) GetBlockTransactionCountByHash

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

func (*TransactionAPI) GetBlockTransactionCountByNumber

func (s *TransactionAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr gethrpc.BlockNumber) *hexutil.Uint

func (*TransactionAPI) GetRawTransactionByBlockHashAndIndex

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

func (*TransactionAPI) GetRawTransactionByBlockNumberAndIndex

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

func (*TransactionAPI) GetRawTransactionByHash

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

func (*TransactionAPI) GetTransactionByBlockHashAndIndex

func (s *TransactionAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *rpc.RpcTransaction

func (*TransactionAPI) GetTransactionByBlockNumberAndIndex

func (s *TransactionAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr gethrpc.BlockNumber, index hexutil.Uint) *rpc.RpcTransaction

func (*TransactionAPI) GetTransactionByHash

func (s *TransactionAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*rpc.RpcTransaction, error)

func (*TransactionAPI) GetTransactionCount

func (s *TransactionAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash gethrpc.BlockNumberOrHash) (*hexutil.Uint64, error)

func (*TransactionAPI) GetTransactionReceipt

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

func (*TransactionAPI) PendingTransactions

func (s *TransactionAPI) PendingTransactions() ([]*rpc.RpcTransaction, error)

func (*TransactionAPI) Resend

func (s *TransactionAPI) Resend(ctx context.Context, sendArgs gethapi.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error)

func (*TransactionAPI) SendRawTransaction

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

func (*TransactionAPI) SendTransaction

func (s *TransactionAPI) SendTransaction(ctx context.Context, args gethapi.TransactionArgs) (common.Hash, error)

type TxPoolAPI

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

func NewTxPoolAPI

func NewTxPoolAPI(we *services.Services) *TxPoolAPI

func (*TxPoolAPI) Content

func (s *TxPoolAPI) Content() map[string]map[string]map[string]*rpc2.RpcTransaction

func (*TxPoolAPI) ContentFrom

func (s *TxPoolAPI) ContentFrom(_ common.Address) map[string]map[string]*rpc2.RpcTransaction

func (*TxPoolAPI) Inspect

func (s *TxPoolAPI) Inspect() map[string]map[string]map[string]string

func (*TxPoolAPI) Status

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

type Web3API added in v0.24.2

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

func NewWeb3API added in v0.24.2

func NewWeb3API(we *services.Services) *Web3API

func (*Web3API) ClientVersion added in v0.24.2

func (api *Web3API) ClientVersion(_ context.Context) (*string, error)

Jump to

Keyboard shortcuts

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