@ckb-ccc/spore 0.1.0-alpha.4 → 0.1.0
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 +22 -0
- package/dist/cluster/index.d.ts +17 -2
- package/dist/cluster/index.d.ts.map +1 -1
- package/dist/cluster/index.js +40 -1
- package/dist/cobuild/index.d.ts +10 -11
- package/dist/cobuild/index.d.ts.map +1 -1
- package/dist/cobuild/index.js +17 -17
- package/dist/codec/cluster.d.ts +17 -24
- package/dist/codec/cluster.d.ts.map +1 -1
- package/dist/codec/cluster.js +17 -28
- package/dist/codec/cobuild/buildingPacket.d.ts +258 -455
- package/dist/codec/cobuild/buildingPacket.d.ts.map +1 -1
- package/dist/codec/cobuild/buildingPacket.js +27 -38
- package/dist/codec/cobuild/sporeAction.d.ts +532 -257
- package/dist/codec/cobuild/sporeAction.d.ts.map +1 -1
- package/dist/codec/cobuild/sporeAction.js +45 -59
- package/dist/codec/cobuild/witnessLayout.d.ts +113 -30
- package/dist/codec/cobuild/witnessLayout.d.ts.map +1 -1
- package/dist/codec/cobuild/witnessLayout.js +10 -11
- package/dist/codec/spore.d.ts +5 -10
- package/dist/codec/spore.d.ts.map +1 -1
- package/dist/codec/spore.js +9 -17
- package/dist/spore/advanced.d.ts +3 -4
- package/dist/spore/advanced.d.ts.map +1 -1
- package/dist/spore/index.d.ts +20 -2
- package/dist/spore/index.d.ts.map +1 -1
- package/dist/spore/index.js +44 -1
- package/dist.commonjs/cluster/index.d.ts +17 -2
- package/dist.commonjs/cluster/index.d.ts.map +1 -1
- package/dist.commonjs/cluster/index.js +40 -0
- package/dist.commonjs/cobuild/index.d.ts +10 -11
- package/dist.commonjs/cobuild/index.d.ts.map +1 -1
- package/dist.commonjs/cobuild/index.js +17 -17
- package/dist.commonjs/codec/cluster.d.ts +17 -24
- package/dist.commonjs/codec/cluster.d.ts.map +1 -1
- package/dist.commonjs/codec/cluster.js +17 -28
- package/dist.commonjs/codec/cobuild/buildingPacket.d.ts +258 -455
- package/dist.commonjs/codec/cobuild/buildingPacket.d.ts.map +1 -1
- package/dist.commonjs/codec/cobuild/buildingPacket.js +27 -38
- package/dist.commonjs/codec/cobuild/sporeAction.d.ts +532 -257
- package/dist.commonjs/codec/cobuild/sporeAction.d.ts.map +1 -1
- package/dist.commonjs/codec/cobuild/sporeAction.js +45 -59
- package/dist.commonjs/codec/cobuild/witnessLayout.d.ts +113 -30
- package/dist.commonjs/codec/cobuild/witnessLayout.d.ts.map +1 -1
- package/dist.commonjs/codec/cobuild/witnessLayout.js +10 -11
- package/dist.commonjs/codec/spore.d.ts +5 -10
- package/dist.commonjs/codec/spore.d.ts.map +1 -1
- package/dist.commonjs/codec/spore.js +9 -17
- package/dist.commonjs/spore/advanced.d.ts +3 -4
- package/dist.commonjs/spore/advanced.d.ts.map +1 -1
- package/dist.commonjs/spore/index.d.ts +20 -2
- package/dist.commonjs/spore/index.d.ts.map +1 -1
- package/dist.commonjs/spore/index.js +44 -0
- package/package.json +5 -6
- package/src/cluster/index.ts +59 -2
- package/src/cobuild/index.ts +27 -28
- package/src/codec/cluster.ts +51 -56
- package/src/codec/cobuild/buildingPacket.ts +41 -72
- package/src/codec/cobuild/sporeAction.ts +75 -129
- package/src/codec/cobuild/witnessLayout.ts +12 -18
- package/src/codec/spore.ts +18 -27
- package/src/spore/advanced.ts +4 -5
- package/src/spore/index.ts +58 -2
- package/dist/codec/base.d.ts +0 -6
- package/dist/codec/base.d.ts.map +0 -1
- package/dist/codec/base.js +0 -10
- package/dist.commonjs/codec/base.d.ts +0 -6
- package/dist.commonjs/codec/base.d.ts.map +0 -1
- package/dist.commonjs/codec/base.js +0 -13
- package/src/codec/base.ts +0 -11
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
import { UnpackResult } from "@ckb-lumos/codec";
|
|
1
|
+
import { ccc, mol } from "@ckb-ccc/core";
|
|
3
2
|
import { Action, ActionVec, WitnessLayout } from "../codec/index.js";
|
|
4
|
-
export declare function assembleCreateSporeAction(sporeOutput: ccc.CellOutputLike, sporeData: ccc.BytesLike, scriptInfoHash?: ccc.HexLike):
|
|
5
|
-
export declare function assembleTransferSporeAction(sporeInput: ccc.CellOutputLike, sporeOutput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike):
|
|
6
|
-
export declare function assembleMeltSporeAction(sporeInput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike):
|
|
7
|
-
export declare function assembleCreateClusterAction(clusterOutput: ccc.CellOutputLike, clusterData: ccc.BytesLike, scriptInfoHash?: ccc.HexLike):
|
|
8
|
-
export declare function assembleTransferClusterAction(clusterInput: ccc.CellOutputLike, clusterOutput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike):
|
|
9
|
-
export declare function prepareSporeTransaction(signer: ccc.Signer, txLike: ccc.TransactionLike, actions:
|
|
10
|
-
export declare function unpackCommonCobuildProof(data: ccc.HexLike):
|
|
11
|
-
export declare function extractCobuildActionsFromTx(tx: ccc.Transaction):
|
|
12
|
-
export declare function injectCobuild(tx: ccc.Transaction, actions:
|
|
3
|
+
export declare function assembleCreateSporeAction(sporeOutput: ccc.CellOutputLike, sporeData: ccc.BytesLike, scriptInfoHash?: ccc.HexLike): mol.EncodableType<typeof Action>;
|
|
4
|
+
export declare function assembleTransferSporeAction(sporeInput: ccc.CellOutputLike, sporeOutput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): mol.EncodableType<typeof Action>;
|
|
5
|
+
export declare function assembleMeltSporeAction(sporeInput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): mol.EncodableType<typeof Action>;
|
|
6
|
+
export declare function assembleCreateClusterAction(clusterOutput: ccc.CellOutputLike, clusterData: ccc.BytesLike, scriptInfoHash?: ccc.HexLike): mol.EncodableType<typeof Action>;
|
|
7
|
+
export declare function assembleTransferClusterAction(clusterInput: ccc.CellOutputLike, clusterOutput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): mol.EncodableType<typeof Action>;
|
|
8
|
+
export declare function prepareSporeTransaction(signer: ccc.Signer, txLike: ccc.TransactionLike, actions: mol.EncodableType<typeof ActionVec>): Promise<ccc.Transaction>;
|
|
9
|
+
export declare function unpackCommonCobuildProof(data: ccc.HexLike): mol.EncodableType<typeof WitnessLayout> | undefined;
|
|
10
|
+
export declare function extractCobuildActionsFromTx(tx: ccc.Transaction): mol.EncodableType<typeof ActionVec>;
|
|
11
|
+
export declare function injectCobuild(tx: ccc.Transaction, actions: mol.EncodableType<typeof ActionVec>): void;
|
|
13
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cobuild/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cobuild/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,MAAM,EACN,SAAS,EAET,aAAa,EACd,MAAM,mBAAmB,CAAC;AAG3B,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,GAAG,CAAC,cAAc,EAC/B,SAAS,EAAE,GAAG,CAAC,SAAS,EACxB,cAAc,GAAE,GAAG,CAAC,OAAmC,GACtD,GAAG,CAAC,aAAa,CAAC,OAAO,MAAM,CAAC,CAsBlC;AAED,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,GAAG,CAAC,cAAc,EAC9B,WAAW,EAAE,GAAG,CAAC,cAAc,EAC/B,cAAc,GAAE,GAAG,CAAC,OAAmC,GACtD,GAAG,CAAC,aAAa,CAAC,OAAO,MAAM,CAAC,CA0BlC;AAED,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,GAAG,CAAC,cAAc,EAC9B,cAAc,GAAE,GAAG,CAAC,OAAmC,GACtD,GAAG,CAAC,aAAa,CAAC,OAAO,MAAM,CAAC,CAqBlC;AAED,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,GAAG,CAAC,cAAc,EACjC,WAAW,EAAE,GAAG,CAAC,SAAS,EAC1B,cAAc,GAAE,GAAG,CAAC,OAAmC,GACtD,GAAG,CAAC,aAAa,CAAC,OAAO,MAAM,CAAC,CAsBlC;AAED,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,GAAG,CAAC,cAAc,EAChC,aAAa,EAAE,GAAG,CAAC,cAAc,EACjC,cAAc,GAAE,GAAG,CAAC,OAAmC,GACtD,GAAG,CAAC,aAAa,CAAC,OAAO,MAAM,CAAC,CAyBlC;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,MAAM,EAAE,GAAG,CAAC,eAAe,EAC3B,OAAO,EAAE,GAAG,CAAC,aAAa,CAAC,OAAO,SAAS,CAAC,GAC3C,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAW1B;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,GAAG,CAAC,OAAO,GAChB,GAAG,CAAC,aAAa,CAAC,OAAO,aAAa,CAAC,GAAG,SAAS,CAMrD;AAED,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,GAAG,CAAC,WAAW,GAClB,GAAG,CAAC,aAAa,CAAC,OAAO,SAAS,CAAC,CAiBrC;AAED,wBAAgB,aAAa,CAC3B,EAAE,EAAE,GAAG,CAAC,WAAW,EACnB,OAAO,EAAE,GAAG,CAAC,aAAa,CAAC,OAAO,SAAS,CAAC,GAC3C,IAAI,CAaN"}
|
|
@@ -18,15 +18,15 @@ function assembleCreateSporeAction(sporeOutput, sporeData, scriptInfoHash = inde
|
|
|
18
18
|
}
|
|
19
19
|
const sporeType = core_1.ccc.Script.from(sporeOutput.type);
|
|
20
20
|
const sporeTypeHash = sporeType.hash();
|
|
21
|
-
const actionData = index_js_1.SporeAction.
|
|
21
|
+
const actionData = index_js_1.SporeAction.encode({
|
|
22
22
|
type: "CreateSpore",
|
|
23
23
|
value: {
|
|
24
24
|
sporeId: sporeType.args,
|
|
25
|
-
dataHash: core_1.ccc.hashCkb(sporeData),
|
|
26
25
|
to: {
|
|
27
26
|
type: "Script",
|
|
28
|
-
value:
|
|
27
|
+
value: sporeOutput.lock,
|
|
29
28
|
},
|
|
29
|
+
dataHash: core_1.ccc.hashCkb(sporeData),
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
return {
|
|
@@ -41,17 +41,17 @@ function assembleTransferSporeAction(sporeInput, sporeOutput, scriptInfoHash = i
|
|
|
41
41
|
}
|
|
42
42
|
const sporeType = core_1.ccc.Script.from(sporeOutput.type);
|
|
43
43
|
const sporeTypeHash = sporeType.hash();
|
|
44
|
-
const actionData = index_js_1.SporeAction.
|
|
44
|
+
const actionData = index_js_1.SporeAction.encode({
|
|
45
45
|
type: "TransferSpore",
|
|
46
46
|
value: {
|
|
47
47
|
sporeId: sporeType.args,
|
|
48
48
|
from: {
|
|
49
49
|
type: "Script",
|
|
50
|
-
value:
|
|
50
|
+
value: sporeInput.lock,
|
|
51
51
|
},
|
|
52
52
|
to: {
|
|
53
53
|
type: "Script",
|
|
54
|
-
value:
|
|
54
|
+
value: sporeOutput.lock,
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
});
|
|
@@ -67,13 +67,13 @@ function assembleMeltSporeAction(sporeInput, scriptInfoHash = index_js_2.DEFAULT
|
|
|
67
67
|
}
|
|
68
68
|
const sporeType = core_1.ccc.Script.from(sporeInput.type);
|
|
69
69
|
const sporeTypeHash = sporeType.hash();
|
|
70
|
-
const actionData = index_js_1.SporeAction.
|
|
70
|
+
const actionData = index_js_1.SporeAction.encode({
|
|
71
71
|
type: "MeltSpore",
|
|
72
72
|
value: {
|
|
73
73
|
sporeId: sporeType.args,
|
|
74
74
|
from: {
|
|
75
75
|
type: "Script",
|
|
76
|
-
value:
|
|
76
|
+
value: sporeInput.lock,
|
|
77
77
|
},
|
|
78
78
|
},
|
|
79
79
|
});
|
|
@@ -89,15 +89,15 @@ function assembleCreateClusterAction(clusterOutput, clusterData, scriptInfoHash
|
|
|
89
89
|
}
|
|
90
90
|
const clusterType = core_1.ccc.Script.from(clusterOutput.type);
|
|
91
91
|
const clusterTypeHash = clusterType.hash();
|
|
92
|
-
const actionData = index_js_1.SporeAction.
|
|
92
|
+
const actionData = index_js_1.SporeAction.encode({
|
|
93
93
|
type: "CreateCluster",
|
|
94
94
|
value: {
|
|
95
95
|
clusterId: clusterType.args,
|
|
96
|
-
dataHash: core_1.ccc.hashCkb(clusterData),
|
|
97
96
|
to: {
|
|
98
97
|
type: "Script",
|
|
99
|
-
value:
|
|
98
|
+
value: clusterOutput.lock,
|
|
100
99
|
},
|
|
100
|
+
dataHash: core_1.ccc.hashCkb(clusterData),
|
|
101
101
|
},
|
|
102
102
|
});
|
|
103
103
|
return {
|
|
@@ -112,17 +112,17 @@ function assembleTransferClusterAction(clusterInput, clusterOutput, scriptInfoHa
|
|
|
112
112
|
}
|
|
113
113
|
const clusterType = core_1.ccc.Script.from(clusterOutput.type);
|
|
114
114
|
const clusterTypeHash = clusterType.hash();
|
|
115
|
-
const actionData = index_js_1.SporeAction.
|
|
115
|
+
const actionData = index_js_1.SporeAction.encode({
|
|
116
116
|
type: "TransferCluster",
|
|
117
117
|
value: {
|
|
118
118
|
clusterId: clusterType.args,
|
|
119
119
|
from: {
|
|
120
120
|
type: "Script",
|
|
121
|
-
value:
|
|
121
|
+
value: clusterInput.lock,
|
|
122
122
|
},
|
|
123
123
|
to: {
|
|
124
124
|
type: "Script",
|
|
125
|
-
value:
|
|
125
|
+
value: clusterOutput.lock,
|
|
126
126
|
},
|
|
127
127
|
},
|
|
128
128
|
});
|
|
@@ -144,7 +144,7 @@ async function prepareSporeTransaction(signer, txLike, actions) {
|
|
|
144
144
|
}
|
|
145
145
|
function unpackCommonCobuildProof(data) {
|
|
146
146
|
try {
|
|
147
|
-
return index_js_1.WitnessLayout.
|
|
147
|
+
return index_js_1.WitnessLayout.decode(core_1.ccc.bytesFrom(data));
|
|
148
148
|
}
|
|
149
149
|
catch {
|
|
150
150
|
return;
|
|
@@ -159,14 +159,14 @@ function extractCobuildActionsFromTx(tx) {
|
|
|
159
159
|
return [];
|
|
160
160
|
}
|
|
161
161
|
if (witnessLayout.type !== "SighashAll") {
|
|
162
|
-
throw new Error("Invalid cobuild proof type: "
|
|
162
|
+
throw new Error("Invalid cobuild proof type: SighashAll");
|
|
163
163
|
}
|
|
164
164
|
// Remove existed cobuild witness
|
|
165
165
|
tx.witnesses.pop();
|
|
166
166
|
return witnessLayout.value.message.actions;
|
|
167
167
|
}
|
|
168
168
|
function injectCobuild(tx, actions) {
|
|
169
|
-
const witnessLayout = core_1.ccc.hexFrom(index_js_1.WitnessLayout.
|
|
169
|
+
const witnessLayout = core_1.ccc.hexFrom(index_js_1.WitnessLayout.encode({
|
|
170
170
|
type: "SighashAll",
|
|
171
171
|
value: {
|
|
172
172
|
seal: "0x",
|
|
@@ -1,41 +1,34 @@
|
|
|
1
|
-
import { ccc } from "@ckb-ccc/core";
|
|
2
|
-
|
|
3
|
-
export declare const MolClusterDataV1: molecule.ObjectLayoutCodec<{
|
|
4
|
-
name: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, string>;
|
|
5
|
-
description: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, string>;
|
|
6
|
-
}>;
|
|
7
|
-
export declare const MolClusterDataV2: molecule.ObjectLayoutCodec<{
|
|
8
|
-
name: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, string>;
|
|
9
|
-
description: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, string>;
|
|
10
|
-
mutantId: molecule.OptionLayoutCodec<import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, import("@ckb-lumos/codec").BytesLike>>;
|
|
11
|
-
}>;
|
|
12
|
-
export interface ClusterDataV1 {
|
|
1
|
+
import { ccc, mol } from "@ckb-ccc/core";
|
|
2
|
+
export interface ClusterDataV1View {
|
|
13
3
|
name: string;
|
|
14
4
|
description: string;
|
|
15
5
|
}
|
|
16
|
-
export
|
|
6
|
+
export declare const ClusterDataV1: mol.Codec<ClusterDataV1View>;
|
|
7
|
+
export interface ClusterDataV2View {
|
|
17
8
|
name: string;
|
|
18
9
|
description: string;
|
|
19
10
|
mutantId?: ccc.HexLike;
|
|
20
11
|
}
|
|
21
|
-
export
|
|
12
|
+
export declare const ClusterDataV2: mol.Codec<ClusterDataV2View>;
|
|
13
|
+
export type ClusterDataView = ClusterDataV2View;
|
|
22
14
|
export type ClusterDataVersion = "v1" | "v2";
|
|
15
|
+
export declare const ClusterData: ccc.mol.Codec<ClusterDataV2View, ClusterDataV2View>;
|
|
23
16
|
/**
|
|
24
17
|
* Pack RawClusterData to Uint8Array.
|
|
25
18
|
* Pass an optional "version" field to select a specific packing version.
|
|
26
19
|
*/
|
|
27
|
-
export declare function packRawClusterData(packable:
|
|
28
|
-
export declare function packRawClusterData(packable:
|
|
29
|
-
export declare function packRawClusterData(packable:
|
|
30
|
-
export declare function packRawClusterDataV1(packable:
|
|
31
|
-
export declare function packRawClusterDataV2(packable:
|
|
20
|
+
export declare function packRawClusterData(packable: ClusterDataView): Uint8Array;
|
|
21
|
+
export declare function packRawClusterData(packable: ClusterDataV1View, version: "v1"): Uint8Array;
|
|
22
|
+
export declare function packRawClusterData(packable: ClusterDataV2View, version: "v2"): Uint8Array;
|
|
23
|
+
export declare function packRawClusterDataV1(packable: ClusterDataV1View): Uint8Array;
|
|
24
|
+
export declare function packRawClusterDataV2(packable: ClusterDataV2View): Uint8Array;
|
|
32
25
|
/**
|
|
33
26
|
* Unpack Hex/Bytes to RawClusterData.
|
|
34
27
|
* Pass an optional "version" field to select a specific unpacking version.
|
|
35
28
|
*/
|
|
36
|
-
export declare function unpackToRawClusterData(unpackable: ccc.BytesLike):
|
|
37
|
-
export declare function unpackToRawClusterData(unpackable: ccc.BytesLike, version: "v1"):
|
|
38
|
-
export declare function unpackToRawClusterData(unpackable: ccc.BytesLike, version: "v2"):
|
|
39
|
-
export declare function unpackToRawClusterDataV1(unpackable: ccc.BytesLike):
|
|
40
|
-
export declare function unpackToRawClusterDataV2(unpackable: ccc.BytesLike):
|
|
29
|
+
export declare function unpackToRawClusterData(unpackable: ccc.BytesLike): ClusterDataView;
|
|
30
|
+
export declare function unpackToRawClusterData(unpackable: ccc.BytesLike, version: "v1"): ClusterDataV1View;
|
|
31
|
+
export declare function unpackToRawClusterData(unpackable: ccc.BytesLike, version: "v2"): ClusterDataV2View;
|
|
32
|
+
export declare function unpackToRawClusterDataV1(unpackable: ccc.BytesLike): ClusterDataV1View;
|
|
33
|
+
export declare function unpackToRawClusterDataV2(unpackable: ccc.BytesLike): ClusterDataV2View;
|
|
41
34
|
//# sourceMappingURL=cluster.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cluster.d.ts","sourceRoot":"","sources":["../../src/codec/cluster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"cluster.d.ts","sourceRoot":"","sources":["../../src/codec/cluster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAGrD,CAAC;AAEH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAIrD,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C,eAAO,MAAM,WAAW,qDAAgB,CAAC;AAEzC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,eAAe,GAAG,UAAU,CAAC;AAC1E,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,IAAI,GACZ,UAAU,CAAC;AACd,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,IAAI,GACZ,UAAU,CAAC;AAgBd,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,UAAU,CAO5E;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,UAAU,CAQ5E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,GAAG,CAAC,SAAS,GACxB,eAAe,CAAC;AACnB,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,GAAG,CAAC,SAAS,EACzB,OAAO,EAAE,IAAI,GACZ,iBAAiB,CAAC;AACrB,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,GAAG,CAAC,SAAS,EACzB,OAAO,EAAE,IAAI,GACZ,iBAAiB,CAAC;AA0BrB,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,GAAG,CAAC,SAAS,GACxB,iBAAiB,CAEnB;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,GAAG,CAAC,SAAS,GACxB,iBAAiB,CAEnB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ClusterData = exports.ClusterDataV2 = exports.ClusterDataV1 = void 0;
|
|
4
4
|
exports.packRawClusterData = packRawClusterData;
|
|
5
5
|
exports.packRawClusterDataV1 = packRawClusterDataV1;
|
|
6
6
|
exports.packRawClusterDataV2 = packRawClusterDataV2;
|
|
@@ -8,18 +8,16 @@ exports.unpackToRawClusterData = unpackToRawClusterData;
|
|
|
8
8
|
exports.unpackToRawClusterDataV1 = unpackToRawClusterDataV1;
|
|
9
9
|
exports.unpackToRawClusterDataV2 = unpackToRawClusterDataV2;
|
|
10
10
|
const core_1 = require("@ckb-ccc/core");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
mutantId: base_1.blockchain.BytesOpt,
|
|
22
|
-
}, ["name", "description", "mutantId"]);
|
|
11
|
+
exports.ClusterDataV1 = core_1.mol.table({
|
|
12
|
+
name: core_1.mol.String,
|
|
13
|
+
description: core_1.mol.String,
|
|
14
|
+
});
|
|
15
|
+
exports.ClusterDataV2 = core_1.mol.table({
|
|
16
|
+
name: core_1.mol.String,
|
|
17
|
+
description: core_1.mol.String,
|
|
18
|
+
mutantId: core_1.mol.BytesOpt,
|
|
19
|
+
});
|
|
20
|
+
exports.ClusterData = exports.ClusterDataV2;
|
|
23
21
|
function packRawClusterData(packable, version) {
|
|
24
22
|
if (!version) {
|
|
25
23
|
return packRawClusterDataV2(packable);
|
|
@@ -32,17 +30,17 @@ function packRawClusterData(packable, version) {
|
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
function packRawClusterDataV1(packable) {
|
|
35
|
-
return exports.
|
|
33
|
+
return core_1.ccc.bytesFrom(exports.ClusterDataV1.encode({
|
|
36
34
|
name: packable.name,
|
|
37
35
|
description: packable.description,
|
|
38
|
-
});
|
|
36
|
+
}));
|
|
39
37
|
}
|
|
40
38
|
function packRawClusterDataV2(packable) {
|
|
41
|
-
return exports.
|
|
39
|
+
return core_1.ccc.bytesFrom(exports.ClusterDataV2.encode({
|
|
42
40
|
name: packable.name,
|
|
43
41
|
description: packable.description,
|
|
44
42
|
mutantId: packable.mutantId,
|
|
45
|
-
});
|
|
43
|
+
}));
|
|
46
44
|
}
|
|
47
45
|
function unpackToRawClusterData(unpackable, version) {
|
|
48
46
|
if (version) {
|
|
@@ -66,17 +64,8 @@ function unpackToRawClusterData(unpackable, version) {
|
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
function unpackToRawClusterDataV1(unpackable) {
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
name: decoded.name,
|
|
72
|
-
description: decoded.description,
|
|
73
|
-
};
|
|
67
|
+
return exports.ClusterDataV1.decode(unpackable);
|
|
74
68
|
}
|
|
75
69
|
function unpackToRawClusterDataV2(unpackable) {
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
name: decoded.name,
|
|
79
|
-
description: decoded.description,
|
|
80
|
-
mutantId: core_1.ccc.apply(core_1.ccc.hexFrom, decoded.mutantId),
|
|
81
|
-
};
|
|
70
|
+
return exports.ClusterDataV2.decode(unpackable);
|
|
82
71
|
}
|