Documentation
¶
Overview ¶
Package httpclient provides an HTTP client to interact with the VeChainThor blockchain. It offers various methods to retrieve accounts, transactions, blocks, events, and other blockchain data through HTTP requests.
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) FilterEvents(req *api.EventFilter) ([]api.FilteredEvent, error)
- func (c *Client) FilterTransfers(req *api.TransferFilter) ([]*api.FilteredTransfer, error)
- func (c *Client) GetAccount(addr *thor.Address, revision string) (*api.Account, error)
- func (c *Client) GetAccountCode(addr *thor.Address, revision string) (*api.GetCodeResult, error)
- func (c *Client) GetAccountStorage(addr *thor.Address, key *thor.Bytes32, revision string) (*api.GetStorageResult, error)
- func (c *Client) GetBlock(blockID string) (*api.JSONCollapsedBlock, error)
- func (c *Client) GetExpandedBlock(revision string) (*api.JSONExpandedBlock, error)
- func (c *Client) GetFeesHistory(blockCount uint32, newestBlock string, rewardPercentiles []float64) (*api.FeesHistory, error)
- func (c *Client) GetFeesPriority() (*api.FeesPriority, error)
- func (c *Client) GetPeers() ([]*api.PeerStats, error)
- func (c *Client) GetRawTransaction(txID *thor.Bytes32, head string, isPending bool) (*api.RawTransaction, error)
- func (c *Client) GetTransaction(txID *thor.Bytes32, head string, isPending bool) (*transactions.Transaction, error)
- func (c *Client) GetTransactionReceipt(txID *thor.Bytes32, head string) (*api.Receipt, error)
- func (c *Client) GetTxPool(expanded bool, origin *thor.Address) (any, error)
- func (c *Client) GetTxPoolStatus() (*api.Status, error)
- func (c *Client) InspectClauses(calldata *api.BatchCallData, revision string) ([]*api.CallResult, error)
- func (c *Client) RawHTTPGet(url string) ([]byte, int, error)
- func (c *Client) RawHTTPPost(url string, calldata any) ([]byte, int, error)
- func (c *Client) SendTransaction(obj *api.RawTx) (*api.SendTxResult, error)
Constants ¶
const ( BestRevision = "best" FinalizedRevision = "finalized" )
Variables ¶
var ( ErrNotFound = errors.New("not found") ErrNot200Status = errors.New("not 200 status code") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the HTTP client for interacting with the VeChainThor blockchain. It manages communication via HTTP requests.
func (*Client) FilterEvents ¶
func (c *Client) FilterEvents(req *api.EventFilter) ([]api.FilteredEvent, error)
FilterEvents filters events based on the provided event filter.
func (*Client) FilterTransfers ¶
func (c *Client) FilterTransfers(req *api.TransferFilter) ([]*api.FilteredTransfer, error)
FilterTransfers filters transfer based on the provided transfer filter.
func (*Client) GetAccount ¶
GetAccount retrieves the account details for the given address at the specified revision.
func (*Client) GetAccountCode ¶
GetAccountCode retrieves the contract code for the given address at the specified revision.
func (*Client) GetAccountStorage ¶
func (c *Client) GetAccountStorage(addr *thor.Address, key *thor.Bytes32, revision string) (*api.GetStorageResult, error)
GetAccountStorage retrieves the storage value for the given address and key at the specified revision.
func (*Client) GetBlock ¶
func (c *Client) GetBlock(blockID string) (*api.JSONCollapsedBlock, error)
GetBlock retrieves a block by its block ID.
func (*Client) GetExpandedBlock ¶
func (c *Client) GetExpandedBlock(revision string) (*api.JSONExpandedBlock, error)
GetExpandedBlock retrieves an expanded block by its revision.
func (*Client) GetFeesHistory ¶ added in v2.3.0
func (c *Client) GetFeesHistory(blockCount uint32, newestBlock string, rewardPercentiles []float64) (*api.FeesHistory, error)
GetFeesHistory retrieves the fees history based on the block count and newest block.
func (*Client) GetFeesPriority ¶ added in v2.3.0
func (c *Client) GetFeesPriority() (*api.FeesPriority, error)
GetFeesPriority retrieves the suggested maxPriorityFeePerGas for a transaction to be included in the next blocks.
func (*Client) GetRawTransaction ¶
func (c *Client) GetRawTransaction(txID *thor.Bytes32, head string, isPending bool) (*api.RawTransaction, error)
GetRawTransaction retrieves the raw transaction data by the transaction ID, along with options for head and pending status.
func (*Client) GetTransaction ¶
func (c *Client) GetTransaction(txID *thor.Bytes32, head string, isPending bool) (*transactions.Transaction, error)
GetTransaction retrieves the transaction details by the transaction ID, along with options for head and pending status.
func (*Client) GetTransactionReceipt ¶
GetTransactionReceipt retrieves the receipt for the given transaction ID at the specified head.
func (*Client) GetTxPool ¶ added in v2.3.2
GetTxPool retrieves transactions from the transaction pool.
func (*Client) GetTxPoolStatus ¶ added in v2.3.2
GetTxPoolStatus retrieves the current status of the transaction pool.
func (*Client) InspectClauses ¶
func (c *Client) InspectClauses(calldata *api.BatchCallData, revision string) ([]*api.CallResult, error)
InspectClauses performs a clause inspection on batch call data at the specified revision.
func (*Client) RawHTTPGet ¶
RawHTTPGet sends a raw HTTP GET request to the specified URL.
func (*Client) RawHTTPPost ¶
RawHTTPPost sends a raw HTTP POST request to the specified URL with the provided data.
func (*Client) SendTransaction ¶
SendTransaction sends a raw transaction to the blockchain.