api

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountQueryOptions

type AccountQueryOptions struct {
	OnFinalBlock   bool
	OnStartOfEpoch core.OptionalUint32
	BlockNonce     core.OptionalUint64
	BlockHash      []byte
	BlockRootHash  []byte
	HintEpoch      core.OptionalUint32
}

AccountQueryOptions holds options for account queries

type AccountResponse

type AccountResponse struct {
	Address         string `json:"address"`
	Nonce           uint64 `json:"nonce"`
	Balance         string `json:"balance"`
	Username        string `json:"username"`
	Code            string `json:"code"`
	CodeHash        []byte `json:"codeHash"`
	RootHash        []byte `json:"rootHash"`
	CodeMetadata    []byte `json:"codeMetadata"`
	DeveloperReward string `json:"developerReward"`
	OwnerAddress    string `json:"ownerAddress"`
}

AccountResponse is the data transfer object to be returned on API when requesting an address data

type Block

type Block struct {
	Nonce                  uint64                 `json:"nonce"`
	Round                  uint64                 `json:"round"`
	Epoch                  uint32                 `json:"epoch"`
	Shard                  uint32                 `json:"shard"`
	NumTxs                 uint32                 `json:"numTxs"`
	Hash                   string                 `json:"hash"`
	PrevBlockHash          string                 `json:"prevBlockHash"`
	StateRootHash          string                 `json:"stateRootHash"`
	AccumulatedFees        string                 `json:"accumulatedFees,omitempty"`
	DeveloperFees          string                 `json:"developerFees,omitempty"`
	AccumulatedFeesInEpoch string                 `json:"accumulatedFeesInEpoch,omitempty"`
	DeveloperFeesInEpoch   string                 `json:"developerFeesInEpoch,omitempty"`
	Status                 string                 `json:"status,omitempty"`
	RandSeed               string                 `json:"randSeed,omitempty"`
	PrevRandSeed           string                 `json:"prevRandSeed,omitempty"`
	Timestamp              time.Duration          `json:"timestamp,omitempty"`
	NotarizedBlocks        []*NotarizedBlock      `json:"notarizedBlocks,omitempty"`
	MiniBlocks             []*MiniBlock           `json:"miniBlocks,omitempty"`
	EpochStartInfo         *EpochStartInfo        `json:"epochStartInfo,omitempty"`
	EpochStartShardsData   []*EpochStartShardData `json:"epochStartShardsData,omitempty"`
	ScheduledData          *ScheduledData         `json:"scheduledData,omitempty"`
}

Block represents the structure for block that is returned by api routes

type BlockFetchType

type BlockFetchType string

BlockFetchType is the type that specifies how a block should be queried from API

const (
	// BlockFetchTypeByHash is to be used when a block should be fetched from API based on its hash
	BlockFetchTypeByHash BlockFetchType = "by-hash"

	// BlockFetchTypeByNonce is to be used when a block should be fetched from API based on its nonce
	BlockFetchTypeByNonce BlockFetchType = "by-nonce"
)

func (BlockFetchType) String

func (aft BlockFetchType) String() string

type BlockInfo

type BlockInfo struct {
	Nonce    uint64 `json:"nonce,omitempty"`
	Hash     string `json:"hash,omitempty"`
	RootHash string `json:"rootHash,omitempty"`
}

BlockInfo is a data transfer object used on the API

type BlockQueryOptions

type BlockQueryOptions struct {
	WithTransactions bool
	WithLogs         bool
}

BlockQueryOptions holds options for block queries

type DCTSupply

type DCTSupply struct {
	InitialMinted string `json:"initialMinted"`
	Supply        string `json:"supply"`
	Burned        string `json:"burned"`
	Minted        string `json:"minted"`
}

DCTSupply represents the structure for dct supply that is returned by api routes

type DelegatedValue

type DelegatedValue struct {
	DelegationScAddress string `json:"delegationScAddress"`
	Value               string `json:"value"`
}

DelegatedValue holds the value and the delegation system SC address

type Delegator

type Delegator struct {
	DelegatorAddress string            `json:"delegatorAddress"`
	DelegatedTo      []*DelegatedValue `json:"delegatedTo"`
	Total            string            `json:"total"`
	TotalAsBigInt    *big.Int          `json:"-"`
}

Delegator holds the delegator address and the slice of delegated values

type DirectStakedValue

type DirectStakedValue struct {
	Address    string `json:"address"`
	BaseStaked string `json:"baseStaked"`
	TopUp      string `json:"topUp"`
	Total      string `json:"total"`
}

DirectStakedValue holds the total staked value for an address

type EpochStartInfo

type EpochStartInfo struct {
	TotalSupply                      string `json:"totalSupply"`
	TotalToDistribute                string `json:"totalToDistribute"`
	TotalNewlyMinted                 string `json:"totalNewlyMinted"`
	RewardsPerBlock                  string `json:"rewardsPerBlock"`
	RewardsForProtocolSustainability string `json:"rewardsForProtocolSustainability"`
	NodePrice                        string `json:"nodePrice"`
	PrevEpochStartRound              uint64 `json:"prevEpochStartRound"`
	PrevEpochStartHash               string `json:"prevEpochStartHash"`
}

EpochStartInfo is a structure that holds information about epoch start meta block

type EpochStartShardData

type EpochStartShardData struct {
	ShardID                 uint32       `json:"shard"`
	Epoch                   uint32       `json:"epoch"`
	Round                   uint64       `json:"round,omitempty"`
	Nonce                   uint64       `json:"nonce,omitempty"`
	HeaderHash              string       `json:"headerHash,omitempty"`
	RootHash                string       `json:"rootHash,omitempty"`
	ScheduledRootHash       string       `json:"scheduledRootHash,omitempty"`
	FirstPendingMetaBlock   string       `json:"firstPendingMetaBlock,omitempty"`
	LastFinishedMetaBlock   string       `json:"lastFinishedMetaBlock,omitempty"`
	PendingMiniBlockHeaders []*MiniBlock `json:"pendingMiniBlockHeaders,omitempty"`
}

EpochStartShardData is a structure that holds data about the epoch start shard data

type GetAlteredAccountsForBlockOptions

type GetAlteredAccountsForBlockOptions struct {
	GetBlockParameters
	TokensFilter string
}

GetAlteredAccountsForBlockOptions specifies the options for returning altered accounts for a given block

type GetBlockParameters

type GetBlockParameters struct {
	RequestType BlockFetchType
	Hash        []byte
	Nonce       uint64
}

GetBlockParameters holds the parameters for requesting a block on API

type Hyperblock

type Hyperblock struct {
	Hash                   string                              `json:"hash"`
	PrevBlockHash          string                              `json:"prevBlockHash"`
	StateRootHash          string                              `json:"stateRootHash"`
	Nonce                  uint64                              `json:"nonce"`
	Round                  uint64                              `json:"round"`
	Epoch                  uint32                              `json:"epoch"`
	NumTxs                 uint32                              `json:"numTxs"`
	AccumulatedFees        string                              `json:"accumulatedFees,omitempty"`
	DeveloperFees          string                              `json:"developerFees,omitempty"`
	AccumulatedFeesInEpoch string                              `json:"accumulatedFeesInEpoch,omitempty"`
	DeveloperFeesInEpoch   string                              `json:"developerFeesInEpoch,omitempty"`
	Timestamp              time.Duration                       `json:"timestamp,omitempty"`
	EpochStartInfo         *EpochStartInfo                     `json:"epochStartInfo,omitempty"`
	EpochStartShardsData   []*EpochStartShardData              `json:"epochStartShardsData,omitempty"`
	ShardBlocks            []*NotarizedBlock                   `json:"shardBlocks"`
	Transactions           []*transaction.ApiTransactionResult `json:"transactions"`
	Status                 string                              `json:"status,omitempty"`
}

Hyperblock contains all fully executed (both in source and in destination shards) transactions notarized in a given metablock

type MiniBlock

type MiniBlock struct {
	Hash                    string                              `json:"hash"`
	Type                    string                              `json:"type"`
	ProcessingType          string                              `json:"processingType,omitempty"`
	ConstructionState       string                              `json:"constructionState,omitempty"`
	IsFromReceiptsStorage   bool                                `json:"isFromReceiptsStorage,omitempty"`
	SourceShard             uint32                              `json:"sourceShard"`
	DestinationShard        uint32                              `json:"destinationShard"`
	Transactions            []*transaction.ApiTransactionResult `json:"transactions,omitempty"`
	Receipts                []*transaction.ApiReceipt           `json:"receipts,omitempty"`
	IndexOfFirstTxProcessed int32                               `json:"indexOfFirstTxProcessed"`
	IndexOfLastTxProcessed  int32                               `json:"indexOfLastTxProcessed"`
}

MiniBlock represents the structure for a miniblock

type NotarizedBlock

type NotarizedBlock struct {
	Hash            string                    `json:"hash"`
	Nonce           uint64                    `json:"nonce"`
	Round           uint64                    `json:"round"`
	Shard           uint32                    `json:"shard"`
	RootHash        string                    `json:"rootHash"`
	MiniBlockHashes []string                  `json:"miniBlockHashes,omitempty"`
	AlteredAccounts []*outport.AlteredAccount `json:"alteredAccounts,omitempty"`
}

NotarizedBlock represents a notarized block

type ScheduledData

type ScheduledData struct {
	ScheduledRootHash        string `json:"rootHash,omitempty"`
	ScheduledAccumulatedFees string `json:"accumulatedFees,omitempty"`
	ScheduledDeveloperFees   string `json:"developerFees,omitempty"`
	ScheduledGasProvided     uint64 `json:"gasProvided,omitempty"`
	ScheduledGasPenalized    uint64 `json:"penalized,omitempty"`
	ScheduledGasRefunded     uint64 `json:"gasRefunded,omitempty"`
}

ScheduledData is a structure that hold information about scheduled events

type StakeValues

type StakeValues struct {
	BaseStaked *big.Int
	TopUp      *big.Int
}

StakeValues is the structure that contains the total staked value and the total top up value

Jump to

Keyboard shortcuts

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