httpclient

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: LGPL-3.0 Imports: 13 Imported by: 0

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

This section is empty.

Variables

This section is empty.

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 New

func New(url string) *Client

New creates a new Client with the provided URL.

func NewWithHTTP

func NewWithHTTP(url string, c *http.Client) *Client

func (*Client) FilterEvents

func (c *Client) FilterEvents(req *events.EventFilter) ([]events.FilteredEvent, error)

FilterEvents filters events based on the provided event filter.

func (*Client) FilterTransfers

func (c *Client) FilterTransfers(req *transfers.TransferFilter) ([]*transfers.FilteredTransfer, error)

FilterTransfers filters transfer based on the provided transfer filter.

func (*Client) GetAccount

func (c *Client) GetAccount(addr *thor.Address, revision string) (*accounts.Account, error)

GetAccount retrieves the account details for the given address at the specified revision.

func (*Client) GetAccountCode

func (c *Client) GetAccountCode(addr *thor.Address, revision string) (*accounts.GetCodeResult, error)

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) (*accounts.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) (*blocks.JSONCollapsedBlock, error)

GetBlock retrieves a block by its block ID.

func (*Client) GetExpandedBlock

func (c *Client) GetExpandedBlock(revision string) (*blocks.JSONExpandedBlock, error)

GetExpandedBlock retrieves an expanded block by its revision.

func (*Client) GetPeers

func (c *Client) GetPeers() ([]*node.PeerStats, error)

GetPeers retrieves the network peers connected to the node.

func (*Client) GetRawTransaction

func (c *Client) GetRawTransaction(txID *thor.Bytes32, head string, isPending bool) (*transactions.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

func (c *Client) GetTransactionReceipt(txID *thor.Bytes32, head string) (*transactions.Receipt, error)

GetTransactionReceipt retrieves the receipt for the given transaction ID at the specified head.

func (*Client) InspectClauses

func (c *Client) InspectClauses(calldata *accounts.BatchCallData, revision string) ([]*accounts.CallResult, error)

InspectClauses performs a clause inspection on batch call data at the specified revision.

func (*Client) RawHTTPGet

func (c *Client) RawHTTPGet(url string) ([]byte, int, error)

RawHTTPGet sends a raw HTTP GET request to the specified URL.

func (*Client) RawHTTPPost

func (c *Client) RawHTTPPost(url string, calldata interface{}) ([]byte, int, error)

RawHTTPPost sends a raw HTTP POST request to the specified URL with the provided data.

func (*Client) SendTransaction

func (c *Client) SendTransaction(obj *transactions.RawTx) (*transactions.SendTxResult, error)

SendTransaction sends a raw transaction to the blockchain.

Jump to

Keyboard shortcuts

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