types

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 13 Imported by: 18

Documentation

Index

Constants

View Source
const (
	HashTypeData  ScriptHashType = "data"
	HashTypeData1 ScriptHashType = "data1"
	HashTypeData2 ScriptHashType = "data2"
	HashTypeType  ScriptHashType = "type"

	DepTypeCode     DepType = "code"
	DepTypeDepGroup DepType = "dep_group"

	TransactionStatusPending   TransactionStatus = "pending"
	TransactionStatusProposed  TransactionStatus = "proposed"
	TransactionStatusCommitted TransactionStatus = "committed"
	TransactionStatusUnknown   TransactionStatus = "unknown"
	TransactionStatusRejected  TransactionStatus = "rejected"

	DefaultBytesPerCycle float64 = 0.000_170_571_4
)
View Source
const (
	HashLength = 32

	NetworkMain Network = iota
	NetworkTest
	NetworkPreview

	WitnessTypeLock WitnessType = iota
	WitnessTypeInputType
	WitnessTypeOutputType

	ScriptTypeLock ScriptType = "lock"
	ScriptTypeType ScriptType = "type"

	ScriptSearchModePrefix ScriptSearchMode = "prefix"
	ScriptSearchModeExact  ScriptSearchMode = "exact"
)

Variables

This section is empty.

Functions

func PackByte

func PackByte(v byte) *molecule.Byte

func PackBytes

func PackBytes(v []byte) *molecule.Bytes

func PackBytesToOpt

func PackBytesToOpt(v []byte) *molecule.BytesOpt

func PackBytesVec

func PackBytesVec(v [][]byte) *molecule.BytesVec

func PackUint32

func PackUint32(v uint32) *molecule.Uint32

func PackUint64

func PackUint64(v uint64) *molecule.Uint64

func SerializeHashTypeByte

func SerializeHashTypeByte(hashType ScriptHashType) (byte, error)

func SerializeUint32

func SerializeUint32(n uint32) []byte

func SerializeUint64

func SerializeUint64(n uint64) []byte

func UnpackBytes

func UnpackBytes(v *molecule.Bytes) []byte

Types

type AlertMessage

type AlertMessage struct {
	Id          uint32 `json:"id"`
	Message     string `json:"message"`
	NoticeUntil uint64 `json:"notice_until"`
	Priority    uint32 `json:"priority"`
}

type AncestorsScoreSortKey added in v2.3.0

type AncestorsScoreSortKey struct {
	AncestorsFee    uint64 `json:"ancestors_fee"`
	AncestorsWeight uint64 `json:"ancestors_weight"`
	Fee             uint64 `json:"fee"`
	Weight          uint64 `json:"weight"`
}

type BannedAddress

type BannedAddress struct {
	Address   string `json:"address"`
	BanReason string `json:"ban_reason"`
	BanUntil  uint64 `json:"ban_until"`
	CreatedAt uint64 `json:"created_at"`
}

func (*BannedAddress) UnmarshalJSON

func (r *BannedAddress) UnmarshalJSON(input []byte) error

type BatchLiveCellItem

type BatchLiveCellItem struct {
	OutPoint OutPoint
	WithData bool
	Result   *CellWithStatus
	Error    error
}

type BatchTransactionItem

type BatchTransactionItem struct {
	Hash   Hash
	Result *TransactionWithStatus
	Error  error
}

refer BatchElem from go-ethereum

type Block

type Block struct {
	Header       *Header        `json:"header"`
	Proposals    []string       `json:"proposals"`
	Transactions []*Transaction `json:"transactions"`
	Uncles       []*UncleBlock  `json:"uncles"`
}

func UnpackBlock added in v2.2.0

func UnpackBlock(v *molecule.Block) *Block

type BlockEconomicState

type BlockEconomicState struct {
	Issuance    BlockIssuance `json:"issuance"`
	MinerReward MinerReward   `json:"miner_reward"`
	TxsFee      uint64        `json:"txs_fee"`
	FinalizedAt Hash          `json:"finalized_at"`
}

func (*BlockEconomicState) UnmarshalJSON

func (r *BlockEconomicState) UnmarshalJSON(input []byte) error

type BlockIssuance

type BlockIssuance struct {
	Primary   uint64 `json:"primary"`
	Secondary uint64 `json:"secondary"`
}

type BlockReward

type BlockReward struct {
	Primary        *big.Int `json:"primary"`
	ProposalReward *big.Int `json:"proposal_reward"`
	Secondary      *big.Int `json:"secondary"`
	Total          *big.Int `json:"total"`
	TxFee          *big.Int `json:"tx_fee"`
}

type BlockWithCycles added in v2.2.0

type BlockWithCycles struct {
	Block  *Block   `json:"block"`
	Cycles []uint64 `json:"cycles"`
}

type BlockchainInfo

type BlockchainInfo struct {
	Alerts                 []*AlertMessage `json:"alerts"`
	Chain                  string          `json:"chain"`
	Difficulty             *big.Int        `json:"difficulty"`
	Epoch                  uint64          `json:"epoch"`
	IsInitialBlockDownload bool            `json:"is_initial_block_download"`
	MedianTime             uint64          `json:"median_time"`
}

func (*BlockchainInfo) UnmarshalJSON

func (r *BlockchainInfo) UnmarshalJSON(input []byte) error

type Cell

type Cell struct {
	BlockHash     Hash      `json:"block_hash"`
	Capacity      uint64    `json:"capacity"`
	Lock          *Script   `json:"lock"`
	OutPoint      *OutPoint `json:"out_point"`
	Type          *Script   `json:"type"`
	Cellbase      bool      `json:"cellbase,omitempty"`
	OutputDataLen uint64    `json:"output_data_len,omitempty"`
}

type CellData

type CellData struct {
	Content []byte `json:"content"`
	Hash    Hash   `json:"hash"`
}

func (CellData) MarshalJSON

func (r CellData) MarshalJSON() ([]byte, error)

func (*CellData) UnmarshalJSON

func (r *CellData) UnmarshalJSON(input []byte) error

type CellDep

type CellDep struct {
	OutPoint *OutPoint `json:"out_point"`
	DepType  DepType   `json:"dep_type"`
}

func UnpackCellDep added in v2.2.0

func UnpackCellDep(v *molecule.CellDep) *CellDep

func (*CellDep) Pack

func (t *CellDep) Pack() *molecule.CellDep

func (*CellDep) Serialize

func (d *CellDep) Serialize() []byte

type CellInfo

type CellInfo struct {
	Data   *CellData   `json:"data"`
	Output *CellOutput `json:"output"`
}

type CellInput

type CellInput struct {
	Since          uint64    `json:"since"`
	PreviousOutput *OutPoint `json:"previous_output"`
}

func UnpackCellInput added in v2.2.0

func UnpackCellInput(v *molecule.CellInput) *CellInput

func (CellInput) MarshalJSON

func (r CellInput) MarshalJSON() ([]byte, error)

func (*CellInput) Pack

func (r *CellInput) Pack() *molecule.CellInput

func (*CellInput) Serialize

func (r *CellInput) Serialize() []byte

func (*CellInput) UnmarshalJSON

func (r *CellInput) UnmarshalJSON(input []byte) error

type CellOutput

type CellOutput struct {
	Capacity uint64  `json:"capacity"`
	Lock     *Script `json:"lock"`
	Type     *Script `json:"type"`
}

func UnpackCellOutput added in v2.2.0

func UnpackCellOutput(v *molecule.CellOutput) *CellOutput

func (CellOutput) MarshalJSON

func (r CellOutput) MarshalJSON() ([]byte, error)

func (CellOutput) OccupiedCapacity

func (r CellOutput) OccupiedCapacity(outputData []byte) uint64

func (*CellOutput) Pack

func (r *CellOutput) Pack() *molecule.CellOutput

func (*CellOutput) Serialize

func (r *CellOutput) Serialize() []byte

func (*CellOutput) UnmarshalJSON

func (r *CellOutput) UnmarshalJSON(input []byte) error

type CellWithStatus

type CellWithStatus struct {
	Cell   *CellInfo `json:"cell"`
	Status string    `json:"status"`
}

type Consensus

type Consensus struct {
	Id                                   string           `json:"ID"`
	GenesisHash                          Hash             `json:"genesis_hash"`
	DaoTypeHash                          *Hash            `json:"dao_type_hash"`
	Secp256k1Blake160SighashAllTypeHash  *Hash            `json:"secp256k1_blake160_sighash_all_type_hash"`
	Secp256k1Blake160MultisigAllTypeHash *Hash            `json:"secp256k1_blake160_multisig_all_type_hash"`
	InitialPrimaryEpochReward            uint64           `json:"initial_primary_epoch_reward"`
	SecondaryEpochReward                 uint64           `json:"secondary_epoch_reward"`
	MaxUnclesNum                         uint64           `json:"max_uncles_num"`
	OrphanRateTarget                     RationalU256     `json:"orphan_rate_target"`
	EpochDurationTarget                  uint64           `json:"epoch_duration_target"`
	TxProposalWindow                     ProposalWindow   `json:"tx_proposal_window"`
	ProposerRewardRatio                  RationalU256     `json:"proposer_reward_ratio"`
	CellbaseMaturity                     uint64           `json:"cellbase_maturity"`
	MedianTimeBlockCount                 uint64           `json:"median_time_block_count"`
	MaxBlockCycles                       uint64           `json:"max_block_cycles"`
	MaxBlockBytes                        uint64           `json:"max_block_bytes"`
	BlockVersion                         uint32           `json:"block_version"`
	TxVersion                            uint32           `json:"tx_version"`
	TypeIdCodeHash                       Hash             `json:"type_id_code_hash"`
	MaxBlockProposalsLimit               uint64           `json:"max_block_proposals_limit"`
	PrimaryEpochRewardHalvingInterval    uint64           `json:"primary_epoch_reward_halving_interval"`
	PermanentDifficultyInDummy           bool             `json:"permanent_difficulty_in_dummy"`
	HardforkFeatures                     HardForkFeatures `json:"hardfork_features"`
}

func (*Consensus) UnmarshalJSON

func (r *Consensus) UnmarshalJSON(input []byte) error

type DepType

type DepType string

func (DepType) Pack

func (t DepType) Pack() *molecule.Byte

func (DepType) Serialize

func (t DepType) Serialize() []byte

type DeploymentInfo added in v2.3.0

type DeploymentInfo struct {
	Bit                uint8
	Start              uint64
	Timeout            uint64
	MinActivationEpoch uint64
	Period             uint64
	Threshold          jsonRationalU256
	Since              uint64
	State              DeploymentState
}

DeploymentInfo represents information about a deployment.

type DeploymentPos added in v2.3.0

type DeploymentPos int

DeploymentPos represents the possible positions for deployments.

const (
	// Testdummy represents a dummy deployment.
	Testdummy DeploymentPos = iota
	// LightClient represents the light client protocol deployment.
	LightClient
)

type DeploymentState added in v2.3.0

type DeploymentState int

DeploymentState represents the possible states of a deployment.

const (
	// Defined is the first state that each softfork starts.
	Defined DeploymentState = iota
	// Started is the state for epochs past the `start` epoch.
	Started
	// LockedIn is the state for epochs after the first epoch period with STARTED epochs of which at least `threshold` has the associated bit set in `version`.
	LockedIn
	// Active is the state for all epochs after the LOCKED_IN epoch.
	Active
	// Failed is the state for epochs past the `timeout_epoch`, if LOCKED_IN was not reached.
	Failed
)

type DeploymentsInfo added in v2.3.0

type DeploymentsInfo struct {
	Hash        Hash
	Epoch       uint64
	Deployments map[DeploymentPos]DeploymentInfo
}

DeploymentsInfo represents information about multiple deployments.

type DryRunTransactionResult

type DryRunTransactionResult struct {
	Cycles uint64 `json:"cycles"`
}

func (*DryRunTransactionResult) UnmarshalJSON

func (r *DryRunTransactionResult) UnmarshalJSON(input []byte) error

type EntryCompleted added in v2.3.0

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

type Epoch

type Epoch struct {
	CompactTarget uint64 `json:"compact_target"`
	Length        uint64 `json:"length"`
	Number        uint64 `json:"number"`
	StartNumber   uint64 `json:"start_number"`
}

func (Epoch) MarshalJSON

func (r Epoch) MarshalJSON() ([]byte, error)

func (*Epoch) UnmarshalJSON

func (r *Epoch) UnmarshalJSON(input []byte) error

type EpochParams

type EpochParams struct {
	Length uint64
	Index  uint64
	Number uint64
}

func ParseEpoch

func ParseEpoch(epoch uint64) *EpochParams

func (*EpochParams) Uint64

func (ep *EpochParams) Uint64() uint64

type EstimateCycles added in v2.0.3

type EstimateCycles struct {
	Cycles uint64 `json:"cycles"`
}

func (*EstimateCycles) UnmarshalJSON added in v2.0.3

func (r *EstimateCycles) UnmarshalJSON(input []byte) error

type FeeRateStatics deprecated added in v2.0.3

type FeeRateStatics = FeeRateStatistics

Deprecated: Use FeeRateStatistics instead

func (*FeeRateStatics) MarshalJSON added in v2.0.3

func (r *FeeRateStatics) MarshalJSON() ([]byte, error)

func (*FeeRateStatics) UnmarshalJSON added in v2.0.3

func (r *FeeRateStatics) UnmarshalJSON(input []byte) error

type FeeRateStatistics added in v2.3.0

type FeeRateStatistics struct {
	Mean   uint64 `json:"mean"`
	Median uint64 `json:"median"`
}

type GenericRPCClient added in v2.2.0

type GenericRPCClient interface {
	CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
	Close()
}

type HardForkFeature

type HardForkFeature struct {
	Rfc         string  `json:"rfc"`
	EpochNumber *uint64 `json:"epoch_number,omitempty"`
}

type HardForkFeatures added in v2.3.0

type HardForkFeatures map[string]*HardForkFeature

type Hash

type Hash [HashLength]byte

func BytesToHash

func BytesToHash(b []byte) Hash

func HexToHash

func HexToHash(s string) Hash

func UnpackHash

func UnpackHash(v *molecule.Byte32) Hash

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (Hash) Hex

func (h Hash) Hex() string

func (Hash) MarshalText

func (h Hash) MarshalText() ([]byte, error)

func (*Hash) Pack

func (h *Hash) Pack() *molecule.Byte32

func (Hash) Serialize

func (h Hash) Serialize() []byte

func (*Hash) SetBytes

func (h *Hash) SetBytes(b []byte)

func (Hash) String

func (h Hash) String() string

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(input []byte) error

func (*Hash) UnmarshalText

func (h *Hash) UnmarshalText(input []byte) error
type Header struct {
	CompactTarget    uint32   `json:"compact_target"`
	Dao              Hash     `json:"dao"`
	Epoch            uint64   `json:"epoch"`
	Hash             Hash     `json:"hash"`
	Nonce            *big.Int `json:"nonce"`
	Number           uint64   `json:"number"`
	ParentHash       Hash     `json:"parent_hash"`
	ProposalsHash    Hash     `json:"proposals_hash"`
	Timestamp        uint64   `json:"timestamp"`
	TransactionsRoot Hash     `json:"transactions_root"`
	ExtraHash        Hash     `json:"extra_hash"`
	Version          uint32   `json:"version"`
}

func UnpackHeader added in v2.2.0

func UnpackHeader(v *molecule.Header) *Header

func (Header) MarshalJSON

func (r Header) MarshalJSON() ([]byte, error)

func (*Header) UnmarshalJSON

func (r *Header) UnmarshalJSON(input []byte) error

type JsonFeeRateStatics added in v2.0.3

type JsonFeeRateStatics struct {
	Mean   hexutil.Uint64 `json:"mean"`
	Median hexutil.Uint64 `json:"median"`
}

type LocalNode

type LocalNode struct {
	Version     string               `json:"version"`
	NodeId      string               `json:"node_id"`
	Active      bool                 `json:"active"`
	Addresses   []*NodeAddress       `json:"addresses"`
	Protocols   []*LocalNodeProtocol `json:"protocols"`
	Connections uint64               `json:"connections"`
}

func (*LocalNode) UnmarshalJSON

func (r *LocalNode) UnmarshalJSON(input []byte) error

type LocalNodeProtocol

type LocalNodeProtocol struct {
	Id              uint64   `json:"id"`
	Name            string   `json:"name"`
	SupportVersions []string `json:"support_versions"`
}

func (*LocalNodeProtocol) UnmarshalJSON

func (r *LocalNodeProtocol) UnmarshalJSON(input []byte) error

type MinerReward

type MinerReward struct {
	Primary   uint64 `json:"primary"`
	Secondary uint64 `json:"secondary"`
	Committed uint64 `json:"committed"`
	Proposal  uint64 `json:"proposal"`
}

type Network

type Network uint

type NodeAddress

type NodeAddress struct {
	Address string `json:"address"`
	Score   uint64 `json:"score"`
}

func (*NodeAddress) UnmarshalJSON

func (r *NodeAddress) UnmarshalJSON(input []byte) error

type OutPoint

type OutPoint struct {
	TxHash Hash   `json:"tx_hash"`
	Index  uint32 `json:"index"`
}

func UnpackOutPoint added in v2.2.0

func UnpackOutPoint(v *molecule.OutPoint) *OutPoint

func (OutPoint) MarshalJSON

func (r OutPoint) MarshalJSON() ([]byte, error)

func (*OutPoint) Pack

func (r *OutPoint) Pack() *molecule.OutPoint

func (*OutPoint) Serialize

func (r *OutPoint) Serialize() []byte

func (*OutPoint) UnmarshalJSON

func (r *OutPoint) UnmarshalJSON(input []byte) error

type PackedBlock added in v2.2.0

type PackedBlock struct {
	Block string `json:"block"`
}

func (*PackedBlock) UnmarshalJSON added in v2.2.0

func (r *PackedBlock) UnmarshalJSON(input []byte) error

type PackedBlockWithCycles added in v2.2.0

type PackedBlockWithCycles struct {
	Block  string   `json:"block"`
	Cycles []uint64 `json:"cycles"`
}

type PackedHeader added in v2.2.0

type PackedHeader struct {
	Header string `json:"header"`
}

type PeerSyncState

type PeerSyncState struct {
	BestKnownHeaderHash    *Hash   `json:"best_known_header_hash,omitempty"`
	BestKnownHeaderNumber  *uint64 `json:"best_known_header_number,omitempty"`
	LastCommonHeaderHash   *Hash   `json:"last_common_header_hash,omitempty"`
	LastCommonHeaderNumber *uint64 `json:"last_common_header_number,omitempty"`
	UnknownHeaderListSize  uint64  `json:"unknown_header_list_size"`
	InflightCount          uint64  `json:"inflight_count"`
	CanFetchCount          uint64  `json:"can_fetch_count"`
}

func (*PeerSyncState) UnmarshalJSON

func (r *PeerSyncState) UnmarshalJSON(input []byte) error

type PoolTxDetailInfo added in v2.3.0

type PoolTxDetailInfo struct {
	AncestorsCount   uint64                `json:"ancestors_count"`
	DescendantsCount uint64                `json:"descendants_count"`
	EntryStatus      string                `json:"entry_status"`
	PendingCount     uint64                `json:"pending_count"`
	ProposedCount    uint64                `json:"proposed_count"`
	RankInPending    uint64                `json:"rank_in_pending"`
	ScoreSortKey     AncestorsScoreSortKey `json:"score_sortkey"`
	Timestamp        uint64                `json:"timestamp"`
}

type Proof

type Proof struct {
	Indices []uint `json:"indices"`
	Lemmas  []Hash `json:"lemmas"`
}

func (Proof) MarshalJSON

func (r Proof) MarshalJSON() ([]byte, error)

func (*Proof) UnmarshalJSON

func (r *Proof) UnmarshalJSON(input []byte) error

type ProposalWindow

type ProposalWindow struct {
	Closest  uint64 `json:"closest"`
	Farthest uint64 `json:"farthest"`
}

type RationalU256

type RationalU256 struct {
	Denom *big.Int `json:"denom"`
	Numer *big.Int `json:"numer"`
}

type RawTxPool

type RawTxPool struct {
	Pending  []Hash `json:"pending"`
	Proposed []Hash `json:"proposed"`
}

type RemoteNode

type RemoteNode struct {
	Version           string                `json:"version"`
	NodeID            string                `json:"node_id"`
	Addresses         []*NodeAddress        `json:"addresses"`
	IsOutbound        bool                  `json:"is_outbound"`
	ConnectedDuration uint64                `json:"connected_duration"`
	LastPingDuration  *uint64               `json:"last_ping_duration,omitempty"`
	SyncState         *PeerSyncState        `json:"sync_state,omitempty"`
	Protocols         []*RemoteNodeProtocol `json:"protocols"`
}

func (*RemoteNode) UnmarshalJSON

func (r *RemoteNode) UnmarshalJSON(input []byte) error

type RemoteNodeProtocol

type RemoteNodeProtocol struct {
	ID      uint64 `json:"id"`
	Version string `json:"version"`
}

func (*RemoteNodeProtocol) UnmarshalJSON

func (r *RemoteNodeProtocol) UnmarshalJSON(input []byte) error

type Script

type Script struct {
	CodeHash Hash           `json:"code_hash"`
	HashType ScriptHashType `json:"hash_type"`
	Args     []byte         `json:"args"`
}

func UnpackScript added in v2.2.0

func UnpackScript(v *molecule.Script) *Script

func UnpackScriptOpt added in v2.2.0

func UnpackScriptOpt(v *molecule.ScriptOpt) *Script

func (*Script) Equals

func (r *Script) Equals(obj *Script) bool

func (*Script) Hash

func (r *Script) Hash() Hash

func (Script) MarshalJSON

func (r Script) MarshalJSON() ([]byte, error)

func (*Script) OccupiedCapacity

func (r *Script) OccupiedCapacity() uint64

func (*Script) Pack

func (r *Script) Pack() *molecule.Script

func (*Script) Serialize

func (r *Script) Serialize() []byte

func (*Script) UnmarshalJSON

func (r *Script) UnmarshalJSON(input []byte) error

type ScriptHashType

type ScriptHashType string

func DeserializeHashTypeByte

func DeserializeHashTypeByte(hashType byte) (ScriptHashType, error)

func (ScriptHashType) Pack

func (t ScriptHashType) Pack() *molecule.Byte

func (ScriptHashType) Serialize

func (t ScriptHashType) Serialize() []byte

type ScriptSearchMode added in v2.2.0

type ScriptSearchMode string

type ScriptType added in v2.0.3

type ScriptType string

func (*ScriptType) UnmarshalJSON added in v2.0.3

func (r *ScriptType) UnmarshalJSON(input []byte) error

type SyncState

type SyncState struct {
	Ibd                      bool   `json:"ibd"`
	BestKnownBlockNumber     uint64 `json:"best_known_block_number"`
	BestKnownBlockTimestamp  uint64 `json:"best_known_block_timestamp"`
	OrphanBlocksCount        uint64 `json:"orphan_blocks_count"`
	InflightBlocksCount      uint64 `json:"inflight_blocks_count"`
	AssumeValidTarget        Hash   `json:"assume_valid_target"`
	AssumeValidTargetReached bool   `json:"assume_valid_target_reached"`
	MinChainWork             uint64 `json:"min_chain_work"`
	MinChainWorkReached      bool   `json:"min_chain_work_reached"`
	FastTime                 uint64 `json:"fast_time"`
	LowTime                  uint64 `json:"low_time"`
	NormalTime               uint64 `json:"normal_time"`
	TipHash                  Hash   `json:"tip_hash"`
	TipNumber                uint64 `json:"tip_number"`
	UnverifiedTipHash        Hash   `json:"unverified_tip_hash"`
	UnverifiedTipNumber      uint64 `json:"unverified_tip_number"`
}

func (*SyncState) UnmarshalJSON

func (t *SyncState) UnmarshalJSON(input []byte) error

type Transaction

type Transaction struct {
	Version     uint32        `json:"version"`
	Hash        Hash          `json:"hash"`
	CellDeps    []*CellDep    `json:"cell_deps"`
	HeaderDeps  []Hash        `json:"header_deps"`
	Inputs      []*CellInput  `json:"inputs"`
	Outputs     []*CellOutput `json:"outputs"`
	OutputsData [][]byte      `json:"outputs_data"`
	Witnesses   [][]byte      `json:"witnesses"`
}

func UnpackTransaction added in v2.2.0

func UnpackTransaction(v *molecule.Transaction) *Transaction

func (Transaction) CalculateFee added in v2.0.3

func (t Transaction) CalculateFee(feeRate uint64) uint64

func (Transaction) CalculateFeeWithTxWeight added in v2.0.3

func (t Transaction) CalculateFeeWithTxWeight(cycles uint64, feeRate uint64) uint64

func (*Transaction) ComputeHash

func (t *Transaction) ComputeHash() Hash

func (Transaction) MarshalJSON

func (t Transaction) MarshalJSON() ([]byte, error)

func (*Transaction) OutputsCapacity

func (t *Transaction) OutputsCapacity() (totalCapacity uint64)

func (*Transaction) Pack

func (t *Transaction) Pack() *molecule.Transaction

func (*Transaction) PackToRawTransaction

func (t *Transaction) PackToRawTransaction() *molecule.RawTransaction

func (*Transaction) Serialize

func (t *Transaction) Serialize() []byte

func (*Transaction) SerializeWithoutWitnesses

func (t *Transaction) SerializeWithoutWitnesses() []byte

func (*Transaction) SizeInBlock

func (t *Transaction) SizeInBlock() uint64

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(input []byte) error

type TransactionAndWitnessProof added in v2.3.0

type TransactionAndWitnessProof struct {
	BlockHash         Hash   `json:"block_hash"`
	TransactionsProof *Proof `json:"transactions_proof"`
	WitnessesProof    *Proof `json:"witnesses_proof"`
}

type TransactionInput

type TransactionInput struct {
	OutPoint   *OutPoint   `json:"out_point"`
	Output     *CellOutput `json:"output"`
	OutputData []byte      `json:"output_data"`
}

type TransactionProof

type TransactionProof struct {
	Proof         *Proof `json:"proof"`
	BlockHash     Hash   `json:"block_hash"`
	WitnessesRoot Hash   `json:"witnesses_root"`
}

type TransactionStatus

type TransactionStatus string

func (*TransactionStatus) UnmarshalJSON

func (r *TransactionStatus) UnmarshalJSON(input []byte) error

type TransactionWithStatus

type TransactionWithStatus struct {
	Transaction     *Transaction `json:"transaction"`
	Cycles          *uint64      `json:"cycles"`
	Fee             *uint64      `json:"fee"`
	MinReplaceFee   *uint64      `json:"min_replace_fee"`
	TimeAddedToPool *uint64      `json:"time_added_to_pool"`
	TxStatus        *TxStatus    `json:"tx_status"`
}

func (*TransactionWithStatus) MarshalJSON added in v2.0.3

func (r *TransactionWithStatus) MarshalJSON() ([]byte, error)

func (*TransactionWithStatus) UnmarshalJSON added in v2.0.3

func (r *TransactionWithStatus) UnmarshalJSON(input []byte) error

type TxPoolInfo

type TxPoolInfo struct {
	LastTxsUpdatedAt uint64 `json:"last_txs_updated_at"`
	MaxTxPoolSize    uint64 `json:"max_tx_pool_size"`
	MinFeeRate       uint64 `json:"min_fee_rate"`
	MinRbfRate       uint64 `json:"min_fee_rate"`
	Orphan           uint64 `json:"orphan"`
	Pending          uint64 `json:"pending"`
	Proposed         uint64 `json:"proposed"`
	TipHash          Hash   `json:"tip_hash"`
	TipNumber        uint64 `json:"tip_number"`
	TotalTxCycles    uint64 `json:"total_tx_cycles"`
	TotalTxSize      uint64 `json:"total_tx_size"`
	TxSizeLimit      uint64 `json:"tx_size_limit"`
	VerifyQueueSize  uint64 `json:"verify_queue_size"`
}

func (*TxPoolInfo) UnmarshalJSON

func (r *TxPoolInfo) UnmarshalJSON(input []byte) error

type TxStatus

type TxStatus struct {
	Status      TransactionStatus `json:"status"`
	BlockHash   *Hash             `json:"block_hash"`
	BlockNumber *uint64           `json:"block_number"`
	TxIndex     *uint             `json:"tx_index"`
	Reason      *string           `json:"reason"`
}

func (*TxStatus) MarshalJSON added in v2.3.0

func (r *TxStatus) MarshalJSON() ([]byte, error)

func (*TxStatus) UnmarshalJSON added in v2.3.0

func (r *TxStatus) UnmarshalJSON(input []byte) error

type UncleBlock

type UncleBlock struct {
	Header    *Header  `json:"header"`
	Proposals []string `json:"proposals"`
}

func UnpackUncleBlock added in v2.2.0

func UnpackUncleBlock(v *molecule.UncleBlock) *UncleBlock

type WitnessArgs

type WitnessArgs struct {
	Lock       []byte `json:"lock"`
	InputType  []byte `json:"input_type"`
	OutputType []byte `json:"output_type"`
}

func DeserializeWitnessArgs

func DeserializeWitnessArgs(in []byte) (*WitnessArgs, error)

func UnpackWitnessArgs

func UnpackWitnessArgs(v *molecule.WitnessArgs) *WitnessArgs

func (*WitnessArgs) Pack

func (r *WitnessArgs) Pack() *molecule.WitnessArgs

func (*WitnessArgs) Serialize

func (w *WitnessArgs) Serialize() []byte

type WitnessType

type WitnessType uint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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