data

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: GPL-3.0 Imports: 10 Imported by: 16

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 Block added in v1.3.3

type Block struct {
	Timestamp int `json:"timestamp"`
}

Block holds a block's details returned by the API

type ESDTFungibleResponse added in v1.3.5

type ESDTFungibleResponse struct {
	Data struct {
		TokenData *ESDTFungibleTokenData `json:"tokenData"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

ESDTFungibleResponse holds the ESDT (fungible) token data endpoint response

type ESDTFungibleTokenData added in v1.3.5

type ESDTFungibleTokenData struct {
	TokenIdentifier string `json:"tokenIdentifier"`
	Balance         string `json:"balance"`
	Properties      string `json:"properties"`
}

ESDTFungibleTokenData holds the ESDT (fungible) token data definition

type ESDTNFTResponse added in v1.3.5

type ESDTNFTResponse struct {
	Data struct {
		TokenData *ESDTNFTTokenData `json:"tokenData"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

ESDTNFTResponse holds the NFT token data endpoint response

type ESDTNFTTokenData added in v1.3.5

type ESDTNFTTokenData struct {
	TokenIdentifier string   `json:"tokenIdentifier"`
	Balance         string   `json:"balance"`
	Properties      string   `json:"properties,omitempty"`
	Name            string   `json:"name,omitempty"`
	Nonce           uint64   `json:"nonce,omitempty"`
	Creator         string   `json:"creator,omitempty"`
	Royalties       string   `json:"royalties,omitempty"`
	Hash            []byte   `json:"hash,omitempty"`
	URIs            [][]byte `json:"uris,omitempty"`
	Attributes      []byte   `json:"attributes,omitempty"`
}

ESDTNFTTokenData holds the ESDT (NDT, SFT or MetaESDT) token data definition

type EnableEpochsConfig

type EnableEpochsConfig struct {
	EnableEpochs config.EnableEpochs
}

EnableEpochsConfig holds the enable epochs configuration parameters

type EnableEpochsConfigResponse

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

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

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 GuardianDataResponse added in v1.3.3

type GuardianDataResponse struct {
	Data struct {
		GuardianData *api.GuardianData `json:"guardianData"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

GuardianDataResponse holds the guardian data 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"`
	Timestamp    uint64 `json:"timestamp"`
	Transactions []TransactionOnNetwork
}

HyperBlock holds a hyper block's details

type HyperBlockResponse

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 IsDataTrieMigratedResponse added in v1.3.7

type IsDataTrieMigratedResponse struct {
	Data  map[string]bool `json:"data"`
	Error string          `json:"error"`
	Code  string          `json:"code"`
}

IsDataTrieMigratedResponse holds the IsDataTrieMigrated endpoint response

type MaxNodesChangeConfig

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

type Mnemonic string

Mnemonic will hold the mnemonic info

func (Mnemonic) ToSplitMnemonicWords

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"`
	RoundsPerEpoch           uint32  `json:"erd_rounds_per_epoch"`
	ExtraGasLimitGuardedTx   uint64  `json:"erd_extra_gas_limit_guarded_tx"`
}

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

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 ProcessedTransactionStatus added in v1.3.4

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

ProcessedTransactionStatus holds a transaction's processed status response from the network

type RatingsConfig

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

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

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

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

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

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 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"`
	ProcessingTypeOnSource            string                                `json:"processingTypeOnSource,omitempty"`
	ProcessingTypeOnDestination       string                                `json:"processingTypeOnDestination,omitempty"`
	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"`
	BlockNonce                        uint64                                `json:"blockNonce"`
	BlockHash                         string                                `json:"blockHash"`
	MiniblockType                     string                                `json:"miniblockType"`
	MiniblockHash                     string                                `json:"miniblockHash"`
	Timestamp                         uint64                                `json:"timestamp"`
	Status                            string                                `json:"status"`
	HyperBlockNonce                   uint64                                `json:"hyperblockNonce"`
	HyperBlockHash                    string                                `json:"hyperblockHash"`
	NotarizedAtSourceInMetaNonce      uint64                                `json:"notarizedAtSourceInMetaNonce,omitempty"`
	NotarizedAtSourceInMetaHash       string                                `json:"NotarizedAtSourceInMetaHash,omitempty"`
	NotarizedAtDestinationInMetaNonce uint64                                `json:"notarizedAtDestinationInMetaNonce,omitempty"`
	NotarizedAtDestinationInMetaHash  string                                `json:"notarizedAtDestinationInMetaHash,omitempty"`
	ScResults                         []*transaction.ApiSmartContractResult `json:"smartContractResults,omitempty"`
	Logs                              *transaction.ApiLogs                  `json:"logs,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 ValidatorsInfoResponse

type ValidatorsInfoResponse struct {
	Data struct {
		ValidatorsInfo []*state.ShardValidatorInfo `json:"validators"`
	} `json:"data"`
	Error string `json:"error"`
	Code  string `json:"code"`
}

ValidatorsInfoResponse holds the validators info endpoint reponse

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

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

VmValueRequestWithOptionalParameters 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