import { AnyCodec, BytesLike, PackParam, UnpackResult, number, molecule } from "@ckb-lumos/codec"; import { BytesCodec, FixedBytesCodec } from "@ckb-lumos/codec/lib/base"; import type * as api from "./api"; type TransactionCodecType = PackParam; type TransactionUnpackResultType = UnpackResult; type RawTransactionUnpackResultType = UnpackResult; type HeaderCodecType = PackParam; type HeaderUnpackResultType = UnpackResult; type RawHeaderUnpackResultType = UnpackResult; export declare function createFixedHexBytesCodec(byteLength: number): FixedBytesCodec; /** * 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 * ``` */ export declare const Bytes: BytesCodec; export declare const BytesOpt: molecule.OptionLayoutCodec>; export declare const BytesVec: molecule.ArrayLayoutCodec>; export declare const BytesOptVec: molecule.ArrayLayoutCodec>>; export declare const Byte32: FixedBytesCodec; export declare const Byte32Vec: molecule.ArrayLayoutCodec>; export declare function WitnessArgsOf(payload: { lock: LockCodec; inputType: InputTypeCodec; outputType: OutputTypeCodec; }): BytesCodec<{ lock?: UnpackResult; inputType?: UnpackResult; outputType?: UnpackResult; }, { lock?: PackParam; inputType?: PackParam; outputType?: PackParam; }>; /** * * @example * ```ts * // secp256k1 lock witness * WitnessArgs.pack({ lock: '0x' + '00'.repeat(65) }) * ``` */ export declare const WitnessArgs: BytesCodec<{ lock?: string | undefined; inputType?: string | undefined; outputType?: string | undefined; }, { lock?: BytesLike | undefined; inputType?: BytesLike | undefined; outputType?: BytesLike | undefined; }>; /** *
 *  0b0000000 0
 *    ───┬─── │
 *       │    ▼
 *       │   type - use the default vm version
 *       │
 *       ▼
 * data* - use a particular vm version
 * 
* * Implementation of blockchain.mol * https://github.com/nervosnetwork/ckb/blob/5a7efe7a0b720de79ff3761dc6e8424b8d5b22ea/util/types/schemas/blockchain.mol */ export declare const HashType: FixedBytesCodec; export declare const DepType: FixedBytesCodec; export declare const Script: molecule.ObjectLayoutCodec<{ codeHash: FixedBytesCodec; hashType: FixedBytesCodec; args: BytesCodec; }>; export declare const ScriptOpt: molecule.OptionLayoutCodec; hashType: FixedBytesCodec; args: BytesCodec; }>>; export declare const OutPoint: molecule.ObjectLayoutCodec<{ txHash: FixedBytesCodec; index: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; export declare const CellInput: molecule.ObjectLayoutCodec<{ since: FixedBytesCodec; previousOutput: molecule.ObjectLayoutCodec<{ txHash: FixedBytesCodec; index: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; }> & import("@ckb-lumos/codec/lib/base").Fixed; export declare const CellInputVec: molecule.ArrayLayoutCodec; previousOutput: molecule.ObjectLayoutCodec<{ txHash: FixedBytesCodec; index: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; }> & import("@ckb-lumos/codec/lib/base").Fixed>; export declare const CellOutput: molecule.ObjectLayoutCodec<{ capacity: FixedBytesCodec; lock: molecule.ObjectLayoutCodec<{ codeHash: FixedBytesCodec; hashType: FixedBytesCodec; args: BytesCodec; }>; type: molecule.OptionLayoutCodec; hashType: FixedBytesCodec; args: BytesCodec; }>>; }>; export declare const CellOutputVec: molecule.ArrayLayoutCodec; lock: molecule.ObjectLayoutCodec<{ codeHash: FixedBytesCodec; hashType: FixedBytesCodec; args: BytesCodec; }>; type: molecule.OptionLayoutCodec; hashType: FixedBytesCodec; args: BytesCodec; }>>; }>>; export declare const CellDep: molecule.ObjectLayoutCodec<{ outPoint: molecule.ObjectLayoutCodec<{ txHash: FixedBytesCodec; index: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; depType: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; export declare const CellDepVec: molecule.ArrayLayoutCodec; index: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; depType: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed>; export declare const RawTransaction: molecule.ObjectLayoutCodec<{ version: FixedBytesCodec; cellDeps: molecule.ArrayLayoutCodec; index: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; depType: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed>; headerDeps: molecule.ArrayLayoutCodec>; inputs: molecule.ArrayLayoutCodec; previousOutput: molecule.ObjectLayoutCodec<{ txHash: FixedBytesCodec; index: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; }> & import("@ckb-lumos/codec/lib/base").Fixed>; outputs: molecule.ArrayLayoutCodec; lock: molecule.ObjectLayoutCodec<{ codeHash: FixedBytesCodec; hashType: FixedBytesCodec; args: BytesCodec; }>; type: molecule.OptionLayoutCodec; hashType: FixedBytesCodec; args: BytesCodec; }>>; }>>; outputsData: molecule.ArrayLayoutCodec>; }>; declare const BaseTransaction: molecule.ObjectLayoutCodec<{ raw: molecule.ObjectLayoutCodec<{ version: FixedBytesCodec; cellDeps: molecule.ArrayLayoutCodec; index: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; depType: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed>; headerDeps: molecule.ArrayLayoutCodec>; inputs: molecule.ArrayLayoutCodec; previousOutput: molecule.ObjectLayoutCodec<{ txHash: FixedBytesCodec; index: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; }> & import("@ckb-lumos/codec/lib/base").Fixed>; outputs: molecule.ArrayLayoutCodec; lock: molecule.ObjectLayoutCodec<{ codeHash: FixedBytesCodec; hashType: FixedBytesCodec; args: BytesCodec; }>; type: molecule.OptionLayoutCodec; hashType: FixedBytesCodec; args: BytesCodec; }>>; }>>; outputsData: molecule.ArrayLayoutCodec>; }>; witnesses: molecule.ArrayLayoutCodec>; }>; export declare const Transaction: BytesCodec> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, never>> & Pick<{ outPoint: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, "outPoint" | "depType">)[]; headerDeps: string[]; inputs: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, never>> & Pick<{ since: string; previousOutput: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, "since" | "previousOutput">)[]; outputs: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "type">> & Pick<{ capacity: string; lock: Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "capacity" | "lock">)[]; outputsData: string[]; }, never>> & Pick<{ version: string; cellDeps: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, never>> & Pick<{ outPoint: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, "outPoint" | "depType">)[]; headerDeps: string[]; inputs: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, never>> & Pick<{ since: string; previousOutput: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, "since" | "previousOutput">)[]; outputs: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "type">> & Pick<{ capacity: string; lock: Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "capacity" | "lock">)[]; outputsData: string[]; }, "version" | "cellDeps" | "headerDeps" | "inputs" | "outputs" | "outputsData"> & { witnesses: string[]; }, api.Transaction>; export declare const TransactionVec: molecule.ArrayLayoutCodec> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, never>> & Pick<{ outPoint: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, "outPoint" | "depType">)[]; headerDeps: string[]; inputs: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, never>> & Pick<{ since: string; previousOutput: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, "since" | "previousOutput">)[]; outputs: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "type">> & Pick<{ capacity: string; lock: Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "capacity" | "lock">)[]; outputsData: string[]; }, never>> & Pick<{ version: string; cellDeps: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, never>> & Pick<{ outPoint: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, "outPoint" | "depType">)[]; headerDeps: string[]; inputs: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, never>> & Pick<{ since: string; previousOutput: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, "since" | "previousOutput">)[]; outputs: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "type">> & Pick<{ capacity: string; lock: Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "capacity" | "lock">)[]; outputsData: string[]; }, "version" | "cellDeps" | "headerDeps" | "inputs" | "outputs" | "outputsData"> & { witnesses: string[]; }, api.Transaction>>; export declare const RawHeader: molecule.ObjectLayoutCodec<{ version: FixedBytesCodec; compactTarget: FixedBytesCodec; timestamp: FixedBytesCodec; number: FixedBytesCodec; epoch: FixedBytesCodec; parentHash: FixedBytesCodec; transactionsRoot: FixedBytesCodec; proposalsHash: FixedBytesCodec; extraHash: FixedBytesCodec; dao: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; export declare const BaseHeader: molecule.ObjectLayoutCodec<{ raw: molecule.ObjectLayoutCodec<{ version: FixedBytesCodec; compactTarget: FixedBytesCodec; timestamp: FixedBytesCodec; number: FixedBytesCodec; epoch: FixedBytesCodec; parentHash: FixedBytesCodec; transactionsRoot: FixedBytesCodec; proposalsHash: FixedBytesCodec; extraHash: FixedBytesCodec; dao: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; nonce: FixedBytesCodec; }> & import("@ckb-lumos/codec/lib/base").Fixed; export declare const Header: BytesCodec> & Pick<{ version: string; compactTarget: string; timestamp: string; number: string; epoch: string; parentHash: string; transactionsRoot: string; proposalsHash: string; extraHash: string; dao: string; }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao"> & { nonce: string; hash: string; }, api.Header>; export declare const ProposalShortId: FixedBytesCodec; export declare const ProposalShortIdVec: molecule.ArrayLayoutCodec>; export declare const UncleBlock: molecule.ObjectLayoutCodec<{ header: BytesCodec> & Pick<{ version: string; compactTarget: string; timestamp: string; number: string; epoch: string; parentHash: string; transactionsRoot: string; proposalsHash: string; extraHash: string; dao: string; }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao"> & { nonce: string; hash: string; }, api.Header>; proposals: molecule.ArrayLayoutCodec>; }>; export declare const UncleBlockVec: molecule.ArrayLayoutCodec> & Pick<{ version: string; compactTarget: string; timestamp: string; number: string; epoch: string; parentHash: string; transactionsRoot: string; proposalsHash: string; extraHash: string; dao: string; }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao"> & { nonce: string; hash: string; }, api.Header>; proposals: molecule.ArrayLayoutCodec>; }>>; export declare const Block: molecule.ObjectLayoutCodec<{ header: BytesCodec> & Pick<{ version: string; compactTarget: string; timestamp: string; number: string; epoch: string; parentHash: string; transactionsRoot: string; proposalsHash: string; extraHash: string; dao: string; }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao"> & { nonce: string; hash: string; }, api.Header>; uncles: molecule.ArrayLayoutCodec> & Pick<{ version: string; compactTarget: string; timestamp: string; number: string; epoch: string; parentHash: string; transactionsRoot: string; proposalsHash: string; extraHash: string; dao: string; }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao"> & { nonce: string; hash: string; }, api.Header>; proposals: molecule.ArrayLayoutCodec>; }>>; transactions: molecule.ArrayLayoutCodec> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, never>> & Pick<{ outPoint: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, "outPoint" | "depType">)[]; headerDeps: string[]; inputs: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, never>> & Pick<{ since: string; previousOutput: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, "since" | "previousOutput">)[]; outputs: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "type">> & Pick<{ capacity: string; lock: Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "capacity" | "lock">)[]; outputsData: string[]; }, never>> & Pick<{ version: string; cellDeps: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, never>> & Pick<{ outPoint: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, "outPoint" | "depType">)[]; headerDeps: string[]; inputs: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, never>> & Pick<{ since: string; previousOutput: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, "since" | "previousOutput">)[]; outputs: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "type">> & Pick<{ capacity: string; lock: Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "capacity" | "lock">)[]; outputsData: string[]; }, "version" | "cellDeps" | "headerDeps" | "inputs" | "outputs" | "outputsData"> & { witnesses: string[]; }, api.Transaction>>; proposals: molecule.ArrayLayoutCodec>; }>; export declare const BlockV1: molecule.ObjectLayoutCodec<{ header: BytesCodec> & Pick<{ version: string; compactTarget: string; timestamp: string; number: string; epoch: string; parentHash: string; transactionsRoot: string; proposalsHash: string; extraHash: string; dao: string; }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao"> & { nonce: string; hash: string; }, api.Header>; uncles: molecule.ArrayLayoutCodec> & Pick<{ version: string; compactTarget: string; timestamp: string; number: string; epoch: string; parentHash: string; transactionsRoot: string; proposalsHash: string; extraHash: string; dao: string; }, "number" | "version" | "compactTarget" | "timestamp" | "epoch" | "parentHash" | "transactionsRoot" | "proposalsHash" | "extraHash" | "dao"> & { nonce: string; hash: string; }, api.Header>; proposals: molecule.ArrayLayoutCodec>; }>>; transactions: molecule.ArrayLayoutCodec> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, never>> & Pick<{ outPoint: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, "outPoint" | "depType">)[]; headerDeps: string[]; inputs: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, never>> & Pick<{ since: string; previousOutput: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, "since" | "previousOutput">)[]; outputs: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "type">> & Pick<{ capacity: string; lock: Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "capacity" | "lock">)[]; outputsData: string[]; }, never>> & Pick<{ version: string; cellDeps: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, never>> & Pick<{ outPoint: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; depType: api.DepType; }, "outPoint" | "depType">)[]; headerDeps: string[]; inputs: (Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, never>> & Pick<{ since: string; previousOutput: Partial> & Pick<{ txHash: string; index: string; }, "index" | "txHash">; }, "since" | "previousOutput">)[]; outputs: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "type">> & Pick<{ capacity: string; lock: Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">; type: (Partial> & Pick<{ codeHash: string; hashType: api.HashType; args: string; }, "codeHash" | "hashType" | "args">) | undefined; }, "capacity" | "lock">)[]; outputsData: string[]; }, "version" | "cellDeps" | "headerDeps" | "inputs" | "outputs" | "outputsData"> & { witnesses: string[]; }, api.Transaction>>; proposals: molecule.ArrayLayoutCodec>; extension: BytesCodec; }>; export declare const CellbaseWitness: molecule.ObjectLayoutCodec<{ lock: molecule.ObjectLayoutCodec<{ codeHash: FixedBytesCodec; hashType: FixedBytesCodec; args: BytesCodec; }>; message: BytesCodec; }>; /** * 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; * } * ``` * @param data Transantion defined in @ckb-lumos/base/lib/api.d.ts * @returns TransactionCodecType */ export declare function transformTransactionCodecType(data: api.Transaction): TransactionCodecType; export declare function deTransformTransactionCodecType(data: TransactionUnpackResultType): RawTransactionUnpackResultType & { witnesses: string[]; }; export declare function transformHeaderCodecType(data: api.Header): HeaderCodecType; export declare function deTransformHeaderCodecType(data: HeaderUnpackResultType): RawHeaderUnpackResultType & { nonce: string; hash: string; }; export {}; //# sourceMappingURL=blockchain.d.ts.map