Options
All
  • Public
  • Public/Protected
  • All
Menu

Package base

@ckb-lumos/base

Base data structures and utilities used in lumos.

Index

References

Classes

Interfaces

Type aliases

Variables

Functions

References

Address

Re-exports Address

Alert

Re-exports Alert

AlertMessage

Re-exports AlertMessage

BannedAddr

Re-exports BannedAddr

BaseCellCollector

Re-exports BaseCellCollector

Block

Re-exports Block

BlockEconomicState

Re-exports BlockEconomicState

Cell

Re-exports Cell

CellCollector

Re-exports CellCollector

CellCollectorResults

Re-exports CellCollectorResults

CellDep

Re-exports CellDep

CellProvider

Re-exports CellProvider

CellWithStatus

Re-exports CellWithStatus

ChainInfo

Re-exports ChainInfo

Consensus

Re-exports Consensus

DepType

Re-exports DepType

DryRunResult

Re-exports DryRunResult

Epoch

Re-exports Epoch

Hash

Re-exports Hash

HashType

Re-exports HashType

Header

Re-exports Header

HexNumber

Re-exports HexNumber

HexString

Re-exports HexString

Hexadecimal

Re-exports Hexadecimal

HexadecimalRange

Re-exports HexadecimalRange

Indexer

Re-exports Indexer

IndexerOptions

Re-exports IndexerOptions

Input

Re-exports Input

LiveCell

Re-exports LiveCell

LocalNode

Re-exports LocalNode

LocalNodeProtocol

Re-exports LocalNodeProtocol

MerkleProof

Re-exports MerkleProof

NodeAddress

Re-exports NodeAddress

OutPoint

Re-exports OutPoint

Output

Re-exports Output

PackedDao

Re-exports PackedDao

PackedSince

Re-exports PackedSince

PeerSyncState

Re-exports PeerSyncState

ProposalWindow

Re-exports ProposalWindow

QueryOptions

Re-exports QueryOptions

Rational

Re-exports Rational

RawTransaction

Re-exports RawTransaction

RawTxPool

Re-exports RawTxPool

RemoteNode

Re-exports RemoteNode

RemoteNodeProtocol

Re-exports RemoteNodeProtocol

Script

Re-exports Script

ScriptWrapper

Re-exports ScriptWrapper

SinceValidationInfo

Re-exports SinceValidationInfo

SyncState

Re-exports SyncState

Tip

Re-exports Tip

Transaction

Re-exports Transaction

TransactionCollector

Re-exports TransactionCollector

TransactionCollectorOptions

Re-exports TransactionCollectorOptions

TransactionCollectorResults

Re-exports TransactionCollectorResults

TransactionProof

Re-exports TransactionProof

TransactionWithStatus

Re-exports TransactionWithStatus

TxPoolIds

Re-exports TxPoolIds

TxPoolInfo

Re-exports TxPoolInfo

TxPoolVerbosity

Re-exports TxPoolVerbosity

TxStatus

Re-exports TxStatus

TxVerbosity

Re-exports TxVerbosity

UncleBlock

Re-exports UncleBlock

WitnessArgs

Re-exports WitnessArgs

indexer

Re-exports indexer

Type aliases

Address

Address: string

Address

Address: string

DepType

DepType: "depGroup" | "code"

DepType

DepType: "depGroup" | "code"

Hash

Hash: HexString

Hash

Hash: HexString

HashType

HashType: "type" | "data" | "data1"

HashType

HashType: "type" | "data" | "data1"

HeaderCodecType

HeaderCodecType: PackParam<typeof BaseHeader>

HeaderCodecType

HeaderCodecType: PackParam<typeof BaseHeader>

HeaderUnpackResultType

HeaderUnpackResultType: UnpackResult<typeof BaseHeader>

HeaderUnpackResultType

HeaderUnpackResultType: UnpackResult<typeof BaseHeader>

HexNumber

HexNumber: Hexadecimal

HexNumber

HexNumber: Hexadecimal

HexString

HexString: string

HexString represents string starts with "0x" and followed by even number(including empty) of [0-9a-fA-F] characters.

HexString

HexString: string

HexString represents string starts with "0x" and followed by even number(including empty) of [0-9a-fA-F] characters.

Hexadecimal

Hexadecimal: string

Hexadecimal represents string starts with "0x" and followed by any number(excluding empty) of [0-9a-fA-F] characters.

Hexadecimal

Hexadecimal: string

Hexadecimal represents string starts with "0x" and followed by any number(excluding empty) of [0-9a-fA-F] characters.

HexadecimalRange

HexadecimalRange: [Hexadecimal, Hexadecimal]

HexadecimalRange

HexadecimalRange: [Hexadecimal, Hexadecimal]

Log

Log: (message: string) => void

Type declaration

    • (message: string): void
    • Parameters

      • message: string

      Returns void

Log

Log: (message: string) => void

Type declaration

    • (message: string): void
    • Parameters

      • message: string

      Returns void

LogLevel

LogLevel: "warn" | "error" | string

LogLevel

LogLevel: "warn" | "error" | string

Logger

Logger: (level: LogLevel, message: string) => void

Type declaration

    • (level: LogLevel, message: string): void
    • Parameters

      Returns void

Logger

Logger: (level: LogLevel, message: string) => void

Type declaration

    • (level: LogLevel, message: string): void
    • Parameters

      Returns void

PackedDao

PackedDao: string

PackedDao

PackedDao: string

PackedSince

PackedSince: string

PackedSince

PackedSince: string

RawTxPool

RawTxPool

SinceType

SinceType: "epochNumber" | "blockNumber" | "blockTimestamp"

SinceType

SinceType: "epochNumber" | "blockNumber" | "blockTimestamp"

TransactionCodecType

TransactionCodecType: PackParam<typeof BaseTransaction>

TransactionCodecType

TransactionCodecType: PackParam<typeof BaseTransaction>

TransactionUnpackResultType

TransactionUnpackResultType: UnpackResult<typeof BaseTransaction>

TransactionUnpackResultType

TransactionUnpackResultType: UnpackResult<typeof BaseTransaction>

Variables

Const BaseHeader

BaseHeader: BytesCodec<Partial<Pick<{ nonce: BI; raw: Partial<Pick<{ compactTarget: number; dao: string; epoch: BI; extraHash: string; number: BI; parentHash: string; proposalsHash: string; timestamp: BI; transactionsRoot: string; version: number }, never>> & Pick<{ compactTarget: number; dao: string; epoch: BI; extraHash: string; number: BI; parentHash: string; proposalsHash: string; timestamp: BI; transactionsRoot: string; version: number }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao"> }, never>> & Pick<{ nonce: BI; raw: Partial<Pick<{ compactTarget: number; dao: string; epoch: BI; extraHash: string; number: BI; parentHash: string; proposalsHash: string; timestamp: BI; transactionsRoot: string; version: number }, never>> & Pick<{ compactTarget: number; dao: string; epoch: BI; extraHash: string; number: BI; parentHash: string; proposalsHash: string; timestamp: BI; transactionsRoot: string; version: number }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao"> }, "raw" | "nonce">, Partial<Pick<{ nonce: string | number | bigint | BI; raw: Partial<Pick<{ compactTarget: string | number | bigint | BI; dao: BytesLike; epoch: string | number | bigint | BI; extraHash: BytesLike; number: string | number | bigint | BI; parentHash: BytesLike; proposalsHash: BytesLike; timestamp: string | number | bigint | BI; transactionsRoot: BytesLike; version: string | number | bigint | BI }, never>> & Pick<{ compactTarget: string | number | bigint | BI; dao: BytesLike; epoch: string | number | bigint | BI; extraHash: BytesLike; number: string | number | bigint | BI; parentHash: BytesLike; proposalsHash: BytesLike; timestamp: string | number | bigint | BI; transactionsRoot: BytesLike; version: string | number | bigint | BI }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao"> }, never>> & Pick<{ nonce: string | number | bigint | BI; raw: Partial<Pick<{ compactTarget: string | number | bigint | BI; dao: BytesLike; epoch: string | number | bigint | BI; extraHash: BytesLike; number: string | number | bigint | BI; parentHash: BytesLike; proposalsHash: BytesLike; timestamp: string | number | bigint | BI; transactionsRoot: BytesLike; version: string | number | bigint | BI }, never>> & Pick<{ compactTarget: string | number | bigint | BI; dao: BytesLike; epoch: string | number | bigint | BI; extraHash: BytesLike; number: string | number | bigint | BI; parentHash: BytesLike; proposalsHash: BytesLike; timestamp: string | number | bigint | BI; transactionsRoot: BytesLike; version: string | number | bigint | BI }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao"> }, "raw" | "nonce">> & { __isFixedCodec__: true; byteLength: number }

Const BaseHeader

BaseHeader: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number } = struct({raw: RawHeader,nonce: Uint128LE,},["raw", "nonce"])

Const BaseTransaction

BaseTransaction: BytesCodec<Partial<Pick<{ raw: Partial<Pick<{ cellDeps: ({} & {})[]; headerDeps: string[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: string[]; version: number }, never>> & Pick<{ cellDeps: ({} & {})[]; headerDeps: string[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: string[]; version: number }, "version" | "cellDeps" | "headerDeps" | "inputs" | "outputs" | "outputsData">; witnesses: string[] }, never>> & Pick<{ raw: Partial<Pick<{ cellDeps: ({} & {})[]; headerDeps: string[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: string[]; version: number }, never>> & Pick<{ cellDeps: ({} & {})[]; headerDeps: string[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: string[]; version: number }, "version" | "cellDeps" | "headerDeps" | "inputs" | "outputs" | "outputsData">; witnesses: string[] }, "raw" | "witnesses">, Partial<Pick<{ raw: Partial<Pick<{ cellDeps: ({} & {})[]; headerDeps: BytesLike[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: BytesLike[]; version: string | number | bigint | BI }, never>> & Pick<{ cellDeps: ({} & {})[]; headerDeps: BytesLike[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: BytesLike[]; version: string | number | bigint | BI }, "version" | "cellDeps" | "headerDeps" | "inputs" | "outputs" | "outputsData">; witnesses: BytesLike[] }, never>> & Pick<{ raw: Partial<Pick<{ cellDeps: ({} & {})[]; headerDeps: BytesLike[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: BytesLike[]; version: string | number | bigint | BI }, never>> & Pick<{ cellDeps: ({} & {})[]; headerDeps: BytesLike[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: BytesLike[]; version: string | number | bigint | BI }, "version" | "cellDeps" | "headerDeps" | "inputs" | "outputs" | "outputsData">; witnesses: BytesLike[] }, "raw" | "witnesses">>

Const BaseTransaction

BaseTransaction: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> = table({raw: RawTransaction,witnesses: BytesVec,},["raw", "witnesses"])

Const Block

Block: BytesCodec<Partial<Pick<{ header: Header; proposals: string[]; transactions: Transaction[]; uncles: ({} & {})[] }, never>> & Pick<{ header: Header; proposals: string[]; transactions: Transaction[]; uncles: ({} & {})[] }, "header" | "proposals" | "uncles" | "transactions">, Partial<Pick<{ header: Header; proposals: BytesLike[]; transactions: Transaction[]; uncles: ({} & {})[] }, never>> & Pick<{ header: Header; proposals: BytesLike[]; transactions: Transaction[]; uncles: ({} & {})[] }, "header" | "proposals" | "uncles" | "transactions">>

Const Block

Block: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> = table({header: Header,uncles: UncleBlockVec,transactions: TransactionVec,proposals: ProposalShortIdVec,},["header", "uncles", "transactions", "proposals"])

Const BlockV1

BlockV1: BytesCodec<Partial<Pick<{ extension: string; header: Header; proposals: string[]; transactions: Transaction[]; uncles: ({} & {})[] }, never>> & Pick<{ extension: string; header: Header; proposals: string[]; transactions: Transaction[]; uncles: ({} & {})[] }, "header" | "proposals" | "uncles" | "transactions" | "extension">, Partial<Pick<{ extension: BytesLike; header: Header; proposals: BytesLike[]; transactions: Transaction[]; uncles: ({} & {})[] }, never>> & Pick<{ extension: BytesLike; header: Header; proposals: BytesLike[]; transactions: Transaction[]; uncles: ({} & {})[] }, "header" | "proposals" | "uncles" | "transactions" | "extension">>

Const BlockV1

BlockV1: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> = table({header: Header,uncles: UncleBlockVec,transactions: TransactionVec,proposals: ProposalShortIdVec,extension: Bytes,},["header", "uncles", "transactions", "proposals", "extension"])

Const Byte32

Byte32: FixedBytesCodec<string, BytesLike>

Const Byte32

Byte32: Codec<Uint8Array, string, string | ArrayLike<number> | ArrayBuffer, string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number } = createFixedHexBytesCodec(32)

Const Byte32Vec

Byte32Vec: BytesCodec<string[], BytesLike[]>

Const Byte32Vec

Byte32Vec: Codec<Uint8Array, string[], (string | ArrayLike<number> | ArrayBuffer)[], string | ArrayLike<number> | ArrayBuffer> = vector(Byte32)

Const Bytes

Bytes: BytesCodec<string, BytesLike>

placeholder codec, generally used as a placeholder

// for example, when some BytesOpt is not used, it will be filled with this codec
// option BytesOpt (Bytes);
const UnusedBytesOpt = UnknownOpt

Const Bytes

Bytes: Codec<Uint8Array, string, string | ArrayLike<number> | ArrayBuffer, string | ArrayLike<number> | ArrayBuffer> = byteVecOf({ pack: bytify, unpack: hexify })

placeholder codec, generally used as a placeholder

// for example, when some BytesOpt is not used, it will be filled with this codec
// option BytesOpt (Bytes);
const UnusedBytesOpt = UnknownOpt

Const BytesOpt

BytesOpt: OptionCodec<BytesCodec<string, BytesLike>>

Const BytesOpt

BytesOpt: OptionCodec<Codec<Uint8Array, string, string | ArrayLike<number> | ArrayBuffer, string | ArrayLike<number> | ArrayBuffer>> = option(Bytes)

Const BytesVec

BytesVec: BytesCodec<string[], BytesLike[]>

Const BytesVec

BytesVec: Codec<Uint8Array, string[], (string | ArrayLike<number> | ArrayBuffer)[], string | ArrayLike<number> | ArrayBuffer> = vector(Bytes)

Const CellDep

CellDep: BytesCodec<Partial<Pick<{ depType: api.DepType; outPoint: Partial<Pick<{ index: number; txHash: string }, never>> & Pick<{ index: number; txHash: string }, "txHash" | "index"> }, never>> & Pick<{ depType: api.DepType; outPoint: Partial<Pick<{ index: number; txHash: string }, never>> & Pick<{ index: number; txHash: string }, "txHash" | "index"> }, "outPoint" | "depType">, Partial<Pick<{ depType: api.DepType; outPoint: Partial<Pick<{ index: string | number | bigint | BI; txHash: BytesLike }, never>> & Pick<{ index: string | number | bigint | BI; txHash: BytesLike }, "txHash" | "index"> }, never>> & Pick<{ depType: api.DepType; outPoint: Partial<Pick<{ index: string | number | bigint | BI; txHash: BytesLike }, never>> & Pick<{ index: string | number | bigint | BI; txHash: BytesLike }, "txHash" | "index"> }, "outPoint" | "depType">> & { __isFixedCodec__: true; byteLength: number }

Const CellDep

CellDep: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number } = struct({outPoint: OutPoint,depType: DepType,},["outPoint", "depType"])

Const CellDepVec

CellDepVec: BytesCodec<({} & {})[], ({} & {})[]>

Const CellDepVec

CellDepVec: Codec<Uint8Array, ({} & {})[], ({} & {})[], string | ArrayLike<number> | ArrayBuffer> = vector(CellDep)

Const CellInput

CellInput: BytesCodec<Partial<Pick<{ previousOutput: Partial<Pick<{ index: number; txHash: string }, never>> & Pick<{ index: number; txHash: string }, "txHash" | "index">; since: BI }, never>> & Pick<{ previousOutput: Partial<Pick<{ index: number; txHash: string }, never>> & Pick<{ index: number; txHash: string }, "txHash" | "index">; since: BI }, "since" | "previousOutput">, Partial<Pick<{ previousOutput: Partial<Pick<{ index: string | number | bigint | BI; txHash: BytesLike }, never>> & Pick<{ index: string | number | bigint | BI; txHash: BytesLike }, "txHash" | "index">; since: string | number | bigint | BI }, never>> & Pick<{ previousOutput: Partial<Pick<{ index: string | number | bigint | BI; txHash: BytesLike }, never>> & Pick<{ index: string | number | bigint | BI; txHash: BytesLike }, "txHash" | "index">; since: string | number | bigint | BI }, "since" | "previousOutput">> & { __isFixedCodec__: true; byteLength: number }

Const CellInput

CellInput: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number } = struct({since: Uint64LE,previousOutput: OutPoint,},["since", "previousOutput"])

Const CellInputVec

CellInputVec: BytesCodec<({} & {})[], ({} & {})[]>

Const CellInputVec

CellInputVec: Codec<Uint8Array, ({} & {})[], ({} & {})[], string | ArrayLike<number> | ArrayBuffer> = vector(CellInput)

Const CellOutput

CellOutput: BytesCodec<Partial<Pick<{ capacity: BI; lock: Partial<Pick<{ args: string; codeHash: string; hashType: api.HashType }, never>> & Pick<{ args: string; codeHash: string; hashType: api.HashType }, "codeHash" | "hashType" | "args">; type: ({} & {}) | undefined }, "type">> & Pick<{ capacity: BI; lock: Partial<Pick<{ args: string; codeHash: string; hashType: api.HashType }, never>> & Pick<{ args: string; codeHash: string; hashType: api.HashType }, "codeHash" | "hashType" | "args">; type: ({} & {}) | undefined }, "capacity" | "lock">, Partial<Pick<{ capacity: string | number | bigint | BI; lock: Partial<Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, never>> & Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, "codeHash" | "hashType" | "args">; type: ({} & {}) | undefined }, "type">> & Pick<{ capacity: string | number | bigint | BI; lock: Partial<Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, never>> & Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, "codeHash" | "hashType" | "args">; type: ({} & {}) | undefined }, "capacity" | "lock">>

Const CellOutput

CellOutput: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> = table({capacity: Uint64LE,lock: Script,type: ScriptOpt,},["capacity", "lock", "type"])

Const CellOutputVec

CellOutputVec: BytesCodec<({} & {})[], ({} & {})[]>

Const CellOutputVec

CellOutputVec: Codec<Uint8Array, ({} & {})[], ({} & {})[], string | ArrayLike<number> | ArrayBuffer> = vector(CellOutput)

Const CellbaseWitness

CellbaseWitness: BytesCodec<Partial<Pick<{ lock: Partial<Pick<{ args: string; codeHash: string; hashType: api.HashType }, never>> & Pick<{ args: string; codeHash: string; hashType: api.HashType }, "codeHash" | "hashType" | "args">; message: string }, never>> & Pick<{ lock: Partial<Pick<{ args: string; codeHash: string; hashType: api.HashType }, never>> & Pick<{ args: string; codeHash: string; hashType: api.HashType }, "codeHash" | "hashType" | "args">; message: string }, "lock" | "message">, Partial<Pick<{ lock: Partial<Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, never>> & Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, "codeHash" | "hashType" | "args">; message: BytesLike }, never>> & Pick<{ lock: Partial<Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, never>> & Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, "codeHash" | "hashType" | "args">; message: BytesLike }, "lock" | "message">>

Const CellbaseWitness

CellbaseWitness: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> = table({lock: Script,message: Bytes,},["lock", "message"])

Const DepType

DepType: FixedBytesCodec<api.DepType, api.DepType>

Const DepType

DepType: Codec<Uint8Array, "depGroup" | "code", "depGroup" | "code", string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number } = createFixedBytesCodec<api.DepType>({byteLength: 1,pack: (type) => {if (type === "code") return Uint8.pack(0);if (type === "depGroup") return Uint8.pack(1);throw new Error(`Invalid dep type: ${type}`);},unpack: (buf) => {const depTypeBuf = Uint8.unpack(buf);if (depTypeBuf === 0) return "code";if (depTypeBuf === 1) return "depGroup";throw new Error(`Invalid dep type: ${depTypeBuf}`);},})

Const HashType

HashType: FixedBytesCodec<api.HashType, api.HashType>

Const HashType

HashType: Codec<Uint8Array, "type" | "data" | "data1", "type" | "data" | "data1", string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number } = createFixedBytesCodec<api.HashType>({byteLength: 1,pack: (type) => {if (type === "data") return Uint8.pack(0);if (type === "type") return Uint8.pack(1);if (type === "data1") return Uint8.pack(2);throw new Error(`Invalid hash type: ${type}`);},unpack: (buf) => {const hashTypeBuf = Uint8.unpack(buf);if (hashTypeBuf === 0) return "data";if (hashTypeBuf === 1) return "type";if (hashTypeBuf === 2) return "data1";throw new Error(`Invalid hash type: ${hashTypeBuf}`);},})

Const Header

Const Header

Header: Codec<Uint8Array, Header, Header, string | ArrayLike<number> | ArrayBuffer> = createBytesCodec({pack: (header: api.Header) => BaseHeader.pack(transformHeaderCodecType(header)),unpack: (buf) => deTransformHeaderCodecType(BaseHeader.unpack(buf)),})

Const HexifyCodec

HexifyCodec: Codec<Uint8Array, string, string | ArrayLike<number> | ArrayBuffer, string | ArrayLike<number> | ArrayBuffer> = createBytesCodec<string, BytesLike>({pack: bytify,unpack: hexify,})

Const OutPoint

OutPoint: BytesCodec<Partial<Pick<{ index: number; txHash: string }, never>> & Pick<{ index: number; txHash: string }, "txHash" | "index">, Partial<Pick<{ index: string | number | bigint | BI; txHash: BytesLike }, never>> & Pick<{ index: string | number | bigint | BI; txHash: BytesLike }, "txHash" | "index">> & { __isFixedCodec__: true; byteLength: number }

Const OutPoint

OutPoint: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number } = struct({txHash: Byte32,index: Uint32LE,},["txHash", "index"])

Const ProposalShortId

ProposalShortId: FixedBytesCodec<string, BytesLike>

Const ProposalShortId

ProposalShortId: Codec<Uint8Array, string, string | ArrayLike<number> | ArrayBuffer, string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number } = createFixedHexBytesCodec(10)

Const ProposalShortIdVec

ProposalShortIdVec: BytesCodec<string[], BytesLike[]>

Const ProposalShortIdVec

ProposalShortIdVec: Codec<Uint8Array, string[], (string | ArrayLike<number> | ArrayBuffer)[], string | ArrayLike<number> | ArrayBuffer> = vector(ProposalShortId)

Const RawHeader

RawHeader: BytesCodec<Partial<Pick<{ compactTarget: number; dao: string; epoch: BI; extraHash: string; number: BI; parentHash: string; proposalsHash: string; timestamp: BI; transactionsRoot: string; version: number }, never>> & Pick<{ compactTarget: number; dao: string; epoch: BI; extraHash: string; number: BI; parentHash: string; proposalsHash: string; timestamp: BI; transactionsRoot: string; version: number }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao">, Partial<Pick<{ compactTarget: string | number | bigint | BI; dao: BytesLike; epoch: string | number | bigint | BI; extraHash: BytesLike; number: string | number | bigint | BI; parentHash: BytesLike; proposalsHash: BytesLike; timestamp: string | number | bigint | BI; transactionsRoot: BytesLike; version: string | number | bigint | BI }, never>> & Pick<{ compactTarget: string | number | bigint | BI; dao: BytesLike; epoch: string | number | bigint | BI; extraHash: BytesLike; number: string | number | bigint | BI; parentHash: BytesLike; proposalsHash: BytesLike; timestamp: string | number | bigint | BI; transactionsRoot: BytesLike; version: string | number | bigint | BI }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao">> & { __isFixedCodec__: true; byteLength: number }

Const RawHeader

RawHeader: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number } = struct({version: Uint32LE,compactTarget: Uint32LE,timestamp: Uint64LE,number: Uint64LE,epoch: Uint64LE,parentHash: Byte32,transactionsRoot: Byte32,proposalsHash: Byte32,extraHash: Byte32,dao: Byte32,},["version","compactTarget","timestamp","number","epoch","parentHash","transactionsRoot","proposalsHash","extraHash","dao",])

Const RawTransaction

RawTransaction: BytesCodec<Partial<Pick<{ cellDeps: ({} & {})[]; headerDeps: string[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: string[]; version: number }, never>> & Pick<{ cellDeps: ({} & {})[]; headerDeps: string[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: string[]; version: number }, "version" | "cellDeps" | "headerDeps" | "inputs" | "outputs" | "outputsData">, Partial<Pick<{ cellDeps: ({} & {})[]; headerDeps: BytesLike[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: BytesLike[]; version: string | number | bigint | BI }, never>> & Pick<{ cellDeps: ({} & {})[]; headerDeps: BytesLike[]; inputs: ({} & {})[]; outputs: ({} & {})[]; outputsData: BytesLike[]; version: string | number | bigint | BI }, "version" | "cellDeps" | "headerDeps" | "inputs" | "outputs" | "outputsData">>

Const RawTransaction

RawTransaction: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> = table({version: Uint32LE,cellDeps: CellDepVec,headerDeps: Byte32Vec,inputs: CellInputVec,outputs: CellOutputVec,outputsData: BytesVec,},["version", "cellDeps", "headerDeps", "inputs", "outputs", "outputsData"])

Const Script

Script: BytesCodec<Partial<Pick<{ args: string; codeHash: string; hashType: api.HashType }, never>> & Pick<{ args: string; codeHash: string; hashType: api.HashType }, "codeHash" | "hashType" | "args">, Partial<Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, never>> & Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, "codeHash" | "hashType" | "args">>

Const Script

Script: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> = table({codeHash: Byte32,hashType: HashType,args: Bytes,},["codeHash", "hashType", "args"])

Const ScriptOpt

ScriptOpt: OptionCodec<BytesCodec<Partial<Pick<{ args: string; codeHash: string; hashType: api.HashType }, never>> & Pick<{ args: string; codeHash: string; hashType: api.HashType }, "codeHash" | "hashType" | "args">, Partial<Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, never>> & Pick<{ args: BytesLike; codeHash: BytesLike; hashType: api.HashType }, "codeHash" | "hashType" | "args">>>

Const ScriptOpt

ScriptOpt: OptionCodec<Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer>> = option(Script)

Const Transaction

Const Transaction

Transaction: Codec<Uint8Array, Transaction, Transaction, string | ArrayLike<number> | ArrayBuffer> = createBytesCodec({pack: (tx: api.Transaction) =>BaseTransaction.pack(transformTransactionCodecType(tx)),unpack: (buf) => deTransformTransactionCodecType(BaseTransaction.unpack(buf)),})

Const TransactionVec

TransactionVec: BytesCodec<Transaction[], Transaction[]>

Const TransactionVec

TransactionVec: Codec<Uint8Array, Transaction[], Transaction[], string | ArrayLike<number> | ArrayBuffer> = vector(Transaction)

Uint128LE

Uint128LE: Codec<Uint8Array, BI, string | number | bigint | BI, string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number }

Uint32LE

Uint32LE: Codec<Uint8Array, number, string | number | bigint | BI, string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number }

Uint64LE

Uint64LE: Codec<Uint8Array, BI, string | number | bigint | BI, string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number }

Uint8

Uint8: Codec<Uint8Array, number, string | number | bigint | BI, string | ArrayLike<number> | ArrayBuffer> & { __isFixedCodec__: true; byteLength: number }

Const UncleBlock

UncleBlock: BytesCodec<Partial<Pick<{ header: Header; proposals: string[] }, never>> & Pick<{ header: Header; proposals: string[] }, "header" | "proposals">, Partial<Pick<{ header: Header; proposals: BytesLike[] }, never>> & Pick<{ header: Header; proposals: BytesLike[] }, "header" | "proposals">>

Const UncleBlock

UncleBlock: Codec<Uint8Array, {} & {}, {} & {}, string | ArrayLike<number> | ArrayBuffer> = table({header: Header,proposals: ProposalShortIdVec,},["header", "proposals"])

Const UncleBlockVec

UncleBlockVec: BytesCodec<({} & {})[], ({} & {})[]>

Const UncleBlockVec

UncleBlockVec: Codec<Uint8Array, ({} & {})[], ({} & {})[], string | ArrayLike<number> | ArrayBuffer> = vector(UncleBlock)

Const WitnessArgs

WitnessArgs: BytesCodec<{ inputType?: string | undefined; lock?: string | undefined; outputType?: string | undefined }, { inputType?: string | ArrayBuffer | ArrayLike<number> | undefined; lock?: string | ArrayBuffer | ArrayLike<number> | undefined; outputType?: string | ArrayBuffer | ArrayLike<number> | undefined }>
example
// secp256k1 lock witness
WitnessArgs.pack({ lock: '0x' + '00'.repeat(65) })

Const WitnessArgs

WitnessArgs: Codec<Uint8Array, { inputType?: UnpackResult<InputTypeCodec>; lock?: UnpackResult<LockCodec>; outputType?: UnpackResult<OutputTypeCodec> }, { inputType?: PackParam<InputTypeCodec>; lock?: PackParam<LockCodec>; outputType?: PackParam<OutputTypeCodec> }, string | ArrayLike<number> | ArrayBuffer> = WitnessArgsOf({lock: HexifyCodec,inputType: HexifyCodec,outputType: HexifyCodec,})
example
// secp256k1 lock witness
WitnessArgs.pack({ lock: '0x' + '00'.repeat(65) })

byteVecOf

byteVecOf: byteVecOf

bytify

bytify: bytify

hexify

hexify: hexify

Const indexer

indexer: { TransactionCollector: typeof TransactionCollector }

Type declaration

Const indexer

indexer: { TransactionCollector: typeof TransactionCollector }

Type declaration

option

option: option

struct

struct: struct

table

table: table

vector

vector: vector

Functions

WitnessArgsOf

  • WitnessArgsOf<LockCodec, InputTypeCodec, OutputTypeCodec>(payload: { inputType: InputTypeCodec; lock: LockCodec; outputType: OutputTypeCodec }): BytesCodec<{ inputType?: UnpackResult<InputTypeCodec>; lock?: UnpackResult<LockCodec>; outputType?: UnpackResult<OutputTypeCodec> }, { inputType?: PackParam<InputTypeCodec>; lock?: PackParam<LockCodec>; outputType?: PackParam<OutputTypeCodec> }>
  • Type parameters

    Parameters

    • payload: { inputType: InputTypeCodec; lock: LockCodec; outputType: OutputTypeCodec }
      • inputType: InputTypeCodec
      • lock: LockCodec
      • outputType: OutputTypeCodec

    Returns BytesCodec<{ inputType?: UnpackResult<InputTypeCodec>; lock?: UnpackResult<LockCodec>; outputType?: UnpackResult<OutputTypeCodec> }, { inputType?: PackParam<InputTypeCodec>; lock?: PackParam<LockCodec>; outputType?: PackParam<OutputTypeCodec> }>

WitnessArgsOf

  • WitnessArgsOf<LockCodec, InputTypeCodec, OutputTypeCodec>(payload: { inputType: InputTypeCodec; lock: LockCodec; outputType: OutputTypeCodec }): BytesCodec<{ inputType?: UnpackResult<InputTypeCodec>; lock?: UnpackResult<LockCodec>; outputType?: UnpackResult<OutputTypeCodec> }, { inputType?: PackParam<InputTypeCodec>; lock?: PackParam<LockCodec>; outputType?: PackParam<OutputTypeCodec> }>
  • Type parameters

    Parameters

    • payload: { inputType: InputTypeCodec; lock: LockCodec; outputType: OutputTypeCodec }
      • inputType: InputTypeCodec
      • lock: LockCodec
      • outputType: OutputTypeCodec

    Returns BytesCodec<{ inputType?: UnpackResult<InputTypeCodec>; lock?: UnpackResult<LockCodec>; outputType?: UnpackResult<OutputTypeCodec> }, { inputType?: PackParam<InputTypeCodec>; lock?: PackParam<LockCodec>; outputType?: PackParam<OutputTypeCodec> }>

assertHexString

  • assertHexString(debugPath: string, str: string): void
  • Parameters

    • debugPath: string
    • str: string

    Returns void

assertHexString

  • assertHexString(debugPath: string, str: string): void
  • Parameters

    • debugPath: string
    • str: string

    Returns void

assertHexadecimal

  • assertHexadecimal(debugPath: string, str: string): void
  • Parameters

    • debugPath: string
    • str: string

    Returns void

assertHexadecimal

  • assertHexadecimal(debugPath: string, str: string): void
  • Parameters

    • debugPath: string
    • str: string

    Returns void

ckbHash

  • Parameters

    Returns Hash

ckbHash

  • Parameters

    Returns Hash

computeScriptHash

  • computeScriptHash(script: Script, options?: undefined | { validate?: undefined | false | true }): Hash
  • compute lock/type hash

    Parameters

    • script: Script
    • Optional options: undefined | { validate?: undefined | false | true }

    Returns Hash

computeScriptHash

  • computeScriptHash(script: Script, options?: undefined | { validate?: undefined | false | true }): Hash
  • compute lock/type hash

    Parameters

    • script: Script
    • Optional options: undefined | { validate?: undefined | false | true }

    Returns Hash

createFixedHexBytesCodec

  • Parameters

    • byteLength: number

    Returns FixedBytesCodec<string, BytesLike>

createFixedHexBytesCodec

  • Parameters

    • byteLength: number

    Returns FixedBytesCodec<string, BytesLike>

deTransformHeaderCodecType

deTransformHeaderCodecType

deTransformTransactionCodecType

deTransformTransactionCodecType

deepCamel

  • deepCamel(data: any): any
  • Parameters

    • data: any

    Returns any

deepCamel

  • deepCamel(data: any): any
  • Parameters

    • data: any

    Returns any

deepCamelizeTransaction

  • deepCamelizeTransaction(data: any): any
  • Parameters

    • data: any

    Returns any

deepCamelizeTransaction

  • deepCamelizeTransaction(data: any): any
  • Parameters

    • data: any

    Returns any

deprecated

  • deprecated(message: string): void
  • Parameters

    • message: string

    Returns void

deprecated

  • deprecated(message: string): void
  • Parameters

    • message: string

    Returns void

generateAbsoluteEpochSince

  • generate absolute-epoch-number format since

    Parameters

    Returns PackedSince

generateAbsoluteEpochSince

  • generate absolute-epoch-number format since

    Parameters

    Returns PackedSince

generateHeaderEpoch

  • generate header epoch from epoch since value

    Parameters

    Returns HexString

generateHeaderEpoch

  • generate header epoch from epoch since value

    Parameters

    Returns HexString

generateSince

  • Parameters

    Returns PackedSince

generateSince

  • Parameters

    Returns PackedSince

generateTypeIdScript

  • Parameters

    Returns Script

generateTypeIdScript

  • Parameters

    Returns Script

hashCode

  • hashCode(buffer: Buffer): number
  • Parameters

    • buffer: Buffer

    Returns number

hashCode

  • hashCode(buffer: Buffer): number
  • Parameters

    • buffer: Buffer

    Returns number

isCellMatchQueryOptions

  • Parameters

    Returns boolean

isCellMatchQueryOptions

  • Parameters

    Returns boolean

isDeepEqual

  • isDeepEqual(a: unknown, b: unknown): boolean
  • Parameters

    • a: unknown
    • b: unknown

    Returns boolean

isDeepEqual

  • isDeepEqual(a: unknown, b: unknown): boolean
  • Parameters

    • a: unknown
    • b: unknown

    Returns boolean

maximumAbsoluteEpochSince

  • return maximum since of args

    Parameters

    • Rest ...args: PackedSince[]

      sinces in absolute-epoch-number format

    Returns PackedSince

maximumAbsoluteEpochSince

  • return maximum since of args

    Parameters

    • Rest ...args: PackedSince[]

      sinces in absolute-epoch-number format

    Returns PackedSince

parseAbsoluteEpochSince

  • Will throw an error if since not in absolute-epoch-number format

    Parameters

    Returns EpochSinceValue

parseAbsoluteEpochSince

  • Will throw an error if since not in absolute-epoch-number format

    Parameters

    Returns EpochSinceValue

parseEpoch

  • parse epoch from blockHeader.epoch

    Parameters

    Returns EpochSinceValue

parseEpoch

  • parse epoch from blockHeader.epoch

    Parameters

    Returns EpochSinceValue

parseSince

  • parseSince(since: PackedSince): { relative: boolean; type: "epochNumber"; value: EpochSinceValue } | { relative: boolean; type: "blockNumber" | "blockTimestamp"; value: bigint }
  • Parse since and get relative or not, type, and value of since

    Parameters

    Returns { relative: boolean; type: "epochNumber"; value: EpochSinceValue } | { relative: boolean; type: "blockNumber" | "blockTimestamp"; value: bigint }

parseSince

  • parseSince(since: PackedSince): { relative: boolean; type: "epochNumber"; value: EpochSinceValue } | { relative: boolean; type: "blockNumber" | "blockTimestamp"; value: bigint }
  • Parse since and get relative or not, type, and value of since

    Parameters

    Returns { relative: boolean; type: "epochNumber"; value: EpochSinceValue } | { relative: boolean; type: "blockNumber" | "blockTimestamp"; value: bigint }

parseSinceCompatible

  • parseSinceCompatible(since: PackedSince): { relative: boolean; type: "epochNumber"; value: EpochSinceValue } | { relative: boolean; type: "blockNumber" | "blockTimestamp"; value: BI }
  • Parameters

    Returns { relative: boolean; type: "epochNumber"; value: EpochSinceValue } | { relative: boolean; type: "blockNumber" | "blockTimestamp"; value: BI }

parseSinceCompatible

  • parseSinceCompatible(since: PackedSince): { relative: boolean; type: "epochNumber"; value: EpochSinceValue } | { relative: boolean; type: "blockNumber" | "blockTimestamp"; value: BI }
  • Parameters

    Returns { relative: boolean; type: "epochNumber"; value: EpochSinceValue } | { relative: boolean; type: "blockNumber" | "blockTimestamp"; value: BI }

readBigUInt128LE

  • deprecated

    please follow the migration-guide convert BigUInt64 little-endian hex string to bigint

    Parameters

    • leHex: HexString

      BigUInt128 little-endian hex string

    Returns bigint

readBigUInt128LE

  • deprecated

    please follow the migration-guide convert BigUInt64 little-endian hex string to bigint

    Parameters

    • leHex: HexString

      BigUInt128 little-endian hex string

    Returns bigint

readBigUInt128LECompatible

readBigUInt128LECompatible

readBigUInt64LE

  • deprecated

    please follow the migration-guide convert BigUInt64 little-endian hex string to bigint

    Parameters

    • hex: HexString

      BigUInt64 little-endian hex string

    Returns bigint

readBigUInt64LE

  • deprecated

    please follow the migration-guide convert BigUInt64 little-endian hex string to bigint

    Parameters

    • hex: HexString

      BigUInt64 little-endian hex string

    Returns bigint

readBigUInt64LECompatible

readBigUInt64LECompatible

toBigUInt128LE

  • toBigUInt128LE(u128: BIish): string
  • deprecated

    please follow the migration-guide convert bigint to BigUInt128 little-endian hex string

    Parameters

    Returns string

toBigUInt128LE

  • toBigUInt128LE(u128: BIish): string
  • deprecated

    please follow the migration-guide convert bigint to BigUInt128 little-endian hex string

    Parameters

    Returns string

toBigUInt64LE

  • deprecated

    please follow the migration-guide convert bigint to BigUInt64 little-endian hex string

    Parameters

    Returns HexString

toBigUInt64LE

  • deprecated

    please follow the migration-guide convert bigint to BigUInt64 little-endian hex string

    Parameters

    Returns HexString

transformHeaderCodecType

transformHeaderCodecType

transformTransactionCodecType

  • from Transantion defined in @ckb-lumos/base/lib/api.d.ts

    export interface Transaction {
     cellDeps: CellDep[];
     hash?: Hash;
     headerDeps: Hash[];
     inputs: Input[];
     outputs: Output[];
     outputsData: HexString[];
     version: HexNumber;
     witnesses: HexString[];
    }
    to :
    interface TransactionCodecType {
      raw: {
        version: Uint32LE;
        cellDeps: DeCellDepVec;
        headerDeps: Byte32Vec;
        inputs: CellInputVec;
        outputs: CellOutputVec;
        outputsData: BytesVec;
      };
      witnesses: BytesVec;
    }

    Parameters

    • data: Transaction

      Transantion defined in @ckb-lumos/base/lib/api.d.ts

    Returns TransactionCodecType

    TransactionCodecType

transformTransactionCodecType

  • from Transantion defined in @ckb-lumos/base/lib/api.d.ts

    export interface Transaction {
     cellDeps: CellDep[];
     hash?: Hash;
     headerDeps: Hash[];
     inputs: Input[];
     outputs: Output[];
     outputsData: HexString[];
     version: HexNumber;
     witnesses: HexString[];
    }
    to :
    interface TransactionCodecType {
      raw: {
        version: Uint32LE;
        cellDeps: DeCellDepVec;
        headerDeps: Byte32Vec;
        inputs: CellInputVec;
        outputs: CellOutputVec;
        outputsData: BytesVec;
      };
      witnesses: BytesVec;
    }

    Parameters

    • data: Transaction

      Transantion defined in @ckb-lumos/base/lib/api.d.ts

    Returns TransactionCodecType

    TransactionCodecType

validateAbsoluteEpochSince

  • Will throw an error if since not in absolute-epoch-number format

    Parameters

    Returns boolean

validateAbsoluteEpochSince

  • Will throw an error if since not in absolute-epoch-number format

    Parameters

    Returns boolean

validateSince

  • Compare since with tipHeader, check since is valid or not.

    Parameters

    Returns boolean

validateSince

  • Compare since with tipHeader, check since is valid or not.

    Parameters

    Returns boolean

Generated using TypeDoc