@pezkuwi/api-contract 16.5.13 → 16.5.14

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 (381) hide show
  1. package/{build/bundle-pezkuwi-api-contract.js → bundle-pezkuwi-api-contract.js} +1 -1
  2. package/{build/cjs → cjs}/packageInfo.js +1 -1
  3. package/package.json +11 -11
  4. package/{build/packageInfo.js → packageInfo.js} +1 -1
  5. package/build/Abi/index.js +0 -359
  6. package/build/Abi/toLatestCompatible.js +0 -30
  7. package/build/Abi/toV1.js +0 -21
  8. package/build/Abi/toV2.js +0 -27
  9. package/build/Abi/toV3.js +0 -10
  10. package/build/Abi/toV4.js +0 -10
  11. package/build/LICENSE +0 -201
  12. package/build/README.md +0 -3
  13. package/build/augment.js +0 -1
  14. package/build/base/Base.js +0 -40
  15. package/build/base/Blueprint.js +0 -51
  16. package/build/base/Code.js +0 -74
  17. package/build/base/Contract.js +0 -127
  18. package/build/base/index.js +0 -3
  19. package/build/base/mock.js +0 -38
  20. package/build/base/types.js +0 -1
  21. package/build/base/util.js +0 -33
  22. package/build/bundle.js +0 -4
  23. package/build/cjs/Abi/index.d.ts +0 -31
  24. package/build/cjs/Abi/index.js +0 -363
  25. package/build/cjs/Abi/toLatestCompatible.d.ts +0 -15
  26. package/build/cjs/Abi/toLatestCompatible.js +0 -36
  27. package/build/cjs/Abi/toV1.d.ts +0 -3
  28. package/build/cjs/Abi/toV1.js +0 -24
  29. package/build/cjs/Abi/toV2.d.ts +0 -3
  30. package/build/cjs/Abi/toV2.js +0 -30
  31. package/build/cjs/Abi/toV3.d.ts +0 -3
  32. package/build/cjs/Abi/toV3.js +0 -13
  33. package/build/cjs/Abi/toV4.d.ts +0 -3
  34. package/build/cjs/Abi/toV4.js +0 -13
  35. package/build/cjs/augment.d.ts +0 -1
  36. package/build/cjs/augment.js +0 -3
  37. package/build/cjs/base/Base.d.ts +0 -13
  38. package/build/cjs/base/Base.js +0 -44
  39. package/build/cjs/base/Blueprint.d.ts +0 -24
  40. package/build/cjs/base/Blueprint.js +0 -57
  41. package/build/cjs/base/Code.d.ts +0 -22
  42. package/build/cjs/base/Code.js +0 -80
  43. package/build/cjs/base/Contract.d.ts +0 -25
  44. package/build/cjs/base/Contract.js +0 -133
  45. package/build/cjs/base/index.d.ts +0 -3
  46. package/build/cjs/base/index.js +0 -14
  47. package/build/cjs/base/mock.d.ts +0 -3
  48. package/build/cjs/base/mock.js +0 -41
  49. package/build/cjs/base/types.d.ts +0 -25
  50. package/build/cjs/base/types.js +0 -2
  51. package/build/cjs/base/util.d.ts +0 -16
  52. package/build/cjs/base/util.js +0 -42
  53. package/build/cjs/bundle.d.ts +0 -4
  54. package/build/cjs/bundle.js +0 -10
  55. package/build/cjs/index.js +0 -5
  56. package/build/cjs/promise/index.js +0 -23
  57. package/build/cjs/promise/types.js +0 -2
  58. package/build/cjs/rx/index.js +0 -23
  59. package/build/cjs/rx/types.js +0 -2
  60. package/build/cjs/types.js +0 -2
  61. package/build/cjs/util.js +0 -13
  62. package/build/index.d.ts +0 -2
  63. package/build/index.js +0 -2
  64. package/build/package.json +0 -410
  65. package/build/packageDetect.d.ts +0 -1
  66. package/build/packageDetect.js +0 -5
  67. package/build/packageInfo.d.ts +0 -6
  68. package/build/promise/index.d.ts +0 -13
  69. package/build/promise/index.js +0 -17
  70. package/build/promise/types.d.ts +0 -3
  71. package/build/promise/types.js +0 -1
  72. package/build/rx/index.d.ts +0 -13
  73. package/build/rx/index.js +0 -17
  74. package/build/rx/types.d.ts +0 -3
  75. package/build/rx/types.js +0 -1
  76. package/build/types.d.ts +0 -79
  77. package/build/types.js +0 -1
  78. package/build/util.d.ts +0 -5
  79. package/build/util.js +0 -10
  80. package/build-deno/Abi/index.ts +0 -475
  81. package/build-deno/Abi/toLatestCompatible.ts +0 -47
  82. package/build-deno/Abi/toV1.ts +0 -33
  83. package/build-deno/Abi/toV2.ts +0 -56
  84. package/build-deno/Abi/toV3.ts +0 -16
  85. package/build-deno/Abi/toV4.ts +0 -19
  86. package/build-deno/README.md +0 -3
  87. package/build-deno/augment.ts +0 -2
  88. package/build-deno/base/Base.ts +0 -50
  89. package/build-deno/base/Blueprint.ts +0 -88
  90. package/build-deno/base/Code.ts +0 -140
  91. package/build-deno/base/Contract.ts +0 -194
  92. package/build-deno/base/index.ts +0 -4
  93. package/build-deno/base/mock.ts +0 -46
  94. package/build-deno/base/types.ts +0 -38
  95. package/build-deno/base/util.ts +0 -54
  96. package/build-deno/bundle.ts +0 -6
  97. package/build-deno/checkTypes.manual.ts +0 -42
  98. package/build-deno/index.ts +0 -4
  99. package/build-deno/mod.ts +0 -2
  100. package/build-deno/packageDetect.ts +0 -9
  101. package/build-deno/packageInfo.ts +0 -3
  102. package/build-deno/promise/index.ts +0 -28
  103. package/build-deno/promise/types.ts +0 -5
  104. package/build-deno/rx/index.ts +0 -28
  105. package/build-deno/rx/types.ts +0 -5
  106. package/build-deno/test/contracts/index.ts +0 -18
  107. package/build-deno/test/contracts/ink/index.ts +0 -11
  108. package/build-deno/test/contracts/ink/v0/accumulator.wasm +0 -0
  109. package/build-deno/test/contracts/ink/v0/adder.wasm +0 -0
  110. package/build-deno/test/contracts/ink/v0/delegator.wasm +0 -0
  111. package/build-deno/test/contracts/ink/v0/dns.wasm +0 -0
  112. package/build-deno/test/contracts/ink/v0/erc20.wasm +0 -0
  113. package/build-deno/test/contracts/ink/v0/erc721.wasm +0 -0
  114. package/build-deno/test/contracts/ink/v0/flipper.wasm +0 -0
  115. package/build-deno/test/contracts/ink/v0/incrementer.wasm +0 -0
  116. package/build-deno/test/contracts/ink/v0/index.ts +0 -9
  117. package/build-deno/test/contracts/ink/v0/multisig_plain.wasm +0 -0
  118. package/build-deno/test/contracts/ink/v0/subber.wasm +0 -0
  119. package/build-deno/test/contracts/ink/v0/trait-flipper.wasm +0 -0
  120. package/build-deno/test/contracts/ink/v1/index.ts +0 -3
  121. package/build-deno/test/contracts/ink/v2/index.ts +0 -3
  122. package/build-deno/test/contracts/ink/v3/index.ts +0 -3
  123. package/build-deno/test/contracts/ink/v4/erc20.wasm +0 -0
  124. package/build-deno/test/contracts/ink/v4/flipper.wasm +0 -0
  125. package/build-deno/test/contracts/ink/v4/index.ts +0 -5
  126. package/build-deno/test/contracts/ink/v5/erc20.wasm +0 -0
  127. package/build-deno/test/contracts/ink/v5/flipper.wasm +0 -0
  128. package/build-deno/test/contracts/ink/v5/index.ts +0 -6
  129. package/build-deno/test/contracts/ink/v6/erc20.polkavm +0 -0
  130. package/build-deno/test/contracts/ink/v6/index.ts +0 -3
  131. package/build-deno/test/contracts/solang/index.ts +0 -5
  132. package/build-deno/test/contracts/solang/v0/index.ts +0 -2
  133. package/build-deno/test/contracts/solang/v0/ints256.sol +0 -13
  134. package/build-deno/test/contracts/solang/v0/ints256.wasm +0 -0
  135. package/build-deno/test/contracts/user/index.ts +0 -7
  136. package/build-deno/test/contracts/user/v0/assetTransfer.wasm +0 -0
  137. package/build-deno/test/contracts/user/v0/enumExample.wasm +0 -0
  138. package/build-deno/test/contracts/user/v0/index.ts +0 -5
  139. package/build-deno/test/contracts/user/v3/index.ts +0 -2
  140. package/build-deno/test/contracts/user/v4/index.ts +0 -2
  141. package/build-deno/test/contracts/util.ts +0 -12
  142. package/build-deno/types.ts +0 -95
  143. package/build-deno/util.ts +0 -18
  144. package/build-tsc-cjs/packageDetect.js +0 -7
  145. package/build-tsc-cjs/packageInfo.js +0 -4
  146. package/build-tsc-esm/packageInfo.js +0 -1
  147. package/src/Abi/Abi.spec.ts +0 -235
  148. package/src/Abi/index.ts +0 -477
  149. package/src/Abi/toLatestCompatible.spec.ts +0 -219
  150. package/src/Abi/toLatestCompatible.ts +0 -52
  151. package/src/Abi/toV1.ts +0 -35
  152. package/src/Abi/toV2.ts +0 -58
  153. package/src/Abi/toV3.ts +0 -18
  154. package/src/Abi/toV4.ts +0 -21
  155. package/src/augment.ts +0 -4
  156. package/src/base/Base.ts +0 -52
  157. package/src/base/Blueprint.ts +0 -90
  158. package/src/base/Code.spec.ts +0 -47
  159. package/src/base/Code.ts +0 -142
  160. package/src/base/Contract.ts +0 -197
  161. package/src/base/index.ts +0 -6
  162. package/src/base/mock.ts +0 -48
  163. package/src/base/types.ts +0 -40
  164. package/src/base/util.ts +0 -56
  165. package/src/bundle.ts +0 -10
  166. package/src/checkTypes.manual.ts +0 -45
  167. package/src/index.ts +0 -6
  168. package/src/mod.ts +0 -4
  169. package/src/packageDetect.ts +0 -13
  170. package/src/packageInfo.ts +0 -6
  171. package/src/promise/index.ts +0 -28
  172. package/src/promise/types.ts +0 -7
  173. package/src/rx/index.ts +0 -28
  174. package/src/rx/types.ts +0 -7
  175. package/src/test/compare/ink_v0_delegator.test.json +0 -47
  176. package/src/test/compare/ink_v0_dns.test.json +0 -232
  177. package/src/test/compare/ink_v0_erc20.test.json +0 -253
  178. package/src/test/compare/ink_v0_erc721.test.json +0 -415
  179. package/src/test/compare/ink_v0_flipper.test.json +0 -9
  180. package/src/test/compare/ink_v0_flipperBundle.test.json +0 -9
  181. package/src/test/compare/ink_v0_incrementer.test.json +0 -9
  182. package/src/test/compare/ink_v0_multisigPlain.test.json +0 -562
  183. package/src/test/compare/ink_v1_flipper.test.json +0 -9
  184. package/src/test/compare/ink_v1_psp22.test.json +0 -531
  185. package/src/test/compare/ink_v2_erc20.test.json +0 -205
  186. package/src/test/compare/ink_v2_flipper.test.json +0 -9
  187. package/src/test/compare/ink_v3_flipper.test.json +0 -9
  188. package/src/test/compare/ink_v3_traitErc20.test.json +0 -205
  189. package/src/test/compare/ink_v4_erc20Contract.test.json +0 -253
  190. package/src/test/compare/ink_v4_erc20Metadata.test.json +0 -253
  191. package/src/test/compare/ink_v4_flipperContract.test.json +0 -155
  192. package/src/test/compare/ink_v4_flipperMetadata.test.json +0 -155
  193. package/src/test/compare/ink_v5_erc20.test.json +0 -370
  194. package/src/test/compare/ink_v5_erc20AnonymousTransferMetadata.test.json +0 -370
  195. package/src/test/compare/ink_v5_erc20Contract.test.json +0 -370
  196. package/src/test/compare/ink_v5_erc20Metadata.test.json +0 -370
  197. package/src/test/compare/ink_v5_flipperContract.test.json +0 -174
  198. package/src/test/compare/ink_v5_flipperMetadata.test.json +0 -174
  199. package/src/test/compare/ink_v6_erc20Contract.test.json +0 -418
  200. package/src/test/compare/ink_v6_erc20Metadata.test.json +0 -418
  201. package/src/test/compare/solang_v0_ints256.test.json +0 -9
  202. package/src/test/compare/user_v0_assetTransfer.test.json +0 -54
  203. package/src/test/compare/user_v0_enumExample.test.json +0 -303
  204. package/src/test/compare/user_v0_recursive.test.json +0 -27
  205. package/src/test/compare/user_v0_withString.test.json +0 -260
  206. package/src/test/compare/user_v3_ask.test.json +0 -71
  207. package/src/test/compare/user_v4_events.test.json +0 -1328
  208. package/src/test/contracts/index.ts +0 -20
  209. package/src/test/contracts/ink/index.ts +0 -13
  210. package/src/test/contracts/ink/v0/accumulator.wasm +0 -0
  211. package/src/test/contracts/ink/v0/adder.wasm +0 -0
  212. package/src/test/contracts/ink/v0/delegator.json +0 -252
  213. package/src/test/contracts/ink/v0/delegator.wasm +0 -0
  214. package/src/test/contracts/ink/v0/dns.json +0 -713
  215. package/src/test/contracts/ink/v0/dns.wasm +0 -0
  216. package/src/test/contracts/ink/v0/erc20.json +0 -704
  217. package/src/test/contracts/ink/v0/erc20.wasm +0 -0
  218. package/src/test/contracts/ink/v0/erc721.json +0 -1197
  219. package/src/test/contracts/ink/v0/erc721.wasm +0 -0
  220. package/src/test/contracts/ink/v0/flipper.contract.json +0 -107
  221. package/src/test/contracts/ink/v0/flipper.json +0 -106
  222. package/src/test/contracts/ink/v0/flipper.wasm +0 -0
  223. package/src/test/contracts/ink/v0/incrementer.json +0 -108
  224. package/src/test/contracts/ink/v0/incrementer.wasm +0 -0
  225. package/src/test/contracts/ink/v0/index.ts +0 -11
  226. package/src/test/contracts/ink/v0/multisig_plain.json +0 -1466
  227. package/src/test/contracts/ink/v0/multisig_plain.wasm +0 -0
  228. package/src/test/contracts/ink/v0/subber.wasm +0 -0
  229. package/src/test/contracts/ink/v0/trait-flipper.json +0 -103
  230. package/src/test/contracts/ink/v0/trait-flipper.wasm +0 -0
  231. package/src/test/contracts/ink/v1/flipper.contract.json +0 -111
  232. package/src/test/contracts/ink/v1/index.ts +0 -6
  233. package/src/test/contracts/ink/v1/psp22_minter_pauser.contract.json +0 -1722
  234. package/src/test/contracts/ink/v2/erc20.contract.json +0 -630
  235. package/src/test/contracts/ink/v2/flipper.contract.json +0 -103
  236. package/src/test/contracts/ink/v2/index.ts +0 -5
  237. package/src/test/contracts/ink/v3/flipper.contract.json +0 -105
  238. package/src/test/contracts/ink/v3/index.ts +0 -6
  239. package/src/test/contracts/ink/v3/trait_erc20.contract.json +0 -631
  240. package/src/test/contracts/ink/v4/erc20.contract.json +0 -1
  241. package/src/test/contracts/ink/v4/erc20.json +0 -821
  242. package/src/test/contracts/ink/v4/erc20.wasm +0 -0
  243. package/src/test/contracts/ink/v4/flipper.contract.json +0 -1
  244. package/src/test/contracts/ink/v4/flipper.json +0 -396
  245. package/src/test/contracts/ink/v4/flipper.wasm +0 -0
  246. package/src/test/contracts/ink/v4/index.ts +0 -7
  247. package/src/test/contracts/ink/v5/erc20.contract.json +0 -1
  248. package/src/test/contracts/ink/v5/erc20.json +0 -1025
  249. package/src/test/contracts/ink/v5/erc20.wasm +0 -0
  250. package/src/test/contracts/ink/v5/erc20_anonymous_transfer.json +0 -1025
  251. package/src/test/contracts/ink/v5/flipper.contract.json +0 -1
  252. package/src/test/contracts/ink/v5/flipper.json +0 -420
  253. package/src/test/contracts/ink/v5/flipper.wasm +0 -0
  254. package/src/test/contracts/ink/v5/index.ts +0 -8
  255. package/src/test/contracts/ink/v6/erc20.contract.json +0 -1
  256. package/src/test/contracts/ink/v6/erc20.json +0 -1081
  257. package/src/test/contracts/ink/v6/erc20.polkavm +0 -0
  258. package/src/test/contracts/ink/v6/index.ts +0 -5
  259. package/src/test/contracts/solang/index.ts +0 -7
  260. package/src/test/contracts/solang/v0/index.ts +0 -4
  261. package/src/test/contracts/solang/v0/ints256.json +0 -113
  262. package/src/test/contracts/solang/v0/ints256.sol +0 -13
  263. package/src/test/contracts/solang/v0/ints256.wasm +0 -0
  264. package/src/test/contracts/user/index.ts +0 -9
  265. package/src/test/contracts/user/v0/assetTransfer.json +0 -299
  266. package/src/test/contracts/user/v0/assetTransfer.wasm +0 -0
  267. package/src/test/contracts/user/v0/enumExample.json +0 -528
  268. package/src/test/contracts/user/v0/enumExample.wasm +0 -0
  269. package/src/test/contracts/user/v0/index.ts +0 -7
  270. package/src/test/contracts/user/v0/recursive.contract.json +0 -1
  271. package/src/test/contracts/user/v0/withString.json +0 -777
  272. package/src/test/contracts/user/v3/ask.json +0 -550
  273. package/src/test/contracts/user/v3/index.ts +0 -4
  274. package/src/test/contracts/user/v4/events.contract.json +0 -2990
  275. package/src/test/contracts/user/v4/index.ts +0 -4
  276. package/src/test/contracts/util.ts +0 -14
  277. package/src/types.ts +0 -98
  278. package/src/util.ts +0 -20
  279. package/tsconfig.build.json +0 -22
  280. package/tsconfig.build.tsbuildinfo +0 -1
  281. package/tsconfig.spec.json +0 -26
  282. package/tsconfig.spec.tsbuildinfo +0 -1
  283. /package/{build-tsc/Abi → Abi}/index.d.ts +0 -0
  284. /package/{build-tsc-esm/Abi → Abi}/index.js +0 -0
  285. /package/{build-tsc/Abi → Abi}/toLatestCompatible.d.ts +0 -0
  286. /package/{build-tsc-esm/Abi → Abi}/toLatestCompatible.js +0 -0
  287. /package/{build-tsc/Abi → Abi}/toV1.d.ts +0 -0
  288. /package/{build-tsc-esm/Abi → Abi}/toV1.js +0 -0
  289. /package/{build-tsc/Abi → Abi}/toV2.d.ts +0 -0
  290. /package/{build-tsc-esm/Abi → Abi}/toV2.js +0 -0
  291. /package/{build-tsc/Abi → Abi}/toV3.d.ts +0 -0
  292. /package/{build-tsc-esm/Abi → Abi}/toV3.js +0 -0
  293. /package/{build-tsc/Abi → Abi}/toV4.d.ts +0 -0
  294. /package/{build-tsc-esm/Abi → Abi}/toV4.js +0 -0
  295. /package/{build-tsc/augment.d.ts → augment.d.ts} +0 -0
  296. /package/{build-tsc-esm/augment.js → augment.js} +0 -0
  297. /package/{build-tsc/base → base}/Base.d.ts +0 -0
  298. /package/{build-tsc-esm/base → base}/Base.js +0 -0
  299. /package/{build-tsc/base → base}/Blueprint.d.ts +0 -0
  300. /package/{build-tsc-esm/base → base}/Blueprint.js +0 -0
  301. /package/{build-tsc/base → base}/Code.d.ts +0 -0
  302. /package/{build-tsc-esm/base → base}/Code.js +0 -0
  303. /package/{build-tsc/base → base}/Contract.d.ts +0 -0
  304. /package/{build-tsc-esm/base → base}/Contract.js +0 -0
  305. /package/{build-tsc/base → base}/index.d.ts +0 -0
  306. /package/{build-tsc-esm/base → base}/index.js +0 -0
  307. /package/{build-tsc/base → base}/mock.d.ts +0 -0
  308. /package/{build-tsc-esm/base → base}/mock.js +0 -0
  309. /package/{build-tsc/base → base}/types.d.ts +0 -0
  310. /package/{build-tsc-esm/base → base}/types.js +0 -0
  311. /package/{build-tsc/base → base}/util.d.ts +0 -0
  312. /package/{build-tsc-esm/base → base}/util.js +0 -0
  313. /package/{build-tsc/bundle.d.ts → bundle.d.ts} +0 -0
  314. /package/{build-tsc-esm/bundle.js → bundle.js} +0 -0
  315. /package/{build → cjs}/Abi/index.d.ts +0 -0
  316. /package/{build-tsc-cjs → cjs}/Abi/index.js +0 -0
  317. /package/{build → cjs}/Abi/toLatestCompatible.d.ts +0 -0
  318. /package/{build-tsc-cjs → cjs}/Abi/toLatestCompatible.js +0 -0
  319. /package/{build → cjs}/Abi/toV1.d.ts +0 -0
  320. /package/{build-tsc-cjs → cjs}/Abi/toV1.js +0 -0
  321. /package/{build → cjs}/Abi/toV2.d.ts +0 -0
  322. /package/{build-tsc-cjs → cjs}/Abi/toV2.js +0 -0
  323. /package/{build → cjs}/Abi/toV3.d.ts +0 -0
  324. /package/{build-tsc-cjs → cjs}/Abi/toV3.js +0 -0
  325. /package/{build → cjs}/Abi/toV4.d.ts +0 -0
  326. /package/{build-tsc-cjs → cjs}/Abi/toV4.js +0 -0
  327. /package/{build → cjs}/augment.d.ts +0 -0
  328. /package/{build-tsc-cjs → cjs}/augment.js +0 -0
  329. /package/{build → cjs}/base/Base.d.ts +0 -0
  330. /package/{build-tsc-cjs → cjs}/base/Base.js +0 -0
  331. /package/{build → cjs}/base/Blueprint.d.ts +0 -0
  332. /package/{build-tsc-cjs → cjs}/base/Blueprint.js +0 -0
  333. /package/{build → cjs}/base/Code.d.ts +0 -0
  334. /package/{build-tsc-cjs → cjs}/base/Code.js +0 -0
  335. /package/{build → cjs}/base/Contract.d.ts +0 -0
  336. /package/{build-tsc-cjs → cjs}/base/Contract.js +0 -0
  337. /package/{build → cjs}/base/index.d.ts +0 -0
  338. /package/{build-tsc-cjs → cjs}/base/index.js +0 -0
  339. /package/{build → cjs}/base/mock.d.ts +0 -0
  340. /package/{build-tsc-cjs → cjs}/base/mock.js +0 -0
  341. /package/{build → cjs}/base/types.d.ts +0 -0
  342. /package/{build-tsc-cjs → cjs}/base/types.js +0 -0
  343. /package/{build → cjs}/base/util.d.ts +0 -0
  344. /package/{build-tsc-cjs → cjs}/base/util.js +0 -0
  345. /package/{build → cjs}/bundle.d.ts +0 -0
  346. /package/{build-tsc-cjs → cjs}/bundle.js +0 -0
  347. /package/{build-tsc → cjs}/index.d.ts +0 -0
  348. /package/{build-tsc-cjs → cjs}/index.js +0 -0
  349. /package/{build/cjs → cjs}/package.json +0 -0
  350. /package/{build-tsc → cjs}/packageDetect.d.ts +0 -0
  351. /package/{build/cjs → cjs}/packageDetect.js +0 -0
  352. /package/{build-tsc → cjs}/packageInfo.d.ts +0 -0
  353. /package/{build-tsc → cjs}/promise/index.d.ts +0 -0
  354. /package/{build-tsc-cjs → cjs}/promise/index.js +0 -0
  355. /package/{build-tsc → cjs}/promise/types.d.ts +0 -0
  356. /package/{build-tsc-cjs → cjs}/promise/types.js +0 -0
  357. /package/{build-tsc → cjs}/rx/index.d.ts +0 -0
  358. /package/{build-tsc-cjs → cjs}/rx/index.js +0 -0
  359. /package/{build-tsc → cjs}/rx/types.d.ts +0 -0
  360. /package/{build-tsc-cjs → cjs}/rx/types.js +0 -0
  361. /package/{build-tsc → cjs}/types.d.ts +0 -0
  362. /package/{build-tsc-cjs → cjs}/types.js +0 -0
  363. /package/{build-tsc → cjs}/util.d.ts +0 -0
  364. /package/{build-tsc-cjs → cjs}/util.js +0 -0
  365. /package/{build/cjs/index.d.ts → index.d.ts} +0 -0
  366. /package/{build-tsc-esm/index.js → index.js} +0 -0
  367. /package/{build/cjs/packageDetect.d.ts → packageDetect.d.ts} +0 -0
  368. /package/{build-tsc-esm/packageDetect.js → packageDetect.js} +0 -0
  369. /package/{build/cjs/packageInfo.d.ts → packageInfo.d.ts} +0 -0
  370. /package/{build/cjs/promise → promise}/index.d.ts +0 -0
  371. /package/{build-tsc-esm/promise → promise}/index.js +0 -0
  372. /package/{build/cjs/promise → promise}/types.d.ts +0 -0
  373. /package/{build-tsc-esm/promise → promise}/types.js +0 -0
  374. /package/{build/cjs/rx → rx}/index.d.ts +0 -0
  375. /package/{build-tsc-esm/rx → rx}/index.js +0 -0
  376. /package/{build/cjs/rx → rx}/types.d.ts +0 -0
  377. /package/{build-tsc-esm/rx → rx}/types.js +0 -0
  378. /package/{build/cjs/types.d.ts → types.d.ts} +0 -0
  379. /package/{build-tsc-esm/types.js → types.js} +0 -0
  380. /package/{build/cjs/util.d.ts → util.d.ts} +0 -0
  381. /package/{build-tsc-esm/util.js → util.js} +0 -0
@@ -1,52 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/api-contract authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { ContractMetadataV4, ContractMetadataV5, ContractMetadataV6 } from '@pezkuwi/types/interfaces';
5
- import type { Registry } from '@pezkuwi/types/types';
6
- import type { ContractMetadataSupported } from './index.js';
7
-
8
- import { v0ToV1 } from './toV1.js';
9
- import { v1ToV2 } from './toV2.js';
10
- import { v2ToV3 } from './toV3.js';
11
- import { v3ToV4 } from './toV4.js';
12
-
13
- // The versions where an enum is used, aka V0 is missing
14
- // (Order from newest, i.e. we expect more on newest vs oldest)
15
- export const enumVersions = ['V6', 'V5', 'V4', 'V3', 'V2', 'V1'] as const;
16
-
17
- type Versions = typeof enumVersions[number] | 'V0';
18
-
19
- type Converter = (registry: Registry, vx: any) => ContractMetadataSupported;
20
-
21
- // Helper to convert metadata from one step to the next
22
- function createConverter <I, O> (next: (registry: Registry, input: O) => ContractMetadataSupported, step: (registry: Registry, input: I) => O): (registry: Registry, input: I) => ContractMetadataSupported {
23
- return (registry: Registry, input: I): ContractMetadataSupported =>
24
- next(registry, step(registry, input));
25
- }
26
-
27
- export function v6ToLatestCompatible (_registry: Registry, v6: ContractMetadataV6): ContractMetadataV6 {
28
- return v6;
29
- }
30
-
31
- export function v5ToLatestCompatible (_registry: Registry, v5: ContractMetadataV5): ContractMetadataV5 {
32
- return v5;
33
- }
34
-
35
- export function v4ToLatestCompatible (_registry: Registry, v4: ContractMetadataV4): ContractMetadataV4 {
36
- return v4;
37
- }
38
-
39
- export const v3ToLatestCompatible = /*#__PURE__*/ createConverter(v4ToLatestCompatible, v3ToV4);
40
- export const v2ToLatestCompatible = /*#__PURE__*/ createConverter(v3ToLatestCompatible, v2ToV3);
41
- export const v1ToLatestCompatible = /*#__PURE__*/ createConverter(v2ToLatestCompatible, v1ToV2);
42
- export const v0ToLatestCompatible = /*#__PURE__*/ createConverter(v1ToLatestCompatible, v0ToV1);
43
-
44
- export const convertVersions: [Versions, Converter][] = [
45
- ['V6', v6ToLatestCompatible],
46
- ['V5', v5ToLatestCompatible],
47
- ['V4', v4ToLatestCompatible],
48
- ['V3', v3ToLatestCompatible],
49
- ['V2', v2ToLatestCompatible],
50
- ['V1', v1ToLatestCompatible],
51
- ['V0', v0ToLatestCompatible]
52
- ];
package/src/Abi/toV1.ts DELETED
@@ -1,35 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/api-contract authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { ContractMetadataV0, ContractMetadataV1 } from '@pezkuwi/types/interfaces';
5
- import type { Registry } from '@pezkuwi/types/types';
6
-
7
- import { convertSiV0toV1 } from '@pezkuwi/types';
8
- import { objectSpread } from '@pezkuwi/util';
9
-
10
- interface Named {
11
- name: unknown;
12
- }
13
-
14
- function v0ToV1Names (all: Named[]): unknown[] {
15
- return all.map((e) =>
16
- objectSpread({}, e, {
17
- name: Array.isArray(e.name)
18
- ? e.name
19
- : [e.name]
20
- }));
21
- }
22
-
23
- export function v0ToV1 (registry: Registry, v0: ContractMetadataV0): ContractMetadataV1 {
24
- if (!v0.metadataVersion.length) {
25
- throw new Error('Invalid format for V0 (detected) contract metadata');
26
- }
27
-
28
- return registry.createType('ContractMetadataV1', objectSpread({}, v0, {
29
- spec: objectSpread({}, v0.spec, {
30
- constructors: v0ToV1Names(v0.spec.constructors),
31
- messages: v0ToV1Names(v0.spec.messages)
32
- }),
33
- types: convertSiV0toV1(registry, v0.types)
34
- }));
35
- }
package/src/Abi/toV2.ts DELETED
@@ -1,58 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/api-contract authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { Text } from '@pezkuwi/types';
5
- import type { ContractConstructorSpecV0, ContractEventSpecV0, ContractMessageSpecV0, ContractMetadataV1, ContractMetadataV2 } from '@pezkuwi/types/interfaces';
6
- import type { Registry } from '@pezkuwi/types/types';
7
-
8
- import { objectSpread } from '@pezkuwi/util';
9
-
10
- type WithArgs = keyof typeof ARG_TYPES;
11
-
12
- interface NamedEntry {
13
- name: Text | Text[];
14
- }
15
-
16
- type GetArgsType<T extends WithArgs> = T extends 'ContractConstructorSpec'
17
- ? ContractConstructorSpecV0
18
- : T extends ContractEventSpecV0
19
- ? ContractEventSpecV0
20
- : ContractMessageSpecV0;
21
-
22
- interface ArgsEntry <T extends WithArgs> extends NamedEntry {
23
- args: GetArgsType<T>['args'][0][];
24
- }
25
-
26
- const ARG_TYPES = {
27
- ContractConstructorSpec: 'ContractMessageParamSpecV2',
28
- ContractEventSpec: 'ContractEventParamSpecV2',
29
- ContractMessageSpec: 'ContractMessageParamSpecV2'
30
- } as const;
31
-
32
- function v1ToV2Label (entry: NamedEntry): { label: Text } {
33
- return objectSpread({}, entry, {
34
- label: Array.isArray(entry.name)
35
- ? entry.name.join('::')
36
- : entry.name
37
- });
38
- }
39
-
40
- function v1ToV2Labels <T extends WithArgs> (registry: Registry, outType: T, all: ArgsEntry<T>[]): unknown[] {
41
- return all.map((e) =>
42
- registry.createType(`${outType}V2`, objectSpread(v1ToV2Label(e), {
43
- args: e.args.map((a) =>
44
- registry.createType(ARG_TYPES[outType], v1ToV2Label(a))
45
- )
46
- }))
47
- );
48
- }
49
-
50
- export function v1ToV2 (registry: Registry, v1: ContractMetadataV1): ContractMetadataV2 {
51
- return registry.createType('ContractMetadataV2', objectSpread({}, v1, {
52
- spec: objectSpread({}, v1.spec, {
53
- constructors: v1ToV2Labels(registry, 'ContractConstructorSpec', v1.spec.constructors),
54
- events: v1ToV2Labels(registry, 'ContractEventSpec', v1.spec.events),
55
- messages: v1ToV2Labels(registry, 'ContractMessageSpec', v1.spec.messages)
56
- })
57
- }));
58
- }
package/src/Abi/toV3.ts DELETED
@@ -1,18 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/api-contract authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { ContractMetadataV2, ContractMetadataV3 } from '@pezkuwi/types/interfaces';
5
- import type { Registry } from '@pezkuwi/types/types';
6
-
7
- import { objectSpread } from '@pezkuwi/util';
8
-
9
- export function v2ToV3 (registry: Registry, v2: ContractMetadataV2): ContractMetadataV3 {
10
- return registry.createType('ContractMetadataV3', objectSpread({}, v2, {
11
- spec: objectSpread({}, v2.spec, {
12
- constructors: v2.spec.constructors.map((c) =>
13
- // V3 introduces the payable flag on constructors, for <V3, it is always true
14
- registry.createType('ContractConstructorSpecV3', objectSpread({}, c, { payable: true }))
15
- )
16
- })
17
- }));
18
- }
package/src/Abi/toV4.ts DELETED
@@ -1,21 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/api-contract authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { ContractMetadataV3, ContractMetadataV4 } from '@pezkuwi/types/interfaces';
5
- import type { Registry } from '@pezkuwi/types/types';
6
-
7
- import { objectSpread } from '@pezkuwi/util';
8
-
9
- export function v3ToV4 (registry: Registry, v3: ContractMetadataV3): ContractMetadataV4 {
10
- return registry.createType('ContractMetadataV4', objectSpread({}, v3, {
11
- spec: objectSpread({}, v3.spec, {
12
- constructors: v3.spec.constructors.map((c) =>
13
- registry.createType('ContractConstructorSpecV4', objectSpread({}, c))
14
- ),
15
- messages: v3.spec.messages.map((m) =>
16
- registry.createType('ContractMessageSpecV3', objectSpread({}, m))
17
- )
18
- }),
19
- version: registry.createType('Text', '4')
20
- }));
21
- }
package/src/augment.ts DELETED
@@ -1,4 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/api-contract authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import '@pezkuwi/api-augment';
package/src/base/Base.ts DELETED
@@ -1,52 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/api authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { ApiBase } from '@pezkuwi/api/base';
5
- import type { ApiTypes, DecorateMethod } from '@pezkuwi/api/types';
6
- import type { WeightV2 } from '@pezkuwi/types/interfaces';
7
- import type { Registry } from '@pezkuwi/types/types';
8
-
9
- import { isFunction } from '@pezkuwi/util';
10
-
11
- import { Abi } from '../Abi/index.js';
12
-
13
- export abstract class Base<ApiType extends ApiTypes> {
14
- readonly abi: Abi;
15
- readonly api: ApiBase<ApiType>;
16
-
17
- protected readonly _decorateMethod: DecorateMethod<ApiType>;
18
- protected readonly _isWeightV1: boolean;
19
- protected readonly _isRevive: boolean;
20
-
21
- constructor (api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, decorateMethod: DecorateMethod<ApiType>) {
22
- if (!api || !api.isConnected || !api.tx) {
23
- throw new Error('Your API has not been initialized correctly and is not connected to a chain');
24
- }
25
-
26
- this.abi = abi instanceof Abi
27
- ? abi
28
- : new Abi(abi, api.registry.getChainProperties());
29
- this.api = api;
30
- this._decorateMethod = decorateMethod;
31
- this._isWeightV1 = !api.registry.createType<WeightV2>('Weight').proofSize;
32
- this._isRevive = this.abi.isRevive;
33
-
34
- if (this._isRevive) {
35
- if (!api.tx.revive || !isFunction(api.tx.revive.instantiateWithCode) || api.tx.revive.instantiateWithCode.meta.args.length !== 6) {
36
- throw new Error('The runtime does not expose api.tx.revive.instantiateWithCode with storageDepositLimit');
37
- } else if (!api.call.reviveApi || !isFunction(api.call.reviveApi.call)) {
38
- throw new Error('Your runtime does not expose the api.call.reviveApi.call runtime interfaces');
39
- }
40
- } else {
41
- if (!api.tx.contracts || !isFunction(api.tx.contracts.instantiateWithCode) || api.tx.contracts.instantiateWithCode.meta.args.length !== 6) {
42
- throw new Error('The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit');
43
- } else if (!api.call.contractsApi || !isFunction(api.call.contractsApi.call)) {
44
- throw new Error('Your runtime does not expose the api.call.contractsApi.call runtime interfaces');
45
- }
46
- }
47
- }
48
-
49
- public get registry (): Registry {
50
- return this.api.registry;
51
- }
52
- }
@@ -1,90 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/api-contract authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { ApiBase } from '@pezkuwi/api/base';
5
- import type { SubmittableExtrinsic } from '@pezkuwi/api/submittable/types';
6
- import type { ApiTypes, DecorateMethod } from '@pezkuwi/api/types';
7
- import type { AccountId, EventRecord, Hash } from '@pezkuwi/types/interfaces';
8
- import type { ISubmittableResult } from '@pezkuwi/types/types';
9
- import type { Abi } from '../Abi/index.js';
10
- import type { AbiConstructor, BlueprintOptions } from '../types.js';
11
- import type { MapConstructorExec } from './types.js';
12
-
13
- import { SubmittableResult } from '@pezkuwi/api';
14
- import { BN_ZERO, isUndefined } from '@pezkuwi/util';
15
-
16
- import { applyOnEvent } from '../util.js';
17
- import { Base } from './Base.js';
18
- import { Contract } from './Contract.js';
19
- import { convertWeight, createBluePrintTx, encodeSalt } from './util.js';
20
-
21
- export type BlueprintConstructor<ApiType extends ApiTypes> = new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, codeHash: string | Hash | Uint8Array) => Blueprint<ApiType>;
22
-
23
- export class BlueprintSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
24
- readonly contract?: Contract<ApiType> | undefined;
25
-
26
- constructor (result: ISubmittableResult, contract?: Contract<ApiType>) {
27
- super(result);
28
-
29
- this.contract = contract;
30
- }
31
- }
32
-
33
- export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
34
- /**
35
- * @description The on-chain code hash for this blueprint
36
- */
37
- readonly codeHash: Hash;
38
-
39
- readonly #tx: MapConstructorExec<ApiType> = {};
40
-
41
- constructor (api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, codeHash: string | Hash | Uint8Array, decorateMethod: DecorateMethod<ApiType>) {
42
- super(api, abi, decorateMethod);
43
-
44
- this.codeHash = this.registry.createType('Hash', codeHash);
45
-
46
- this.abi.constructors.forEach((c): void => {
47
- if (isUndefined(this.#tx[c.method])) {
48
- this.#tx[c.method] = createBluePrintTx(c, (o, p) => this.#deploy(c, o, p));
49
- }
50
- });
51
- }
52
-
53
- public get tx (): MapConstructorExec<ApiType> {
54
- return this.#tx;
55
- }
56
-
57
- #deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, storageDepositLimit = null, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, BlueprintSubmittableResult<ApiType>> => {
58
- const palletTx = this._isRevive
59
- ? this.api.tx.revive
60
- : this.api.tx.contracts;
61
-
62
- return palletTx.instantiate(
63
- value,
64
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
65
- // @ts-ignore jiggle v1 weights, metadata points to latest
66
- this._isWeightV1
67
- ? convertWeight(gasLimit).v1Weight
68
- : convertWeight(gasLimit).v2Weight,
69
- storageDepositLimit,
70
- this.codeHash,
71
- this.abi.findConstructor(constructorOrId).toU8a(params),
72
- encodeSalt(salt)
73
- ).withResultTransform((result: ISubmittableResult) =>
74
- new BlueprintSubmittableResult(result, applyOnEvent(result, ['Instantiated'], ([record]: EventRecord[]) =>
75
- new Contract<ApiType>(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod), this._isRevive
76
- )
77
- )
78
- );
79
- };
80
- }
81
-
82
- export function extendBlueprint <ApiType extends ApiTypes> (type: ApiType, decorateMethod: DecorateMethod<ApiType>): BlueprintConstructor<ApiType> {
83
- return class extends Blueprint<ApiType> {
84
- static __BlueprintType = type;
85
-
86
- constructor (api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, codeHash: string | Hash | Uint8Array) {
87
- super(api, abi, codeHash, decorateMethod);
88
- }
89
- };
90
- }
@@ -1,47 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/api-contract authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- /// <reference types="@pezkuwi/dev-test/globals.d.ts" />
5
-
6
- import fs from 'node:fs';
7
-
8
- import { toPromiseMethod } from '@pezkuwi/api';
9
-
10
- import v0contractFlipper from '../test/contracts/ink/v0/flipper.contract.json' with { type: 'json' };
11
- import v0abiFlipper from '../test/contracts/ink/v0/flipper.json' with { type: 'json' };
12
- import v1contractFlipper from '../test/contracts/ink/v1/flipper.contract.json' with { type: 'json' };
13
- import v6contractErc20 from '../test/contracts/ink/v6/erc20.contract.json' with { type: 'json' };
14
- import { Code } from './Code.js';
15
- import { mockApi, mockReviveApi } from './mock.js';
16
-
17
- const v0wasmFlipper = fs.readFileSync(new URL('../test/contracts/ink/v0/flipper.wasm', import.meta.url), 'utf-8');
18
-
19
- describe('Code', (): void => {
20
- it('can construct with an individual ABI/WASM combo', (): void => {
21
- expect(
22
- () => new Code(mockApi, v0abiFlipper as Record<string, unknown>, v0wasmFlipper, toPromiseMethod)
23
- ).not.toThrow();
24
- });
25
-
26
- it('can construct with an .contract ABI (v0)', (): void => {
27
- expect(
28
- () => new Code(mockApi, v0contractFlipper as Record<string, unknown>, null, toPromiseMethod)
29
- ).not.toThrow();
30
- });
31
-
32
- it('can construct with an .contract ABI (v1)', (): void => {
33
- expect(
34
- () => new Code(mockApi, v1contractFlipper as Record<string, unknown>, null, toPromiseMethod)
35
- ).not.toThrow();
36
- });
37
-
38
- it('can construct a revive compatible contract (v6)', (): void => {
39
- expect(
40
- () => new Code(mockApi, v6contractErc20 as Record<string, unknown>, null, toPromiseMethod)
41
- ).toThrow('The runtime does not expose api.tx.revive.instantiateWithCode with storageDepositLimit');
42
-
43
- expect(
44
- () => new Code(mockReviveApi, v6contractErc20 as Record<string, unknown>, null, toPromiseMethod)
45
- ).not.toThrow();
46
- });
47
- });
package/src/base/Code.ts DELETED
@@ -1,142 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/api-contract authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import type { ApiBase } from '@pezkuwi/api/base';
5
- import type { SubmittableExtrinsic } from '@pezkuwi/api/submittable/types';
6
- import type { ApiTypes, DecorateMethod } from '@pezkuwi/api/types';
7
- import type { AccountId, EventRecord } from '@pezkuwi/types/interfaces';
8
- import type { ISubmittableResult } from '@pezkuwi/types/types';
9
- import type { Codec } from '@pezkuwi/types-codec/types';
10
- import type { Abi } from '../Abi/index.js';
11
- import type { AbiConstructor, BlueprintOptions } from '../types.js';
12
- import type { MapConstructorExec } from './types.js';
13
-
14
- import { SubmittableResult } from '@pezkuwi/api';
15
- import { BN_ZERO, compactAddLength, isRiscV, isUndefined, isWasm, u8aToU8a } from '@pezkuwi/util';
16
-
17
- import { applyOnEvent } from '../util.js';
18
- import { Base } from './Base.js';
19
- import { Blueprint } from './Blueprint.js';
20
- import { Contract } from './Contract.js';
21
- import { convertWeight, createBluePrintTx, encodeSalt } from './util.js';
22
-
23
- export type CodeConstructor<ApiType extends ApiTypes> = new(api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, wasm: Uint8Array | string | Buffer | null | undefined) => Code<ApiType>;
24
-
25
- export class CodeSubmittableResult<ApiType extends ApiTypes> extends SubmittableResult {
26
- readonly blueprint?: Blueprint<ApiType> | undefined;
27
- readonly contract?: Contract<ApiType> | undefined;
28
-
29
- constructor (result: ISubmittableResult, blueprint?: Blueprint<ApiType> | undefined, contract?: Contract<ApiType> | undefined) {
30
- super(result);
31
-
32
- this.blueprint = blueprint;
33
- this.contract = contract;
34
- }
35
- }
36
-
37
- // checks to see if the code (or at least the header)
38
- // is a valid/supported format
39
- function isValidCode (code: Uint8Array): boolean {
40
- return isWasm(code) || isRiscV(code);
41
- }
42
-
43
- export class Code<ApiType extends ApiTypes> extends Base<ApiType> {
44
- readonly code: Uint8Array;
45
-
46
- readonly #tx: MapConstructorExec<ApiType> = {};
47
-
48
- constructor (api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, wasm: Uint8Array | string | Buffer | null | undefined, decorateMethod: DecorateMethod<ApiType>) {
49
- super(api, abi, decorateMethod);
50
-
51
- this.code = isValidCode(this.abi.info.source.wasm)
52
- ? this.abi.info.source.wasm
53
- : u8aToU8a(wasm);
54
-
55
- if (!isValidCode(this.code)) {
56
- throw new Error('Invalid code provided');
57
- }
58
-
59
- this.abi.constructors.forEach((c): void => {
60
- if (isUndefined(this.#tx[c.method])) {
61
- this.#tx[c.method] = createBluePrintTx(c, (o, p) => this.#instantiate(c, o, p));
62
- }
63
- });
64
- }
65
-
66
- public get tx (): MapConstructorExec<ApiType> {
67
- return this.#tx;
68
- }
69
-
70
- #instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, storageDepositLimit = null, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic<ApiType, CodeSubmittableResult<ApiType>> => {
71
- const palletTx = this._isRevive ? this.api.tx.revive : this.api.tx.contracts;
72
-
73
- if (this._isRevive) {
74
- return palletTx.instantiateWithCode(
75
- value,
76
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
77
- // @ts-ignore jiggle v1 weights, metadata points to latest
78
- this._isWeightV1
79
- ? convertWeight(gasLimit).v1Weight
80
- : convertWeight(gasLimit).v2Weight,
81
- storageDepositLimit,
82
- compactAddLength(this.code),
83
- this.abi.findConstructor(constructorOrId).toU8a(params),
84
- encodeSalt(salt)
85
- ).withResultTransform((result: ISubmittableResult) =>
86
- new CodeSubmittableResult(
87
- result,
88
- ...(applyOnEvent(result, ['Instantiated'], (records: EventRecord[]) =>
89
- records.reduce<[Blueprint<ApiType> | undefined, Contract<ApiType> | undefined]>(
90
- ([blueprint, contract], { event }) =>
91
- this.api.events.revive['Instantiated'].is(event)
92
- ? [
93
- blueprint,
94
- new Contract<ApiType>(
95
- this.api,
96
- this.abi,
97
- (event as unknown as { data: [Codec, AccountId] }).data[1],
98
- this._decorateMethod
99
- )
100
- ]
101
- : [blueprint, contract],
102
- [undefined, undefined]
103
- ), this._isRevive
104
- ) || [undefined, undefined])
105
- )
106
- );
107
- }
108
-
109
- return palletTx.instantiateWithCode(
110
- value,
111
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
112
- // @ts-ignore jiggle v1 weights, metadata points to latest
113
- this._isWeightV1
114
- ? convertWeight(gasLimit).v1Weight
115
- : convertWeight(gasLimit).v2Weight,
116
- storageDepositLimit,
117
- compactAddLength(this.code),
118
- this.abi.findConstructor(constructorOrId).toU8a(params),
119
- encodeSalt(salt)
120
- ).withResultTransform((result: ISubmittableResult) =>
121
- new CodeSubmittableResult(result, ...(applyOnEvent(result, ['CodeStored', 'Instantiated'], (records: EventRecord[]) =>
122
- records.reduce<[Blueprint<ApiType> | undefined, Contract<ApiType> | undefined]>(([blueprint, contract], { event }) =>
123
- this.api.events.contracts.Instantiated.is(event)
124
- ? [blueprint, new Contract<ApiType>(this.api, this.abi, (event as unknown as { data: [Codec, AccountId] }).data[1], this._decorateMethod)]
125
- : this.api.events.contracts.CodeStored.is(event)
126
- ? [new Blueprint<ApiType>(this.api, this.abi, (event as unknown as { data: [AccountId] }).data[0], this._decorateMethod), contract]
127
- : [blueprint, contract],
128
- [undefined, undefined]), this._isRevive
129
- ) || [undefined, undefined]))
130
- );
131
- };
132
- }
133
-
134
- export function extendCode <ApiType extends ApiTypes> (type: ApiType, decorateMethod: DecorateMethod<ApiType>): CodeConstructor<ApiType> {
135
- return class extends Code<ApiType> {
136
- static __CodeType = type;
137
-
138
- constructor (api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, wasm: Uint8Array | string | Buffer | null | undefined) {
139
- super(api, abi, wasm, decorateMethod);
140
- }
141
- };
142
- }