@pezkuwi/api 16.5.8 → 16.5.9

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 (379) hide show
  1. package/bundle-pezkuwi-api.js +22 -17
  2. package/cjs/packageInfo.js +1 -1
  3. package/package.json +19 -18
  4. package/packageInfo.js +1 -1
  5. package/build/LICENSE +0 -201
  6. package/build/README.md +0 -100
  7. package/build/augment.d.ts +0 -1
  8. package/build/augment.js +0 -1
  9. package/build/base/Decorate.d.ts +0 -143
  10. package/build/base/Decorate.js +0 -752
  11. package/build/base/Events.d.ts +0 -67
  12. package/build/base/Events.js +0 -78
  13. package/build/base/Getters.d.ts +0 -163
  14. package/build/base/Getters.js +0 -207
  15. package/build/base/Init.d.ts +0 -44
  16. package/build/base/Init.js +0 -400
  17. package/build/base/find.d.ts +0 -3
  18. package/build/base/find.js +0 -7
  19. package/build/base/index.d.ts +0 -47
  20. package/build/base/index.js +0 -57
  21. package/build/base/types.d.ts +0 -15
  22. package/build/base/types.js +0 -1
  23. package/build/bundle-pezkuwi-api.js +0 -26247
  24. package/build/bundle.d.ts +0 -7
  25. package/build/bundle.js +0 -7
  26. package/build/cjs/augment.d.ts +0 -1
  27. package/build/cjs/augment.js +0 -3
  28. package/build/cjs/base/Decorate.d.ts +0 -143
  29. package/build/cjs/base/Decorate.js +0 -756
  30. package/build/cjs/base/Events.d.ts +0 -67
  31. package/build/cjs/base/Events.js +0 -82
  32. package/build/cjs/base/Getters.d.ts +0 -163
  33. package/build/cjs/base/Getters.js +0 -211
  34. package/build/cjs/base/Init.d.ts +0 -44
  35. package/build/cjs/base/Init.js +0 -404
  36. package/build/cjs/base/find.d.ts +0 -3
  37. package/build/cjs/base/find.js +0 -11
  38. package/build/cjs/base/index.d.ts +0 -47
  39. package/build/cjs/base/index.js +0 -61
  40. package/build/cjs/base/types.d.ts +0 -15
  41. package/build/cjs/base/types.js +0 -2
  42. package/build/cjs/bundle.d.ts +0 -7
  43. package/build/cjs/bundle.js +0 -17
  44. package/build/cjs/index.d.ts +0 -2
  45. package/build/cjs/index.js +0 -5
  46. package/build/cjs/package.json +0 -3
  47. package/build/cjs/packageDetect.d.ts +0 -1
  48. package/build/cjs/packageDetect.js +0 -10
  49. package/build/cjs/packageInfo.d.ts +0 -6
  50. package/build/cjs/packageInfo.js +0 -4
  51. package/build/cjs/promise/Api.d.ts +0 -158
  52. package/build/cjs/promise/Api.js +0 -195
  53. package/build/cjs/promise/Combinator.d.ts +0 -12
  54. package/build/cjs/promise/Combinator.js +0 -72
  55. package/build/cjs/promise/decorateMethod.d.ts +0 -14
  56. package/build/cjs/promise/decorateMethod.js +0 -75
  57. package/build/cjs/promise/index.d.ts +0 -2
  58. package/build/cjs/promise/index.js +0 -7
  59. package/build/cjs/promise/types.d.ts +0 -5
  60. package/build/cjs/promise/types.js +0 -2
  61. package/build/cjs/rx/Api.d.ts +0 -155
  62. package/build/cjs/rx/Api.js +0 -173
  63. package/build/cjs/rx/decorateMethod.d.ts +0 -3
  64. package/build/cjs/rx/decorateMethod.js +0 -6
  65. package/build/cjs/rx/index.d.ts +0 -2
  66. package/build/cjs/rx/index.js +0 -7
  67. package/build/cjs/submittable/Result.d.ts +0 -31
  68. package/build/cjs/submittable/Result.js +0 -84
  69. package/build/cjs/submittable/createClass.d.ts +0 -12
  70. package/build/cjs/submittable/createClass.js +0 -277
  71. package/build/cjs/submittable/createSubmittable.d.ts +0 -8
  72. package/build/cjs/submittable/createSubmittable.js +0 -8
  73. package/build/cjs/submittable/index.d.ts +0 -2
  74. package/build/cjs/submittable/index.js +0 -7
  75. package/build/cjs/submittable/types.d.ts +0 -1
  76. package/build/cjs/submittable/types.js +0 -2
  77. package/build/cjs/types/calls.d.ts +0 -1
  78. package/build/cjs/types/calls.js +0 -4
  79. package/build/cjs/types/consts.d.ts +0 -1
  80. package/build/cjs/types/consts.js +0 -4
  81. package/build/cjs/types/errors.d.ts +0 -1
  82. package/build/cjs/types/errors.js +0 -4
  83. package/build/cjs/types/events.d.ts +0 -1
  84. package/build/cjs/types/events.js +0 -4
  85. package/build/cjs/types/index.d.ts +0 -114
  86. package/build/cjs/types/index.js +0 -13
  87. package/build/cjs/types/storage.d.ts +0 -1
  88. package/build/cjs/types/storage.js +0 -4
  89. package/build/cjs/types/submittable.d.ts +0 -1
  90. package/build/cjs/types/submittable.js +0 -4
  91. package/build/cjs/util/augmentObject.d.ts +0 -9
  92. package/build/cjs/util/augmentObject.js +0 -84
  93. package/build/cjs/util/decorate.d.ts +0 -16
  94. package/build/cjs/util/decorate.js +0 -17
  95. package/build/cjs/util/filterEvents.d.ts +0 -6
  96. package/build/cjs/util/filterEvents.js +0 -25
  97. package/build/cjs/util/index.d.ts +0 -4
  98. package/build/cjs/util/index.js +0 -11
  99. package/build/cjs/util/isKeyringPair.d.ts +0 -3
  100. package/build/cjs/util/isKeyringPair.js +0 -7
  101. package/build/cjs/util/logging.d.ts +0 -1
  102. package/build/cjs/util/logging.js +0 -5
  103. package/build/cjs/util/validate.d.ts +0 -3
  104. package/build/cjs/util/validate.js +0 -26
  105. package/build/index.d.ts +0 -2
  106. package/build/index.js +0 -2
  107. package/build/package.json +0 -612
  108. package/build/packageDetect.d.ts +0 -1
  109. package/build/packageDetect.js +0 -8
  110. package/build/packageInfo.d.ts +0 -6
  111. package/build/packageInfo.js +0 -1
  112. package/build/promise/Api.d.ts +0 -158
  113. package/build/promise/Api.js +0 -191
  114. package/build/promise/Combinator.d.ts +0 -12
  115. package/build/promise/Combinator.js +0 -68
  116. package/build/promise/decorateMethod.d.ts +0 -14
  117. package/build/promise/decorateMethod.js +0 -71
  118. package/build/promise/index.d.ts +0 -2
  119. package/build/promise/index.js +0 -2
  120. package/build/promise/types.d.ts +0 -5
  121. package/build/promise/types.js +0 -1
  122. package/build/rx/Api.d.ts +0 -155
  123. package/build/rx/Api.js +0 -169
  124. package/build/rx/decorateMethod.d.ts +0 -3
  125. package/build/rx/decorateMethod.js +0 -3
  126. package/build/rx/index.d.ts +0 -2
  127. package/build/rx/index.js +0 -2
  128. package/build/submittable/Result.d.ts +0 -31
  129. package/build/submittable/Result.js +0 -80
  130. package/build/submittable/createClass.d.ts +0 -12
  131. package/build/submittable/createClass.js +0 -274
  132. package/build/submittable/createSubmittable.d.ts +0 -8
  133. package/build/submittable/createSubmittable.js +0 -5
  134. package/build/submittable/index.d.ts +0 -2
  135. package/build/submittable/index.js +0 -2
  136. package/build/submittable/types.d.ts +0 -1
  137. package/build/submittable/types.js +0 -1
  138. package/build/types/calls.d.ts +0 -1
  139. package/build/types/calls.js +0 -1
  140. package/build/types/consts.d.ts +0 -1
  141. package/build/types/consts.js +0 -1
  142. package/build/types/errors.d.ts +0 -1
  143. package/build/types/errors.js +0 -1
  144. package/build/types/events.d.ts +0 -1
  145. package/build/types/events.js +0 -1
  146. package/build/types/index.d.ts +0 -114
  147. package/build/types/index.js +0 -8
  148. package/build/types/storage.d.ts +0 -1
  149. package/build/types/storage.js +0 -1
  150. package/build/types/submittable.d.ts +0 -1
  151. package/build/types/submittable.js +0 -1
  152. package/build/util/augmentObject.d.ts +0 -9
  153. package/build/util/augmentObject.js +0 -81
  154. package/build/util/decorate.d.ts +0 -16
  155. package/build/util/decorate.js +0 -14
  156. package/build/util/filterEvents.d.ts +0 -6
  157. package/build/util/filterEvents.js +0 -22
  158. package/build/util/index.d.ts +0 -4
  159. package/build/util/index.js +0 -4
  160. package/build/util/isKeyringPair.d.ts +0 -3
  161. package/build/util/isKeyringPair.js +0 -4
  162. package/build/util/logging.d.ts +0 -1
  163. package/build/util/logging.js +0 -2
  164. package/build/util/validate.d.ts +0 -3
  165. package/build/util/validate.js +0 -23
  166. package/build-deno/README.md +0 -95
  167. package/build-deno/augment.ts +0 -2
  168. package/build-deno/base/Decorate.ts +0 -1100
  169. package/build-deno/base/Events.ts +0 -89
  170. package/build-deno/base/Getters.ts +0 -243
  171. package/build-deno/base/Init.ts +0 -523
  172. package/build-deno/base/find.ts +0 -12
  173. package/build-deno/base/index.ts +0 -83
  174. package/build-deno/base/types.ts +0 -17
  175. package/build-deno/bundle.ts +0 -11
  176. package/build-deno/checkTypes.manual.ts +0 -320
  177. package/build-deno/index.ts +0 -4
  178. package/build-deno/mod.ts +0 -2
  179. package/build-deno/packageDetect.ts +0 -12
  180. package/build-deno/packageInfo.ts +0 -3
  181. package/build-deno/promise/Api.ts +0 -212
  182. package/build-deno/promise/Combinator.ts +0 -89
  183. package/build-deno/promise/decorateMethod.ts +0 -111
  184. package/build-deno/promise/index.ts +0 -3
  185. package/build-deno/promise/types.ts +0 -7
  186. package/build-deno/rx/Api.ts +0 -184
  187. package/build-deno/rx/decorateMethod.ts +0 -7
  188. package/build-deno/rx/index.ts +0 -3
  189. package/build-deno/submittable/Result.ts +0 -109
  190. package/build-deno/submittable/createClass.ts +0 -436
  191. package/build-deno/submittable/createSubmittable.ts +0 -17
  192. package/build-deno/submittable/index.ts +0 -3
  193. package/build-deno/submittable/types.ts +0 -2
  194. package/build-deno/test/SingleAccountSigner.ts +0 -51
  195. package/build-deno/test/index.ts +0 -3
  196. package/build-deno/test/logEvents.ts +0 -21
  197. package/build-deno/types/calls.ts +0 -2
  198. package/build-deno/types/consts.ts +0 -2
  199. package/build-deno/types/errors.ts +0 -2
  200. package/build-deno/types/events.ts +0 -2
  201. package/build-deno/types/index.ts +0 -124
  202. package/build-deno/types/storage.ts +0 -2
  203. package/build-deno/types/submittable.ts +0 -2
  204. package/build-deno/util/augmentObject.ts +0 -109
  205. package/build-deno/util/decorate.ts +0 -38
  206. package/build-deno/util/filterEvents.ts +0 -32
  207. package/build-deno/util/index.ts +0 -6
  208. package/build-deno/util/isKeyringPair.ts +0 -9
  209. package/build-deno/util/logging.ts +0 -4
  210. package/build-deno/util/validate.ts +0 -32
  211. package/build-tsc/augment.d.ts +0 -1
  212. package/build-tsc/base/Decorate.d.ts +0 -143
  213. package/build-tsc/base/Events.d.ts +0 -67
  214. package/build-tsc/base/Getters.d.ts +0 -163
  215. package/build-tsc/base/Init.d.ts +0 -44
  216. package/build-tsc/base/find.d.ts +0 -3
  217. package/build-tsc/base/index.d.ts +0 -47
  218. package/build-tsc/base/types.d.ts +0 -15
  219. package/build-tsc/bundle.d.ts +0 -7
  220. package/build-tsc/index.d.ts +0 -2
  221. package/build-tsc/packageDetect.d.ts +0 -1
  222. package/build-tsc/packageInfo.d.ts +0 -6
  223. package/build-tsc/promise/Api.d.ts +0 -158
  224. package/build-tsc/promise/Combinator.d.ts +0 -12
  225. package/build-tsc/promise/decorateMethod.d.ts +0 -14
  226. package/build-tsc/promise/index.d.ts +0 -2
  227. package/build-tsc/promise/types.d.ts +0 -5
  228. package/build-tsc/rx/Api.d.ts +0 -155
  229. package/build-tsc/rx/decorateMethod.d.ts +0 -3
  230. package/build-tsc/rx/index.d.ts +0 -2
  231. package/build-tsc/submittable/Result.d.ts +0 -31
  232. package/build-tsc/submittable/createClass.d.ts +0 -12
  233. package/build-tsc/submittable/createSubmittable.d.ts +0 -8
  234. package/build-tsc/submittable/index.d.ts +0 -2
  235. package/build-tsc/submittable/types.d.ts +0 -1
  236. package/build-tsc/types/calls.d.ts +0 -1
  237. package/build-tsc/types/consts.d.ts +0 -1
  238. package/build-tsc/types/errors.d.ts +0 -1
  239. package/build-tsc/types/events.d.ts +0 -1
  240. package/build-tsc/types/index.d.ts +0 -114
  241. package/build-tsc/types/storage.d.ts +0 -1
  242. package/build-tsc/types/submittable.d.ts +0 -1
  243. package/build-tsc/util/augmentObject.d.ts +0 -9
  244. package/build-tsc/util/decorate.d.ts +0 -16
  245. package/build-tsc/util/filterEvents.d.ts +0 -6
  246. package/build-tsc/util/index.d.ts +0 -4
  247. package/build-tsc/util/isKeyringPair.d.ts +0 -3
  248. package/build-tsc/util/logging.d.ts +0 -1
  249. package/build-tsc/util/validate.d.ts +0 -3
  250. package/build-tsc-cjs/augment.js +0 -3
  251. package/build-tsc-cjs/base/Decorate.js +0 -756
  252. package/build-tsc-cjs/base/Events.js +0 -82
  253. package/build-tsc-cjs/base/Getters.js +0 -211
  254. package/build-tsc-cjs/base/Init.js +0 -404
  255. package/build-tsc-cjs/base/find.js +0 -11
  256. package/build-tsc-cjs/base/index.js +0 -61
  257. package/build-tsc-cjs/base/types.js +0 -2
  258. package/build-tsc-cjs/bundle.js +0 -17
  259. package/build-tsc-cjs/index.js +0 -5
  260. package/build-tsc-cjs/packageDetect.js +0 -10
  261. package/build-tsc-cjs/packageInfo.js +0 -4
  262. package/build-tsc-cjs/promise/Api.js +0 -195
  263. package/build-tsc-cjs/promise/Combinator.js +0 -72
  264. package/build-tsc-cjs/promise/decorateMethod.js +0 -75
  265. package/build-tsc-cjs/promise/index.js +0 -7
  266. package/build-tsc-cjs/promise/types.js +0 -2
  267. package/build-tsc-cjs/rx/Api.js +0 -173
  268. package/build-tsc-cjs/rx/decorateMethod.js +0 -6
  269. package/build-tsc-cjs/rx/index.js +0 -7
  270. package/build-tsc-cjs/submittable/Result.js +0 -84
  271. package/build-tsc-cjs/submittable/createClass.js +0 -277
  272. package/build-tsc-cjs/submittable/createSubmittable.js +0 -8
  273. package/build-tsc-cjs/submittable/index.js +0 -7
  274. package/build-tsc-cjs/submittable/types.js +0 -2
  275. package/build-tsc-cjs/types/calls.js +0 -4
  276. package/build-tsc-cjs/types/consts.js +0 -4
  277. package/build-tsc-cjs/types/errors.js +0 -4
  278. package/build-tsc-cjs/types/events.js +0 -4
  279. package/build-tsc-cjs/types/index.js +0 -13
  280. package/build-tsc-cjs/types/storage.js +0 -4
  281. package/build-tsc-cjs/types/submittable.js +0 -4
  282. package/build-tsc-cjs/util/augmentObject.js +0 -84
  283. package/build-tsc-cjs/util/decorate.js +0 -17
  284. package/build-tsc-cjs/util/filterEvents.js +0 -25
  285. package/build-tsc-cjs/util/index.js +0 -11
  286. package/build-tsc-cjs/util/isKeyringPair.js +0 -7
  287. package/build-tsc-cjs/util/logging.js +0 -5
  288. package/build-tsc-cjs/util/validate.js +0 -26
  289. package/build-tsc-esm/augment.js +0 -1
  290. package/build-tsc-esm/base/Decorate.js +0 -752
  291. package/build-tsc-esm/base/Events.js +0 -78
  292. package/build-tsc-esm/base/Getters.js +0 -207
  293. package/build-tsc-esm/base/Init.js +0 -400
  294. package/build-tsc-esm/base/find.js +0 -7
  295. package/build-tsc-esm/base/index.js +0 -57
  296. package/build-tsc-esm/base/types.js +0 -1
  297. package/build-tsc-esm/bundle.js +0 -7
  298. package/build-tsc-esm/index.js +0 -2
  299. package/build-tsc-esm/packageDetect.js +0 -8
  300. package/build-tsc-esm/packageInfo.js +0 -1
  301. package/build-tsc-esm/promise/Api.js +0 -191
  302. package/build-tsc-esm/promise/Combinator.js +0 -68
  303. package/build-tsc-esm/promise/decorateMethod.js +0 -71
  304. package/build-tsc-esm/promise/index.js +0 -2
  305. package/build-tsc-esm/promise/types.js +0 -1
  306. package/build-tsc-esm/rx/Api.js +0 -169
  307. package/build-tsc-esm/rx/decorateMethod.js +0 -3
  308. package/build-tsc-esm/rx/index.js +0 -2
  309. package/build-tsc-esm/submittable/Result.js +0 -80
  310. package/build-tsc-esm/submittable/createClass.js +0 -274
  311. package/build-tsc-esm/submittable/createSubmittable.js +0 -5
  312. package/build-tsc-esm/submittable/index.js +0 -2
  313. package/build-tsc-esm/submittable/types.js +0 -1
  314. package/build-tsc-esm/types/calls.js +0 -1
  315. package/build-tsc-esm/types/consts.js +0 -1
  316. package/build-tsc-esm/types/errors.js +0 -1
  317. package/build-tsc-esm/types/events.js +0 -1
  318. package/build-tsc-esm/types/index.js +0 -8
  319. package/build-tsc-esm/types/storage.js +0 -1
  320. package/build-tsc-esm/types/submittable.js +0 -1
  321. package/build-tsc-esm/util/augmentObject.js +0 -81
  322. package/build-tsc-esm/util/decorate.js +0 -14
  323. package/build-tsc-esm/util/filterEvents.js +0 -22
  324. package/build-tsc-esm/util/index.js +0 -4
  325. package/build-tsc-esm/util/isKeyringPair.js +0 -4
  326. package/build-tsc-esm/util/logging.js +0 -2
  327. package/build-tsc-esm/util/validate.js +0 -23
  328. package/src/augment.ts +0 -4
  329. package/src/base/Decorate.ts +0 -1103
  330. package/src/base/Events.ts +0 -91
  331. package/src/base/Getters.ts +0 -245
  332. package/src/base/Init.ts +0 -525
  333. package/src/base/find.ts +0 -14
  334. package/src/base/index.ts +0 -85
  335. package/src/base/types.ts +0 -19
  336. package/src/bundle.ts +0 -16
  337. package/src/checkTypes.manual.ts +0 -323
  338. package/src/index.ts +0 -6
  339. package/src/mod.ts +0 -4
  340. package/src/packageDetect.ts +0 -16
  341. package/src/packageInfo.ts +0 -6
  342. package/src/promise/Api.ts +0 -214
  343. package/src/promise/Combinator.ts +0 -91
  344. package/src/promise/Combinators.spec.ts +0 -109
  345. package/src/promise/decorateMethod.ts +0 -118
  346. package/src/promise/index.spec.ts +0 -167
  347. package/src/promise/index.ts +0 -5
  348. package/src/promise/types.ts +0 -9
  349. package/src/rx/Api.ts +0 -186
  350. package/src/rx/decorateMethod.ts +0 -9
  351. package/src/rx/index.ts +0 -5
  352. package/src/submittable/Result.ts +0 -111
  353. package/src/submittable/createClass.ts +0 -438
  354. package/src/submittable/createSubmittable.ts +0 -19
  355. package/src/submittable/index.ts +0 -5
  356. package/src/submittable/types.ts +0 -4
  357. package/src/test/SingleAccountSigner.ts +0 -53
  358. package/src/test/index.ts +0 -5
  359. package/src/test/logEvents.ts +0 -24
  360. package/src/types/calls.ts +0 -4
  361. package/src/types/consts.ts +0 -4
  362. package/src/types/errors.ts +0 -4
  363. package/src/types/events.ts +0 -4
  364. package/src/types/index.ts +0 -137
  365. package/src/types/storage.ts +0 -4
  366. package/src/types/submittable.ts +0 -4
  367. package/src/util/augmentObject.spec.ts +0 -54
  368. package/src/util/augmentObject.ts +0 -112
  369. package/src/util/decorate.ts +0 -43
  370. package/src/util/filterEvents.ts +0 -34
  371. package/src/util/index.ts +0 -10
  372. package/src/util/isKeyringPair.ts +0 -11
  373. package/src/util/logging.ts +0 -6
  374. package/src/util/validate.spec.ts +0 -72
  375. package/src/util/validate.ts +0 -36
  376. package/tsconfig.build.json +0 -25
  377. package/tsconfig.build.tsbuildinfo +0 -1
  378. package/tsconfig.spec.json +0 -26
  379. package/tsconfig.spec.tsbuildinfo +0 -1
@@ -1,277 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createClass = createClass;
4
- const rxjs_1 = require("rxjs");
5
- const util_1 = require("@pezkuwi/util");
6
- const index_js_1 = require("../util/index.js");
7
- const Result_js_1 = require("./Result.js");
8
- function makeEraOptions(api, registry, partialOptions, { header, mortalLength, nonce }) {
9
- if (!header) {
10
- if (partialOptions.era && !partialOptions.blockHash) {
11
- throw new Error('Expected blockHash to be passed alongside non-immortal era options');
12
- }
13
- if ((0, util_1.isNumber)(partialOptions.era)) {
14
- // since we have no header, it is immortal, remove any option overrides
15
- // so we only supply the genesisHash and no era to the construction
16
- delete partialOptions.era;
17
- delete partialOptions.blockHash;
18
- }
19
- return makeSignOptions(api, partialOptions, { nonce });
20
- }
21
- return makeSignOptions(api, partialOptions, {
22
- blockHash: header.hash,
23
- era: registry.createTypeUnsafe('ExtrinsicEra', [{
24
- current: header.number,
25
- period: partialOptions.era || mortalLength
26
- }]),
27
- nonce
28
- });
29
- }
30
- function makeSignAndSendOptions(partialOptions, statusCb) {
31
- let options = {};
32
- if ((0, util_1.isFunction)(partialOptions)) {
33
- statusCb = partialOptions;
34
- }
35
- else {
36
- options = (0, util_1.objectSpread)({}, partialOptions);
37
- }
38
- return [options, statusCb];
39
- }
40
- function makeSignOptions(api, partialOptions, extras) {
41
- return (0, util_1.objectSpread)({ blockHash: api.genesisHash, genesisHash: api.genesisHash }, partialOptions, extras, { runtimeVersion: api.runtimeVersion, signedExtensions: api.registry.signedExtensions, version: api.extrinsicType });
42
- }
43
- function optionsOrNonce(partialOptions = {}) {
44
- return (0, util_1.isBn)(partialOptions) || (0, util_1.isNumber)(partialOptions)
45
- ? { nonce: partialOptions }
46
- : partialOptions;
47
- }
48
- function createClass({ api, apiType, blockHash, decorateMethod }) {
49
- // an instance of the base extrinsic for us to extend
50
- const ExtrinsicBase = api.registry.createClass('Extrinsic');
51
- const extrinsicInfoMap = new WeakMap();
52
- class Submittable extends ExtrinsicBase {
53
- #ignoreStatusCb;
54
- #transformResult = (util_1.identity);
55
- constructor(registry, extrinsic) {
56
- super(registry, extrinsic, { version: api.extrinsicType });
57
- this.#ignoreStatusCb = apiType === 'rxjs';
58
- }
59
- get hasDryRun() {
60
- return (0, util_1.isFunction)(api.rpc.system?.dryRun);
61
- }
62
- get hasPaymentInfo() {
63
- return (0, util_1.isFunction)(api.call.transactionPaymentApi?.queryInfo);
64
- }
65
- // dry run an extrinsic
66
- dryRun(account, optionsOrHash) {
67
- if (!this.hasDryRun) {
68
- throw new Error('The system.dryRun RPC call is not available in your environment');
69
- }
70
- if (blockHash || (0, util_1.isString)(optionsOrHash) || (0, util_1.isU8a)(optionsOrHash)) {
71
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
72
- return decorateMethod(() => api.rpc.system.dryRun(this.toHex(), blockHash || optionsOrHash));
73
- }
74
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call
75
- return decorateMethod(() => this.#observeSign(account, optionsOrHash).pipe((0, rxjs_1.switchMap)(() => api.rpc.system.dryRun(this.toHex()))))();
76
- }
77
- // calculate the payment info for this transaction (if signed and submitted)
78
- paymentInfo(account, optionsOrHash) {
79
- if (!this.hasPaymentInfo) {
80
- throw new Error('The transactionPaymentApi.queryInfo runtime call is not available in your environment');
81
- }
82
- if (blockHash || (0, util_1.isString)(optionsOrHash) || (0, util_1.isU8a)(optionsOrHash)) {
83
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
84
- return decorateMethod(() => api.callAt(blockHash || optionsOrHash).pipe((0, rxjs_1.switchMap)((callAt) => {
85
- const u8a = this.toU8a();
86
- return callAt.transactionPaymentApi.queryInfo(u8a, u8a.length);
87
- })));
88
- }
89
- const [allOptions] = makeSignAndSendOptions(optionsOrHash);
90
- const address = (0, index_js_1.isKeyringPair)(account) ? account.address : account.toString();
91
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call
92
- return decorateMethod(() => api.derive.tx.signingInfo(address, allOptions.nonce, allOptions.era).pipe((0, rxjs_1.first)(), (0, rxjs_1.switchMap)((signingInfo) => {
93
- // setup our options (same way as in signAndSend)
94
- const eraOptions = makeEraOptions(api, this.registry, allOptions, signingInfo);
95
- const signOptions = makeSignOptions(api, eraOptions, {});
96
- // 1. Don't use the internal objects inside the new tx (hence toU8a)
97
- // 2. Don't override the data from existing signed extrinsics
98
- // 3. Ensure that this object stays intact, with no new sign after operation
99
- const u8a = api.tx(this.toU8a()).signFake(address, signOptions).toU8a();
100
- return api.call.transactionPaymentApi.queryInfo(u8a, u8a.length);
101
- })))();
102
- }
103
- // send implementation for both immediate Hash and statusCb variants
104
- send(statusCb) {
105
- const isSubscription = api.hasSubscriptions && (this.#ignoreStatusCb || !!statusCb);
106
- const updatedInfo = extrinsicInfoMap.get(this);
107
- extrinsicInfoMap.delete(this);
108
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call
109
- return decorateMethod(isSubscription
110
- ? () => this.#observeSubscribe(updatedInfo)
111
- : () => this.#observeSend(updatedInfo))(statusCb);
112
- }
113
- /**
114
- * @description Signs a transaction, returning `this` to allow chaining. E.g.: `signAsync(...).send()`. Like `.signAndSend` this will retrieve the nonce and blockHash to send the tx with.
115
- */
116
- signAsync(account, partialOptions) {
117
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call
118
- return decorateMethod(() => this.#observeSign(account, partialOptions).pipe((0, rxjs_1.map)((info) => {
119
- // If we got a full signed transaction from the signer, attach it
120
- if (info.signedTransaction) {
121
- const extrinsic = new Submittable(api.registry, info.signedTransaction);
122
- extrinsicInfoMap.set(this, info);
123
- return extrinsic;
124
- }
125
- // Fallback if signer didn’t return signedTransaction
126
- return this;
127
- })))();
128
- }
129
- // signAndSend implementation for all 3 cases above
130
- signAndSend(account, partialOptions, optionalStatusCb) {
131
- const [options, statusCb] = makeSignAndSendOptions(partialOptions, optionalStatusCb);
132
- const isSubscription = api.hasSubscriptions && (this.#ignoreStatusCb || !!statusCb);
133
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call
134
- return decorateMethod(() => this.#observeSign(account, options).pipe((0, rxjs_1.switchMap)((info) => isSubscription
135
- ? this.#observeSubscribe(info)
136
- : this.#observeSend(info))) // FIXME This is wrong, SubmittableResult is _not_ a codec
137
- )(statusCb);
138
- }
139
- // adds a transform to the result, applied before result is returned
140
- withResultTransform(transform) {
141
- this.#transformResult = transform;
142
- return this;
143
- }
144
- #observeSign = (account, partialOptions) => {
145
- const address = (0, index_js_1.isKeyringPair)(account) ? account.address : account.toString();
146
- const options = optionsOrNonce(partialOptions);
147
- return api.derive.tx.signingInfo(address, options.nonce, options.era).pipe((0, rxjs_1.first)(), (0, rxjs_1.mergeMap)(async (signingInfo) => {
148
- const eraOptions = makeEraOptions(api, this.registry, options, signingInfo);
149
- let updateId = -1;
150
- let signedTx = null;
151
- if ((0, index_js_1.isKeyringPair)(account)) {
152
- this.sign(account, eraOptions);
153
- }
154
- else {
155
- const result = await this.#signViaSigner(address, eraOptions, signingInfo.header);
156
- updateId = result.id;
157
- if (result.signedTransaction) {
158
- signedTx = result.signedTransaction;
159
- }
160
- }
161
- return { options: eraOptions, signedTransaction: signedTx, updateId };
162
- }));
163
- };
164
- #observeStatus = (txHash, status) => {
165
- if (!status.isFinalized && !status.isInBlock) {
166
- return (0, rxjs_1.of)(this.#transformResult(new Result_js_1.SubmittableResult({
167
- status,
168
- txHash
169
- })));
170
- }
171
- const blockHash = status.isInBlock
172
- ? status.asInBlock
173
- : status.asFinalized;
174
- return api.derive.tx.events(blockHash).pipe((0, rxjs_1.map)(({ block, events }) => this.#transformResult(new Result_js_1.SubmittableResult({
175
- ...(0, index_js_1.filterEvents)(txHash, block, events, status),
176
- status,
177
- txHash
178
- }))), (0, rxjs_1.catchError)((internalError) => (0, rxjs_1.of)(this.#transformResult(new Result_js_1.SubmittableResult({
179
- internalError,
180
- status,
181
- txHash
182
- })))));
183
- };
184
- #observeSend = (info) => {
185
- return api.rpc.author.submitExtrinsic(info?.signedTransaction || this).pipe((0, rxjs_1.tap)((hash) => {
186
- this.#updateSigner(hash, info);
187
- }));
188
- };
189
- #observeSubscribe = (info) => {
190
- const txHash = this.hash;
191
- return api.rpc.author.submitAndWatchExtrinsic(info?.signedTransaction || this).pipe((0, rxjs_1.switchMap)((status) => this.#observeStatus(txHash, status)), (0, rxjs_1.tap)((status) => {
192
- this.#updateSigner(status, info);
193
- }));
194
- };
195
- #signViaSigner = async (address, options, header) => {
196
- const signer = options.signer || api.signer;
197
- const allowCallDataAlteration = options.allowCallDataAlteration ?? true;
198
- if (!signer) {
199
- throw new Error('No signer specified, either via api.setSigner or via sign options. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.');
200
- }
201
- const payload = this.registry.createTypeUnsafe('SignerPayload', [(0, util_1.objectSpread)({}, options, {
202
- address,
203
- blockNumber: header ? header.number : 0,
204
- method: this.method
205
- })]);
206
- let result;
207
- if ((0, util_1.isFunction)(signer.signPayload)) {
208
- result = await signer.signPayload(payload.toPayload());
209
- if (result.signedTransaction && !options.withSignedTransaction) {
210
- throw new Error('The `signedTransaction` field may not be submitted when `withSignedTransaction` is disabled');
211
- }
212
- if (result.signedTransaction && options.withSignedTransaction) {
213
- const ext = this.registry.createTypeUnsafe('Extrinsic', [result.signedTransaction]);
214
- const newSignerPayload = this.registry.createTypeUnsafe('SignerPayload', [(0, util_1.objectSpread)({}, {
215
- address,
216
- assetId: ext.assetId && ext.assetId.isSome ? ext.assetId.toHex() : null,
217
- blockHash: payload.blockHash,
218
- blockNumber: header ? header.number : 0,
219
- era: ext.era.toHex(),
220
- genesisHash: payload.genesisHash,
221
- metadataHash: ext.metadataHash ? ext.metadataHash.toHex() : null,
222
- method: ext.method.toHex(),
223
- mode: ext.mode ? ext.mode.toHex() : null,
224
- nonce: ext.nonce.toHex(),
225
- runtimeVersion: payload.runtimeVersion,
226
- signedExtensions: payload.signedExtensions,
227
- tip: ext.tip ? ext.tip.toHex() : null,
228
- version: payload.version
229
- })]);
230
- if (!ext.isSigned) {
231
- throw new Error(`When using the signedTransaction field, the transaction must be signed. Recieved isSigned: ${ext.isSigned}`);
232
- }
233
- if (!allowCallDataAlteration) {
234
- this.#validateSignedTransaction(payload, ext);
235
- }
236
- // This is only used for signAsync - signAndSend does not need to adjust the super payload or
237
- // add the signature.
238
- super.addSignature(address, result.signature, newSignerPayload.toPayload());
239
- return { id: result.id, signedTransaction: result.signedTransaction };
240
- }
241
- }
242
- else if ((0, util_1.isFunction)(signer.signRaw)) {
243
- result = await signer.signRaw(payload.toRaw());
244
- }
245
- else {
246
- throw new Error('Invalid signer interface, it should implement either signPayload or signRaw (or both)');
247
- }
248
- // Here we explicitly call `toPayload()` again instead of working with an object
249
- // (reference) as passed to the signer. This means that we are sure that the
250
- // payload data is not modified from our inputs, but the signer
251
- super.addSignature(address, result.signature, payload.toPayload());
252
- return { id: result.id };
253
- };
254
- #updateSigner = (status, info) => {
255
- if (info && (info.updateId !== -1)) {
256
- const { options, updateId } = info;
257
- const signer = options.signer || api.signer;
258
- if (signer && (0, util_1.isFunction)(signer.update)) {
259
- signer.update(updateId, status);
260
- }
261
- }
262
- };
263
- /**
264
- * When a signer includes `signedTransaction` within the SignerResult this will validate
265
- * specific fields within the signed extrinsic against the original payload that was passed
266
- * to the signer.
267
- */
268
- #validateSignedTransaction = (signerPayload, signedExt) => {
269
- const payload = signerPayload.toPayload();
270
- const errMsg = (field) => `signAndSend: ${field} does not match the original payload`;
271
- if (payload.method !== signedExt.method.toHex()) {
272
- throw new Error(errMsg('call data'));
273
- }
274
- };
275
- }
276
- return Submittable;
277
- }
@@ -1,8 +0,0 @@
1
- import type { Call } from '@pezkuwi/types/interfaces';
2
- import type { Registry } from '@pezkuwi/types-codec/types';
3
- import type { ApiBase } from '../base/index.js';
4
- import type { ApiInterfaceRx, ApiTypes } from '../types/index.js';
5
- import type { SubmittableExtrinsic } from './types.js';
6
- type Creator<ApiType extends ApiTypes> = (extrinsic: Call | Uint8Array | string) => SubmittableExtrinsic<ApiType>;
7
- export declare function createSubmittable<ApiType extends ApiTypes>(apiType: ApiTypes, api: ApiInterfaceRx, decorateMethod: ApiBase<ApiType>['_decorateMethod'], registry?: Registry, blockHash?: Uint8Array): Creator<ApiType>;
8
- export {};
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSubmittable = createSubmittable;
4
- const createClass_js_1 = require("./createClass.js");
5
- function createSubmittable(apiType, api, decorateMethod, registry, blockHash) {
6
- const Submittable = (0, createClass_js_1.createClass)({ api, apiType, blockHash, decorateMethod });
7
- return (extrinsic) => new Submittable(registry || api.registry, extrinsic);
8
- }
@@ -1,2 +0,0 @@
1
- export { createSubmittable } from './createSubmittable.js';
2
- export { SubmittableResult } from './Result.js';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubmittableResult = exports.createSubmittable = void 0;
4
- var createSubmittable_js_1 = require("./createSubmittable.js");
5
- Object.defineProperty(exports, "createSubmittable", { enumerable: true, get: function () { return createSubmittable_js_1.createSubmittable; } });
6
- var Result_js_1 = require("./Result.js");
7
- Object.defineProperty(exports, "SubmittableResult", { enumerable: true, get: function () { return Result_js_1.SubmittableResult; } });
@@ -1 +0,0 @@
1
- export type { AddressOrPair, SignerOptions, SubmittableDryRunResult, SubmittableExtrinsic, SubmittablePaymentResult, SubmittableResultResult, SubmittableResultSubscription, SubmittableResultValue } from '@pezkuwi/api-base/types';
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export * from '@pezkuwi/api-base/types/calls';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("@pezkuwi/api-base/types/calls"), exports);
@@ -1 +0,0 @@
1
- export * from '@pezkuwi/api-base/types/consts';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("@pezkuwi/api-base/types/consts"), exports);
@@ -1 +0,0 @@
1
- export * from '@pezkuwi/api-base/types/errors';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("@pezkuwi/api-base/types/errors"), exports);
@@ -1 +0,0 @@
1
- export * from '@pezkuwi/api-base/types/events';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("@pezkuwi/api-base/types/events"), exports);
@@ -1,114 +0,0 @@
1
- import type { ApiTypes, DeriveCustom, QueryableStorageMulti } from '@pezkuwi/api-base/types';
2
- import type { ApiInterfaceRx as ApiInterfaceBase } from '@pezkuwi/api-base/types/api';
3
- import type { QueryableCalls } from '@pezkuwi/api-base/types/calls';
4
- import type { QueryableConsts } from '@pezkuwi/api-base/types/consts';
5
- import type { DecoratedErrors } from '@pezkuwi/api-base/types/errors';
6
- import type { DecoratedEvents } from '@pezkuwi/api-base/types/events';
7
- import type { QueryableStorage } from '@pezkuwi/api-base/types/storage';
8
- import type { ProviderInterface, ProviderInterfaceEmitted } from '@pezkuwi/rpc-provider/types';
9
- import type { ExtDef } from '@pezkuwi/types/extrinsic/signedExtensions/types';
10
- import type { Call, Extrinsic, Hash, RuntimeVersionPartial } from '@pezkuwi/types/interfaces';
11
- import type { CallFunction, DefinitionRpc, DefinitionRpcSub, DefinitionsCall, RegisteredTypes, Registry, RegistryError, SignatureOptions, Signer } from '@pezkuwi/types/types';
12
- import type { BN } from '@pezkuwi/util';
13
- import type { HexString } from '@pezkuwi/util/types';
14
- import type { ApiBase } from '../base/index.js';
15
- import type { SubmittableExtrinsic } from '../types/submittable.js';
16
- import type { AllDerives } from '../util/decorate.js';
17
- export type { Signer, SignerResult } from '@pezkuwi/types/types';
18
- export { ApiBase } from '../base/index.js';
19
- export * from '@pezkuwi/api/types/calls';
20
- export * from '@pezkuwi/api/types/consts';
21
- export * from '@pezkuwi/api/types/errors';
22
- export * from '@pezkuwi/api/types/events';
23
- export * from '@pezkuwi/api/types/storage';
24
- export * from '@pezkuwi/api/types/submittable';
25
- export * from '@pezkuwi/api-base/types';
26
- export interface ApiInterfaceRx extends ApiInterfaceBase {
27
- derive: AllDerives<'rxjs'>;
28
- }
29
- export interface ApiOptions extends RegisteredTypes {
30
- /**
31
- * @description Add custom derives to be injected
32
- */
33
- derives?: DeriveCustom;
34
- /**
35
- * @description Control the initialization of the wasm libraries. When not specified, it defaults to `true`, initializing the wasm libraries, set to `false` to not initialize wasm. (No sr25519 support)
36
- */
37
- initWasm?: boolean;
38
- /**
39
- * @description Controls the checking of storage values once they have been contructed. When not specified this defaults to `true`. Set to `false` to forgo any checking on storage results.
40
- */
41
- isPedantic?: boolean;
42
- /**
43
- * @description pre-bundles is a map of 'genesis hash and runtime spec version' as key to a metadata hex string
44
- * if genesis hash and runtime spec version matches, then use metadata, else fetch it from chain
45
- */
46
- metadata?: Record<string, HexString>;
47
- /**
48
- * @description Don't display any warnings on initialization (missing RPC methods & runtime calls)
49
- */
50
- noInitWarn?: boolean;
51
- /**
52
- * @description Transport Provider from rpc-provider. If not specified, it will default to
53
- * connecting to a WsProvider connecting localhost with the default port, i.e. `ws://127.0.0.1:9944`
54
- */
55
- provider?: ProviderInterface;
56
- /**
57
- * @description A type registry to use along with this instance
58
- */
59
- registry?: Registry;
60
- /**
61
- * @description User-defined RPC methods
62
- */
63
- rpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
64
- /**
65
- * @description Defines the size of the cache for the rpc-core. Defaults to 1024 * 10 * 10.
66
- */
67
- rpcCacheCapacity?: number;
68
- /**
69
- * @description Overrides for state_call usage (this will be removed in some future version)
70
- */
71
- runtime?: DefinitionsCall;
72
- /**
73
- * @description Any chain-specific signed extensions that are now well-known
74
- */
75
- signedExtensions?: ExtDef;
76
- /**
77
- * @description An external signer which will be used to sign extrinsic when account passed in is not KeyringPair
78
- */
79
- signer?: Signer;
80
- /**
81
- * @description The source object to use for runtime information (only used when cloning)
82
- */
83
- source?: ApiBase<any>;
84
- /**
85
- * @description Throws an error when the initial connection fails (same as isReadyOrError)
86
- */
87
- throwOnConnect?: boolean;
88
- /**
89
- * @description Throws an error when some types are unknown (useful with throwOnConnect)
90
- */
91
- throwOnUnknown?: boolean;
92
- }
93
- export type ApiInterfaceEvents = ProviderInterfaceEmitted | 'ready' | 'decorated';
94
- export interface SignerOptions extends SignatureOptions {
95
- blockNumber: BN;
96
- genesisHash: Hash;
97
- }
98
- export interface ApiDecoration<ApiType extends ApiTypes> {
99
- call: QueryableCalls<ApiType>;
100
- consts: QueryableConsts<ApiType>;
101
- errors: DecoratedErrors<ApiType>;
102
- events: DecoratedEvents<ApiType>;
103
- query: QueryableStorage<ApiType>;
104
- registry: Registry;
105
- runtimeVersion: RuntimeVersionPartial;
106
- rx: {
107
- call: QueryableCalls<'rxjs'>;
108
- query: QueryableStorage<'rxjs'>;
109
- };
110
- tx: (extrinsic: Call | Extrinsic | Uint8Array | string) => SubmittableExtrinsic<ApiType>;
111
- findCall(callIndex: Uint8Array | string): CallFunction;
112
- findError(errorIndex: Uint8Array | string): RegistryError;
113
- queryMulti: QueryableStorageMulti<ApiType>;
114
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiBase = void 0;
4
- const tslib_1 = require("tslib");
5
- var index_js_1 = require("../base/index.js");
6
- Object.defineProperty(exports, "ApiBase", { enumerable: true, get: function () { return index_js_1.ApiBase; } });
7
- tslib_1.__exportStar(require("@pezkuwi/api/types/calls"), exports);
8
- tslib_1.__exportStar(require("@pezkuwi/api/types/consts"), exports);
9
- tslib_1.__exportStar(require("@pezkuwi/api/types/errors"), exports);
10
- tslib_1.__exportStar(require("@pezkuwi/api/types/events"), exports);
11
- tslib_1.__exportStar(require("@pezkuwi/api/types/storage"), exports);
12
- tslib_1.__exportStar(require("@pezkuwi/api/types/submittable"), exports);
13
- tslib_1.__exportStar(require("@pezkuwi/api-base/types"), exports);
@@ -1 +0,0 @@
1
- export * from '@pezkuwi/api-base/types/storage';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("@pezkuwi/api-base/types/storage"), exports);
@@ -1 +0,0 @@
1
- export * from '@pezkuwi/api-base/types/submittable';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("@pezkuwi/api-base/types/submittable"), exports);
@@ -1,9 +0,0 @@
1
- type Sections<T> = Record<string, Methods<T>>;
2
- type Methods<T> = Record<string, T>;
3
- /**
4
- * @description Takes a decorated api section (e.g. api.tx) and augment it with the details. It does not override what is
5
- * already available, but rather just adds new missing items into the result object.
6
- * @internal
7
- */
8
- export declare function augmentObject<T>(prefix: string | null, src: Sections<T>, dst: Sections<T>, fromEmpty?: boolean): Sections<T>;
9
- export {};
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.augmentObject = augmentObject;
4
- const util_1 = require("@pezkuwi/util");
5
- const l = (0, util_1.logger)('api/augment');
6
- function logLength(type, values, and = []) {
7
- return values.length
8
- ? ` ${values.length} ${type}${and.length ? ' and' : ''}`
9
- : '';
10
- }
11
- function logValues(type, values) {
12
- return values.length
13
- ? `\n\t${type.padStart(7)}: ${values.sort().join(', ')}`
14
- : '';
15
- }
16
- function warn(prefix, type, [added, removed]) {
17
- if (added.length || removed.length) {
18
- l.warn(`api.${prefix}: Found${logLength('added', added, removed)}${logLength('removed', removed)} ${type}:${logValues('added', added)}${logValues('removed', removed)}`);
19
- }
20
- }
21
- function findSectionExcludes(a, b) {
22
- return a.filter((s) => !b.includes(s));
23
- }
24
- function findSectionIncludes(a, b) {
25
- return a.filter((s) => b.includes(s));
26
- }
27
- function extractSections(src, dst) {
28
- const srcSections = Object.keys(src);
29
- const dstSections = Object.keys(dst);
30
- return [
31
- findSectionExcludes(srcSections, dstSections),
32
- findSectionExcludes(dstSections, srcSections)
33
- ];
34
- }
35
- function findMethodExcludes(src, dst) {
36
- const srcSections = Object.keys(src);
37
- const dstSections = findSectionIncludes(Object.keys(dst), srcSections);
38
- const excludes = [];
39
- for (let s = 0, scount = dstSections.length; s < scount; s++) {
40
- const section = dstSections[s];
41
- const srcMethods = Object.keys(src[section]);
42
- const dstMethods = Object.keys(dst[section]);
43
- for (let d = 0, mcount = dstMethods.length; d < mcount; d++) {
44
- const method = dstMethods[d];
45
- if (!srcMethods.includes(method)) {
46
- excludes.push(`${section}.${method}`);
47
- }
48
- }
49
- }
50
- return excludes;
51
- }
52
- function extractMethods(src, dst) {
53
- return [
54
- findMethodExcludes(dst, src),
55
- findMethodExcludes(src, dst)
56
- ];
57
- }
58
- /**
59
- * @description Takes a decorated api section (e.g. api.tx) and augment it with the details. It does not override what is
60
- * already available, but rather just adds new missing items into the result object.
61
- * @internal
62
- */
63
- function augmentObject(prefix, src, dst, fromEmpty = false) {
64
- fromEmpty && (0, util_1.objectClear)(dst);
65
- // NOTE: This part is slightly problematic since it will get the
66
- // values for at least all the sections and the names of the methods
67
- // (Since methods won't be decorated before lazy, this _may_ be ok)
68
- if (prefix && Object.keys(dst).length) {
69
- warn(prefix, 'modules', extractSections(src, dst));
70
- warn(prefix, 'calls', extractMethods(src, dst));
71
- }
72
- const sections = Object.keys(src);
73
- for (let i = 0, count = sections.length; i < count; i++) {
74
- const section = sections[i];
75
- const methods = src[section];
76
- // We don't set here with a lazy interface, we decorate based
77
- // on the top-level structure (this bypasses adding lazy onto lazy)
78
- if (!dst[section]) {
79
- dst[section] = {};
80
- }
81
- (0, util_1.lazyMethods)(dst[section], Object.keys(methods), (m) => methods[m]);
82
- }
83
- return dst;
84
- }
@@ -1,16 +0,0 @@
1
- import type { ExactDerive } from '@pezkuwi/api-derive';
2
- import type { AnyFunction } from '@pezkuwi/types/types';
3
- import type { ApiTypes, DecorateMethod, MethodResult } from '../types/index.js';
4
- type AnyDeriveSection = Record<string, AnyFunction>;
5
- type AnyDerive = Record<string, AnyDeriveSection>;
6
- type DeriveSection<ApiType extends ApiTypes, Section extends AnyDeriveSection> = {
7
- [M in keyof Section]: MethodResult<ApiType, Section[M]>;
8
- };
9
- export type AllDerives<ApiType extends ApiTypes> = {
10
- [S in keyof ExactDerive]: DeriveSection<ApiType, ExactDerive[S]>;
11
- };
12
- /**
13
- * This is a section decorator which keeps all type information.
14
- */
15
- export declare function decorateDeriveSections<ApiType extends ApiTypes>(decorateMethod: DecorateMethod<ApiType>, derives: AnyDerive): AllDerives<ApiType>;
16
- export {};
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decorateDeriveSections = decorateDeriveSections;
4
- const api_derive_1 = require("@pezkuwi/api-derive");
5
- /**
6
- * This is a section decorator which keeps all type information.
7
- */
8
- function decorateDeriveSections(decorateMethod, derives) {
9
- const getKeys = (s) => Object.keys(derives[s]);
10
- const creator = (s, m) => decorateMethod(derives[s][m]);
11
- const result = {};
12
- const names = Object.keys(derives);
13
- for (let i = 0, count = names.length; i < count; i++) {
14
- (0, api_derive_1.lazyDeriveSection)(result, names[i], getKeys, creator);
15
- }
16
- return result;
17
- }
@@ -1,6 +0,0 @@
1
- import type { BlockNumber, EventRecord, ExtrinsicStatus, H256, SignedBlock } from '@pezkuwi/types/interfaces';
2
- export declare function filterEvents(txHash: H256, { block: { extrinsics, header } }: SignedBlock, allEvents: EventRecord[], status: ExtrinsicStatus): {
3
- events?: EventRecord[];
4
- txIndex?: number;
5
- blockNumber?: BlockNumber;
6
- };