@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 +1 @@
1
- {"version":3,"file":"sporeAction.d.ts","sourceRoot":"","sources":["../../../src/codec/cobuild/sporeAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C,eAAO,MAAM,OAAO;;;;;;EAKnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;EAOvB,CAAC;AACF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;EAOzB,CAAC;AACF,eAAO,MAAM,SAAS;;;;;;;;;EAMrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;EAOzB,CAAC;AACF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;EAO3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;EAO9B,CAAC;AACF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;EAQhC,CAAC;AACF,eAAO,MAAM,gBAAgB;;;;;;;;;;EAO5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;EAO9B,CAAC;AACF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;EAOhC,CAAC;AACF,eAAO,MAAM,gBAAgB;;;;;;;;;EAM5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCvB,CAAC"}
1
+ {"version":3,"file":"sporeAction.d.ts","sourceRoot":"","sources":["../../../src/codec/cobuild/sporeAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,eAAO,MAAM,OAAO;;;;;;EAElB,CAAC;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});
3
3
  exports.SporeAction = exports.MeltClusterAgent = exports.TransferClusterAgent = exports.CreateClusterAgent = exports.MeltClusterProxy = exports.TransferClusterProxy = exports.CreateClusterProxy = exports.TransferCluster = exports.CreateCluster = exports.MeltSpore = exports.TransferSpore = exports.CreateSpore = exports.Address = void 0;
4
- const base_1 = require("@ckb-lumos/base");
5
- const codec_1 = require("@ckb-lumos/codec");
6
- const Hash = base_1.blockchain.Byte32;
7
- exports.Address = codec_1.molecule.union({
8
- Script: base_1.blockchain.Script,
9
- }, ["Script"]);
4
+ const core_1 = require("@ckb-ccc/core");
5
+ exports.Address = core_1.mol.union({
6
+ Script: core_1.mol.Script,
7
+ });
10
8
  /**
11
9
  * Spore
12
10
  */
13
- exports.CreateSpore = codec_1.molecule.table({
14
- sporeId: Hash,
11
+ exports.CreateSpore = core_1.mol.table({
12
+ sporeId: core_1.mol.Hash,
15
13
  to: exports.Address,
16
- dataHash: Hash,
17
- }, ["sporeId", "to", "dataHash"]);
18
- exports.TransferSpore = codec_1.molecule.table({
19
- sporeId: Hash,
14
+ dataHash: core_1.mol.Hash,
15
+ });
16
+ exports.TransferSpore = core_1.mol.table({
17
+ sporeId: core_1.mol.Hash,
20
18
  from: exports.Address,
21
19
  to: exports.Address,
22
- }, ["sporeId", "from", "to"]);
23
- exports.MeltSpore = codec_1.molecule.table({
24
- sporeId: Hash,
20
+ });
21
+ exports.MeltSpore = core_1.mol.table({
22
+ sporeId: core_1.mol.Hash,
25
23
  from: exports.Address,
26
- }, ["sporeId", "from"]);
24
+ });
27
25
  /**
28
26
  * Cluster
29
27
  */
30
- exports.CreateCluster = codec_1.molecule.table({
31
- clusterId: Hash,
28
+ exports.CreateCluster = core_1.mol.table({
29
+ clusterId: core_1.mol.Hash,
32
30
  to: exports.Address,
33
- dataHash: Hash,
34
- }, ["clusterId", "to", "dataHash"]);
35
- exports.TransferCluster = codec_1.molecule.table({
36
- clusterId: Hash,
31
+ dataHash: core_1.mol.Hash,
32
+ });
33
+ exports.TransferCluster = core_1.mol.table({
34
+ clusterId: core_1.mol.Hash,
37
35
  from: exports.Address,
38
36
  to: exports.Address,
39
- }, ["clusterId", "from", "to"]);
37
+ });
40
38
  /**
41
39
  * ClusterProxy
42
40
  */
43
- exports.CreateClusterProxy = codec_1.molecule.table({
44
- clusterId: Hash,
45
- clusterProxyId: Hash,
41
+ exports.CreateClusterProxy = core_1.mol.table({
42
+ clusterId: core_1.mol.Hash,
43
+ clusterProxyId: core_1.mol.Hash,
46
44
  to: exports.Address,
47
- }, ["clusterId", "clusterProxyId", "to"]);
48
- exports.TransferClusterProxy = codec_1.molecule.table({
49
- clusterId: Hash,
50
- clusterProxyId: Hash,
45
+ });
46
+ exports.TransferClusterProxy = core_1.mol.table({
47
+ clusterId: core_1.mol.Hash,
48
+ clusterProxyId: core_1.mol.Hash,
51
49
  from: exports.Address,
52
50
  to: exports.Address,
53
- }, ["clusterId", "clusterProxyId", "from", "to"]);
54
- exports.MeltClusterProxy = codec_1.molecule.table({
55
- clusterId: Hash,
56
- clusterProxyId: Hash,
51
+ });
52
+ exports.MeltClusterProxy = core_1.mol.table({
53
+ clusterId: core_1.mol.Hash,
54
+ clusterProxyId: core_1.mol.Hash,
57
55
  from: exports.Address,
58
- }, ["clusterId", "clusterProxyId", "from"]);
56
+ });
59
57
  /**
60
58
  * ClusterAgent
61
59
  */
62
- exports.CreateClusterAgent = codec_1.molecule.table({
63
- clusterId: Hash,
64
- clusterProxyId: Hash,
60
+ exports.CreateClusterAgent = core_1.mol.table({
61
+ clusterId: core_1.mol.Hash,
62
+ clusterProxyId: core_1.mol.Hash,
65
63
  to: exports.Address,
66
- }, ["clusterId", "clusterProxyId", "to"]);
67
- exports.TransferClusterAgent = codec_1.molecule.table({
68
- clusterId: Hash,
64
+ });
65
+ exports.TransferClusterAgent = core_1.mol.table({
66
+ clusterId: core_1.mol.Hash,
69
67
  from: exports.Address,
70
68
  to: exports.Address,
71
- }, ["clusterId", "from", "to"]);
72
- exports.MeltClusterAgent = codec_1.molecule.table({
73
- clusterId: Hash,
69
+ });
70
+ exports.MeltClusterAgent = core_1.mol.table({
71
+ clusterId: core_1.mol.Hash,
74
72
  from: exports.Address,
75
- }, ["clusterId", "from"]);
73
+ });
76
74
  /**
77
75
  * Spore ScriptInfo Actions
78
76
  */
79
- exports.SporeAction = codec_1.molecule.union({
77
+ exports.SporeAction = core_1.mol.union({
80
78
  // Spore
81
79
  CreateSpore: exports.CreateSpore,
82
80
  TransferSpore: exports.TransferSpore,
@@ -92,16 +90,4 @@ exports.SporeAction = codec_1.molecule.union({
92
90
  CreateClusterAgent: exports.CreateClusterAgent,
93
91
  TransferClusterAgent: exports.TransferClusterAgent,
94
92
  MeltClusterAgent: exports.MeltClusterAgent,
95
- }, [
96
- "CreateSpore",
97
- "TransferSpore",
98
- "MeltSpore",
99
- "CreateCluster",
100
- "TransferCluster",
101
- "CreateClusterProxy",
102
- "TransferClusterProxy",
103
- "MeltClusterProxy",
104
- "CreateClusterAgent",
105
- "TransferClusterAgent",
106
- "MeltClusterAgent",
107
- ]);
93
+ });
@@ -1,43 +1,126 @@
1
- import { molecule } from "@ckb-lumos/codec";
2
- export declare const SighashAll: molecule.ObjectLayoutCodec<{
3
- seal: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
4
- message: molecule.ObjectLayoutCodec<{
5
- actions: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
6
- scriptInfoHash: import("@ckb-lumos/codec/lib/base.js").FixedBytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
7
- scriptHash: import("@ckb-lumos/codec/lib/base.js").FixedBytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
8
- data: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
9
- }>>;
10
- }>;
11
- }>;
12
- export declare const SighashAllOnly: molecule.ObjectLayoutCodec<{
13
- seal: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
14
- }>;
1
+ import { mol } from "@ckb-ccc/core";
2
+ export declare const SighashAll: mol.Codec<mol.EncodableRecord<{
3
+ seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
4
+ message: mol.Codec<mol.EncodableRecord<{
5
+ actions: mol.Codec<mol.EncodableRecord<{
6
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
7
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
8
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
9
+ }>[], mol.DecodedRecord<{
10
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
11
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
12
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
13
+ }>[]>;
14
+ }>, mol.DecodedRecord<{
15
+ actions: mol.Codec<mol.EncodableRecord<{
16
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
17
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
18
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
19
+ }>[], mol.DecodedRecord<{
20
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
21
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
22
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
23
+ }>[]>;
24
+ }>>;
25
+ }>, mol.DecodedRecord<{
26
+ seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
27
+ message: mol.Codec<mol.EncodableRecord<{
28
+ actions: mol.Codec<mol.EncodableRecord<{
29
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
30
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
31
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
32
+ }>[], mol.DecodedRecord<{
33
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
34
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
35
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
36
+ }>[]>;
37
+ }>, mol.DecodedRecord<{
38
+ actions: mol.Codec<mol.EncodableRecord<{
39
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
40
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
41
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
42
+ }>[], mol.DecodedRecord<{
43
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
44
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
45
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
46
+ }>[]>;
47
+ }>>;
48
+ }>>;
49
+ export declare const SighashAllOnly: mol.Codec<mol.EncodableRecord<{
50
+ seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
51
+ }>, mol.DecodedRecord<{
52
+ seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
53
+ }>>;
15
54
  /**
16
55
  * Otx related are not implemented yet, so just placeholders.
17
56
  */
18
- export declare const Otx: molecule.ObjectLayoutCodec<{}>;
19
- export declare const OtxStart: molecule.ObjectLayoutCodec<{}>;
57
+ export declare const Otx: mol.Codec<mol.EncodableRecord<{}>, mol.DecodedRecord<{}>>;
58
+ export declare const OtxStart: mol.Codec<mol.EncodableRecord<{}>, mol.DecodedRecord<{}>>;
20
59
  export declare const WitnessLayoutFieldTags: {
21
60
  readonly SighashAll: 4278190081;
22
61
  readonly SighashAllOnly: 4278190082;
23
62
  readonly Otx: 4278190083;
24
63
  readonly OtxStart: 4278190084;
25
64
  };
26
- export declare const WitnessLayout: molecule.UnionLayoutCodec<{
27
- SighashAll: molecule.ObjectLayoutCodec<{
28
- seal: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
29
- message: molecule.ObjectLayoutCodec<{
30
- actions: molecule.ArrayLayoutCodec<molecule.ObjectLayoutCodec<{
31
- scriptInfoHash: import("@ckb-lumos/codec/lib/base.js").FixedBytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
32
- scriptHash: import("@ckb-lumos/codec/lib/base.js").FixedBytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
33
- data: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
34
- }>>;
35
- }>;
65
+ export declare const WitnessLayout: mol.Codec<{
66
+ type: "SighashAll";
67
+ value: {} & {
68
+ message: {} & {
69
+ actions: mol.EncodableRecord<{
70
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
71
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
72
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
73
+ }>[];
74
+ };
75
+ seal: import("@ckb-ccc/core").BytesLike;
76
+ };
77
+ } | {
78
+ type: "SighashAllOnly";
79
+ value: {} & {
80
+ seal: import("@ckb-ccc/core").BytesLike;
81
+ };
82
+ } | {
83
+ type: "Otx";
84
+ value: {} & {};
85
+ } | {
86
+ type: "OtxStart";
87
+ value: {} & {};
88
+ }, {
89
+ type: "SighashAll";
90
+ value: mol.DecodedRecord<{
91
+ seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
92
+ message: mol.Codec<mol.EncodableRecord<{
93
+ actions: mol.Codec<mol.EncodableRecord<{
94
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
95
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
96
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
97
+ }>[], mol.DecodedRecord<{
98
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
99
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
100
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
101
+ }>[]>;
102
+ }>, mol.DecodedRecord<{
103
+ actions: mol.Codec<mol.EncodableRecord<{
104
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
105
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
106
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
107
+ }>[], mol.DecodedRecord<{
108
+ scriptInfoHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
109
+ scriptHash: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
110
+ data: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
111
+ }>[]>;
112
+ }>>;
36
113
  }>;
37
- SighashAllOnly: molecule.ObjectLayoutCodec<{
38
- seal: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
114
+ } | {
115
+ type: "SighashAllOnly";
116
+ value: mol.DecodedRecord<{
117
+ seal: mol.Codec<import("@ckb-ccc/core").BytesLike, `0x${string}`>;
39
118
  }>;
40
- Otx: molecule.ObjectLayoutCodec<{}>;
41
- OtxStart: molecule.ObjectLayoutCodec<{}>;
119
+ } | {
120
+ type: "Otx";
121
+ value: mol.DecodedRecord<{}>;
122
+ } | {
123
+ type: "OtxStart";
124
+ value: mol.DecodedRecord<{}>;
42
125
  }>;
43
126
  //# sourceMappingURL=witnessLayout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"witnessLayout.d.ts","sourceRoot":"","sources":["../../../src/codec/cobuild/witnessLayout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,eAAO,MAAM,UAAU;;;;;;;;;EAMtB,CAAC;AACF,eAAO,MAAM,cAAc;;EAK1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,GAAG,gCAAyB,CAAC;AAC1C,eAAO,MAAM,QAAQ,gCAAyB,CAAC;AAE/C,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;EAQzB,CAAC"}
1
+ {"version":3,"file":"witnessLayout.d.ts","sourceRoot":"","sources":["../../../src/codec/cobuild/witnessLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGrB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;GAEzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,GAAG,2DAAgB,CAAC;AACjC,eAAO,MAAM,QAAQ,2DAAgB,CAAC;AAEtC,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQzB,CAAC"}
@@ -1,28 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WitnessLayout = exports.WitnessLayoutFieldTags = exports.OtxStart = exports.Otx = exports.SighashAllOnly = exports.SighashAll = void 0;
4
- const base_1 = require("@ckb-lumos/base");
5
- const codec_1 = require("@ckb-lumos/codec");
4
+ const core_1 = require("@ckb-ccc/core");
6
5
  const buildingPacket_js_1 = require("./buildingPacket.js");
7
- exports.SighashAll = codec_1.molecule.table({
8
- seal: base_1.blockchain.Bytes,
6
+ exports.SighashAll = core_1.mol.table({
7
+ seal: core_1.mol.Bytes,
9
8
  message: buildingPacket_js_1.Message,
10
- }, ["seal", "message"]);
11
- exports.SighashAllOnly = codec_1.molecule.table({
12
- seal: base_1.blockchain.Bytes,
13
- }, ["seal"]);
9
+ });
10
+ exports.SighashAllOnly = core_1.mol.table({
11
+ seal: core_1.mol.Bytes,
12
+ });
14
13
  /**
15
14
  * Otx related are not implemented yet, so just placeholders.
16
15
  */
17
- exports.Otx = codec_1.molecule.table({}, []);
18
- exports.OtxStart = codec_1.molecule.table({}, []);
16
+ exports.Otx = core_1.mol.table({});
17
+ exports.OtxStart = core_1.mol.table({});
19
18
  exports.WitnessLayoutFieldTags = {
20
19
  SighashAll: 4278190081,
21
20
  SighashAllOnly: 4278190082,
22
21
  Otx: 4278190083,
23
22
  OtxStart: 4278190084,
24
23
  };
25
- exports.WitnessLayout = codec_1.molecule.union({
24
+ exports.WitnessLayout = core_1.mol.union({
26
25
  SighashAll: exports.SighashAll,
27
26
  SighashAllOnly: exports.SighashAllOnly,
28
27
  Otx: exports.Otx,
@@ -1,15 +1,10 @@
1
- import { ccc } from "@ckb-ccc/core";
2
- import { molecule } from "@ckb-lumos/codec";
3
- export declare const MolSporeData: molecule.ObjectLayoutCodec<{
4
- contentType: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, string>;
5
- content: import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, import("@ckb-lumos/codec").BytesLike>;
6
- clusterId: molecule.OptionLayoutCodec<import("@ckb-lumos/codec/lib/base.js").BytesCodec<string, import("@ckb-lumos/codec").BytesLike>>;
7
- }>;
8
- export interface SporeData {
1
+ import { ccc, mol } from "@ckb-ccc/core";
2
+ export interface SporeDataView {
9
3
  contentType: string;
10
4
  content: ccc.BytesLike;
11
5
  clusterId?: ccc.HexLike;
12
6
  }
13
- export declare function packRawSporeData(packable: SporeData): Uint8Array;
14
- export declare function unpackToRawSporeData(unpackable: ccc.BytesLike): SporeData;
7
+ export declare const SporeData: mol.Codec<SporeDataView>;
8
+ export declare function packRawSporeData(packable: SporeDataView): Uint8Array;
9
+ export declare function unpackToRawSporeData(unpackable: ccc.BytesLike): SporeDataView;
15
10
  //# sourceMappingURL=spore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spore.d.ts","sourceRoot":"","sources":["../../src/codec/spore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,eAAO,MAAM,YAAY;;;;EAOxB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,GAAG,CAAC,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACzB;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,GAAG,UAAU,CAMhE;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,GAAG,SAAS,CAOzE"}
1
+ {"version":3,"file":"spore.d.ts","sourceRoot":"","sources":["../../src/codec/spore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,GAAG,CAAC,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,SAAS,EAAE,GAAG,CAAC,KAAK,CAAC,aAAa,CAI7C,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,UAAU,CAQpE;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,GAAG,aAAa,CAE7E"}
@@ -1,29 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MolSporeData = void 0;
3
+ exports.SporeData = void 0;
4
4
  exports.packRawSporeData = packRawSporeData;
5
5
  exports.unpackToRawSporeData = unpackToRawSporeData;
6
6
  const core_1 = require("@ckb-ccc/core");
7
- const base_1 = require("@ckb-lumos/base");
8
- const codec_1 = require("@ckb-lumos/codec");
9
- const base_js_1 = require("./base.js");
10
- exports.MolSporeData = codec_1.molecule.table({
11
- contentType: base_js_1.RawString,
12
- content: base_1.blockchain.Bytes,
13
- clusterId: base_1.blockchain.BytesOpt,
14
- }, ["contentType", "content", "clusterId"]);
7
+ exports.SporeData = core_1.mol.table({
8
+ contentType: core_1.mol.String,
9
+ content: core_1.mol.Bytes,
10
+ clusterId: core_1.mol.BytesOpt,
11
+ });
15
12
  function packRawSporeData(packable) {
16
- return exports.MolSporeData.pack({
13
+ return core_1.ccc.bytesFrom(exports.SporeData.encode({
17
14
  contentType: packable.contentType,
18
15
  content: packable.content,
19
16
  clusterId: packable.clusterId,
20
- });
17
+ }));
21
18
  }
22
19
  function unpackToRawSporeData(unpackable) {
23
- const unpacked = exports.MolSporeData.unpack(unpackable);
24
- return {
25
- contentType: unpacked.contentType,
26
- content: unpacked.content,
27
- clusterId: core_1.ccc.apply(core_1.ccc.hexFrom, unpacked.clusterId),
28
- };
20
+ return exports.SporeData.decode(unpackable);
29
21
  }
@@ -1,5 +1,4 @@
1
- import { ccc } from "@ckb-ccc/core";
2
- import { UnpackResult } from "@ckb-lumos/codec";
3
- import { Action, SporeData } from "../codec/index.js";
4
- export declare function prepareCluster(signer: ccc.Signer, tx: ccc.Transaction, data: SporeData, clusterMode?: "lockProxy" | "clusterCell" | "skip", scriptInfoHash?: ccc.HexLike): Promise<UnpackResult<typeof Action> | undefined>;
1
+ import { ccc, mol } from "@ckb-ccc/core";
2
+ import { Action, SporeDataView } from "../codec/index.js";
3
+ export declare function prepareCluster(signer: ccc.Signer, tx: ccc.Transaction, data: SporeDataView, clusterMode?: "lockProxy" | "clusterCell" | "skip", scriptInfoHash?: ccc.HexLike): Promise<mol.EncodableType<typeof Action> | undefined>;
5
4
  //# sourceMappingURL=advanced.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../src/spore/advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGtD,wBAAsB,cAAc,CAClC,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,EAAE,EAAE,GAAG,CAAC,WAAW,EACnB,IAAI,EAAE,SAAS,EACf,WAAW,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,MAAM,EAClD,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,GAC3B,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,GAAG,SAAS,CAAC,CA0ElD"}
1
+ {"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../src/spore/advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG1D,wBAAsB,cAAc,CAClC,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,EAAE,EAAE,GAAG,CAAC,WAAW,EACnB,IAAI,EAAE,aAAa,EACnB,WAAW,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,MAAM,EAClD,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,GAC3B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,MAAM,CAAC,GAAG,SAAS,CAAC,CA0EvD"}
@@ -1,5 +1,5 @@
1
1
  import { ccc } from "@ckb-ccc/core";
2
- import { SporeData } from "../codec/index.js";
2
+ import { SporeDataView } from "../codec/index.js";
3
3
  import { SporeScriptInfo, SporeScriptInfoLike } from "../predefined/index.js";
4
4
  export declare function findSpore(client: ccc.Client, args: ccc.HexLike, scripts?: SporeScriptInfoLike[]): Promise<{
5
5
  cell: ccc.Cell;
@@ -29,7 +29,7 @@ export declare function assertSpore(client: ccc.Client, args: ccc.HexLike, scrip
29
29
  */
30
30
  export declare function createSpore(params: {
31
31
  signer: ccc.Signer;
32
- data: SporeData;
32
+ data: SporeDataView;
33
33
  to?: ccc.ScriptLike;
34
34
  clusterMode?: "lockProxy" | "clusterCell" | "skip";
35
35
  tx?: ccc.TransactionLike;
@@ -77,4 +77,22 @@ export declare function meltSpore(params: {
77
77
  }): Promise<{
78
78
  tx: ccc.Transaction;
79
79
  }>;
80
+ /**
81
+ * Search on-chain spores under the signer's control, if cluster provided, filter spores belonging to this cluster
82
+ *
83
+ * @param signer the owner of spores
84
+ * @param order the order in creation time of spores
85
+ * @param clusterId the cluster that spores belong to
86
+ * @param scriptInfos the deployed script infos of spores
87
+ * @returns speific spore cells
88
+ */
89
+ export declare function findSporesBySigner(params: {
90
+ signer: ccc.Signer;
91
+ order?: "asc" | "desc";
92
+ clusterId?: ccc.HexLike;
93
+ scriptInfos?: SporeScriptInfoLike[];
94
+ }): AsyncGenerator<{
95
+ spore: ccc.Cell;
96
+ sporeData: SporeDataView;
97
+ }>;
80
98
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spore/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,EAAE,SAAS,EAAoB,MAAM,mBAAmB,CAAC;AAKhE,OAAO,EACL,eAAe,EACf,mBAAmB,EAGpB,MAAM,wBAAwB,CAAC;AAGhC,wBAAsB,SAAS,CAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,IA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,CAAC;IACvB,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACrC,GAAG,cAAc,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC,CAqCD"}
@@ -5,6 +5,7 @@ exports.assertSpore = assertSpore;
5
5
  exports.createSpore = createSpore;
6
6
  exports.transferSpore = transferSpore;
7
7
  exports.meltSpore = meltSpore;
8
+ exports.findSporesBySigner = findSporesBySigner;
8
9
  const core_1 = require("@ckb-ccc/core");
9
10
  const advanced_js_1 = require("../advanced.js");
10
11
  const index_js_1 = require("../codec/index.js");
@@ -140,3 +141,46 @@ async function meltSpore(params) {
140
141
  tx: await (0, advanced_js_1.prepareSporeTransaction)(signer, tx, actions),
141
142
  };
142
143
  }
144
+ /**
145
+ * Search on-chain spores under the signer's control, if cluster provided, filter spores belonging to this cluster
146
+ *
147
+ * @param signer the owner of spores
148
+ * @param order the order in creation time of spores
149
+ * @param clusterId the cluster that spores belong to
150
+ * @param scriptInfos the deployed script infos of spores
151
+ * @returns speific spore cells
152
+ */
153
+ async function* findSporesBySigner(params) {
154
+ const { signer, clusterId, scriptInfos, order } = params;
155
+ for (const scriptInfo of scriptInfos ??
156
+ Object.values((0, index_js_3.getSporeScriptInfos)(signer.client))) {
157
+ if (!scriptInfo) {
158
+ continue;
159
+ }
160
+ for await (const spore of signer.findCells({
161
+ script: {
162
+ ...scriptInfo,
163
+ args: [],
164
+ },
165
+ }, true, order, 10)) {
166
+ try {
167
+ const sporeData = index_js_1.SporeData.decode(spore.outputData);
168
+ if (!clusterId) {
169
+ yield {
170
+ spore,
171
+ sporeData,
172
+ };
173
+ }
174
+ if (sporeData.clusterId === clusterId) {
175
+ return {
176
+ spore,
177
+ sporeData,
178
+ };
179
+ }
180
+ }
181
+ catch (e) {
182
+ throw new Error(`Spore data decode failed: ${e.toString()}`);
183
+ }
184
+ }
185
+ }
186
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckb-ccc/spore",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0",
4
4
  "description": "CCC - CKBer's Codebase. Common Chains Connector's support for Spore protocol",
5
5
  "author": "ashuralyk <ashuralyk@live.com>",
6
6
  "license": "MIT",
@@ -24,7 +24,9 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@eslint/js": "^9.1.1",
27
+ "@types/node": "^22.10.0",
27
28
  "copyfiles": "^2.4.1",
29
+ "dotenv": "^16.4.5",
28
30
  "eslint": "^9.1.0",
29
31
  "eslint-config-prettier": "^9.1.0",
30
32
  "eslint-plugin-prettier": "^5.1.3",
@@ -32,17 +34,14 @@
32
34
  "prettier-plugin-organize-imports": "^3.2.4",
33
35
  "rimraf": "^5.0.5",
34
36
  "typescript": "^5.4.5",
35
- "typescript-eslint": "^7.7.0",
36
- "dotenv": "^16.4.5"
37
+ "typescript-eslint": "^7.7.0"
37
38
  },
38
39
  "publishConfig": {
39
40
  "access": "public"
40
41
  },
41
42
  "dependencies": {
42
- "@ckb-lumos/base": "^0.24.0-next.1",
43
- "@ckb-lumos/codec": "^0.24.0-next.1",
44
43
  "axios": "^1.7.7",
45
- "@ckb-ccc/core": "0.1.0-alpha.6"
44
+ "@ckb-ccc/core": "0.1.0"
46
45
  },
47
46
  "scripts": {
48
47
  "build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",