types

package
v0.0.0-...-a4d8579 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MempoolInclusionStatusSuccess Successfully added to mempool
	MempoolInclusionStatusSuccess = MempoolInclusionStatus(1)

	// MempoolInclusionStatusPending Pending being added to the mempool
	MempoolInclusionStatusPending = MempoolInclusionStatus(2)

	// MempoolInclusionStatusFailed Failed being added to the mempool
	MempoolInclusionStatusFailed = MempoolInclusionStatus(3)
)
View Source
const (
	// TransactionTypeIncomingTX incoming transaction
	TransactionTypeIncomingTX = TransactionType(0)

	// TransactionTypeOutgoingTX outgoing transaction
	TransactionTypeOutgoingTX = TransactionType(1)

	// TransactionTypeCoinbaseReward coinbase reward
	TransactionTypeCoinbaseReward = TransactionType(2)

	// TransactionTypeFeeReward fee reward
	TransactionTypeFeeReward = TransactionType(3)

	// TransactionTypeIncomingTrade incoming trade
	TransactionTypeIncomingTrade = TransactionType(4)

	// TransactionTypeOutgoingTrade outgoing trade
	TransactionTypeOutgoingTrade = TransactionType(5)
)
View Source
const (
	// WalletTypeStandard Standard Wallet
	WalletTypeStandard = WalletType(0)

	// WalletTypeRateLimited Rate Limited Wallet
	WalletTypeRateLimited = WalletType(1)

	// WalletTypeAtomicSwap Atomic Swap
	WalletTypeAtomicSwap = WalletType(2)

	// WalletTypeAuthorizedPayee Authorized Payee
	WalletTypeAuthorizedPayee = WalletType(3)

	// WalletTypeMultiSig Multi Sig
	WalletTypeMultiSig = WalletType(4)

	// WalletTypeCustody Custody
	WalletTypeCustody = WalletType(5)

	// WalletTypeColouredCoin Coloured Coin
	WalletTypeColouredCoin = WalletType(6)

	// WalletTypeRecoverable Recoverable Wallet
	WalletTypeRecoverable = WalletType(7)

	// WalletTypeDistributedID DID Wallet
	WalletTypeDistributedID = WalletType(8)
)

Variables

Uint128Max is the largest possible uint128 value.

Functions

This section is empty.

Types

type Address

type Address string

Address Own type for future methods to encode/decode

type BlockCountMetrics

type BlockCountMetrics struct {
	CompactBlocks   uint32 `json:"compact_blocks"`
	UncompactBlocks uint32 `json:"uncompact_blocks"`
	HintCount       uint64 `json:"hint_count"`
}

BlockCountMetrics metrics from get_block_count_metrics endpoint

type BlockEvent

type BlockEvent struct {
	TransactionBlock              bool               `json:"transaction_block"`
	KSize                         uint8              `json:"k_size"`
	HeaderHash                    string             `json:"header_hash"`
	Height                        uint32             `json:"height"`
	BlockCost                     uint64             `json:"block_cost"`
	BlockFees                     uint64             `json:"block_fees"`
	TransactionGeneratorSizeBytes uint64             `json:"transaction_generator_size_bytes"`
	TransactionGeneratorRefList   []uint32           `json:"transaction_generator_ref_list"`
	ReceiveBlockResult            ReceiveBlockResult `json:"receive_block_result"`
}

BlockEvent data from block websocket event

type BlockRecord

type BlockRecord struct {
	HeaderHash                 string             `json:"header_hash"`
	PrevHash                   string             `json:"prev_hash"`
	Height                     uint32             `json:"height"`
	Weight                     Uint128            `json:"weight"`
	TotalIters                 Uint128            `json:"total_iters"`
	SignagePointIndex          uint8              `json:"signage_point_index"`
	ChallengeVDFOutput         *ClassgroupElement `json:"challenge_vdf_output"`
	InfusedChallengeVDFOutput  *ClassgroupElement `json:"infused_challenge_vdf_output"`
	RewardInfusionNewChallenge string             `json:"reward_infusion_new_challenge"`
	ChallengeBlockInfoHash     string             `json:"challenge_block_info_hash"`
	SubSlotIters               uint64             `json:"sub_slot_iters"`
	PoolPuzzleHash             *PuzzleHash        `json:"pool_puzzle_hash"`
	FarmerPuzzleHash           *PuzzleHash        `json:"farmer_puzzle_hash"`
	RequiredIters              uint64             `json:"required_iters"`
	Deficit                    uint8              `json:"deficit"`
	Overflow                   bool               `json:"overflow"`
	PrevTransactionBlockHeight uint32             `json:"prev_transaction_block_height"`

	// Transaction Block - Present if is_transaction_block
	Timestamp                uint64  `json:"timestamp"` // @TODO time.Time ?
	PrevTransactionBlockHash string  `json:"prev_transaction_block_hash"`
	Fees                     uint64  `json:"fees"` // @TODO proper unit (mojo/xch)?
	RewardClaimsIncorporated []*Coin `json:"reward_claims_incorporated"`

	// Slot - present if this is the first SB in sub slot
	FinishedChallengeSlotHashes        []string `json:"finished_challenge_slot_hashes"`
	FinishedInfusedChallengeSlotHashes []string `json:"finished_infused_challenge_slot_hashes"`
	FinishedRewardSlotHashes           []string `json:"finished_reward_slot_hashes"`

	// Sub-epoch - present if this is the first SB after sub-epoch
	SubEpochSummaryIncluded *SubEpochSummary `json:"sub_epoch_summary_included"`
}

BlockRecord a single block record

type BlockchainState

type BlockchainState struct {
	Difficulty                  uint64          `json:"difficulty"`
	GenesisChallengeInitialized bool            `json:"genesis_challenge_initialized"`
	MempoolSize                 uint64          `json:"mempool_size"`
	MempoolCost                 uint64          `json:"mempool_cost"`
	MempoolMinFees              *MempoolMinFees `json:"mempool_min_fees"`
	MempoolMaxTotalCost         uint64          `json:"mempool_max_total_cost"`
	Peak                        *BlockRecord    `json:"peak"`
	Space                       Uint128         `json:"space"`
	SubSlotIters                uint64          `json:"sub_slot_iters"`
	Sync                        *Sync           `json:"sync"`
	BlockMaxCost                uint64          `json:"block_max_cost"`
}

BlockchainState blockchain state

type ClassgroupElement

type ClassgroupElement struct {
	Data string `json:"data"`
}

ClassgroupElement Classgroup Element

type Coin

type Coin struct {
	Amount         Mojo   `json:"amount"`
	ParentCoinInfo string `json:"parent_coin_info"`
	PuzzleHash     string `json:"puzzle_hash"`
}

Coin is a coin

type CoinAddedEvent

type CoinAddedEvent struct {
	Success  bool   `json:"success"`
	State    string `json:"state"`
	WalletID uint32 `json:"wallet_id"`
}

CoinAddedEvent data from coin-added websocket event

type CoinSolution

type CoinSolution struct {
	Coin         *Coin              `json:"coin"`
	PuzzleReveal *SerializedProgram `json:"puzzle_reveal"`
	Solution     *SerializedProgram `json:"solution"`
}

CoinSolution solution to a coin

type CompressibleVDFField

type CompressibleVDFField uint8

CompressibleVDFField Stores, for a given VDF, the field that uses it.

const (
	// CompressibleVDFFieldCCEOSVDF CC_EOS_VDF
	CompressibleVDFFieldCCEOSVDF CompressibleVDFField = 1

	// CompressibleVDFFieldICCEOSVDF ICC_EOS_VDF
	CompressibleVDFFieldICCEOSVDF CompressibleVDFField = 2

	// CompressibleVDFFieldCCSPVDF CC_SP_VDF
	CompressibleVDFFieldCCSPVDF CompressibleVDFField = 3

	// CompressibleVDFFieldCCIPVDF CC_IP_VDF
	CompressibleVDFFieldCCIPVDF CompressibleVDFField = 4
)

type Connection

type Connection struct {
	BytesRead    uint64 `json:"bytes_read"`
	BytesWritten uint64 `json:"bytes_written"`
	//CreationTime // @TODO parse to time - is seconds as float
	//LastMessageTime // @TODO parse to time - is seconds as float
	LocalPort      uint16   `json:"local_port"`
	NodeID         string   `json:"node_id"`
	PeakHash       string   `json:"peak_hash"`
	PeakHeight     uint32   `json:"peak_height"`
	PeakWeight     Uint128  `json:"peak_weight"`
	PeerHost       net.IP   `json:"peer_host"`
	PeerPort       uint16   `json:"peer_port"`
	PeerServerPort uint16   `json:"peer_server_port"`
	Type           NodeType `json:"type"`
}

Connection represents a single peer or internal connection

type CrawlerPeerCounts

type CrawlerPeerCounts struct {
	TotalLast5Days uint           `json:"total_last_5_days"`
	ReliableNodes  uint           `json:"reliable_nodes"`
	IPV4Last5Days  uint           `json:"ipv4_last_5_days"`
	IPV6Last5Days  uint           `json:"ipv6_last_5_days"`
	Versions       map[string]int `json:"versions"`
}

CrawlerPeerCounts peer_count data from the crawler

type EndOfSubSlotBundle

type EndOfSubSlotBundle struct {
}

EndOfSubSlotBundle end of subslot bundle

type FinishedPoTEvent

type FinishedPoTEvent struct {
	Success          bool          `json:"success"`
	Chain            TimelordChain `json:"chain"`
	EstimatedIPS     float64       `json:"estimated_ips"`
	IterationsNeeded uint64        `json:"iterations_needed"`
	VDFInfo          VDFInfo       `json:"vdf_info"`
	VDFProof         VDFProof      `json:"vdf_proof"`
}

FinishedPoTEvent data every time a PoT Challenge is completed

type Foliage

type Foliage struct {
	PrevBlockHash                    string            `json:"prev_block_hash"`
	RewardBlockHash                  string            `json:"reward_block_hash"`
	FoliageBlockData                 *FoliageBlockData `json:"foliage_block_data"`
	FoliageBlockDataSignature        *G2Element        `json:"foliage_block_data_signature"`
	FoliageTransactionBlockHash      string            `json:"foliage_transaction_block_hash"`
	FoliageTransactionBlockSignature *G2Element        `json:"foliage_transaction_block_signature"`
}

Foliage Foliage

type FoliageBlockData

type FoliageBlockData struct {
	UnfinishedRewardBlockHash string      `json:"unfinished_reward_block_hash"`
	PoolTarget                *PoolTarget `json:"pool_target"`
	PoolSignature             *G2Element  `json:"pool_signature"`
	FarmerRewardPuzzleHash    string      `json:"farmer_reward_puzzle_hash"`
	ExtensionData             string      `json:"extension_data"`
}

FoliageBlockData FoliageBlockData

type FoliageTransactionBlock

type FoliageTransactionBlock struct {
	PrevTransactionBlockHash string `json:"prev_transaction_block_hash"`
	Timestamp                uint64 `json:"timestamp"` // @TODO time.Time?
	FilterHash               string `json:"filter_hash"`
	AdditionsRoot            string `json:"additions_root"`
	RemovalsRoot             string `json:"removals_root"`
	TransactionsInfoHash     string `json:"transactions_info_hash"`
}

FoliageTransactionBlock foliage transaction block

type FullBlock

type FullBlock struct {
	FinishedSubSlots             []*EndOfSubSlotBundle    `json:"finished_sub_slots"`
	RewardChainBlock             *RewardChainBlock        `json:"reward_chain_block"`
	ChallengeChainSPProof        *VDFProof                `json:"challenge_chain_sp_proof"`
	ChallengeChainIPProof        *VDFProof                `json:"challenge_chain_ip_proof"`
	RewardChainSPProof           *VDFProof                `json:"reward_chain_sp_proof"`
	RewardChainIPProof           *VDFProof                `json:"reward_chain_ip_proof"`
	InfusedChallengeChainIPProof *VDFProof                `json:"infused_challenge_chain_ip_proof"`
	Foliage                      *Foliage                 `json:"foliage"`
	FoliageTransactionBlock      *FoliageTransactionBlock `json:"foliage_transaction_block"`
	TransactionsInfo             *TransactionsInfo        `json:"transactions_info"`
	TransactionsGenerator        *SerializedProgram       `json:"transactions_generator"`          // @TODO Verify this is correct
	TransactionsGeneratorRefList []uint32                 `json:"transactions_generator_ref_list"` // @TODO Verify this is correct
}

FullBlock a full block

type G1Element

type G1Element string

G1Element String for now, can make better later if we need

type G2Element

type G2Element string

G2Element String for now, can make better later if we need

type MempoolInclusionStatus

type MempoolInclusionStatus uint8

MempoolInclusionStatus status of being included in the mempool

type MempoolMinFees

type MempoolMinFees struct {
	Cost5m uint64 `json:"cost_5000000"`
}

MempoolMinFees minimum fees to get in the mempool at varying costs

type Mojo

type Mojo int64

Mojo is a special type for Mojos, to keep track of what unit an amount is

func (Mojo) MarshalJSON

func (m Mojo) MarshalJSON() ([]byte, error)

MarshalJSON marshals Mojo into json

func (Mojo) ToChia

func (m Mojo) ToChia() XCH

ToChia converts mojo to chia

func (*Mojo) UnmarshalJSON

func (m *Mojo) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals json data into Mojo

type NewCompactProofEvent

type NewCompactProofEvent struct {
	Success    bool                 `json:"success"`
	HeaderHash string               `json:"header_hash"`
	Height     uint32               `json:"height"`
	FieldVdf   CompressibleVDFField `json:"field_vdf"`
}

NewCompactProofEvent is an event from the timelord every time a new compact proof is generated

type NewPeakEvent

type NewPeakEvent struct {
	Success bool   `json:"success"`
	Height  uint32 `json:"height"`
}

NewPeakEvent data that is sent when a timelord skips a peak because it was fastest/already had the peak

type NewSignagePoint

type NewSignagePoint struct {
	ChallengeHash      string `json:"challenge_hash"`
	ChallengeChainHash string `json:"challenge_chain_hash"`
	RewardChainSP      string `json:"reward_chain_sp"`
	Difficulty         uint64 `json:"difficulty"`
	SubSlotIters       uint64 `json:"sub_slot_iters"`
	SignagePointIndex  uint8  `json:"signage_point_index"`
}

NewSignagePoint is the event broadcast to farmers for a new signage point @TODO this is a protocol/streamable message that should be in lib

type NodeType

type NodeType uint8

NodeType is the type of peer (farmer, full node, etc)

const (
	// NodeTypeFullNode NodeType for full node
	NodeTypeFullNode NodeType = 1

	// NodeTypeHarvester NodeType for Harvester
	NodeTypeHarvester NodeType = 2

	// NodeTypeFarmer NodeType for Farmer
	NodeTypeFarmer NodeType = 3

	// NodeTypeTimelord NodeType for Timelord
	NodeTypeTimelord NodeType = 4

	// NodeTypeIntroducer NodeType for Introducer
	NodeTypeIntroducer NodeType = 5

	// NodeTypeWallet NodeType for Wallet
	NodeTypeWallet NodeType = 6
)

type PoolTarget

type PoolTarget struct {
	PuzzleHash *PuzzleHash `json:"puzzle_hash"`
	MaxHeight  uint32      `json:"max_height"`
}

PoolTarget PoolTarget

type ProofOfSpace

type ProofOfSpace struct {
	Challenge              string      `json:"challenge"`
	PoolPublicKey          *G1Element  `json:"pool_public_key"` // Only one of these two should be present
	PoolContractPuzzleHash *PuzzleHash `json:"pool_contract_puzzle_hash"`
	PlotPublicKey          *G1Element  `json:"plot_public_key"`
	Size                   uint8       `json:"size"`
	Proof                  string      `json:"proof"`
}

ProofOfSpace Proof of Space

type PuzzleHash

type PuzzleHash string

PuzzleHash Own type for future methods to encode/decode

type ReceiveBlockResult

type ReceiveBlockResult uint8

ReceiveBlockResult When Blockchain.receive_block(b) is called, one of these results is returned, showing whether the block was added to the chain (extending the peak), and if not, why it was not added. These values match values in chia blockchain. Must not be arbitrarily changed

const (
	// ReceiveBlockResultNewPeak Added to the peak of the blockchain
	ReceiveBlockResultNewPeak ReceiveBlockResult = 1

	// ReceiveBlockResultOrphan Added as an orphan/stale block (not a new peak of the chain)
	ReceiveBlockResultOrphan ReceiveBlockResult = 2

	// ReceiveBlockResultInvalidBlock Block was not added because it was invalid
	ReceiveBlockResultInvalidBlock ReceiveBlockResult = 3

	// ReceiveBlockResultAlreadyHaveBlock Block is already present in this blockchain
	ReceiveBlockResultAlreadyHaveBlock ReceiveBlockResult = 4

	// ReceiveBlockResultDisconnectedBlock Block's parent (previous pointer) is not in this blockchain
	ReceiveBlockResultDisconnectedBlock ReceiveBlockResult = 5
)

type RewardChainBlock

type RewardChainBlock struct {
	Weight                     Uint128       `json:"weight"`
	Height                     uint32        `json:"height"`
	TotalIters                 Uint128       `json:"total_iters"`
	SignagePointIndex          uint8         `json:"signage_point_index"`
	POSSSCCChallengeHash       string        `json:"pos_ss_cc_challenge_hash"`
	ProofOfSpace               *ProofOfSpace `json:"proof_of_space"`
	ChallengeChainSPVDF        *VDFInfo      `json:"challenge_chain_sp_vdf"`
	ChallengeChainSPSignature  *G2Element    `json:"challenge_chain_sp_signature"`
	ChallengeChainIPVDF        *VDFInfo      `json:"challenge_chain_ip_vdf"`
	RewardChainSPVDF           *VDFInfo      `json:"reward_chain_sp_vdf"` // Not present for first sp in slot
	RewardChainSPSignature     *G2Element    `json:"reward_chain_sp_signature"`
	RewardChainIPVDF           *VDFInfo      `json:"reward_chain_ip_vdf"`
	InfusedChallengeChainIPVDF *VDFInfo      `json:"infused_challenge_chain_ip_vdf"` // Iff deficit < 16
	IsTransactionBlock         bool          `json:"is_transaction_block"`
}

RewardChainBlock Reward Chain Block

type SentTo

type SentTo struct {
	Peer                   string
	MempoolInclusionStatus *MempoolInclusionStatus
	Error                  string
}

SentTo Represents the list of peers that we sent the transaction to, whether each one included it in the mempool, and what the error message (if any) was sent_to: List[Tuple[str, uint8, Optional[str]]] @TODO need to parse from the json

type SerializedProgram

type SerializedProgram string

SerializedProgram Just represent as a string for now

type SignagePointEvent

type SignagePointEvent struct {
	Success         bool            `json:"success"`
	BroadcastFarmer NewSignagePoint `json:"broadcast_farmer"`
}

SignagePointEvent is the data received for each signage point

type SkippingPeakEvent

type SkippingPeakEvent struct {
	Success bool   `json:"success"`
	Height  uint32 `json:"height"`
}

SkippingPeakEvent data that is sent when a timelord skips a peak because it was fastest/already had the peak

type SpendBundle

type SpendBundle struct {
	AggregatedSignature string          `json:"aggregated_signature"`
	CoinSolutions       []*CoinSolution `json:"coin_solutions"`
}

SpendBundle Spend Bundle...

type SubEpochSummary

type SubEpochSummary struct {
	PrevSubEpochSummaryHash string `json:"prev_subepoch_summary_hash"`
	RewardChainHash         string `json:"reward_chain_hash"`
	NumBlocksOverflow       uint8  `json:"num_blocks_overflow"`
	NewDifficulty           uint64 `json:"new_difficulty"`
	NewSubSlotIters         uint64 `json:"new_sub_slot_iters"`
}

SubEpochSummary sub epoch summary

type Sync

type Sync struct {
	SyncMode           bool   `json:"sync_mode"`
	SyncProgressHeight uint32 `json:"sync_progress_height"`
	SyncTipHeight      uint32 `json:"sync_tip_height"`
	Synced             bool   `json:"synced"`
}

Sync struct within blockchain state

type TimelordChain

type TimelordChain uint8

TimelordChain references a particular chain within timelord code

const (
	// TimelordChainChallenge Challenge Chain
	TimelordChainChallenge TimelordChain = 1

	// TimelordChainReward Reward Chain
	TimelordChainReward TimelordChain = 2

	// TimelordChainInfusedChallenge Infused Challenge Chain
	TimelordChainInfusedChallenge TimelordChain = 3

	// TimelordChainBluebox Bluebox Chain
	TimelordChainBluebox TimelordChain = 4
)

type TransactionRecord

type TransactionRecord struct {
	ConfirmedAtHeight uint32       `json:"confirmed_at_height"`
	CreatedAtTime     uint64       `json:"created_at_time"` // @TODO time.Time?
	ToPuzzleHash      *PuzzleHash  `json:"to_puzzle_hash"`
	Amount            uint64       `json:"amount"`
	FeeAmount         uint64       `json:"fee_amount"`
	Confirmed         bool         `json:"confirmed"`
	Sent              uint32       `json:"sent"`
	SpendBundle       *SpendBundle `json:"spend_bundle"`
	Additions         []*Coin      `json:"additions"`
	Removals          []*Coin      `json:"removals"`
	WalletID          uint32       `json:"wallet_id"`
	//SentTo            SentTo          `json:"sent_to"` // @TODO need to properly unserialize this
	TradeID string           `json:"trade_id"`
	Type    *TransactionType `json:"type"`
	Name    string           `json:"name"` // @TODO bytes32 / hex
	// ToAddress is not on the official type, but some endpoints return it anyways
	ToAddress *Address `json:"to_address"`
}

TransactionRecord Single Transaction

type TransactionType

type TransactionType uint32

TransactionType type of transaction

type TransactionsInfo

type TransactionsInfo struct {
	GeneratorRoot            string     `json:"generator_root"`
	GeneratorRefsRoot        string     `json:"generator_refs_root"`
	AggregatedSignature      *G2Element `json:"aggregated_signature"`
	Fees                     uint64     `json:"fees"`
	Cost                     uint64     `json:"cost"`
	RewardClaimsIncorporated []*Coin    `json:"reward_claims_incorporated"`
}

TransactionsInfo transactions info

type Uint128

type Uint128 struct {
	Lo, Hi uint64
}

A Uint128 is an unsigned 128-bit number.

var Uint128Zero Uint128

Uint128Zero is a zero-valued uint128.

func NewUint128

func NewUint128(lo, hi uint64) Uint128

NewUint128 returns the Uint128 value (lo,hi).

func Uint128From64

func Uint128From64(v uint64) Uint128

Uint128From64 converts v to a Uint128 value.

func Uint128FromBig

func Uint128FromBig(i *big.Int) (u Uint128)

Uint128FromBig converts i to a Uint128 value. It panics if i is negative or overflows 128 bits.

func Uint128FromBytes

func Uint128FromBytes(b []byte) Uint128

Uint128FromBytes converts b to a Uint128 value.

func (Uint128) Add

func (u Uint128) Add(v Uint128) Uint128

Add returns u+v.

func (Uint128) Add64

func (u Uint128) Add64(v uint64) Uint128

Add64 returns u+v.

func (Uint128) AddWrap

func (u Uint128) AddWrap(v Uint128) Uint128

AddWrap returns u+v with wraparound semantics; for example, Max.AddWrap(From64(1)) == Zero.

func (Uint128) AddWrap64

func (u Uint128) AddWrap64(v uint64) Uint128

AddWrap64 returns u+v with wraparound semantics; for example, Max.AddWrap64(1) == Zero.

func (Uint128) And

func (u Uint128) And(v Uint128) Uint128

And returns u&v.

func (Uint128) And64

func (u Uint128) And64(v uint64) Uint128

And64 returns u&v.

func (Uint128) Big

func (u Uint128) Big() *big.Int

Big returns u as a *big.Int.

func (Uint128) Cmp

func (u Uint128) Cmp(v Uint128) int

Cmp compares u and v and returns:

-1 if u <  v
 0 if u == v
+1 if u >  v

func (Uint128) Cmp64

func (u Uint128) Cmp64(v uint64) int

Cmp64 compares u and v and returns:

-1 if u <  v
 0 if u == v
+1 if u >  v

func (Uint128) Div

func (u Uint128) Div(v Uint128) Uint128

Div returns u/v.

func (Uint128) Div64

func (u Uint128) Div64(v uint64) Uint128

Div64 returns u/v.

func (Uint128) Equals

func (u Uint128) Equals(v Uint128) bool

Equals returns true if u == v.

Uint128 values can be compared directly with ==, but use of the Equals method is preferred for consistency.

func (Uint128) Equals64

func (u Uint128) Equals64(v uint64) bool

Equals64 returns true if u == v.

func (*Uint128) FitsInUint64

func (u *Uint128) FitsInUint64() bool

FitsInUint64 returns true if the value of the Uint128 will fit in Uint64

func (Uint128) IsZero

func (u Uint128) IsZero() bool

IsZero returns true if u == 0.

func (Uint128) LeadingZeros

func (u Uint128) LeadingZeros() int

LeadingZeros returns the number of leading zero bits in u; the result is 128 for u == 0.

func (Uint128) Len

func (u Uint128) Len() int

Len returns the minimum number of bits required to represent u; the result is 0 for u == 0.

func (Uint128) Lsh

func (u Uint128) Lsh(n uint) (s Uint128)

Lsh returns u<<n.

func (*Uint128) MarshalJSON

func (u *Uint128) MarshalJSON() ([]byte, error)

MarshalJSON marshals the uint128 value to json

func (Uint128) Mod

func (u Uint128) Mod(v Uint128) (r Uint128)

Mod returns r = u%v.

func (Uint128) Mod64

func (u Uint128) Mod64(v uint64) (r uint64)

Mod64 returns r = u%v.

func (Uint128) Mul

func (u Uint128) Mul(v Uint128) Uint128

Mul returns u*v, panicking on overflow.

func (Uint128) Mul64

func (u Uint128) Mul64(v uint64) Uint128

Mul64 returns u*v, panicking on overflow.

func (Uint128) MulWrap

func (u Uint128) MulWrap(v Uint128) Uint128

MulWrap returns u*v with wraparound semantics; for example, Max.MulWrap(Max) == 1.

func (Uint128) MulWrap64

func (u Uint128) MulWrap64(v uint64) Uint128

MulWrap64 returns u*v with wraparound semantics; for example, Max.MulWrap64(2) == Max.Sub64(1).

func (Uint128) OnesCount

func (u Uint128) OnesCount() int

OnesCount returns the number of one bits ("population count") in u.

func (Uint128) Or

func (u Uint128) Or(v Uint128) Uint128

Or returns u|v.

func (Uint128) Or64

func (u Uint128) Or64(v uint64) Uint128

Or64 returns u|v.

func (Uint128) PutBytes

func (u Uint128) PutBytes(b []byte)

PutBytes stores u in b in little-endian order. It panics if len(b) < 16.

func (Uint128) QuoRem

func (u Uint128) QuoRem(v Uint128) (q, r Uint128)

QuoRem returns q = u/v and r = u%v.

func (Uint128) QuoRem64

func (u Uint128) QuoRem64(v uint64) (q Uint128, r uint64)

QuoRem64 returns q = u/v and r = u%v.

func (Uint128) Reverse

func (u Uint128) Reverse() Uint128

Reverse returns the value of u with its bits in reversed order.

func (Uint128) ReverseBytes

func (u Uint128) ReverseBytes() Uint128

ReverseBytes returns the value of u with its bytes in reversed order.

func (Uint128) RotateLeft

func (u Uint128) RotateLeft(k int) Uint128

RotateLeft returns the value of u rotated left by (k mod 128) bits.

func (Uint128) RotateRight

func (u Uint128) RotateRight(k int) Uint128

RotateRight returns the value of u rotated left by (k mod 128) bits.

func (Uint128) Rsh

func (u Uint128) Rsh(n uint) (s Uint128)

Rsh returns u>>n.

func (Uint128) String

func (u Uint128) String() string

String returns the base-10 representation of u as a string.

func (Uint128) Sub

func (u Uint128) Sub(v Uint128) Uint128

Sub returns u-v.

func (Uint128) Sub64

func (u Uint128) Sub64(v uint64) Uint128

Sub64 returns u-v.

func (Uint128) SubWrap

func (u Uint128) SubWrap(v Uint128) Uint128

SubWrap returns u-v with wraparound semantics; for example, Zero.SubWrap(From64(1)) == Max.

func (Uint128) SubWrap64

func (u Uint128) SubWrap64(v uint64) Uint128

SubWrap64 returns u-v with wraparound semantics; for example, Zero.SubWrap64(1) == Max.

func (Uint128) TrailingZeros

func (u Uint128) TrailingZeros() int

TrailingZeros returns the number of trailing zero bits in u; the result is 128 for u == 0.

func (*Uint128) Uint64

func (u *Uint128) Uint64() uint64

Uint64 returns the Uint64 value of the Int Be careful with this - if the number is larger than Uint64, it will just return nonsense

func (*Uint128) UnmarshalJSON

func (u *Uint128) UnmarshalJSON(data []byte) error

UnmarshalJSON Uint128 from json

func (Uint128) Xor

func (u Uint128) Xor(v Uint128) Uint128

Xor returns u^v.

func (Uint128) Xor64

func (u Uint128) Xor64(v uint64) Uint128

Xor64 returns u^v.

type VDFInfo

type VDFInfo struct {
	Challenge          string             `json:"challenge"`
	NumberOfIterations uint64             `json:"number_of_iterations"`
	Output             *ClassgroupElement `json:"output"`
}

VDFInfo VDF Info

type VDFProof

type VDFProof struct {
	WitnessType          uint8  `json:"witness_type"`
	Witness              string `json:"witness"`
	NormalizedToIdentity bool   `json:"normalized_to_identity"`
}

VDFProof VDF Proof

type WalletBalance

type WalletBalance struct {
	WalletID                 int32   `json:"wallet_id"`
	Fingerprint              int     `json:"fingerprint"`
	ConfirmedWalletBalance   Uint128 `json:"confirmed_wallet_balance"`
	UnconfirmedWalletBalance Uint128 `json:"unconfirmed_wallet_balance"`
	SpendableBalance         Uint128 `json:"spendable_balance"`
	PendingChange            int64   `json:"pending_change"`
	MaxSendAmount            int64   `json:"max_send_amount"`
	UnspentCoinCount         int64   `json:"unspent_coin_count"`
	PendingCoinRemovalCount  int64   `json:"pending_coin_removal_count"`
}

WalletBalance specific wallet balance information

type WalletInfo

type WalletInfo struct {
	Data string      `json:"data"`
	ID   uint32      `json:"id"`
	Name string      `json:"name"`
	Type *WalletType `json:"type"`
}

WalletInfo single wallet record

type WalletType

type WalletType uint8

WalletType types of wallets This matches constants on the chia-blockchain end as well. Don't change to arbitrary values.

type WebsocketBlockchainState

type WebsocketBlockchainState struct {
	BlockchainState BlockchainState `json:"blockchain_state"`
}

WebsocketBlockchainState is how blockchain_state comes across in the websockets (wrapped)

type WebsocketRequest

type WebsocketRequest struct {
	Command     string      `json:"command"`
	Ack         bool        `json:"ack"`
	Origin      string      `json:"origin"`
	Destination string      `json:"destination"`
	RequestID   string      `json:"request_id"`
	Data        interface{} `json:"data"`
}

WebsocketRequest defines a request sent over the websocket connection

type WebsocketResponse

type WebsocketResponse struct {
	Command     string          `json:"command"`
	Ack         bool            `json:"ack"`
	Origin      string          `json:"origin"`
	Destination string          `json:"destination"`
	RequestID   string          `json:"request_id"`
	Data        json.RawMessage `json:"data"`
}

WebsocketResponse defines the response structure received over the websocket connection

type WebsocketSubscription

type WebsocketSubscription struct {
	Service string `json:"service"`
}

WebsocketSubscription is the Data for a new subscribe request

type XCH

type XCH float64

XCH is a special type for Chia, to keep track of what unit an amount is

func (XCH) MarshalJSON

func (xch XCH) MarshalJSON() ([]byte, error)

MarshalJSON marshals XCH into json

func (XCH) ToMojo

func (xch XCH) ToMojo() Mojo

ToMojo converts chia to mojos

func (*XCH) UnmarshalJSON

func (xch *XCH) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals json data into XCH

Jump to

Keyboard shortcuts

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