Documentation ¶
Index ¶
- func ExecAuthRPC[R any](ctx context.Context, w *Services, cfg *ExecCfg, method string, args ...any) (*R, error)
- func UnauthenticatedTenRPCCall[R any](ctx context.Context, w *Services, cfg *CacheCfg, method string, args ...any) (*R, error)
- type AccountResult
- type BlockChainAPI
- func (api *BlockChainAPI) BlockNumber() hexutil.Uint64
- func (api *BlockChainAPI) Call(ctx context.Context, args gethapi.TransactionArgs, ...) (hexutil.Bytes, error)
- func (api *BlockChainAPI) ChainId() *hexutil.Big
- func (s *BlockChainAPI) CreateAccessList(ctx context.Context, args gethapi.TransactionArgs, ...) (*accessListResult, error)
- func (api *BlockChainAPI) EstimateGas(ctx context.Context, args gethapi.TransactionArgs, ...) (hexutil.Uint64, error)
- func (api *BlockChainAPI) GetBalance(ctx context.Context, address gethcommon.Address, ...) (*hexutil.Big, error)
- func (api *BlockChainAPI) GetBlockByHash(ctx context.Context, hash gethcommon.Hash, fullTx bool) (map[string]interface{}, error)
- func (api *BlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (s *BlockChainAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]map[string]interface{}, error)
- func (api *BlockChainAPI) GetCode(ctx context.Context, address gethcommon.Address, ...) (hexutil.Bytes, error)
- func (api *BlockChainAPI) GetHeaderByHash(ctx context.Context, hash gethcommon.Hash) map[string]interface{}
- func (api *BlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)
- func (s *BlockChainAPI) GetProof(ctx context.Context, address gethcommon.Address, storageKeys []string, ...) (*AccountResult, error)
- func (api *BlockChainAPI) GetStorageAt(ctx context.Context, address gethcommon.Address, params string, ...) (hexutil.Bytes, error)
- type BlockOverrides
- type CacheCfg
- type CacheStrategy
- type CircularBuffer
- type DebugAPI
- func (api *DebugAPI) ChaindbCompact() error
- func (api *DebugAPI) ChaindbProperty(property string) (string, error)
- func (api *DebugAPI) EventLogRelevancy(_ context.Context, _ common.Hash) (interface{}, error)
- func (api *DebugAPI) GetRawBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
- func (api *DebugAPI) GetRawHeader(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
- func (api *DebugAPI) GetRawReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]hexutil.Bytes, error)
- func (s *DebugAPI) GetRawTransaction(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (api *DebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error)
- func (api *DebugAPI) SetHead(number hexutil.Uint64)
- type EthereumAPI
- func (api *EthereumAPI) FeeHistory(ctx context.Context, blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, ...) (*FeeHistoryResult, error)
- func (api *EthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)
- func (api *EthereumAPI) MaxPriorityFeePerGas(ctx context.Context) (*hexutil.Big, error)
- func (api *EthereumAPI) Syncing() (interface{}, error)
- type ExecCfg
- type FeeHistoryResult
- type FilterAPI
- func (api *FilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error)
- func (api *FilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*types.Log, error)
- func (api *FilterAPI) GetLogs(ctx context.Context, crit common.FilterCriteria) ([]*types.Log, error)
- func (api *FilterAPI) Logs(ctx context.Context, crit common.FilterCriteria) (*rpc.Subscription, error)
- func (api *FilterAPI) NewBlockFilter() rpc.ID
- func (api *FilterAPI) NewFilter(crit common.FilterCriteria) (rpc.ID, error)
- func (api *FilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error)
- func (api *FilterAPI) NewPendingTransactionFilter(_ *bool) rpc.ID
- func (api *FilterAPI) NewPendingTransactions(ctx context.Context, fullTx *bool) (*rpc.Subscription, error)
- func (api *FilterAPI) UninstallFilter(id rpc.ID) bool
- type GWAccount
- type GWUser
- type LogKey
- type NetAPI
- type NewHeadNotifier
- type OverrideAccount
- type Services
- func (w *Services) AddAddressToUser(userID []byte, address string, signature []byte, ...) error
- func (w *Services) DeleteUser(userID []byte) error
- func (w *Services) GenerateAndStoreNewUser() ([]byte, error)
- func (w *Services) GenerateUserMessageToSign(encryptionToken []byte, formatsSlice []string) (string, error)
- func (w *Services) GetTenNodeHealthStatus() (bool, error)
- func (w *Services) IsStopping() bool
- func (w *Services) Logger() gethlog.Logger
- func (w *Services) Stop()
- func (w *Services) UserExists(userID []byte) bool
- func (w *Services) UserHasAccount(userID []byte, address string) (bool, error)
- func (w *Services) Version() string
- type SignTransactionResult
- type StateOverride
- type StorageResult
- type TransactionAPI
- func (s *TransactionAPI) FillTransaction(ctx context.Context, args gethapi.TransactionArgs) (*SignTransactionResult, error)
- func (s *TransactionAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (s *TransactionAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr gethrpc.BlockNumber) *hexutil.Uint
- func (s *TransactionAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes
- func (s *TransactionAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr gethrpc.BlockNumber, index hexutil.Uint) hexutil.Bytes
- func (s *TransactionAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (s *TransactionAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *rpc.RpcTransaction
- func (s *TransactionAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr gethrpc.BlockNumber, index hexutil.Uint) *rpc.RpcTransaction
- func (s *TransactionAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*rpc.RpcTransaction, error)
- func (s *TransactionAPI) GetTransactionCount(ctx context.Context, address common.Address, ...) (*hexutil.Uint64, error)
- func (s *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
- func (s *TransactionAPI) PendingTransactions() ([]*rpc.RpcTransaction, error)
- func (s *TransactionAPI) Resend(ctx context.Context, sendArgs gethapi.TransactionArgs, gasPrice *hexutil.Big, ...) (common.Hash, error)
- func (s *TransactionAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (common.Hash, error)
- func (s *TransactionAPI) SendTransaction(ctx context.Context, args gethapi.TransactionArgs) (common.Hash, error)
- type TxPoolAPI
- type Web3API
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecAuthRPC ¶
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 BlockChainAPI ¶
type BlockChainAPI struct {
// contains filtered or unexported fields
}
func NewBlockChainAPI ¶
func NewBlockChainAPI(we *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 (s *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 (s *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 (s *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 is not compatible with ETH RPC tooling. Ten network does not getStorageAt because it would violate the privacy guarantees of the network.
However, we can repurpose this method to be able to route Ten-specific requests through from an ETH RPC client. We call these requests Custom Queries.
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.
In future, we can support both CustomQueries and some debug version of eth_getStorageAt if needed.
type BlockOverrides ¶
type CacheCfg ¶
type CacheCfg struct { CacheType CacheStrategy CacheTypeDynamic func() CacheStrategy }
type CacheStrategy ¶
type CacheStrategy uint8
const ( NoCache CacheStrategy = iota LatestBatch CacheStrategy = iota LongLiving CacheStrategy = iota )
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 DebugAPI ¶
type DebugAPI struct {
// contains filtered or unexported fields
}
func NewDebugAPI ¶
func (*DebugAPI) ChaindbCompact ¶
func (*DebugAPI) ChaindbProperty ¶
func (*DebugAPI) EventLogRelevancy ¶
EventLogRelevancy - specific to Ten - todo
func (*DebugAPI) GetRawBlock ¶
func (*DebugAPI) GetRawHeader ¶
func (*DebugAPI) GetRawReceipts ¶
func (*DebugAPI) GetRawTransaction ¶
func (*DebugAPI) PrintBlock ¶
type EthereumAPI ¶
type EthereumAPI struct {
// contains filtered or unexported fields
}
func NewEthereumAPI ¶
func NewEthereumAPI(we *Services, ) *EthereumAPI
func (*EthereumAPI) FeeHistory ¶
func (api *EthereumAPI) FeeHistory(ctx context.Context, blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*FeeHistoryResult, error)
func (*EthereumAPI) MaxPriorityFeePerGas ¶
func (*EthereumAPI) Syncing ¶
func (api *EthereumAPI) Syncing() (interface{}, error)
type FeeHistoryResult ¶
type FilterAPI ¶
type FilterAPI struct {
// contains filtered or unexported fields
}
func NewFilterAPI ¶
func (*FilterAPI) GetFilterChanges ¶
func (*FilterAPI) GetFilterLogs ¶
func (*FilterAPI) Logs ¶
func (api *FilterAPI) Logs(ctx context.Context, crit common.FilterCriteria) (*rpc.Subscription, error)
func (*FilterAPI) NewBlockFilter ¶
func (*FilterAPI) NewPendingTransactionFilter ¶
func (*FilterAPI) NewPendingTransactions ¶
type GWUser ¶
type GWUser struct {
// contains filtered or unexported fields
}
func (GWUser) GetAllAddresses ¶
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 NewHeadNotifier ¶
type NewHeadNotifier interface {
// contains filtered or unexported methods
}
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 Services ¶
type Services struct { HostAddrHTTP string // The HTTP address on which the Ten host can be reached HostAddrWS string // The WS address on which the Ten host can be reached Storage storage.Storage FileLogger gethlog.Logger Cache cache.Cache Config *common.Config NewHeadsService *subscriptioncommon.NewHeadsService // contains filtered or unexported fields }
Services handles the various business logic for the api endpoints
func NewServices ¶
func (*Services) AddAddressToUser ¶
func (w *Services) AddAddressToUser(userID []byte, address string, signature []byte, signatureType viewingkey.SignatureType) error
AddAddressToUser checks if a message is in correct format and if signature is valid. If all checks pass we save address and signature against userID
func (*Services) DeleteUser ¶
DeleteUser deletes user and accounts associated with user from the database for given userID
func (*Services) GenerateAndStoreNewUser ¶
GenerateAndStoreNewUser generates new key-pair and userID, stores it in the database and returns hex encoded userID and error
func (*Services) GenerateUserMessageToSign ¶
func (*Services) GetTenNodeHealthStatus ¶
func (*Services) IsStopping ¶
IsStopping returns whether the WE is stopping
func (*Services) UserExists ¶
func (*Services) UserHasAccount ¶
UserHasAccount checks if provided account exist in the database for given userID
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 TransactionAPI ¶
type TransactionAPI struct {
// contains filtered or unexported fields
}
func NewTransactionAPI ¶
func NewTransactionAPI(we *Services) *TransactionAPI
func (*TransactionAPI) FillTransaction ¶
func (s *TransactionAPI) FillTransaction(ctx context.Context, args gethapi.TransactionArgs) (*SignTransactionResult, error)
func (*TransactionAPI) GetBlockTransactionCountByHash ¶
func (*TransactionAPI) GetBlockTransactionCountByNumber ¶
func (s *TransactionAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr gethrpc.BlockNumber) *hexutil.Uint
func (*TransactionAPI) GetRawTransactionByBlockHashAndIndex ¶
func (*TransactionAPI) GetRawTransactionByBlockNumberAndIndex ¶
func (s *TransactionAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr gethrpc.BlockNumber, index hexutil.Uint) hexutil.Bytes
func (*TransactionAPI) GetRawTransactionByHash ¶
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 (*TransactionAPI) PendingTransactions ¶
func (s *TransactionAPI) PendingTransactions() ([]*rpc.RpcTransaction, error)
func (*TransactionAPI) SendRawTransaction ¶
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
}