data

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: GPL-3.0 Imports: 6 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"`
	CodeMetadata    []byte `json:"codeMetadata"`
	Username        string `json:"username"`
	DeveloperReward string `json:"developerReward"`
	OwnerAddress    string `json:"ownerAddress"`
}

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 ArgCreateTransaction added in v1.0.1

type ArgCreateTransaction struct {
	Nonce            uint64
	Value            string
	RcvAddr          string
	SndAddr          string
	GasPrice         uint64
	GasLimit         uint64
	Data             []byte
	Signature        string
	ChainID          string
	Version          uint32
	Options          uint32
	AvailableBalance string
}

ArgCreateTransaction will hold the transaction fields

type EnableEpochsConfig added in v1.0.14

type EnableEpochsConfig struct {
	BalanceWaitingListsEnableEpoch uint32                 `json:"erd_balance_waiting_lists_enable_epoch"`
	WaitingListFixEnableEpoch      uint32                 `json:"erd_waiting_list_fix_enable_epoch"`
	MaxNodesChangeEnableEpoch      []MaxNodesChangeConfig `json:"erd_max_nodes_change_enable_epoch"`
}

EnableEpochsConfig holds the enable epochs configuration parameters

type EnableEpochsConfigResponse added in v1.0.14

type EnableEpochsConfigResponse struct {
	Data struct {
		Config *EnableEpochsConfig `json:"enableEpochs"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

EnableEpochsConfigResponse holds the enable epochs config endpoint response

type GenesisNodes added in v1.0.14

type GenesisNodes struct {
	Eligible map[uint32][]string `json:"eligible"`
	Waiting  map[uint32][]string `json:"waiting"`
}

GenesisNodes holds the genesis nodes public keys per shard

type GenesisNodesResponse added in v1.0.14

type GenesisNodesResponse struct {
	Data struct {
		Nodes *GenesisNodes `json:"nodes"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

GenesisNodesResponse holds the network genesis nodes endpoint reponse

type HyperBlock added in v1.0.2

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 hyper block's details

type HyperBlockResponse added in v1.0.2

type HyperBlockResponse struct {
	Data struct {
		HyperBlock HyperBlock `json:"hyperblock"`
	}
	Error string `json:"error"`
	Code  string `json:"code"`
}

HyperBlockResponse holds a hyper block info response from the network

type MaxNodesChangeConfig added in v1.0.14

type MaxNodesChangeConfig struct {
	EpochEnable            uint32 `json:"erd_epoch_enable"`
	MaxNumNodes            uint32 `json:"erd_max_num_nodes"`
	NodesToShufflePerShard uint32 `json:"erd_nodes_to_shuffle_per_shard"`
}

MaxNodesChangeConfig holds the max nodes change config

type Mnemonic added in v1.0.2

type Mnemonic string

Mnemonic will hold the mnemonic info

func (Mnemonic) ToSplitMnemonicWords added in v1.0.2

func (m Mnemonic) ToSplitMnemonicWords() []string

ToSplitMnemonicWords splits the complete strings in words

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       uint32  `json:"erd_meta_consensus_group_size"`
	MinGasLimit              uint64  `json:"erd_min_gas_limit"`
	MinGasPrice              uint64  `json:"erd_min_gas_price"`
	MinTransactionVersion    uint32  `json:"erd_min_transaction_version"`
	NumMetachainNodes        uint32  `json:"erd_num_metachain_nodes"`
	NumNodesInShard          uint32  `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"`
	Adaptivity               bool    `json:"erd_adaptivity,string"`
	Hysteresys               float32 `json:"erd_hysteresis,string"`
}

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"`
	CrossCheckBlockHeight      string `json:"erd_cross_check_block_height"`
	HighestNonce               uint64 `json:"erd_highest_final_nonce"`
	ProbableHighestNonce       uint64 `json:"erd_probable_highest_nonce"`
	ShardID                    uint32 `json:"erd_shard_id"`
}

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 NodeStatusResponse added in v1.0.19

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

NodeStatusResponse holds the node status response

type RatingsConfig added in v1.0.14

type RatingsConfig struct {
	GeneralMaxRating                          uint32              `json:"erd_ratings_general_max_rating"`
	GeneralMinRating                          uint32              `json:"erd_ratings_general_min_rating"`
	GeneralSignedBlocksThreshold              float32             `json:"erd_ratings_general_signed_blocks_threshold,string"`
	GeneralStartRating                        uint32              `json:"erd_ratings_general_start_rating"`
	GeneralSelectionChances                   []*SelectionChances `json:"erd_ratings_general_selection_chances"`
	MetachainConsecutiveMissedBlocksPenalty   float32             `json:"erd_ratings_metachain_consecutive_missed_blocks_penalty,string"`
	MetachainHoursToMaxRatingFromStartRating  uint32              `json:"erd_ratings_metachain_hours_to_max_rating_from_start_rating"`
	MetachainProposerDecreaseFactor           float32             `json:"erd_ratings_metachain_proposer_decrease_factor,string"`
	MetachainProposerValidatorImportance      float32             `json:"erd_ratings_metachain_proposer_validator_importance,string"`
	MetachainValidatorDecreaseFactor          float32             `json:"erd_ratings_metachain_validator_decrease_factor,string"`
	PeerhonestyBadPeerThreshold               float64             `json:"erd_ratings_peerhonesty_bad_peer_threshold,string"`
	PeerhonestyDecayCoefficient               float64             `json:"erd_ratings_peerhonesty_decay_coefficient,string"`
	PeerhonestyDecayUpdateIntervalInseconds   uint32              `json:"erd_ratings_peerhonesty_decay_update_interval_inseconds"`
	PeerhonestyMaxScore                       float64             `json:"erd_ratings_peerhonesty_max_score,string"`
	PeerhonestyMinScore                       float64             `json:"erd_ratings_peerhonesty_min_score,string"`
	PeerhonestyUnitValue                      float64             `json:"erd_ratings_peerhonesty_unit_value,string"`
	ShardchainConsecutiveMissedBlocksPenalty  float32             `json:"erd_ratings_shardchain_consecutive_missed_blocks_penalty,string"`
	ShardchainHoursToMaxRatingFromStartRating uint32              `json:"erd_ratings_shardchain_hours_to_max_rating_from_start_rating"`
	ShardchainProposerDecreaseFactor          float32             `json:"erd_ratings_shardchain_proposer_decrease_factor,string"`
	ShardchainProposerValidatorImportance     float32             `json:"erd_ratings_shardchain_proposer_validator_importance,string"`
	ShardchainValidatorDecreaseFactor         float32             `json:"erd_ratings_shardchain_validator_decrease_factor,string"`
}

RatingsConfig holds the ratings configuration parameters

type RatingsConfigResponse added in v1.0.14

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

RatingsConfigResponse holds the ratings config endpoint response

type RawBlockRespone added in v1.0.14

type RawBlockRespone struct {
	Data struct {
		Block []byte `json:"block"`
	}
	Error string `json:"error"`
	Code  string `json:"code"`
}

RawBlockRespone holds the raw blocks endpoint response

type RawMiniBlockRespone added in v1.0.14

type RawMiniBlockRespone struct {
	Data struct {
		MiniBlock []byte `json:"miniblock"`
	}
	Error string `json:"error"`
	Code  string `json:"code"`
}

RawMiniBlockRespone holds the raw miniblock endpoint respone

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 SelectionChances added in v1.0.14

type SelectionChances struct {
	ChancePercent uint32 `json:"erd_chance_percent"`
	MaxThreshold  uint32 `json:"erd_max_threshold"`
}

SelectionChances holds the selection chances parameters

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 SendTransactionsResponse added in v1.0.1

type SendTransactionsResponse struct {
	Data struct {
		NumOfSentTxs int            `json:"numOfSentTxs"`
		TxsHashes    map[int]string `json:"txsHashes"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

SendTransactionsResponse holds the response received from the network when broadcasting multiple transactions

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"`
	ScResults        []*transaction.ApiSmartContractResult `json:"smartContractResults,omitempty"`
}

TransactionOnNetwork holds a transaction's info entry in a hyper block

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 VmValueRequestWithOptionalParameters added in v1.0.16

type VmValueRequestWithOptionalParameters struct {
	*VmValueRequest
	SameScState    bool `json:"sameScState"`
	ShouldBeSynced bool `json:"shouldBeSynced"`
}

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