@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.
Files changed (70) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cluster/index.d.ts +17 -2
  3. package/dist/cluster/index.d.ts.map +1 -1
  4. package/dist/cluster/index.js +40 -1
  5. package/dist/cobuild/index.d.ts +10 -11
  6. package/dist/cobuild/index.d.ts.map +1 -1
  7. package/dist/cobuild/index.js +17 -17
  8. package/dist/codec/cluster.d.ts +17 -24
  9. package/dist/codec/cluster.d.ts.map +1 -1
  10. package/dist/codec/cluster.js +17 -28
  11. package/dist/codec/cobuild/buildingPacket.d.ts +258 -455
  12. package/dist/codec/cobuild/buildingPacket.d.ts.map +1 -1
  13. package/dist/codec/cobuild/buildingPacket.js +27 -38
  14. package/dist/codec/cobuild/sporeAction.d.ts +532 -257
  15. package/dist/codec/cobuild/sporeAction.d.ts.map +1 -1
  16. package/dist/codec/cobuild/sporeAction.js +45 -59
  17. package/dist/codec/cobuild/witnessLayout.d.ts +113 -30
  18. package/dist/codec/cobuild/witnessLayout.d.ts.map +1 -1
  19. package/dist/codec/cobuild/witnessLayout.js +10 -11
  20. package/dist/codec/spore.d.ts +5 -10
  21. package/dist/codec/spore.d.ts.map +1 -1
  22. package/dist/codec/spore.js +9 -17
  23. package/dist/spore/advanced.d.ts +3 -4
  24. package/dist/spore/advanced.d.ts.map +1 -1
  25. package/dist/spore/index.d.ts +20 -2
  26. package/dist/spore/index.d.ts.map +1 -1
  27. package/dist/spore/index.js +44 -1
  28. package/dist.commonjs/cluster/index.d.ts +17 -2
  29. package/dist.commonjs/cluster/index.d.ts.map +1 -1
  30. package/dist.commonjs/cluster/index.js +40 -0
  31. package/dist.commonjs/cobuild/index.d.ts +10 -11
  32. package/dist.commonjs/cobuild/index.d.ts.map +1 -1
  33. package/dist.commonjs/cobuild/index.js +17 -17
  34. package/dist.commonjs/codec/cluster.d.ts +17 -24
  35. package/dist.commonjs/codec/cluster.d.ts.map +1 -1
  36. package/dist.commonjs/codec/cluster.js +17 -28
  37. package/dist.commonjs/codec/cobuild/buildingPacket.d.ts +258 -455
  38. package/dist.commonjs/codec/cobuild/buildingPacket.d.ts.map +1 -1
  39. package/dist.commonjs/codec/cobuild/buildingPacket.js +27 -38
  40. package/dist.commonjs/codec/cobuild/sporeAction.d.ts +532 -257
  41. package/dist.commonjs/codec/cobuild/sporeAction.d.ts.map +1 -1
  42. package/dist.commonjs/codec/cobuild/sporeAction.js +45 -59
  43. package/dist.commonjs/codec/cobuild/witnessLayout.d.ts +113 -30
  44. package/dist.commonjs/codec/cobuild/witnessLayout.d.ts.map +1 -1
  45. package/dist.commonjs/codec/cobuild/witnessLayout.js +10 -11
  46. package/dist.commonjs/codec/spore.d.ts +5 -10
  47. package/dist.commonjs/codec/spore.d.ts.map +1 -1
  48. package/dist.commonjs/codec/spore.js +9 -17
  49. package/dist.commonjs/spore/advanced.d.ts +3 -4
  50. package/dist.commonjs/spore/advanced.d.ts.map +1 -1
  51. package/dist.commonjs/spore/index.d.ts +20 -2
  52. package/dist.commonjs/spore/index.d.ts.map +1 -1
  53. package/dist.commonjs/spore/index.js +44 -0
  54. package/package.json +5 -6
  55. package/src/cluster/index.ts +59 -2
  56. package/src/cobuild/index.ts +27 -28
  57. package/src/codec/cluster.ts +51 -56
  58. package/src/codec/cobuild/buildingPacket.ts +41 -72
  59. package/src/codec/cobuild/sporeAction.ts +75 -129
  60. package/src/codec/cobuild/witnessLayout.ts +12 -18
  61. package/src/codec/spore.ts +18 -27
  62. package/src/spore/advanced.ts +4 -5
  63. package/src/spore/index.ts +58 -2
  64. package/dist/codec/base.d.ts +0 -6
  65. package/dist/codec/base.d.ts.map +0 -1
  66. package/dist/codec/base.js +0 -10
  67. package/dist.commonjs/codec/base.d.ts +0 -6
  68. package/dist.commonjs/codec/base.d.ts.map +0 -1
  69. package/dist.commonjs/codec/base.js +0 -13
  70. 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): UnpackResult<typeof Action>;
5
- export declare function assembleTransferSporeAction(sporeInput: ccc.CellOutputLike, sporeOutput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): UnpackResult<typeof Action>;
6
- export declare function assembleMeltSporeAction(sporeInput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): UnpackResult<typeof Action>;
7
- export declare function assembleCreateClusterAction(clusterOutput: ccc.CellOutputLike, clusterData: ccc.BytesLike, scriptInfoHash?: ccc.HexLike): UnpackResult<typeof Action>;
8
- export declare function assembleTransferClusterAction(clusterInput: ccc.CellOutputLike, clusterOutput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): UnpackResult<typeof Action>;
9
- export declare function prepareSporeTransaction(signer: ccc.Signer, txLike: ccc.TransactionLike, actions: UnpackResult<typeof ActionVec>): Promise<ccc.Transaction>;
10
- export declare function unpackCommonCobuildProof(data: ccc.HexLike): UnpackResult<typeof WitnessLayout> | undefined;
11
- export declare function extractCobuildActionsFromTx(tx: ccc.Transaction): UnpackResult<typeof ActionVec>;
12
- export declare function injectCobuild(tx: ccc.Transaction, actions: UnpackResult<typeof ActionVec>): void;
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,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,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,YAAY,CAAC,OAAO,MAAM,CAAC,CAsB7B;AAED,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,GAAG,CAAC,cAAc,EAC9B,WAAW,EAAE,GAAG,CAAC,cAAc,EAC/B,cAAc,GAAE,GAAG,CAAC,OAAmC,GACtD,YAAY,CAAC,OAAO,MAAM,CAAC,CA0B7B;AAED,wBAAgB,uBAAuB,CACrC,U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2B,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.pack({
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: core_1.ccc.Script.from(sporeOutput.lock),
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.pack({
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: core_1.ccc.Script.from(sporeInput.lock),
50
+ value: sporeInput.lock,
51
51
  },
52
52
  to: {
53
53
  type: "Script",
54
- value: core_1.ccc.Script.from(sporeOutput.lock),
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.pack({
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: core_1.ccc.Script.from(sporeInput.lock),
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.pack({
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: core_1.ccc.Script.from(clusterOutput.lock),
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.pack({
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: core_1.ccc.Script.from(clusterInput.lock),
121
+ value: clusterInput.lock,
122
122
  },
123
123
  to: {
124
124
  type: "Script",
125
- value: core_1.ccc.Script.from(clusterOutput.lock),
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.unpack(core_1.ccc.bytesFrom(data));
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: " + witnessLayout.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.pack({
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
- import { molecule } from "@ckb-lumos/codec";
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 interface ClusterDataV2 {
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 type ClusterData = ClusterDataV2;
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: ClusterData): Uint8Array;
28
- export declare function packRawClusterData(packable: ClusterDataV1, version: "v1"): Uint8Array;
29
- export declare function packRawClusterData(packable: ClusterDataV2, version: "v2"): Uint8Array;
30
- export declare function packRawClusterDataV1(packable: ClusterDataV1): Uint8Array;
31
- export declare function packRawClusterDataV2(packable: ClusterDataV2): Uint8Array;
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): ClusterData;
37
- export declare function unpackToRawClusterData(unpackable: ccc.BytesLike, version: "v1"): ClusterDataV1;
38
- export declare function unpackToRawClusterData(unpackable: ccc.BytesLike, version: "v2"): ClusterDataV2;
39
- export declare function unpackToRawClusterDataV1(unpackable: ccc.BytesLike): ClusterDataV1;
40
- export declare function unpackToRawClusterDataV2(unpackable: ccc.BytesLike): ClusterDataV2;
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;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,eAAO,MAAM,gBAAgB;;;EAM5B,CAAC;AACF,eAAO,MAAM,gBAAgB;;;;EAO5B,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACxB;AACD,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC;AAExC,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,WAAW,GAAG,UAAU,CAAC;AACtE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,IAAI,GACZ,UAAU,CAAC;AACd,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,IAAI,GACZ,UAAU,CAAC;AAgBd,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,GAAG,UAAU,CAKxE;AACD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,GAAG,UAAU,CAMxE;AAED;;;GAGG;AACH,wBAAgB,sBA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AAI,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.MolClusterDataV2 = exports.MolClusterDataV1 = void 0;
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
- const base_1 = require("@ckb-lumos/base");
12
- const codec_1 = require("@ckb-lumos/codec");
13
- const base_js_1 = require("./base.js");
14
- exports.MolClusterDataV1 = codec_1.molecule.table({
15
- name: base_js_1.RawString,
16
- description: base_js_1.RawString,
17
- }, ["name", "description"]);
18
- exports.MolClusterDataV2 = codec_1.molecule.table({
19
- name: base_js_1.RawString,
20
- description: base_js_1.RawString,
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.MolClusterDataV1.pack({
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.MolClusterDataV2.pack({
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
- const decoded = exports.MolClusterDataV1.unpack(unpackable);
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
- const decoded = exports.MolClusterDataV2.unpack(unpackable);
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
  }