httpclient

package
v0.0.0-...-15c384e Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHeader

type BlockHeader struct {
	RawData          BlockHeaderRawData `json:"raw_data"`
	WitnessSignature Bytes              `json:"witness_signature"`
}

type BlockHeaderRawData

type BlockHeaderRawData struct {
	Number    uint64 `json:"number"`
	Verion    uint64 `json:"version"`
	Timestamp uint64 `json:"timestamp"`
}

type BlockResponse

type BlockResponse struct {
	Error
	BlockHeader BlockHeader `json:"block_header"`
	BlockId     string      `json:"blockID"`
}

type Bytes

type Bytes []byte

Bytes marshals/unmarshals as a JSON string with NO 0x prefix.

func (*Bytes) UnmarshalJSON

func (b *Bytes) UnmarshalJSON(inputBz []byte) error

type Client

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

func NewHttpClient

func NewHttpClient(baseUrl string) (*Client, error)

func (*Client) BroadcastHex

func (c *Client) BroadcastHex(txHex string) (*CreateTransactionResponse, error)

func (*Client) CreateTransaction

func (c *Client) CreateTransaction(from string, to string, amount int) (*CreateTransactionResponse, error)

func (*Client) GetAccount

func (c *Client) GetAccount(address string) (*GetAccountResponse, error)

func (*Client) GetBlockByNum

func (c *Client) GetBlockByNum(num uint64) (*BlockResponse, error)

func (*Client) GetTransactionByID

func (c *Client) GetTransactionByID(txHash string) (*GetTransactionIDResponse, error)

func (*Client) GetTransactionInfoByID

func (c *Client) GetTransactionInfoByID(txHash string) (*GetTransactionInfoById, error)

func (*Client) ReadTrc20Balance

func (c *Client) ReadTrc20Balance(fromAddress string, contract string) (*big.Int, error)

func (*Client) ReadTrc20Decimals

func (c *Client) ReadTrc20Decimals(contract string) (*big.Int, error)

func (*Client) TriggerConstantContracts

func (c *Client) TriggerConstantContracts(ownerAddress string, contract string, funcSelector string, param string) (*TriggerConstantContractResponse, error)

func (*Client) Url

func (c *Client) Url(path string) string

type ContractData

type ContractData struct {
	Parameter ContractParameter `json:"parameter"`
	Type      string            `json:"type"`
}

func (*ContractData) AsTransferContract

func (c *ContractData) AsTransferContract() (*transferContract, error)

type ContractParameter

type ContractParameter struct {
	Value   map[string]interface{} `json:"value"`
	TypeUrl string                 `json:"type_url"`
}

type CreateTransactionResponse

type CreateTransactionResponse struct {
	Error
	RawData    TransactionRawData `json:"raw_data"`
	RawDataHex Bytes              `json:"raw_data_hex"`
}

type Error

type Error struct {
	Code         string `json:"code"`
	Message      string `json:"message"`
	ErrorMessage string `json:"Error"`
}

func (*Error) Error

func (e *Error) Error() string

type GetAccountResponse

type GetAccountResponse struct {
	Error
	Balance uint64 `json:"balance"`
	Address string `json:"address"`
}

type GetTransactionIDResponse

type GetTransactionIDResponse struct {
	Error
	Ret        []RetItem          `json:"ret"`
	RawData    TransactionRawData `json:"raw_data"`
	RawDataHex Bytes              `json:"raw_data_hex"`
	TxID       Bytes              `json:"txID"`
	Signature  []Bytes            `json:"signature"`
}

type GetTransactionInfoById

type GetTransactionInfoById struct {
	Error
	Id              Bytes    `json:"id"`
	Fee             uint64   `json:"fee"`
	BlockNumber     uint64   `json:"blockNumber"`
	BlockTimeStamp  uint64   `json:"blockTimeStamp"`
	ContractResult  []string `json:"contractResult"`
	Receipt         Receipt  `json:"receipt"`
	ContractAddress string   `json:"contract_address"`

	Logs                 []*Log                 `json:"log"`
	InternalTransactions []*InternalTransaction `json:"internal_transactions"`
}

type InternalTransaction

type InternalTransaction struct {
	Hash              Bytes `json:"hash"`
	CallerAddress     Bytes `json:"caller_address"`
	TransferToAddress Bytes `json:"transferTo_address"`
	Note              Bytes `json:"note"`
}

type Log

type Log struct {
	Address Bytes   `json:"address"`
	Topics  []Bytes `json:"topics"`
	Data    Bytes   `json:"data"`
}

type Receipt

type Receipt struct {
	EnergyUsage       int64    `json:"energy_usage"`
	OriginEnergyUsage int64    `json:"origin_energy_usage"`
	EnergyUsageTotal  int64    `json:"energy_usage_total"`
	NetFee            int64    `json:"net_fee"`
	Result            TxResult `json:"result"`
}

type RetItem

type RetItem struct {
	ContractRet TxResult `json:"contractRet"`
}

type TransactionRawData

type TransactionRawData struct {
	Contract          []ContractData `json:"contract"`
	RefBlockBytes     Bytes          `json:"ref_block_bytes"`
	RefBlockHashBytes Bytes          `json:"ref_block_hash"`
	Expiration        uint64         `json:"expiration"`
	FeeLimit          uint64         `json:"fee_limit"`
	Timestamp         uint64         `json:"timestamp"`
}

type TriggerConstantContractResponse

type TriggerConstantContractResponse struct {
	Error
	ConstantResult []Bytes `json:"constant_result"`
}

type TxResult

type TxResult string
var Revert TxResult = "REVERT"
var Success TxResult = "SUCCESS"

Jump to

Keyboard shortcuts

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