archive

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LedgerTypeCurrent = "current"
	LedgerTypeStaged  = "staged"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Height                 uint64            `json:"height"`
	StateHash              string            `json:"state_hash"`
	ParentHash             string            `json:"parent_hash"`
	LedgerHash             string            `json:"ledger_hash"`
	SnarkedLedgerHash      string            `json:"snarked_ledger_hash"`
	Creator                string            `json:"creator"`
	Winner                 string            `json:"winner"`
	Timestamp              int64             `json:"timestamp"`
	TimestampFormatted     string            `json:"timestamp_formatted"`
	GlobalSlotSinceGenesis uint              `json:"global_slot_since_genesis"`
	GlobalSlot             uint              `json:"global_slot"`
	InternalCommands       []InternalCommand `json:"internal_commands"`
	UserCommands           []UserCommand     `json:"user_commands"`
}

type BlocksRequest

type BlocksRequest struct {
	Canonical   *bool
	StartHeight uint
	Limit       uint
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client interacts with the Archive API

func NewClient

func NewClient(httpClient *http.Client, endpoint string) *Client

NewClient returns a new archive service client

func NewDefaultClient

func NewDefaultClient(endpoint string) *Client

NewDefaultClient returns a default archive service client

func (Client) Block

func (c Client) Block(hash string) (*Block, error)

Block returns block for a given hash

func (Client) Blocks

func (c Client) Blocks(blocksReq *BlocksRequest) ([]Block, error)

Blocks returns blocks matching the request parameters

func (Client) StakingLedger

func (c Client) StakingLedger(ledgerType string) ([]StakingInfo, error)

StakingLedger returns the staking ledger records

func (Client) Summary

func (c Client) Summary() (*Summary, error)

Summary returns archive summary

type InternalCommand

type InternalCommand struct {
	ID                  string `json:"id"`
	Hash                string `json:"hash"`
	Type                string `json:"type"`
	Fee                 int64  `json:"fee"`
	Token               int    `json:"token"`
	Receiver            string `json:"receiver"`
	SequenceNo          int    `json:"sequence_no"`
	SecondarySequenceNo int    `json:"secondary_sequence_no"`
}

type StakingInfo

type StakingInfo struct {
	Pk       string `json:"pk"`
	Balance  string `json:"balance"`
	Delegate string `json:"delegate"`
	Timing   *struct {
		InitialMinimumBalance string `json:"initial_minimum_balance"`
		CliffTime             string `json:"cliff_time"`
		CliffAmount           string `json:"cliff_amount"`
		VestingPeriod         string `json:"vesting_period"`
		VestingIncrement      string `json:"vesting_increment"`
	} `json:"timing"`
	Token            string `json:"token"`
	TokenPermissions struct {
	} `json:"token_permissions"`
	ReceiptChainHash string `json:"receipt_chain_hash"`
	VotingFor        string `json:"voting_for"`
	Permissions      *struct {
		Stake              bool   `json:"stake"`
		EditState          string `json:"edit_state"`
		Send               string `json:"send"`
		SetDelegate        string `json:"set_delegate"`
		SetPermissions     string `json:"set_permissions"`
		SetVerificationKey string `json:"set_verification_key"`
	} `json:"permissions"`
}

type Summary

type Summary struct {
	BlocksCount           uint            `json:"blocks_count"`
	BlocksMinHeight       uint            `json:"blocks_min_height"`
	BlocksMaxHeight       uint            `json:"blocks_max_height"`
	BlocksMinTimestamp    int64           `json:"blocks_min_timestamp"`
	BlocksMaxTimestamp    int64           `json:"blocks_max_timestamp"`
	BlocksProducersCount  uint            `json:"blocks_producers_count"`
	PublicKeysCount       uint            `json:"public_keys_count"`
	InternalCommandsCount uint            `json:"internal_commands_count"`
	UserCommandsCount     uint            `json:"user_commands_count"`
	UserCommandsTypes     map[string]uint `json:"user_commands_types"`
	InternalCommandsTypes map[string]uint `json:"internal_commands_types"`
}

type UserCommand

type UserCommand struct {
	Hash                           string  `json:"hash"`
	Type                           string  `json:"type"`
	FeeToken                       int     `json:"fee_token"`
	Token                          int     `json:"token"`
	Nonce                          int     `json:"nonce"`
	Amount                         int64   `json:"amount"`
	Fee                            int64   `json:"fee"`
	ValidUntil                     *uint64 `json:"valid_until"`
	Memo                           string  `json:"memo"`
	Status                         string  `json:"status"`
	FailureReason                  *string `json:"failure_reason"`
	FeePayerAccountCreationFeePaid *uint64 `json:"fee_payer_account_creation_fee_paid"`
	ReceiverAccountCreationFeePaid *uint64 `json:"receiver_account_creation_fee_paid"`
	CreatedToken                   *uint64 `json:"created_token"`
	SequenceNo                     int     `json:"sequence_no"`
	FeePayer                       string  `json:"fee_payer"`
	Sender                         string  `json:"sender"`
	Receiver                       string  `json:"receiver"`
}

Jump to

Keyboard shortcuts

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