@ckb-ccc/spore 1.5.17 → 1.6.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 (225) hide show
  1. package/CHANGELOG.md +23 -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-B4pnDQ_D.d.mts +324 -0
  8. package/dist/barrel-B4pnDQ_D.d.mts.map +1 -0
  9. package/dist/barrel-C4fV1nUf.mjs +2 -0
  10. package/dist/barrel-C4fV1nUf.mjs.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-1b682ehT.d.mts +1048 -0
  19. package/dist/types-1b682ehT.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-Dj_LwfvL.js +2 -0
  26. package/dist.commonjs/barrel-Dj_LwfvL.js.map +1 -0
  27. package/dist.commonjs/barrel-DsEUm55S.d.ts +324 -0
  28. package/dist.commonjs/barrel-DsEUm55S.d.ts.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-DjAlFsfK.d.ts +1050 -0
  36. package/dist.commonjs/types-DjAlFsfK.d.ts.map +1 -0
  37. package/package.json +30 -33
  38. package/src/cobuild/index.ts +10 -10
  39. package/src/codec/cluster.ts +2 -2
  40. package/src/codec/spore.ts +1 -1
  41. package/src/spore/advanced.ts +2 -2
  42. package/tsdown.config.mts +43 -0
  43. package/dist/advanced.d.ts +0 -3
  44. package/dist/advanced.d.ts.map +0 -1
  45. package/dist/advanced.js +0 -2
  46. package/dist/advancedBarrel.d.ts +0 -5
  47. package/dist/advancedBarrel.d.ts.map +0 -1
  48. package/dist/advancedBarrel.js +0 -4
  49. package/dist/barrel.d.ts +0 -5
  50. package/dist/barrel.d.ts.map +0 -1
  51. package/dist/barrel.js +0 -4
  52. package/dist/cluster/index.d.ts +0 -95
  53. package/dist/cluster/index.d.ts.map +0 -1
  54. package/dist/cluster/index.js +0 -165
  55. package/dist/cobuild/index.d.ts +0 -12
  56. package/dist/cobuild/index.d.ts.map +0 -1
  57. package/dist/cobuild/index.js +0 -167
  58. package/dist/codec/cluster.d.ts +0 -34
  59. package/dist/codec/cluster.d.ts.map +0 -1
  60. package/dist/codec/cluster.js +0 -62
  61. package/dist/codec/cobuild/buildingPacket.d.ts +0 -268
  62. package/dist/codec/cobuild/buildingPacket.d.ts.map +0 -1
  63. package/dist/codec/cobuild/buildingPacket.js +0 -33
  64. package/dist/codec/cobuild/index.d.ts +0 -4
  65. package/dist/codec/cobuild/index.d.ts.map +0 -1
  66. package/dist/codec/cobuild/index.js +0 -3
  67. package/dist/codec/cobuild/sporeAction.d.ts +0 -589
  68. package/dist/codec/cobuild/sporeAction.d.ts.map +0 -1
  69. package/dist/codec/cobuild/sporeAction.js +0 -90
  70. package/dist/codec/cobuild/witnessLayout.d.ts +0 -126
  71. package/dist/codec/cobuild/witnessLayout.d.ts.map +0 -1
  72. package/dist/codec/cobuild/witnessLayout.js +0 -26
  73. package/dist/codec/index.d.ts +0 -4
  74. package/dist/codec/index.d.ts.map +0 -1
  75. package/dist/codec/index.js +0 -3
  76. package/dist/codec/spore.d.ts +0 -10
  77. package/dist/codec/spore.d.ts.map +0 -1
  78. package/dist/codec/spore.js +0 -16
  79. package/dist/dob/api/decode.d.ts +0 -8
  80. package/dist/dob/api/decode.d.ts.map +0 -1
  81. package/dist/dob/api/decode.js +0 -63
  82. package/dist/dob/api/encode.d.ts +0 -5
  83. package/dist/dob/api/encode.d.ts.map +0 -1
  84. package/dist/dob/api/encode.js +0 -81
  85. package/dist/dob/api/index.d.ts +0 -3
  86. package/dist/dob/api/index.d.ts.map +0 -1
  87. package/dist/dob/api/index.js +0 -2
  88. package/dist/dob/config/index.d.ts +0 -2
  89. package/dist/dob/config/index.d.ts.map +0 -1
  90. package/dist/dob/config/index.js +0 -1
  91. package/dist/dob/config/predefined.d.ts +0 -8
  92. package/dist/dob/config/predefined.d.ts.map +0 -1
  93. package/dist/dob/config/predefined.js +0 -59
  94. package/dist/dob/helper/check.d.ts +0 -5
  95. package/dist/dob/helper/check.d.ts.map +0 -1
  96. package/dist/dob/helper/check.js +0 -75
  97. package/dist/dob/helper/error.d.ts +0 -2
  98. package/dist/dob/helper/error.d.ts.map +0 -1
  99. package/dist/dob/helper/error.js +0 -40
  100. package/dist/dob/helper/index.d.ts +0 -4
  101. package/dist/dob/helper/index.d.ts.map +0 -1
  102. package/dist/dob/helper/index.js +0 -3
  103. package/dist/dob/helper/object.d.ts +0 -59
  104. package/dist/dob/helper/object.d.ts.map +0 -1
  105. package/dist/dob/helper/object.js +0 -1
  106. package/dist/dob/index.d.ts +0 -4
  107. package/dist/dob/index.d.ts.map +0 -1
  108. package/dist/dob/index.js +0 -3
  109. package/dist/helper/index.d.ts +0 -7
  110. package/dist/helper/index.d.ts.map +0 -1
  111. package/dist/helper/index.js +0 -18
  112. package/dist/index.d.ts +0 -3
  113. package/dist/index.d.ts.map +0 -1
  114. package/dist/index.js +0 -2
  115. package/dist/predefined/advanced.d.ts +0 -3
  116. package/dist/predefined/advanced.d.ts.map +0 -1
  117. package/dist/predefined/advanced.js +0 -2
  118. package/dist/predefined/index.d.ts +0 -3
  119. package/dist/predefined/index.d.ts.map +0 -1
  120. package/dist/predefined/index.js +0 -2
  121. package/dist/predefined/mainnet.advanced.d.ts +0 -4
  122. package/dist/predefined/mainnet.advanced.d.ts.map +0 -1
  123. package/dist/predefined/mainnet.advanced.js +0 -61
  124. package/dist/predefined/testnet.advanced.d.ts +0 -4
  125. package/dist/predefined/testnet.advanced.d.ts.map +0 -1
  126. package/dist/predefined/testnet.advanced.js +0 -88
  127. package/dist/predefined/types.d.ts +0 -17
  128. package/dist/predefined/types.d.ts.map +0 -1
  129. package/dist/predefined/types.js +0 -18
  130. package/dist/predefined/utils.d.ts +0 -7
  131. package/dist/predefined/utils.d.ts.map +0 -1
  132. package/dist/predefined/utils.js +0 -26
  133. package/dist/spore/advanced.d.ts +0 -4
  134. package/dist/spore/advanced.d.ts.map +0 -1
  135. package/dist/spore/advanced.js +0 -54
  136. package/dist/spore/index.d.ts +0 -129
  137. package/dist/spore/index.d.ts.map +0 -1
  138. package/dist/spore/index.js +0 -218
  139. package/dist.commonjs/advanced.d.ts.map +0 -1
  140. package/dist.commonjs/barrel.d.ts.map +0 -1
  141. package/dist.commonjs/cluster/index.d.ts +0 -95
  142. package/dist.commonjs/cluster/index.d.ts.map +0 -1
  143. package/dist.commonjs/cluster/index.js +0 -173
  144. package/dist.commonjs/cobuild/index.d.ts +0 -12
  145. package/dist.commonjs/cobuild/index.d.ts.map +0 -1
  146. package/dist.commonjs/cobuild/index.js +0 -178
  147. package/dist.commonjs/codec/cluster.d.ts +0 -34
  148. package/dist.commonjs/codec/cluster.d.ts.map +0 -1
  149. package/dist.commonjs/codec/cluster.js +0 -71
  150. package/dist.commonjs/codec/cobuild/buildingPacket.d.ts +0 -268
  151. package/dist.commonjs/codec/cobuild/buildingPacket.d.ts.map +0 -1
  152. package/dist.commonjs/codec/cobuild/buildingPacket.js +0 -36
  153. package/dist.commonjs/codec/cobuild/index.d.ts +0 -4
  154. package/dist.commonjs/codec/cobuild/index.d.ts.map +0 -1
  155. package/dist.commonjs/codec/cobuild/index.js +0 -19
  156. package/dist.commonjs/codec/cobuild/sporeAction.d.ts +0 -589
  157. package/dist.commonjs/codec/cobuild/sporeAction.d.ts.map +0 -1
  158. package/dist.commonjs/codec/cobuild/sporeAction.js +0 -93
  159. package/dist.commonjs/codec/cobuild/witnessLayout.d.ts +0 -126
  160. package/dist.commonjs/codec/cobuild/witnessLayout.d.ts.map +0 -1
  161. package/dist.commonjs/codec/cobuild/witnessLayout.js +0 -29
  162. package/dist.commonjs/codec/index.d.ts +0 -4
  163. package/dist.commonjs/codec/index.d.ts.map +0 -1
  164. package/dist.commonjs/codec/index.js +0 -19
  165. package/dist.commonjs/codec/spore.d.ts +0 -10
  166. package/dist.commonjs/codec/spore.d.ts.map +0 -1
  167. package/dist.commonjs/codec/spore.js +0 -21
  168. package/dist.commonjs/dob/api/decode.d.ts +0 -8
  169. package/dist.commonjs/dob/api/decode.d.ts.map +0 -1
  170. package/dist.commonjs/dob/api/decode.js +0 -70
  171. package/dist.commonjs/dob/api/encode.d.ts +0 -5
  172. package/dist.commonjs/dob/api/encode.d.ts.map +0 -1
  173. package/dist.commonjs/dob/api/encode.js +0 -86
  174. package/dist.commonjs/dob/api/index.d.ts +0 -3
  175. package/dist.commonjs/dob/api/index.d.ts.map +0 -1
  176. package/dist.commonjs/dob/api/index.js +0 -18
  177. package/dist.commonjs/dob/config/index.d.ts +0 -2
  178. package/dist.commonjs/dob/config/index.d.ts.map +0 -1
  179. package/dist.commonjs/dob/config/index.js +0 -17
  180. package/dist.commonjs/dob/config/predefined.d.ts +0 -8
  181. package/dist.commonjs/dob/config/predefined.d.ts.map +0 -1
  182. package/dist.commonjs/dob/config/predefined.js +0 -63
  183. package/dist.commonjs/dob/helper/check.d.ts +0 -5
  184. package/dist.commonjs/dob/helper/check.d.ts.map +0 -1
  185. package/dist.commonjs/dob/helper/check.js +0 -80
  186. package/dist.commonjs/dob/helper/error.d.ts +0 -2
  187. package/dist.commonjs/dob/helper/error.d.ts.map +0 -1
  188. package/dist.commonjs/dob/helper/error.js +0 -43
  189. package/dist.commonjs/dob/helper/index.d.ts +0 -4
  190. package/dist.commonjs/dob/helper/index.d.ts.map +0 -1
  191. package/dist.commonjs/dob/helper/index.js +0 -19
  192. package/dist.commonjs/dob/helper/object.d.ts +0 -59
  193. package/dist.commonjs/dob/helper/object.d.ts.map +0 -1
  194. package/dist.commonjs/dob/helper/object.js +0 -2
  195. package/dist.commonjs/dob/index.d.ts +0 -4
  196. package/dist.commonjs/dob/index.d.ts.map +0 -1
  197. package/dist.commonjs/dob/index.js +0 -19
  198. package/dist.commonjs/helper/index.d.ts +0 -7
  199. package/dist.commonjs/helper/index.d.ts.map +0 -1
  200. package/dist.commonjs/helper/index.js +0 -21
  201. package/dist.commonjs/index.d.ts.map +0 -1
  202. package/dist.commonjs/predefined/advanced.d.ts +0 -3
  203. package/dist.commonjs/predefined/advanced.d.ts.map +0 -1
  204. package/dist.commonjs/predefined/advanced.js +0 -18
  205. package/dist.commonjs/predefined/index.d.ts +0 -3
  206. package/dist.commonjs/predefined/index.d.ts.map +0 -1
  207. package/dist.commonjs/predefined/index.js +0 -18
  208. package/dist.commonjs/predefined/mainnet.advanced.d.ts +0 -4
  209. package/dist.commonjs/predefined/mainnet.advanced.d.ts.map +0 -1
  210. package/dist.commonjs/predefined/mainnet.advanced.js +0 -64
  211. package/dist.commonjs/predefined/testnet.advanced.d.ts +0 -4
  212. package/dist.commonjs/predefined/testnet.advanced.d.ts.map +0 -1
  213. package/dist.commonjs/predefined/testnet.advanced.js +0 -91
  214. package/dist.commonjs/predefined/types.d.ts +0 -17
  215. package/dist.commonjs/predefined/types.d.ts.map +0 -1
  216. package/dist.commonjs/predefined/types.js +0 -22
  217. package/dist.commonjs/predefined/utils.d.ts +0 -7
  218. package/dist.commonjs/predefined/utils.d.ts.map +0 -1
  219. package/dist.commonjs/predefined/utils.js +0 -32
  220. package/dist.commonjs/spore/advanced.d.ts +0 -4
  221. package/dist.commonjs/spore/advanced.d.ts.map +0 -1
  222. package/dist.commonjs/spore/advanced.js +0 -57
  223. package/dist.commonjs/spore/index.d.ts +0 -129
  224. package/dist.commonjs/spore/index.d.ts.map +0 -1
  225. package/dist.commonjs/spore/index.js +0 -227
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DjAlFsfK.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;AA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AA,CAAI,cAAc;EAClD,OAAA;AAAA;AAAA,cAGW,eAAA,SAAwB,GAAA,CAAI,UAAA;EAK9B,OAAA;cAHP,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.17",
3
+ "version": "1.6.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",
@@ -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.12.5"
52
+ "axios": "^1.18.0",
53
+ "tsdown": "^0.22.3",
54
+ "@ckb-ccc/core": "1.14.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
  }
@@ -1,4 +1,4 @@
1
- import { ccc, mol } from "@ckb-ccc/core";
1
+ import { ccc } from "@ckb-ccc/core";
2
2
  import {
3
3
  Action,
4
4
  ActionVec,
@@ -11,7 +11,7 @@ export function assembleCreateSporeAction(
11
11
  sporeOutput: ccc.CellOutputLike,
12
12
  sporeData: ccc.BytesLike,
13
13
  scriptInfoHash: ccc.HexLike = DEFAULT_COBUILD_INFO_HASH,
14
- ): mol.EncodableType<typeof Action> {
14
+ ): ccc.EncodableType<typeof Action> {
15
15
  if (!sporeOutput.type) {
16
16
  throw new Error("Spore cell must have a type script");
17
17
  }
@@ -39,7 +39,7 @@ export function assembleTransferSporeAction(
39
39
  sporeInput: ccc.CellOutputLike,
40
40
  sporeOutput: ccc.CellOutputLike,
41
41
  scriptInfoHash: ccc.HexLike = DEFAULT_COBUILD_INFO_HASH,
42
- ): mol.EncodableType<typeof Action> {
42
+ ): ccc.EncodableType<typeof Action> {
43
43
  if (!sporeInput.type || !sporeOutput.type) {
44
44
  throw new Error("Spore cell must have a type script");
45
45
  }
@@ -70,7 +70,7 @@ export function assembleTransferSporeAction(
70
70
  export function assembleMeltSporeAction(
71
71
  sporeInput: ccc.CellOutputLike,
72
72
  scriptInfoHash: ccc.HexLike = DEFAULT_COBUILD_INFO_HASH,
73
- ): mol.EncodableType<typeof Action> {
73
+ ): ccc.EncodableType<typeof Action> {
74
74
  if (!sporeInput.type) {
75
75
  throw new Error("Spore cell must have a type script");
76
76
  }
@@ -97,7 +97,7 @@ export function assembleCreateClusterAction(
97
97
  clusterOutput: ccc.CellOutputLike,
98
98
  clusterData: ccc.BytesLike,
99
99
  scriptInfoHash: ccc.HexLike = DEFAULT_COBUILD_INFO_HASH,
100
- ): mol.EncodableType<typeof Action> {
100
+ ): ccc.EncodableType<typeof Action> {
101
101
  if (!clusterOutput.type) {
102
102
  throw new Error("Cluster cell must have a type script");
103
103
  }
@@ -125,7 +125,7 @@ export function assembleTransferClusterAction(
125
125
  clusterInput: ccc.CellOutputLike,
126
126
  clusterOutput: ccc.CellOutputLike,
127
127
  scriptInfoHash: ccc.HexLike = DEFAULT_COBUILD_INFO_HASH,
128
- ): mol.EncodableType<typeof Action> {
128
+ ): ccc.EncodableType<typeof Action> {
129
129
  if (!clusterInput.type || !clusterOutput.type) {
130
130
  throw new Error("Cluster cell must have a type script");
131
131
  }
@@ -155,7 +155,7 @@ export function assembleTransferClusterAction(
155
155
  export async function prepareSporeTransaction(
156
156
  signer: ccc.Signer,
157
157
  txLike: ccc.TransactionLike,
158
- actions: mol.EncodableType<typeof ActionVec>,
158
+ actions: ccc.EncodableType<typeof ActionVec>,
159
159
  ): Promise<ccc.Transaction> {
160
160
  let tx = ccc.Transaction.from(txLike);
161
161
 
@@ -171,7 +171,7 @@ export async function prepareSporeTransaction(
171
171
 
172
172
  export function unpackCommonCobuildProof(
173
173
  data: ccc.HexLike,
174
- ): mol.EncodableType<typeof WitnessLayout> | undefined {
174
+ ): ccc.EncodableType<typeof WitnessLayout> | undefined {
175
175
  try {
176
176
  return WitnessLayout.decode(ccc.bytesFrom(data));
177
177
  } catch {
@@ -181,7 +181,7 @@ export function unpackCommonCobuildProof(
181
181
 
182
182
  export function extractCobuildActionsFromTx(
183
183
  tx: ccc.Transaction,
184
- ): mol.EncodableType<typeof ActionVec> {
184
+ ): ccc.EncodableType<typeof ActionVec> {
185
185
  if (tx.witnesses.length === 0) {
186
186
  return [];
187
187
  }
@@ -202,7 +202,7 @@ export function extractCobuildActionsFromTx(
202
202
 
203
203
  export function injectCobuild(
204
204
  tx: ccc.Transaction,
205
- actions: mol.EncodableType<typeof ActionVec>,
205
+ actions: ccc.EncodableType<typeof ActionVec>,
206
206
  ): void {
207
207
  tx.setWitnessAt(
208
208
  Math.max(tx.witnesses.length, tx.inputs.length),
@@ -5,7 +5,7 @@ export interface ClusterDataV1View {
5
5
  description: string;
6
6
  }
7
7
 
8
- export const ClusterDataV1: mol.Codec<ClusterDataV1View> = mol.table({
8
+ export const ClusterDataV1: ccc.Codec<ClusterDataV1View> = mol.table({
9
9
  name: mol.String,
10
10
  description: mol.String,
11
11
  });
@@ -16,7 +16,7 @@ export interface ClusterDataV2View {
16
16
  mutantId?: ccc.HexLike;
17
17
  }
18
18
 
19
- export const ClusterDataV2: mol.Codec<ClusterDataV2View> = mol.table({
19
+ export const ClusterDataV2: ccc.Codec<ClusterDataV2View> = mol.table({
20
20
  name: mol.String,
21
21
  description: mol.String,
22
22
  mutantId: mol.BytesOpt,
@@ -6,7 +6,7 @@ export interface SporeDataView {
6
6
  clusterId?: ccc.HexLike;
7
7
  }
8
8
 
9
- export const SporeData: mol.Codec<SporeDataView> = mol.table({
9
+ export const SporeData: ccc.Codec<SporeDataView> = mol.table({
10
10
  contentType: mol.String,
11
11
  content: mol.Bytes,
12
12
  clusterId: mol.BytesOpt,
@@ -1,4 +1,4 @@
1
- import { ccc, mol } from "@ckb-ccc/core";
1
+ import { ccc } from "@ckb-ccc/core";
2
2
  import { assembleTransferClusterAction } from "../advanced.js";
3
3
  import { assertCluster } from "../cluster/index.js";
4
4
  import { Action, SporeDataView } from "../codec/index.js";
@@ -9,7 +9,7 @@ export async function prepareCluster(
9
9
  data: SporeDataView,
10
10
  clusterMode?: "lockProxy" | "clusterCell" | "skip",
11
11
  scriptInfoHash?: ccc.HexLike,
12
- ): Promise<mol.EncodableType<typeof Action> | undefined> {
12
+ ): Promise<ccc.EncodableType<typeof Action> | undefined> {
13
13
  // skip if the spore is not belong to a cluster
14
14
  if (!data.clusterId || clusterMode === "skip") {
15
15
  return;
@@ -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,MA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c } 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, mol } 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): 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;
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,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,2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