@ckb-ccc/spore 1.5.18 → 1.6.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.
Files changed (221) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/advanced.d.mts +3 -0
  3. package/dist/advanced.mjs +1 -0
  4. package/dist/advancedBarrel.d.mts +30 -0
  5. package/dist/advancedBarrel.d.mts.map +1 -0
  6. package/dist/advancedBarrel.mjs +1 -0
  7. package/dist/barrel-C4fV1nUf.mjs +2 -0
  8. package/dist/barrel-C4fV1nUf.mjs.map +1 -0
  9. package/dist/barrel-Cqgd-hM0.d.mts +324 -0
  10. package/dist/barrel-Cqgd-hM0.d.mts.map +1 -0
  11. package/dist/barrel.d.mts +3 -0
  12. package/dist/barrel.mjs +1 -0
  13. package/dist/cluster-KsFIhwZx.mjs +2 -0
  14. package/dist/cluster-KsFIhwZx.mjs.map +1 -0
  15. package/dist/index.d.mts +3 -0
  16. package/dist/index.mjs +1 -0
  17. package/dist/rolldown-runtime-DK3Fl9T5.mjs +1 -0
  18. package/dist/types-DRzFzVRX.d.mts +1048 -0
  19. package/dist/types-DRzFzVRX.d.mts.map +1 -0
  20. package/dist.commonjs/advanced.d.ts +3 -3
  21. package/dist.commonjs/advanced.js +1 -41
  22. package/dist.commonjs/advancedBarrel.d.ts +29 -4
  23. package/dist.commonjs/advancedBarrel.d.ts.map +1 -1
  24. package/dist.commonjs/advancedBarrel.js +1 -20
  25. package/dist.commonjs/barrel-Dj4BYAYE.d.ts +324 -0
  26. package/dist.commonjs/barrel-Dj4BYAYE.d.ts.map +1 -0
  27. package/dist.commonjs/barrel-Dj_LwfvL.js +2 -0
  28. package/dist.commonjs/barrel-Dj_LwfvL.js.map +1 -0
  29. package/dist.commonjs/barrel.d.ts +3 -5
  30. package/dist.commonjs/barrel.js +1 -43
  31. package/dist.commonjs/cluster-CGo0DCM9.js +2 -0
  32. package/dist.commonjs/cluster-CGo0DCM9.js.map +1 -0
  33. package/dist.commonjs/index.d.ts +3 -3
  34. package/dist.commonjs/index.js +1 -41
  35. package/dist.commonjs/types-C1N7Mdzo.d.ts +1050 -0
  36. package/dist.commonjs/types-C1N7Mdzo.d.ts.map +1 -0
  37. package/package.json +30 -33
  38. package/tsdown.config.mts +43 -0
  39. package/dist/advanced.d.ts +0 -3
  40. package/dist/advanced.d.ts.map +0 -1
  41. package/dist/advanced.js +0 -2
  42. package/dist/advancedBarrel.d.ts +0 -5
  43. package/dist/advancedBarrel.d.ts.map +0 -1
  44. package/dist/advancedBarrel.js +0 -4
  45. package/dist/barrel.d.ts +0 -5
  46. package/dist/barrel.d.ts.map +0 -1
  47. package/dist/barrel.js +0 -4
  48. package/dist/cluster/index.d.ts +0 -95
  49. package/dist/cluster/index.d.ts.map +0 -1
  50. package/dist/cluster/index.js +0 -165
  51. package/dist/cobuild/index.d.ts +0 -12
  52. package/dist/cobuild/index.d.ts.map +0 -1
  53. package/dist/cobuild/index.js +0 -167
  54. package/dist/codec/cluster.d.ts +0 -34
  55. package/dist/codec/cluster.d.ts.map +0 -1
  56. package/dist/codec/cluster.js +0 -62
  57. package/dist/codec/cobuild/buildingPacket.d.ts +0 -268
  58. package/dist/codec/cobuild/buildingPacket.d.ts.map +0 -1
  59. package/dist/codec/cobuild/buildingPacket.js +0 -33
  60. package/dist/codec/cobuild/index.d.ts +0 -4
  61. package/dist/codec/cobuild/index.d.ts.map +0 -1
  62. package/dist/codec/cobuild/index.js +0 -3
  63. package/dist/codec/cobuild/sporeAction.d.ts +0 -589
  64. package/dist/codec/cobuild/sporeAction.d.ts.map +0 -1
  65. package/dist/codec/cobuild/sporeAction.js +0 -90
  66. package/dist/codec/cobuild/witnessLayout.d.ts +0 -126
  67. package/dist/codec/cobuild/witnessLayout.d.ts.map +0 -1
  68. package/dist/codec/cobuild/witnessLayout.js +0 -26
  69. package/dist/codec/index.d.ts +0 -4
  70. package/dist/codec/index.d.ts.map +0 -1
  71. package/dist/codec/index.js +0 -3
  72. package/dist/codec/spore.d.ts +0 -10
  73. package/dist/codec/spore.d.ts.map +0 -1
  74. package/dist/codec/spore.js +0 -16
  75. package/dist/dob/api/decode.d.ts +0 -8
  76. package/dist/dob/api/decode.d.ts.map +0 -1
  77. package/dist/dob/api/decode.js +0 -63
  78. package/dist/dob/api/encode.d.ts +0 -5
  79. package/dist/dob/api/encode.d.ts.map +0 -1
  80. package/dist/dob/api/encode.js +0 -81
  81. package/dist/dob/api/index.d.ts +0 -3
  82. package/dist/dob/api/index.d.ts.map +0 -1
  83. package/dist/dob/api/index.js +0 -2
  84. package/dist/dob/config/index.d.ts +0 -2
  85. package/dist/dob/config/index.d.ts.map +0 -1
  86. package/dist/dob/config/index.js +0 -1
  87. package/dist/dob/config/predefined.d.ts +0 -8
  88. package/dist/dob/config/predefined.d.ts.map +0 -1
  89. package/dist/dob/config/predefined.js +0 -59
  90. package/dist/dob/helper/check.d.ts +0 -5
  91. package/dist/dob/helper/check.d.ts.map +0 -1
  92. package/dist/dob/helper/check.js +0 -75
  93. package/dist/dob/helper/error.d.ts +0 -2
  94. package/dist/dob/helper/error.d.ts.map +0 -1
  95. package/dist/dob/helper/error.js +0 -40
  96. package/dist/dob/helper/index.d.ts +0 -4
  97. package/dist/dob/helper/index.d.ts.map +0 -1
  98. package/dist/dob/helper/index.js +0 -3
  99. package/dist/dob/helper/object.d.ts +0 -59
  100. package/dist/dob/helper/object.d.ts.map +0 -1
  101. package/dist/dob/helper/object.js +0 -1
  102. package/dist/dob/index.d.ts +0 -4
  103. package/dist/dob/index.d.ts.map +0 -1
  104. package/dist/dob/index.js +0 -3
  105. package/dist/helper/index.d.ts +0 -7
  106. package/dist/helper/index.d.ts.map +0 -1
  107. package/dist/helper/index.js +0 -18
  108. package/dist/index.d.ts +0 -3
  109. package/dist/index.d.ts.map +0 -1
  110. package/dist/index.js +0 -2
  111. package/dist/predefined/advanced.d.ts +0 -3
  112. package/dist/predefined/advanced.d.ts.map +0 -1
  113. package/dist/predefined/advanced.js +0 -2
  114. package/dist/predefined/index.d.ts +0 -3
  115. package/dist/predefined/index.d.ts.map +0 -1
  116. package/dist/predefined/index.js +0 -2
  117. package/dist/predefined/mainnet.advanced.d.ts +0 -4
  118. package/dist/predefined/mainnet.advanced.d.ts.map +0 -1
  119. package/dist/predefined/mainnet.advanced.js +0 -61
  120. package/dist/predefined/testnet.advanced.d.ts +0 -4
  121. package/dist/predefined/testnet.advanced.d.ts.map +0 -1
  122. package/dist/predefined/testnet.advanced.js +0 -88
  123. package/dist/predefined/types.d.ts +0 -17
  124. package/dist/predefined/types.d.ts.map +0 -1
  125. package/dist/predefined/types.js +0 -18
  126. package/dist/predefined/utils.d.ts +0 -7
  127. package/dist/predefined/utils.d.ts.map +0 -1
  128. package/dist/predefined/utils.js +0 -26
  129. package/dist/spore/advanced.d.ts +0 -4
  130. package/dist/spore/advanced.d.ts.map +0 -1
  131. package/dist/spore/advanced.js +0 -54
  132. package/dist/spore/index.d.ts +0 -129
  133. package/dist/spore/index.d.ts.map +0 -1
  134. package/dist/spore/index.js +0 -218
  135. package/dist.commonjs/advanced.d.ts.map +0 -1
  136. package/dist.commonjs/barrel.d.ts.map +0 -1
  137. package/dist.commonjs/cluster/index.d.ts +0 -95
  138. package/dist.commonjs/cluster/index.d.ts.map +0 -1
  139. package/dist.commonjs/cluster/index.js +0 -173
  140. package/dist.commonjs/cobuild/index.d.ts +0 -12
  141. package/dist.commonjs/cobuild/index.d.ts.map +0 -1
  142. package/dist.commonjs/cobuild/index.js +0 -178
  143. package/dist.commonjs/codec/cluster.d.ts +0 -34
  144. package/dist.commonjs/codec/cluster.d.ts.map +0 -1
  145. package/dist.commonjs/codec/cluster.js +0 -71
  146. package/dist.commonjs/codec/cobuild/buildingPacket.d.ts +0 -268
  147. package/dist.commonjs/codec/cobuild/buildingPacket.d.ts.map +0 -1
  148. package/dist.commonjs/codec/cobuild/buildingPacket.js +0 -36
  149. package/dist.commonjs/codec/cobuild/index.d.ts +0 -4
  150. package/dist.commonjs/codec/cobuild/index.d.ts.map +0 -1
  151. package/dist.commonjs/codec/cobuild/index.js +0 -19
  152. package/dist.commonjs/codec/cobuild/sporeAction.d.ts +0 -589
  153. package/dist.commonjs/codec/cobuild/sporeAction.d.ts.map +0 -1
  154. package/dist.commonjs/codec/cobuild/sporeAction.js +0 -93
  155. package/dist.commonjs/codec/cobuild/witnessLayout.d.ts +0 -126
  156. package/dist.commonjs/codec/cobuild/witnessLayout.d.ts.map +0 -1
  157. package/dist.commonjs/codec/cobuild/witnessLayout.js +0 -29
  158. package/dist.commonjs/codec/index.d.ts +0 -4
  159. package/dist.commonjs/codec/index.d.ts.map +0 -1
  160. package/dist.commonjs/codec/index.js +0 -19
  161. package/dist.commonjs/codec/spore.d.ts +0 -10
  162. package/dist.commonjs/codec/spore.d.ts.map +0 -1
  163. package/dist.commonjs/codec/spore.js +0 -21
  164. package/dist.commonjs/dob/api/decode.d.ts +0 -8
  165. package/dist.commonjs/dob/api/decode.d.ts.map +0 -1
  166. package/dist.commonjs/dob/api/decode.js +0 -70
  167. package/dist.commonjs/dob/api/encode.d.ts +0 -5
  168. package/dist.commonjs/dob/api/encode.d.ts.map +0 -1
  169. package/dist.commonjs/dob/api/encode.js +0 -86
  170. package/dist.commonjs/dob/api/index.d.ts +0 -3
  171. package/dist.commonjs/dob/api/index.d.ts.map +0 -1
  172. package/dist.commonjs/dob/api/index.js +0 -18
  173. package/dist.commonjs/dob/config/index.d.ts +0 -2
  174. package/dist.commonjs/dob/config/index.d.ts.map +0 -1
  175. package/dist.commonjs/dob/config/index.js +0 -17
  176. package/dist.commonjs/dob/config/predefined.d.ts +0 -8
  177. package/dist.commonjs/dob/config/predefined.d.ts.map +0 -1
  178. package/dist.commonjs/dob/config/predefined.js +0 -63
  179. package/dist.commonjs/dob/helper/check.d.ts +0 -5
  180. package/dist.commonjs/dob/helper/check.d.ts.map +0 -1
  181. package/dist.commonjs/dob/helper/check.js +0 -80
  182. package/dist.commonjs/dob/helper/error.d.ts +0 -2
  183. package/dist.commonjs/dob/helper/error.d.ts.map +0 -1
  184. package/dist.commonjs/dob/helper/error.js +0 -43
  185. package/dist.commonjs/dob/helper/index.d.ts +0 -4
  186. package/dist.commonjs/dob/helper/index.d.ts.map +0 -1
  187. package/dist.commonjs/dob/helper/index.js +0 -19
  188. package/dist.commonjs/dob/helper/object.d.ts +0 -59
  189. package/dist.commonjs/dob/helper/object.d.ts.map +0 -1
  190. package/dist.commonjs/dob/helper/object.js +0 -2
  191. package/dist.commonjs/dob/index.d.ts +0 -4
  192. package/dist.commonjs/dob/index.d.ts.map +0 -1
  193. package/dist.commonjs/dob/index.js +0 -19
  194. package/dist.commonjs/helper/index.d.ts +0 -7
  195. package/dist.commonjs/helper/index.d.ts.map +0 -1
  196. package/dist.commonjs/helper/index.js +0 -21
  197. package/dist.commonjs/index.d.ts.map +0 -1
  198. package/dist.commonjs/predefined/advanced.d.ts +0 -3
  199. package/dist.commonjs/predefined/advanced.d.ts.map +0 -1
  200. package/dist.commonjs/predefined/advanced.js +0 -18
  201. package/dist.commonjs/predefined/index.d.ts +0 -3
  202. package/dist.commonjs/predefined/index.d.ts.map +0 -1
  203. package/dist.commonjs/predefined/index.js +0 -18
  204. package/dist.commonjs/predefined/mainnet.advanced.d.ts +0 -4
  205. package/dist.commonjs/predefined/mainnet.advanced.d.ts.map +0 -1
  206. package/dist.commonjs/predefined/mainnet.advanced.js +0 -64
  207. package/dist.commonjs/predefined/testnet.advanced.d.ts +0 -4
  208. package/dist.commonjs/predefined/testnet.advanced.d.ts.map +0 -1
  209. package/dist.commonjs/predefined/testnet.advanced.js +0 -91
  210. package/dist.commonjs/predefined/types.d.ts +0 -17
  211. package/dist.commonjs/predefined/types.d.ts.map +0 -1
  212. package/dist.commonjs/predefined/types.js +0 -22
  213. package/dist.commonjs/predefined/utils.d.ts +0 -7
  214. package/dist.commonjs/predefined/utils.d.ts.map +0 -1
  215. package/dist.commonjs/predefined/utils.js +0 -32
  216. package/dist.commonjs/spore/advanced.d.ts +0 -4
  217. package/dist.commonjs/spore/advanced.d.ts.map +0 -1
  218. package/dist.commonjs/spore/advanced.js +0 -57
  219. package/dist.commonjs/spore/index.d.ts +0 -129
  220. package/dist.commonjs/spore/index.d.ts.map +0 -1
  221. package/dist.commonjs/spore/index.js +0 -227
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-C1N7Mdzo.d.ts","names":[],"sources":["../src/codec/cluster.ts","../src/codec/cobuild/buildingPacket.ts","../src/codec/cobuild/sporeAction.ts","../src/codec/cobuild/witnessLayout.ts","../src/codec/spore.ts","../src/predefined/types.ts"],"mappings":";;;;;UAEiB,iBAAA;EACf,IAAA;EACA,WAAW;AAAA;AAAA,cAGA,aAAA,EAAe,GAAA,CAAI,KAAK,CAAC,iBAAA;AAAA,UAKrB,iBAAA;EACf,IAAA;EACA,WAAA;EACA,QAAA,GAAW,GAAA,CAAI,OAAO;AAAA;AAAA,cAGX,aAAA,EAAe,GAAA,CAAI,KAAK,CAAC,iBAAA;AAAA,KAM1B,eAAA,GAAkB,iBAAiB;AAAA,KAEnC,kBAAA;AAAA,cAEC,WAAA,EAAW,GAAA,CAAA,KAAA,CAAA,iBAAA,EAAA,iBAAA;;;;;iBAMR,kBAAA,CAAmB,QAAA,EAAU,eAAA,GAAkB,UAAU;AAAA,iBACzD,kBAAA,CACd,QAAA,EAAU,iBAAA,EACV,OAAA,SACC,UAAU;AAAA,iBACG,kBAAA,CACd,QAAA,EAAU,iBAAA,EACV,OAAA,SACC,UAAU;AAAA,iBAgBG,oBAAA,CAAqB,QAAA,EAAU,iBAAA,GAAoB,UAAU;AAAA,iBAS7D,oBAAA,CAAqB,QAAA,EAAU,iBAAA,GAAoB,UAAU;AA/DhE;AAGb;;;AAHa,iBA6EG,sBAAA,CACd,UAAA,EAAY,GAAA,CAAI,SAAA,GACf,eAAe;AAAA,iBACF,sBAAA,CACd,UAAA,EAAY,GAAA,CAAI,SAAA,EAChB,OAAA,SACC,iBAAiB;AAAA,iBACJ,s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AHP,QAAA,EAAU,GAAA,CAAI,GAAA,EACd,QAAA,EAAU,GAAA,CAAI,QAAA,EACd,QAAA,EAAU,GAAA,CAAI,WAAA,IACP,OAAA;EAAA,OAKF,IAAA,CAAK,cAAA,EAAgB,mBAAA,GAAsB,eAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckb-ccc/spore",
3
- "version": "1.5.18",
3
+ "version": "1.6.1",
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",
@@ -11,54 +11,51 @@
11
11
  "url": "git://github.com/ckb-devrel/ccc.git"
12
12
  },
13
13
  "sideEffects": false,
14
- "main": "dist.commonjs/index.js",
15
- "module": "dist/index.js",
14
+ "main": "./dist.commonjs/index.js",
15
+ "module": "./dist/index.mjs",
16
16
  "exports": {
17
17
  ".": {
18
- "import": "./dist/index.js",
19
- "require": "./dist.commonjs/index.js",
20
- "default": "./dist.commonjs/index.js"
21
- },
22
- "./barrel": {
23
- "import": "./dist/barrel.js",
24
- "require": "./dist.commonjs/barrel.js",
25
- "default": "./dist.commonjs/barrel.js"
18
+ "import": "./dist/index.mjs",
19
+ "require": "./dist.commonjs/index.js"
26
20
  },
27
21
  "./advanced": {
28
- "import": "./dist/advanced.js",
29
- "require": "./dist.commonjs/advanced.js",
30
- "default": "./dist.commonjs/advanced.js"
22
+ "import": "./dist/advanced.mjs",
23
+ "require": "./dist.commonjs/advanced.js"
31
24
  },
32
25
  "./advancedBarrel": {
33
- "import": "./dist/advancedBarrel.js",
34
- "require": "./dist.commonjs/advancedBarrel.js",
35
- "default": "./dist.commonjs/advancedBarrel.js"
36
- }
26
+ "import": "./dist/advancedBarrel.mjs",
27
+ "require": "./dist.commonjs/advancedBarrel.js"
28
+ },
29
+ "./barrel": {
30
+ "import": "./dist/barrel.mjs",
31
+ "require": "./dist.commonjs/barrel.js"
32
+ },
33
+ "./package.json": "./package.json"
37
34
  },
38
35
  "devDependencies": {
39
- "@eslint/js": "^9.34.0",
40
- "@types/node": "^24.3.0",
41
- "copyfiles": "^2.4.1",
42
- "dotenv": "^17.2.1",
43
- "eslint": "^9.34.0",
36
+ "@eslint/js": "^10.0.1",
37
+ "@types/node": "^26.0.0",
38
+ "dotenv": "^17.4.2",
39
+ "eslint": "^10.5.0",
44
40
  "eslint-config-prettier": "^10.1.8",
45
- "eslint-plugin-prettier": "^5.5.4",
46
- "prettier": "^3.6.2",
47
- "prettier-plugin-organize-imports": "^4.2.0",
48
- "rimraf": "^6.0.1",
49
- "typescript": "^5.9.2",
50
- "typescript-eslint": "^8.41.0",
51
- "vitest": "^3.2.4"
41
+ "eslint-plugin-prettier": "^5.5.6",
42
+ "prettier": "^3.8.4",
43
+ "prettier-plugin-organize-imports": "^4.3.0",
44
+ "typescript": "^6.0.3",
45
+ "typescript-eslint": "^8.61.1",
46
+ "vitest": "^4.1.9"
52
47
  },
53
48
  "publishConfig": {
54
49
  "access": "public"
55
50
  },
56
51
  "dependencies": {
57
- "axios": "^1.11.0",
58
- "@ckb-ccc/core": "1.13.0"
52
+ "axios": "^1.18.0",
53
+ "tsdown": "^0.22.3",
54
+ "@ckb-ccc/core": "1.15.0"
59
55
  },
56
+ "types": "./dist.commonjs/index.d.ts",
60
57
  "scripts": {
61
- "build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
58
+ "build": "tsdown",
62
59
  "lint": "eslint ./src",
63
60
  "format": "prettier --write . && eslint --fix ./src"
64
61
  }
@@ -0,0 +1,43 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ const common = {
4
+ minify: true,
5
+ dts: true,
6
+ platform: "neutral" as const,
7
+ sourcemap: true,
8
+ exports: true,
9
+ };
10
+
11
+ const entry = {
12
+ index: "src/index.ts",
13
+ barrel: "src/barrel.ts",
14
+ advanced: "src/advanced.ts",
15
+ advancedBarrel: "src/advancedBarrel.ts",
16
+ } as const;
17
+
18
+ const bundleDeps: string[] = [];
19
+
20
+ export default defineConfig(
21
+ (
22
+ [
23
+ {
24
+ entry,
25
+ deps: {
26
+ onlyBundle: [] as string[],
27
+ },
28
+ format: "esm",
29
+ copy: "./misc/basedirs/dist/*",
30
+ },
31
+ {
32
+ entry,
33
+ deps: {
34
+ alwaysBundle: bundleDeps,
35
+ onlyBundle: bundleDeps,
36
+ },
37
+ format: "cjs",
38
+ outDir: "dist.commonjs",
39
+ copy: "./misc/basedirs/dist.commonjs/*",
40
+ },
41
+ ] as const
42
+ ).map((c) => ({ ...c, ...common })),
43
+ );
@@ -1,3 +0,0 @@
1
- export * from "./advancedBarrel.js";
2
- export * as sporeA from "./advancedBarrel.js";
3
- //# sourceMappingURL=advanced.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../src/advanced.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC"}
package/dist/advanced.js DELETED
@@ -1,2 +0,0 @@
1
- export * from "./advancedBarrel.js";
2
- export * as sporeA from "./advancedBarrel.js";
@@ -1,5 +0,0 @@
1
- export * from "./cobuild/index.js";
2
- export * from "./codec/index.js";
3
- export * from "./predefined/advanced.js";
4
- export * from "./spore/advanced.js";
5
- //# sourceMappingURL=advancedBarrel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"advancedBarrel.d.ts","sourceRoot":"","sources":["../src/advancedBarrel.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
@@ -1,4 +0,0 @@
1
- export * from "./cobuild/index.js";
2
- export * from "./codec/index.js";
3
- export * from "./predefined/advanced.js";
4
- export * from "./spore/advanced.js";
package/dist/barrel.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from "./cluster/index.js";
2
- export * as dob from "./dob/index.js";
3
- export * from "./predefined/index.js";
4
- export * from "./spore/index.js";
5
- //# sourceMappingURL=barrel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"barrel.d.ts","sourceRoot":"","sources":["../src/barrel.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
package/dist/barrel.js DELETED
@@ -1,4 +0,0 @@
1
- export * from "./cluster/index.js";
2
- export * as dob from "./dob/index.js";
3
- export * from "./predefined/index.js";
4
- export * from "./spore/index.js";
@@ -1,95 +0,0 @@
1
- import { ccc } from "@ckb-ccc/core";
2
- import { ClusterDataView } from "../codec/index.js";
3
- import { SporeScriptInfo, SporeScriptInfoLike } from "../predefined/index.js";
4
- export declare function findCluster(client: ccc.Client, id: ccc.HexLike, scripts?: SporeScriptInfoLike[]): Promise<{
5
- cell: ccc.Cell;
6
- cluster: ccc.Cell;
7
- clusterData: ClusterDataView;
8
- scriptInfo: SporeScriptInfo;
9
- } | undefined>;
10
- export declare function assertCluster(client: ccc.Client, args: ccc.HexLike, scripts?: SporeScriptInfoLike[]): Promise<{
11
- cell: ccc.Cell;
12
- scriptInfo: SporeScriptInfo;
13
- }>;
14
- /**
15
- * Create a new Cluster cell
16
- *
17
- * @param params.signer who takes the responsibility to balance and sign the transaction
18
- * @param params.data specific format of data required by Cluster protocol
19
- * @param params.to the owner of the Cluster cell, which will be replaced with signer if not provided
20
- * @param params.tx the transaction skeleton, if not provided, a new one will be created
21
- * @param params.scriptInfo the script info of new cluster, default spore version if undefined
22
- * @param params.scriptInfoHash the script info hash used in cobuild
23
- * @returns
24
- * - **tx**: a new transaction that contains created Cluster cell
25
- * - **id**: the id of the created Cluster cell
26
- */
27
- export declare function createSporeCluster(params: {
28
- signer: ccc.Signer;
29
- data: ClusterDataView;
30
- to?: ccc.ScriptLike;
31
- tx?: ccc.TransactionLike;
32
- scriptInfo?: SporeScriptInfoLike;
33
- scriptInfoHash?: ccc.HexLike;
34
- }): Promise<{
35
- tx: ccc.Transaction;
36
- id: ccc.Hex;
37
- }>;
38
- /**
39
- * Transfer a Cluster cell
40
- *
41
- * @param params.signer who takes the responsibility to balance and sign the transaction
42
- * @param params.id the id of the Cluster cell to be transferred
43
- * @param params.to the new owner of the Cluster cell
44
- * @param params.tx the transaction skeleton, if not provided, a new one will be created
45
- * @param params.scriptInfoHash the script info hash used in cobuild
46
- * @returns
47
- * - **tx**: a new transaction that contains transferred Cluster cell
48
- */
49
- export declare function transferSporeCluster(params: {
50
- signer: ccc.Signer;
51
- id: ccc.HexLike;
52
- to: ccc.ScriptLike;
53
- tx?: ccc.TransactionLike;
54
- scripts?: SporeScriptInfoLike[];
55
- scriptInfoHash?: ccc.HexLike;
56
- }): Promise<{
57
- tx: ccc.Transaction;
58
- }>;
59
- /**
60
- * Search on-chain clusters under the signer's control
61
- *
62
- * @param params.signer the owner of clusters
63
- * @param params.order the order in creation time of clusters
64
- * @param params.scriptInfos the deployed script infos of clusters
65
- */
66
- export declare function findSporeClustersBySigner(params: {
67
- signer: ccc.Signer;
68
- order?: "asc" | "desc";
69
- limit?: number;
70
- scriptInfos?: SporeScriptInfoLike[];
71
- }): AsyncGenerator<{
72
- cell: ccc.Cell;
73
- cluster: ccc.Cell;
74
- clusterData: ClusterDataView;
75
- scriptInfo: SporeScriptInfo;
76
- }>;
77
- /**
78
- * Search on-chain clusters under the specified lock or not
79
- *
80
- * @param params.client the client to search clusters
81
- * @param params.lock the lock of clusters
82
- */
83
- export declare function findSporeClusters(params: {
84
- client: ccc.Client;
85
- lock?: ccc.ScriptLike;
86
- order?: "asc" | "desc";
87
- limit?: number;
88
- scriptInfos?: SporeScriptInfoLike[];
89
- }): AsyncGenerator<{
90
- cell: ccc.Cell;
91
- cluster: ccc.Cell;
92
- clusterData: ClusterDataView;
93
- scriptInfo: SporeScriptInfo;
94
- }>;
95
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cluster/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAMpC,OAAO,EACL,eAAe,EAGhB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,mBAAmB,EAGpB,MAAM,wBAAwB,CAAC;AAEhC,wBAAsB,WAAW,CAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,EAAE,EAAE,GAAG,CAAC,OAAO,EACf,OAAO,CAAC,EAAE,mBAAmB,EAAE,GAC9B,OAAO,CACN;IACE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;IACf,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC;IAClB,WAAW,EAAE,eAAe,CAAC;IAC7B,UAAU,EAAE,eAAe,CAAC;CAC7B,GACD,SAAS,CACZ,CAgBA;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,IAAI,EAAE,GAAG,CAAC,OAAO,EACjB,OAAO,CAAC,EAAE,mBAAmB,EAAE,GAC9B,OAAO,CAAC;IACT,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;IACf,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC,CAQD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAC/C,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC;IACnB,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC;IACpB,EAAE,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC;IACzB,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CAC9B,GAAG,OAAO,CAAC;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B,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;IACf,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC;IAClB,WAAW,EAAE,eAAe,CAAC;IAC7B,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC,CAkCD"}
@@ -1,165 +0,0 @@
1
- import { ccc } from "@ckb-ccc/core";
2
- import { assembleCreateClusterAction, assembleTransferClusterAction, prepareSporeTransaction, } from "../advanced.js";
3
- import { packRawClusterData, unpackToRawClusterData, } from "../codec/index.js";
4
- import { findSingletonCellByArgs } from "../helper/index.js";
5
- import { SporeScriptInfo, getClusterScriptInfo, getClusterScriptInfos, } from "../predefined/index.js";
6
- export async function findCluster(client, id, scripts) {
7
- const found = await findSingletonCellByArgs(client, id, scripts ?? Object.values(getClusterScriptInfos(client)));
8
- if (!found) {
9
- return;
10
- }
11
- return {
12
- cell: found.cell,
13
- cluster: found.cell,
14
- clusterData: unpackToRawClusterData(found.cell.outputData),
15
- scriptInfo: found.scriptInfo,
16
- };
17
- }
18
- export async function assertCluster(client, args, scripts) {
19
- const res = await findCluster(client, args, scripts);
20
- if (!res) {
21
- throw new Error(`Cluster ${ccc.hexFrom(args)} not found`);
22
- }
23
- return res;
24
- }
25
- /**
26
- * Create a new Cluster cell
27
- *
28
- * @param params.signer who takes the responsibility to balance and sign the transaction
29
- * @param params.data specific format of data required by Cluster protocol
30
- * @param params.to the owner of the Cluster cell, which will be replaced with signer if not provided
31
- * @param params.tx the transaction skeleton, if not provided, a new one will be created
32
- * @param params.scriptInfo the script info of new cluster, default spore version if undefined
33
- * @param params.scriptInfoHash the script info hash used in cobuild
34
- * @returns
35
- * - **tx**: a new transaction that contains created Cluster cell
36
- * - **id**: the id of the created Cluster cell
37
- */
38
- export async function createSporeCluster(params) {
39
- const { signer, data, to, scriptInfoHash } = params;
40
- const scriptInfo = params.scriptInfo ?? getClusterScriptInfo(signer.client);
41
- // prepare transaction
42
- const tx = ccc.Transaction.from(params.tx ?? {});
43
- await tx.completeInputsAtLeastOne(signer);
44
- // build cluster cell
45
- const id = ccc.hashTypeId(tx.inputs[0], tx.outputs.length);
46
- const packedClusterData = packRawClusterData(data);
47
- tx.addOutput({
48
- lock: to ?? (await signer.getRecommendedAddressObj()).script,
49
- type: {
50
- ...scriptInfo,
51
- args: id,
52
- },
53
- }, packedClusterData);
54
- // complete cellDeps
55
- await tx.addCellDepInfos(signer.client, scriptInfo.cellDeps);
56
- // generate cobuild action
57
- const actions = scriptInfo.cobuild
58
- ? [
59
- assembleCreateClusterAction(tx.outputs[tx.outputs.length - 1], packedClusterData, scriptInfoHash),
60
- ]
61
- : [];
62
- return {
63
- tx: await prepareSporeTransaction(signer, tx, actions),
64
- id,
65
- };
66
- }
67
- /**
68
- * Transfer a Cluster cell
69
- *
70
- * @param params.signer who takes the responsibility to balance and sign the transaction
71
- * @param params.id the id of the Cluster cell to be transferred
72
- * @param params.to the new owner of the Cluster cell
73
- * @param params.tx the transaction skeleton, if not provided, a new one will be created
74
- * @param params.scriptInfoHash the script info hash used in cobuild
75
- * @returns
76
- * - **tx**: a new transaction that contains transferred Cluster cell
77
- */
78
- export async function transferSporeCluster(params) {
79
- const { signer, id, to, scripts, scriptInfoHash } = params;
80
- // prepare transaction
81
- const tx = ccc.Transaction.from(params.tx ?? {});
82
- // build cluster cell
83
- const { cell: cluster, scriptInfo: clusterScriptInfo } = await assertCluster(signer.client, id, scripts);
84
- tx.addInput(cluster);
85
- tx.addOutput({
86
- lock: to,
87
- type: cluster.cellOutput.type,
88
- }, cluster.outputData);
89
- // complete cellDeps
90
- await tx.addCellDepInfos(signer.client, clusterScriptInfo.cellDeps);
91
- // generate cobuild action
92
- const actions = clusterScriptInfo.cobuild
93
- ? [
94
- assembleTransferClusterAction(cluster.cellOutput, tx.outputs[tx.outputs.length - 1], scriptInfoHash),
95
- ]
96
- : [];
97
- return {
98
- tx: await prepareSporeTransaction(signer, tx, actions),
99
- };
100
- }
101
- /**
102
- * Search on-chain clusters under the signer's control
103
- *
104
- * @param params.signer the owner of clusters
105
- * @param params.order the order in creation time of clusters
106
- * @param params.scriptInfos the deployed script infos of clusters
107
- */
108
- export async function* findSporeClustersBySigner(params) {
109
- const { signer, order, limit, scriptInfos } = params;
110
- for (const scriptInfo of scriptInfos ??
111
- Object.values(getClusterScriptInfos(signer.client))) {
112
- if (!scriptInfo) {
113
- continue;
114
- }
115
- for await (const cluster of signer.findCells({
116
- script: {
117
- ...scriptInfo,
118
- args: "",
119
- },
120
- }, true, order, limit)) {
121
- yield {
122
- cell: cluster,
123
- cluster,
124
- clusterData: unpackToRawClusterData(cluster.outputData),
125
- scriptInfo: SporeScriptInfo.from(scriptInfo),
126
- };
127
- }
128
- }
129
- }
130
- /**
131
- * Search on-chain clusters under the specified lock or not
132
- *
133
- * @param params.client the client to search clusters
134
- * @param params.lock the lock of clusters
135
- */
136
- export async function* findSporeClusters(params) {
137
- const { client, lock, order, limit, scriptInfos } = params;
138
- for (const scriptInfo of scriptInfos ??
139
- Object.values(getClusterScriptInfos(client))) {
140
- if (!scriptInfo) {
141
- continue;
142
- }
143
- for await (const cluster of client.findCells({
144
- script: {
145
- ...scriptInfo,
146
- args: "",
147
- },
148
- scriptType: "type",
149
- scriptSearchMode: "prefix",
150
- withData: true,
151
- filter: lock
152
- ? {
153
- script: lock,
154
- }
155
- : undefined,
156
- }, order, limit)) {
157
- yield {
158
- cell: cluster,
159
- cluster,
160
- clusterData: unpackToRawClusterData(cluster.outputData),
161
- scriptInfo: SporeScriptInfo.from(scriptInfo),
162
- };
163
- }
164
- }
165
- }
@@ -1,12 +0,0 @@
1
- import { ccc } from "@ckb-ccc/core";
2
- import { Action, ActionVec, WitnessLayout } from "../codec/index.js";
3
- export declare function assembleCreateSporeAction(sporeOutput: ccc.CellOutputLike, sporeData: ccc.BytesLike, scriptInfoHash?: ccc.HexLike): ccc.EncodableType<typeof Action>;
4
- export declare function assembleTransferSporeAction(sporeInput: ccc.CellOutputLike, sporeOutput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): ccc.EncodableType<typeof Action>;
5
- export declare function assembleMeltSporeAction(sporeInput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): ccc.EncodableType<typeof Action>;
6
- export declare function assembleCreateClusterAction(clusterOutput: ccc.CellOutputLike, clusterData: ccc.BytesLike, scriptInfoHash?: ccc.HexLike): ccc.EncodableType<typeof Action>;
7
- export declare function assembleTransferClusterAction(clusterInput: ccc.CellOutputLike, clusterOutput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): ccc.EncodableType<typeof Action>;
8
- export declare function prepareSporeTransaction(signer: ccc.Signer, txLike: ccc.TransactionLike, actions: ccc.EncodableType<typeof ActionVec>): Promise<ccc.Transaction>;
9
- export declare function unpackCommonCobuildProof(data: ccc.HexLike): ccc.EncodableType<typeof WitnessLayout> | undefined;
10
- export declare function extractCobuildActionsFromTx(tx: ccc.Transaction): ccc.EncodableType<typeof ActionVec>;
11
- export declare function injectCobuild(tx: ccc.Transaction, actions: ccc.EncodableType<typeof ActionVec>): void;
12
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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,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,M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_COBUILD_INFO_HASH } from "../predefined/index.js";
4
- export function assembleCreateSporeAction(sporeOutput, sporeData, scriptInfoHash = DEFAULT_COBUILD_INFO_HASH) {
5
- if (!sporeOutput.type) {
6
- throw new Error("Spore cell must have a type script");
7
- }
8
- const sporeType = ccc.Script.from(sporeOutput.type);
9
- const sporeTypeHash = sporeType.hash();
10
- const actionData = SporeAction.encode({
11
- type: "CreateSpore",
12
- value: {
13
- sporeId: sporeType.args,
14
- to: {
15
- type: "Script",
16
- value: sporeOutput.lock,
17
- },
18
- dataHash: ccc.hashCkb(sporeData),
19
- },
20
- });
21
- return {
22
- scriptInfoHash: ccc.hexFrom(scriptInfoHash),
23
- scriptHash: sporeTypeHash,
24
- data: ccc.hexFrom(actionData),
25
- };
26
- }
27
- export function assembleTransferSporeAction(sporeInput, sporeOutput, scriptInfoHash = DEFAULT_COBUILD_INFO_HASH) {
28
- if (!sporeInput.type || !sporeOutput.type) {
29
- throw new Error("Spore cell must have a type script");
30
- }
31
- const sporeType = ccc.Script.from(sporeOutput.type);
32
- const sporeTypeHash = sporeType.hash();
33
- const actionData = SporeAction.encode({
34
- type: "TransferSpore",
35
- value: {
36
- sporeId: sporeType.args,
37
- from: {
38
- type: "Script",
39
- value: sporeInput.lock,
40
- },
41
- to: {
42
- type: "Script",
43
- value: sporeOutput.lock,
44
- },
45
- },
46
- });
47
- return {
48
- scriptInfoHash: ccc.hexFrom(scriptInfoHash),
49
- scriptHash: sporeTypeHash,
50
- data: ccc.hexFrom(actionData),
51
- };
52
- }
53
- export function assembleMeltSporeAction(sporeInput, scriptInfoHash = DEFAULT_COBUILD_INFO_HASH) {
54
- if (!sporeInput.type) {
55
- throw new Error("Spore cell must have a type script");
56
- }
57
- const sporeType = ccc.Script.from(sporeInput.type);
58
- const sporeTypeHash = sporeType.hash();
59
- const actionData = SporeAction.encode({
60
- type: "MeltSpore",
61
- value: {
62
- sporeId: sporeType.args,
63
- from: {
64
- type: "Script",
65
- value: sporeInput.lock,
66
- },
67
- },
68
- });
69
- return {
70
- scriptInfoHash: ccc.hexFrom(scriptInfoHash),
71
- scriptHash: sporeTypeHash,
72
- data: ccc.hexFrom(actionData),
73
- };
74
- }
75
- export function assembleCreateClusterAction(clusterOutput, clusterData, scriptInfoHash = DEFAULT_COBUILD_INFO_HASH) {
76
- if (!clusterOutput.type) {
77
- throw new Error("Cluster cell must have a type script");
78
- }
79
- const clusterType = ccc.Script.from(clusterOutput.type);
80
- const clusterTypeHash = clusterType.hash();
81
- const actionData = SporeAction.encode({
82
- type: "CreateCluster",
83
- value: {
84
- clusterId: clusterType.args,
85
- to: {
86
- type: "Script",
87
- value: clusterOutput.lock,
88
- },
89
- dataHash: ccc.hashCkb(clusterData),
90
- },
91
- });
92
- return {
93
- scriptInfoHash: ccc.hexFrom(scriptInfoHash),
94
- scriptHash: clusterTypeHash,
95
- data: ccc.hexFrom(actionData),
96
- };
97
- }
98
- export function assembleTransferClusterAction(clusterInput, clusterOutput, scriptInfoHash = DEFAULT_COBUILD_INFO_HASH) {
99
- if (!clusterInput.type || !clusterOutput.type) {
100
- throw new Error("Cluster cell must have a type script");
101
- }
102
- const clusterType = ccc.Script.from(clusterOutput.type);
103
- const clusterTypeHash = clusterType.hash();
104
- const actionData = SporeAction.encode({
105
- type: "TransferCluster",
106
- value: {
107
- clusterId: clusterType.args,
108
- from: {
109
- type: "Script",
110
- value: clusterInput.lock,
111
- },
112
- to: {
113
- type: "Script",
114
- value: clusterOutput.lock,
115
- },
116
- },
117
- });
118
- return {
119
- scriptInfoHash: ccc.hexFrom(scriptInfoHash),
120
- scriptHash: clusterTypeHash,
121
- data: ccc.hexFrom(actionData),
122
- };
123
- }
124
- export async function prepareSporeTransaction(signer, txLike, actions) {
125
- let tx = ccc.Transaction.from(txLike);
126
- if (actions.length === 0) {
127
- return signer.prepareTransaction(tx);
128
- }
129
- const existedActions = extractCobuildActionsFromTx(tx);
130
- tx = await signer.prepareTransaction(tx);
131
- injectCobuild(tx, [existedActions, actions].flat());
132
- return tx;
133
- }
134
- export function unpackCommonCobuildProof(data) {
135
- try {
136
- return WitnessLayout.decode(ccc.bytesFrom(data));
137
- }
138
- catch {
139
- return;
140
- }
141
- }
142
- export function extractCobuildActionsFromTx(tx) {
143
- if (tx.witnesses.length === 0) {
144
- return [];
145
- }
146
- const witnessLayout = unpackCommonCobuildProof(tx.witnesses[tx.witnesses.length - 1]);
147
- if (!witnessLayout) {
148
- return [];
149
- }
150
- if (witnessLayout.type !== "SighashAll") {
151
- throw new Error("Invalid cobuild proof type: SighashAll");
152
- }
153
- // Remove existed cobuild witness
154
- tx.witnesses.pop();
155
- return witnessLayout.value.message.actions;
156
- }
157
- export function injectCobuild(tx, actions) {
158
- tx.setWitnessAt(Math.max(tx.witnesses.length, tx.inputs.length), WitnessLayout.encode({
159
- type: "SighashAll",
160
- value: {
161
- seal: "0x",
162
- message: {
163
- actions,
164
- },
165
- },
166
- }));
167
- }