Documentation ¶
Index ¶
- Constants
- func SerializeArray(items []Serializer) ([][]byte, error)
- func SerializeBytes(items []byte) []byte
- func SerializeDynVec(items [][]byte) []byte
- func SerializeFixVec(items [][]byte) []byte
- func SerializeOption(o Serializer) ([]byte, error)
- func SerializeOptionBytes(o []byte) ([]byte, error)
- func SerializeStruct(fields [][]byte) []byte
- func SerializeTable(fields [][]byte) []byte
- func SerializeUint(n uint) []byte
- func SerializeUint64(n uint64) []byte
- type AlertMessage
- type BannedAddress
- type BatchLiveCellItem
- type BatchTransactionItem
- type Block
- type BlockEconomicState
- type BlockIssuance
- type BlockReward
- type BlockchainInfo
- type Cell
- type CellData
- type CellDep
- type CellInfo
- type CellInput
- type CellOutput
- type CellTransaction
- type CellWithStatus
- type Consensus
- type DepType
- type DryRunTransactionResult
- type Epoch
- type EpochParams
- type EstimateFeeRateResult
- type Hash
- func (h Hash) Bytes() []byte
- func (h Hash) Hex() string
- func (h Hash) MarshalText() ([]byte, error)
- func (h Hash) Serialize() ([]byte, error)
- func (h *Hash) SetBytes(b []byte)
- func (h Hash) String() string
- func (h *Hash) UnmarshalJSON(input []byte) error
- func (h *Hash) UnmarshalText(input []byte) error
- type Header
- type LiveCell
- type LockHashIndexState
- type MinerReward
- type Node
- type NodeAddress
- type OutPoint
- type Proof
- type ProposalWindow
- type RationalU256
- type RawTxPool
- type ReceiverInfo
- type Script
- type ScriptHashType
- type Serializer
- type SyncState
- type Transaction
- type TransactionPoint
- type TransactionProof
- type TransactionStatus
- type TransactionWithStatus
- type TxPoolInfo
- type TxStatus
- type UncleBlock
- type WitnessArgs
Constants ¶
View Source
const ( HashTypeData ScriptHashType = "data" HashTypeType ScriptHashType = "type" DepTypeCode DepType = "code" DepTypeDepGroup DepType = "dep_group" TransactionStatusPending TransactionStatus = "pending" TransactionStatusProposed TransactionStatus = "proposed" TransactionStatusCommitted TransactionStatus = "committed" )
View Source
const (
HashLength = 32
)
Variables ¶
This section is empty.
Functions ¶
func SerializeArray ¶
func SerializeArray(items []Serializer) ([][]byte, error)
SerializeArray serialize array
func SerializeBytes ¶
SerializeFixVec serialize bytes There are two steps of serializing a bytes:
Serialize the length as a 32 bit unsigned integer in little-endian. Serialize all items in it.
func SerializeDynVec ¶
SerializeDynVec serialize dynvec There are three steps of serializing a dynvec:
Serialize the full size in bytes as a 32 bit unsigned integer in little-endian. Serialize all offset of items as 32 bit unsigned integer in little-endian. Serialize all items in it.
func SerializeFixVec ¶
SerializeFixVec serialize fixvec vector There are two steps of serializing a fixvec:
Serialize the length as a 32 bit unsigned integer in little-endian. Serialize all items in it.
func SerializeOption ¶
func SerializeOption(o Serializer) ([]byte, error)
SerializeOption serialize option
func SerializeOptionBytes ¶
SerializeOption serialize option
func SerializeStruct ¶
SerializeStruct serialize struct
func SerializeTable ¶
SerializeTable serialize table The serializing steps are same as table:
Serialize the full size in bytes as a 32 bit unsigned integer in little-endian. Serialize all offset of fields as 32 bit unsigned integer in little-endian. Serialize all fields in it in the order they are declared.
func SerializeUint ¶
func SerializeUint64 ¶
Types ¶
type AlertMessage ¶
type BannedAddress ¶
type BatchLiveCellItem ¶ added in v0.2.0
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"` }
type BlockEconomicState ¶ added in v0.3.0
type BlockEconomicState struct { Issuance BlockIssuance `json:"issuance"` MinerReward MinerReward `json:"miner_reward"` TxsFee *big.Int `json:"txs_fee"` FinalizedAt Hash `json:"finalized_at"` }
type BlockIssuance ¶ added in v0.3.0
type BlockReward ¶
type BlockchainInfo ¶
type CellInfo ¶
type CellInfo struct { Data *CellData `json:"data"` Output *CellOutput `json:"output"` }
type CellInput ¶
type CellOutput ¶
type CellOutput struct { Capacity uint64 `json:"capacity"` Lock *Script `json:"lock"` Type *Script `json:"type"` }
func (CellOutput) OccupiedCapacity ¶ added in v0.2.0
func (o CellOutput) OccupiedCapacity(outputData []byte) uint64
func (*CellOutput) Serialize ¶
func (o *CellOutput) Serialize() ([]byte, error)
Serialize cell output
type CellTransaction ¶
type CellTransaction struct { ConsumedBy *TransactionPoint `json:"consumed_by"` CreatedBy *TransactionPoint `json:"created_by"` }
type CellWithStatus ¶
type Consensus ¶ added in v0.41.0
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"` BlockVersion uint `json:"block_version"` TxVersion uint `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"` }
type DryRunTransactionResult ¶
type DryRunTransactionResult struct {
Cycles uint64 `json:"cycles"`
}
type EpochParams ¶
func ParseEpoch ¶
func ParseEpoch(epoch uint64) *EpochParams
func (*EpochParams) Uint64 ¶
func (ep *EpochParams) Uint64() uint64
type EstimateFeeRateResult ¶
type EstimateFeeRateResult struct {
FeeRate uint64 `json:"fee_rate"`
}
type Hash ¶
type Hash [HashLength]byte
func BytesToHash ¶
func (Hash) MarshalText ¶
func (*Hash) UnmarshalJSON ¶
func (*Hash) UnmarshalText ¶
type Header ¶
type Header struct { CompactTarget uint `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"` UnclesHash Hash `json:"uncles_hash"` Version uint `json:"version"` }
type LiveCell ¶
type LiveCell struct { CellOutput *CellOutput `json:"cell_output"` CreatedBy *TransactionPoint `json:"created_by"` }
type LockHashIndexState ¶
type MinerReward ¶ added in v0.3.0
type Node ¶
type Node struct { Addresses []*NodeAddress `json:"addresses"` IsOutbound bool `json:"is_outbound"` NodeId string `json:"node_id"` Version string `json:"version"` }
type NodeAddress ¶
type ProposalWindow ¶ added in v0.41.0
type RationalU256 ¶ added in v0.41.0
type ReceiverInfo ¶ added in v0.3.0
type Script ¶
type Script struct { CodeHash Hash `json:"code_hash"` HashType ScriptHashType `json:"hash_type"` Args []byte `json:"args"` }
func (*Script) OccupiedCapacity ¶ added in v0.2.0
type ScriptHashType ¶
type ScriptHashType string
func (ScriptHashType) Serialize ¶
func (t ScriptHashType) Serialize() ([]byte, error)
type Serializer ¶
type SyncState ¶ added in v0.43.1
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"` FastTime uint64 `json:"fast_time"` LowTime uint64 `json:"low_time"` NormalTime uint64 `json:"normal_time"` }
type Transaction ¶
type Transaction struct { Version uint `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 (*Transaction) ComputeHash ¶
func (t *Transaction) ComputeHash() (Hash, error)
func (*Transaction) OutputsCapacity ¶ added in v0.3.0
func (t *Transaction) OutputsCapacity() (totalCapacity uint64)
func (*Transaction) Serialize ¶
func (t *Transaction) Serialize() ([]byte, error)
Serialize transaction
func (*Transaction) SizeInBlock ¶ added in v0.3.0
func (t *Transaction) SizeInBlock() (uint64, error)
type TransactionPoint ¶
type TransactionProof ¶ added in v0.43.1
type TransactionStatus ¶
type TransactionStatus string
type TransactionWithStatus ¶
type TransactionWithStatus struct { Transaction *Transaction `json:"transaction"` TxStatus *TxStatus `json:"tx_status"` }
type TxPoolInfo ¶
type TxStatus ¶
type TxStatus struct { BlockHash *Hash `json:"block_hash"` Status TransactionStatus `json:"status"` }
type UncleBlock ¶
type WitnessArgs ¶
type WitnessArgs struct { Lock []byte `json:"lock"` InputType []byte `json:"input_type"` OutputType []byte `json:"output_type"` }
func (*WitnessArgs) Serialize ¶
func (w *WitnessArgs) Serialize() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.