rpcclient

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: ISC Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRPC = errors.New("rpc error")

ErrRPC is an error in the RPC protocol

Functions

This section is empty.

Types

type RPCClient

type RPCClient struct {
	*grpcclient.GRPCClient
	// contains filtered or unexported fields
}

RPCClient is an RPC client

func NewRPCClient

func NewRPCClient(rpcAddress string) (*RPCClient, error)

NewRPCClient сreates a new RPC client with a default call timeout value

func (*RPCClient) AddPeer

func (c *RPCClient) AddPeer(address string, isPermanent bool) error

AddPeer sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) Address

func (c *RPCClient) Address() string

Address returns the address the RPC client connected to

func (*RPCClient) Ban

Ban sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) Close

func (c *RPCClient) Close() error

Close closes the RPC client

func (*RPCClient) EstimateNetworkHashesPerSecond

func (c *RPCClient) EstimateNetworkHashesPerSecond(startHash string, windowSize uint32) (*appmessage.EstimateNetworkHashesPerSecondResponseMessage, error)

EstimateNetworkHashesPerSecond sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetBalanceByAddress

func (c *RPCClient) GetBalanceByAddress(address string) (*appmessage.GetBalanceByAddressResponseMessage, error)

GetBalanceByAddress sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetBalancesByAddresses

func (c *RPCClient) GetBalancesByAddresses(addresses []string) (*appmessage.GetBalancesByAddressesResponseMessage, error)

GetBalancesByAddresses sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetBlock

func (c *RPCClient) GetBlock(hash string, includeTransactions bool) (
	*appmessage.GetBlockResponseMessage, error)

GetBlock sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetBlockCount

func (c *RPCClient) GetBlockCount() (*appmessage.GetBlockCountResponseMessage, error)

GetBlockCount sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetBlockDAGInfo

func (c *RPCClient) GetBlockDAGInfo() (*appmessage.GetBlockDAGInfoResponseMessage, error)

GetBlockDAGInfo sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetBlockTemplate

func (c *RPCClient) GetBlockTemplate(miningAddress, extraData string) (*appmessage.GetBlockTemplateResponseMessage, error)

GetBlockTemplate sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetBlocks

func (c *RPCClient) GetBlocks(lowHash string, includeBlocks bool,
	includeTransactions bool) (*appmessage.GetBlocksResponseMessage, error)

GetBlocks sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetCoinSupply

func (c *RPCClient) GetCoinSupply() (*appmessage.GetCoinSupplyResponseMessage, error)

GetCoinSupply sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetConnectedPeerInfo

func (c *RPCClient) GetConnectedPeerInfo() (*appmessage.GetConnectedPeerInfoResponseMessage, error)

GetConnectedPeerInfo sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetHeaders

func (c *RPCClient) GetHeaders(startHash string, limit uint64, isAscending bool) (*appmessage.GetHeadersResponseMessage, error)

GetHeaders sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetInfo

GetInfo sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetMempoolEntries

func (c *RPCClient) GetMempoolEntries(includeOrphanPool bool, filterTransactionPool bool) (*appmessage.GetMempoolEntriesResponseMessage, error)

GetMempoolEntries sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetMempoolEntriesByAddresses

func (c *RPCClient) GetMempoolEntriesByAddresses(addresses []string, includeOrphanPool bool, filterTransactionPool bool) (*appmessage.GetMempoolEntriesByAddressesResponseMessage, error)

GetMempoolEntriesByAddresses sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetMempoolEntry

func (c *RPCClient) GetMempoolEntry(txID string, includeOrphanPool bool, filterTransactionPool bool) (*appmessage.GetMempoolEntryResponseMessage, error)

GetMempoolEntry sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetPeerAddresses

func (c *RPCClient) GetPeerAddresses() (*appmessage.GetPeerAddressesResponseMessage, error)

GetPeerAddresses sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetSelectedTipHash

func (c *RPCClient) GetSelectedTipHash() (*appmessage.GetSelectedTipHashResponseMessage, error)

GetSelectedTipHash sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetSubnetwork

func (c *RPCClient) GetSubnetwork(subnetworkID string) (*appmessage.GetSubnetworkResponseMessage, error)

GetSubnetwork sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetUTXOsByAddresses

func (c *RPCClient) GetUTXOsByAddresses(addresses []string) (*appmessage.GetUTXOsByAddressesResponseMessage, error)

GetUTXOsByAddresses sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetVirtualSelectedParentBlueScore

func (c *RPCClient) GetVirtualSelectedParentBlueScore() (*appmessage.GetVirtualSelectedParentBlueScoreResponseMessage, error)

GetVirtualSelectedParentBlueScore sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) GetVirtualSelectedParentChainFromBlock

func (c *RPCClient) GetVirtualSelectedParentChainFromBlock(startHash string, includeAcceptedTransactionIDs bool) (
	*appmessage.GetVirtualSelectedParentChainFromBlockResponseMessage, error)

GetVirtualSelectedParentChainFromBlock sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) Reconnect

func (c *RPCClient) Reconnect() error

Reconnect forces the client to attempt to reconnect to the address this client initially was connected to

func (*RPCClient) RegisterForBlockAddedNotifications

func (c *RPCClient) RegisterForBlockAddedNotifications(onBlockAdded func(notification *appmessage.BlockAddedNotificationMessage)) error

RegisterForBlockAddedNotifications sends an RPC request respective to the function's name and returns the RPC server's response. Additionally, it starts listening for the appropriate notification using the given handler function

func (*RPCClient) RegisterForFinalityConflictsNotifications

func (c *RPCClient) RegisterForFinalityConflictsNotifications(
	onFinalityConflict func(notification *appmessage.FinalityConflictNotificationMessage),
	onFinalityConflictResolved func(notification *appmessage.FinalityConflictResolvedNotificationMessage)) error

RegisterForFinalityConflictsNotifications sends an RPC request respective to the function's name and returns the RPC server's response. Additionally, it starts listening for the appropriate notification using the given handler function

func (*RPCClient) RegisterForNewBlockTemplateNotifications

func (c *RPCClient) RegisterForNewBlockTemplateNotifications(onNewBlockTemplate func(notification *appmessage.NewBlockTemplateNotificationMessage)) error

RegisterForNewBlockTemplateNotifications sends an RPC request respective to the function's name and returns the RPC server's response. Additionally, it starts listening for the appropriate notification using the given handler function

func (*RPCClient) RegisterForUTXOsChangedNotifications

func (c *RPCClient) RegisterForUTXOsChangedNotifications(addresses []string,
	onUTXOsChanged func(notification *appmessage.UTXOsChangedNotificationMessage)) error

RegisterForUTXOsChangedNotifications sends an RPC request respective to the function's name and returns the RPC server's response. Additionally, it starts listening for the appropriate notification using the given handler function

func (*RPCClient) RegisterForVirtualDaaScoreChangedNotifications

func (c *RPCClient) RegisterForVirtualDaaScoreChangedNotifications(
	onVirtualDaaScoreChanged func(notification *appmessage.VirtualDaaScoreChangedNotificationMessage)) error

RegisterForVirtualDaaScoreChangedNotifications sends an RPC request respective to the function's name and returns the RPC server's response. Additionally, it starts listening for the appropriate notification using the given handler function

func (*RPCClient) RegisterForVirtualSelectedParentBlueScoreChangedNotifications

func (c *RPCClient) RegisterForVirtualSelectedParentBlueScoreChangedNotifications(
	onVirtualSelectedParentBlueScoreChanged func(notification *appmessage.VirtualSelectedParentBlueScoreChangedNotificationMessage)) error

RegisterForVirtualSelectedParentBlueScoreChangedNotifications sends an RPC request respective to the function's name and returns the RPC server's response. Additionally, it starts listening for the appropriate notification using the given handler function

func (*RPCClient) RegisterForVirtualSelectedParentChainChangedNotifications

func (c *RPCClient) RegisterForVirtualSelectedParentChainChangedNotifications(includeAcceptedTransactionIDs bool,
	onChainChanged func(notification *appmessage.VirtualSelectedParentChainChangedNotificationMessage)) error

RegisterForVirtualSelectedParentChainChangedNotifications sends an RPC request respective to the function's name and returns the RPC server's response. Additionally, it starts listening for the appropriate notification using the given handler function

func (*RPCClient) RegisterPruningPointUTXOSetNotifications

func (c *RPCClient) RegisterPruningPointUTXOSetNotifications(onPruningPointUTXOSetNotifications func()) error

RegisterPruningPointUTXOSetNotifications sends an RPC request respective to the function's name and returns the RPC server's response. Additionally, it starts listening for the appropriate notification using the given handler function

func (*RPCClient) ResolveFinalityConflict

func (c *RPCClient) ResolveFinalityConflict(finalityBlockHash string) (*appmessage.ResolveFinalityConflictResponseMessage, error)

ResolveFinalityConflict sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) SetLogger

func (c *RPCClient) SetLogger(backend *logger.Backend, level logger.Level)

SetLogger uses a specified Logger to output package logging info

func (*RPCClient) SetTimeout

func (c *RPCClient) SetTimeout(timeout time.Duration)

SetTimeout sets the timeout by which to wait for RPC responses

func (*RPCClient) SubmitBlock

func (c *RPCClient) SubmitBlock(block *externalapi.DomainBlock) (appmessage.RejectReason, error)

SubmitBlock sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) SubmitBlockAlsoIfNonDAA

func (c *RPCClient) SubmitBlockAlsoIfNonDAA(block *externalapi.DomainBlock) (appmessage.RejectReason, error)

SubmitBlockAlsoIfNonDAA operates the same as SubmitBlock with the exception that `allowNonDAABlocks` is set to true

func (*RPCClient) SubmitTransaction

func (c *RPCClient) SubmitTransaction(transaction *appmessage.RPCTransaction, allowOrphan bool) (*appmessage.SubmitTransactionResponseMessage, error)

SubmitTransaction sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) Unban

Unban sends an RPC request respective to the function's name and returns the RPC server's response

func (*RPCClient) UnregisterPruningPointUTXOSetNotifications

func (c *RPCClient) UnregisterPruningPointUTXOSetNotifications() error

UnregisterPruningPointUTXOSetNotifications sends an RPC request respective to the function's name and returns the RPC server's response. Additionally, it stops listening for the appropriate notification using the given handler function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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