@pezkuwi/api 16.5.5 → 16.5.8

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 (498) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +12 -12
  3. package/augment.d.ts +1 -0
  4. package/augment.js +1 -0
  5. package/base/Decorate.d.ts +143 -0
  6. package/base/Decorate.js +752 -0
  7. package/base/Events.d.ts +67 -0
  8. package/base/Events.js +78 -0
  9. package/base/Getters.d.ts +163 -0
  10. package/base/Getters.js +207 -0
  11. package/base/Init.d.ts +44 -0
  12. package/base/Init.js +400 -0
  13. package/base/find.d.ts +3 -0
  14. package/base/find.js +7 -0
  15. package/base/index.d.ts +47 -0
  16. package/base/index.js +57 -0
  17. package/base/types.d.ts +15 -0
  18. package/base/types.js +1 -0
  19. package/build/LICENSE +201 -0
  20. package/build/README.md +100 -0
  21. package/build/augment.js +1 -0
  22. package/build/base/Decorate.js +752 -0
  23. package/build/base/Events.js +78 -0
  24. package/build/base/Getters.js +207 -0
  25. package/build/base/Init.js +400 -0
  26. package/build/base/find.js +7 -0
  27. package/build/base/index.d.ts +1 -1
  28. package/build/base/index.js +57 -0
  29. package/build/base/types.js +1 -0
  30. package/build/bundle-pezkuwi-api.js +26247 -0
  31. package/build/bundle.js +7 -0
  32. package/build/cjs/augment.d.ts +1 -0
  33. package/build/cjs/augment.js +3 -0
  34. package/build/cjs/base/Decorate.d.ts +143 -0
  35. package/build/cjs/base/Decorate.js +756 -0
  36. package/build/cjs/base/Events.d.ts +67 -0
  37. package/build/cjs/base/Events.js +82 -0
  38. package/build/cjs/base/Getters.d.ts +163 -0
  39. package/build/cjs/base/Getters.js +211 -0
  40. package/build/cjs/base/Init.d.ts +44 -0
  41. package/build/cjs/base/Init.js +404 -0
  42. package/build/cjs/base/find.d.ts +3 -0
  43. package/build/cjs/base/find.js +11 -0
  44. package/build/cjs/base/index.d.ts +47 -0
  45. package/build/cjs/base/index.js +61 -0
  46. package/build/cjs/base/types.d.ts +15 -0
  47. package/build/cjs/base/types.js +2 -0
  48. package/build/cjs/bundle.d.ts +7 -0
  49. package/build/cjs/bundle.js +17 -0
  50. package/build/cjs/index.d.ts +2 -0
  51. package/build/cjs/index.js +5 -0
  52. package/build/cjs/package.json +3 -0
  53. package/build/cjs/packageDetect.d.ts +1 -0
  54. package/build/cjs/packageDetect.js +10 -0
  55. package/build/cjs/packageInfo.d.ts +6 -0
  56. package/build/cjs/packageInfo.js +4 -0
  57. package/build/cjs/promise/Api.d.ts +158 -0
  58. package/build/cjs/promise/Api.js +195 -0
  59. package/build/cjs/promise/Combinator.d.ts +12 -0
  60. package/build/cjs/promise/Combinator.js +72 -0
  61. package/build/cjs/promise/decorateMethod.d.ts +14 -0
  62. package/build/cjs/promise/decorateMethod.js +75 -0
  63. package/build/cjs/promise/index.d.ts +2 -0
  64. package/build/cjs/promise/index.js +7 -0
  65. package/build/cjs/promise/types.d.ts +5 -0
  66. package/build/cjs/promise/types.js +2 -0
  67. package/build/cjs/rx/Api.d.ts +155 -0
  68. package/build/cjs/rx/Api.js +173 -0
  69. package/build/cjs/rx/decorateMethod.d.ts +3 -0
  70. package/build/cjs/rx/decorateMethod.js +6 -0
  71. package/build/cjs/rx/index.d.ts +2 -0
  72. package/build/cjs/rx/index.js +7 -0
  73. package/build/cjs/submittable/Result.d.ts +31 -0
  74. package/build/cjs/submittable/Result.js +84 -0
  75. package/build/cjs/submittable/createClass.d.ts +12 -0
  76. package/build/cjs/submittable/createClass.js +277 -0
  77. package/build/cjs/submittable/createSubmittable.d.ts +8 -0
  78. package/build/cjs/submittable/createSubmittable.js +8 -0
  79. package/build/cjs/submittable/index.d.ts +2 -0
  80. package/build/cjs/submittable/index.js +7 -0
  81. package/build/cjs/submittable/types.d.ts +1 -0
  82. package/build/cjs/submittable/types.js +2 -0
  83. package/build/cjs/types/calls.d.ts +1 -0
  84. package/build/cjs/types/calls.js +4 -0
  85. package/build/cjs/types/consts.d.ts +1 -0
  86. package/build/cjs/types/consts.js +4 -0
  87. package/build/cjs/types/errors.d.ts +1 -0
  88. package/build/cjs/types/errors.js +4 -0
  89. package/build/cjs/types/events.d.ts +1 -0
  90. package/build/cjs/types/events.js +4 -0
  91. package/build/cjs/types/index.d.ts +114 -0
  92. package/build/cjs/types/index.js +13 -0
  93. package/build/cjs/types/storage.d.ts +1 -0
  94. package/build/cjs/types/storage.js +4 -0
  95. package/build/cjs/types/submittable.d.ts +1 -0
  96. package/build/cjs/types/submittable.js +4 -0
  97. package/build/cjs/util/augmentObject.d.ts +9 -0
  98. package/build/cjs/util/augmentObject.js +84 -0
  99. package/build/cjs/util/decorate.d.ts +16 -0
  100. package/build/cjs/util/decorate.js +17 -0
  101. package/build/cjs/util/filterEvents.d.ts +6 -0
  102. package/build/cjs/util/filterEvents.js +25 -0
  103. package/build/cjs/util/index.d.ts +4 -0
  104. package/build/cjs/util/index.js +11 -0
  105. package/build/cjs/util/isKeyringPair.d.ts +3 -0
  106. package/build/cjs/util/isKeyringPair.js +7 -0
  107. package/build/cjs/util/logging.d.ts +1 -0
  108. package/build/cjs/util/logging.js +5 -0
  109. package/build/cjs/util/validate.d.ts +3 -0
  110. package/build/cjs/util/validate.js +26 -0
  111. package/build/index.js +2 -0
  112. package/build/package.json +612 -0
  113. package/build/packageDetect.js +8 -0
  114. package/build/packageInfo.js +1 -0
  115. package/build/promise/Api.d.ts +2 -2
  116. package/build/promise/Api.js +191 -0
  117. package/build/promise/Combinator.js +68 -0
  118. package/build/promise/decorateMethod.js +71 -0
  119. package/build/promise/index.js +2 -0
  120. package/build/promise/types.js +1 -0
  121. package/build/rx/Api.d.ts +2 -2
  122. package/build/rx/Api.js +169 -0
  123. package/build/rx/decorateMethod.js +3 -0
  124. package/build/rx/index.js +2 -0
  125. package/build/submittable/Result.js +80 -0
  126. package/build/submittable/createClass.js +274 -0
  127. package/build/submittable/createSubmittable.js +5 -0
  128. package/build/submittable/index.js +2 -0
  129. package/build/submittable/types.js +1 -0
  130. package/build/types/calls.js +1 -0
  131. package/build/types/consts.js +1 -0
  132. package/build/types/errors.js +1 -0
  133. package/build/types/events.js +1 -0
  134. package/build/types/index.js +8 -0
  135. package/build/types/storage.js +1 -0
  136. package/build/types/submittable.js +1 -0
  137. package/build/util/augmentObject.js +81 -0
  138. package/build/util/decorate.js +14 -0
  139. package/build/util/filterEvents.js +22 -0
  140. package/build/util/index.js +4 -0
  141. package/build/util/isKeyringPair.js +4 -0
  142. package/build/util/logging.js +2 -0
  143. package/build/util/validate.js +23 -0
  144. package/build-deno/README.md +95 -0
  145. package/build-deno/augment.ts +2 -0
  146. package/build-deno/base/Decorate.ts +1100 -0
  147. package/build-deno/base/Events.ts +89 -0
  148. package/build-deno/base/Getters.ts +243 -0
  149. package/build-deno/base/Init.ts +523 -0
  150. package/build-deno/base/find.ts +12 -0
  151. package/build-deno/base/index.ts +83 -0
  152. package/build-deno/base/types.ts +17 -0
  153. package/build-deno/bundle.ts +11 -0
  154. package/build-deno/checkTypes.manual.ts +320 -0
  155. package/build-deno/index.ts +4 -0
  156. package/build-deno/mod.ts +2 -0
  157. package/build-deno/packageDetect.ts +12 -0
  158. package/build-deno/packageInfo.ts +3 -0
  159. package/build-deno/promise/Api.ts +212 -0
  160. package/build-deno/promise/Combinator.ts +89 -0
  161. package/build-deno/promise/decorateMethod.ts +111 -0
  162. package/build-deno/promise/index.ts +3 -0
  163. package/build-deno/promise/types.ts +7 -0
  164. package/build-deno/rx/Api.ts +184 -0
  165. package/build-deno/rx/decorateMethod.ts +7 -0
  166. package/build-deno/rx/index.ts +3 -0
  167. package/build-deno/submittable/Result.ts +109 -0
  168. package/build-deno/submittable/createClass.ts +436 -0
  169. package/build-deno/submittable/createSubmittable.ts +17 -0
  170. package/build-deno/submittable/index.ts +3 -0
  171. package/build-deno/submittable/types.ts +2 -0
  172. package/build-deno/test/SingleAccountSigner.ts +51 -0
  173. package/build-deno/test/index.ts +3 -0
  174. package/build-deno/test/logEvents.ts +21 -0
  175. package/build-deno/types/calls.ts +2 -0
  176. package/build-deno/types/consts.ts +2 -0
  177. package/build-deno/types/errors.ts +2 -0
  178. package/build-deno/types/events.ts +2 -0
  179. package/build-deno/types/index.ts +124 -0
  180. package/build-deno/types/storage.ts +2 -0
  181. package/build-deno/types/submittable.ts +2 -0
  182. package/build-deno/util/augmentObject.ts +109 -0
  183. package/build-deno/util/decorate.ts +38 -0
  184. package/build-deno/util/filterEvents.ts +32 -0
  185. package/build-deno/util/index.ts +6 -0
  186. package/build-deno/util/isKeyringPair.ts +9 -0
  187. package/build-deno/util/logging.ts +4 -0
  188. package/build-deno/util/validate.ts +32 -0
  189. package/build-tsc/augment.d.ts +1 -0
  190. package/build-tsc/base/Decorate.d.ts +143 -0
  191. package/build-tsc/base/Events.d.ts +67 -0
  192. package/build-tsc/base/Getters.d.ts +163 -0
  193. package/build-tsc/base/Init.d.ts +44 -0
  194. package/build-tsc/base/find.d.ts +3 -0
  195. package/build-tsc/base/index.d.ts +47 -0
  196. package/build-tsc/base/types.d.ts +15 -0
  197. package/build-tsc/bundle.d.ts +7 -0
  198. package/build-tsc/index.d.ts +2 -0
  199. package/build-tsc/packageDetect.d.ts +1 -0
  200. package/build-tsc/packageInfo.d.ts +6 -0
  201. package/build-tsc/promise/Api.d.ts +158 -0
  202. package/build-tsc/promise/Combinator.d.ts +12 -0
  203. package/build-tsc/promise/decorateMethod.d.ts +14 -0
  204. package/build-tsc/promise/index.d.ts +2 -0
  205. package/build-tsc/promise/types.d.ts +5 -0
  206. package/build-tsc/rx/Api.d.ts +155 -0
  207. package/build-tsc/rx/decorateMethod.d.ts +3 -0
  208. package/build-tsc/rx/index.d.ts +2 -0
  209. package/build-tsc/submittable/Result.d.ts +31 -0
  210. package/build-tsc/submittable/createClass.d.ts +12 -0
  211. package/build-tsc/submittable/createSubmittable.d.ts +8 -0
  212. package/build-tsc/submittable/index.d.ts +2 -0
  213. package/build-tsc/submittable/types.d.ts +1 -0
  214. package/build-tsc/types/calls.d.ts +1 -0
  215. package/build-tsc/types/consts.d.ts +1 -0
  216. package/build-tsc/types/errors.d.ts +1 -0
  217. package/build-tsc/types/events.d.ts +1 -0
  218. package/build-tsc/types/index.d.ts +114 -0
  219. package/build-tsc/types/storage.d.ts +1 -0
  220. package/build-tsc/types/submittable.d.ts +1 -0
  221. package/build-tsc/util/augmentObject.d.ts +9 -0
  222. package/build-tsc/util/decorate.d.ts +16 -0
  223. package/build-tsc/util/filterEvents.d.ts +6 -0
  224. package/build-tsc/util/index.d.ts +4 -0
  225. package/build-tsc/util/isKeyringPair.d.ts +3 -0
  226. package/build-tsc/util/logging.d.ts +1 -0
  227. package/build-tsc/util/validate.d.ts +3 -0
  228. package/build-tsc-cjs/augment.js +3 -0
  229. package/build-tsc-cjs/base/Decorate.js +756 -0
  230. package/build-tsc-cjs/base/Events.js +82 -0
  231. package/build-tsc-cjs/base/Getters.js +211 -0
  232. package/build-tsc-cjs/base/Init.js +404 -0
  233. package/build-tsc-cjs/base/find.js +11 -0
  234. package/build-tsc-cjs/base/index.js +61 -0
  235. package/build-tsc-cjs/base/types.js +2 -0
  236. package/build-tsc-cjs/bundle.js +17 -0
  237. package/build-tsc-cjs/index.js +5 -0
  238. package/build-tsc-cjs/packageDetect.js +10 -0
  239. package/build-tsc-cjs/packageInfo.js +4 -0
  240. package/build-tsc-cjs/promise/Api.js +195 -0
  241. package/build-tsc-cjs/promise/Combinator.js +72 -0
  242. package/build-tsc-cjs/promise/decorateMethod.js +75 -0
  243. package/build-tsc-cjs/promise/index.js +7 -0
  244. package/build-tsc-cjs/promise/types.js +2 -0
  245. package/build-tsc-cjs/rx/Api.js +173 -0
  246. package/build-tsc-cjs/rx/decorateMethod.js +6 -0
  247. package/build-tsc-cjs/rx/index.js +7 -0
  248. package/build-tsc-cjs/submittable/Result.js +84 -0
  249. package/build-tsc-cjs/submittable/createClass.js +277 -0
  250. package/build-tsc-cjs/submittable/createSubmittable.js +8 -0
  251. package/build-tsc-cjs/submittable/index.js +7 -0
  252. package/build-tsc-cjs/submittable/types.js +2 -0
  253. package/build-tsc-cjs/types/calls.js +4 -0
  254. package/build-tsc-cjs/types/consts.js +4 -0
  255. package/build-tsc-cjs/types/errors.js +4 -0
  256. package/build-tsc-cjs/types/events.js +4 -0
  257. package/build-tsc-cjs/types/index.js +13 -0
  258. package/build-tsc-cjs/types/storage.js +4 -0
  259. package/build-tsc-cjs/types/submittable.js +4 -0
  260. package/build-tsc-cjs/util/augmentObject.js +84 -0
  261. package/build-tsc-cjs/util/decorate.js +17 -0
  262. package/build-tsc-cjs/util/filterEvents.js +25 -0
  263. package/build-tsc-cjs/util/index.js +11 -0
  264. package/build-tsc-cjs/util/isKeyringPair.js +7 -0
  265. package/build-tsc-cjs/util/logging.js +5 -0
  266. package/build-tsc-cjs/util/validate.js +26 -0
  267. package/build-tsc-esm/augment.js +1 -0
  268. package/build-tsc-esm/base/Decorate.js +752 -0
  269. package/build-tsc-esm/base/Events.js +78 -0
  270. package/build-tsc-esm/base/Getters.js +207 -0
  271. package/build-tsc-esm/base/Init.js +400 -0
  272. package/build-tsc-esm/base/find.js +7 -0
  273. package/build-tsc-esm/base/index.js +57 -0
  274. package/build-tsc-esm/base/types.js +1 -0
  275. package/build-tsc-esm/bundle.js +7 -0
  276. package/build-tsc-esm/index.js +2 -0
  277. package/build-tsc-esm/packageDetect.js +8 -0
  278. package/build-tsc-esm/packageInfo.js +1 -0
  279. package/build-tsc-esm/promise/Api.js +191 -0
  280. package/build-tsc-esm/promise/Combinator.js +68 -0
  281. package/build-tsc-esm/promise/decorateMethod.js +71 -0
  282. package/build-tsc-esm/promise/index.js +2 -0
  283. package/build-tsc-esm/promise/types.js +1 -0
  284. package/build-tsc-esm/rx/Api.js +169 -0
  285. package/build-tsc-esm/rx/decorateMethod.js +3 -0
  286. package/build-tsc-esm/rx/index.js +2 -0
  287. package/build-tsc-esm/submittable/Result.js +80 -0
  288. package/build-tsc-esm/submittable/createClass.js +274 -0
  289. package/build-tsc-esm/submittable/createSubmittable.js +5 -0
  290. package/build-tsc-esm/submittable/index.js +2 -0
  291. package/build-tsc-esm/submittable/types.js +1 -0
  292. package/build-tsc-esm/types/calls.js +1 -0
  293. package/build-tsc-esm/types/consts.js +1 -0
  294. package/build-tsc-esm/types/errors.js +1 -0
  295. package/build-tsc-esm/types/events.js +1 -0
  296. package/build-tsc-esm/types/index.js +8 -0
  297. package/build-tsc-esm/types/storage.js +1 -0
  298. package/build-tsc-esm/types/submittable.js +1 -0
  299. package/build-tsc-esm/util/augmentObject.js +81 -0
  300. package/build-tsc-esm/util/decorate.js +14 -0
  301. package/build-tsc-esm/util/filterEvents.js +22 -0
  302. package/build-tsc-esm/util/index.js +4 -0
  303. package/build-tsc-esm/util/isKeyringPair.js +4 -0
  304. package/build-tsc-esm/util/logging.js +2 -0
  305. package/build-tsc-esm/util/validate.js +23 -0
  306. package/bundle-pezkuwi-api.js +26247 -0
  307. package/bundle.d.ts +7 -0
  308. package/bundle.js +7 -0
  309. package/cjs/augment.d.ts +1 -0
  310. package/cjs/augment.js +3 -0
  311. package/cjs/base/Decorate.d.ts +143 -0
  312. package/cjs/base/Decorate.js +756 -0
  313. package/cjs/base/Events.d.ts +67 -0
  314. package/cjs/base/Events.js +82 -0
  315. package/cjs/base/Getters.d.ts +163 -0
  316. package/cjs/base/Getters.js +211 -0
  317. package/cjs/base/Init.d.ts +44 -0
  318. package/cjs/base/Init.js +404 -0
  319. package/cjs/base/find.d.ts +3 -0
  320. package/cjs/base/find.js +11 -0
  321. package/cjs/base/index.d.ts +47 -0
  322. package/cjs/base/index.js +61 -0
  323. package/cjs/base/types.d.ts +15 -0
  324. package/cjs/base/types.js +2 -0
  325. package/cjs/bundle.d.ts +7 -0
  326. package/cjs/bundle.js +17 -0
  327. package/cjs/index.d.ts +2 -0
  328. package/cjs/index.js +5 -0
  329. package/cjs/package.json +3 -0
  330. package/cjs/packageDetect.d.ts +1 -0
  331. package/cjs/packageDetect.js +10 -0
  332. package/cjs/packageInfo.d.ts +6 -0
  333. package/cjs/packageInfo.js +4 -0
  334. package/cjs/promise/Api.d.ts +158 -0
  335. package/cjs/promise/Api.js +195 -0
  336. package/cjs/promise/Combinator.d.ts +12 -0
  337. package/cjs/promise/Combinator.js +72 -0
  338. package/cjs/promise/decorateMethod.d.ts +14 -0
  339. package/cjs/promise/decorateMethod.js +75 -0
  340. package/cjs/promise/index.d.ts +2 -0
  341. package/cjs/promise/index.js +7 -0
  342. package/cjs/promise/types.d.ts +5 -0
  343. package/cjs/promise/types.js +2 -0
  344. package/cjs/rx/Api.d.ts +155 -0
  345. package/cjs/rx/Api.js +173 -0
  346. package/cjs/rx/decorateMethod.d.ts +3 -0
  347. package/cjs/rx/decorateMethod.js +6 -0
  348. package/cjs/rx/index.d.ts +2 -0
  349. package/cjs/rx/index.js +7 -0
  350. package/cjs/submittable/Result.d.ts +31 -0
  351. package/cjs/submittable/Result.js +84 -0
  352. package/cjs/submittable/createClass.d.ts +12 -0
  353. package/cjs/submittable/createClass.js +277 -0
  354. package/cjs/submittable/createSubmittable.d.ts +8 -0
  355. package/cjs/submittable/createSubmittable.js +8 -0
  356. package/cjs/submittable/index.d.ts +2 -0
  357. package/cjs/submittable/index.js +7 -0
  358. package/cjs/submittable/types.d.ts +1 -0
  359. package/cjs/submittable/types.js +2 -0
  360. package/cjs/types/calls.d.ts +1 -0
  361. package/cjs/types/calls.js +4 -0
  362. package/cjs/types/consts.d.ts +1 -0
  363. package/cjs/types/consts.js +4 -0
  364. package/cjs/types/errors.d.ts +1 -0
  365. package/cjs/types/errors.js +4 -0
  366. package/cjs/types/events.d.ts +1 -0
  367. package/cjs/types/events.js +4 -0
  368. package/cjs/types/index.d.ts +114 -0
  369. package/cjs/types/index.js +13 -0
  370. package/cjs/types/storage.d.ts +1 -0
  371. package/cjs/types/storage.js +4 -0
  372. package/cjs/types/submittable.d.ts +1 -0
  373. package/cjs/types/submittable.js +4 -0
  374. package/cjs/util/augmentObject.d.ts +9 -0
  375. package/cjs/util/augmentObject.js +84 -0
  376. package/cjs/util/decorate.d.ts +16 -0
  377. package/cjs/util/decorate.js +17 -0
  378. package/cjs/util/filterEvents.d.ts +6 -0
  379. package/cjs/util/filterEvents.js +25 -0
  380. package/cjs/util/index.d.ts +4 -0
  381. package/cjs/util/index.js +11 -0
  382. package/cjs/util/isKeyringPair.d.ts +3 -0
  383. package/cjs/util/isKeyringPair.js +7 -0
  384. package/cjs/util/logging.d.ts +1 -0
  385. package/cjs/util/logging.js +5 -0
  386. package/cjs/util/validate.d.ts +3 -0
  387. package/cjs/util/validate.js +26 -0
  388. package/index.d.ts +2 -0
  389. package/index.js +2 -0
  390. package/package.json +588 -22
  391. package/packageDetect.d.ts +1 -0
  392. package/packageDetect.js +8 -0
  393. package/packageInfo.d.ts +6 -0
  394. package/packageInfo.js +1 -0
  395. package/promise/Api.d.ts +158 -0
  396. package/promise/Api.js +191 -0
  397. package/promise/Combinator.d.ts +12 -0
  398. package/promise/Combinator.js +68 -0
  399. package/promise/decorateMethod.d.ts +14 -0
  400. package/promise/decorateMethod.js +71 -0
  401. package/promise/index.d.ts +2 -0
  402. package/promise/index.js +2 -0
  403. package/promise/types.d.ts +5 -0
  404. package/promise/types.js +1 -0
  405. package/rx/Api.d.ts +155 -0
  406. package/rx/Api.js +169 -0
  407. package/rx/decorateMethod.d.ts +3 -0
  408. package/rx/decorateMethod.js +3 -0
  409. package/rx/index.d.ts +2 -0
  410. package/rx/index.js +2 -0
  411. package/src/augment.ts +1 -1
  412. package/src/base/Decorate.ts +1 -1
  413. package/src/base/Events.ts +1 -1
  414. package/src/base/Getters.ts +1 -1
  415. package/src/base/Init.ts +1 -1
  416. package/src/base/find.ts +1 -1
  417. package/src/base/index.ts +1 -1
  418. package/src/base/types.ts +1 -1
  419. package/src/bundle.ts +1 -1
  420. package/src/checkTypes.manual.ts +7 -7
  421. package/src/index.ts +1 -1
  422. package/src/mod.ts +1 -1
  423. package/src/packageDetect.ts +2 -2
  424. package/src/packageInfo.ts +3 -3
  425. package/src/promise/Api.ts +3 -3
  426. package/src/promise/Combinator.ts +1 -1
  427. package/src/promise/Combinators.spec.ts +1 -1
  428. package/src/promise/decorateMethod.ts +1 -1
  429. package/src/promise/index.spec.ts +1 -1
  430. package/src/promise/index.ts +1 -1
  431. package/src/promise/types.ts +1 -1
  432. package/src/rx/Api.ts +3 -3
  433. package/src/rx/decorateMethod.ts +1 -1
  434. package/src/rx/index.ts +1 -1
  435. package/src/submittable/Result.ts +1 -1
  436. package/src/submittable/createClass.ts +1 -1
  437. package/src/submittable/createSubmittable.ts +1 -1
  438. package/src/submittable/index.ts +1 -1
  439. package/src/submittable/types.ts +1 -1
  440. package/src/test/SingleAccountSigner.ts +1 -1
  441. package/src/test/index.ts +1 -1
  442. package/src/test/logEvents.ts +1 -1
  443. package/src/types/calls.ts +1 -1
  444. package/src/types/consts.ts +1 -1
  445. package/src/types/errors.ts +1 -1
  446. package/src/types/events.ts +1 -1
  447. package/src/types/index.ts +1 -1
  448. package/src/types/storage.ts +1 -1
  449. package/src/types/submittable.ts +1 -1
  450. package/src/util/augmentObject.spec.ts +1 -1
  451. package/src/util/augmentObject.ts +1 -1
  452. package/src/util/decorate.ts +1 -1
  453. package/src/util/filterEvents.ts +1 -1
  454. package/src/util/index.ts +1 -1
  455. package/src/util/isKeyringPair.ts +1 -1
  456. package/src/util/logging.ts +1 -1
  457. package/src/util/validate.spec.ts +2 -2
  458. package/src/util/validate.ts +1 -1
  459. package/submittable/Result.d.ts +31 -0
  460. package/submittable/Result.js +80 -0
  461. package/submittable/createClass.d.ts +12 -0
  462. package/submittable/createClass.js +274 -0
  463. package/submittable/createSubmittable.d.ts +8 -0
  464. package/submittable/createSubmittable.js +5 -0
  465. package/submittable/index.d.ts +2 -0
  466. package/submittable/index.js +2 -0
  467. package/submittable/types.d.ts +1 -0
  468. package/submittable/types.js +1 -0
  469. package/tsconfig.build.tsbuildinfo +1 -1
  470. package/tsconfig.spec.tsbuildinfo +1 -0
  471. package/types/calls.d.ts +1 -0
  472. package/types/calls.js +1 -0
  473. package/types/consts.d.ts +1 -0
  474. package/types/consts.js +1 -0
  475. package/types/errors.d.ts +1 -0
  476. package/types/errors.js +1 -0
  477. package/types/events.d.ts +1 -0
  478. package/types/events.js +1 -0
  479. package/types/index.d.ts +114 -0
  480. package/types/index.js +8 -0
  481. package/types/storage.d.ts +1 -0
  482. package/types/storage.js +1 -0
  483. package/types/submittable.d.ts +1 -0
  484. package/types/submittable.js +1 -0
  485. package/util/augmentObject.d.ts +9 -0
  486. package/util/augmentObject.js +81 -0
  487. package/util/decorate.d.ts +16 -0
  488. package/util/decorate.js +14 -0
  489. package/util/filterEvents.d.ts +6 -0
  490. package/util/filterEvents.js +22 -0
  491. package/util/index.d.ts +4 -0
  492. package/util/index.js +4 -0
  493. package/util/isKeyringPair.d.ts +3 -0
  494. package/util/isKeyringPair.js +4 -0
  495. package/util/logging.d.ts +1 -0
  496. package/util/logging.js +2 -0
  497. package/util/validate.d.ts +3 -0
  498. package/util/validate.js +23 -0
@@ -0,0 +1,163 @@
1
+ import type { RpcCoreStats, RpcInterface } from '@pezkuwi/rpc-core/types';
2
+ import type { Text } from '@pezkuwi/types';
3
+ import type { Hash, RuntimeVersion } from '@pezkuwi/types/interfaces';
4
+ import type { Metadata } from '@pezkuwi/types/metadata';
5
+ import type { CallFunction, RegistryError } from '@pezkuwi/types/types';
6
+ import type { ApiDecoration, ApiInterfaceRx, ApiTypes, DecoratedErrors, DecoratedEvents, DecoratedRpc, QueryableCalls, QueryableConsts, QueryableStorage, QueryableStorageMulti, SubmittableExtrinsics } from '../types/index.js';
7
+ import { Init } from './Init.js';
8
+ export declare abstract class Getters<ApiType extends ApiTypes> extends Init<ApiType> implements ApiDecoration<ApiType> {
9
+ /**
10
+ * @description Runtime call interfaces (currently untyped, only decorated via API options)
11
+ */
12
+ get call(): QueryableCalls<ApiType>;
13
+ /**
14
+ * @description Contains the parameter types (constants) of all modules.
15
+ *
16
+ * The values are instances of the appropriate type and are accessible using `section`.`constantName`,
17
+ *
18
+ * @example
19
+ * <BR>
20
+ *
21
+ * ```javascript
22
+ * console.log(api.consts.democracy.enactmentPeriod.toString())
23
+ * ```
24
+ */
25
+ get consts(): QueryableConsts<ApiType>;
26
+ /**
27
+ * @description Derived results that are injected into the API, allowing for combinations of various query results.
28
+ *
29
+ * @example
30
+ * <BR>
31
+ *
32
+ * ```javascript
33
+ * api.derive.chain.bestNumber((number) => {
34
+ * console.log('best number', number);
35
+ * });
36
+ * ```
37
+ */
38
+ get derive(): ReturnType<Getters<ApiType>['_decorateDerive']>;
39
+ /**
40
+ * @description Errors from metadata
41
+ */
42
+ get errors(): DecoratedErrors<ApiType>;
43
+ /**
44
+ * @description Events from metadata
45
+ */
46
+ get events(): DecoratedEvents<ApiType>;
47
+ /**
48
+ * @description Returns the version of extrinsics in-use on this chain
49
+ */
50
+ get extrinsicVersion(): number;
51
+ /**
52
+ * @description Contains the genesis Hash of the attached chain. Apart from being useful to determine the actual chain, it can also be used to sign immortal transactions.
53
+ */
54
+ get genesisHash(): Hash;
55
+ /**
56
+ * @description true is the underlying provider is connected
57
+ */
58
+ get isConnected(): boolean;
59
+ /**
60
+ * @description The library information name & version (from package.json)
61
+ */
62
+ get libraryInfo(): string;
63
+ /**
64
+ * @description Contains all the chain state modules and their subsequent methods in the API. These are attached dynamically from the runtime metadata.
65
+ *
66
+ * All calls inside the namespace, is denoted by `section`.`method` and may take an optional query parameter. As an example, `api.query.timestamp.now()` (current block timestamp) does not take parameters, while `api.query.system.account(<accountId>)` (retrieving the associated nonce & balances for an account), takes the `AccountId` as a parameter.
67
+ *
68
+ * @example
69
+ * <BR>
70
+ *
71
+ * ```javascript
72
+ * api.query.system.account(<accountId>, ([nonce, balance]) => {
73
+ * console.log('new free balance', balance.free, 'new nonce', nonce);
74
+ * });
75
+ * ```
76
+ */
77
+ get query(): QueryableStorage<ApiType>;
78
+ /**
79
+ * @description Allows for the querying of multiple storage entries and the combination thereof into a single result. This is a very optimal way to make multiple queries since it only makes a single connection to the node and retrieves the data over one subscription.
80
+ *
81
+ * @example
82
+ * <BR>
83
+ *
84
+ * ```javascript
85
+ * const unsub = await api.queryMulti(
86
+ * [
87
+ * // you can include the storage without any parameters
88
+ * api.query.balances.totalIssuance,
89
+ * // or you can pass parameters to the storage query
90
+ * [api.query.system.account, '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY']
91
+ * ],
92
+ * ([existential, [, { free }]]) => {
93
+ * console.log(`You have ${free.sub(existential)} more than the existential deposit`);
94
+ *
95
+ * unsub();
96
+ * }
97
+ * );
98
+ * ```
99
+ */
100
+ get queryMulti(): QueryableStorageMulti<ApiType>;
101
+ /**
102
+ * @description Contains all the raw rpc sections and their subsequent methods in the API as defined by the jsonrpc interface definitions. Unlike the dynamic `api.query` and `api.tx` sections, these methods are fixed (although extensible with node upgrades) and not determined by the runtime.
103
+ *
104
+ * RPC endpoints available here allow for the query of chain, node and system information, in addition to providing interfaces for the raw queries of state (using known keys) and the submission of transactions.
105
+ *
106
+ * @example
107
+ * <BR>
108
+ *
109
+ * ```javascript
110
+ * api.rpc.chain.subscribeNewHeads((header) => {
111
+ * console.log('new header', header);
112
+ * });
113
+ * ```
114
+ */
115
+ get rpc(): DecoratedRpc<ApiType, RpcInterface>;
116
+ /**
117
+ * @description Contains the chain information for the current node.
118
+ */
119
+ get runtimeChain(): Text;
120
+ /**
121
+ * @description Yields the current attached runtime metadata. Generally this is only used to construct extrinsics & storage, but is useful for current runtime inspection.
122
+ */
123
+ get runtimeMetadata(): Metadata;
124
+ /**
125
+ * @description Contains the version information for the current runtime.
126
+ */
127
+ get runtimeVersion(): RuntimeVersion;
128
+ /**
129
+ * @description The underlying Rx API interface
130
+ */
131
+ get rx(): Pick<ApiInterfaceRx, 'tx' | 'rpc' | 'query' | 'call'>;
132
+ /**
133
+ * @description Returns the underlying provider stats
134
+ */
135
+ get stats(): RpcCoreStats | undefined;
136
+ /**
137
+ * @description The type of this API instance, either 'rxjs' or 'promise'
138
+ */
139
+ get type(): ApiTypes;
140
+ /**
141
+ * @description Contains all the extrinsic modules and their subsequent methods in the API. It allows for the construction of transactions and the submission thereof. These are attached dynamically from the runtime metadata.
142
+ *
143
+ * @example
144
+ * <BR>
145
+ *
146
+ * ```javascript
147
+ * api.tx.balances
148
+ * .transferAllowDeath(<recipientId>, <balance>)
149
+ * .signAndSend(<keyPair>, ({status}) => {
150
+ * console.log('tx status', status.asFinalized.toHex());
151
+ * });
152
+ * ```
153
+ */
154
+ get tx(): SubmittableExtrinsics<ApiType>;
155
+ /**
156
+ * @description Finds the definition for a specific [[CallFunction]] based on the index supplied
157
+ */
158
+ findCall(callIndex: Uint8Array | string): CallFunction;
159
+ /**
160
+ * @description Finds the definition for a specific [[RegistryError]] based on the index supplied
161
+ */
162
+ findError(errorIndex: Uint8Array | string): RegistryError;
163
+ }
@@ -0,0 +1,44 @@
1
+ import type { RuntimeVersion } from '@pezkuwi/types/interfaces';
2
+ import type { ApiDecoration, ApiOptions, ApiTypes, DecorateMethod } from '../types/index.js';
3
+ import type { VersionedRegistry } from './types.js';
4
+ import { Decorate } from './Decorate.js';
5
+ export declare abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
6
+ #private;
7
+ constructor(options: ApiOptions, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>);
8
+ /**
9
+ * @description Decorates a registry based on the runtime version
10
+ */
11
+ private _initRegistry;
12
+ /**
13
+ * @description Returns the default versioned registry
14
+ */
15
+ private _getDefaultRegistry;
16
+ /**
17
+ * @description Returns a decorated API instance at a specific point in time
18
+ */
19
+ at(blockHash: Uint8Array | string, knownVersion?: RuntimeVersion): Promise<ApiDecoration<ApiType>>;
20
+ private _createBlockRegistry;
21
+ private _cacheBlockRegistryProgress;
22
+ private _getBlockRegistryViaVersion;
23
+ private _getBlockRegistryViaHash;
24
+ /**
25
+ * @description Sets up a registry based on the block hash defined
26
+ */
27
+ getBlockRegistry(blockHash: Uint8Array, knownVersion?: RuntimeVersion): Promise<VersionedRegistry<ApiType>>;
28
+ protected _loadMeta(): Promise<boolean>;
29
+ private _metaFromSource;
30
+ private _subscribeUpdates;
31
+ private _metaFromChain;
32
+ private _initFromMeta;
33
+ /**
34
+ * @internal
35
+ *
36
+ * Tries to use runtime api calls to retrieve metadata. This ensures the api initializes with the latest metadata.
37
+ * If the runtime call is not there it will use the rpc method.
38
+ */
39
+ private _retrieveMetadata;
40
+ private _subscribeHealth;
41
+ private _unsubscribeHealth;
42
+ private _unsubscribeUpdates;
43
+ protected _unsubscribe(): void;
44
+ }
@@ -0,0 +1,3 @@
1
+ import type { CallFunction, Registry, RegistryError } from '@pezkuwi/types/types';
2
+ export declare function findCall(registry: Registry, callIndex: Uint8Array | string): CallFunction;
3
+ export declare function findError(registry: Registry, errorIndex: Uint8Array | string): RegistryError;
@@ -0,0 +1,47 @@
1
+ import type { SignerPayloadRawBase } from '@pezkuwi/types/types';
2
+ import type { ApiOptions, ApiTypes, DecorateMethod, Signer } from '../types/index.js';
3
+ import { Getters } from './Getters.js';
4
+ interface KeyringSigner {
5
+ sign(message: Uint8Array): Uint8Array;
6
+ }
7
+ interface SignerRawOptions {
8
+ signer?: Signer;
9
+ }
10
+ export declare abstract class ApiBase<ApiType extends ApiTypes> extends Getters<ApiType> {
11
+ /**
12
+ * @description Create an instance of the class
13
+ *
14
+ * @param options Options object to create API instance or a Provider instance
15
+ *
16
+ * @example
17
+ * <BR>
18
+ *
19
+ * ```javascript
20
+ * import Api from '@pezkuwi/api/promise';
21
+ *
22
+ * const api = new Api().isReady();
23
+ *
24
+ * api.rpc.subscribeNewHeads((header) => {
25
+ * console.log(`new block #${header.number.toNumber()}`);
26
+ * });
27
+ * ```
28
+ */
29
+ constructor(options: ApiOptions | undefined, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>);
30
+ /**
31
+ * @description Connect from the underlying provider, halting all network traffic
32
+ */
33
+ connect(): Promise<void>;
34
+ /**
35
+ * @description Disconnect from the underlying provider, halting all network traffic
36
+ */
37
+ disconnect(): Promise<void>;
38
+ /**
39
+ * @description Set an external signer which will be used to sign extrinsic when account passed in is not KeyringPair
40
+ */
41
+ setSigner(signer: Signer | undefined): void;
42
+ /**
43
+ * @description Signs a raw signer payload, string or Uint8Array
44
+ */
45
+ sign(address: KeyringSigner | string, data: SignerPayloadRawBase, { signer }?: SignerRawOptions): Promise<string>;
46
+ }
47
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { Metadata } from '@pezkuwi/types';
2
+ import type { RuntimeVersionPartial } from '@pezkuwi/types/interfaces';
3
+ import type { DecoratedMeta } from '@pezkuwi/types/metadata/decorate/types';
4
+ import type { Registry } from '@pezkuwi/types/types';
5
+ import type { ApiDecoration, ApiTypes } from '../types/index.js';
6
+ export interface VersionedRegistry<ApiType extends ApiTypes> {
7
+ counter: number;
8
+ decoratedApi?: ApiDecoration<ApiType>;
9
+ decoratedMeta?: DecoratedMeta;
10
+ isDefault?: boolean;
11
+ lastBlockHash?: Uint8Array | null;
12
+ metadata: Metadata;
13
+ registry: Registry;
14
+ runtimeVersion: RuntimeVersionPartial;
15
+ }
@@ -0,0 +1,7 @@
1
+ import '@pezkuwi/rpc-augment';
2
+ export { Keyring } from '@pezkuwi/keyring';
3
+ export { HttpProvider, ScProvider, WsProvider } from '@pezkuwi/rpc-provider';
4
+ export { packageInfo } from './packageInfo.js';
5
+ export { SubmittableResult } from './submittable/index.js';
6
+ export * from './promise/index.js';
7
+ export * from './rx/index.js';
@@ -0,0 +1,2 @@
1
+ import './packageDetect.js';
2
+ export * from './bundle.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const packageInfo: {
2
+ name: string;
3
+ path: string;
4
+ type: string;
5
+ version: string;
6
+ };
@@ -0,0 +1,158 @@
1
+ import type { ApiOptions, UnsubscribePromise } from '../types/index.js';
2
+ import type { CombinatorCallback, CombinatorFunction } from './Combinator.js';
3
+ import { ApiBase } from '../base/index.js';
4
+ /**
5
+ * # @pezkuwi/api/promise
6
+ *
7
+ * ## Overview
8
+ *
9
+ * @name ApiPromise
10
+ * @description
11
+ * ApiPromise is a standard JavaScript wrapper around the RPC and interfaces on the Pezkuwi network. As a full Promise-based, all interface calls return Promises, including the static `.create(...)`. Subscription calls utilise `(value) => {}` callbacks to pass through the latest values.
12
+ *
13
+ * The API is well suited to real-time applications where either the single-shot state is needed or use is to be made of the subscription-based features of Pezkuwi (and Bizinikiwi) clients.
14
+ *
15
+ * @see [[ApiRx]]
16
+ *
17
+ * ## Usage
18
+ *
19
+ * Making rpc calls -
20
+ * <BR>
21
+ *
22
+ * ```javascript
23
+ * import ApiPromise from '@pezkuwi/api/promise';
24
+ *
25
+ * // initialise via static create
26
+ * const api = await ApiPromise.create();
27
+ *
28
+ * // make a subscription to the network head
29
+ * api.rpc.chain.subscribeNewHeads((header) => {
30
+ * console.log(`Chain is at #${header.number}`);
31
+ * });
32
+ * ```
33
+ * <BR>
34
+ *
35
+ * Subscribing to chain state -
36
+ * <BR>
37
+ *
38
+ * ```javascript
39
+ * import { ApiPromise, WsProvider } from '@pezkuwi/api';
40
+ *
41
+ * // initialise a provider with a specific endpoint
42
+ * const provider = new WsProvider('wss://example.com:9944')
43
+ *
44
+ * // initialise via isReady & new with specific provider
45
+ * const api = await new ApiPromise({ provider }).isReady;
46
+ *
47
+ * // retrieve the block target time
48
+ * const blockPeriod = await api.query.timestamp.blockPeriod().toNumber();
49
+ * let last = 0;
50
+ *
51
+ * // subscribe to the current block timestamp, updates automatically (callback provided)
52
+ * api.query.timestamp.now((timestamp) => {
53
+ * const elapsed = last
54
+ * ? `, ${timestamp.toNumber() - last}s since last`
55
+ * : '';
56
+ *
57
+ * last = timestamp.toNumber();
58
+ * console.log(`timestamp ${timestamp}${elapsed} (${blockPeriod}s target)`);
59
+ * });
60
+ * ```
61
+ * <BR>
62
+ *
63
+ * Submitting a transaction -
64
+ * <BR>
65
+ *
66
+ * ```javascript
67
+ * import ApiPromise from '@pezkuwi/api/promise';
68
+ *
69
+ * ApiPromise.create().then((api) => {
70
+ * const [nonce] = await api.query.system.account(keyring.alice.address);
71
+ *
72
+ * api.tx.balances
73
+ * // create transfer
74
+ * transfer(keyring.bob.address, 12345)
75
+ * // sign the transcation
76
+ * .sign(keyring.alice, { nonce })
77
+ * // send the transaction (optional status callback)
78
+ * .send((status) => {
79
+ * console.log(`current status ${status.type}`);
80
+ * })
81
+ * // retrieve the submitted extrinsic hash
82
+ * .then((hash) => {
83
+ * console.log(`submitted with hash ${hash}`);
84
+ * });
85
+ * });
86
+ * ```
87
+ */
88
+ export declare class ApiPromise extends ApiBase<'promise'> {
89
+ #private;
90
+ /**
91
+ * @description Creates an instance of the ApiPromise class
92
+ * @param options Options to create an instance. This can be either [[ApiOptions]] or
93
+ * an [[WsProvider]].
94
+ * @example
95
+ * <BR>
96
+ *
97
+ * ```javascript
98
+ * import Api from '@pezkuwi/api/promise';
99
+ *
100
+ * new Api().isReady.then((api) => {
101
+ * api.rpc.subscribeNewHeads((header) => {
102
+ * console.log(`new block #${header.number.toNumber()}`);
103
+ * });
104
+ * });
105
+ * ```
106
+ */
107
+ constructor(options?: ApiOptions);
108
+ /**
109
+ * @description Creates an ApiPromise instance using the supplied provider. Returns an Promise containing the actual Api instance.
110
+ * @param options options that is passed to the class contructor. Can be either [[ApiOptions]] or a
111
+ * provider (see the constructor arguments)
112
+ * @example
113
+ * <BR>
114
+ *
115
+ * ```javascript
116
+ * import Api from '@pezkuwi/api/promise';
117
+ *
118
+ * Api.create().then(async (api) => {
119
+ * const timestamp = await api.query.timestamp.now();
120
+ *
121
+ * console.log(`lastest block timestamp ${timestamp}`);
122
+ * });
123
+ * ```
124
+ */
125
+ static create(options?: ApiOptions): Promise<ApiPromise>;
126
+ /**
127
+ * @description Promise that resolves the first time we are connected and loaded
128
+ */
129
+ get isReady(): Promise<ApiPromise>;
130
+ /**
131
+ * @description Promise that resolves if we can connect, or reject if there is an error
132
+ */
133
+ get isReadyOrError(): Promise<ApiPromise>;
134
+ /**
135
+ * @description Returns a clone of this ApiPromise instance (new underlying provider connection)
136
+ */
137
+ clone(): ApiPromise;
138
+ /**
139
+ * @description Creates a combinator that can be used to combine the latest results from multiple subscriptions
140
+ * @param fns An array of function to combine, each in the form of `(cb: (value: void)) => void`
141
+ * @param callback A callback that will return an Array of all the values this combinator has been applied to
142
+ * @example
143
+ * <BR>
144
+ *
145
+ * ```javascript
146
+ * const address = '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFacT7';
147
+ *
148
+ * // combines values from balance & nonce as it updates
149
+ * api.combineLatest([
150
+ * api.rpc.chain.subscribeNewHeads,
151
+ * (cb) => api.query.system.account(address, cb)
152
+ * ], ([head, [balance, nonce]]) => {
153
+ * console.log(`#${head.number}: You have ${balance.free} units, with ${nonce} transactions sent`);
154
+ * });
155
+ * ```
156
+ */
157
+ combineLatest<T extends any[] = any[]>(fns: (CombinatorFunction | [CombinatorFunction, ...any[]])[], callback: CombinatorCallback<T>): UnsubscribePromise;
158
+ }
@@ -0,0 +1,12 @@
1
+ import type { Callback } from '@pezkuwi/types/types';
2
+ import type { UnsubscribePromise } from '../types/index.js';
3
+ export type CombinatorCallback<T extends unknown[]> = Callback<T>;
4
+ export type CombinatorFunction = (cb: Callback<any>) => UnsubscribePromise;
5
+ export declare class Combinator<T extends unknown[] = unknown[]> {
6
+ #private;
7
+ constructor(fns: (CombinatorFunction | [CombinatorFunction, ...unknown[]])[], callback: CombinatorCallback<T>);
8
+ protected _allHasFired(): boolean;
9
+ protected _createCallback(index: number): (value: any) => void;
10
+ protected _triggerUpdate(): void;
11
+ unsubscribe(): void;
12
+ }
@@ -0,0 +1,14 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { Codec } from '@pezkuwi/types/types';
3
+ import type { DecorateFn, DecorateMethodOptions, ObsInnerType, StorageEntryPromiseOverloads } from '../types/index.js';
4
+ interface Tracker<T> {
5
+ reject: (value: Error) => Observable<never>;
6
+ resolve: (value: T) => void;
7
+ }
8
+ type CodecReturnType<T extends (...args: unknown[]) => Observable<Codec>> = T extends (...args: any) => infer R ? R extends Observable<Codec> ? ObsInnerType<R> : never : never;
9
+ export declare function promiseTracker<T>(resolve: (value: T) => void, reject: (value: Error) => void): Tracker<T>;
10
+ /**
11
+ * @description Decorate method for ApiPromise, where the results are converted to the Promise equivalent
12
+ */
13
+ export declare function toPromiseMethod<M extends DecorateFn<CodecReturnType<M>>>(method: M, options?: DecorateMethodOptions): StorageEntryPromiseOverloads;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ export { ApiPromise } from './Api.js';
2
+ export { toPromiseMethod } from './decorateMethod.js';
@@ -0,0 +1,5 @@
1
+ import type { SubmittableExtrinsic as SubmittableExtrinsicBase } from '../submittable/types.js';
2
+ import type { QueryableStorageEntry as QueryableStorageEntryBase, SubmittableExtrinsicFunction as SubmittableExtrinsicFunctionBase } from '../types/index.js';
3
+ export type QueryableStorageEntry = QueryableStorageEntryBase<'promise'>;
4
+ export type SubmittableExtrinsic = SubmittableExtrinsicBase<'promise'>;
5
+ export type SubmittableExtrinsicFunction = SubmittableExtrinsicFunctionBase<'promise'>;
@@ -0,0 +1,155 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { ApiOptions } from '../types/index.js';
3
+ import { ApiBase } from '../base/index.js';
4
+ /**
5
+ * # @pezkuwi/api/rx
6
+ *
7
+ * ## Overview
8
+ *
9
+ * @name ApiRx
10
+ *
11
+ * @description
12
+ * ApiRx is a powerful RxJS Observable wrapper around the RPC and interfaces on the Pezkuwi network. As a full Observable API, all interface calls return RxJS Observables, including the static `.create(...)`. In the same fashion and subscription-based methods return long-running Observables that update with the latest values.
13
+ *
14
+ * The API is well suited to real-time applications where the latest state is needed, unlocking the subscription-based features of Pezkuwi (and Bizinikiwi) clients. Some familiarity with RxJS is a requirement to use the API, however just understanding `.subscribe` and `.pipe` on Observables will unlock full-scale use thereof.
15
+ *
16
+ * @see [[ApiPromise]]
17
+ *
18
+ * ## Usage
19
+ *
20
+ * Making rpc calls -
21
+ * <BR>
22
+ *
23
+ * ```javascript
24
+ * import ApiRx from '@pezkuwi/api/rx';
25
+ *
26
+ * // initialize via Promise & static create
27
+ * const api = await ApiRx.create().toPromise();
28
+ *
29
+ * // make a call to retrieve the current network head
30
+ * api.rpc.chain.subscribeNewHeads().subscribe((header) => {
31
+ * console.log(`Chain is at #${header.number}`);
32
+ * });
33
+ * ```
34
+ * <BR>
35
+ *
36
+ * Subscribing to chain state -
37
+ * <BR>
38
+ *
39
+ * ```javascript
40
+ * import { combineLatest, pairwise, switchMap } from 'rxjs';
41
+ * import { ApiRx, WsProvider } from '@pezkuwi/api';
42
+ *
43
+ *
44
+ * // initialize a provider with a specific endpoint
45
+ * const provider = new WsProvider('wss://example.com:9944')
46
+ *
47
+ * // initialize via isReady & new with specific provider
48
+ * new ApiRx({ provider })
49
+ * .isReady
50
+ * .pipe(
51
+ * switchMap((api) =>
52
+ * combineLatest([
53
+ * api.query.timestamp.blockPeriod(),
54
+ * api.query.timestamp.now().pipe(pairwise())
55
+ * ])
56
+ * )
57
+ * )
58
+ * .subscribe(([blockPeriod, timestamp]) => {
59
+ * const elapsed = timestamp[1].toNumber() - timestamp[0].toNumber();
60
+ * console.log(`timestamp ${timestamp[1]} \nelapsed ${elapsed} \n(${blockPeriod}s target)`);
61
+ * });
62
+ * ```
63
+ * <BR>
64
+ *
65
+ * Submitting a transaction -
66
+ * <BR>
67
+ *
68
+ * ```javascript
69
+ * import { first, switchMap } from 'rxjs';
70
+ * import ApiRx from '@pezkuwi/api/rx';
71
+ *
72
+ * // import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie)
73
+ * import testingPairs from '@pezkuwi/keyring/testingPairs';
74
+ * const keyring = testingPairs();
75
+ *
76
+ * // get api via Promise
77
+ * const api = await ApiRx.create().toPromise();
78
+ *
79
+ * // retrieve nonce for the account
80
+ * api.query.system
81
+ * .account(keyring.alice.address)
82
+ * .pipe(
83
+ * first(),
84
+ * // pipe nonce into transfer
85
+ * switchMap(([nonce]) =>
86
+ * api.tx.balances
87
+ * // create transfer
88
+ * .transferAllowDeath(keyring.bob.address, 12345)
89
+ * // sign the transaction
90
+ * .sign(keyring.alice, { nonce })
91
+ * // send the transaction
92
+ * .send()
93
+ * )
94
+ * )
95
+ * // subscribe to overall result
96
+ * .subscribe(({ status }) => {
97
+ * if (status.isInBlock) {
98
+ * console.log('Completed at block hash', status.asFinalized.toHex());
99
+ * }
100
+ * });
101
+ * ```
102
+ */
103
+ export declare class ApiRx extends ApiBase<'rxjs'> {
104
+ #private;
105
+ /**
106
+ * @description Create an instance of the ApiRx class
107
+ * @param options Options to create an instance. Can be either [[ApiOptions]] or [[WsProvider]]
108
+ * @example
109
+ * <BR>
110
+ *
111
+ * ```javascript
112
+ * import { switchMap } from 'rxjs';
113
+ * import Api from '@pezkuwi/api/rx';
114
+ *
115
+ * new Api().isReady
116
+ * .pipe(
117
+ * switchMap((api) =>
118
+ * api.rpc.chain.subscribeNewHeads()
119
+ * ))
120
+ * .subscribe((header) => {
121
+ * console.log(`new block #${header.number.toNumber()}`);
122
+ * });
123
+ * ```
124
+ */
125
+ constructor(options?: ApiOptions);
126
+ /**
127
+ * @description Creates an ApiRx instance using the supplied provider. Returns an Observable containing the actual Api instance.
128
+ * @param options options that is passed to the class constructor. Can be either [[ApiOptions]] or [[WsProvider]]
129
+ * @example
130
+ * <BR>
131
+ *
132
+ * ```javascript
133
+ * import { switchMap } from 'rxjs';
134
+ * import Api from '@pezkuwi/api/rx';
135
+ *
136
+ * Api.create()
137
+ * .pipe(
138
+ * switchMap((api) =>
139
+ * api.rpc.chain.subscribeNewHeads()
140
+ * ))
141
+ * .subscribe((header) => {
142
+ * console.log(`new block #${header.number.toNumber()}`);
143
+ * });
144
+ * ```
145
+ */
146
+ static create(options?: ApiOptions): Observable<ApiRx>;
147
+ /**
148
+ * @description Observable that returns the first time we are connected and loaded
149
+ */
150
+ get isReady(): Observable<ApiRx>;
151
+ /**
152
+ * @description Returns a clone of this ApiRx instance (new underlying provider connection)
153
+ */
154
+ clone(): ApiRx;
155
+ }
@@ -0,0 +1,3 @@
1
+ import type { Codec } from '@pezkuwi/types/types';
2
+ import type { DecorateFn } from '../types/index.js';
3
+ export declare function toRxMethod<M extends DecorateFn<Codec>>(method: M): M;
@@ -0,0 +1,2 @@
1
+ export { ApiRx } from './Api.js';
2
+ export { toRxMethod } from './decorateMethod.js';