@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"}
|
package/dist/molecule/codec.d.ts
CHANGED
|
@@ -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,SAAS,IAAI;IACtD,QAAQ,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,KAAK,CAAC;IACjD,QAAQ,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC;IACnD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AACF,qBAAa,KAAK,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS;aAE7B,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,KAAK;aACvC,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO;aACzC,UAAU,CAAC,EAAE,MAA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AAC,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"}
|
package/dist/molecule/codec.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { bytesConcat, bytesFrom } from "../bytes/index.js";
|
|
2
|
+
import { bytesConcat, bytesConcatTo, bytesFrom, } from "../bytes/index.js";
|
|
3
3
|
import { numBeFromBytes, numBeToBytes, numFromBytes, numToBytes, } from "../num/index.js";
|
|
4
4
|
export class Codec {
|
|
5
5
|
constructor(encode, decode, byteLength) {
|
|
@@ -19,6 +19,12 @@ export class Codec {
|
|
|
19
19
|
: this.decode(buffer)),
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
+
mapIn(map) {
|
|
23
|
+
return this.map({ inMap: map });
|
|
24
|
+
}
|
|
25
|
+
mapOut(map) {
|
|
26
|
+
return this.map({ outMap: map });
|
|
27
|
+
}
|
|
22
28
|
}
|
|
23
29
|
function uint32To(numLike) {
|
|
24
30
|
return numToBytes(numLike, 4);
|
|
@@ -38,7 +44,12 @@ export function fixedItemVec(itemCodec) {
|
|
|
38
44
|
return Codec.from({
|
|
39
45
|
encode(userDefinedItems) {
|
|
40
46
|
try {
|
|
41
|
-
|
|
47
|
+
const concatted = [];
|
|
48
|
+
bytesConcatTo(concatted, uint32To(userDefinedItems.length));
|
|
49
|
+
for (const item of userDefinedItems) {
|
|
50
|
+
bytesConcatTo(concatted, itemCodec.encode(item));
|
|
51
|
+
}
|
|
52
|
+
return bytesFrom(concatted);
|
|
42
53
|
}
|
|
43
54
|
catch (e) {
|
|
44
55
|
throw new Error(`fixedItemVec(${e?.toString()})`);
|
|
@@ -56,7 +67,7 @@ export function fixedItemVec(itemCodec) {
|
|
|
56
67
|
}
|
|
57
68
|
try {
|
|
58
69
|
const decodedArray = [];
|
|
59
|
-
for (let offset =
|
|
70
|
+
for (let offset = 4; offset < byteLength; offset += itemByteLength) {
|
|
60
71
|
decodedArray.push(itemCodec.decode(value.slice(offset, offset + itemByteLength)));
|
|
61
72
|
}
|
|
62
73
|
return decodedArray;
|
|
@@ -75,21 +86,17 @@ export function dynItemVec(itemCodec) {
|
|
|
75
86
|
return Codec.from({
|
|
76
87
|
encode(userDefinedItems) {
|
|
77
88
|
try {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
offset: 4 + userDefinedItems.length * 4,
|
|
90
|
-
});
|
|
91
|
-
const packedTotalSize = uint32To(encoded.header.byteLength + encoded.body.byteLength + 4);
|
|
92
|
-
return bytesConcat(packedTotalSize, encoded.header, encoded.body);
|
|
89
|
+
let offset = 4 + userDefinedItems.length * 4;
|
|
90
|
+
const header = [];
|
|
91
|
+
const body = [];
|
|
92
|
+
for (const item of userDefinedItems) {
|
|
93
|
+
const encoded = itemCodec.encode(item);
|
|
94
|
+
bytesConcatTo(header, uint32To(offset));
|
|
95
|
+
bytesConcatTo(body, encoded);
|
|
96
|
+
offset += encoded.byteLength;
|
|
97
|
+
}
|
|
98
|
+
const packedTotalSize = uint32To(header.length + body.length + 4);
|
|
99
|
+
return bytesConcat(packedTotalSize, header, body);
|
|
93
100
|
}
|
|
94
101
|
catch (e) {
|
|
95
102
|
throw new Error(`dynItemVec(${e?.toString()})`);
|
|
@@ -97,12 +104,15 @@ export function dynItemVec(itemCodec) {
|
|
|
97
104
|
},
|
|
98
105
|
decode(buffer) {
|
|
99
106
|
const value = bytesFrom(buffer);
|
|
107
|
+
if (value.byteLength < 4) {
|
|
108
|
+
throw new Error(`dynItemVec: too short buffer, expected at least 4 bytes, but got ${value.byteLength}`);
|
|
109
|
+
}
|
|
100
110
|
const byteLength = uint32From(value.slice(0, 4));
|
|
101
111
|
if (byteLength !== value.byteLength) {
|
|
102
112
|
throw new Error(`dynItemVec: invalid buffer size, expected ${byteLength}, but got ${value.byteLength}`);
|
|
103
113
|
}
|
|
104
|
-
if (
|
|
105
|
-
|
|
114
|
+
if (byteLength === 4) {
|
|
115
|
+
return [];
|
|
106
116
|
}
|
|
107
117
|
const offset = uint32From(value.slice(4, 8));
|
|
108
118
|
const itemCount = (offset - 4) / 4;
|
|
@@ -210,26 +220,21 @@ export function table(codecLayout) {
|
|
|
210
220
|
const keys = Object.keys(codecLayout);
|
|
211
221
|
return Codec.from({
|
|
212
222
|
encode(object) {
|
|
213
|
-
|
|
214
|
-
const
|
|
223
|
+
let offset = 4 + keys.length * 4;
|
|
224
|
+
const header = [];
|
|
225
|
+
const body = [];
|
|
226
|
+
for (const key of keys) {
|
|
215
227
|
try {
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
body: bytesConcat(result.body, encodedItem),
|
|
221
|
-
offset: result.offset + bytesFrom(encodedItem).byteLength,
|
|
222
|
-
};
|
|
228
|
+
const encoded = codecLayout[key].encode(object[key]);
|
|
229
|
+
bytesConcatTo(header, uint32To(offset));
|
|
230
|
+
bytesConcatTo(body, encoded);
|
|
231
|
+
offset += encoded.byteLength;
|
|
223
232
|
}
|
|
224
233
|
catch (e) {
|
|
225
234
|
throw new Error(`table.${key}(${e?.toString()})`);
|
|
226
235
|
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
body: bytesFrom([]),
|
|
230
|
-
offset: headerLength,
|
|
231
|
-
});
|
|
232
|
-
const packedTotalSize = uint32To(header.byteLength + body.byteLength + 4);
|
|
236
|
+
}
|
|
237
|
+
const packedTotalSize = uint32To(header.length + body.length + 4);
|
|
233
238
|
return bytesConcat(packedTotalSize, header, body);
|
|
234
239
|
},
|
|
235
240
|
decode(buffer) {
|
|
@@ -330,22 +335,26 @@ export function union(codecLayout, fields) {
|
|
|
330
335
|
*/
|
|
331
336
|
export function struct(codecLayout) {
|
|
332
337
|
const codecArray = Object.values(codecLayout);
|
|
333
|
-
if (codecArray.some((codec) => codec.byteLength === undefined)) {
|
|
334
|
-
throw new Error("struct: all fields must be fixed-size");
|
|
335
|
-
}
|
|
336
338
|
const keys = Object.keys(codecLayout);
|
|
337
339
|
return Codec.from({
|
|
338
|
-
byteLength: codecArray.reduce((
|
|
340
|
+
byteLength: codecArray.reduce((acc, codec) => {
|
|
341
|
+
if (codec.byteLength === undefined) {
|
|
342
|
+
throw new Error("struct: all fields must be fixed-size");
|
|
343
|
+
}
|
|
344
|
+
return acc + codec.byteLength;
|
|
345
|
+
}, 0),
|
|
339
346
|
encode(object) {
|
|
340
|
-
|
|
347
|
+
const bytes = [];
|
|
348
|
+
for (const key of keys) {
|
|
341
349
|
try {
|
|
342
|
-
const
|
|
343
|
-
|
|
350
|
+
const encoded = codecLayout[key].encode(object[key]);
|
|
351
|
+
bytesConcatTo(bytes, encoded);
|
|
344
352
|
}
|
|
345
353
|
catch (e) {
|
|
346
354
|
throw new Error(`struct.${key}(${e?.toString()})`);
|
|
347
355
|
}
|
|
348
|
-
}
|
|
356
|
+
}
|
|
357
|
+
return bytesFrom(bytes);
|
|
349
358
|
},
|
|
350
359
|
decode(buffer) {
|
|
351
360
|
const value = bytesFrom(buffer);
|
|
@@ -381,7 +390,11 @@ export function array(itemCodec, itemCount) {
|
|
|
381
390
|
byteLength,
|
|
382
391
|
encode(items) {
|
|
383
392
|
try {
|
|
384
|
-
|
|
393
|
+
const bytes = [];
|
|
394
|
+
for (const item of items) {
|
|
395
|
+
bytesConcatTo(bytes, itemCodec.encode(item));
|
|
396
|
+
}
|
|
397
|
+
return bytesFrom(bytes);
|
|
385
398
|
}
|
|
386
399
|
catch (e) {
|
|
387
400
|
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,OAA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,GAAG,IAAI;qBAIjB,SAAS,GAAG,IAAI;kBAjB5B,QAAQ,GAAG,IAAI;oBAsBhC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { bytesEq } from "../bytes/index.js";
|
|
2
|
+
import { hashCkb } from "../hasher/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* The base class of CCC to create a serializable instance. This should be used with the {@link codec} decorator.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export class Entity {
|
|
8
|
+
/**
|
|
9
|
+
* Generate a base class of CCC to create a serializable instance.
|
|
10
|
+
* This should be used with the {@link codec} decorator.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
static Base() {
|
|
14
|
+
class Impl {
|
|
15
|
+
/**
|
|
16
|
+
* Encode the entity into bytes
|
|
17
|
+
* @public
|
|
18
|
+
* @static
|
|
19
|
+
* @param _ - The entity to encode
|
|
20
|
+
* @returns The encoded bytes
|
|
21
|
+
* @throws Will throw an error if the entity is not serializable
|
|
22
|
+
*/
|
|
23
|
+
static encode(_) {
|
|
24
|
+
throw new Error("encode not implemented, use @ccc.mol.codec to decorate your type");
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Decode the entity from bytes
|
|
28
|
+
* @public
|
|
29
|
+
* @static
|
|
30
|
+
* @param _ - The bytes to decode
|
|
31
|
+
* @returns The decoded entity
|
|
32
|
+
* @throws Will throw an error if the entity is not serializable
|
|
33
|
+
*/
|
|
34
|
+
static decode(_) {
|
|
35
|
+
throw new Error("decode not implemented, use @ccc.mol.codec to decorate your type");
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create an entity from bytes
|
|
39
|
+
* @public
|
|
40
|
+
* @static
|
|
41
|
+
* @param _ - The bytes to create the entity from
|
|
42
|
+
* @returns The created entity
|
|
43
|
+
* @throws Will throw an error if the entity is not serializable
|
|
44
|
+
*/
|
|
45
|
+
static fromBytes(_bytes) {
|
|
46
|
+
throw new Error("fromBytes not implemented, use @ccc.mol.codec to decorate your type");
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create an entity from a serializable object
|
|
50
|
+
* @public
|
|
51
|
+
* @static
|
|
52
|
+
* @param _ - The serializable object to create the entity from
|
|
53
|
+
* @returns The created entity
|
|
54
|
+
* @throws Will throw an error if the entity is not serializable
|
|
55
|
+
*/
|
|
56
|
+
static from(_) {
|
|
57
|
+
throw new Error("from not implemented");
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Convert the entity to bytes
|
|
61
|
+
* @public
|
|
62
|
+
* @returns The bytes representation of the entity
|
|
63
|
+
*/
|
|
64
|
+
toBytes() {
|
|
65
|
+
return this.constructor.encode(this);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Create a clone of the entity
|
|
69
|
+
* @public
|
|
70
|
+
* @returns A clone of the entity
|
|
71
|
+
*/
|
|
72
|
+
clone() {
|
|
73
|
+
return this.constructor.fromBytes(this.toBytes());
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Check if the entity is equal to another entity
|
|
77
|
+
* @public
|
|
78
|
+
* @param other - The other entity to compare with
|
|
79
|
+
* @returns True if the entities are equal, false otherwise
|
|
80
|
+
*/
|
|
81
|
+
eq(other) {
|
|
82
|
+
if (this === other) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return bytesEq(this.toBytes(),
|
|
86
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any */
|
|
87
|
+
(this.constructor?.from(other) ?? other).toBytes());
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Calculate the hash of the entity
|
|
91
|
+
* @public
|
|
92
|
+
* @returns The hash of the entity
|
|
93
|
+
*/
|
|
94
|
+
hash() {
|
|
95
|
+
return hashCkb(this.toBytes());
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return Impl;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A class decorator to add methods implementation on the {@link Entity.Base} class
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* @mol.codec(
|
|
106
|
+
* mol.table({
|
|
107
|
+
* codeHash: mol.Byte32,
|
|
108
|
+
* hashType: HashTypeCodec,
|
|
109
|
+
* args: mol.Bytes,
|
|
110
|
+
* }),
|
|
111
|
+
* )
|
|
112
|
+
* export class Script extends mol.Entity.Base<ScriptLike, Script>() {
|
|
113
|
+
* from(scriptLike: ScriptLike): Script {}
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export function codec(codec) {
|
|
118
|
+
return function (Constructor) {
|
|
119
|
+
var _a;
|
|
120
|
+
return _a = class Extended extends Constructor {
|
|
121
|
+
static encode(encodable) {
|
|
122
|
+
return codec.encode(encodable);
|
|
123
|
+
}
|
|
124
|
+
static decode(bytesLike) {
|
|
125
|
+
return Constructor.from(codec.decode(bytesLike));
|
|
126
|
+
}
|
|
127
|
+
static fromBytes(bytes) {
|
|
128
|
+
return Constructor.from(codec.decode(bytes));
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
_a.byteLength = codec.byteLength,
|
|
132
|
+
_a;
|
|
133
|
+
};
|
|
134
|
+
}
|
package/dist/molecule/index.d.ts
CHANGED
|
@@ -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"}
|
package/dist/molecule/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./predefined.js";
|
|
1
|
+
export * as mol from "./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,G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