data

package
v0.0.0-...-f23e49c Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAddressFromBech32String

func NewAddressFromBech32String(bech32 string) (*address, error)

NewAddressFromBech32String returns a new address from provided bech32 string

func NewAddressFromBytes

func NewAddressFromBytes(bytes []byte) *address

NewAddressFromBytes returns a new address from provided bytes

Types

type Account

type Account struct {
	Address  string `json:"address"`
	Nonce    uint64 `json:"nonce"`
	Balance  string `json:"balance"`
	Code     string `json:"code"`
	CodeHash []byte `json:"codeHash"`
	RootHash []byte `json:"rootHash"`
}

Account holds an Account's information

func (*Account) GetBalance

func (a *Account) GetBalance(decimals int) (float64, error)

GetBalance computes the float representation of the balance, based on the provided number of decimals

type AccountResponse

type AccountResponse struct {
	Data struct {
		Account *Account `json:"account"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

AccountResponse holds the account endpoint response

type Hyperblock

type Hyperblock struct {
	Nonce         uint64 `json:"nonce"`
	Round         uint64 `json:"round"`
	Hash          string `json:"hash"`
	PrevBlockHash string `json:"prevBlockHash"`
	Epoch         uint64 `json:"epoch"`
	NumTxs        uint64 `json:"numTxs"`
	ShardBlocks   []struct {
		Hash  string `json:"hash"`
		Nonce uint64 `json:"nonce"`
		Shard uint32 `json:"shard"`
	} `json:"shardBlocks"`
	Transactions []TransactionOnNetwork
}

Hyperblock holds a hyperblock's details

type HyperblockResponse

type HyperblockResponse struct {
	Data struct {
		Hyperblock Hyperblock `json:"hyperblock"`
	}
	Error string `json:"error"`
	Code  string `json:"code"`
}

HyperblockResponse holds a hyperblock info response from the network

type NetworkConfig

type NetworkConfig struct {
	ChainID                  string `json:"erd_chain_id"`
	Denomination             int    `json:"erd_denomination"`
	GasPerDataByte           uint64 `json:"erd_gas_per_data_byte"`
	LatestTagSoftwareVersion string `json:"erd_latest_tag_software_version"`
	MetaConsensusGroup       uint64 `json:"erd_meta_consensus_group"`
	MinGasLimit              uint64 `json:"erd_min_gas_limit"`
	MinGasPrice              uint64 `json:"erd_min_gas_price"`
	MinTransactionVersion    uint32 `json:"erd_min_transaction_version"`
	NumMetachainNodes        uint64 `json:"erd_num_metachain_nodes"`
	NumNodesInShard          uint64 `json:"erd_num_nodes_in_shard"`
	NumShardsWithoutMeta     uint32 `json:"erd_num_shards_without_meta"`
	RoundDuration            int64  `json:"erd_round_duration"`
	ShardConsensusGroupSize  uint64 `json:"erd_shard_consensus_group_size"`
	StartTime                int64  `json:"erd_start_time"`
}

NetworkConfig holds the network configuration parameters

type NetworkConfigResponse

type NetworkConfigResponse struct {
	Data struct {
		Config *NetworkConfig `json:"config"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

NetworkConfigResponse holds the network config endpoint response

type NetworkEconomics

type NetworkEconomics struct {
	DevRewards            string `json:"erd_dev_rewards"`
	EpochForEconomicsData uint32 `json:"erd_epoch_for_economics_data"`
	Inflation             string `json:"erd_inflation"`
	TotalFees             string `json:"erd_total_fees"`
	TotalStakedValue      string `json:"erd_total_staked_value"`
	TotalSupply           string `json:"erd_total_supply"`
	TotalTopUpValue       string `json:"erd_total_top_up_value"`
}

NetworkEconomics holds the network economics details

type NetworkEconomicsResponse

type NetworkEconomicsResponse struct {
	Data struct {
		Economics *NetworkEconomics `json:"metrics"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

NetworkEconomicsResponse holds the network economics endpoint response

type NetworkStatus

type NetworkStatus struct {
	CurrentRound               uint64 `json:"erd_current_round"`
	EpochNumber                uint64 `json:"erd_epoch_number"`
	Nonce                      uint64 `json:"erd_nonce"`
	NonceAtEpochStart          uint64 `json:"erd_nonce_at_epoch_start"`
	NoncesPassedInCurrentEpoch uint64 `json:"erd_nonces_passed_in_current_epoch"`
	RoundAtEpochStart          uint64 `json:"erd_round_at_epoch_start"`
	RoundsPassedInCurrentEpoch uint64 `json:"erd_rounds_passed_in_current_epoch"`
	RoundsPerEpoch             uint64 `json:"erd_rounds_per_epoch"`
}

NetworkStatus holds the network status details of a specified shard

type NetworkStatusResponse

type NetworkStatusResponse struct {
	Data struct {
		Status *NetworkStatus `json:"status"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

NetworkStatusResponse holds the network status response (for a specified shard)

type ResponseTxCost

type ResponseTxCost struct {
	Data  TxCostResponseData `json:"data"`
	Error string             `json:"error"`
	Code  string             `json:"code"`
}

ResponseTxCost defines a response from the node holding the transaction cost

type ResponseVmValue

type ResponseVmValue struct {
	Data  VmValuesResponseData `json:"data"`
	Error string               `json:"error"`
	Code  string               `json:"code"`
}

ResponseVmValue defines a wrapper over string containing returned data in hex format

type SendTransactionResponse

type SendTransactionResponse struct {
	Data struct {
		TxHash string `json:"txHash"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

SendTransactionResponse holds the response received from the network when broadcasting a transaction

type Transaction

type Transaction struct {
	Nonce     uint64 `json:"nonce"`
	Value     string `json:"value"`
	RcvAddr   string `json:"receiver"`
	SndAddr   string `json:"sender"`
	GasPrice  uint64 `json:"gasPrice,omitempty"`
	GasLimit  uint64 `json:"gasLimit,omitempty"`
	Data      []byte `json:"data,omitempty"`
	Signature string `json:"signature,omitempty"`
	ChainID   string `json:"chainID"`
	Version   uint32 `json:"version"`
	Options   uint32 `json:"options,omitempty"`
}

Transaction holds the fields of a transaction to be broadcasted to the network

type TransactionInfo

type TransactionInfo struct {
	Data struct {
		Transaction TransactionOnNetwork `json:"transaction"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

TransactionInfo holds a transaction info response from the network

type TransactionOnNetwork

type TransactionOnNetwork struct {
	Type             string                                `json:"type"`
	Hash             string                                `json:"hash"`
	Nonce            uint64                                `json:"nonce"`
	Value            string                                `json:"value"`
	Receiver         string                                `json:"receiver"`
	Sender           string                                `json:"sender"`
	GasPrice         uint64                                `json:"gasPrice"`
	GasLimit         uint64                                `json:"gasLimit"`
	Data             []byte                                `json:"data"`
	Signature        string                                `json:"signature"`
	SourceShard      uint32                                `json:"sourceShard"`
	DestinationShard uint32                                `json:"destinationShard"`
	MiniblockType    string                                `json:"miniblockType"`
	MiniblockHash    string                                `json:"miniblockHash"`
	Status           string                                `json:"status"`
	HyperblockNonce  uint64                                `json:"hyperblockNonce"`
	HyperblockHash   string                                `json:"hyperblockHash"`
	Receipt          *transaction.ReceiptApi               `json:"receipt,omitempty"`
	ScResults        []*transaction.ApiSmartContractResult `json:"smartContractResults,omitempty"`
}

TransactionOnNetwork holds a transaction's info entry in a hyperblock

type TransactionStatus

type TransactionStatus struct {
	Data struct {
		Status string `json:"status"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

TransactionStatus holds a transaction's status response from the network

type TxCostResponseData

type TxCostResponseData struct {
	TxCost     uint64 `json:"txGasUnits"`
	RetMessage string `json:"returnMessage"`
}

TxCostResponseData follows the format of the data field of a transaction cost request

type VmValueRequest

type VmValueRequest struct {
	Address    string   `json:"scAddress"`
	FuncName   string   `json:"funcName"`
	CallerAddr string   `json:"caller"`
	CallValue  string   `json:"value"`
	Args       []string `json:"args"`
}

VmValueRequest defines the request struct for values available in a VM

type VmValuesResponseData

type VmValuesResponseData struct {
	Data *vm.VMOutputApi `json:"data"`
}

VmValuesResponseData follows the format of the data field in an API response for a VM values query

Jump to

Keyboard shortcuts

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