@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @ckb-ccc/spore
2
2
 
3
+ ## 1.6.1
4
+ ### Patch Changes
5
+
6
+ - Updated dependencies [[`98597b5`](https://github.com/ckb-devrel/ccc/commit/98597b56eb6eeb029b72ea963649155dfe1f4215), [`bef9d0a`](https://github.com/ckb-devrel/ccc/commit/bef9d0a037fba045eab24d7ad55400fa26fbbffd), [`8067a08`](https://github.com/ckb-devrel/ccc/commit/8067a08de041ffd7a624adea0b594eb283e2634e), [`7019a1a`](https://github.com/ckb-devrel/ccc/commit/7019a1a7f765dfa7940cdfe51474bcd347f18ec6), [`9beee4d`](https://github.com/ckb-devrel/ccc/commit/9beee4d7f39e4b4b19919c5feb86e1c8be0e089d), [`2d4e701`](https://github.com/ckb-devrel/ccc/commit/2d4e701e54e9bf5247c2363490009acc5606c0ea), [`0eb8435`](https://github.com/ckb-devrel/ccc/commit/0eb8435d9694602fce3b7e6a95f04f793452a88d)]:
7
+ - @ckb-ccc/core@1.15.0
8
+
9
+ ## 1.6.0
10
+ ### Minor Changes
11
+
12
+
13
+
14
+ - [#381](https://github.com/ckb-devrel/ccc/pull/381) [`46cc045`](https://github.com/ckb-devrel/ccc/commit/46cc045a3eefe9ba6625482dc7f740a0c59c99d4) Thanks [@Hanssen0](https://github.com/Hanssen0)! - chore: bump packages
15
+
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`46cc045`](https://github.com/ckb-devrel/ccc/commit/46cc045a3eefe9ba6625482dc7f740a0c59c99d4)]:
20
+ - @ckb-ccc/core@1.14.0
21
+
3
22
  ## 1.5.18
4
23
  ### Patch Changes
5
24
 
@@ -0,0 +1,3 @@
1
+ import { A as ActionVec, B as ClusterDataV2, C as MeltSpore, D as TransferClusterProxy, E as TransferClusterAgent, F as ScriptInfo, G as packRawClusterDataV1, H as ClusterDataVersion, I as ScriptInfoVec, J as unpackToRawClusterDataV1, K as packRawClusterDataV2, L as ClusterData, M as BuildingPacketV1, N as Message, O as TransferSpore, P as ResolvedInputs, R as ClusterDataV1, S as MeltClusterProxy, T as TransferCluster, U as ClusterDataView, V as ClusterDataV2View, W as packRawClusterData, Y as unpackToRawClusterDataV2, _ as CreateCluster, b as CreateSpore, c as packRawSporeData, d as OtxStart, f as SighashAll, g as Address, h as WitnessLayoutFieldTags, j as BuildingPacket, k as Action, l as unpackToRawSporeData, m as WitnessLayout, o as SporeData, p as SighashAllOnly, q as unpackToRawClusterData, s as SporeDataView, u as Otx, v as CreateClusterAgent, w as SporeAction, x as MeltClusterAgent, y as CreateClusterProxy, z as ClusterDataV1View } from "./types-DRzFzVRX.mjs";
2
+ import { SCRIPTS_CLUSTER_MAINNET, SCRIPTS_CLUSTER_TESTNET, SCRIPTS_SPORE_MAINNET, SCRIPTS_SPORE_TESTNET, assembleCreateClusterAction, assembleCreateSporeAction, assembleMeltSporeAction, assembleTransferClusterAction, assembleTransferSporeAction, extractCobuildActionsFromTx, injectCobuild, prepareCluster, prepareSporeTransaction, t as advancedBarrel_d_exports, unpackCommonCobuildProof } from "./advancedBarrel.mjs";
3
+ export { Action, ActionVec, Address, BuildingPacket, BuildingPacketV1, ClusterData, ClusterDataV1, ClusterDataV1View, ClusterDataV2, ClusterDataV2View, ClusterDataVersion, ClusterDataView, CreateCluster, CreateClusterAgent, CreateClusterProxy, CreateSpore, MeltClusterAgent, MeltClusterProxy, MeltSpore, Message, Otx, OtxStart, ResolvedInputs, SCRIPTS_CLUSTER_MAINNET, SCRIPTS_CLUSTER_TESTNET, SCRIPTS_SPORE_MAINNET, SCRIPTS_SPORE_TESTNET, ScriptInfo, ScriptInfoVec, SighashAll, SighashAllOnly, SporeAction, SporeData, SporeDataView, TransferCluster, TransferClusterAgent, TransferClusterProxy, TransferSpore, WitnessLayout, WitnessLayoutFieldTags, assembleCreateClusterAction, assembleCreateSporeAction, assembleMeltSporeAction, assembleTransferClusterAction, assembleTransferSporeAction, extractCobuildActionsFromTx, injectCobuild, packRawClusterData, packRawClusterDataV1, packRawClusterDataV2, packRawSporeData, prepareCluster, prepareSporeTransaction, advancedBarrel_d_exports as sporeA, unpackCommonCobuildProof, unpackToRawClusterData, unpackToRawClusterDataV1, unpackToRawClusterDataV2, unpackToRawSporeData };
@@ -0,0 +1 @@
1
+ import{$ as e,B as t,C as n,E as r,F as i,G as a,H as o,I as s,J as c,K as l,L as u,M as d,N as f,P as p,Q as m,R as h,T as g,U as _,V as v,W as y,X as b,Y as x,Z as S,_ as C,at as w,c as T,ct as E,d as D,dt as O,et as k,f as A,ft as j,g as M,h as N,ht as P,it as F,j as I,l as L,lt as R,m as z,mt as B,nt as V,ot as H,p as U,pt as W,q as G,rt as K,st as q,tt as J,u as Y,ut as X,v as Z,w as Q,z as $}from"./cluster-KsFIhwZx.mjs";export{e as Action,k as ActionVec,t as Address,J as BuildingPacket,V as BuildingPacketV1,q as ClusterData,E as ClusterDataV1,R as ClusterDataV2,v as CreateCluster,o as CreateClusterAgent,_ as CreateClusterProxy,y as CreateSpore,a as MeltClusterAgent,l as MeltClusterProxy,G as MeltSpore,K as Message,p as Otx,i as OtxStart,F as ResolvedInputs,g as SCRIPTS_CLUSTER_MAINNET,n as SCRIPTS_CLUSTER_TESTNET,r as SCRIPTS_SPORE_MAINNET,Q as SCRIPTS_SPORE_TESTNET,w as ScriptInfo,H as ScriptInfoVec,s as SighashAll,u as SighashAllOnly,c as SporeAction,I as SporeData,x as TransferCluster,b as TransferClusterAgent,S as TransferClusterProxy,m as TransferSpore,h as WitnessLayout,$ as WitnessLayoutFieldTags,Y as assembleCreateClusterAction,D as assembleCreateSporeAction,A as assembleMeltSporeAction,U as assembleTransferClusterAction,z as assembleTransferSporeAction,N as extractCobuildActionsFromTx,M as injectCobuild,X as packRawClusterData,O as packRawClusterDataV1,j as packRawClusterDataV2,d as packRawSporeData,L as prepareCluster,C as prepareSporeTransaction,T as sporeA,Z as unpackCommonCobuildProof,W as unpackToRawClusterData,B as unpackToRawClusterDataV1,P as unpackToRawClusterDataV2,f as unpackToRawSporeData};
@@ -0,0 +1,30 @@
1
+ import { A as ActionVec, B as ClusterDataV2, C as MeltSpore, D as TransferClusterProxy, E as TransferClusterAgent, F as ScriptInfo, G as packRawClusterDataV1, H as ClusterDataVersion, I as ScriptInfoVec, J as unpackToRawClusterDataV1, K as packRawClusterDataV2, L as ClusterData, M as BuildingPacketV1, N as Message, O as TransferSpore, P as ResolvedInputs, R as ClusterDataV1, S as MeltClusterProxy, T as TransferCluster, U as ClusterDataView, V as ClusterDataV2View, W as packRawClusterData, Y as unpackToRawClusterDataV2, _ as CreateCluster, a as SporeVersion, b as CreateSpore, c as packRawSporeData, d as OtxStart, f as SighashAll, g as Address, h as WitnessLayoutFieldTags, i as SporeScriptInfoLike, j as BuildingPacket, k as Action, l as unpackToRawSporeData, m as WitnessLayout, o as SporeData, p as SighashAllOnly, q as unpackToRawClusterData, s as SporeDataView, u as Otx, v as CreateClusterAgent, w as SporeAction, x as MeltClusterAgent, y as CreateClusterProxy, z as ClusterDataV1View } from "./types-DRzFzVRX.mjs";
2
+ import { ccc } from "@ckb-ccc/core";
3
+
4
+ //#region src/cobuild/index.d.ts
5
+ declare function assembleCreateSporeAction(sporeOutput: ccc.CellOutputLike, sporeData: ccc.BytesLike, scriptInfoHash?: ccc.HexLike): ccc.EncodableType<typeof Action>;
6
+ declare function assembleTransferSporeAction(sporeInput: ccc.CellOutputLike, sporeOutput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): ccc.EncodableType<typeof Action>;
7
+ declare function assembleMeltSporeAction(sporeInput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): ccc.EncodableType<typeof Action>;
8
+ declare function assembleCreateClusterAction(clusterOutput: ccc.CellOutputLike, clusterData: ccc.BytesLike, scriptInfoHash?: ccc.HexLike): ccc.EncodableType<typeof Action>;
9
+ declare function assembleTransferClusterAction(clusterInput: ccc.CellOutputLike, clusterOutput: ccc.CellOutputLike, scriptInfoHash?: ccc.HexLike): ccc.EncodableType<typeof Action>;
10
+ declare function prepareSporeTransaction(signer: ccc.Signer, txLike: ccc.TransactionLike, actions: ccc.EncodableType<typeof ActionVec>): Promise<ccc.Transaction>;
11
+ declare function unpackCommonCobuildProof(data: ccc.HexLike): ccc.EncodableType<typeof WitnessLayout> | undefined;
12
+ declare function extractCobuildActionsFromTx(tx: ccc.Transaction): ccc.EncodableType<typeof ActionVec>;
13
+ declare function injectCobuild(tx: ccc.Transaction, actions: ccc.EncodableType<typeof ActionVec>): void;
14
+ //#endregion
15
+ //#region src/predefined/mainnet.advanced.d.ts
16
+ declare const SCRIPTS_SPORE_MAINNET: Record<SporeVersion, SporeScriptInfoLike | undefined>;
17
+ declare const SCRIPTS_CLUSTER_MAINNET: Record<SporeVersion, SporeScriptInfoLike | undefined>;
18
+ //#endregion
19
+ //#region src/predefined/testnet.advanced.d.ts
20
+ declare const SCRIPTS_SPORE_TESTNET: Record<SporeVersion, SporeScriptInfoLike | undefined>;
21
+ declare const SCRIPTS_CLUSTER_TESTNET: Record<SporeVersion, SporeScriptInfoLike | undefined>;
22
+ //#endregion
23
+ //#region src/spore/advanced.d.ts
24
+ declare function prepareCluster(signer: ccc.Signer, tx: ccc.Transaction, data: SporeDataView, clusterMode?: "lockProxy" | "clusterCell" | "skip", scriptInfoHash?: ccc.HexLike): Promise<ccc.EncodableType<typeof Action> | undefined>;
25
+ declare namespace advancedBarrel_d_exports {
26
+ export { Action, ActionVec, Address, BuildingPacket, BuildingPacketV1, ClusterData, ClusterDataV1, ClusterDataV1View, ClusterDataV2, ClusterDataV2View, ClusterDataVersion, ClusterDataView, CreateCluster, CreateClusterAgent, CreateClusterProxy, CreateSpore, MeltClusterAgent, MeltClusterProxy, MeltSpore, Message, Otx, OtxStart, ResolvedInputs, SCRIPTS_CLUSTER_MAINNET, SCRIPTS_CLUSTER_TESTNET, SCRIPTS_SPORE_MAINNET, SCRIPTS_SPORE_TESTNET, ScriptInfo, ScriptInfoVec, SighashAll, SighashAllOnly, SporeAction, SporeData, SporeDataView, TransferCluster, TransferClusterAgent, TransferClusterProxy, TransferSpore, WitnessLayout, WitnessLayoutFieldTags, assembleCreateClusterAction, assembleCreateSporeAction, assembleMeltSporeAction, assembleTransferClusterAction, assembleTransferSporeAction, extractCobuildActionsFromTx, injectCobuild, packRawClusterData, packRawClusterDataV1, packRawClusterDataV2, packRawSporeData, prepareCluster, prepareSporeTransaction, unpackCommonCobuildProof, unpackToRawClusterData, unpackToRawClusterDataV1, unpackToRawClusterDataV2, unpackToRawSporeData };
27
+ }
28
+ //#endregion
29
+ export { Action, ActionVec, Address, BuildingPacket, BuildingPacketV1, ClusterData, ClusterDataV1, ClusterDataV1View, ClusterDataV2, ClusterDataV2View, ClusterDataVersion, ClusterDataView, CreateCluster, CreateClusterAgent, CreateClusterProxy, CreateSpore, MeltClusterAgent, MeltClusterProxy, MeltSpore, Message, Otx, OtxStart, ResolvedInputs, SCRIPTS_CLUSTER_MAINNET, SCRIPTS_CLUSTER_TESTNET, SCRIPTS_SPORE_MAINNET, SCRIPTS_SPORE_TESTNET, ScriptInfo, ScriptInfoVec, SighashAll, SighashAllOnly, SporeAction, SporeData, SporeDataView, TransferCluster, TransferClusterAgent, TransferClusterProxy, TransferSpore, WitnessLayout, WitnessLayoutFieldTags, assembleCreateClusterAction, assembleCreateSporeAction, assembleMeltSporeAction, assembleTransferClusterAction, assembleTransferSporeAction, extractCobuildActionsFromTx, injectCobuild, packRawClusterData, packRawClusterDataV1, packRawClusterDataV2, packRawSporeData, prepareCluster, prepareSporeTransaction, advancedBarrel_d_exports as t, unpackCommonCobuildProof, unpackToRawClusterData, unpackToRawClusterDataV1, unpackToRawClusterDataV2, unpackToRawSporeData };
30
+ //# sourceMappingURL=advancedBarrel.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advancedBarrel.d.mts","names":[],"sources":["../src/cobuild/index.ts","../src/predefined/mainnet.advanced.ts","../src/predefined/testnet.advanced.ts","../src/spore/advanced.ts","../src/advancedBarrel.ts"],"mappings":";;;;iBASgB,yBAAA,CACd,WAAA,EAAa,GAAA,CAAI,cAAA,EACjB,SAAA,EAAW,GAAA,CAAI,SAAA,EACf,cAAA,GAAgB,GAAA,CAAI,OAAA,GACnB,GAAA,CAAI,aAAA,QAAqB,MAAA;AAAA,iBAwBZ,2BAAA,CACd,UAAA,EAAY,GAAA,CAAI,cAAA,EAChB,WAAA,EAAa,GAAA,CAAI,cAAA,EACjB,cAAA,GAAgB,GAAA,CAAI,OAAA,GACnB,GAAA,CAAI,aAAA,QAAqB,MAAA;AAAA,iBA4BZ,uBAAA,CACd,UAAA,EAAY,GAAA,CAAI,cAAA,EAChB,cAAA,GAAgB,GAAA,CAAI,OAAA,GACnB,GAAA,CAAI,aAAA,QAAqB,MAAA;AAAA,iBAuBZ,2BAAA,CACd,aAAA,EAAe,GAAA,CAAI,cAAA,EACnB,WAAA,EAAa,GAAA,CAAI,SAAA,EACjB,cAAA,GAAgB,GAAA,CAAI,OAAA,GACnB,GAAA,CAAI,aAAA,QAAqB,MAAA;AAAA,iBAwBZ,6BAAA,CACd,YAAA,EAAc,GAAA,CAAI,cAAA,EAClB,aAAA,EAAe,GAAA,CAAI,cAAA,EACnB,cAAA,GAAgB,GAAA,CAAI,OAAA,GACnB,GAAA,CAAI,aAAA,QAAqB,MAAA;AAAA,iBA2BN,uBAAA,CACpB,MAAA,EAAQ,GAAA,CAAI,MAAA,EACZ,MAAA,EAAQ,GAAA,CAAI,eAAA,EACZ,OAAA,EAAS,GAAA,CAAI,aAAA,QAAqB,SAAA,IACjC,OAAA,CAAQ,GAAA,CAAI,WAAA;AAAA,iBAaC,wBAAA,CACd,IAAA,EAAM,GAAA,CAAI,OAAA,GACT,GAAA,CAAI,aAAA,QAAqB,aAAA;AAAA,iBAQZ,2BAAA,CACd,EAAA,EAAI,GAAA,CAAI,WAAA,GACP,GAAA,CAAI,aAAA,QAAqB,SAAA;AAAA,iBAmBZ,aAAA,CACd,EAAA,EAAI,GAAA,CAAI,WAAA,EACR,OAAA,EAAS,GAAA,CAAI,aAAA,QAAqB,SAAA;;;cC1MvB,qBAAA,EAAuB,MAAA,CAClC,YAAA,EACA,mBAAA;AAAA,cA+CW,uBAAA,EAAyB,MAAA,CACpC,YAAA,EACA,mBAAA;;;cCnDW,qBAAA,EAAuB,MAAA,CAClC,YAAA,EACA,mBAAA;AAAA,cA8DW,uBAAA,EAAyB,MAAA,CACpC,YAAA,EACA,mBAAA;;;iBC/DoB,cAAA,CACpB,MAAA,EAAQ,GAAA,CAAI,MAAA,EACZ,EAAA,EAAI,GAAA,CAAI,WAAA,EACR,IAAA,EAAM,aAAA,EACN,WAAA,yCACA,cAAA,GAAiB,GAAA,CAAI,OAAA,GACpB,OAAA,CAAQ,GAAA,CAAI,aAAA,QAAqB,MAAA;AAAA"}
@@ -0,0 +1 @@
1
+ import{$ as e,B as t,C as n,E as r,F as i,G as a,H as o,I as s,J as c,K as l,L as u,M as d,N as f,P as p,Q as m,R as h,T as g,U as _,V as v,W as y,X as b,Y as x,Z as S,_ as C,at as w,ct as T,d as E,dt as D,et as O,f as k,ft as A,g as j,h as M,ht as N,it as P,j as F,l as I,lt as L,m as R,mt as z,nt as B,ot as V,p as H,pt as U,q as W,rt as G,st as K,tt as q,u as J,ut as Y,v as X,w as Z,z as Q}from"./cluster-KsFIhwZx.mjs";export{e as Action,O as ActionVec,t as Address,q as BuildingPacket,B as BuildingPacketV1,K as ClusterData,T as ClusterDataV1,L as ClusterDataV2,v as CreateCluster,o as CreateClusterAgent,_ as CreateClusterProxy,y as CreateSpore,a as MeltClusterAgent,l as MeltClusterProxy,W as MeltSpore,G as Message,p as Otx,i as OtxStart,P as ResolvedInputs,g as SCRIPTS_CLUSTER_MAINNET,n as SCRIPTS_CLUSTER_TESTNET,r as SCRIPTS_SPORE_MAINNET,Z as SCRIPTS_SPORE_TESTNET,w as ScriptInfo,V as ScriptInfoVec,s as SighashAll,u as SighashAllOnly,c as SporeAction,F as SporeData,x as TransferCluster,b as TransferClusterAgent,S as TransferClusterProxy,m as TransferSpore,h as WitnessLayout,Q as WitnessLayoutFieldTags,J as assembleCreateClusterAction,E as assembleCreateSporeAction,k as assembleMeltSporeAction,H as assembleTransferClusterAction,R as assembleTransferSporeAction,M as extractCobuildActionsFromTx,j as injectCobuild,Y as packRawClusterData,D as packRawClusterDataV1,A as packRawClusterDataV2,d as packRawSporeData,I as prepareCluster,C as prepareSporeTransaction,X as unpackCommonCobuildProof,U as unpackToRawClusterData,z as unpackToRawClusterDataV1,N as unpackToRawClusterDataV2,f as unpackToRawSporeData};
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{A as t,D as n,M as r,N as i,S as a,_ as o,a as s,b as c,d as l,f as u,i as d,k as f,l as p,m,n as h,o as g,r as _,s as v,t as y,x as b,y as x}from"./cluster-KsFIhwZx.mjs";import{ccc as S}from"@ckb-ccc/core";import{Axios as C}from"axios";const w={1001:`DnaLengthNotMatch`,1002:`SporeIdLengthInvalid`,1003:`NativeDecoderNotFound`,1004:`SporeIdNotFound`,1005:`SporeDataUncompatible`,1006:`SporeDataContentTypeUncompatible`,1007:`DOBVersionUnexpected`,1008:`ClusterIdNotSet`,1009:`ClusterIdNotFound`,1010:`ClusterDataUncompatible`,1011:`DecoderIdNotFound`,1012:`DecoderOutputInvalid`,1013:`HexedDNAParseError`,1014:`HexedSporeIdParseError`,1015:`DecoderBinaryPathInvalid`,1016:`DecoderExecutionError`,1017:`DecoderExecutionInternalError`,1018:`FetchLiveCellsError`,1019:`FetchTransactionError`,1020:`NoOutputCellInTransaction`,1021:`DOBContentUnexpected`,1022:`DOBMetadataUnexpected`,1023:`DOBRenderCacheNotFound`,1024:`DOBRenderCacheModified`,1025:`DecoderBinaryHashInvalid`,1026:`DecoderBinaryNotFoundInCell`,1027:`JsonRpcRequestError`,1028:`SystemTimeError`,1029:`DecoderHashNotFound`,1030:`DecoderScriptNotFound`,1031:`DecoderChainIsEmpty`};function T(e){let t=Object.keys(w).indexOf(e.toString());if(t<0)throw Error(`Error code ${e} not found`);return Object.values(w)[t]}function E(e){let t=JSON.parse(e);if(`error`in t){let e=T(t.error.code);throw Error(`Decode DOB failed: ${e}`)}let n=JSON.parse(t.result);return JSON.parse(n.render_output)}async function D(e,t){return E((await new C({baseURL:t,method:`POST`,headers:{"Content-Type":`application/json`}}).post(`/`,JSON.stringify({id:0,jsonrpc:`2.0`,method:`dob_decode`,params:[S.hexFrom(e).replace(/^0x/,``)]}))).data)}async function O(e,t){let n=e.type?.args;if(n===void 0)throw Error(`Invalid spore cell: missing spore id`);return D(S.hexFrom(n),t)}async function k(e,t,n){let r=await e.getCell(t);if(!r)throw Error(`Invalid spore outpoint: missing spore cell`);return O(r.cellOutput,n)}async function A(e,t,n){return E((await new C({baseURL:n,method:`POST`,headers:{"Content-Type":`application/json`}}).post(`/`,JSON.stringify({id:0,jsonrpc:`2.0`,method:`dob_raw_decode`,params:[S.hexFrom(e),S.hexFrom(t)]}))).data)}function j(e){if((e.type===`code_hash`||e.type===`type_id`)&&e.hash===void 0)throw Error(`Invalid decoder: 'hash' is required for 'code_hash' and 'type_id'`);if(e.type===`type_script`&&e.script===void 0)throw Error(`Invalid decoder: 'script' is required for 'type_script'`)}function M(e){switch(e.patternType){case`options`:if(e.traitArgs===void 0)throw Error(`Invalid pattern: 'traitArgs' is required for 'options'`);if(e.traitArgs.length===0)throw Error(`Invalid pattern: 'traitArgs' should not be empty for 'options'`);break;case`range`:if(e.traitArgs===void 0)throw Error(`Invalid pattern: 'traitArgs' is required for 'range'`);if(e.traitArgs.length!==2||e.traitArgs.filter(e=>typeof e==`number`).length!==2)throw Error(`Invalid pattern: 'traitArgs' should contain exactly 2 numbers for 'range'`);break}if(e.dnaLength===0)throw Error(`Invalid pattern: 'dnaLength' should be greater than 0`)}function N(e){switch(e.patternType){case`options`:if(!Array.isArray(e.traitArgs))throw Error(`Invalid pattern: 'traitArgs' should be an array for 'options'`);for(let t of e.traitArgs){if(t.length!==2)throw Error(`Invalid pattern: 'traitArgs' should contain exactly 2 elements for 'options'`);if(typeof t[0]!=`string`&&(!Array.isArray(t[0])||t[0].length===1&&t[0][0]!==`*`||t[0].length===2&&(typeof t[0][0]!=`number`||typeof t[0][1]!=`number`)||t[0].length===0||t[0].length>2))throw Error(`Invalid pattern: 'traitArgs[0]' should be a string or an array that contains only 2 numbers or the '*' for 'options'`);if(typeof t[1]!=`string`)throw Error(`Invalid pattern: 'traitArgs[1]' should be a string for 'options'`)}break;case`raw`:if(e.traitName!==``||typeof e.traitArgs!=`string`)throw Error(`Invalid pattern: 'traitName' should be empty and 'traitArgs' should be a string for 'raw'`);break}}function P(e){let t=S.bytesFrom(JSON.stringify(e),`utf8`),n=new ArrayBuffer(t.byteLength);return new Uint8Array(n).set(t),n}function F(e){return j(e.dob.decoder),e.dob.pattern.forEach(e=>{M(e),e.toJSON=function(){return e.traitArgs?[e.traitName,e.dobType,e.dnaOffset,e.dnaLength,e.patternType,e.traitArgs]:[e.traitName,e.dobType,e.dnaOffset,e.dnaLength,e.patternType]}}),JSON.stringify(e)}function I(e){return e.dob.decoders.forEach(e=>{j(e.decoder),e.pattern.forEach(e=>{`dnaOffset`in e?(M(e),e.toJSON=function(){return e.traitArgs?[e.traitName,e.dobType,e.dnaOffset,e.dnaLength,e.patternType,e.traitArgs]:[e.traitName,e.dobType,e.dnaOffset,e.dnaLength,e.patternType]}):(N(e),e.toJSON=()=>[e.imageName,e.svgFields,e.traitName,e.patternType,e.traitArgs])})}),JSON.stringify(e)}const L=Object.freeze({dob0:{type:`code_hash`,hash:`0x13cac78ad8482202f18f9df4ea707611c35f994375fa03ae79121312dda9925c`},dob1:{type:`code_hash`,hash:`0xda3525549b72970b4c95f5b5749357f20d1293d335710b674f09c32f7d54b6dc`}}),R=Object.freeze({dob0:{type:`code_hash`,hash:`0x13cac78ad8482202f18f9df4ea707611c35f994375fa03ae79121312dda9925c`},dob1:{type:`code_hash`,hash:`0xda3525549b72970b4c95f5b5749357f20d1293d335710b674f09c32f7d54b6dc`}});function z(e,t,n){return n?n[t]:e.addressPrefix===`ckb`?R[t]:L[t]}var B=e({DOB_MAINNET_DECODERS:()=>R,DOB_TESTNET_DECODERS:()=>L,checkDecoder:()=>j,checkPatternDob0:()=>M,checkPatternDob1:()=>N,decodeDobByRawData:()=>A,decodeDobBySporeCell:()=>O,decodeDobBySporeId:()=>D,decodeDobBySporeOutpoint:()=>k,encodeClusterDescriptionForDob0:()=>F,encodeClusterDescriptionForDob1:()=>I,encodeDna:()=>P,extractDobFromDecoderResult:()=>E,getDecoder:()=>z,getErrorByCode:()=>T});async function V(e,t,n){let r=await v(e,t,n??Object.values(a(e)));if(r)return{cell:r.cell,spore:r.cell,sporeData:i(r.cell.outputData),scriptInfo:r.scriptInfo}}async function H(e,t,n){let r=await V(e,t,n);if(!r)throw Error(`Spore ${S.hexFrom(t)} not found`);return r}async function U(e){let{signer:t,data:n,to:i,clusterMode:a,scriptInfoHash:s}=e,c=e.scriptInfo??b(t.client),u=[],d=[],f=S.Transaction.from(e.tx??{});await f.completeInputsAtLeastOne(t);let{script:m}=await t.getRecommendedAddressObj(),h=S.hashTypeId(f.inputs[0],f.outputs.length);d.push(h);let g=r(n);if(f.addOutput({lock:i??m,type:{...c,args:h}},g),c.cobuild){let e=f.outputs[f.outputs.length-1],t=l(e,g,s);u.push(t)}await f.addCellDepInfos(t.client,c.cellDeps);let _=await p(t,f,n,a);return _&&u.push(_),{tx:await o(t,f,u),id:h}}async function W(e){let{signer:t,id:n,to:r,scripts:i,scriptInfoHash:a}=e,s=S.Transaction.from(e.tx??{}),{cell:c,scriptInfo:l}=await H(t.client,n,i);return await s.addCellDepInfos(t.client,l.cellDeps),s.addInput(c),s.addOutput({lock:r,type:c.cellOutput.type},c.outputData),{tx:await o(t,s,l.cobuild?[m(c.cellOutput,s.outputs[s.outputs.length-1],a)]:[])}}async function G(e){let{signer:t,id:n,scripts:r,scriptInfoHash:i}=e,a=S.Transaction.from(e.tx??{}),{cell:s,scriptInfo:c}=await H(t.client,n,r);return await a.addCellDepInfos(t.client,c.cellDeps),a.addInput(s),{tx:await o(t,a,c.cobuild?[u(s.cellOutput,i)]:[])}}async function*K(e){let{signer:t,clusterId:n,scriptInfos:r,limit:o,order:s}=e;for(let e of r??Object.values(a(t.client)))if(e)for await(let r of t.findCells({script:{...e,args:[]}},!0,s,o)){let t=i(r.outputData);(!n||n===``&&!t.clusterId||t.clusterId===S.hexFrom(n))&&(yield{cell:r,spore:r,sporeData:t,scriptInfo:f.from(e)})}}async function*q(e){let{client:t,lock:n,clusterId:r,scriptInfos:o,limit:s,order:c}=e;for(let e of o??Object.values(a(t)))if(e)for await(let a of t.findCells({script:{...e,args:[]},scriptType:`type`,scriptSearchMode:`prefix`,withData:!0,filter:n?{script:n}:void 0},c,s)){let t=i(a.outputData);(!r||r===``&&!t.clusterId||t.clusterId===S.hexFrom(r))&&(yield{cell:a,spore:a,sporeData:t,scriptInfo:f.from(e)})}}var J=e({DEFAULT_COBUILD_INFO_HASH:()=>n,SPORE_VERSION_DEFAULT:()=>`V2`,SporeScriptInfo:()=>f,SporeVersion:()=>t,assertCluster:()=>y,assertSpore:()=>H,createSpore:()=>U,createSporeCluster:()=>h,dob:()=>B,findCluster:()=>_,findSpore:()=>V,findSporeClusters:()=>d,findSporeClustersBySigner:()=>s,findSpores:()=>q,findSporesBySigner:()=>K,getClusterScriptInfo:()=>x,getClusterScriptInfos:()=>c,getSporeScriptInfo:()=>b,getSporeScriptInfos:()=>a,meltSpore:()=>G,transferSpore:()=>W,transferSporeCluster:()=>g});export{q as a,W as c,V as i,B as l,H as n,K as o,U as r,G as s,J as t};
2
+ //# sourceMappingURL=barrel-C4fV1nUf.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barrel-C4fV1nUf.mjs","names":[],"sources":["../src/dob/helper/error.ts","../src/dob/api/decode.ts","../src/dob/helper/check.ts","../src/dob/api/encode.ts","../src/dob/config/predefined.ts","../src/dob/index.ts","../src/spore/index.ts","../src/barrel.ts"],"sourcesContent":["const errors = {\n 1001: \"DnaLengthNotMatch\",\n 1002: \"SporeIdLengthInvalid\",\n 1003: \"NativeDecoderNotFound\",\n 1004: \"SporeIdNotFound\",\n 1005: \"SporeDataUncompatible\",\n 1006: \"SporeDataContentTypeUncompatible\",\n 1007: \"DOBVersionUnexpected\",\n 1008: \"ClusterIdNotSet\",\n 1009: \"ClusterIdNotFound\",\n 1010: \"ClusterDataUncompatible\",\n 1011: \"DecoderIdNotFound\",\n 1012: \"DecoderOutputInvalid\",\n 1013: \"HexedDNAParseError\",\n 1014: \"HexedSporeIdParseError\",\n 1015: \"DecoderBinaryPathInvalid\",\n 1016: \"DecoderExecutionError\",\n 1017: \"DecoderExecutionInternalError\",\n 1018: \"FetchLiveCellsError\",\n 1019: \"FetchTransactionError\",\n 1020: \"NoOutputCellInTransaction\",\n 1021: \"DOBContentUnexpected\",\n 1022: \"DOBMetadataUnexpected\",\n 1023: \"DOBRenderCacheNotFound\",\n 1024: \"DOBRenderCacheModified\",\n 1025: \"DecoderBinaryHashInvalid\",\n 1026: \"DecoderBinaryNotFoundInCell\",\n 1027: \"JsonRpcRequestError\",\n 1028: \"SystemTimeError\",\n 1029: \"DecoderHashNotFound\",\n 1030: \"DecoderScriptNotFound\",\n 1031: \"DecoderChainIsEmpty\",\n};\n\nexport function getErrorByCode(code: number): string {\n const errorIndex = Object.keys(errors).indexOf(code.toString());\n if (errorIndex < 0) {\n throw new Error(`Error code ${code} not found`);\n }\n return Object.values(errors)[errorIndex];\n}\n","import { ccc } from \"@ckb-ccc/core\";\nimport { Axios } from \"axios\";\nimport { getErrorByCode } from \"../helper/error.js\";\nimport { RenderOutput } from \"../helper/object.js\";\n\nexport function extractDobFromDecoderResult(result: string): RenderOutput {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const decoderResult = JSON.parse(result);\n if (\"error\" in decoderResult) {\n const serverError = getErrorByCode(decoderResult.error.code as number);\n throw new Error(`Decode DOB failed: ${serverError}`);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument\n const renderResult = JSON.parse(decoderResult.result);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument\n const renderOutput = JSON.parse(renderResult.render_output);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return renderOutput;\n}\n\nexport async function decodeDobBySporeId(\n sporeId: ccc.HexLike,\n dobServerUrl: string,\n): Promise<RenderOutput> {\n const axios = new Axios({\n baseURL: dobServerUrl,\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n });\n const result = await axios.post(\n \"/\",\n JSON.stringify({\n id: 0,\n jsonrpc: \"2.0\",\n method: \"dob_decode\",\n params: [ccc.hexFrom(sporeId).replace(/^0x/, \"\")],\n }),\n );\n return extractDobFromDecoderResult(result.data as string);\n}\n\nexport async function decodeDobBySporeCell(\n sporeOutput: ccc.CellOutputLike,\n dobServerUrl: string,\n): Promise<RenderOutput> {\n const sporeId = sporeOutput.type?.args;\n if (sporeId === undefined) {\n throw new Error(\"Invalid spore cell: missing spore id\");\n }\n return decodeDobBySporeId(ccc.hexFrom(sporeId), dobServerUrl);\n}\n\nexport async function decodeDobBySporeOutpoint(\n client: ccc.Client,\n sporeOutpoint: ccc.OutPointLike,\n dobServerUrl: string,\n): Promise<RenderOutput> {\n const liveCell = await client.getCell(sporeOutpoint);\n if (!liveCell) {\n throw new Error(\"Invalid spore outpoint: missing spore cell\");\n }\n return decodeDobBySporeCell(liveCell.cellOutput, dobServerUrl);\n}\n\nexport async function decodeDobByRawData(\n sporeCellData: ccc.HexLike,\n clusterCellData: ccc.HexLike,\n dobServerUrl: string,\n): Promise<RenderOutput> {\n const axios = new Axios({\n baseURL: dobServerUrl,\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n });\n const result = await axios.post(\n \"/\",\n JSON.stringify({\n id: 0,\n jsonrpc: \"2.0\",\n method: \"dob_raw_decode\",\n params: [ccc.hexFrom(sporeCellData), ccc.hexFrom(clusterCellData)],\n }),\n );\n return extractDobFromDecoderResult(result.data as string);\n}\n","import { Decoder, PatternElementDob0, PatternElementDob1 } from \"./object.js\";\n\nexport function checkDecoder(decoder: Decoder) {\n if (decoder.type === \"code_hash\" || decoder.type === \"type_id\") {\n if (decoder.hash === undefined) {\n throw new Error(\n \"Invalid decoder: 'hash' is required for 'code_hash' and 'type_id'\",\n );\n }\n }\n if (decoder.type === \"type_script\" && decoder.script === undefined) {\n throw new Error(\"Invalid decoder: 'script' is required for 'type_script'\");\n }\n}\n\nexport function checkPatternDob0(value: PatternElementDob0) {\n switch (value.patternType) {\n case \"options\": {\n if (value.traitArgs === undefined) {\n throw new Error(\n \"Invalid pattern: 'traitArgs' is required for 'options'\",\n );\n }\n if (value.traitArgs.length === 0) {\n throw new Error(\n \"Invalid pattern: 'traitArgs' should not be empty for 'options'\",\n );\n }\n break;\n }\n case \"range\": {\n if (value.traitArgs === undefined) {\n throw new Error(\"Invalid pattern: 'traitArgs' is required for 'range'\");\n }\n if (\n value.traitArgs.length !== 2 ||\n value.traitArgs.filter((v) => typeof v === \"number\").length !== 2\n ) {\n throw new Error(\n \"Invalid pattern: 'traitArgs' should contain exactly 2 numbers for 'range'\",\n );\n }\n break;\n }\n }\n if (value.dnaLength === 0) {\n throw new Error(\"Invalid pattern: 'dnaLength' should be greater than 0\");\n }\n}\n\nexport function checkPatternDob1(value: PatternElementDob1) {\n switch (value.patternType) {\n case \"options\": {\n if (!Array.isArray(value.traitArgs)) {\n throw new Error(\n \"Invalid pattern: 'traitArgs' should be an array for 'options'\",\n );\n }\n for (const args of value.traitArgs) {\n if (args.length !== 2) {\n throw new Error(\n \"Invalid pattern: 'traitArgs' should contain exactly 2 elements for 'options'\",\n );\n }\n if (typeof args[0] !== \"string\") {\n if (!Array.isArray(args[0])) {\n throw new Error(\n \"Invalid pattern: 'traitArgs[0]' should be a string or an array that contains only 2 numbers or the '*' for 'options'\",\n );\n }\n if (args[0].length === 1 && args[0][0] !== \"*\") {\n throw new Error(\n \"Invalid pattern: 'traitArgs[0]' should be a string or an array that contains only 2 numbers or the '*' for 'options'\",\n );\n }\n if (\n args[0].length === 2 &&\n (typeof args[0][0] !== \"number\" || typeof args[0][1] !== \"number\")\n ) {\n throw new Error(\n \"Invalid pattern: 'traitArgs[0]' should be a string or an array that contains only 2 numbers or the '*' for 'options'\",\n );\n }\n if (args[0].length === 0 || args[0].length > 2) {\n throw new Error(\n \"Invalid pattern: 'traitArgs[0]' should be a string or an array that contains only 2 numbers or the '*' for 'options'\",\n );\n }\n }\n if (typeof args[1] !== \"string\") {\n throw new Error(\n \"Invalid pattern: 'traitArgs[1]' should be a string for 'options'\",\n );\n }\n }\n break;\n }\n case \"raw\": {\n if (value.traitName !== \"\" || typeof value.traitArgs !== \"string\") {\n throw new Error(\n \"Invalid pattern: 'traitName' should be empty and 'traitArgs' should be a string for 'raw'\",\n );\n }\n break;\n }\n }\n}\n","import { ccc } from \"@ckb-ccc/core\";\nimport {\n checkDecoder,\n checkPatternDob0,\n checkPatternDob1,\n DNA,\n Dob0,\n Dob1,\n} from \"../helper/index.js\";\n\nexport function encodeDna(dna: DNA): ArrayBuffer {\n const data = ccc.bytesFrom(JSON.stringify(dna), \"utf8\");\n const arrayBuffer = new ArrayBuffer(data.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n view.set(data);\n return arrayBuffer;\n}\n\nexport function encodeClusterDescriptionForDob0(dob0: Dob0): string {\n checkDecoder(dob0.dob.decoder);\n dob0.dob.pattern.forEach((v) => {\n checkPatternDob0(v);\n v.toJSON = function () {\n if (v.traitArgs) {\n return [\n v.traitName,\n v.dobType,\n v.dnaOffset,\n v.dnaLength,\n v.patternType,\n v.traitArgs,\n ];\n } else {\n return [\n v.traitName,\n v.dobType,\n v.dnaOffset,\n v.dnaLength,\n v.patternType,\n ];\n }\n };\n });\n return JSON.stringify(dob0);\n}\n\nexport function encodeClusterDescriptionForDob1(dob1: Dob1): string {\n dob1.dob.decoders.forEach((value) => {\n checkDecoder(value.decoder);\n value.pattern.forEach((v) => {\n if (\"dnaOffset\" in v) {\n checkPatternDob0(v);\n v.toJSON = function () {\n if (v.traitArgs) {\n return [\n v.traitName,\n v.dobType,\n v.dnaOffset,\n v.dnaLength,\n v.patternType,\n v.traitArgs,\n ];\n } else {\n return [\n v.traitName,\n v.dobType,\n v.dnaOffset,\n v.dnaLength,\n v.patternType,\n ];\n }\n };\n } else {\n checkPatternDob1(v);\n v.toJSON = () => {\n return [\n v.imageName,\n v.svgFields,\n v.traitName,\n v.patternType,\n v.traitArgs,\n ];\n };\n }\n });\n });\n return JSON.stringify(dob1);\n}\n","import { ccc } from \"@ckb-ccc/core\";\nimport { Decoder } from \"../helper/index.js\";\n\nexport type DobType = \"dob0\" | \"dob1\";\nexport type DobScriptInfo = Record<DobType, Decoder>;\n\nexport const DOB_TESTNET_DECODERS: DobScriptInfo = Object.freeze({\n [\"dob0\"]: {\n type: \"code_hash\",\n hash: \"0x13cac78ad8482202f18f9df4ea707611c35f994375fa03ae79121312dda9925c\",\n },\n // another avaliable options:\n // {\n // type: \"type_id\",\n // hash: \"0x784e32cef202b9d4759ea96e80d806f94051e8069fd34d761f452553700138d7\",\n // }\n // or\n // {\n // type: \"type_script\",\n // script: {\n // code_hash:\n // \"0x00000000000000000000000000000000000000000000000000545950455f4944\",\n // hash_type: \"type\",\n // args: \"0x784e32cef202b9d4759ea96e80d806f94051e8069fd34d761f452553700138d7\",\n // }\n // }\n [\"dob1\"]: {\n type: \"code_hash\",\n hash: \"0xda3525549b72970b4c95f5b5749357f20d1293d335710b674f09c32f7d54b6dc\",\n },\n});\n\nexport const DOB_MAINNET_DECODERS: DobScriptInfo = Object.freeze({\n [\"dob0\"]: {\n type: \"code_hash\",\n hash: \"0x13cac78ad8482202f18f9df4ea707611c35f994375fa03ae79121312dda9925c\",\n },\n // another avaliable options:\n // {\n // type: \"type_id\",\n // hash: \"0x8892bea4405a1f077921799bc0f4516e0ebaef7aea0dfc6614a8898fb47d5372\",\n // },\n // or\n // {\n // type: \"type_script\",\n // script: {\n // code_hash:\n // \"0x00000000000000000000000000000000000000000000000000545950455f4944\",\n // hash_type: \"type\",\n // args: \"0x8892bea4405a1f077921799bc0f4516e0ebaef7aea0dfc6614a8898fb47d5372\",\n // }\n // }\n [\"dob1\"]: {\n type: \"code_hash\",\n hash: \"0xda3525549b72970b4c95f5b5749357f20d1293d335710b674f09c32f7d54b6dc\",\n },\n});\n\nexport function getDecoder(\n client: ccc.Client,\n dobType: DobType,\n dobScriptInfo?: DobScriptInfo,\n): Decoder {\n if (dobScriptInfo) {\n return dobScriptInfo[dobType];\n }\n if (client.addressPrefix === \"ckb\") {\n return DOB_MAINNET_DECODERS[dobType];\n }\n return DOB_TESTNET_DECODERS[dobType];\n}\n","export * from \"./api/index.js\";\nexport * from \"./config/index.js\";\nexport * from \"./helper/index.js\";\n","import { ccc } from \"@ckb-ccc/core\";\nimport {\n assembleCreateSporeAction,\n assembleMeltSporeAction,\n assembleTransferSporeAction,\n prepareSporeTransaction,\n} from \"../advanced.js\";\nimport {\n SporeDataView,\n packRawSporeData,\n unpackToRawSporeData,\n} from \"../codec/index.js\";\nimport { findSingletonCellByArgs } from \"../helper/index.js\";\nimport {\n SporeScriptInfo,\n SporeScriptInfoLike,\n getSporeScriptInfo,\n getSporeScriptInfos,\n} from \"../predefined/index.js\";\nimport { prepareCluster } from \"./advanced.js\";\n\nexport async function findSpore(\n client: ccc.Client,\n id: ccc.HexLike,\n scripts?: SporeScriptInfoLike[],\n): Promise<\n | {\n cell: ccc.Cell;\n spore: ccc.Cell;\n sporeData: SporeDataView;\n scriptInfo: SporeScriptInfo;\n }\n | undefined\n> {\n const found = await findSingletonCellByArgs(\n client,\n id,\n scripts ?? Object.values(getSporeScriptInfos(client)),\n );\n if (!found) {\n return undefined;\n }\n\n return {\n cell: found.cell,\n spore: found.cell,\n sporeData: unpackToRawSporeData(found.cell.outputData),\n scriptInfo: found.scriptInfo,\n };\n}\n\nexport async function assertSpore(\n client: ccc.Client,\n args: ccc.HexLike,\n scripts?: SporeScriptInfoLike[],\n): Promise<{\n cell: ccc.Cell;\n scriptInfo: SporeScriptInfo;\n}> {\n const res = await findSpore(client, args, scripts);\n\n if (!res) {\n throw new Error(`Spore ${ccc.hexFrom(args)} not found`);\n }\n\n return res;\n}\n\n/**\n * Create one Spore cell with the specified Spore data.\n *\n * @param params.signer who takes the responsibility to balance and sign the transaction\n * @param params.data specific format of data required by Spore protocol\n * @param params.to owner of new spore cell, signer if no provided\n * @param params.clusterMode how to process cluster cell **(if clusterId is not provided in SporeData, this parameter will be ignored)**\n * - undefined: error if the spore has a cluster but the clusterMode is not set\n * - lockProxy: put a cell that uses the same lock from Cluster cell in both Inputs and Outputs\n * - clusterCell: directly put Cluster cell in Inputs and Outputs\n * - skip: don't handle the cluster logic\n * @param params.tx the transaction skeleton, if not provided, a new one will be created\n * @param params.scriptInfo the script info of Spore cell, if not provided, the default script info will be used\n * @param params.scriptInfoHash the script info hash used in cobuild\n * @returns\n * - **tx**: a new transaction that contains created Spore cells\n * - **id**: the sporeId of created Spore cell\n */\nexport async function createSpore(params: {\n signer: ccc.Signer;\n data: SporeDataView;\n to?: ccc.ScriptLike;\n clusterMode?: \"lockProxy\" | \"clusterCell\" | \"skip\";\n tx?: ccc.TransactionLike;\n scriptInfo?: SporeScriptInfoLike;\n scriptInfoHash?: ccc.HexLike;\n}): Promise<{\n tx: ccc.Transaction;\n id: ccc.Hex;\n}> {\n const { signer, data, to, clusterMode, scriptInfoHash } = params;\n const scriptInfo = params.scriptInfo ?? getSporeScriptInfo(signer.client);\n\n // prepare transaction\n const actions = [];\n const ids: ccc.Hex[] = [];\n const tx = ccc.Transaction.from(params.tx ?? {});\n await tx.completeInputsAtLeastOne(signer);\n\n const { script: lock } = await signer.getRecommendedAddressObj();\n\n // build spore cell\n const id = ccc.hashTypeId(tx.inputs[0], tx.outputs.length);\n ids.push(id);\n\n const packedData = packRawSporeData(data);\n tx.addOutput(\n {\n lock: to ?? lock,\n type: {\n ...scriptInfo,\n args: id,\n },\n },\n packedData,\n );\n\n // create spore action\n if (scriptInfo.cobuild) {\n const output = tx.outputs[tx.outputs.length - 1];\n const createAction = assembleCreateSporeAction(\n output,\n packedData,\n scriptInfoHash,\n );\n actions.push(createAction);\n }\n\n // complete cellDeps\n await tx.addCellDepInfos(signer.client, scriptInfo.cellDeps);\n\n const action = await prepareCluster(signer, tx, data, clusterMode);\n if (action) {\n actions.push(action);\n }\n\n return {\n tx: await prepareSporeTransaction(signer, tx, actions),\n id,\n };\n}\n\n/**\n * Transfer one Spore cell\n *\n * @param params.signer who takes the responsibility to balance and sign the transaction\n * @param params.id sporeId\n * @param params.to Spore's new owner\n * @param params.tx the transaction skeleton, if not provided, a new one will be created\n * @param params.scriptInfoHash the script info hash used in cobuild\n * @returns\n * - **tx**: a new transaction that contains transferred Spore cells\n */\nexport async function transferSpore(params: {\n signer: ccc.Signer;\n id: ccc.HexLike;\n to: ccc.ScriptLike;\n tx?: ccc.TransactionLike;\n scripts?: SporeScriptInfoLike[];\n scriptInfoHash?: ccc.HexLike;\n}): Promise<{\n tx: ccc.Transaction;\n}> {\n const { signer, id, to, scripts, scriptInfoHash } = params;\n\n // prepare transaction\n const tx = ccc.Transaction.from(params.tx ?? {});\n\n const { cell: sporeCell, scriptInfo: sporeScriptInfo } = await assertSpore(\n signer.client,\n id,\n scripts,\n );\n await tx.addCellDepInfos(signer.client, sporeScriptInfo.cellDeps);\n tx.addInput(sporeCell);\n tx.addOutput(\n {\n lock: to,\n type: sporeCell.cellOutput.type,\n },\n sporeCell.outputData,\n );\n\n const actions = sporeScriptInfo.cobuild\n ? [\n assembleTransferSporeAction(\n sporeCell.cellOutput,\n tx.outputs[tx.outputs.length - 1],\n scriptInfoHash,\n ),\n ]\n : [];\n\n return {\n tx: await prepareSporeTransaction(signer, tx, actions),\n };\n}\n\n/**\n * Melt one Spore cell\n *\n * @param params.signer who takes the responsibility to balance and sign the transaction\n * @param params.id sporeId to be melted\n * @param params.tx the transaction skeleton, if not provided, a new one will be created\n * @param params.scriptInfoHash the script info hash used in cobuild\n * @returns\n * - **tx**: a new transaction that contains melted Spore cell\n */\nexport async function meltSpore(params: {\n signer: ccc.Signer;\n id: ccc.HexLike;\n tx?: ccc.TransactionLike;\n scripts?: SporeScriptInfoLike[];\n scriptInfoHash?: ccc.HexLike;\n}): Promise<{\n tx: ccc.Transaction;\n}> {\n const { signer, id, scripts, scriptInfoHash } = params;\n\n // prepare transaction\n const tx = ccc.Transaction.from(params.tx ?? {});\n\n // build spore cell\n const { cell: sporeCell, scriptInfo: sporeScriptInfo } = await assertSpore(\n signer.client,\n id,\n scripts,\n );\n await tx.addCellDepInfos(signer.client, sporeScriptInfo.cellDeps);\n tx.addInput(sporeCell);\n\n const actions = sporeScriptInfo.cobuild\n ? [assembleMeltSporeAction(sporeCell.cellOutput, scriptInfoHash)]\n : [];\n\n return {\n tx: await prepareSporeTransaction(signer, tx, actions),\n };\n}\n\n/**\n * Search on-chain spores under the signer's control, if cluster provided, filter spores belonging to this cluster\n *\n * @param params.signer the owner of spores\n * @param params.order the order in creation time of spores\n * @param params.clusterId the cluster that spores belong to. \"\" to find public spores\n * @param params.scriptInfos the deployed script infos of spores\n * @returns specified spore cells\n */\nexport async function* findSporesBySigner(params: {\n signer: ccc.Signer;\n order?: \"asc\" | \"desc\";\n limit?: number;\n clusterId?: ccc.HexLike;\n scriptInfos?: SporeScriptInfoLike[];\n}): AsyncGenerator<{\n cell: ccc.Cell;\n spore: ccc.Cell;\n sporeData: SporeDataView;\n scriptInfo: SporeScriptInfo;\n}> {\n const { signer, clusterId, scriptInfos, limit, order } = params;\n for (const scriptInfo of scriptInfos ??\n Object.values(getSporeScriptInfos(signer.client))) {\n if (!scriptInfo) {\n continue;\n }\n for await (const spore of signer.findCells(\n {\n script: {\n ...scriptInfo,\n args: [],\n },\n },\n true,\n order,\n limit,\n )) {\n const sporeData = unpackToRawSporeData(spore.outputData);\n if (\n !clusterId ||\n (clusterId === \"\" && !sporeData.clusterId) ||\n sporeData.clusterId === ccc.hexFrom(clusterId)\n ) {\n yield {\n cell: spore,\n spore,\n sporeData,\n scriptInfo: SporeScriptInfo.from(scriptInfo),\n };\n }\n }\n }\n}\n\n/**\n * Search on-chain spores under the specified lock or not, if cluster provided, filter spores belonging to this cluster\n *\n * @param params.client the client to search spores\n * @param params.lock the lock of spores\n * @param params.clusterId the cluster that spores belong to. \"\" to find public spores\n * @param params.scriptInfos the deployed script infos of spores\n * @param params.limit the limit of spores to search\n * @param params.order the order in creation time of spores\n * @returns specified spore cells\n */\nexport async function* findSpores(params: {\n client: ccc.Client;\n lock?: ccc.ScriptLike;\n clusterId?: ccc.HexLike;\n scriptInfos?: SporeScriptInfoLike[];\n limit?: number;\n order?: \"asc\" | \"desc\";\n}): AsyncGenerator<{\n cell: ccc.Cell;\n spore: ccc.Cell;\n sporeData: SporeDataView;\n scriptInfo: SporeScriptInfo;\n}> {\n const { client, lock, clusterId, scriptInfos, limit, order } = params;\n for (const scriptInfo of scriptInfos ??\n Object.values(getSporeScriptInfos(client))) {\n if (!scriptInfo) {\n continue;\n }\n for await (const spore of client.findCells(\n {\n script: {\n ...scriptInfo,\n args: [],\n },\n scriptType: \"type\",\n scriptSearchMode: \"prefix\",\n withData: true,\n filter: lock\n ? {\n script: lock,\n }\n : undefined,\n },\n order,\n limit,\n )) {\n const sporeData = unpackToRawSporeData(spore.outputData);\n if (\n !clusterId ||\n (clusterId === \"\" && !sporeData.clusterId) ||\n sporeData.clusterId === ccc.hexFrom(clusterId)\n ) {\n yield {\n cell: spore,\n spore,\n sporeData,\n scriptInfo: SporeScriptInfo.from(scriptInfo),\n };\n }\n }\n }\n}\n","export * from \"./cluster/index.js\";\nexport * as dob from \"./dob/index.js\";\nexport * from \"./predefined/index.js\";\nexport * from \"./spore/index.js\";\n"],"mappings":"wSAAA,MAAM,EAAS,CACb,KAAM,oBACN,KAAM,uBACN,KAAM,wBACN,KAAM,kBACN,KAAM,wBACN,KAAM,mCACN,KAAM,uBACN,KAAM,kBACN,KAAM,oBACN,KAAM,0BACN,KAAM,oBACN,KAAM,uBACN,KAAM,qBACN,KAAM,yBACN,KAAM,2BACN,KAAM,wBACN,KAAM,gCACN,KAAM,sBACN,KAAM,wBACN,KAAM,4BACN,KAAM,uBACN,KAAM,wBACN,KAAM,yBACN,KAAM,yBACN,KAAM,2BACN,KAAM,8BACN,KAAM,sBACN,KAAM,kBACN,KAAM,sBACN,KAAM,wBACN,KAAM,qBACR,EAEA,SAAgB,EAAe,EAAsB,CACnD,IAAM,EAAa,OAAO,KAAK,CAAM,CAAC,CAAC,QAAQ,EAAK,SAAS,CAAC,EAC9D,GAAI,EAAa,EACf,MAAU,MAAM,cAAc,EAAK,WAAW,EAEhD,OAAO,OAAO,OAAO,CAAM,CAAC,CAAC,EAC/B,CCnCA,SAAgB,EAA4B,EAA8B,CAExE,IAAM,EAAgB,KAAK,MAAM,CAAM,EACvC,GAAI,UAAW,EAAe,CAC5B,IAAM,EAAc,EAAe,EAAc,MAAM,IAAc,EACrE,MAAU,MAAM,sBAAsB,GAAa,CACrD,CAEA,IAAM,EAAe,KAAK,MAAM,EAAc,MAAM,EAIpD,OAFqB,KAAK,MAAM,EAAa,aAE3B,CACpB,CAEA,eAAsB,EACpB,EACA,EACuB,CAiBvB,OAAO,GAA4B,MATd,IAPH,EAAM,CACtB,QAAS,EACT,OAAQ,OACR,QAAS,CACP,eAAgB,kBAClB,CACF,CACyB,CAAC,CAAC,KACzB,IACA,KAAK,UAAU,CACb,GAAI,EACJ,QAAS,MACT,OAAQ,aACR,OAAQ,CAAC,EAAI,QAAQ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uB,EAAW,EAY/B,CACD,GAAM,CAAE,SAAQ,OAAM,YAAW,cAAa,QAAO,SAAU,EAC/D,IAAK,IAAM,KAAc,GACvB,OAAO,OAAO,EAAoB,CAAM,CAAC,EACpC,KAGL,UAAW,IAAM,KAAS,EAAO,UAC/B,CACE,OAAQ,CACN,GAAG,EACH,KAAM,CAAC,CACT,EACA,WAAY,OACZ,iBAAkB,SAClB,SAAU,GACV,OAAQ,EACJ,CACE,OAAQ,CACV,EACA,IAAA,EACN,EACA,EACA,CACF,EAAG,CACD,IAAM,EAAY,EAAqB,EAAM,UAAU,GAErD,CAAC,GACA,IAAc,IAAM,CAAC,EAAU,WAChC,EAAU,YAAc,EAAI,QAAQ,CAAS,KAE7C,KAAM,CACJ,KAAM,EACN,QACA,YACA,WAAY,EAAgB,KAAK,CAAU,CAC7C,EAEJ,CAEJ"}
@@ -0,0 +1,324 @@
1
+ import { U as ClusterDataView, a as SporeVersion, i as SporeScriptInfoLike, n as SPORE_VERSION_DEFAULT, r as SporeScriptInfo, s as SporeDataView, t as DEFAULT_COBUILD_INFO_HASH } from "./types-DRzFzVRX.mjs";
2
+ import { ccc } from "@ckb-ccc/core";
3
+
4
+ //#region src/predefined/utils.d.ts
5
+ declare function getSporeScriptInfos(client: ccc.Client): Record<SporeVersion, SporeScriptInfoLike | undefined>;
6
+ declare function getClusterScriptInfos(client: ccc.Client): Record<SporeVersion, SporeScriptInfoLike | undefined>;
7
+ declare function getSporeScriptInfo(client: ccc.Client, version?: SporeVersion): SporeScriptInfo;
8
+ declare function getClusterScriptInfo(client: ccc.Client, version?: SporeVersion): SporeScriptInfo;
9
+ //#endregion
10
+ //#region src/cluster/index.d.ts
11
+ declare function findCluster(client: ccc.Client, id: ccc.HexLike, scripts?: SporeScriptInfoLike[]): Promise<{
12
+ cell: ccc.Cell;
13
+ cluster: ccc.Cell;
14
+ clusterData: ClusterDataView;
15
+ scriptInfo: SporeScriptInfo;
16
+ } | undefined>;
17
+ declare function assertCluster(client: ccc.Client, args: ccc.HexLike, scripts?: SporeScriptInfoLike[]): Promise<{
18
+ cell: ccc.Cell;
19
+ scriptInfo: SporeScriptInfo;
20
+ }>;
21
+ /**
22
+ * Create a new Cluster cell
23
+ *
24
+ * @param params.signer who takes the responsibility to balance and sign the transaction
25
+ * @param params.data specific format of data required by Cluster protocol
26
+ * @param params.to the owner of the Cluster cell, which will be replaced with signer if not provided
27
+ * @param params.tx the transaction skeleton, if not provided, a new one will be created
28
+ * @param params.scriptInfo the script info of new cluster, default spore version if undefined
29
+ * @param params.scriptInfoHash the script info hash used in cobuild
30
+ * @returns
31
+ * - **tx**: a new transaction that contains created Cluster cell
32
+ * - **id**: the id of the created Cluster cell
33
+ */
34
+ declare function createSporeCluster(params: {
35
+ signer: ccc.Signer;
36
+ data: ClusterDataView;
37
+ to?: ccc.ScriptLike;
38
+ tx?: ccc.TransactionLike;
39
+ scriptInfo?: SporeScriptInfoLike;
40
+ scriptInfoHash?: ccc.HexLike;
41
+ }): Promise<{
42
+ tx: ccc.Transaction;
43
+ id: ccc.Hex;
44
+ }>;
45
+ /**
46
+ * Transfer a Cluster cell
47
+ *
48
+ * @param params.signer who takes the responsibility to balance and sign the transaction
49
+ * @param params.id the id of the Cluster cell to be transferred
50
+ * @param params.to the new owner of the Cluster cell
51
+ * @param params.tx the transaction skeleton, if not provided, a new one will be created
52
+ * @param params.scriptInfoHash the script info hash used in cobuild
53
+ * @returns
54
+ * - **tx**: a new transaction that contains transferred Cluster cell
55
+ */
56
+ declare function transferSporeCluster(params: {
57
+ signer: ccc.Signer;
58
+ id: ccc.HexLike;
59
+ to: ccc.ScriptLike;
60
+ tx?: ccc.TransactionLike;
61
+ scripts?: SporeScriptInfoLike[];
62
+ scriptInfoHash?: ccc.HexLike;
63
+ }): Promise<{
64
+ tx: ccc.Transaction;
65
+ }>;
66
+ /**
67
+ * Search on-chain clusters under the signer's control
68
+ *
69
+ * @param params.signer the owner of clusters
70
+ * @param params.order the order in creation time of clusters
71
+ * @param params.scriptInfos the deployed script infos of clusters
72
+ */
73
+ declare function findSporeClustersBySigner(params: {
74
+ signer: ccc.Signer;
75
+ order?: "asc" | "desc";
76
+ limit?: number;
77
+ scriptInfos?: SporeScriptInfoLike[];
78
+ }): AsyncGenerator<{
79
+ cell: ccc.Cell;
80
+ cluster: ccc.Cell;
81
+ clusterData: ClusterDataView;
82
+ scriptInfo: SporeScriptInfo;
83
+ }>;
84
+ /**
85
+ * Search on-chain clusters under the specified lock or not
86
+ *
87
+ * @param params.client the client to search clusters
88
+ * @param params.lock the lock of clusters
89
+ */
90
+ declare function findSporeClusters(params: {
91
+ client: ccc.Client;
92
+ lock?: ccc.ScriptLike;
93
+ order?: "asc" | "desc";
94
+ limit?: number;
95
+ scriptInfos?: SporeScriptInfoLike[];
96
+ }): AsyncGenerator<{
97
+ cell: ccc.Cell;
98
+ cluster: ccc.Cell;
99
+ clusterData: ClusterDataView;
100
+ scriptInfo: SporeScriptInfo;
101
+ }>;
102
+ //#endregion
103
+ //#region src/dob/helper/object.d.ts
104
+ type DNA = string | {
105
+ dna: string;
106
+ } | string[];
107
+ interface Decoder {
108
+ type: "code_hash" | "type_id" | "type_script";
109
+ hash?: string;
110
+ script?: {
111
+ code_hash: string;
112
+ hash_type: string;
113
+ args: string;
114
+ };
115
+ }
116
+ interface PatternElementDob0 {
117
+ traitName: string;
118
+ dobType: string;
119
+ dnaOffset: number;
120
+ dnaLength: number;
121
+ patternType: "options" | "range" | "rawNumber" | "rawString" | "utf8";
122
+ traitArgs?: string[] | number[];
123
+ toJSON?: () => unknown;
124
+ }
125
+ interface PatternDob0 {
126
+ ver: 0;
127
+ decoder: Decoder;
128
+ pattern: PatternElementDob0[];
129
+ }
130
+ interface Dob0 {
131
+ description: string;
132
+ dob: PatternDob0;
133
+ }
134
+ type Dob1PatternArgs = string | number[] | ["*"];
135
+ interface PatternElementDob1 {
136
+ imageName: string;
137
+ svgFields: "attributes" | "elements";
138
+ traitName: string;
139
+ patternType: "options" | "raw";
140
+ traitArgs: Dob1PatternArgs[][] | string;
141
+ toJSON?: () => unknown;
142
+ }
143
+ interface PatternDob1 {
144
+ ver: 1;
145
+ decoders: {
146
+ decoder: Decoder;
147
+ pattern: PatternElementDob0[] | PatternElementDob1[];
148
+ }[];
149
+ }
150
+ interface Dob1 {
151
+ description: string;
152
+ dob: PatternDob1;
153
+ }
154
+ interface DecodeElement {
155
+ name: string;
156
+ traits: {
157
+ type: string;
158
+ value: number | string;
159
+ }[];
160
+ }
161
+ type RenderOutput = DecodeElement[];
162
+ //#endregion
163
+ //#region src/dob/api/decode.d.ts
164
+ declare function extractDobFromDecoderResult(result: string): RenderOutput;
165
+ declare function decodeDobBySporeId(sporeId: ccc.HexLike, dobServerUrl: string): Promise<RenderOutput>;
166
+ declare function decodeDobBySporeCell(sporeOutput: ccc.CellOutputLike, dobServerUrl: string): Promise<RenderOutput>;
167
+ declare function decodeDobBySporeOutpoint(client: ccc.Client, sporeOutpoint: ccc.OutPointLike, dobServerUrl: string): Promise<RenderOutput>;
168
+ declare function decodeDobByRawData(sporeCellData: ccc.HexLike, clusterCellData: ccc.HexLike, dobServerUrl: string): Promise<RenderOutput>;
169
+ //#endregion
170
+ //#region src/dob/helper/check.d.ts
171
+ declare function checkDecoder(decoder: Decoder): void;
172
+ declare function checkPatternDob0(value: PatternElementDob0): void;
173
+ declare function checkPatternDob1(value: PatternElementDob1): void;
174
+ //#endregion
175
+ //#region src/dob/helper/error.d.ts
176
+ declare function getErrorByCode(code: number): string;
177
+ //#endregion
178
+ //#region src/dob/api/encode.d.ts
179
+ declare function encodeDna(dna: DNA): ArrayBuffer;
180
+ declare function encodeClusterDescriptionForDob0(dob0: Dob0): string;
181
+ declare function encodeClusterDescriptionForDob1(dob1: Dob1): string;
182
+ //#endregion
183
+ //#region src/dob/config/predefined.d.ts
184
+ type DobType = "dob0" | "dob1";
185
+ type DobScriptInfo = Record<DobType, Decoder>;
186
+ declare const DOB_TESTNET_DECODERS: DobScriptInfo;
187
+ declare const DOB_MAINNET_DECODERS: DobScriptInfo;
188
+ declare function getDecoder(client: ccc.Client, dobType: DobType, dobScriptInfo?: DobScriptInfo): Decoder;
189
+ declare namespace index_d_exports {
190
+ export { DNA, DOB_MAINNET_DECODERS, DOB_TESTNET_DECODERS, DecodeElement, Decoder, Dob0, Dob1, Dob1PatternArgs, DobScriptInfo, DobType, PatternDob0, PatternDob1, PatternElementDob0, PatternElementDob1, RenderOutput, checkDecoder, checkPatternDob0, checkPatternDob1, decodeDobByRawData, decodeDobBySporeCell, decodeDobBySporeId, decodeDobBySporeOutpoint, encodeClusterDescriptionForDob0, encodeClusterDescriptionForDob1, encodeDna, extractDobFromDecoderResult, getDecoder, getErrorByCode };
191
+ }
192
+ //#endregion
193
+ //#region src/spore/index.d.ts
194
+ declare function findSpore(client: ccc.Client, id: ccc.HexLike, scripts?: SporeScriptInfoLike[]): Promise<{
195
+ cell: ccc.Cell;
196
+ spore: ccc.Cell;
197
+ sporeData: SporeDataView;
198
+ scriptInfo: SporeScriptInfo;
199
+ } | undefined>;
200
+ declare function assertSpore(client: ccc.Client, args: ccc.HexLike, scripts?: SporeScriptInfoLike[]): Promise<{
201
+ cell: ccc.Cell;
202
+ scriptInfo: SporeScriptInfo;
203
+ }>;
204
+ /**
205
+ * Create one Spore cell with the specified Spore data.
206
+ *
207
+ * @param params.signer who takes the responsibility to balance and sign the transaction
208
+ * @param params.data specific format of data required by Spore protocol
209
+ * @param params.to owner of new spore cell, signer if no provided
210
+ * @param params.clusterMode how to process cluster cell **(if clusterId is not provided in SporeData, this parameter will be ignored)**
211
+ * - undefined: error if the spore has a cluster but the clusterMode is not set
212
+ * - lockProxy: put a cell that uses the same lock from Cluster cell in both Inputs and Outputs
213
+ * - clusterCell: directly put Cluster cell in Inputs and Outputs
214
+ * - skip: don't handle the cluster logic
215
+ * @param params.tx the transaction skeleton, if not provided, a new one will be created
216
+ * @param params.scriptInfo the script info of Spore cell, if not provided, the default script info will be used
217
+ * @param params.scriptInfoHash the script info hash used in cobuild
218
+ * @returns
219
+ * - **tx**: a new transaction that contains created Spore cells
220
+ * - **id**: the sporeId of created Spore cell
221
+ */
222
+ declare function createSpore(params: {
223
+ signer: ccc.Signer;
224
+ data: SporeDataView;
225
+ to?: ccc.ScriptLike;
226
+ clusterMode?: "lockProxy" | "clusterCell" | "skip";
227
+ tx?: ccc.TransactionLike;
228
+ scriptInfo?: SporeScriptInfoLike;
229
+ scriptInfoHash?: ccc.HexLike;
230
+ }): Promise<{
231
+ tx: ccc.Transaction;
232
+ id: ccc.Hex;
233
+ }>;
234
+ /**
235
+ * Transfer one Spore cell
236
+ *
237
+ * @param params.signer who takes the responsibility to balance and sign the transaction
238
+ * @param params.id sporeId
239
+ * @param params.to Spore's new owner
240
+ * @param params.tx the transaction skeleton, if not provided, a new one will be created
241
+ * @param params.scriptInfoHash the script info hash used in cobuild
242
+ * @returns
243
+ * - **tx**: a new transaction that contains transferred Spore cells
244
+ */
245
+ declare function transferSpore(params: {
246
+ signer: ccc.Signer;
247
+ id: ccc.HexLike;
248
+ to: ccc.ScriptLike;
249
+ tx?: ccc.TransactionLike;
250
+ scripts?: SporeScriptInfoLike[];
251
+ scriptInfoHash?: ccc.HexLike;
252
+ }): Promise<{
253
+ tx: ccc.Transaction;
254
+ }>;
255
+ /**
256
+ * Melt one Spore cell
257
+ *
258
+ * @param params.signer who takes the responsibility to balance and sign the transaction
259
+ * @param params.id sporeId to be melted
260
+ * @param params.tx the transaction skeleton, if not provided, a new one will be created
261
+ * @param params.scriptInfoHash the script info hash used in cobuild
262
+ * @returns
263
+ * - **tx**: a new transaction that contains melted Spore cell
264
+ */
265
+ declare function meltSpore(params: {
266
+ signer: ccc.Signer;
267
+ id: ccc.HexLike;
268
+ tx?: ccc.TransactionLike;
269
+ scripts?: SporeScriptInfoLike[];
270
+ scriptInfoHash?: ccc.HexLike;
271
+ }): Promise<{
272
+ tx: ccc.Transaction;
273
+ }>;
274
+ /**
275
+ * Search on-chain spores under the signer's control, if cluster provided, filter spores belonging to this cluster
276
+ *
277
+ * @param params.signer the owner of spores
278
+ * @param params.order the order in creation time of spores
279
+ * @param params.clusterId the cluster that spores belong to. "" to find public spores
280
+ * @param params.scriptInfos the deployed script infos of spores
281
+ * @returns specified spore cells
282
+ */
283
+ declare function findSporesBySigner(params: {
284
+ signer: ccc.Signer;
285
+ order?: "asc" | "desc";
286
+ limit?: number;
287
+ clusterId?: ccc.HexLike;
288
+ scriptInfos?: SporeScriptInfoLike[];
289
+ }): AsyncGenerator<{
290
+ cell: ccc.Cell;
291
+ spore: ccc.Cell;
292
+ sporeData: SporeDataView;
293
+ scriptInfo: SporeScriptInfo;
294
+ }>;
295
+ /**
296
+ * Search on-chain spores under the specified lock or not, if cluster provided, filter spores belonging to this cluster
297
+ *
298
+ * @param params.client the client to search spores
299
+ * @param params.lock the lock of spores
300
+ * @param params.clusterId the cluster that spores belong to. "" to find public spores
301
+ * @param params.scriptInfos the deployed script infos of spores
302
+ * @param params.limit the limit of spores to search
303
+ * @param params.order the order in creation time of spores
304
+ * @returns specified spore cells
305
+ */
306
+ declare function findSpores(params: {
307
+ client: ccc.Client;
308
+ lock?: ccc.ScriptLike;
309
+ clusterId?: ccc.HexLike;
310
+ scriptInfos?: SporeScriptInfoLike[];
311
+ limit?: number;
312
+ order?: "asc" | "desc";
313
+ }): AsyncGenerator<{
314
+ cell: ccc.Cell;
315
+ spore: ccc.Cell;
316
+ sporeData: SporeDataView;
317
+ scriptInfo: SporeScriptInfo;
318
+ }>;
319
+ declare namespace barrel_d_exports {
320
+ export { DEFAULT_COBUILD_INFO_HASH, SPORE_VERSION_DEFAULT, SporeScriptInfo, SporeScriptInfoLike, SporeVersion, assertCluster, assertSpore, createSpore, createSporeCluster, index_d_exports as dob, findCluster, findSpore, findSporeClusters, findSporeClustersBySigner, findSpores, findSporesBySigner, getClusterScriptInfo, getClusterScriptInfos, getSporeScriptInfo, getSporeScriptInfos, meltSpore, transferSpore, transferSporeCluster };
321
+ }
322
+ //#endregion
323
+ export { getClusterScriptInfos as _, findSpores as a, transferSpore as c, createSporeCluster as d, findCluster as f, getClusterScriptInfo as g, transferSporeCluster as h, findSpore as i, index_d_exports as l, findSporeClustersBySigner as m, assertSpore as n, findSporesBySigner as o, findSporeClusters as p, createSpore as r, meltSpore as s, barrel_d_exports as t, assertCluster as u, getSporeScriptInfo as v, getSporeScriptInfos as y };
324
+ //# sourceMappingURL=barrel-Cqgd-hM0.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barrel-Cqgd-hM0.d.mts","names":[],"sources":["../src/predefined/utils.ts","../src/cluster/index.ts","../src/dob/helper/object.ts","../src/dob/api/decode.ts","../src/dob/helper/check.ts","../src/dob/helper/error.ts","../src/dob/api/encode.ts","../src/dob/config/predefined.ts","../src/dob/index.ts","../src/spore/index.ts","../src/barrel.ts"],"mappings":";;;;iBAagB,mBAAA,CAAoB,MAAA,EAAQ,GAAA,CAAI,MAAA,GAAM,MAAA,CAAA,YAAA,EAAA,mBAAA;AAAA,iBAMtC,qBAAA,CAAsB,MAAA,EAAQ,GAAA,CAAI,MAAA,GAAM,MAAA,CAAA,YAAA,EAAA,mBAAA;AAAA,iBAMxC,kBAAA,CACd,MAAA,EAAQ,GAAA,CAAI,MAAA,EACZ,OAAA,GAAU,YAAA,GACT,eAAA;AAAA,iBAaa,oBAAA,CACd,MAAA,EAAQ,GAAA,CAAI,MAAA,EACZ,OAAA,GAAU,YAAA,GACT,eAAA;;;iBCzBmB,WAAA,CACpB,MAAA,EAAQ,GAAA,CAAI,MAAA,EACZ,EAAA,EAAI,GAAA,CAAI,OAAA,EACR,OAAA,GAAU,mBAAA,KACT,OAAA;EAEG,IAAA,EAAM,GAAA,CAAI,IAAA;EACV,OAAA,EAAS,GAAA,CAAI,IAAA;EACb,WAAA,EAAa,eAAA;EACb,UAAA,EAAY,eAAA;AAAA;AAAA,iBAqBI,aAAA,CACpB,MAAA,EAAQ,GAAA,CAAI,MAAA,EACZ,IAAA,EAAM,GA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A,EAAQ,GAAA,CAAI,MAAA;EACZ,IAAA,GAAO,GAAA,CAAI,UAAA;EACX,SAAA,GAAY,GAAA,CAAI,OAAA;EAChB,WAAA,GAAc,mBAAA;EACd,KAAA;EACA,KAAA;AAAA,IACE,cAAA;EACF,IAAA,EAAM,GAAA,CAAI,IAAA;EACV,KAAA,EAAO,GAAA,CAAI,IAAA;EACX,SAAA,EAAW,aAAA;EACX,UAAA,EAAY,eAAA;AAAA;AAAA"}
@@ -0,0 +1,3 @@
1
+ import { a as SporeVersion, i as SporeScriptInfoLike, n as SPORE_VERSION_DEFAULT, r as SporeScriptInfo, t as DEFAULT_COBUILD_INFO_HASH } from "./types-DRzFzVRX.mjs";
2
+ import { _ as getClusterScriptInfos, a as findSpores, c as transferSpore, d as createSporeCluster, f as findCluster, g as getClusterScriptInfo, h as transferSporeCluster, i as findSpore, l as index_d_exports, m as findSporeClustersBySigner, n as assertSpore, o as findSporesBySigner, p as findSporeClusters, r as createSpore, s as meltSpore, u as assertCluster, v as getSporeScriptInfo, y as getSporeScriptInfos } from "./barrel-Cqgd-hM0.mjs";
3
+ export { DEFAULT_COBUILD_INFO_HASH, SPORE_VERSION_DEFAULT, SporeScriptInfo, SporeScriptInfoLike, SporeVersion, assertCluster, assertSpore, createSpore, createSporeCluster, index_d_exports as dob, findCluster, findSpore, findSporeClusters, findSporeClustersBySigner, findSpores, findSporesBySigner, getClusterScriptInfo, getClusterScriptInfos, getSporeScriptInfo, getSporeScriptInfos, meltSpore, transferSpore, transferSporeCluster };
@@ -0,0 +1 @@
1
+ import{A as e,D as t,O as n,S as r,a as i,b as a,i as o,k as s,n as c,o as l,r as u,t as d,x as f,y as p}from"./cluster-KsFIhwZx.mjs";import{a as m,c as h,i as g,l as _,n as v,o as y,r as b,s as x}from"./barrel-C4fV1nUf.mjs";export{t as DEFAULT_COBUILD_INFO_HASH,n as SPORE_VERSION_DEFAULT,s as SporeScriptInfo,e as SporeVersion,d as assertCluster,v as assertSpore,b as createSpore,c as createSporeCluster,_ as dob,u as findCluster,g as findSpore,o as findSporeClusters,i as findSporeClustersBySigner,m as findSpores,y as findSporesBySigner,p as getClusterScriptInfo,a as getClusterScriptInfos,f as getSporeScriptInfo,r as getSporeScriptInfos,x as meltSpore,h as transferSpore,l as transferSporeCluster};
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{ccc as t,mol as n}from"@ckb-ccc/core";const r=n.table({name:n.String,description:n.String}),i=n.table({name:n.String,description:n.String,mutantId:n.BytesOpt}),a=i;function o(e,t){if(!t)return c(e);switch(t){case`v1`:return s(e);case`v2`:return c(e)}}function s(e){return t.bytesFrom(r.encode({name:e.name,description:e.description}))}function c(e){return t.bytesFrom(i.encode({name:e.name,description:e.description,mutantId:e.mutantId}))}function l(e,n){if(n)switch(n){case`v1`:return u(e);case`v2`:return d(e)}try{return d(e)}catch{try{return u(e)}catch{throw Error(`Cannot unpack ClusterData, no matching molecule: ${t.hexFrom(e)}`)}}}function u(e){return r.decode(e)}function d(e){return i.decode(e)}const f=n.table({scriptInfoHash:n.Byte32,scriptHash:n.Byte32,data:n.Bytes}),p=n.vector(f),m=n.table({actions:p}),h=n.table({outputs:t.CellOutputVec,outputsData:n.BytesVec}),g=n.table({name:n.String,url:n.String,scriptHash:n.Byte32,schema:n.String,messageType:n.String}),_=n.vector(g),v=n.table({message:m,payload:t.Transaction,resolvedInputs:h,changeOutput:n.Uint32Opt,scriptInfos:_,lockActions:p}),ee=n.union({BuildingPacketV1:v}),y=n.union({Script:t.Script}),b=n.table({sporeId:n.Byte32,to:y,dataHash:n.Byte32}),x=n.table({sporeId:n.Byte32,from:y,to:y}),S=n.table({sporeId:n.Byte32,from:y}),C=n.table({clusterId:n.Byte32,to:y,dataHash:n.Byte32}),w=n.table({clusterId:n.Byte32,from:y,to:y}),T=n.table({clusterId:n.Byte32,clusterProxyId:n.Byte32,to:y}),E=n.table({clusterId:n.Byte32,clusterProxyId:n.Byte32,from:y,to:y}),D=n.table({clusterId:n.Byte32,clusterProxyId:n.Byte32,from:y}),O=n.table({clusterId:n.Byte32,clusterProxyId:n.Byte32,to:y}),k=n.table({clusterId:n.Byte32,from:y,to:y}),A=n.table({clusterId:n.Byte32,from:y}),j=n.union({CreateSpore:b,TransferSpore:x,MeltSpore:S,CreateCluster:C,TransferCluster:w,CreateClusterProxy:T,TransferClusterProxy:E,MeltClusterProxy:D,CreateClusterAgent:O,TransferClusterAgent:k,MeltClusterAgent:A}),M=n.table({seal:n.Bytes,message:m}),N=n.table({seal:n.Bytes}),P=n.table({}),F=n.table({}),I={SighashAll:4278190081,SighashAllOnly:4278190082,Otx:4278190083,OtxStart:4278190084},L=n.union({SighashAll:M,SighashAllOnly:N,Otx:P,OtxStart:F},I),R=n.table({contentType:n.String,content:n.Bytes,clusterId:n.BytesOpt});function te(e){return t.bytesFrom(R.encode({contentType:e.contentType,content:e.content,clusterId:e.clusterId}))}function ne(e){return R.decode(e)}const z=t.hashCkb(t.bytesFrom(`CCC_DEFAULT_COBUILD_INFO`,`utf8`));let re=function(e){return e.V1=`V1`,e.V2=`V2`,e.DID=`DID`,e}({});const ie=`V2`;var B=class e extends t.ScriptInfo{constructor(e,t,n,r){super(e,t,n),this.cobuild=r}static from(n){return new e(t.hexFrom(n.codeHash),t.hashTypeFrom(n.hashType),n.cellDeps.map(e=>t.CellDepInfo.from(e)),n.cobuild)}};const V=Object.freeze({DID:{codeHash:`0xcfba73b58b6f30e70caed8a999748781b164ef9a1e218424a6fb55ebf641cb33`,hashType:`type`,cellDeps:[{cellDep:{outPoint:{txHash:`0x37c80ba8124780920bc8fe06b49e3535b43ca339bb9a97fb462b16d575bfa9a6`,index:0},depType:`code`},type:{codeHash:`0x00000000000000000000000000000000000000000000000000545950455f4944`,hashType:`type`,args:`0x62312cd846659e188b05da11dc3f080b083c27371ea701d6026e11e713e0e3de`}}],cobuild:!0},V2:{codeHash:`0x4a4dce1df3dffff7f8b2cd7dff7303df3b6150c9788cb75dcf6747247132b9f5`,hashType:`data1`,cellDeps:[{cellDep:{outPoint:{txHash:`0x96b198fb5ddbd1eed57ed667068f1f1e55d07907b4c0dbd38675a69ea1b69824`,index:0},depType:`code`}}],cobuild:!0},V1:void 0}),H=Object.freeze({V2:{codeHash:`0x7366a61534fa7c7e6225ecc0d828ea3b5366adec2b58206f2ee84995fe030075`,hashType:`data1`,cellDeps:[{cellDep:{outPoint:{txHash:`0xe464b7fb9311c5e2820e61c99afc615d6b98bdefbe318c34868c010cbd0dc938`,index:0},depType:`code`}}],cobuild:!0},V1:void 0,DID:void 0}),U=Object.freeze({DID:{codeHash:`0x0b1f412fbae26853ff7d082d422c2bdd9e2ff94ee8aaec11240a5b34cc6e890f`,hashType:`type`,cellDeps:[{cellDep:{outPoint:{txHash:`0x306961e0eb04ed972c60cb89a0aed1b0ef065d96d2fc0000c62db5275e32dc6f`,index:0},depType:`code`},type:{codeHash:`0x00000000000000000000000000000000000000000000000000545950455f4944`,hashType:`type`,args:`0x80f0d4bf6b3951911aa6b98cc609d477a8a10b903b35cfd528d098e95c36f680`}}]},V2:{codeHash:`0x685a60219309029d01310311dba953d67029170ca4848a4ff638e57002130a0d`,hashType:`data1`,cellDeps:[{cellDep:{outPoint:{txHash:`0x5e8d2a517d50fd4bb4d01737a7952a1f1d35c8afc77240695bb569cd7d9d5a1f`,index:0},depType:`code`}}],cobuild:!0},V1:{codeHash:`0xbbad126377d45f90a8ee120da988a2d7332c78ba8fd679aab478a19d6c133494`,hashType:`data1`,cellDeps:[{cellDep:{outPoint:{txHash:`0xfd694382e621f175ddf81ce91ce2ecf8bfc027d53d7d31b8438f7d26fc37fd19`,index:0},depType:`code`}}]}}),W=Object.freeze({V2:{codeHash:`0x0bbe768b519d8ea7b96d58f1182eb7e6ef96c541fbd9526975077ee09f049058`,hashType:`data1`,cellDeps:[{cellDep:{outPoint:{txHash:`0xcebb174d6e300e26074aea2f5dbd7f694bb4fe3de52b6dfe205e54f90164510a`,index:0},depType:`code`}}],cobuild:!0},V1:{codeHash:`0x598d793defef36e2eeba54a9b45130e4ca92822e1d193671f490950c3b856080`,hashType:`data1`,cellDeps:[{cellDep:{outPoint:{txHash:`0x49551a20dfe39231e7db49431d26c9c08ceec96a29024eef3acc936deeb2ca76`,index:0},depType:`code`}}]},DID:void 0});function ae(e){return e.addressPrefix===`ckb`?V:U}function G(e){return e.addressPrefix===`ckb`?H:W}function oe(e,t){let n=ae(e)[t??`V2`];if(!n)throw Error(`Spore script info not found of for version ${t} on ${e.addressPrefix}`);return B.from(n)}function se(e,t){let n=G(e)[t??`V2`];if(!n)throw Error(`Cluster script info not found of for version ${t} on ${e.addressPrefix}`);return B.from(n)}function ce(e,n,r=z){if(!e.type)throw Error(`Spore cell must have a type script`);let i=t.Script.from(e.type),a=i.hash(),o=j.encode({type:`CreateSpore`,value:{sporeId:i.args,to:{type:`Script`,value:e.lock},dataHash:t.hashCkb(n)}});return{scriptInfoHash:t.hexFrom(r),scriptHash:a,data:t.hexFrom(o)}}function le(e,n,r=z){if(!e.type||!n.type)throw Error(`Spore cell must have a type script`);let i=t.Script.from(n.type),a=i.hash(),o=j.encode({type:`TransferSpore`,value:{sporeId:i.args,from:{type:`Script`,value:e.lock},to:{type:`Script`,value:n.lock}}});return{scriptInfoHash:t.hexFrom(r),scriptHash:a,data:t.hexFrom(o)}}function ue(e,n=z){if(!e.type)throw Error(`Spore cell must have a type script`);let r=t.Script.from(e.type),i=r.hash(),a=j.encode({type:`MeltSpore`,value:{sporeId:r.args,from:{type:`Script`,value:e.lock}}});return{scriptInfoHash:t.hexFrom(n),scriptHash:i,data:t.hexFrom(a)}}function K(e,n,r=z){if(!e.type)throw Error(`Cluster cell must have a type script`);let i=t.Script.from(e.type),a=i.hash(),o=j.encode({type:`CreateCluster`,value:{clusterId:i.args,to:{type:`Script`,value:e.lock},dataHash:t.hashCkb(n)}});return{scriptInfoHash:t.hexFrom(r),scriptHash:a,data:t.hexFrom(o)}}function q(e,n,r=z){if(!e.type||!n.type)throw Error(`Cluster cell must have a type script`);let i=t.Script.from(n.type),a=i.hash(),o=j.encode({type:`TransferCluster`,value:{clusterId:i.args,from:{type:`Script`,value:e.lock},to:{type:`Script`,value:n.lock}}});return{scriptInfoHash:t.hexFrom(r),scriptHash:a,data:t.hexFrom(o)}}async function J(e,n,r){let i=t.Transaction.from(n);if(r.length===0)return e.prepareTransaction(i);let a=X(i);return i=await e.prepareTransaction(i),Z(i,[a,r].flat()),i}function Y(e){try{return L.decode(t.bytesFrom(e))}catch{return}}function X(e){if(e.witnesses.length===0)return[];let t=Y(e.witnesses[e.witnesses.length-1]);if(!t)return[];if(t.type!==`SighashAll`)throw Error(`Invalid cobuild proof type: SighashAll`);return e.witnesses.pop(),t.value.message.actions}function Z(e,t){e.setWitnessAt(Math.max(e.witnesses.length,e.inputs.length),L.encode({type:`SighashAll`,value:{seal:`0x`,message:{actions:t}}}))}async function Q(e,n,r,i,a){if(!r.clusterId||i===`skip`)return;if(!i)throw Error(`clusterMode is undefined but the spore has a cluster`);let{cell:o,scriptInfo:s}=await $(e.client,r.clusterId);switch(i){case`lockProxy`:{let r=o.cellOutput.lock,i=await n.findInputIndexByLock(r,e.client);if(i===void 0&&(await n.completeInputsAddOne(new t.SignerCkbScriptReadonly(e.client,r)),i=await n.findInputIndexByLock(r,e.client),i===void 0))throw Error(`Lock proxy input not found`);n.outputs.some(e=>e.lock===r)||n.addOutput(await n.getInput(i).getCell(e.client)),n.addCellDeps({outPoint:o.outPoint,depType:`code`});return}case`clusterCell`:return n.inputs.some(e=>e.previousOutput.eq(o.outPoint))?void 0:(n.addInput(o),n.addOutput(o.cellOutput,o.outputData),await n.addCellDepInfos(e.client,s.cellDeps),n.addCellDeps({outPoint:o.outPoint,depType:`code`}),s.cobuild?q(o.cellOutput,o.cellOutput,a):void 0)}}var de=e({Action:()=>f,ActionVec:()=>p,Address:()=>y,BuildingPacket:()=>ee,BuildingPacketV1:()=>v,ClusterData:()=>a,ClusterDataV1:()=>r,ClusterDataV2:()=>i,CreateCluster:()=>C,CreateClusterAgent:()=>O,CreateClusterProxy:()=>T,CreateSpore:()=>b,MeltClusterAgent:()=>A,MeltClusterProxy:()=>D,MeltSpore:()=>S,Message:()=>m,Otx:()=>P,OtxStart:()=>F,ResolvedInputs:()=>h,SCRIPTS_CLUSTER_MAINNET:()=>H,SCRIPTS_CLUSTER_TESTNET:()=>W,SCRIPTS_SPORE_MAINNET:()=>V,SCRIPTS_SPORE_TESTNET:()=>U,ScriptInfo:()=>g,ScriptInfoVec:()=>_,SighashAll:()=>M,SighashAllOnly:()=>N,SporeAction:()=>j,SporeData:()=>R,TransferCluster:()=>w,TransferClusterAgent:()=>k,TransferClusterProxy:()=>E,TransferSpore:()=>x,WitnessLayout:()=>L,WitnessLayoutFieldTags:()=>I,assembleCreateClusterAction:()=>K,assembleCreateSporeAction:()=>ce,assembleMeltSporeAction:()=>ue,assembleTransferClusterAction:()=>q,assembleTransferSporeAction:()=>le,extractCobuildActionsFromTx:()=>X,injectCobuild:()=>Z,packRawClusterData:()=>o,packRawClusterDataV1:()=>s,packRawClusterDataV2:()=>c,packRawSporeData:()=>te,prepareCluster:()=>Q,prepareSporeTransaction:()=>J,unpackCommonCobuildProof:()=>Y,unpackToRawClusterData:()=>l,unpackToRawClusterDataV1:()=>u,unpackToRawClusterDataV2:()=>d,unpackToRawSporeData:()=>ne});async function fe(e,t,n){for(let r of n){if(!r)continue;let n=await e.findSingletonCellByType({...r,args:t},!0);if(n)return{cell:n,scriptInfo:B.from(r)}}}async function pe(e,t,n){let r=await fe(e,t,n??Object.values(G(e)));if(r)return{cell:r.cell,cluster:r.cell,clusterData:l(r.cell.outputData),scriptInfo:r.scriptInfo}}async function $(e,n,r){let i=await pe(e,n,r);if(!i)throw Error(`Cluster ${t.hexFrom(n)} not found`);return i}async function me(e){let{signer:n,data:r,to:i,scriptInfoHash:a}=e,s=e.scriptInfo??se(n.client),c=t.Transaction.from(e.tx??{});await c.completeInputsAtLeastOne(n);let l=t.hashTypeId(c.inputs[0],c.outputs.length),u=o(r);return c.addOutput({lock:i??(await n.getRecommendedAddressObj()).script,type:{...s,args:l}},u),await c.addCellDepInfos(n.client,s.cellDeps),{tx:await J(n,c,s.cobuild?[K(c.outputs[c.outputs.length-1],u,a)]:[]),id:l}}async function he(e){let{signer:n,id:r,to:i,scripts:a,scriptInfoHash:o}=e,s=t.Transaction.from(e.tx??{}),{cell:c,scriptInfo:l}=await $(n.client,r,a);return s.addInput(c),s.addOutput({lock:i,type:c.cellOutput.type},c.outputData),await s.addCellDepInfos(n.client,l.cellDeps),{tx:await J(n,s,l.cobuild?[q(c.cellOutput,s.outputs[s.outputs.length-1],o)]:[])}}async function*ge(e){let{signer:t,order:n,limit:r,scriptInfos:i}=e;for(let e of i??Object.values(G(t.client)))if(e)for await(let i of t.findCells({script:{...e,args:``}},!0,n,r))yield{cell:i,cluster:i,clusterData:l(i.outputData),scriptInfo:B.from(e)}}async function*_e(e){let{client:t,lock:n,order:r,limit:i,scriptInfos:a}=e;for(let e of a??Object.values(G(t)))if(e)for await(let a of t.findCells({script:{...e,args:``},scriptType:`type`,scriptSearchMode:`prefix`,withData:!0,filter:n?{script:n}:void 0},r,i))yield{cell:a,cluster:a,clusterData:l(a.outputData),scriptInfo:B.from(e)}}export{f as $,re as A,y as B,W as C,z as D,V as E,F,A as G,O as H,M as I,j as J,D as K,N as L,te as M,ne as N,ie as O,P,x as Q,L as R,ae as S,H as T,T as U,C as V,b as W,k as X,w as Y,E as Z,J as _,ge as a,g as at,G as b,de as c,r as ct,ce as d,s as dt,p as et,ue as f,c as ft,Z as g,X as h,d as ht,_e as i,h as it,R as j,B as k,Q as l,i as lt,le as m,u as mt,me as n,v as nt,he as o,_ as ot,q as p,l as pt,S as q,pe as r,m as rt,fe as s,a as st,$ as t,ee as tt,K as u,o as ut,Y as v,U as w,oe as x,se as y,I as z};
2
+ //# sourceMappingURL=cluster-KsFIhwZx.mjs.map