response

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadResponse

func ReadResponse[T EtherscanResponse](content bytes.Buffer) (T, error)

Types

type AccountBalance

type AccountBalance struct {
	Account string        `json:"account"`
	Balance *types.BigInt `json:"balance"`
}

AccountBalance account and its balance in pair

type BlockRewards

type BlockRewards struct {
	BlockNumber int           `json:"blockNumber,string"`
	TimeStamp   types.Time    `json:"timeStamp"`
	BlockMiner  string        `json:"blockMiner"`
	BlockReward *types.BigInt `json:"blockReward"`
	Uncles      []struct {
		Miner         string        `json:"miner"`
		UnclePosition int           `json:"unclePosition,string"`
		BlockReward   *types.BigInt `json:"blockreward"`
	} `json:"uncles"`
	UncleInclusionReward *types.BigInt `json:"uncleInclusionReward"`
}

BlockRewards holds info from query for block and uncle rewards

type ContractSource

type ContractSource struct {
	SourceCode           string `json:"SourceCode"`
	ABI                  string `json:"ABI"`
	ContractName         string `json:"ContractName"`
	CompilerVersion      string `json:"CompilerVersion"`
	OptimizationUsed     int    `json:"OptimizationUsed,string"`
	Runs                 int    `json:"Runs,string"`
	ConstructorArguments string `json:"ConstructorArguments"`
	EVMVersion           string `json:"EVMVersion"`
	Library              string `json:"Library"`
	LicenseType          string `json:"LicenseType"`
	Proxy                string `json:"Proxy"`
	Implementation       string `json:"Implementation"`
	SwarmSource          string `json:"SwarmSource"`
}

ContractSource holds info from query for contract source code

type ERC1155Transfer

type ERC1155Transfer struct {
	BlockNumber int        `json:"blockNumber,string"`
	TimeStamp   types.Time `json:"timeStamp"`
	Hash        string     `json:"hash"`
	//Nonce           int     `json:"nonce,string"`
	BlockHash       string `json:"blockHash"`
	From            string `json:"from"`
	ContractAddress string `json:"contractAddress"`
	To              string `json:"to"`
	//TokenID         *BigInt `json:"tokenID"`
	TokenName   string `json:"tokenName"`
	TokenSymbol string `json:"tokenSymbol"`
	//TokenDecimal      int     `json:"tokenDecimal,string"`
	//TokenValue int `json:"tokenValue,string"`
	//TransactionIndex  int     `json:"transactionIndex,string"`
	//Gas               int     `json:"gas,string"`
	//GasPrice *BigInt `json:"gasPrice"`
	//GasUsed           int     `json:"gasUsed,string"`
	//CumulativeGasUsed int     `json:"cumulativeGasUsed,string"`
	Input string `json:"input"`
}

ERC1155Transfer holds info from ERC1155 token transfer event query

func (ERC1155Transfer) GetBlockNumber

func (tx ERC1155Transfer) GetBlockNumber() int

func (ERC1155Transfer) GetHash

func (tx ERC1155Transfer) GetHash() string

type ERC20Transfer

type ERC20Transfer struct {
	BlockNumber       int           `json:"blockNumber,string"`
	TimeStamp         types.Time    `json:"timeStamp"`
	Hash              string        `json:"hash"`
	Nonce             int           `json:"nonce,string"`
	BlockHash         string        `json:"blockHash"`
	From              string        `json:"from"`
	ContractAddress   string        `json:"contractAddress"`
	To                string        `json:"to"`
	Value             *types.BigInt `json:"value"`
	TokenName         string        `json:"tokenName"`
	TokenSymbol       string        `json:"tokenSymbol"`
	TokenDecimal      int           `json:"tokenDecimal,string"`
	TransactionIndex  int           `json:"transactionIndex,string"`
	Gas               int           `json:"gas,string"`
	GasPrice          *types.BigInt `json:"gasPrice"`
	GasUsed           int           `json:"gasUsed,string"`
	CumulativeGasUsed int           `json:"cumulativeGasUsed,string"`
	Input             string        `json:"input"`
	Confirmations     int           `json:"confirmations,string"`
}

ERC20Transfer holds info from ERC20 token transfer event query

func (ERC20Transfer) GetBlockNumber

func (tx ERC20Transfer) GetBlockNumber() int

func (ERC20Transfer) GetHash

func (tx ERC20Transfer) GetHash() string

type ERC721Transfer

type ERC721Transfer struct {
	BlockNumber       int           `json:"blockNumber,string"`
	TimeStamp         types.Time    `json:"timeStamp"`
	Hash              string        `json:"hash"`
	Nonce             int           `json:"nonce,string"`
	BlockHash         string        `json:"blockHash"`
	From              string        `json:"from"`
	ContractAddress   string        `json:"contractAddress"`
	To                string        `json:"to"`
	TokenID           *types.BigInt `json:"tokenID"`
	TokenName         string        `json:"tokenName"`
	TokenSymbol       string        `json:"tokenSymbol"`
	TokenDecimal      int           `json:"tokenDecimal,string"`
	TransactionIndex  int           `json:"transactionIndex,string"`
	Gas               int           `json:"gas,string"`
	GasPrice          *types.BigInt `json:"gasPrice"`
	GasUsed           int           `json:"gasUsed,string"`
	CumulativeGasUsed int           `json:"cumulativeGasUsed,string"`
	Input             string        `json:"input"`
	Confirmations     int           `json:"confirmations,string"`
}

ERC721Transfer holds info from ERC721 token transfer event query

func (ERC721Transfer) GetBlockNumber

func (tx ERC721Transfer) GetBlockNumber() int

func (ERC721Transfer) GetHash

func (tx ERC721Transfer) GetHash() string

type EtherscanTx

type EtherscanTx interface {
	GetBlockNumber() int
	GetHash() string
}

EtherscanTx represents

type ExecutionStatus

type ExecutionStatus struct {
	// 0 = pass, 1 = error
	IsError        int    `json:"isError,string"`
	ErrDescription string `json:"errDescription"`
}

ExecutionStatus holds info from query for transaction execution status

type GasPrices

type GasPrices struct {
	LastBlock            int
	SafeGasPrice         float64
	ProposeGasPrice      float64
	FastGasPrice         float64
	SuggestBaseFeeInGwei float64   `json:"suggestBaseFee"`
	GasUsedRatio         []float64 `json:"gasUsedRatio"`
}

GasPrices holds info for Gas Oracle queries Gas Prices are returned in Gwei

func (*GasPrices) UnmarshalJSON

func (gp *GasPrices) UnmarshalJSON(data []byte) error

type InternalTx

type InternalTx struct {
	BlockNumber     int           `json:"blockNumber,string"`
	TimeStamp       types.Time    `json:"timeStamp"`
	Hash            string        `json:"hash"`
	From            string        `json:"from"`
	To              string        `json:"to"`
	Value           *types.BigInt `json:"value"`
	ContractAddress string        `json:"contractAddress"`
	Input           string        `json:"input"`
	Type            string        `json:"type"`
	Gas             int           `json:"gas,string"`
	GasUsed         int           `json:"gasUsed,string"`
	TraceID         string        `json:"traceId"`
	IsError         int           `json:"isError,string"`
	ErrCode         string        `json:"errCode"`
}

InternalTx holds info from internal tx query

func (InternalTx) GetBlockNumber

func (tx InternalTx) GetBlockNumber() int

func (InternalTx) GetHash

func (tx InternalTx) GetHash() string

type LatestPrice

type LatestPrice struct {
	ETHBTC          float64    `json:"ethbtc,string"`
	ETHBTCTimestamp types.Time `json:"ethbtc_timestamp"`
	ETHUSD          float64    `json:"ethusd,string"`
	ETHUSDTimestamp types.Time `json:"ethusd_timestamp"`
}

LatestPrice holds info from query for latest ether price

type Log

type Log struct {
	Address         string   `json:"address"`
	Topics          []string `json:"topics"`
	Data            string   `json:"data"`
	BlockNumber     string   `json:"blockNumber"`
	TransactionHash string   `json:"transactionHash"`
	BlockHash       string   `json:"blockHash"`
	LogIndex        string   `json:"logIndex"`
	Removed         bool     `json:"removed"`
}

type MinedBlock

type MinedBlock struct {
	BlockNumber int           `json:"blockNumber,string"`
	TimeStamp   types.Time    `json:"timeStamp"`
	BlockReward *types.BigInt `json:"blockReward"`
}

MinedBlock holds info from query for mined block by address

type NormalTx

type NormalTx struct {
	BlockNumber       int           `json:"blockNumber,string"`
	TimeStamp         types.Time    `json:"timeStamp"`
	Hash              string        `json:"hash"`
	Nonce             int           `json:"nonce,string"`
	BlockHash         string        `json:"blockHash"`
	TransactionIndex  int           `json:"transactionIndex,string"`
	From              string        `json:"from"`
	To                string        `json:"to"`
	Value             *types.BigInt `json:"value"`
	Gas               int           `json:"gas,string"`
	GasPrice          *types.BigInt `json:"gasPrice"`
	IsError           int           `json:"isError,string"`
	TxReceiptStatus   string        `json:"txreceipt_status"`
	Input             string        `json:"input"`
	ContractAddress   string        `json:"contractAddress"`
	CumulativeGasUsed int           `json:"cumulativeGasUsed,string"`
	GasUsed           int           `json:"gasUsed,string"`
	Confirmations     int           `json:"confirmations,string"`
}

NormalTx holds info from normal tx query

func (NormalTx) GetBlockNumber

func (tx NormalTx) GetBlockNumber() int

func (NormalTx) GetHash

func (tx NormalTx) GetHash() string

type StatusReponse

type StatusReponse struct {
	Status string `json:"status"`
}

Jump to

Keyboard shortcuts

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