types

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func YoctoToNEAR

func YoctoToNEAR(yocto Balance) uint64

TODO

Types

type AccountID

type AccountID = string

Account identifier. Provides access to user's state.

type Balance

type Balance uint128.Uint128

Balance holds amount of yoctoNEAR

func BalanceFromFloat

func BalanceFromFloat(f float64) (bal Balance)

TODO

func BalanceFromString

func BalanceFromString(s string) (bal Balance, err error)

TODO

func NEARToYocto

func NEARToYocto(near uint64) Balance

TODO

func (Balance) Div64

func (bal Balance) Div64(div uint64) Balance

Convenience funcs

func (Balance) MarshalJSON

func (bal Balance) MarshalJSON() ([]byte, error)

func (Balance) String

func (bal Balance) String() string

func (*Balance) UnmarshalJSON

func (bal *Balance) UnmarshalJSON(b []byte) error

type BlockHeader added in v0.2.3

type BlockHeader struct {
	Height                int           `json:"height"`
	EpochID               string        `json:"epoch_id"`
	NextEpochID           string        `json:"next_epoch_id"`
	Hash                  string        `json:"hash"`
	PrevHash              string        `json:"prev_hash"`
	PrevStateRoot         string        `json:"prev_state_root"`
	ChunkReceiptsRoot     string        `json:"hunk_receipts_root"`
	ChunkHeadersRoot      string        `json:"chunk_headers_root"`
	ChunkTxRoot           string        `json:"chunk_tx_root"`
	OutcomeToot           string        `json:"outcome_root"`
	ChunksIncluded        int           `json:"chunks_included"`
	ChallengesRoot        string        `json:"challenges_root"`
	Timestamp             int           `json:"timestamp"`
	TimestampNanosec      string        `json:"timestamp_nanosec"`
	RandomValue           string        `json:"random_value"`
	ValidatorProposals    []interface{} `json:"validator_proposals"` // TODO: what with this?
	ChunkMask             []bool        `json:"chunk_mask"`
	GasPrice              string        `json:"gas_price"`
	RentPaid              string        `json:"rent_paid"`
	ValidatorReward       string        `json:"validator_reward"`
	TotalSupply           string        `json:"total_supply"`
	ChallengesResult      []interface{} `json:"challenges_result"` // TODO: what with this?
	LastFinalBlock        string        `json:"last_final_block"`
	LastDsFinalBlock      string        `json:"last_ds_final_block"`
	NextBpHash            string        `json:"next_bp_hash"`
	BlockMerkleRoot       string        `json:"block_merkle_root"`
	Approvals             []string      `json:"approvals"`
	Signature             string        `json:"signature"`
	LatestProtocolVersion int           `json:"latest_protocol_version"`
}

BlockHeader contains information about a block header.

type BlockHeight

type BlockHeight = uint64

BlockHeight is used for height of the block

type BlockRequest added in v0.2.3

type BlockRequest struct {
	BlockID  interface{} `json:"block_id,omitempty"`
	Finality string      `json:"finality,omitempty"`
}

BlockRequest is used for RPC block requests.

type BlockResult added in v0.2.3

type BlockResult struct {
	Author string       `json:"author"`
	Header *BlockHeader `json:"header"`
	Chunks []*Chunk     `json:"chunks"`
}

BlockResult contains information about a block result.

type ChangesRequest added in v0.2.3

type ChangesRequest struct {
	ChangesType     string      `json:"changes_type"`
	AccountIDs      []string    `json:"account_ids"`
	KeyPrefixBase64 string      `json:"key_prefix_base64"`
	Finality        string      `json:"finality,omitempty"`
	BlockID         interface{} `json:"block_id,omitempty"`
}

ChangesRequest is used for RPC changes requests.

type Chunk added in v0.2.3

type Chunk struct {
	ChunkHash            string        `json:"chunk_hash"`
	PrevBlockHash        string        `json:"prev_block_hash"`
	OutcomeRoot          string        `json:"outcome_root"`
	PrevStateRoot        string        `json:"prev_state_root"`
	EncodedMerkleRoot    string        `json:"encoded_merkle_root"`
	EncodedLength        int           `json:"encoded_length"`
	HeightCreated        int           `json:"height_created"`
	HeightIncluded       int           `json:"height_included"`
	ShardID              int           `json:"shard_id"`
	GasUsed              int           `json:"gas_used"`
	GasLimit             int           `json:"gas_limit"`
	RentPaid             string        `json:"rent_paid"`
	ValidatorReward      string        `json:"validator_reward"`
	BalanceBurnt         string        `json:"balance_burnt"`
	OutgoingReceiptsRoot string        `json:"outgoing_receipts_root"`
	TxRoot               string        `json:"tx_root"`
	ValidatorProposals   []interface{} `json:"validator_proposals"` // TODO: what with this?
	Signature            string        `json:"signature"`
}

Chunk contains information about a chunk.

type Gas

type Gas = uint64

Gas is a type for storing amounts of gas.

var (
	// 30 TGas
	DefaultFunctionCallGas Gas = 30 * 1000000000000
)

type Nonce

type Nonce = uint64

Nonce for transactions.

type NumBlocks

type NumBlocks = uint64

NumBlocks holds number of blocks in current group.

type QueryRequest added in v0.2.3

type QueryRequest struct {
	RequestType  string      `json:"request_type"`
	Finality     string      `json:"finality,omitempty"`
	BlockID      interface{} `json:"block_id,omitempty"`
	AccountID    string      `json:"account_id,omitempty"`
	PrefixBase64 string      `json:"prefix_base64"`
	MethodName   string      `json:"method_name,omitempty"`
	ArgsBase64   string      `json:"args_base64"`
	PublicKey    string      `json:"public_key,omitempty"`
}

QueryRequest is used for RPC query requests.

type QueryResponse added in v0.2.3

type QueryResponse struct {
	BlockHash   string `json:"block_hash"`
	BlockHeight int    `json:"block_height"`
	// TODO: this property is undocumented, but appears in some API responses. Is this the right place for it?
	Error string `json:"error"`
}

QueryResponse is a base type used for responses to query requests.

type ShardID

type ShardID = uint64

ShardID is used for a shard index, from 0 to NUM_SHARDS - 1.

type StorageUsage

type StorageUsage = uint64

StorageUsage is used to count the amount of storage used by a contract.

type TimeNanos

type TimeNanos = Balance

Time nanoseconds fit into uint128. Using existing Balance type which implements JSON marshal/unmarshal

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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