obsclient

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

README

This package is analogous to the ethclient package in go-ethereum.

It provides a higher level, standard way to interact with an Ten network programmatically.

It aims to provide all the same methods that the geth ethclient provides for compatibility/familiarity, as well as ten-specific methods.

There are two clients, ObsClient and AuthObsClient

ObsClient just requires a Client and provides access to general Ten functionality that doesn't require viewing keys.

AuthObsClient requires a EncRPCClient, which is an RPC client with an account and a signed Viewing Key for authentication. It provides full Ten functionality, authenticating with the node and encrypting/decrypting sensitive requests.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToCallArg

func ToCallArg(msg ethereum.CallMsg) interface{}

Types

type AuthObsClient

type AuthObsClient struct {
	ObsClient
	// contains filtered or unexported fields
}

AuthObsClient extends the functionality of the ObsClient for all methods that require encryption when communicating with the enclave It is created with an EncRPCClient rather than basic RPC client so encryption/decryption is supported

The methods in this client are analogous to the methods in geth's EthClient and should behave the same unless noted otherwise.

func DialWithAuth

func DialWithAuth(rpcurl string, wal wallet.Wallet, logger gethlog.Logger) (*AuthObsClient, error)

DialWithAuth will generate and sign a viewing key for given wallet, then initiate a connection with the RPC node and

register the viewing key

func NewAuthObsClient

func NewAuthObsClient(client *rpc.EncRPCClient) *AuthObsClient

NewAuthObsClient constructs an AuthObsClient for sensitive communication with an enclave.

It requires an EncRPCClient specifically even though the AuthObsClient uses a Client interface in its struct because the Client interface makes testing easy but an EncRPCClient is required for the actual encrypted communication

func (*AuthObsClient) Address

func (ac *AuthObsClient) Address() gethcommon.Address

func (*AuthObsClient) BalanceAt

func (ac *AuthObsClient) BalanceAt(ctx context.Context, blockNumber *big.Int) (*big.Int, error)

BalanceAt retrieves the native balance for the account registered on this client (due to obscuro privacy restrictions, balance cannot be requested for other accounts)

func (*AuthObsClient) CallContract

func (ac *AuthObsClient) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*AuthObsClient) EstimateGas

func (ac *AuthObsClient) EstimateGas(ctx context.Context, msg *ethereum.CallMsg) (uint64, error)

func (*AuthObsClient) EstimateGasAndGasPrice

func (ac *AuthObsClient) EstimateGasAndGasPrice(txData types.TxData) types.TxData

func (*AuthObsClient) GasPrice added in v0.21.0

func (ac *AuthObsClient) GasPrice(ctx context.Context) (*big.Int, error)

func (*AuthObsClient) GetLogs

func (ac *AuthObsClient) GetLogs(ctx context.Context, filterCriteria common.FilterCriteriaJSON) ([]*types.Log, error)

func (*AuthObsClient) GetReceiptsByAddress

func (ac *AuthObsClient) GetReceiptsByAddress(ctx context.Context, address *gethcommon.Address) (types.Receipts, error)

GetReceiptsByAddress retrieves the receipts for the account registered on this client (due to obscuro privacy restrictions, balance cannot be requested for other accounts)

func (*AuthObsClient) NonceAt

func (ac *AuthObsClient) NonceAt(ctx context.Context, blockNumber *big.Int) (uint64, error)

NonceAt retrieves the nonce for the account registered on this client (due to obscuro privacy restrictions, nonce cannot be requested for other accounts)

func (*AuthObsClient) SendTransaction

func (ac *AuthObsClient) SendTransaction(ctx context.Context, signedTx *types.Transaction) error

func (*AuthObsClient) SubscribeFilterLogs

func (ac *AuthObsClient) SubscribeFilterLogs(ctx context.Context, filterCriteria filters.FilterCriteria, ch chan common.IDAndLog) (ethereum.Subscription, error)

func (*AuthObsClient) TransactionByHash

func (ac *AuthObsClient) TransactionByHash(ctx context.Context, hash gethcommon.Hash) (*types.Transaction, bool, error)

TransactionByHash returns transaction (if found), isPending (always false currently as we don't search the mempool), error

func (*AuthObsClient) TransactionReceipt

func (ac *AuthObsClient) TransactionReceipt(ctx context.Context, txHash gethcommon.Hash) (*types.Receipt, error)

type ObsClient

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

ObsClient provides access to general Obscuro functionality that doesn't require viewing keys.

The methods in this client are analogous to the methods in geth's EthClient and should behave the same unless noted otherwise.

func Dial

func Dial(rawurl string) (*ObsClient, error)

func NewObsClient

func NewObsClient(c rpc.Client) *ObsClient

func (*ObsClient) BatchByHash

func (oc *ObsClient) BatchByHash(hash gethcommon.Hash) (*common.ExtBatch, error)

BatchByHash returns the batch with the given hash.

func (*ObsClient) BatchHeaderByHash

func (oc *ObsClient) BatchHeaderByHash(hash gethcommon.Hash) (*common.BatchHeader, error)

BatchHeaderByHash returns the block header with the given hash.

func (*ObsClient) BatchHeaderByNumber

func (oc *ObsClient) BatchHeaderByNumber(number *big.Int) (*common.BatchHeader, error)

BatchHeaderByNumber returns the header of the rollup with the given number

func (*ObsClient) BatchNumber

func (oc *ObsClient) BatchNumber() (uint64, error)

BatchNumber returns the height of the head rollup

func (*ObsClient) ChainID

func (oc *ObsClient) ChainID() (*big.Int, error)

ChainID retrieves the current chain ID for transaction replay protection.

func (*ObsClient) Close

func (oc *ObsClient) Close()

func (*ObsClient) GetBatchesListing

func (oc *ObsClient) GetBatchesListing(pagination *common.QueryPagination) (*common.BatchListingResponse, error)

GetBatchesListing returns a list of batches

func (*ObsClient) GetBlockListing

func (oc *ObsClient) GetBlockListing(pagination *common.QueryPagination) (*common.BlockListingResponse, error)

GetBlockListing returns a list of block headers

func (*ObsClient) GetConfig

func (oc *ObsClient) GetConfig() (*common.ObscuroNetworkInfo, error)

GetConfig returns the network config for obscuro

func (*ObsClient) GetLatestRollupHeader

func (oc *ObsClient) GetLatestRollupHeader() (*common.RollupHeader, error)

GetLatestRollupHeader returns the header of the rollup at tip

func (*ObsClient) GetPublicTxListing

func (oc *ObsClient) GetPublicTxListing(pagination *common.QueryPagination) (*common.TransactionListingResponse, error)

GetPublicTxListing returns a list of public transactions

func (*ObsClient) GetTotalContractCount

func (oc *ObsClient) GetTotalContractCount() (int, error)

GetTotalContractCount returns the total count of created contracts

func (*ObsClient) GetTotalTransactionCount

func (oc *ObsClient) GetTotalTransactionCount() (int, error)

GetTotalTransactionCount returns the total count of executed transactions

func (*ObsClient) Health

func (oc *ObsClient) Health() (bool, error)

Health returns the health of the node.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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