@ckb-ccc/core 0.1.2 → 1.0.1
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 +14 -0
- package/dist/address/address.advanced.d.ts.map +1 -1
- package/dist/address/address.advanced.js +6 -2
- package/dist/barrel.d.ts +1 -1
- package/dist/barrel.d.ts.map +1 -1
- package/dist/barrel.js +1 -1
- package/dist/bytes/index.d.ts +35 -0
- package/dist/bytes/index.d.ts.map +1 -1
- package/dist/bytes/index.js +60 -4
- package/dist/ckb/advanced.d.ts +0 -1
- package/dist/ckb/advanced.d.ts.map +1 -1
- package/dist/ckb/advanced.js +0 -1
- package/dist/ckb/script.d.ts +17 -58
- package/dist/ckb/script.d.ts.map +1 -1
- package/dist/ckb/script.js +29 -78
- package/dist/ckb/transaction.d.ts +125 -264
- package/dist/ckb/transaction.d.ts.map +1 -1
- package/dist/ckb/transaction.js +146 -357
- package/dist/molecule/barrel.d.ts +4 -0
- package/dist/molecule/barrel.d.ts.map +1 -0
- package/dist/molecule/barrel.js +3 -0
- package/dist/molecule/codec.d.ts +2 -0
- package/dist/molecule/codec.d.ts.map +1 -1
- package/dist/molecule/codec.js +57 -44
- package/dist/molecule/entity.d.ts +119 -0
- package/dist/molecule/entity.d.ts.map +1 -0
- package/dist/molecule/entity.js +134 -0
- package/dist/molecule/index.d.ts +1 -2
- package/dist/molecule/index.d.ts.map +1 -1
- package/dist/molecule/index.js +1 -2
- package/dist/molecule/predefined.d.ts +13 -20
- package/dist/molecule/predefined.d.ts.map +1 -1
- package/dist/molecule/predefined.js +14 -54
- package/dist/num/index.d.ts.map +1 -1
- package/dist/num/index.js +2 -2
- package/dist/signer/btc/verify.js +1 -1
- package/dist/signer/doge/verify.d.ts.map +1 -1
- package/dist/signer/doge/verify.js +3 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist.commonjs/address/address.advanced.d.ts.map +1 -1
- package/dist.commonjs/address/address.advanced.js +6 -2
- package/dist.commonjs/barrel.d.ts +1 -1
- package/dist.commonjs/barrel.d.ts.map +1 -1
- package/dist.commonjs/barrel.js +1 -14
- package/dist.commonjs/bytes/index.d.ts +35 -0
- package/dist.commonjs/bytes/index.d.ts.map +1 -1
- package/dist.commonjs/bytes/index.js +62 -4
- package/dist.commonjs/ckb/advanced.d.ts +0 -1
- package/dist.commonjs/ckb/advanced.d.ts.map +1 -1
- package/dist.commonjs/ckb/advanced.js +0 -14
- package/dist.commonjs/ckb/script.d.ts +17 -58
- package/dist.commonjs/ckb/script.d.ts.map +1 -1
- package/dist.commonjs/ckb/script.js +29 -102
- package/dist.commonjs/ckb/transaction.d.ts +125 -264
- package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
- package/dist.commonjs/ckb/transaction.js +167 -408
- package/dist.commonjs/molecule/barrel.d.ts +4 -0
- package/dist.commonjs/molecule/barrel.d.ts.map +1 -0
- package/dist.commonjs/{ckb/molecule.advanced/index.js → molecule/barrel.js} +3 -8
- package/dist.commonjs/molecule/codec.d.ts +2 -0
- package/dist.commonjs/molecule/codec.d.ts.map +1 -1
- package/dist.commonjs/molecule/codec.js +56 -43
- package/dist.commonjs/molecule/entity.d.ts +119 -0
- package/dist.commonjs/molecule/entity.d.ts.map +1 -0
- package/dist.commonjs/molecule/entity.js +139 -0
- package/dist.commonjs/molecule/index.d.ts +1 -2
- package/dist.commonjs/molecule/index.d.ts.map +1 -1
- package/dist.commonjs/molecule/index.js +13 -4
- package/dist.commonjs/molecule/predefined.d.ts +13 -20
- package/dist.commonjs/molecule/predefined.d.ts.map +1 -1
- package/dist.commonjs/molecule/predefined.js +14 -77
- package/dist.commonjs/num/index.d.ts.map +1 -1
- package/dist.commonjs/num/index.js +2 -2
- package/dist.commonjs/signer/btc/verify.js +1 -1
- package/dist.commonjs/signer/doge/verify.d.ts.map +1 -1
- package/dist.commonjs/signer/doge/verify.js +3 -1
- package/dist.commonjs/utils/index.d.ts +3 -0
- package/dist.commonjs/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/address/address.advanced.ts +6 -2
- package/src/barrel.ts +1 -1
- package/src/bytes/index.ts +70 -6
- package/src/ckb/advanced.ts +0 -1
- package/src/ckb/script.ts +20 -85
- package/src/ckb/transaction.ts +123 -416
- package/src/molecule/barrel.ts +3 -0
- package/src/molecule/codec.ts +82 -66
- package/src/molecule/entity.ts +183 -0
- package/src/molecule/index.ts +1 -2
- package/src/molecule/predefined.ts +20 -69
- package/src/num/index.ts +2 -5
- package/src/signer/btc/verify.ts +1 -1
- package/src/signer/doge/verify.ts +3 -1
- package/src/utils/index.ts +5 -0
- package/dist/ckb/molecule.advanced/generated.d.ts +0 -355
- package/dist/ckb/molecule.advanced/generated.d.ts.map +0 -1
- package/dist/ckb/molecule.advanced/generated.js +0 -1468
- package/dist/ckb/molecule.advanced/index.d.ts +0 -6
- package/dist/ckb/molecule.advanced/index.d.ts.map +0 -1
- package/dist/ckb/molecule.advanced/index.js +0 -7
- package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +0 -355
- package/dist.commonjs/ckb/molecule.advanced/generated.d.ts.map +0 -1
- package/dist.commonjs/ckb/molecule.advanced/generated.js +0 -1535
- package/dist.commonjs/ckb/molecule.advanced/index.d.ts +0 -6
- package/dist.commonjs/ckb/molecule.advanced/index.d.ts.map +0 -1
- package/src/ckb/molecule.advanced/blockchain.mol +0 -118
- package/src/ckb/molecule.advanced/generated.d.ts +0 -444
- package/src/ckb/molecule.advanced/generated.js +0 -1804
- package/src/ckb/molecule.advanced/index.ts +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"barrel.d.ts","sourceRoot":"","sources":["../../src/molecule/barrel.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
@@ -14,11 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
|
|
20
|
-
if (mol.hasValue()) {
|
|
21
|
-
return mol.value();
|
|
22
|
-
}
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
17
|
+
__exportStar(require("./codec.js"), exports);
|
|
18
|
+
__exportStar(require("./entity.js"), exports);
|
|
19
|
+
__exportStar(require("./predefined.js"), exports);
|
|
@@ -15,6 +15,8 @@ export declare class Codec<Encodable, Decoded = Encodable> {
|
|
|
15
15
|
inMap?: (encodable: NewEncodable) => Encodable;
|
|
16
16
|
outMap?: (decoded: Decoded) => NewDecoded;
|
|
17
17
|
}): Codec<NewEncodable, NewDecoded>;
|
|
18
|
+
mapIn<NewEncodable>(map: (encodable: NewEncodable) => Encodable): Codec<NewEncodable, Decoded>;
|
|
19
|
+
mapOut<NewDecoded>(map: (decoded: Decoded) => NewDecoded): Codec<Encodable, NewDecoded>;
|
|
18
20
|
}
|
|
19
21
|
export type EncodableType<T extends CodecLike<any, any>> = T extends CodecLike<infer Encodable, unknown> ? Encodable : never;
|
|
20
22
|
export type DecodedType<T extends CodecLike<any, any>> = T extends CodecLike<any, infer Decoded> ? Decoded : never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/molecule/codec.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/molecule/codec.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EAIL,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,GAAG,EAIH,OAAO,EAER,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,SAAS,CAAC,SAAS,EAAE,OAAO,GAAG,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C,MAAM,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EACjE,WAAW,EAAE,CAAC,EACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,GAClD,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CA0D3C;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CACpB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAC7C,SAAS,SAAS,eAAe,CAAC,CAAC,CAAC,EACpC,OAAO,SAAS,aAAa,CAAC,CAAC,CAAC,EAChC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAyC3C;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,SAAS,EAAE,OAAO,EACtC,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,EACxC,SAAS,EAAE,MAAM,GAChB,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAwCzC;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAClB,UAAU,EAAE,MAAM,EAClB,YAAY,UAAQ,GACnB,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAkBrB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,MAAM,EAClB,YAAY,UAAQ,GACnB,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAOxB"}
|
|
@@ -33,6 +33,12 @@ class Codec {
|
|
|
33
33
|
: this.decode(buffer)),
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
+
mapIn(map) {
|
|
37
|
+
return this.map({ inMap: map });
|
|
38
|
+
}
|
|
39
|
+
mapOut(map) {
|
|
40
|
+
return this.map({ outMap: map });
|
|
41
|
+
}
|
|
36
42
|
}
|
|
37
43
|
exports.Codec = Codec;
|
|
38
44
|
function uint32To(numLike) {
|
|
@@ -53,7 +59,12 @@ function fixedItemVec(itemCodec) {
|
|
|
53
59
|
return Codec.from({
|
|
54
60
|
encode(userDefinedItems) {
|
|
55
61
|
try {
|
|
56
|
-
|
|
62
|
+
const concatted = [];
|
|
63
|
+
(0, index_js_1.bytesConcatTo)(concatted, uint32To(userDefinedItems.length));
|
|
64
|
+
for (const item of userDefinedItems) {
|
|
65
|
+
(0, index_js_1.bytesConcatTo)(concatted, itemCodec.encode(item));
|
|
66
|
+
}
|
|
67
|
+
return (0, index_js_1.bytesFrom)(concatted);
|
|
57
68
|
}
|
|
58
69
|
catch (e) {
|
|
59
70
|
throw new Error(`fixedItemVec(${e?.toString()})`);
|
|
@@ -71,7 +82,7 @@ function fixedItemVec(itemCodec) {
|
|
|
71
82
|
}
|
|
72
83
|
try {
|
|
73
84
|
const decodedArray = [];
|
|
74
|
-
for (let offset =
|
|
85
|
+
for (let offset = 4; offset < byteLength; offset += itemByteLength) {
|
|
75
86
|
decodedArray.push(itemCodec.decode(value.slice(offset, offset + itemByteLength)));
|
|
76
87
|
}
|
|
77
88
|
return decodedArray;
|
|
@@ -90,21 +101,17 @@ function dynItemVec(itemCodec) {
|
|
|
90
101
|
return Codec.from({
|
|
91
102
|
encode(userDefinedItems) {
|
|
92
103
|
try {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
offset: 4 + userDefinedItems.length * 4,
|
|
105
|
-
});
|
|
106
|
-
const packedTotalSize = uint32To(encoded.header.byteLength + encoded.body.byteLength + 4);
|
|
107
|
-
return (0, index_js_1.bytesConcat)(packedTotalSize, encoded.header, encoded.body);
|
|
104
|
+
let offset = 4 + userDefinedItems.length * 4;
|
|
105
|
+
const header = [];
|
|
106
|
+
const body = [];
|
|
107
|
+
for (const item of userDefinedItems) {
|
|
108
|
+
const encoded = itemCodec.encode(item);
|
|
109
|
+
(0, index_js_1.bytesConcatTo)(header, uint32To(offset));
|
|
110
|
+
(0, index_js_1.bytesConcatTo)(body, encoded);
|
|
111
|
+
offset += encoded.byteLength;
|
|
112
|
+
}
|
|
113
|
+
const packedTotalSize = uint32To(header.length + body.length + 4);
|
|
114
|
+
return (0, index_js_1.bytesConcat)(packedTotalSize, header, body);
|
|
108
115
|
}
|
|
109
116
|
catch (e) {
|
|
110
117
|
throw new Error(`dynItemVec(${e?.toString()})`);
|
|
@@ -112,12 +119,15 @@ function dynItemVec(itemCodec) {
|
|
|
112
119
|
},
|
|
113
120
|
decode(buffer) {
|
|
114
121
|
const value = (0, index_js_1.bytesFrom)(buffer);
|
|
122
|
+
if (value.byteLength < 4) {
|
|
123
|
+
throw new Error(`dynItemVec: too short buffer, expected at least 4 bytes, but got ${value.byteLength}`);
|
|
124
|
+
}
|
|
115
125
|
const byteLength = uint32From(value.slice(0, 4));
|
|
116
126
|
if (byteLength !== value.byteLength) {
|
|
117
127
|
throw new Error(`dynItemVec: invalid buffer size, expected ${byteLength}, but got ${value.byteLength}`);
|
|
118
128
|
}
|
|
119
|
-
if (
|
|
120
|
-
|
|
129
|
+
if (byteLength === 4) {
|
|
130
|
+
return [];
|
|
121
131
|
}
|
|
122
132
|
const offset = uint32From(value.slice(4, 8));
|
|
123
133
|
const itemCount = (offset - 4) / 4;
|
|
@@ -225,26 +235,21 @@ function table(codecLayout) {
|
|
|
225
235
|
const keys = Object.keys(codecLayout);
|
|
226
236
|
return Codec.from({
|
|
227
237
|
encode(object) {
|
|
228
|
-
|
|
229
|
-
const
|
|
238
|
+
let offset = 4 + keys.length * 4;
|
|
239
|
+
const header = [];
|
|
240
|
+
const body = [];
|
|
241
|
+
for (const key of keys) {
|
|
230
242
|
try {
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
body: (0, index_js_1.bytesConcat)(result.body, encodedItem),
|
|
236
|
-
offset: result.offset + (0, index_js_1.bytesFrom)(encodedItem).byteLength,
|
|
237
|
-
};
|
|
243
|
+
const encoded = codecLayout[key].encode(object[key]);
|
|
244
|
+
(0, index_js_1.bytesConcatTo)(header, uint32To(offset));
|
|
245
|
+
(0, index_js_1.bytesConcatTo)(body, encoded);
|
|
246
|
+
offset += encoded.byteLength;
|
|
238
247
|
}
|
|
239
248
|
catch (e) {
|
|
240
249
|
throw new Error(`table.${key}(${e?.toString()})`);
|
|
241
250
|
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
body: (0, index_js_1.bytesFrom)([]),
|
|
245
|
-
offset: headerLength,
|
|
246
|
-
});
|
|
247
|
-
const packedTotalSize = uint32To(header.byteLength + body.byteLength + 4);
|
|
251
|
+
}
|
|
252
|
+
const packedTotalSize = uint32To(header.length + body.length + 4);
|
|
248
253
|
return (0, index_js_1.bytesConcat)(packedTotalSize, header, body);
|
|
249
254
|
},
|
|
250
255
|
decode(buffer) {
|
|
@@ -345,22 +350,26 @@ function union(codecLayout, fields) {
|
|
|
345
350
|
*/
|
|
346
351
|
function struct(codecLayout) {
|
|
347
352
|
const codecArray = Object.values(codecLayout);
|
|
348
|
-
if (codecArray.some((codec) => codec.byteLength === undefined)) {
|
|
349
|
-
throw new Error("struct: all fields must be fixed-size");
|
|
350
|
-
}
|
|
351
353
|
const keys = Object.keys(codecLayout);
|
|
352
354
|
return Codec.from({
|
|
353
|
-
byteLength: codecArray.reduce((
|
|
355
|
+
byteLength: codecArray.reduce((acc, codec) => {
|
|
356
|
+
if (codec.byteLength === undefined) {
|
|
357
|
+
throw new Error("struct: all fields must be fixed-size");
|
|
358
|
+
}
|
|
359
|
+
return acc + codec.byteLength;
|
|
360
|
+
}, 0),
|
|
354
361
|
encode(object) {
|
|
355
|
-
|
|
362
|
+
const bytes = [];
|
|
363
|
+
for (const key of keys) {
|
|
356
364
|
try {
|
|
357
|
-
const
|
|
358
|
-
|
|
365
|
+
const encoded = codecLayout[key].encode(object[key]);
|
|
366
|
+
(0, index_js_1.bytesConcatTo)(bytes, encoded);
|
|
359
367
|
}
|
|
360
368
|
catch (e) {
|
|
361
369
|
throw new Error(`struct.${key}(${e?.toString()})`);
|
|
362
370
|
}
|
|
363
|
-
}
|
|
371
|
+
}
|
|
372
|
+
return (0, index_js_1.bytesFrom)(bytes);
|
|
364
373
|
},
|
|
365
374
|
decode(buffer) {
|
|
366
375
|
const value = (0, index_js_1.bytesFrom)(buffer);
|
|
@@ -396,7 +405,11 @@ function array(itemCodec, itemCount) {
|
|
|
396
405
|
byteLength,
|
|
397
406
|
encode(items) {
|
|
398
407
|
try {
|
|
399
|
-
|
|
408
|
+
const bytes = [];
|
|
409
|
+
for (const item of items) {
|
|
410
|
+
(0, index_js_1.bytesConcatTo)(bytes, itemCodec.encode(item));
|
|
411
|
+
}
|
|
412
|
+
return (0, index_js_1.bytesFrom)(bytes);
|
|
400
413
|
}
|
|
401
414
|
catch (e) {
|
|
402
415
|
throw new Error(`array(${e?.toString()})`);
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Bytes, BytesLike } from "../bytes/index.js";
|
|
2
|
+
import { Hex } from "../hex/index.js";
|
|
3
|
+
import { Constructor } from "../utils/index.js";
|
|
4
|
+
import { Codec } from "./codec.js";
|
|
5
|
+
/**
|
|
6
|
+
* The base class of CCC to create a serializable instance. This should be used with the {@link codec} decorator.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class Entity {
|
|
10
|
+
/**
|
|
11
|
+
* Generate a base class of CCC to create a serializable instance.
|
|
12
|
+
* This should be used with the {@link codec} decorator.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
static Base<SubTypeLike, SubType = SubTypeLike>(): (abstract new () => {
|
|
16
|
+
/**
|
|
17
|
+
* Convert the entity to bytes
|
|
18
|
+
* @public
|
|
19
|
+
* @returns The bytes representation of the entity
|
|
20
|
+
*/
|
|
21
|
+
toBytes(): Bytes;
|
|
22
|
+
/**
|
|
23
|
+
* Create a clone of the entity
|
|
24
|
+
* @public
|
|
25
|
+
* @returns A clone of the entity
|
|
26
|
+
*/
|
|
27
|
+
clone(): SubType;
|
|
28
|
+
/**
|
|
29
|
+
* Check if the entity is equal to another entity
|
|
30
|
+
* @public
|
|
31
|
+
* @param other - The other entity to compare with
|
|
32
|
+
* @returns True if the entities are equal, false otherwise
|
|
33
|
+
*/
|
|
34
|
+
eq(other: SubTypeLike): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Calculate the hash of the entity
|
|
37
|
+
* @public
|
|
38
|
+
* @returns The hash of the entity
|
|
39
|
+
*/
|
|
40
|
+
hash(): Hex;
|
|
41
|
+
}) & {
|
|
42
|
+
/**
|
|
43
|
+
* The bytes length of the entity, if it is fixed, otherwise undefined
|
|
44
|
+
* @public
|
|
45
|
+
* @static
|
|
46
|
+
*/
|
|
47
|
+
byteLength?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Encode the entity into bytes
|
|
50
|
+
* @public
|
|
51
|
+
* @static
|
|
52
|
+
* @param _ - The entity to encode
|
|
53
|
+
* @returns The encoded bytes
|
|
54
|
+
* @throws Will throw an error if the entity is not serializable
|
|
55
|
+
*/
|
|
56
|
+
encode(_: SubTypeLike): Bytes;
|
|
57
|
+
/**
|
|
58
|
+
* Decode the entity from bytes
|
|
59
|
+
* @public
|
|
60
|
+
* @static
|
|
61
|
+
* @param _ - The bytes to decode
|
|
62
|
+
* @returns The decoded entity
|
|
63
|
+
* @throws Will throw an error if the entity is not serializable
|
|
64
|
+
*/
|
|
65
|
+
decode(_: BytesLike): SubType;
|
|
66
|
+
/**
|
|
67
|
+
* Create an entity from bytes
|
|
68
|
+
* @public
|
|
69
|
+
* @static
|
|
70
|
+
* @param _ - The bytes to create the entity from
|
|
71
|
+
* @returns The created entity
|
|
72
|
+
* @throws Will throw an error if the entity is not serializable
|
|
73
|
+
*/
|
|
74
|
+
fromBytes(_bytes: BytesLike): SubType;
|
|
75
|
+
/**
|
|
76
|
+
* Create an entity from a serializable object
|
|
77
|
+
* @public
|
|
78
|
+
* @static
|
|
79
|
+
* @param _ - The serializable object to create the entity from
|
|
80
|
+
* @returns The created entity
|
|
81
|
+
* @throws Will throw an error if the entity is not serializable
|
|
82
|
+
*/
|
|
83
|
+
from(_: SubTypeLike): SubType;
|
|
84
|
+
};
|
|
85
|
+
abstract toBytes(): Bytes;
|
|
86
|
+
abstract hash(): Hex;
|
|
87
|
+
abstract clone(): Entity;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* A class decorator to add methods implementation on the {@link Entity.Base} class
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* @mol.codec(
|
|
94
|
+
* mol.table({
|
|
95
|
+
* codeHash: mol.Byte32,
|
|
96
|
+
* hashType: HashTypeCodec,
|
|
97
|
+
* args: mol.Bytes,
|
|
98
|
+
* }),
|
|
99
|
+
* )
|
|
100
|
+
* export class Script extends mol.Entity.Base<ScriptLike, Script>() {
|
|
101
|
+
* from(scriptLike: ScriptLike): Script {}
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function codec<Encodable, TypeLike extends Encodable, Decoded extends TypeLike, Type extends object & TypeLike, ConstructorType extends Constructor<Type> & {
|
|
106
|
+
from(decoded: TypeLike): Type;
|
|
107
|
+
byteLength?: number;
|
|
108
|
+
encode(encodable: TypeLike): Bytes;
|
|
109
|
+
decode(bytesLike: BytesLike): TypeLike;
|
|
110
|
+
fromBytes(bytes: BytesLike): Type;
|
|
111
|
+
}>(codec: Codec<Encodable, Decoded>): (Constructor: ConstructorType) => {
|
|
112
|
+
new (...args: any[]): {};
|
|
113
|
+
byteLength: number | undefined;
|
|
114
|
+
encode(encodable: TypeLike): Bytes;
|
|
115
|
+
decode(bytesLike: BytesLike): Type;
|
|
116
|
+
fromBytes(bytes: BytesLike): Type;
|
|
117
|
+
from(decoded: TypeLike): Type;
|
|
118
|
+
} & ConstructorType;
|
|
119
|
+
//# sourceMappingURL=entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../src/molecule/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAW,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;GAGG;AACH,8BAAsB,MAAM;IAC1B;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW;QA6D1C;;;;WAIG;mBACQ,KAAK;QAMhB;;;;WAIG;iBACM,OAAO;QAMhB;;;;;WAKG;kBACO,WAAW,GAAG,OAAO;QAe/B;;;;WAIG;gBACK,GAAG;;QA3GX;;;;WAIG;qBACiB,MAAM;QAC1B;;;;;;;WAOG;kBACc,WAAW,GAAG,KAAK;QAKpC;;;;;;;WAOG;kBACc,SAAS,GAAG,OAAO;QAMpC;;;;;;;WAOG;0BACsB,SAAS,GAAG,OAAO;QAM5C;;;;;;;WAOG;gBACY,WAAW,GAAG,OAAO;;IA4DxC,QAAQ,CAAC,OAAO,IAAI,KAAK;IACzB,QAAQ,CAAC,IAAI,IAAI,GAAG;IACpB,QAAQ,CAAC,KAAK,IAAI,MAAM;CACzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,KAAK,CACnB,SAAS,EACT,QAAQ,SAAS,SAAS,EAC1B,OAAO,SAAS,QAAQ,EACxB,IAAI,SAAS,MAAM,GAAG,QAAQ,EAC9B,eAAe,SAAS,WAAW,CAAC,IAAI,CAAC,GAAG;IAC1C,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAC;IACnC,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,QAAQ,CAAC;IACvC,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACnC,EACD,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,iBACF,eAAe;;;sBAGhB,QAAQ,GAAG,KAAK;sBAGhB,SAAS,GAAG,IAAI;qBAIjB,SAAS,GAAG,IAAI;kBAjB5B,QAAQ,GAAG,IAAI;oBAsBhC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Entity = void 0;
|
|
4
|
+
exports.codec = codec;
|
|
5
|
+
const index_js_1 = require("../bytes/index.js");
|
|
6
|
+
const index_js_2 = require("../hasher/index.js");
|
|
7
|
+
/**
|
|
8
|
+
* The base class of CCC to create a serializable instance. This should be used with the {@link codec} decorator.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
class Entity {
|
|
12
|
+
/**
|
|
13
|
+
* Generate a base class of CCC to create a serializable instance.
|
|
14
|
+
* This should be used with the {@link codec} decorator.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
static Base() {
|
|
18
|
+
class Impl {
|
|
19
|
+
/**
|
|
20
|
+
* Encode the entity into bytes
|
|
21
|
+
* @public
|
|
22
|
+
* @static
|
|
23
|
+
* @param _ - The entity to encode
|
|
24
|
+
* @returns The encoded bytes
|
|
25
|
+
* @throws Will throw an error if the entity is not serializable
|
|
26
|
+
*/
|
|
27
|
+
static encode(_) {
|
|
28
|
+
throw new Error("encode not implemented, use @ccc.mol.codec to decorate your type");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Decode the entity from bytes
|
|
32
|
+
* @public
|
|
33
|
+
* @static
|
|
34
|
+
* @param _ - The bytes to decode
|
|
35
|
+
* @returns The decoded entity
|
|
36
|
+
* @throws Will throw an error if the entity is not serializable
|
|
37
|
+
*/
|
|
38
|
+
static decode(_) {
|
|
39
|
+
throw new Error("decode not implemented, use @ccc.mol.codec to decorate your type");
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create an entity from bytes
|
|
43
|
+
* @public
|
|
44
|
+
* @static
|
|
45
|
+
* @param _ - The bytes to create the entity from
|
|
46
|
+
* @returns The created entity
|
|
47
|
+
* @throws Will throw an error if the entity is not serializable
|
|
48
|
+
*/
|
|
49
|
+
static fromBytes(_bytes) {
|
|
50
|
+
throw new Error("fromBytes not implemented, use @ccc.mol.codec to decorate your type");
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create an entity from a serializable object
|
|
54
|
+
* @public
|
|
55
|
+
* @static
|
|
56
|
+
* @param _ - The serializable object to create the entity from
|
|
57
|
+
* @returns The created entity
|
|
58
|
+
* @throws Will throw an error if the entity is not serializable
|
|
59
|
+
*/
|
|
60
|
+
static from(_) {
|
|
61
|
+
throw new Error("from not implemented");
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Convert the entity to bytes
|
|
65
|
+
* @public
|
|
66
|
+
* @returns The bytes representation of the entity
|
|
67
|
+
*/
|
|
68
|
+
toBytes() {
|
|
69
|
+
return this.constructor.encode(this);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create a clone of the entity
|
|
73
|
+
* @public
|
|
74
|
+
* @returns A clone of the entity
|
|
75
|
+
*/
|
|
76
|
+
clone() {
|
|
77
|
+
return this.constructor.fromBytes(this.toBytes());
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Check if the entity is equal to another entity
|
|
81
|
+
* @public
|
|
82
|
+
* @param other - The other entity to compare with
|
|
83
|
+
* @returns True if the entities are equal, false otherwise
|
|
84
|
+
*/
|
|
85
|
+
eq(other) {
|
|
86
|
+
if (this === other) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
return (0, index_js_1.bytesEq)(this.toBytes(),
|
|
90
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any */
|
|
91
|
+
(this.constructor?.from(other) ?? other).toBytes());
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Calculate the hash of the entity
|
|
95
|
+
* @public
|
|
96
|
+
* @returns The hash of the entity
|
|
97
|
+
*/
|
|
98
|
+
hash() {
|
|
99
|
+
return (0, index_js_2.hashCkb)(this.toBytes());
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return Impl;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.Entity = Entity;
|
|
106
|
+
/**
|
|
107
|
+
* A class decorator to add methods implementation on the {@link Entity.Base} class
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* @mol.codec(
|
|
111
|
+
* mol.table({
|
|
112
|
+
* codeHash: mol.Byte32,
|
|
113
|
+
* hashType: HashTypeCodec,
|
|
114
|
+
* args: mol.Bytes,
|
|
115
|
+
* }),
|
|
116
|
+
* )
|
|
117
|
+
* export class Script extends mol.Entity.Base<ScriptLike, Script>() {
|
|
118
|
+
* from(scriptLike: ScriptLike): Script {}
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
function codec(codec) {
|
|
123
|
+
return function (Constructor) {
|
|
124
|
+
var _a;
|
|
125
|
+
return _a = class Extended extends Constructor {
|
|
126
|
+
static encode(encodable) {
|
|
127
|
+
return codec.encode(encodable);
|
|
128
|
+
}
|
|
129
|
+
static decode(bytesLike) {
|
|
130
|
+
return Constructor.from(codec.decode(bytesLike));
|
|
131
|
+
}
|
|
132
|
+
static fromBytes(bytes) {
|
|
133
|
+
return Constructor.from(codec.decode(bytes));
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
_a.byteLength = codec.byteLength,
|
|
137
|
+
_a;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/molecule/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/molecule/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC"}
|
|
@@ -10,9 +10,18 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var
|
|
14
|
-
|
|
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;
|
|
15
24
|
};
|
|
16
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
26
|
+
exports.mol = void 0;
|
|
27
|
+
exports.mol = __importStar(require("./barrel.js"));
|
|
@@ -1,32 +1,38 @@
|
|
|
1
|
-
import * as ckb from "../ckb/index.js";
|
|
2
1
|
import { Hex, HexLike } from "../hex/index.js";
|
|
3
2
|
import { Codec } from "./codec.js";
|
|
4
3
|
export declare const Uint8: Codec<import("../barrel.js").NumLike, number>;
|
|
4
|
+
export declare const Uint8Opt: Codec<import("../barrel.js").NumLike | null | undefined, number | undefined>;
|
|
5
|
+
export declare const Uint8Vec: Codec<import("../barrel.js").NumLike[], number[]>;
|
|
5
6
|
export declare const Uint16LE: Codec<import("../barrel.js").NumLike, number>;
|
|
6
7
|
export declare const Uint16BE: Codec<import("../barrel.js").NumLike, number>;
|
|
7
8
|
export declare const Uint16: Codec<import("../barrel.js").NumLike, number>;
|
|
9
|
+
export declare const Uint16Opt: Codec<import("../barrel.js").NumLike | null | undefined, number | undefined>;
|
|
10
|
+
export declare const Uint16Vec: Codec<import("../barrel.js").NumLike[], number[]>;
|
|
8
11
|
export declare const Uint32LE: Codec<import("../barrel.js").NumLike, number>;
|
|
9
12
|
export declare const Uint32BE: Codec<import("../barrel.js").NumLike, number>;
|
|
10
13
|
export declare const Uint32: Codec<import("../barrel.js").NumLike, number>;
|
|
14
|
+
export declare const Uint32Opt: Codec<import("../barrel.js").NumLike | null | undefined, number | undefined>;
|
|
15
|
+
export declare const Uint32Vec: Codec<import("../barrel.js").NumLike[], number[]>;
|
|
11
16
|
export declare const Uint64LE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
12
17
|
export declare const Uint64BE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
13
18
|
export declare const Uint64: Codec<import("../barrel.js").NumLike, bigint>;
|
|
19
|
+
export declare const Uint64Opt: Codec<import("../barrel.js").NumLike | null | undefined, bigint | undefined>;
|
|
20
|
+
export declare const Uint64Vec: Codec<import("../barrel.js").NumLike[], bigint[]>;
|
|
14
21
|
export declare const Uint128LE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
15
22
|
export declare const Uint128BE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
16
23
|
export declare const Uint128: Codec<import("../barrel.js").NumLike, bigint>;
|
|
24
|
+
export declare const Uint128Opt: Codec<import("../barrel.js").NumLike | null | undefined, bigint | undefined>;
|
|
25
|
+
export declare const Uint128Vec: Codec<import("../barrel.js").NumLike[], bigint[]>;
|
|
17
26
|
export declare const Uint256LE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
18
27
|
export declare const Uint256BE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
19
28
|
export declare const Uint256: Codec<import("../barrel.js").NumLike, bigint>;
|
|
29
|
+
export declare const Uint256Opt: Codec<import("../barrel.js").NumLike | null | undefined, bigint | undefined>;
|
|
30
|
+
export declare const Uint256Vec: Codec<import("../barrel.js").NumLike[], bigint[]>;
|
|
20
31
|
export declare const Uint512LE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
21
32
|
export declare const Uint512BE: Codec<import("../barrel.js").NumLike, bigint>;
|
|
22
33
|
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
34
|
export declare const Uint512Opt: Codec<import("../barrel.js").NumLike | null | undefined, bigint | undefined>;
|
|
35
|
+
export declare const Uint512Vec: Codec<import("../barrel.js").NumLike[], bigint[]>;
|
|
30
36
|
export declare const Bytes: Codec<HexLike, Hex>;
|
|
31
37
|
export declare const BytesOpt: Codec<import("../bytes/index.js").BytesLike | null | undefined, `0x${string}` | undefined>;
|
|
32
38
|
export declare const BytesVec: Codec<import("../bytes/index.js").BytesLike[], `0x${string}`[]>;
|
|
@@ -36,17 +42,4 @@ export declare const Byte32Vec: Codec<import("../bytes/index.js").BytesLike[], `
|
|
|
36
42
|
export declare const String: Codec<string, string>;
|
|
37
43
|
export declare const StringVec: Codec<string[], string[]>;
|
|
38
44
|
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
45
|
//# sourceMappingURL=predefined.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predefined.d.ts","sourceRoot":"","sources":["../../src/molecule/predefined.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"predefined.d.ts","sourceRoot":"","sources":["../../src/molecule/predefined.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAW,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAW,KAAK,EAAoC,MAAM,YAAY,CAAC;AAE9E,eAAO,MAAM,KAAK,+CAAsB,CAAC;AACzC,eAAO,MAAM,QAAQ,8EAAgB,CAAC;AACtC,eAAO,MAAM,QAAQ,mDAAgB,CA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