@ckb-ccc/core 0.1.0-alpha.5 → 0.1.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/barrel.d.ts +1 -0
- package/dist/barrel.d.ts.map +1 -1
- package/dist/barrel.js +1 -0
- package/dist/ckb/transaction.d.ts.map +1 -1
- package/dist/ckb/transaction.js +9 -7
- package/dist/molecule/codec.d.ts +118 -0
- package/dist/molecule/codec.d.ts.map +1 -0
- package/dist/molecule/codec.js +446 -0
- package/dist/molecule/index.d.ts +3 -0
- package/dist/molecule/index.d.ts.map +1 -0
- package/dist/molecule/index.js +2 -0
- package/dist/molecule/predefined.d.ts +52 -0
- package/dist/molecule/predefined.d.ts.map +1 -0
- package/dist/molecule/predefined.js +95 -0
- package/dist.commonjs/barrel.d.ts +1 -0
- package/dist.commonjs/barrel.d.ts.map +1 -1
- package/dist.commonjs/barrel.js +14 -0
- package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
- package/dist.commonjs/ckb/transaction.js +7 -5
- package/dist.commonjs/molecule/codec.d.ts +118 -0
- package/dist.commonjs/molecule/codec.d.ts.map +1 -0
- package/dist.commonjs/molecule/codec.js +461 -0
- package/dist.commonjs/molecule/index.d.ts +3 -0
- package/dist.commonjs/molecule/index.d.ts.map +1 -0
- package/dist.commonjs/molecule/index.js +18 -0
- package/dist.commonjs/molecule/predefined.d.ts +52 -0
- package/dist.commonjs/molecule/predefined.d.ts.map +1 -0
- package/dist.commonjs/molecule/predefined.js +121 -0
- package/package.json +1 -1
- package/src/barrel.ts +1 -0
- package/src/ckb/transaction.ts +9 -12
- package/src/molecule/codec.ts +610 -0
- package/src/molecule/index.ts +2 -0
- package/src/molecule/predefined.ts +114 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./codec.js"), exports);
|
|
18
|
+
__exportStar(require("./predefined.js"), exports);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as ckb from "../ckb/index.js";
|
|
2
|
+
import { Hex, HexLike } from "../hex/index.js";
|
|
3
|
+
import { Codec } from "./codec.js";
|
|
4
|
+
export declare const Uint8: Codec<import("../barrel.js").NumLike, number>;
|
|
5
|
+
export declare const Uint16LE: Codec<import("../barrel.js").NumLike, number>;
|
|
6
|
+
export declare const Uint16BE: Codec<import("../barrel.js").NumLike, number>;
|
|
7
|
+
export declare const Uint16: Codec<import("../barrel.js").NumLike, number>;
|
|
8
|
+
export declare const Uint32LE: Codec<import("../barrel.js").NumLike, number>;
|
|
9
|
+
export declare const Uint32BE: Codec<import("../barrel.js").NumLike, number>;
|
|
10
|
+
export declare const Uint32: Codec<import("../barrel.js").NumLike, number>;
|
|
11
|
+
export declare const Uint64LE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
12
|
+
export declare const Uint64BE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
13
|
+
export declare const Uint64: Codec<import("../barrel.js").NumLike, bigint>;
|
|
14
|
+
export declare const Uint128LE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
15
|
+
export declare const Uint128BE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
16
|
+
export declare const Uint128: Codec<import("../barrel.js").NumLike, bigint>;
|
|
17
|
+
export declare const Uint256LE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
18
|
+
export declare const Uint256BE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
19
|
+
export declare const Uint256: Codec<import("../barrel.js").NumLike, bigint>;
|
|
20
|
+
export declare const Uint512LE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
21
|
+
export declare const Uint512BE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
22
|
+
export declare const Uint512: Codec<import("../barrel.js").NumLike, bigint>;
|
|
23
|
+
export declare const Uint8Opt: Codec<import("../barrel.js").NumLike | null | undefined, number | undefined>;
|
|
24
|
+
export declare const Uint16Opt: Codec<import("../barrel.js").NumLike | null | undefined, number | undefined>;
|
|
25
|
+
export declare const Uint32Opt: Codec<import("../barrel.js").NumLike | null | undefined, number | undefined>;
|
|
26
|
+
export declare const Uint64Opt: Codec<import("../barrel.js").NumLike | null | undefined, bigint | undefined>;
|
|
27
|
+
export declare const Uint128Opt: Codec<import("../barrel.js").NumLike | null | undefined, bigint | undefined>;
|
|
28
|
+
export declare const Uint256Opt: Codec<import("../barrel.js").NumLike | null | undefined, bigint | undefined>;
|
|
29
|
+
export declare const Uint512Opt: Codec<import("../barrel.js").NumLike | null | undefined, bigint | undefined>;
|
|
30
|
+
export declare const Bytes: Codec<HexLike, Hex>;
|
|
31
|
+
export declare const BytesOpt: Codec<import("../bytes/index.js").BytesLike | null | undefined, `0x${string}` | undefined>;
|
|
32
|
+
export declare const BytesVec: Codec<import("../bytes/index.js").BytesLike[], `0x${string}`[]>;
|
|
33
|
+
export declare const Byte32: Codec<HexLike, Hex>;
|
|
34
|
+
export declare const Byte32Opt: Codec<import("../bytes/index.js").BytesLike | null | undefined, `0x${string}` | undefined>;
|
|
35
|
+
export declare const Byte32Vec: Codec<import("../bytes/index.js").BytesLike[], `0x${string}`[]>;
|
|
36
|
+
export declare const String: Codec<string, string>;
|
|
37
|
+
export declare const StringVec: Codec<string[], string[]>;
|
|
38
|
+
export declare const StringOpt: Codec<string | null | undefined, string | undefined>;
|
|
39
|
+
export declare const Hash: Codec<import("../bytes/index.js").BytesLike, `0x${string}`>;
|
|
40
|
+
export declare const HashType: Codec<ckb.HashTypeLike, ckb.HashType>;
|
|
41
|
+
export declare const Script: Codec<ckb.ScriptLike, ckb.Script>;
|
|
42
|
+
export declare const ScriptOpt: Codec<ckb.ScriptLike | null | undefined, ckb.Script | undefined>;
|
|
43
|
+
export declare const OutPoint: Codec<ckb.OutPointLike, ckb.OutPoint>;
|
|
44
|
+
export declare const CellInput: Codec<ckb.CellInputLike, ckb.CellInput>;
|
|
45
|
+
export declare const CellInputVec: Codec<ckb.CellInputLike[], ckb.CellInput[]>;
|
|
46
|
+
export declare const CellOutput: Codec<ckb.CellOutputLike, ckb.CellOutput>;
|
|
47
|
+
export declare const CellOutputVec: Codec<ckb.CellOutputLike[], ckb.CellOutput[]>;
|
|
48
|
+
export declare const DepType: Codec<ckb.DepTypeLike, ckb.DepType>;
|
|
49
|
+
export declare const CellDep: Codec<ckb.CellDepLike, ckb.CellDep>;
|
|
50
|
+
export declare const CellDepVec: Codec<ckb.CellDepLike[], ckb.CellDep[]>;
|
|
51
|
+
export declare const Transaction: Codec<ckb.TransactionLike, ckb.Transaction>;
|
|
52
|
+
//# sourceMappingURL=predefined.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predefined.d.ts","sourceRoot":"","sources":["../../src/molecule/predefined.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,GAAG,EAAW,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAEL,KAAK,EAON,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,K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) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Transaction = exports.CellDepVec = exports.CellDep = exports.DepType = exports.CellOutputVec = exports.CellOutput = exports.CellInputVec = exports.CellInput = exports.OutPoint = exports.ScriptOpt = exports.Script = exports.HashType = exports.Hash = exports.StringOpt = exports.StringVec = exports.String = exports.Byte32Vec = exports.Byte32Opt = exports.Byte32 = exports.BytesVec = exports.BytesOpt = exports.Bytes = exports.Uint512Opt = exports.Uint256Opt = exports.Uint128Opt = exports.Uint64Opt = exports.Uint32Opt = exports.Uint16Opt = exports.Uint8Opt = exports.Uint512 = exports.Uint512BE = exports.Uint512LE = exports.Uint256 = exports.Uint256BE = exports.Uint256LE = exports.Uint128 = exports.Uint128BE = exports.Uint128LE = exports.Uint64 = exports.Uint64BE = exports.Uint64LE = exports.Uint32 = exports.Uint32BE = exports.Uint32LE = exports.Uint16 = exports.Uint16BE = exports.Uint16LE = exports.Uint8 = void 0;
|
|
27
|
+
const index_js_1 = require("../bytes/index.js");
|
|
28
|
+
const ckb = __importStar(require("../ckb/index.js"));
|
|
29
|
+
const index_js_2 = require("../hex/index.js");
|
|
30
|
+
const codec_js_1 = require("./codec.js");
|
|
31
|
+
exports.Uint8 = (0, codec_js_1.uintNumber)(1, true);
|
|
32
|
+
exports.Uint16LE = (0, codec_js_1.uintNumber)(2, true);
|
|
33
|
+
exports.Uint16BE = (0, codec_js_1.uintNumber)(2);
|
|
34
|
+
exports.Uint16 = exports.Uint16LE;
|
|
35
|
+
exports.Uint32LE = (0, codec_js_1.uintNumber)(4, true);
|
|
36
|
+
exports.Uint32BE = (0, codec_js_1.uintNumber)(4);
|
|
37
|
+
exports.Uint32 = exports.Uint32LE;
|
|
38
|
+
exports.Uint64LE = (0, codec_js_1.uint)(8, true);
|
|
39
|
+
exports.Uint64BE = (0, codec_js_1.uint)(8);
|
|
40
|
+
exports.Uint64 = exports.Uint64LE;
|
|
41
|
+
exports.Uint128LE = (0, codec_js_1.uint)(16, true);
|
|
42
|
+
exports.Uint128BE = (0, codec_js_1.uint)(16);
|
|
43
|
+
exports.Uint128 = exports.Uint128LE;
|
|
44
|
+
exports.Uint256LE = (0, codec_js_1.uint)(32, true);
|
|
45
|
+
exports.Uint256BE = (0, codec_js_1.uint)(32);
|
|
46
|
+
exports.Uint256 = exports.Uint256LE;
|
|
47
|
+
exports.Uint512LE = (0, codec_js_1.uint)(64, true);
|
|
48
|
+
exports.Uint512BE = (0, codec_js_1.uint)(64);
|
|
49
|
+
exports.Uint512 = exports.Uint512LE;
|
|
50
|
+
exports.Uint8Opt = (0, codec_js_1.option)(exports.Uint8);
|
|
51
|
+
exports.Uint16Opt = (0, codec_js_1.option)(exports.Uint16);
|
|
52
|
+
exports.Uint32Opt = (0, codec_js_1.option)(exports.Uint32);
|
|
53
|
+
exports.Uint64Opt = (0, codec_js_1.option)(exports.Uint64);
|
|
54
|
+
exports.Uint128Opt = (0, codec_js_1.option)(exports.Uint128);
|
|
55
|
+
exports.Uint256Opt = (0, codec_js_1.option)(exports.Uint256);
|
|
56
|
+
exports.Uint512Opt = (0, codec_js_1.option)(exports.Uint512);
|
|
57
|
+
exports.Bytes = (0, codec_js_1.byteVec)({
|
|
58
|
+
encode: (value) => (0, index_js_1.bytesFrom)(value),
|
|
59
|
+
decode: (buffer) => (0, index_js_2.hexFrom)(buffer),
|
|
60
|
+
});
|
|
61
|
+
exports.BytesOpt = (0, codec_js_1.option)(exports.Bytes);
|
|
62
|
+
exports.BytesVec = (0, codec_js_1.vector)(exports.Bytes);
|
|
63
|
+
exports.Byte32 = codec_js_1.Codec.from({
|
|
64
|
+
byteLength: 32,
|
|
65
|
+
encode: (value) => (0, index_js_1.bytesFrom)(value),
|
|
66
|
+
decode: (buffer) => (0, index_js_2.hexFrom)(buffer),
|
|
67
|
+
});
|
|
68
|
+
exports.Byte32Opt = (0, codec_js_1.option)(exports.Byte32);
|
|
69
|
+
exports.Byte32Vec = (0, codec_js_1.vector)(exports.Byte32);
|
|
70
|
+
exports.String = (0, codec_js_1.byteVec)({
|
|
71
|
+
encode: (value) => (0, index_js_1.bytesFrom)(value, "utf8"),
|
|
72
|
+
decode: (buffer) => (0, index_js_1.bytesTo)(buffer, "utf8"),
|
|
73
|
+
});
|
|
74
|
+
exports.StringVec = (0, codec_js_1.vector)(exports.String);
|
|
75
|
+
exports.StringOpt = (0, codec_js_1.option)(exports.String);
|
|
76
|
+
exports.Hash = exports.Byte32;
|
|
77
|
+
exports.HashType = codec_js_1.Codec.from({
|
|
78
|
+
byteLength: 1,
|
|
79
|
+
encode: ckb.hashTypeToBytes,
|
|
80
|
+
decode: ckb.hashTypeFromBytes,
|
|
81
|
+
});
|
|
82
|
+
exports.Script = (0, codec_js_1.table)({
|
|
83
|
+
codeHash: exports.Hash,
|
|
84
|
+
hashType: exports.HashType,
|
|
85
|
+
args: exports.Bytes,
|
|
86
|
+
}).map({ outMap: ckb.Script.from });
|
|
87
|
+
exports.ScriptOpt = (0, codec_js_1.option)(exports.Script);
|
|
88
|
+
exports.OutPoint = (0, codec_js_1.struct)({
|
|
89
|
+
txHash: exports.Hash,
|
|
90
|
+
index: exports.Uint32,
|
|
91
|
+
}).map({ outMap: ckb.OutPoint.from });
|
|
92
|
+
exports.CellInput = (0, codec_js_1.struct)({
|
|
93
|
+
previousOutput: exports.OutPoint,
|
|
94
|
+
since: exports.Uint64,
|
|
95
|
+
}).map({ outMap: ckb.CellInput.from });
|
|
96
|
+
exports.CellInputVec = (0, codec_js_1.vector)(exports.CellInput);
|
|
97
|
+
exports.CellOutput = (0, codec_js_1.table)({
|
|
98
|
+
capacity: exports.Uint64,
|
|
99
|
+
lock: exports.Script,
|
|
100
|
+
type: exports.ScriptOpt,
|
|
101
|
+
}).map({ outMap: ckb.CellOutput.from });
|
|
102
|
+
exports.CellOutputVec = (0, codec_js_1.vector)(exports.CellOutput);
|
|
103
|
+
exports.DepType = codec_js_1.Codec.from({
|
|
104
|
+
byteLength: 1,
|
|
105
|
+
encode: ckb.depTypeToBytes,
|
|
106
|
+
decode: ckb.depTypeFromBytes,
|
|
107
|
+
});
|
|
108
|
+
exports.CellDep = (0, codec_js_1.struct)({
|
|
109
|
+
outPoint: exports.OutPoint,
|
|
110
|
+
depType: exports.DepType,
|
|
111
|
+
}).map({ outMap: ckb.CellDep.from });
|
|
112
|
+
exports.CellDepVec = (0, codec_js_1.vector)(exports.CellDep);
|
|
113
|
+
exports.Transaction = (0, codec_js_1.table)({
|
|
114
|
+
version: exports.Uint32,
|
|
115
|
+
cellDeps: exports.CellDepVec,
|
|
116
|
+
headerDeps: exports.Byte32Vec,
|
|
117
|
+
inputs: exports.CellInputVec,
|
|
118
|
+
outputs: exports.CellOutputVec,
|
|
119
|
+
outputsData: exports.BytesVec,
|
|
120
|
+
witnesses: exports.BytesVec,
|
|
121
|
+
}).map({ outMap: ckb.Transaction.from });
|
package/package.json
CHANGED
package/src/barrel.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./fixedPoint/index.js";
|
|
|
6
6
|
export * from "./hasher/index.js";
|
|
7
7
|
export * from "./hex/index.js";
|
|
8
8
|
export * from "./keystore/index.js";
|
|
9
|
+
export * as mol from "./molecule/index.js";
|
|
9
10
|
export * from "./num/index.js";
|
|
10
11
|
export * from "./signer/index.js";
|
|
11
12
|
export * from "./utils/index.js";
|
package/src/ckb/transaction.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClientCollectableSearchKeyFilterLike } from "../advancedBarrel.js";
|
|
2
|
-
import { Bytes, BytesLike,
|
|
2
|
+
import { Bytes, BytesLike, bytesFrom } from "../bytes/index.js";
|
|
3
3
|
import { CellDepInfoLike, Client, KnownScript } from "../client/index.js";
|
|
4
4
|
import {
|
|
5
5
|
Zero,
|
|
@@ -11,7 +11,6 @@ import { Hex, HexLike, hexFrom } from "../hex/index.js";
|
|
|
11
11
|
import {
|
|
12
12
|
Num,
|
|
13
13
|
NumLike,
|
|
14
|
-
numBeToBytes,
|
|
15
14
|
numFrom,
|
|
16
15
|
numFromBytes,
|
|
17
16
|
numToBytes,
|
|
@@ -435,12 +434,12 @@ export function epochFrom(epochLike: EpochLike): Epoch {
|
|
|
435
434
|
* @public
|
|
436
435
|
*/
|
|
437
436
|
export function epochFromHex(hex: HexLike): Epoch {
|
|
438
|
-
const
|
|
437
|
+
const num = numFrom(hexFrom(hex));
|
|
439
438
|
|
|
440
439
|
return [
|
|
441
|
-
numFrom(
|
|
442
|
-
numFrom(
|
|
443
|
-
numFrom(
|
|
440
|
+
num & numFrom("0xffffff"),
|
|
441
|
+
(num >> numFrom(24)) & numFrom("0xffff"),
|
|
442
|
+
(num >> numFrom(40)) & numFrom("0xffff"),
|
|
444
443
|
];
|
|
445
444
|
}
|
|
446
445
|
/**
|
|
@@ -449,12 +448,10 @@ export function epochFromHex(hex: HexLike): Epoch {
|
|
|
449
448
|
export function epochToHex(epochLike: EpochLike): Hex {
|
|
450
449
|
const epoch = epochFrom(epochLike);
|
|
451
450
|
|
|
452
|
-
return
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
numBeToBytes(epoch[0], 3),
|
|
457
|
-
),
|
|
451
|
+
return numToHex(
|
|
452
|
+
numFrom(epoch[0]) +
|
|
453
|
+
(numFrom(epoch[1]) << numFrom(24)) +
|
|
454
|
+
(numFrom(epoch[2]) << numFrom(40)),
|
|
458
455
|
);
|
|
459
456
|
}
|
|
460
457
|
|