Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ckb-lumos/base

Package Overview
Dependencies
Maintainers
3
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckb-lumos/base - npm Package Compare versions

Comparing version 0.0.0-canary-31e2f29-20240122070336 to 0.0.0-canary-321ae50-20240807024443

6

lib/api.d.ts

@@ -75,2 +75,4 @@ import { Hash, Hexadecimal, HexNumber, HexString, PackedSince } from "./primitive";

cycles: Uint64 | null;
fee: Uint64 | null;
minReplaceFee: Uint64 | null;
}

@@ -270,2 +272,5 @@ export interface Cell {

lastTxsUpdatedAt: HexNumber;
minRbfRate: HexNumber;
maxTxPoolSize: HexNumber;
txSizeLimit: HexNumber;
}

@@ -291,2 +296,3 @@ export interface TxPoolIds {

};
conflicted: Hash[];
}

@@ -293,0 +299,0 @@ export type RawTxPool = TxPoolIds | TxPoolVerbosity;

191

lib/blockchain.d.ts

@@ -1,5 +0,4 @@

import { AnyCodec, BytesLike, PackParam, UnpackResult } from "@ckb-lumos/codec";
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";
import { BIish } from "@ckb-lumos/bi";
type TransactionCodecType = PackParam<typeof BaseTransaction>;

@@ -21,7 +20,7 @@ type TransactionUnpackResultType = UnpackResult<typeof BaseTransaction>;

export declare const Bytes: BytesCodec<string, BytesLike>;
export declare const BytesOpt: import("@ckb-lumos/codec/lib/molecule/layout").OptionCodec<BytesCodec<string, BytesLike>>;
export declare const BytesVec: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<BytesCodec<string, BytesLike>>;
export declare const BytesOptVec: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").OptionCodec<BytesCodec<string, BytesLike>>>;
export declare const BytesOpt: molecule.OptionLayoutCodec<BytesCodec<string, BytesLike>>;
export declare const BytesVec: molecule.ArrayLayoutCodec<BytesCodec<string, BytesLike>>;
export declare const BytesOptVec: molecule.ArrayLayoutCodec<molecule.OptionLayoutCodec<BytesCodec<string, BytesLike>>>;
export declare const Byte32: FixedBytesCodec<string, BytesLike>;
export declare const Byte32Vec: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<FixedBytesCodec<string, BytesLike>>;
export declare const Byte32Vec: molecule.ArrayLayoutCodec<FixedBytesCodec<string, BytesLike>>;
export declare function WitnessArgsOf<LockCodec extends AnyCodec, InputTypeCodec extends AnyCodec, OutputTypeCodec extends AnyCodec>(payload: {

@@ -73,3 +72,3 @@ lock: LockCodec;

export declare const DepType: FixedBytesCodec<api.DepType, api.DepType>;
export declare const Script: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const Script: molecule.ObjectLayoutCodec<{
codeHash: FixedBytesCodec<string, BytesLike>;

@@ -79,3 +78,3 @@ hashType: FixedBytesCodec<api.HashType, api.HashType>;

}>;
export declare const ScriptOpt: import("@ckb-lumos/codec/lib/molecule/layout").OptionCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const ScriptOpt: molecule.OptionLayoutCodec<molecule.ObjectLayoutCodec<{
codeHash: FixedBytesCodec<string, BytesLike>;

@@ -85,23 +84,23 @@ hashType: FixedBytesCodec<api.HashType, api.HashType>;

}>>;
export declare const OutPoint: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const OutPoint: molecule.ObjectLayoutCodec<{
txHash: FixedBytesCodec<string, BytesLike>;
index: FixedBytesCodec<string, BIish>;
index: FixedBytesCodec<string, number.BIish>;
}> & import("@ckb-lumos/codec/lib/base").Fixed;
export declare const CellInput: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
since: FixedBytesCodec<string, BIish>;
previousOutput: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const CellInput: molecule.ObjectLayoutCodec<{
since: FixedBytesCodec<string, number.BIish>;
previousOutput: molecule.ObjectLayoutCodec<{
txHash: FixedBytesCodec<string, BytesLike>;
index: FixedBytesCodec<string, BIish>;
index: FixedBytesCodec<string, number.BIish>;
}> & import("@ckb-lumos/codec/lib/base").Fixed;
}> & import("@ckb-lumos/codec/lib/base").Fixed;
export declare const CellInputVec: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
since: FixedBytesCodec<string, BIish>;
previousOutput: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const CellInputVec: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
since: FixedBytesCodec<string, number.BIish>;
previousOutput: molecule.ObjectLayoutCodec<{
txHash: FixedBytesCodec<string, BytesLike>;
index: FixedBytesCodec<string, BIish>;
index: FixedBytesCodec<string, number.BIish>;
}> & import("@ckb-lumos/codec/lib/base").Fixed;
}> & import("@ckb-lumos/codec/lib/base").Fixed>;
export declare const CellOutput: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
capacity: FixedBytesCodec<string, BIish>;
lock: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const CellOutput: molecule.ObjectLayoutCodec<{
capacity: FixedBytesCodec<string, number.BIish>;
lock: molecule.ObjectLayoutCodec<{
codeHash: FixedBytesCodec<string, BytesLike>;

@@ -111,3 +110,3 @@ hashType: FixedBytesCodec<api.HashType, api.HashType>;

}>;
type: import("@ckb-lumos/codec/lib/molecule/layout").OptionCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
type: molecule.OptionLayoutCodec<molecule.ObjectLayoutCodec<{
codeHash: FixedBytesCodec<string, BytesLike>;

@@ -118,5 +117,5 @@ hashType: FixedBytesCodec<api.HashType, api.HashType>;

}>;
export declare const CellOutputVec: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
capacity: FixedBytesCodec<string, BIish>;
lock: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const CellOutputVec: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
capacity: FixedBytesCodec<string, number.BIish>;
lock: molecule.ObjectLayoutCodec<{
codeHash: FixedBytesCodec<string, BytesLike>;

@@ -126,3 +125,3 @@ hashType: FixedBytesCodec<api.HashType, api.HashType>;

}>;
type: import("@ckb-lumos/codec/lib/molecule/layout").OptionCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
type: molecule.OptionLayoutCodec<molecule.ObjectLayoutCodec<{
codeHash: FixedBytesCodec<string, BytesLike>;

@@ -133,36 +132,36 @@ hashType: FixedBytesCodec<api.HashType, api.HashType>;

}>>;
export declare const CellDep: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
outPoint: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const CellDep: molecule.ObjectLayoutCodec<{
outPoint: molecule.ObjectLayoutCodec<{
txHash: FixedBytesCodec<string, BytesLike>;
index: FixedBytesCodec<string, BIish>;
index: FixedBytesCodec<string, number.BIish>;
}> & import("@ckb-lumos/codec/lib/base").Fixed;
depType: FixedBytesCodec<api.DepType, api.DepType>;
}> & import("@ckb-lumos/codec/lib/base").Fixed;
export declare const CellDepVec: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
outPoint: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const CellDepVec: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
outPoint: molecule.ObjectLayoutCodec<{
txHash: FixedBytesCodec<string, BytesLike>;
index: FixedBytesCodec<string, BIish>;
index: FixedBytesCodec<string, number.BIish>;
}> & import("@ckb-lumos/codec/lib/base").Fixed;
depType: FixedBytesCodec<api.DepType, api.DepType>;
}> & import("@ckb-lumos/codec/lib/base").Fixed>;
export declare const RawTransaction: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
version: FixedBytesCodec<string, BIish>;
cellDeps: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
outPoint: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const RawTransaction: molecule.ObjectLayoutCodec<{
version: FixedBytesCodec<string, number.BIish>;
cellDeps: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
outPoint: molecule.ObjectLayoutCodec<{
txHash: FixedBytesCodec<string, BytesLike>;
index: FixedBytesCodec<string, BIish>;
index: FixedBytesCodec<string, number.BIish>;
}> & import("@ckb-lumos/codec/lib/base").Fixed;
depType: FixedBytesCodec<api.DepType, api.DepType>;
}> & import("@ckb-lumos/codec/lib/base").Fixed>;
headerDeps: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<FixedBytesCodec<string, BytesLike>>;
inputs: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
since: FixedBytesCodec<string, BIish>;
previousOutput: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
headerDeps: molecule.ArrayLayoutCodec<FixedBytesCodec<string, BytesLike>>;
inputs: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
since: FixedBytesCodec<string, number.BIish>;
previousOutput: molecule.ObjectLayoutCodec<{
txHash: FixedBytesCodec<string, BytesLike>;
index: FixedBytesCodec<string, BIish>;
index: FixedBytesCodec<string, number.BIish>;
}> & import("@ckb-lumos/codec/lib/base").Fixed;
}> & import("@ckb-lumos/codec/lib/base").Fixed>;
outputs: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
capacity: FixedBytesCodec<string, BIish>;
lock: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
outputs: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
capacity: FixedBytesCodec<string, number.BIish>;
lock: molecule.ObjectLayoutCodec<{
codeHash: FixedBytesCodec<string, BytesLike>;

@@ -172,3 +171,3 @@ hashType: FixedBytesCodec<api.HashType, api.HashType>;

}>;
type: import("@ckb-lumos/codec/lib/molecule/layout").OptionCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
type: molecule.OptionLayoutCodec<molecule.ObjectLayoutCodec<{
codeHash: FixedBytesCodec<string, BytesLike>;

@@ -179,25 +178,25 @@ hashType: FixedBytesCodec<api.HashType, api.HashType>;

}>>;
outputsData: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<BytesCodec<string, BytesLike>>;
outputsData: molecule.ArrayLayoutCodec<BytesCodec<string, BytesLike>>;
}>;
declare const BaseTransaction: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
raw: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
version: FixedBytesCodec<string, BIish>;
cellDeps: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
outPoint: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
declare const BaseTransaction: molecule.ObjectLayoutCodec<{
raw: molecule.ObjectLayoutCodec<{
version: FixedBytesCodec<string, number.BIish>;
cellDeps: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
outPoint: molecule.ObjectLayoutCodec<{
txHash: FixedBytesCodec<string, BytesLike>;
index: FixedBytesCodec<string, BIish>;
index: FixedBytesCodec<string, number.BIish>;
}> & import("@ckb-lumos/codec/lib/base").Fixed;
depType: FixedBytesCodec<api.DepType, api.DepType>;
}> & import("@ckb-lumos/codec/lib/base").Fixed>;
headerDeps: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<FixedBytesCodec<string, BytesLike>>;
inputs: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
since: FixedBytesCodec<string, BIish>;
previousOutput: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
headerDeps: molecule.ArrayLayoutCodec<FixedBytesCodec<string, BytesLike>>;
inputs: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
since: FixedBytesCodec<string, number.BIish>;
previousOutput: molecule.ObjectLayoutCodec<{
txHash: FixedBytesCodec<string, BytesLike>;
index: FixedBytesCodec<string, BIish>;
index: FixedBytesCodec<string, number.BIish>;
}> & import("@ckb-lumos/codec/lib/base").Fixed;
}> & import("@ckb-lumos/codec/lib/base").Fixed>;
outputs: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
capacity: FixedBytesCodec<string, BIish>;
lock: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
outputs: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
capacity: FixedBytesCodec<string, number.BIish>;
lock: molecule.ObjectLayoutCodec<{
codeHash: FixedBytesCodec<string, BytesLike>;

@@ -207,3 +206,3 @@ hashType: FixedBytesCodec<api.HashType, api.HashType>;

}>;
type: import("@ckb-lumos/codec/lib/molecule/layout").OptionCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
type: molecule.OptionLayoutCodec<molecule.ObjectLayoutCodec<{
codeHash: FixedBytesCodec<string, BytesLike>;

@@ -214,5 +213,5 @@ hashType: FixedBytesCodec<api.HashType, api.HashType>;

}>>;
outputsData: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<BytesCodec<string, BytesLike>>;
outputsData: molecule.ArrayLayoutCodec<BytesCodec<string, BytesLike>>;
}>;
witnesses: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<BytesCodec<string, BytesLike>>;
witnesses: molecule.ArrayLayoutCodec<BytesCodec<string, BytesLike>>;
}>;

@@ -388,3 +387,3 @@ export declare const Transaction: BytesCodec<Partial<Pick<{

}, api.Transaction>;
export declare const TransactionVec: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<BytesCodec<Partial<Pick<{
export declare const TransactionVec: molecule.ArrayLayoutCodec<BytesCodec<Partial<Pick<{
version: string;

@@ -558,8 +557,8 @@ cellDeps: (Partial<Pick<{

}, api.Transaction>>;
export declare const RawHeader: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
version: FixedBytesCodec<string, BIish>;
compactTarget: FixedBytesCodec<string, BIish>;
timestamp: FixedBytesCodec<string, BIish>;
number: FixedBytesCodec<string, BIish>;
epoch: FixedBytesCodec<string, BIish>;
export declare const RawHeader: molecule.ObjectLayoutCodec<{
version: FixedBytesCodec<string, number.BIish>;
compactTarget: FixedBytesCodec<string, number.BIish>;
timestamp: FixedBytesCodec<string, number.BIish>;
number: FixedBytesCodec<string, number.BIish>;
epoch: FixedBytesCodec<string, number.BIish>;
parentHash: FixedBytesCodec<string, BytesLike>;

@@ -571,9 +570,9 @@ transactionsRoot: FixedBytesCodec<string, BytesLike>;

}> & import("@ckb-lumos/codec/lib/base").Fixed;
export declare const BaseHeader: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
raw: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
version: FixedBytesCodec<string, BIish>;
compactTarget: FixedBytesCodec<string, BIish>;
timestamp: FixedBytesCodec<string, BIish>;
number: FixedBytesCodec<string, BIish>;
epoch: FixedBytesCodec<string, BIish>;
export declare const BaseHeader: molecule.ObjectLayoutCodec<{
raw: molecule.ObjectLayoutCodec<{
version: FixedBytesCodec<string, number.BIish>;
compactTarget: FixedBytesCodec<string, number.BIish>;
timestamp: FixedBytesCodec<string, number.BIish>;
number: FixedBytesCodec<string, number.BIish>;
epoch: FixedBytesCodec<string, number.BIish>;
parentHash: FixedBytesCodec<string, BytesLike>;

@@ -585,3 +584,3 @@ transactionsRoot: FixedBytesCodec<string, BytesLike>;

}> & import("@ckb-lumos/codec/lib/base").Fixed;
nonce: FixedBytesCodec<string, BIish>;
nonce: FixedBytesCodec<string, number.BIish>;
}> & import("@ckb-lumos/codec/lib/base").Fixed;

@@ -615,4 +614,4 @@ export declare const Header: BytesCodec<Partial<Pick<{

export declare const ProposalShortId: FixedBytesCodec<string, BytesLike>;
export declare const ProposalShortIdVec: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<FixedBytesCodec<string, BytesLike>>;
export declare const UncleBlock: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const ProposalShortIdVec: molecule.ArrayLayoutCodec<FixedBytesCodec<string, BytesLike>>;
export declare const UncleBlock: molecule.ObjectLayoutCodec<{
header: BytesCodec<Partial<Pick<{

@@ -644,5 +643,5 @@ version: string;

}, api.Header>;
proposals: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<FixedBytesCodec<string, BytesLike>>;
proposals: molecule.ArrayLayoutCodec<FixedBytesCodec<string, BytesLike>>;
}>;
export declare const UncleBlockVec: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const UncleBlockVec: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
header: BytesCodec<Partial<Pick<{

@@ -674,5 +673,5 @@ version: string;

}, api.Header>;
proposals: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<FixedBytesCodec<string, BytesLike>>;
proposals: molecule.ArrayLayoutCodec<FixedBytesCodec<string, BytesLike>>;
}>>;
export declare const Block: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const Block: molecule.ObjectLayoutCodec<{
header: BytesCodec<Partial<Pick<{

@@ -704,3 +703,3 @@ version: string;

}, api.Header>;
uncles: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
uncles: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
header: BytesCodec<Partial<Pick<{

@@ -732,5 +731,5 @@ version: string;

}, api.Header>;
proposals: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<FixedBytesCodec<string, BytesLike>>;
proposals: molecule.ArrayLayoutCodec<FixedBytesCodec<string, BytesLike>>;
}>>;
transactions: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<BytesCodec<Partial<Pick<{
transactions: molecule.ArrayLayoutCodec<BytesCodec<Partial<Pick<{
version: string;

@@ -904,5 +903,5 @@ cellDeps: (Partial<Pick<{

}, api.Transaction>>;
proposals: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<FixedBytesCodec<string, BytesLike>>;
proposals: molecule.ArrayLayoutCodec<FixedBytesCodec<string, BytesLike>>;
}>;
export declare const BlockV1: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const BlockV1: molecule.ObjectLayoutCodec<{
header: BytesCodec<Partial<Pick<{

@@ -934,3 +933,3 @@ version: string;

}, api.Header>;
uncles: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
uncles: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
header: BytesCodec<Partial<Pick<{

@@ -962,5 +961,5 @@ version: string;

}, api.Header>;
proposals: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<FixedBytesCodec<string, BytesLike>>;
proposals: molecule.ArrayLayoutCodec<FixedBytesCodec<string, BytesLike>>;
}>>;
transactions: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<BytesCodec<Partial<Pick<{
transactions: molecule.ArrayLayoutCodec<BytesCodec<Partial<Pick<{
version: string;

@@ -1134,7 +1133,7 @@ cellDeps: (Partial<Pick<{

}, api.Transaction>>;
proposals: import("@ckb-lumos/codec/lib/molecule/layout").ArrayCodec<FixedBytesCodec<string, BytesLike>>;
proposals: molecule.ArrayLayoutCodec<FixedBytesCodec<string, BytesLike>>;
extension: BytesCodec<string, BytesLike>;
}>;
export declare const CellbaseWitness: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
lock: import("@ckb-lumos/codec/lib/molecule/layout").ObjectCodec<{
export declare const CellbaseWitness: molecule.ObjectLayoutCodec<{
lock: molecule.ObjectLayoutCodec<{
codeHash: FixedBytesCodec<string, BytesLike>;

@@ -1141,0 +1140,0 @@ hashType: FixedBytesCodec<api.HashType, api.HashType>;

@@ -55,17 +55,11 @@ "use strict";

// vector Bytes <byte>
const Bytes = byteVecOf({
const Bytes = exports.Bytes = byteVecOf({
pack: bytify,
unpack: hexify
});
exports.Bytes = Bytes;
const BytesOpt = option(Bytes);
exports.BytesOpt = BytesOpt;
const BytesVec = vector(Bytes);
exports.BytesVec = BytesVec;
const BytesOptVec = vector(BytesOpt);
exports.BytesOptVec = BytesOptVec;
const Byte32 = createFixedHexBytesCodec(32);
exports.Byte32 = Byte32;
const Byte32Vec = vector(Byte32);
exports.Byte32Vec = Byte32Vec;
const BytesOpt = exports.BytesOpt = option(Bytes);
const BytesVec = exports.BytesVec = vector(Bytes);
const BytesOptVec = exports.BytesOptVec = vector(BytesOpt);
const Byte32 = exports.Byte32 = createFixedHexBytesCodec(32);
const Byte32Vec = exports.Byte32Vec = vector(Byte32);
function WitnessArgsOf(payload) {

@@ -91,3 +85,3 @@ return table({

*/
const WitnessArgs = WitnessArgsOf({
const WitnessArgs = exports.WitnessArgs = WitnessArgsOf({
lock: HexifyCodec,

@@ -112,4 +106,3 @@ inputType: HexifyCodec,

*/
exports.WitnessArgs = WitnessArgs;
const HashType = (0, _codec.createFixedBytesCodec)({
const HashType = exports.HashType = (0, _codec.createFixedBytesCodec)({
byteLength: 1,

@@ -134,4 +127,3 @@ pack: type => {

});
exports.HashType = HashType;
const DepType = (0, _codec.createFixedBytesCodec)({
const DepType = exports.DepType = (0, _codec.createFixedBytesCodec)({
byteLength: 1,

@@ -150,4 +142,3 @@ pack: type => {

});
exports.DepType = DepType;
const Script = table({
const Script = exports.Script = table({
codeHash: Byte32,

@@ -157,18 +148,13 @@ hashType: HashType,

}, ["codeHash", "hashType", "args"]);
exports.Script = Script;
const ScriptOpt = option(Script);
exports.ScriptOpt = ScriptOpt;
const OutPoint = struct({
const ScriptOpt = exports.ScriptOpt = option(Script);
const OutPoint = exports.OutPoint = struct({
txHash: Byte32,
index: Uint32LE
}, ["txHash", "index"]);
exports.OutPoint = OutPoint;
const CellInput = struct({
const CellInput = exports.CellInput = struct({
since: Uint64LE,
previousOutput: OutPoint
}, ["since", "previousOutput"]);
exports.CellInput = CellInput;
const CellInputVec = vector(CellInput);
exports.CellInputVec = CellInputVec;
const CellOutput = table({
const CellInputVec = exports.CellInputVec = vector(CellInput);
const CellOutput = exports.CellOutput = table({
capacity: Uint64LE,

@@ -178,13 +164,9 @@ lock: Script,

}, ["capacity", "lock", "type"]);
exports.CellOutput = CellOutput;
const CellOutputVec = vector(CellOutput);
exports.CellOutputVec = CellOutputVec;
const CellDep = struct({
const CellOutputVec = exports.CellOutputVec = vector(CellOutput);
const CellDep = exports.CellDep = struct({
outPoint: OutPoint,
depType: DepType
}, ["outPoint", "depType"]);
exports.CellDep = CellDep;
const CellDepVec = vector(CellDep);
exports.CellDepVec = CellDepVec;
const RawTransaction = table({
const CellDepVec = exports.CellDepVec = vector(CellDep);
const RawTransaction = exports.RawTransaction = table({
version: Uint32LE,

@@ -197,3 +179,2 @@ cellDeps: CellDepVec,

}, ["version", "cellDeps", "headerDeps", "inputs", "outputs", "outputsData"]);
exports.RawTransaction = RawTransaction;
const BaseTransaction = table({

@@ -203,10 +184,8 @@ raw: RawTransaction,

}, ["raw", "witnesses"]);
const Transaction = (0, _codec.createBytesCodec)({
const Transaction = exports.Transaction = (0, _codec.createBytesCodec)({
pack: tx => BaseTransaction.pack(transformTransactionCodecType(tx)),
unpack: buf => deTransformTransactionCodecType(BaseTransaction.unpack(buf))
});
exports.Transaction = Transaction;
const TransactionVec = vector(Transaction);
exports.TransactionVec = TransactionVec;
const RawHeader = struct({
const TransactionVec = exports.TransactionVec = vector(Transaction);
const RawHeader = exports.RawHeader = struct({
version: Uint32LE,

@@ -223,25 +202,18 @@ compactTarget: Uint32LE,

}, ["version", "compactTarget", "timestamp", "number", "epoch", "parentHash", "transactionsRoot", "proposalsHash", "extraHash", "dao"]);
exports.RawHeader = RawHeader;
const BaseHeader = struct({
const BaseHeader = exports.BaseHeader = struct({
raw: RawHeader,
nonce: Uint128LE
}, ["raw", "nonce"]);
exports.BaseHeader = BaseHeader;
const Header = (0, _codec.createBytesCodec)({
const Header = exports.Header = (0, _codec.createBytesCodec)({
pack: header => BaseHeader.pack(transformHeaderCodecType(header)),
unpack: buf => deTransformHeaderCodecType(BaseHeader.unpack(buf))
});
exports.Header = Header;
const ProposalShortId = createFixedHexBytesCodec(10);
exports.ProposalShortId = ProposalShortId;
const ProposalShortIdVec = vector(ProposalShortId);
exports.ProposalShortIdVec = ProposalShortIdVec;
const UncleBlock = table({
const ProposalShortId = exports.ProposalShortId = createFixedHexBytesCodec(10);
const ProposalShortIdVec = exports.ProposalShortIdVec = vector(ProposalShortId);
const UncleBlock = exports.UncleBlock = table({
header: Header,
proposals: ProposalShortIdVec
}, ["header", "proposals"]);
exports.UncleBlock = UncleBlock;
const UncleBlockVec = vector(UncleBlock);
exports.UncleBlockVec = UncleBlockVec;
const Block = table({
const UncleBlockVec = exports.UncleBlockVec = vector(UncleBlock);
const Block = exports.Block = table({
header: Header,

@@ -252,4 +224,3 @@ uncles: UncleBlockVec,

}, ["header", "uncles", "transactions", "proposals"]);
exports.Block = Block;
const BlockV1 = table({
const BlockV1 = exports.BlockV1 = table({
header: Header,

@@ -261,4 +232,3 @@ uncles: UncleBlockVec,

}, ["header", "uncles", "transactions", "proposals", "extension"]);
exports.BlockV1 = BlockV1;
const CellbaseWitness = table({
const CellbaseWitness = exports.CellbaseWitness = table({
lock: Script,

@@ -298,3 +268,2 @@ message: Bytes

*/
exports.CellbaseWitness = CellbaseWitness;
function transformTransactionCodecType(data) {

@@ -301,0 +270,0 @@ return {

@@ -65,4 +65,4 @@ "use strict";

});
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
//# sourceMappingURL=index.js.map

@@ -132,4 +132,3 @@ "use strict";

};
var _default = indexer;
exports.default = _default;
var _default = exports.default = indexer;
//# sourceMappingURL=indexer.js.map

@@ -1,2 +0,1 @@

/// <reference types="node" />
import { Blake2b } from "blake2b";

@@ -17,4 +16,13 @@ import { BytesLike } from "@ckb-lumos/codec";

}
/**
* create a 32-bytes Blake2b hash with the CKB personalization
* @param data
*/
declare function ckbHash(data: BytesLike): Hash;
/**
* create a 20-bytes Blake2b hash with the CKB personalization
* @param data
*/
declare function ckbHash160(data: BytesLike): Hash;
/**
* compute lock/type hash

@@ -25,3 +33,3 @@ *

declare function computeScriptHash(script: Script): string;
declare function hashCode(buffer: Buffer): number;
declare function hashCode(buffer: Uint8Array): number;
/**

@@ -66,3 +74,2 @@ * @deprecated please follow the {@link https://lumos-website.vercel.app/migrations/migrate-to-v0.19 migration-guide}

declare function assertHexadecimal(debugPath: string, str: string): void;
declare function isDeepEqual(a: any, b: any): boolean;
/**

@@ -76,3 +83,3 @@ * Generate a type script for type id {@link https://xuejie.space/2020_02_03_introduction_to_ckb_script_programming_type_id/}

declare function deepCamelizeTransaction(data: any): any;
export { CKBHasher, ckbHash, deepCamel, deepCamelizeTransaction, toBigUInt64LE, toBigUInt64LECompatible, readBigUInt64LE, readBigUInt64LECompatible, toBigUInt128LE, toBigUInt128LECompatible, readBigUInt128LE, readBigUInt128LECompatible, computeScriptHash, hashCode, assertHexString, assertHexadecimal, isDeepEqual, generateTypeIdScript, };
export { CKBHasher, ckbHash, ckbHash160, deepCamel, deepCamelizeTransaction, toBigUInt64LE, toBigUInt64LECompatible, readBigUInt64LE, readBigUInt64LECompatible, toBigUInt128LE, toBigUInt128LECompatible, readBigUInt128LE, readBigUInt128LECompatible, computeScriptHash, hashCode, assertHexString, assertHexadecimal, generateTypeIdScript, };
//# sourceMappingURL=utils.d.ts.map

@@ -10,2 +10,3 @@ "use strict";

exports.ckbHash = ckbHash;
exports.ckbHash160 = ckbHash160;
exports.computeScriptHash = computeScriptHash;

@@ -16,3 +17,2 @@ exports.deepCamel = deepCamel;

exports.hashCode = hashCode;
exports.isDeepEqual = isDeepEqual;
exports.readBigUInt128LE = readBigUInt128LE;

@@ -27,9 +27,8 @@ exports.readBigUInt128LECompatible = readBigUInt128LECompatible;

var _blake2b = _interopRequireDefault(require("blake2b"));
var _lodash = _interopRequireDefault(require("lodash.isequal"));
var _jsXxhash = require("js-xxhash");
var _codec = require("@ckb-lumos/codec");
var _bi = require("@ckb-lumos/bi");
var blockchain = _interopRequireWildcard(require("./blockchain"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var _number = require("@ckb-lumos/codec/lib/number");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -59,2 +58,7 @@ const {

}
/**
* create a 32-bytes Blake2b hash with the CKB personalization
* @param data
*/
exports.CKBHasher = CKBHasher;

@@ -68,2 +72,13 @@ function ckbHash(data) {

/**
* create a 20-bytes Blake2b hash with the CKB personalization
* @param data
*/
function ckbHash160(data) {
// 2 for prefix 0x
// 40 for 20-bytes hex string
const hash160HexLength = 42;
return ckbHash(data).slice(0, hash160HexLength);
}
/**
* compute lock/type hash

@@ -89,8 +104,3 @@ *

function toBigUInt64LECompatible(num) {
num = _bi.BI.from(num);
const buf = Buffer.alloc(8);
buf.writeUInt32LE(num.and("0xffffffff").toNumber(), 0);
num = num.shr(32);
buf.writeUInt32LE(num.and("0xffffffff").toNumber(), 4);
return `0x${buf.toString("hex")}`;
return _codec.bytes.hexify(_number.Uint64LE.pack(num));
}

@@ -112,4 +122,3 @@

function readBigUInt64LECompatible(hex) {
const buf = Buffer.from(hex.slice(2), "hex");
return _bi.BI.from(buf.readUInt32LE()).add(_bi.BI.from(buf.readUInt32LE(4)).shl(32));
return _number.Uint64LE.unpack(hex);
}

@@ -128,21 +137,4 @@

}
const U128_MIN_COMPATIBLE = _bi.BI.from(0);
const U128_MAX_COMPATIBLE = _bi.BI.from("340282366920938463463374607431768211455");
function toBigUInt128LECompatible(num) {
num = _bi.BI.from(num);
if (num.lt(U128_MIN_COMPATIBLE)) {
throw new Error(`u128 ${num} too small`);
}
if (num.gt(U128_MAX_COMPATIBLE)) {
throw new Error(`u128 ${num} too large`);
}
const buf = Buffer.alloc(16);
buf.writeUInt32LE(num.and(0xffffffff).toNumber(), 0);
num = num.shr(32);
buf.writeUInt32LE(num.and(0xffffffff).toNumber(), 4);
num = num.shr(32);
buf.writeUInt32LE(num.and(0xffffffff).toNumber(), 8);
num = num.shr(32);
buf.writeUInt32LE(num.and(0xffffffff).toNumber(), 12);
return `0x${buf.toString("hex")}`;
return _codec.bytes.hexify(_number.Uint128LE.pack(num));
}

@@ -164,7 +156,3 @@

function readBigUInt128LECompatible(leHex) {
if (leHex.length < 34 || !leHex.startsWith("0x")) {
throw new Error(`leHex format error`);
}
const buf = Buffer.from(leHex.slice(2, 34), "hex");
return _bi.BI.from(buf.readUInt32LE(0)).shl(0).add(_bi.BI.from(buf.readUInt32LE(4)).shl(32)).add(_bi.BI.from(buf.readUInt32LE(8)).shl(64)).add(_bi.BI.from(buf.readUInt32LE(12)).shl(96));
return _number.Uint128LE.unpack(leHex);
}

@@ -182,6 +170,2 @@ function assertHexString(debugPath, str) {

// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
function isDeepEqual(a, b) {
return (0, _lodash.default)(a, b);
}
// Buffer.from('TYPE_ID')

@@ -188,0 +172,0 @@ const TYPE_ID_CODE_HASH = "0x00000000000000000000000000000000000000000000000000545950455f4944";

@@ -11,4 +11,4 @@ "use strict";

var blockchain = _interopRequireWildcard(require("./blockchain"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
// This module provides a ValueObject implementation for CKB related data

@@ -28,3 +28,3 @@ // structures to allow seamless immutable.js integration.

hashCode() {
return (0, _jsXxhash.xxHash32)(Buffer.from(this.buffer), 0);
return (0, _jsXxhash.xxHash32)(this.buffer, 0);
}

@@ -31,0 +31,0 @@ hash() {

{
"name": "@ckb-lumos/base",
"version": "0.0.0-canary-31e2f29-20240122070336",
"version": "0.0.0-canary-321ae50-20240807024443",
"description": "Base data structures and utilities used in lumos",

@@ -38,13 +38,13 @@ "author": "Xuejie Xiao <xxuejie@gmail.com>",

"dependencies": {
"@ckb-lumos/bi": "0.0.0-canary-31e2f29-20240122070336",
"@ckb-lumos/codec": "0.0.0-canary-31e2f29-20240122070336",
"@ckb-lumos/toolkit": "0.0.0-canary-31e2f29-20240122070336",
"@ckb-lumos/bi": "0.0.0-canary-321ae50-20240807024443",
"@ckb-lumos/codec": "0.0.0-canary-321ae50-20240807024443",
"@ckb-lumos/toolkit": "0.0.0-canary-321ae50-20240807024443",
"@types/blake2b": "^2.1.0",
"@types/lodash.isequal": "^4.5.5",
"blake2b": "^2.1.3",
"js-xxhash": "^1.0.4",
"lodash.isequal": "^4.5.0"
"js-xxhash": "^1.0.4"
},
"devDependencies": {
"jsbi": "^4.1.0"
"jsbi": "^4.1.0",
"lodash.isequal": "^4.5.0"
},

@@ -51,0 +51,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc