@pezkuwi/api 16.5.8 → 16.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/bundle-pezkuwi-api.js +24 -18
  2. package/cjs/packageInfo.js +1 -1
  3. package/cjs/submittable/createClass.js +1 -0
  4. package/package.json +18 -17
  5. package/packageInfo.js +1 -1
  6. package/submittable/createClass.js +1 -0
  7. package/build/LICENSE +0 -201
  8. package/build/README.md +0 -100
  9. package/build/augment.d.ts +0 -1
  10. package/build/augment.js +0 -1
  11. package/build/base/Decorate.d.ts +0 -143
  12. package/build/base/Decorate.js +0 -752
  13. package/build/base/Events.d.ts +0 -67
  14. package/build/base/Events.js +0 -78
  15. package/build/base/Getters.d.ts +0 -163
  16. package/build/base/Getters.js +0 -207
  17. package/build/base/Init.d.ts +0 -44
  18. package/build/base/Init.js +0 -400
  19. package/build/base/find.d.ts +0 -3
  20. package/build/base/find.js +0 -7
  21. package/build/base/index.d.ts +0 -47
  22. package/build/base/index.js +0 -57
  23. package/build/base/types.d.ts +0 -15
  24. package/build/base/types.js +0 -1
  25. package/build/bundle-pezkuwi-api.js +0 -26247
  26. package/build/bundle.d.ts +0 -7
  27. package/build/bundle.js +0 -7
  28. package/build/cjs/augment.d.ts +0 -1
  29. package/build/cjs/augment.js +0 -3
  30. package/build/cjs/base/Decorate.d.ts +0 -143
  31. package/build/cjs/base/Decorate.js +0 -756
  32. package/build/cjs/base/Events.d.ts +0 -67
  33. package/build/cjs/base/Events.js +0 -82
  34. package/build/cjs/base/Getters.d.ts +0 -163
  35. package/build/cjs/base/Getters.js +0 -211
  36. package/build/cjs/base/Init.d.ts +0 -44
  37. package/build/cjs/base/Init.js +0 -404
  38. package/build/cjs/base/find.d.ts +0 -3
  39. package/build/cjs/base/find.js +0 -11
  40. package/build/cjs/base/index.d.ts +0 -47
  41. package/build/cjs/base/index.js +0 -61
  42. package/build/cjs/base/types.d.ts +0 -15
  43. package/build/cjs/base/types.js +0 -2
  44. package/build/cjs/bundle.d.ts +0 -7
  45. package/build/cjs/bundle.js +0 -17
  46. package/build/cjs/index.d.ts +0 -2
  47. package/build/cjs/index.js +0 -5
  48. package/build/cjs/package.json +0 -3
  49. package/build/cjs/packageDetect.d.ts +0 -1
  50. package/build/cjs/packageDetect.js +0 -10
  51. package/build/cjs/packageInfo.d.ts +0 -6
  52. package/build/cjs/packageInfo.js +0 -4
  53. package/build/cjs/promise/Api.d.ts +0 -158
  54. package/build/cjs/promise/Api.js +0 -195
  55. package/build/cjs/promise/Combinator.d.ts +0 -12
  56. package/build/cjs/promise/Combinator.js +0 -72
  57. package/build/cjs/promise/decorateMethod.d.ts +0 -14
  58. package/build/cjs/promise/decorateMethod.js +0 -75
  59. package/build/cjs/promise/index.d.ts +0 -2
  60. package/build/cjs/promise/index.js +0 -7
  61. package/build/cjs/promise/types.d.ts +0 -5
  62. package/build/cjs/promise/types.js +0 -2
  63. package/build/cjs/rx/Api.d.ts +0 -155
  64. package/build/cjs/rx/Api.js +0 -173
  65. package/build/cjs/rx/decorateMethod.d.ts +0 -3
  66. package/build/cjs/rx/decorateMethod.js +0 -6
  67. package/build/cjs/rx/index.d.ts +0 -2
  68. package/build/cjs/rx/index.js +0 -7
  69. package/build/cjs/submittable/Result.d.ts +0 -31
  70. package/build/cjs/submittable/Result.js +0 -84
  71. package/build/cjs/submittable/createClass.d.ts +0 -12
  72. package/build/cjs/submittable/createClass.js +0 -277
  73. package/build/cjs/submittable/createSubmittable.d.ts +0 -8
  74. package/build/cjs/submittable/createSubmittable.js +0 -8
  75. package/build/cjs/submittable/index.d.ts +0 -2
  76. package/build/cjs/submittable/index.js +0 -7
  77. package/build/cjs/submittable/types.d.ts +0 -1
  78. package/build/cjs/submittable/types.js +0 -2
  79. package/build/cjs/types/calls.d.ts +0 -1
  80. package/build/cjs/types/calls.js +0 -4
  81. package/build/cjs/types/consts.d.ts +0 -1
  82. package/build/cjs/types/consts.js +0 -4
  83. package/build/cjs/types/errors.d.ts +0 -1
  84. package/build/cjs/types/errors.js +0 -4
  85. package/build/cjs/types/events.d.ts +0 -1
  86. package/build/cjs/types/events.js +0 -4
  87. package/build/cjs/types/index.d.ts +0 -114
  88. package/build/cjs/types/index.js +0 -13
  89. package/build/cjs/types/storage.d.ts +0 -1
  90. package/build/cjs/types/storage.js +0 -4
  91. package/build/cjs/types/submittable.d.ts +0 -1
  92. package/build/cjs/types/submittable.js +0 -4
  93. package/build/cjs/util/augmentObject.d.ts +0 -9
  94. package/build/cjs/util/augmentObject.js +0 -84
  95. package/build/cjs/util/decorate.d.ts +0 -16
  96. package/build/cjs/util/decorate.js +0 -17
  97. package/build/cjs/util/filterEvents.d.ts +0 -6
  98. package/build/cjs/util/filterEvents.js +0 -25
  99. package/build/cjs/util/index.d.ts +0 -4
  100. package/build/cjs/util/index.js +0 -11
  101. package/build/cjs/util/isKeyringPair.d.ts +0 -3
  102. package/build/cjs/util/isKeyringPair.js +0 -7
  103. package/build/cjs/util/logging.d.ts +0 -1
  104. package/build/cjs/util/logging.js +0 -5
  105. package/build/cjs/util/validate.d.ts +0 -3
  106. package/build/cjs/util/validate.js +0 -26
  107. package/build/index.d.ts +0 -2
  108. package/build/index.js +0 -2
  109. package/build/package.json +0 -612
  110. package/build/packageDetect.d.ts +0 -1
  111. package/build/packageDetect.js +0 -8
  112. package/build/packageInfo.d.ts +0 -6
  113. package/build/packageInfo.js +0 -1
  114. package/build/promise/Api.d.ts +0 -158
  115. package/build/promise/Api.js +0 -191
  116. package/build/promise/Combinator.d.ts +0 -12
  117. package/build/promise/Combinator.js +0 -68
  118. package/build/promise/decorateMethod.d.ts +0 -14
  119. package/build/promise/decorateMethod.js +0 -71
  120. package/build/promise/index.d.ts +0 -2
  121. package/build/promise/index.js +0 -2
  122. package/build/promise/types.d.ts +0 -5
  123. package/build/promise/types.js +0 -1
  124. package/build/rx/Api.d.ts +0 -155
  125. package/build/rx/Api.js +0 -169
  126. package/build/rx/decorateMethod.d.ts +0 -3
  127. package/build/rx/decorateMethod.js +0 -3
  128. package/build/rx/index.d.ts +0 -2
  129. package/build/rx/index.js +0 -2
  130. package/build/submittable/Result.d.ts +0 -31
  131. package/build/submittable/Result.js +0 -80
  132. package/build/submittable/createClass.d.ts +0 -12
  133. package/build/submittable/createClass.js +0 -274
  134. package/build/submittable/createSubmittable.d.ts +0 -8
  135. package/build/submittable/createSubmittable.js +0 -5
  136. package/build/submittable/index.d.ts +0 -2
  137. package/build/submittable/index.js +0 -2
  138. package/build/submittable/types.d.ts +0 -1
  139. package/build/submittable/types.js +0 -1
  140. package/build/types/calls.d.ts +0 -1
  141. package/build/types/calls.js +0 -1
  142. package/build/types/consts.d.ts +0 -1
  143. package/build/types/consts.js +0 -1
  144. package/build/types/errors.d.ts +0 -1
  145. package/build/types/errors.js +0 -1
  146. package/build/types/events.d.ts +0 -1
  147. package/build/types/events.js +0 -1
  148. package/build/types/index.d.ts +0 -114
  149. package/build/types/index.js +0 -8
  150. package/build/types/storage.d.ts +0 -1
  151. package/build/types/storage.js +0 -1
  152. package/build/types/submittable.d.ts +0 -1
  153. package/build/types/submittable.js +0 -1
  154. package/build/util/augmentObject.d.ts +0 -9
  155. package/build/util/augmentObject.js +0 -81
  156. package/build/util/decorate.d.ts +0 -16
  157. package/build/util/decorate.js +0 -14
  158. package/build/util/filterEvents.d.ts +0 -6
  159. package/build/util/filterEvents.js +0 -22
  160. package/build/util/index.d.ts +0 -4
  161. package/build/util/index.js +0 -4
  162. package/build/util/isKeyringPair.d.ts +0 -3
  163. package/build/util/isKeyringPair.js +0 -4
  164. package/build/util/logging.d.ts +0 -1
  165. package/build/util/logging.js +0 -2
  166. package/build/util/validate.d.ts +0 -3
  167. package/build/util/validate.js +0 -23
  168. package/build-deno/README.md +0 -95
  169. package/build-deno/augment.ts +0 -2
  170. package/build-deno/base/Decorate.ts +0 -1100
  171. package/build-deno/base/Events.ts +0 -89
  172. package/build-deno/base/Getters.ts +0 -243
  173. package/build-deno/base/Init.ts +0 -523
  174. package/build-deno/base/find.ts +0 -12
  175. package/build-deno/base/index.ts +0 -83
  176. package/build-deno/base/types.ts +0 -17
  177. package/build-deno/bundle.ts +0 -11
  178. package/build-deno/checkTypes.manual.ts +0 -320
  179. package/build-deno/index.ts +0 -4
  180. package/build-deno/mod.ts +0 -2
  181. package/build-deno/packageDetect.ts +0 -12
  182. package/build-deno/packageInfo.ts +0 -3
  183. package/build-deno/promise/Api.ts +0 -212
  184. package/build-deno/promise/Combinator.ts +0 -89
  185. package/build-deno/promise/decorateMethod.ts +0 -111
  186. package/build-deno/promise/index.ts +0 -3
  187. package/build-deno/promise/types.ts +0 -7
  188. package/build-deno/rx/Api.ts +0 -184
  189. package/build-deno/rx/decorateMethod.ts +0 -7
  190. package/build-deno/rx/index.ts +0 -3
  191. package/build-deno/submittable/Result.ts +0 -109
  192. package/build-deno/submittable/createClass.ts +0 -436
  193. package/build-deno/submittable/createSubmittable.ts +0 -17
  194. package/build-deno/submittable/index.ts +0 -3
  195. package/build-deno/submittable/types.ts +0 -2
  196. package/build-deno/test/SingleAccountSigner.ts +0 -51
  197. package/build-deno/test/index.ts +0 -3
  198. package/build-deno/test/logEvents.ts +0 -21
  199. package/build-deno/types/calls.ts +0 -2
  200. package/build-deno/types/consts.ts +0 -2
  201. package/build-deno/types/errors.ts +0 -2
  202. package/build-deno/types/events.ts +0 -2
  203. package/build-deno/types/index.ts +0 -124
  204. package/build-deno/types/storage.ts +0 -2
  205. package/build-deno/types/submittable.ts +0 -2
  206. package/build-deno/util/augmentObject.ts +0 -109
  207. package/build-deno/util/decorate.ts +0 -38
  208. package/build-deno/util/filterEvents.ts +0 -32
  209. package/build-deno/util/index.ts +0 -6
  210. package/build-deno/util/isKeyringPair.ts +0 -9
  211. package/build-deno/util/logging.ts +0 -4
  212. package/build-deno/util/validate.ts +0 -32
  213. package/build-tsc/augment.d.ts +0 -1
  214. package/build-tsc/base/Decorate.d.ts +0 -143
  215. package/build-tsc/base/Events.d.ts +0 -67
  216. package/build-tsc/base/Getters.d.ts +0 -163
  217. package/build-tsc/base/Init.d.ts +0 -44
  218. package/build-tsc/base/find.d.ts +0 -3
  219. package/build-tsc/base/index.d.ts +0 -47
  220. package/build-tsc/base/types.d.ts +0 -15
  221. package/build-tsc/bundle.d.ts +0 -7
  222. package/build-tsc/index.d.ts +0 -2
  223. package/build-tsc/packageDetect.d.ts +0 -1
  224. package/build-tsc/packageInfo.d.ts +0 -6
  225. package/build-tsc/promise/Api.d.ts +0 -158
  226. package/build-tsc/promise/Combinator.d.ts +0 -12
  227. package/build-tsc/promise/decorateMethod.d.ts +0 -14
  228. package/build-tsc/promise/index.d.ts +0 -2
  229. package/build-tsc/promise/types.d.ts +0 -5
  230. package/build-tsc/rx/Api.d.ts +0 -155
  231. package/build-tsc/rx/decorateMethod.d.ts +0 -3
  232. package/build-tsc/rx/index.d.ts +0 -2
  233. package/build-tsc/submittable/Result.d.ts +0 -31
  234. package/build-tsc/submittable/createClass.d.ts +0 -12
  235. package/build-tsc/submittable/createSubmittable.d.ts +0 -8
  236. package/build-tsc/submittable/index.d.ts +0 -2
  237. package/build-tsc/submittable/types.d.ts +0 -1
  238. package/build-tsc/types/calls.d.ts +0 -1
  239. package/build-tsc/types/consts.d.ts +0 -1
  240. package/build-tsc/types/errors.d.ts +0 -1
  241. package/build-tsc/types/events.d.ts +0 -1
  242. package/build-tsc/types/index.d.ts +0 -114
  243. package/build-tsc/types/storage.d.ts +0 -1
  244. package/build-tsc/types/submittable.d.ts +0 -1
  245. package/build-tsc/util/augmentObject.d.ts +0 -9
  246. package/build-tsc/util/decorate.d.ts +0 -16
  247. package/build-tsc/util/filterEvents.d.ts +0 -6
  248. package/build-tsc/util/index.d.ts +0 -4
  249. package/build-tsc/util/isKeyringPair.d.ts +0 -3
  250. package/build-tsc/util/logging.d.ts +0 -1
  251. package/build-tsc/util/validate.d.ts +0 -3
  252. package/build-tsc-cjs/augment.js +0 -3
  253. package/build-tsc-cjs/base/Decorate.js +0 -756
  254. package/build-tsc-cjs/base/Events.js +0 -82
  255. package/build-tsc-cjs/base/Getters.js +0 -211
  256. package/build-tsc-cjs/base/Init.js +0 -404
  257. package/build-tsc-cjs/base/find.js +0 -11
  258. package/build-tsc-cjs/base/index.js +0 -61
  259. package/build-tsc-cjs/base/types.js +0 -2
  260. package/build-tsc-cjs/bundle.js +0 -17
  261. package/build-tsc-cjs/index.js +0 -5
  262. package/build-tsc-cjs/packageDetect.js +0 -10
  263. package/build-tsc-cjs/packageInfo.js +0 -4
  264. package/build-tsc-cjs/promise/Api.js +0 -195
  265. package/build-tsc-cjs/promise/Combinator.js +0 -72
  266. package/build-tsc-cjs/promise/decorateMethod.js +0 -75
  267. package/build-tsc-cjs/promise/index.js +0 -7
  268. package/build-tsc-cjs/promise/types.js +0 -2
  269. package/build-tsc-cjs/rx/Api.js +0 -173
  270. package/build-tsc-cjs/rx/decorateMethod.js +0 -6
  271. package/build-tsc-cjs/rx/index.js +0 -7
  272. package/build-tsc-cjs/submittable/Result.js +0 -84
  273. package/build-tsc-cjs/submittable/createClass.js +0 -277
  274. package/build-tsc-cjs/submittable/createSubmittable.js +0 -8
  275. package/build-tsc-cjs/submittable/index.js +0 -7
  276. package/build-tsc-cjs/submittable/types.js +0 -2
  277. package/build-tsc-cjs/types/calls.js +0 -4
  278. package/build-tsc-cjs/types/consts.js +0 -4
  279. package/build-tsc-cjs/types/errors.js +0 -4
  280. package/build-tsc-cjs/types/events.js +0 -4
  281. package/build-tsc-cjs/types/index.js +0 -13
  282. package/build-tsc-cjs/types/storage.js +0 -4
  283. package/build-tsc-cjs/types/submittable.js +0 -4
  284. package/build-tsc-cjs/util/augmentObject.js +0 -84
  285. package/build-tsc-cjs/util/decorate.js +0 -17
  286. package/build-tsc-cjs/util/filterEvents.js +0 -25
  287. package/build-tsc-cjs/util/index.js +0 -11
  288. package/build-tsc-cjs/util/isKeyringPair.js +0 -7
  289. package/build-tsc-cjs/util/logging.js +0 -5
  290. package/build-tsc-cjs/util/validate.js +0 -26
  291. package/build-tsc-esm/augment.js +0 -1
  292. package/build-tsc-esm/base/Decorate.js +0 -752
  293. package/build-tsc-esm/base/Events.js +0 -78
  294. package/build-tsc-esm/base/Getters.js +0 -207
  295. package/build-tsc-esm/base/Init.js +0 -400
  296. package/build-tsc-esm/base/find.js +0 -7
  297. package/build-tsc-esm/base/index.js +0 -57
  298. package/build-tsc-esm/base/types.js +0 -1
  299. package/build-tsc-esm/bundle.js +0 -7
  300. package/build-tsc-esm/index.js +0 -2
  301. package/build-tsc-esm/packageDetect.js +0 -8
  302. package/build-tsc-esm/packageInfo.js +0 -1
  303. package/build-tsc-esm/promise/Api.js +0 -191
  304. package/build-tsc-esm/promise/Combinator.js +0 -68
  305. package/build-tsc-esm/promise/decorateMethod.js +0 -71
  306. package/build-tsc-esm/promise/index.js +0 -2
  307. package/build-tsc-esm/promise/types.js +0 -1
  308. package/build-tsc-esm/rx/Api.js +0 -169
  309. package/build-tsc-esm/rx/decorateMethod.js +0 -3
  310. package/build-tsc-esm/rx/index.js +0 -2
  311. package/build-tsc-esm/submittable/Result.js +0 -80
  312. package/build-tsc-esm/submittable/createClass.js +0 -274
  313. package/build-tsc-esm/submittable/createSubmittable.js +0 -5
  314. package/build-tsc-esm/submittable/index.js +0 -2
  315. package/build-tsc-esm/submittable/types.js +0 -1
  316. package/build-tsc-esm/types/calls.js +0 -1
  317. package/build-tsc-esm/types/consts.js +0 -1
  318. package/build-tsc-esm/types/errors.js +0 -1
  319. package/build-tsc-esm/types/events.js +0 -1
  320. package/build-tsc-esm/types/index.js +0 -8
  321. package/build-tsc-esm/types/storage.js +0 -1
  322. package/build-tsc-esm/types/submittable.js +0 -1
  323. package/build-tsc-esm/util/augmentObject.js +0 -81
  324. package/build-tsc-esm/util/decorate.js +0 -14
  325. package/build-tsc-esm/util/filterEvents.js +0 -22
  326. package/build-tsc-esm/util/index.js +0 -4
  327. package/build-tsc-esm/util/isKeyringPair.js +0 -4
  328. package/build-tsc-esm/util/logging.js +0 -2
  329. package/build-tsc-esm/util/validate.js +0 -23
  330. package/src/augment.ts +0 -4
  331. package/src/base/Decorate.ts +0 -1103
  332. package/src/base/Events.ts +0 -91
  333. package/src/base/Getters.ts +0 -245
  334. package/src/base/Init.ts +0 -525
  335. package/src/base/find.ts +0 -14
  336. package/src/base/index.ts +0 -85
  337. package/src/base/types.ts +0 -19
  338. package/src/bundle.ts +0 -16
  339. package/src/checkTypes.manual.ts +0 -323
  340. package/src/index.ts +0 -6
  341. package/src/mod.ts +0 -4
  342. package/src/packageDetect.ts +0 -16
  343. package/src/packageInfo.ts +0 -6
  344. package/src/promise/Api.ts +0 -214
  345. package/src/promise/Combinator.ts +0 -91
  346. package/src/promise/Combinators.spec.ts +0 -109
  347. package/src/promise/decorateMethod.ts +0 -118
  348. package/src/promise/index.spec.ts +0 -167
  349. package/src/promise/index.ts +0 -5
  350. package/src/promise/types.ts +0 -9
  351. package/src/rx/Api.ts +0 -186
  352. package/src/rx/decorateMethod.ts +0 -9
  353. package/src/rx/index.ts +0 -5
  354. package/src/submittable/Result.ts +0 -111
  355. package/src/submittable/createClass.ts +0 -438
  356. package/src/submittable/createSubmittable.ts +0 -19
  357. package/src/submittable/index.ts +0 -5
  358. package/src/submittable/types.ts +0 -4
  359. package/src/test/SingleAccountSigner.ts +0 -53
  360. package/src/test/index.ts +0 -5
  361. package/src/test/logEvents.ts +0 -24
  362. package/src/types/calls.ts +0 -4
  363. package/src/types/consts.ts +0 -4
  364. package/src/types/errors.ts +0 -4
  365. package/src/types/events.ts +0 -4
  366. package/src/types/index.ts +0 -137
  367. package/src/types/storage.ts +0 -4
  368. package/src/types/submittable.ts +0 -4
  369. package/src/util/augmentObject.spec.ts +0 -54
  370. package/src/util/augmentObject.ts +0 -112
  371. package/src/util/decorate.ts +0 -43
  372. package/src/util/filterEvents.ts +0 -34
  373. package/src/util/index.ts +0 -10
  374. package/src/util/isKeyringPair.ts +0 -11
  375. package/src/util/logging.ts +0 -6
  376. package/src/util/validate.spec.ts +0 -72
  377. package/src/util/validate.ts +0 -36
  378. package/tsconfig.build.json +0 -25
  379. package/tsconfig.build.tsbuildinfo +0 -1
  380. package/tsconfig.spec.json +0 -26
  381. package/tsconfig.spec.tsbuildinfo +0 -1
@@ -1,523 +0,0 @@
1
-
2
- import type { Observable, Subscription } from 'https://esm.sh/rxjs@7.8.1';
3
- import type { Bytes, Text, u32, Vec } from 'https://deno.land/x/pezkuwi/types/mod.ts';
4
- import type { ExtDef } from 'https://deno.land/x/pezkuwi/types/extrinsic/signedExtensions/types.ts';
5
- import type { BlockHash, ChainProperties, Hash, HeaderPartial, RuntimeVersion, RuntimeVersionApi, RuntimeVersionPartial } from 'https://deno.land/x/pezkuwi/types/interfaces/index.ts';
6
- import type { Registry } from 'https://deno.land/x/pezkuwi/types/types/index.ts';
7
- import type { BN } from 'https://deno.land/x/pezkuwi/util/mod.ts';
8
- import type { HexString } from 'https://deno.land/x/pezkuwi/util/types.ts';
9
- import type { ApiBase, ApiDecoration, ApiOptions, ApiTypes, DecorateMethod } from '../types/index.ts';
10
- import type { VersionedRegistry } from './types.ts';
11
-
12
- import { firstValueFrom, map, of, switchMap } from 'https://esm.sh/rxjs@7.8.1';
13
-
14
- import { Metadata, TypeRegistry } from 'https://deno.land/x/pezkuwi/types/mod.ts';
15
- import { LATEST_EXTRINSIC_VERSION } from 'https://deno.land/x/pezkuwi/types/extrinsic/constants.ts';
16
- import { getSpecAlias, getSpecExtensions, getSpecHasher, getSpecRpc, getSpecTypes, getUpgradeVersion } from 'https://deno.land/x/pezkuwi/types-known/mod.ts';
17
- import { assertReturn, BN_ZERO, isUndefined, logger, noop, objectSpread, u8aEq, u8aToHex, u8aToU8a } from 'https://deno.land/x/pezkuwi/util/mod.ts';
18
- import { blake2AsHex, cryptoWaitReady } from 'https://deno.land/x/pezkuwi/util-crypto/mod.ts';
19
-
20
- import { Decorate } from './Decorate.ts';
21
-
22
- const KEEPALIVE_INTERVAL = 10000;
23
- const WITH_VERSION_SHORTCUT = false;
24
-
25
- const SUPPORTED_METADATA_VERSIONS = [16, 15, 14];
26
-
27
- const l = logger('api/init');
28
-
29
- function textToString (t: Text): string {
30
- return t.toString();
31
- }
32
-
33
- export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
34
- #atLast: [string, ApiDecoration<ApiType>] | null = null;
35
- #healthTimer: ReturnType<typeof setInterval> | null = null;
36
- #registries: VersionedRegistry<ApiType>[] = [];
37
- #updateSub?: Subscription | null = null;
38
- #waitingRegistries: Record<HexString, Promise<VersionedRegistry<ApiType>>> = {};
39
-
40
- constructor (options: ApiOptions, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>) {
41
- super(options, type, decorateMethod);
42
-
43
- // all injected types added to the registry for overrides
44
- this.registry.setKnownTypes(options);
45
-
46
- // We only register the types (global) if this is not a cloned instance.
47
- // Do right up-front, so we get in the user types before we are actually
48
- // doing anything on-chain, this ensures we have the overrides in-place
49
- if (!options.source) {
50
- this.registerTypes(options.types);
51
- } else {
52
- this.#registries = options.source.#registries as VersionedRegistry<ApiType>[];
53
- }
54
-
55
- this._rpc = this._decorateRpc(this._rpcCore, this._decorateMethod);
56
- this._rx.rpc = this._decorateRpc(this._rpcCore, this._rxDecorateMethod);
57
-
58
- if (this.supportMulti) {
59
- this._queryMulti = this._decorateMulti(this._decorateMethod);
60
- this._rx.queryMulti = this._decorateMulti(this._rxDecorateMethod);
61
- }
62
-
63
- this._rx.signer = options.signer;
64
-
65
- this._rpcCore.setRegistrySwap((blockHash: Uint8Array) => this.getBlockRegistry(blockHash));
66
-
67
- this._rpcCore.setResolveBlockHash((blockNumber) => firstValueFrom(this._rpcCore.chain.getBlockHash(blockNumber)));
68
-
69
- if (this.hasSubscriptions) {
70
- this._rpcCore.provider.on('disconnected', () => this.#onProviderDisconnect());
71
- this._rpcCore.provider.on('error', (e: Error) => this.#onProviderError(e));
72
- this._rpcCore.provider.on('connected', () => this.#onProviderConnect());
73
- } else if (!this._options.noInitWarn) {
74
- l.warn('Api will be available in a limited mode since the provider does not support subscriptions');
75
- }
76
-
77
- // If the provider was instantiated earlier, and has already emitted a
78
- // 'connected' event, then the `on('connected')` won't fire anymore. To
79
- // cater for this case, we call manually `this._onProviderConnect`.
80
- if (this._rpcCore.provider.isConnected) {
81
- this.#onProviderConnect().catch(noop);
82
- }
83
- }
84
-
85
- /**
86
- * @description Decorates a registry based on the runtime version
87
- */
88
- private _initRegistry (registry: Registry, chain: Text, version: { specName: Text, specVersion: BN }, metadata: Metadata, chainProps?: ChainProperties): void {
89
- registry.clearCache();
90
- registry.setChainProperties(chainProps || this.registry.getChainProperties());
91
- registry.setKnownTypes(this._options);
92
- registry.register(getSpecTypes(registry, chain, version.specName, version.specVersion));
93
- registry.setHasher(getSpecHasher(registry, chain, version.specName));
94
-
95
- // for bundled types, pull through the aliases defined
96
- if (registry.knownTypes.typesBundle) {
97
- registry.knownTypes.typesAlias = getSpecAlias(registry, chain, version.specName);
98
- }
99
-
100
- registry.setMetadata(metadata, undefined, objectSpread<ExtDef>({}, getSpecExtensions(registry, chain, version.specName), this._options.signedExtensions), this._options.noInitWarn);
101
- }
102
-
103
- /**
104
- * @description Returns the default versioned registry
105
- */
106
- private _getDefaultRegistry (): VersionedRegistry<ApiType> {
107
- return assertReturn(this.#registries.find(({ isDefault }) => isDefault), 'Initialization error, cannot find the default registry');
108
- }
109
-
110
- /**
111
- * @description Returns a decorated API instance at a specific point in time
112
- */
113
- public async at (blockHash: Uint8Array | string, knownVersion?: RuntimeVersion): Promise<ApiDecoration<ApiType>> {
114
- const u8aHash = u8aToU8a(blockHash);
115
- const u8aHex = u8aToHex(u8aHash);
116
- const registry = await this.getBlockRegistry(u8aHash, knownVersion);
117
-
118
- if (!this.#atLast || this.#atLast[0] !== u8aHex) {
119
- // always create a new decoration - since we are pointing to a specific hash, this
120
- // means that all queries needs to use that hash (not a previous one already existing)
121
- this.#atLast = [u8aHex, this._createDecorated(registry, true, null, u8aHash).decoratedApi];
122
- }
123
-
124
- return this.#atLast[1];
125
- }
126
-
127
- private async _createBlockRegistry (blockHash: Uint8Array, header: HeaderPartial, version: RuntimeVersionPartial): Promise<VersionedRegistry<ApiType>> {
128
- const registry = new TypeRegistry(blockHash);
129
- const metadata = await this._retrieveMetadata(version.apis, header.parentHash, registry);
130
- const runtimeChain = this._runtimeChain;
131
-
132
- if (!runtimeChain) {
133
- throw new Error('Invalid initializion order, runtimeChain is not available');
134
- }
135
-
136
- this._initRegistry(registry, runtimeChain, version, metadata);
137
-
138
- // add our new registry
139
- const result = { counter: 0, lastBlockHash: blockHash, metadata, registry, runtimeVersion: version };
140
-
141
- this.#registries.push(result);
142
-
143
- return result;
144
- }
145
-
146
- private _cacheBlockRegistryProgress (key: HexString, creator: () => Promise<VersionedRegistry<ApiType>>): Promise<VersionedRegistry<ApiType>> {
147
- // look for waiting resolves
148
- let waiting = this.#waitingRegistries[key];
149
-
150
- if (isUndefined(waiting)) {
151
- // nothing waiting, construct new
152
- waiting = this.#waitingRegistries[key] = new Promise<VersionedRegistry<ApiType>>((resolve, reject): void => {
153
- creator()
154
- .then((registry): void => {
155
- delete this.#waitingRegistries[key];
156
- resolve(registry);
157
- })
158
- .catch((error): void => {
159
- delete this.#waitingRegistries[key];
160
- reject(error);
161
- });
162
- });
163
- }
164
-
165
- return waiting;
166
- }
167
-
168
- private _getBlockRegistryViaVersion (blockHash: Uint8Array, version?: RuntimeVersionPartial): VersionedRegistry<ApiType> | null {
169
- if (version) {
170
- // check for pre-existing registries. We also check specName, e.g. it
171
- // could be changed like in Westmint with upgrade from shell -> westmint
172
- const existingViaVersion = this.#registries.find(({ runtimeVersion: { specName, specVersion } }) =>
173
- specName.eq(version.specName) &&
174
- specVersion.eq(version.specVersion)
175
- );
176
-
177
- if (existingViaVersion) {
178
- existingViaVersion.counter++;
179
- existingViaVersion.lastBlockHash = blockHash;
180
-
181
- return existingViaVersion;
182
- }
183
- }
184
-
185
- return null;
186
- }
187
-
188
- private async _getBlockRegistryViaHash (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> {
189
- // ensure we have everything required
190
- if (!this._genesisHash || !this._runtimeVersion) {
191
- throw new Error('Cannot retrieve data on an uninitialized chain');
192
- }
193
-
194
- // We have to assume that on the RPC layer the calls used here does not call back into
195
- // the registry swap, so getHeader & getRuntimeVersion should not be historic
196
- const header = this.registry.createType('HeaderPartial',
197
- this._genesisHash.eq(blockHash)
198
- ? { number: BN_ZERO, parentHash: this._genesisHash }
199
- : await firstValueFrom(this._rpcCore.chain.getHeader.raw(blockHash))
200
- );
201
-
202
- if (header.parentHash.isEmpty) {
203
- l.warn(`Unable to retrieve header ${blockHash.toString()} and parent ${header.parentHash.toString()} from supplied hash`);
204
- throw new Error('Unable to retrieve header and parent from supplied hash');
205
- }
206
-
207
- // get the runtime version, either on-chain or via an known upgrade history
208
- const [firstVersion, lastVersion] = getUpgradeVersion(this._genesisHash, header.number);
209
- const version = this.registry.createType('RuntimeVersionPartial',
210
- WITH_VERSION_SHORTCUT && (
211
- firstVersion && (
212
- lastVersion ||
213
- firstVersion.specVersion.eq(this._runtimeVersion.specVersion)
214
- )
215
- )
216
- ? { apis: firstVersion.apis, specName: this._runtimeVersion.specName, specVersion: firstVersion.specVersion }
217
- : await firstValueFrom(this._rpcCore.state.getRuntimeVersion.raw(header.parentHash))
218
- );
219
-
220
- return (
221
- // try to find via version
222
- this._getBlockRegistryViaVersion(blockHash, version) ||
223
- // return new or in-flight result
224
- await this._cacheBlockRegistryProgress(version.toHex(), () => this._createBlockRegistry(blockHash, header, version))
225
- );
226
- }
227
-
228
- /**
229
- * @description Sets up a registry based on the block hash defined
230
- */
231
- public async getBlockRegistry (blockHash: Uint8Array, knownVersion?: RuntimeVersion): Promise<VersionedRegistry<ApiType>> {
232
- return (
233
- // try to find via blockHash
234
- this.#registries.find(({ lastBlockHash }) =>
235
- lastBlockHash && u8aEq(lastBlockHash, blockHash)
236
- ) ||
237
- // try to find via version
238
- this._getBlockRegistryViaVersion(blockHash, knownVersion) ||
239
- // return new or in-flight result
240
- await this._cacheBlockRegistryProgress(u8aToHex(blockHash), () => this._getBlockRegistryViaHash(blockHash))
241
- );
242
- }
243
-
244
- protected async _loadMeta (): Promise<boolean> {
245
- // on re-connection to the same chain, we don't want to re-do everything from chain again
246
- if (this._isReady) {
247
- // on re-connection only re-subscribe to chain updates if we are not a clone
248
- if (!this._options.source) {
249
- this._subscribeUpdates();
250
- }
251
-
252
- return true;
253
- }
254
-
255
- this._unsubscribeUpdates();
256
-
257
- // only load from on-chain if we are not a clone (default path), alternatively
258
- // just use the values from the source instance provided
259
- [this._genesisHash, this._runtimeMetadata] = this._options.source?._isReady
260
- ? await this._metaFromSource(this._options.source)
261
- : await this._metaFromChain(this._options.metadata);
262
-
263
- return this._initFromMeta(this._runtimeMetadata);
264
- }
265
-
266
- // eslint-disable-next-line @typescript-eslint/require-await
267
- private async _metaFromSource (source: ApiBase<any>): Promise<[Hash, Metadata]> {
268
- this._extrinsicType = source.extrinsicVersion;
269
- this._runtimeChain = source.runtimeChain;
270
- this._runtimeVersion = source.runtimeVersion;
271
-
272
- // manually build a list of all available methods in this RPC, we are
273
- // going to filter on it to align the cloned RPC without making a call
274
- const sections = Object.keys(source.rpc);
275
- const rpcs: string[] = [];
276
-
277
- for (let s = 0, scount = sections.length; s < scount; s++) {
278
- const section = sections[s];
279
- const methods = Object.keys((source.rpc as unknown as Record<string, Record<string, unknown>>)[section]);
280
-
281
- for (let m = 0, mcount = methods.length; m < mcount; m++) {
282
- rpcs.push(`${section}_${methods[m]}`);
283
- }
284
- }
285
-
286
- this._filterRpc(rpcs, getSpecRpc(this.registry, source.runtimeChain, source.runtimeVersion.specName));
287
-
288
- return [source.genesisHash, source.runtimeMetadata];
289
- }
290
-
291
- // subscribe to metadata updates, inject the types on changes
292
- private _subscribeUpdates (): void {
293
- if (this.#updateSub || !this.hasSubscriptions) {
294
- return;
295
- }
296
-
297
- this.#updateSub = this._rpcCore.state.subscribeRuntimeVersion().pipe(
298
- switchMap((version: RuntimeVersion): Observable<boolean> =>
299
- // only retrieve the metadata when the on-chain version has been changed
300
- this._runtimeVersion?.specVersion.eq(version.specVersion)
301
- ? of(false)
302
- : this._rpcCore.state.getMetadata().pipe(
303
- map((metadata: Metadata): boolean => {
304
- l.log(`Runtime version updated to spec=${version.specVersion.toString()}, tx=${version.transactionVersion.toString()}`);
305
-
306
- this._runtimeMetadata = metadata;
307
- this._runtimeVersion = version;
308
- this._rx.runtimeVersion = version;
309
-
310
- // update the default registry version
311
- const thisRegistry = this._getDefaultRegistry();
312
- const runtimeChain = this._runtimeChain;
313
-
314
- if (!runtimeChain) {
315
- throw new Error('Invalid initializion order, runtimeChain is not available');
316
- }
317
-
318
- // setup the data as per the current versions
319
- thisRegistry.metadata = metadata;
320
- thisRegistry.runtimeVersion = version;
321
-
322
- this._initRegistry(this.registry, runtimeChain, version, metadata);
323
- this._injectMetadata(thisRegistry, true);
324
-
325
- return true;
326
- })
327
- )
328
- )
329
- ).subscribe();
330
- }
331
-
332
- private async _metaFromChain (optMetadata?: Record<string, HexString>): Promise<[Hash, Metadata]> {
333
- const [genesisHash, runtimeVersion, chain, chainProps, rpcMethods] = await Promise.all([
334
- firstValueFrom(this._rpcCore.chain.getBlockHash(0)),
335
- firstValueFrom(this._rpcCore.state.getRuntimeVersion()),
336
- firstValueFrom(this._rpcCore.system.chain()),
337
- firstValueFrom(this._rpcCore.system.properties()),
338
- firstValueFrom(this._rpcCore.rpc.methods())
339
- ]);
340
-
341
- // set our chain version & genesisHash as returned
342
- this._runtimeChain = chain;
343
- this._runtimeVersion = runtimeVersion;
344
- this._rx.runtimeVersion = runtimeVersion;
345
-
346
- // retrieve metadata, either from chain or as pass-in via options
347
- const metadataKey = `${genesisHash.toHex() || '0x'}-${runtimeVersion.specVersion.toString()}`;
348
- const metadata = optMetadata?.[metadataKey]
349
- ? new Metadata(this.registry, optMetadata[metadataKey])
350
- : await this._retrieveMetadata(runtimeVersion.apis);
351
-
352
- // initializes the registry & RPC
353
- this._initRegistry(this.registry, chain, runtimeVersion, metadata, chainProps);
354
- this._filterRpc(rpcMethods.methods.map(textToString), getSpecRpc(this.registry, chain, runtimeVersion.specName));
355
- this._subscribeUpdates();
356
-
357
- // setup the initial registry, when we have none
358
- if (!this.#registries.length) {
359
- this.#registries.push({ counter: 0, isDefault: true, metadata, registry: this.registry, runtimeVersion });
360
- }
361
-
362
- // get unique types & validate
363
- metadata.getUniqTypes(this._options.throwOnUnknown || false);
364
-
365
- return [genesisHash, metadata];
366
- }
367
-
368
- private _initFromMeta (metadata: Metadata): boolean {
369
- const runtimeVersion = this._runtimeVersion;
370
-
371
- if (!runtimeVersion) {
372
- throw new Error('Invalid initializion order, runtimeVersion is not available');
373
- }
374
-
375
- // ExtrinsicV5 is not fully supported yet, for that reason we default to version 4
376
- this._extrinsicType = metadata.asLatest.extrinsic.versions.at(0) || LATEST_EXTRINSIC_VERSION;
377
- this._rx.extrinsicType = this._extrinsicType;
378
- this._rx.genesisHash = this._genesisHash;
379
- this._rx.runtimeVersion = runtimeVersion;
380
-
381
- // inject metadata and adjust the types as detected
382
- this._injectMetadata(this._getDefaultRegistry(), true);
383
-
384
- // derive is last, since it uses the decorated rx
385
- this._rx.derive = this._decorateDeriveRx(this._rxDecorateMethod);
386
- this._derive = this._decorateDerive(this._decorateMethod);
387
-
388
- return true;
389
- }
390
-
391
- /**
392
- * @internal
393
- *
394
- * Tries to use runtime api calls to retrieve metadata. This ensures the api initializes with the latest metadata.
395
- * If the runtime call is not there it will use the rpc method.
396
- */
397
- private async _retrieveMetadata (apis: Vec<RuntimeVersionApi>, at?: BlockHash | string | Uint8Array, registry?: TypeRegistry): Promise<Metadata> {
398
- let metadataVersion: u32 | null = null;
399
- const metadataApi = apis.find(([a]) => a.eq(blake2AsHex('Metadata', 64)));
400
- const typeRegistry = registry || this.registry;
401
-
402
- // This chain does not have support for the metadataApi, or does not have the required version.
403
- if (!metadataApi || metadataApi[1].toNumber() < 2) {
404
- l.warn('MetadataApi not available, rpc::state::get_metadata will be used.');
405
-
406
- return at
407
- ? new Metadata(typeRegistry, await firstValueFrom(this._rpcCore.state.getMetadata.raw<HexString>(at)))
408
- : await firstValueFrom(this._rpcCore.state.getMetadata());
409
- }
410
-
411
- try {
412
- const metadataVersionsAsBytes = at
413
- ? await firstValueFrom(this._rpcCore.state.call.raw('Metadata_metadata_versions', '0x', at))
414
- : await firstValueFrom(this._rpcCore.state.call('Metadata_metadata_versions', '0x'));
415
- const versions = typeRegistry.createType('Vec<u32>', metadataVersionsAsBytes);
416
-
417
- // For unstable versions of the metadata the last value is set to u32 MAX in the runtime. This ensures only supported stable versions are used.
418
- metadataVersion = versions.filter((ver) => SUPPORTED_METADATA_VERSIONS.includes(ver.toNumber())).reduce((largest, current) => current.gt(largest) ? current : largest);
419
- } catch (e) {
420
- l.debug((e as Error).message);
421
- l.warn('error with state_call::Metadata_metadata_versions, rpc::state::get_metadata will be used');
422
- }
423
-
424
- // When the metadata version does not align with the latest supported versions we ensure not to call the metadata runtime call.
425
- // I noticed on some previous runtimes that have support for `Metadata_metadata_at_version` that very irregular versions were being returned.
426
- // This was evident with runtime 1000000 - it return a very large number. This ensures we always stick within what is supported.
427
- if (metadataVersion && !SUPPORTED_METADATA_VERSIONS.includes(metadataVersion.toNumber())) {
428
- metadataVersion = null;
429
- }
430
-
431
- if (metadataVersion) {
432
- try {
433
- const metadataBytes = at
434
- ? await firstValueFrom(this._rpcCore.state.call.raw<Bytes>('Metadata_metadata_at_version', u8aToHex(metadataVersion.toU8a()), at))
435
- : await firstValueFrom(this._rpcCore.state.call('Metadata_metadata_at_version', u8aToHex(metadataVersion.toU8a())));
436
- // When the metadata is called with `at` it is required to use `.raw`. Therefore since the length prefix is not present the
437
- // need to create a `Raw` type is necessary before creating the `OpaqueMetadata` type or else there will be a magic number
438
- // mismatch
439
- const rawMeta = at
440
- ? typeRegistry.createType('Raw', metadataBytes).toU8a()
441
- : metadataBytes;
442
- const opaqueMetadata = typeRegistry.createType('Option<OpaqueMetadata>', rawMeta).unwrapOr(null);
443
-
444
- if (opaqueMetadata) {
445
- return new Metadata(typeRegistry, opaqueMetadata.toHex());
446
- }
447
- } catch (e) {
448
- l.debug((e as Error).message);
449
- l.warn('error with state_call::Metadata_metadata_at_version, rpc::state::get_metadata will be used');
450
- }
451
- }
452
-
453
- return at
454
- ? new Metadata(typeRegistry, await firstValueFrom(this._rpcCore.state.getMetadata.raw<HexString>(at)))
455
- : await firstValueFrom(this._rpcCore.state.getMetadata());
456
- }
457
-
458
- private _subscribeHealth (): void {
459
- this._unsubscribeHealth();
460
-
461
- // Only enable the health keepalive on WS, not needed on HTTP
462
- this.#healthTimer = this.hasSubscriptions
463
- ? setInterval((): void => {
464
- firstValueFrom(this._rpcCore.system.health.raw()).catch(noop);
465
- }, KEEPALIVE_INTERVAL)
466
- : null;
467
- }
468
-
469
- private _unsubscribeHealth (): void {
470
- if (this.#healthTimer) {
471
- clearInterval(this.#healthTimer);
472
- this.#healthTimer = null;
473
- }
474
- }
475
-
476
- private _unsubscribeUpdates (): void {
477
- if (this.#updateSub) {
478
- this.#updateSub.unsubscribe();
479
- this.#updateSub = null;
480
- }
481
- }
482
-
483
- protected _unsubscribe (): void {
484
- this._unsubscribeHealth();
485
- this._unsubscribeUpdates();
486
- }
487
-
488
- async #onProviderConnect (): Promise<void> {
489
- this._isConnected.next(true);
490
- this.emit('connected');
491
-
492
- try {
493
- const cryptoReady = this._options.initWasm === false
494
- ? true
495
- : await cryptoWaitReady();
496
- const hasMeta = await this._loadMeta();
497
-
498
- this._subscribeHealth();
499
-
500
- if (hasMeta && !this._isReady && cryptoReady) {
501
- this._isReady = true;
502
-
503
- this.emit('ready', this);
504
- }
505
- } catch (_error) {
506
- const error = new Error(`FATAL: Unable to initialize the API: ${(_error as Error).message}`);
507
-
508
- l.error(error);
509
-
510
- this.emit('error', error);
511
- }
512
- }
513
-
514
- #onProviderDisconnect (): void {
515
- this._isConnected.next(false);
516
- this._unsubscribe();
517
- this.emit('disconnected');
518
- }
519
-
520
- #onProviderError (error: Error): void {
521
- this.emit('error', error);
522
- }
523
- }
@@ -1,12 +0,0 @@
1
-
2
- import type { CallFunction, Registry, RegistryError } from 'https://deno.land/x/pezkuwi/types/types/index.ts';
3
-
4
- import { u8aToU8a } from 'https://deno.land/x/pezkuwi/util/mod.ts';
5
-
6
- export function findCall (registry: Registry, callIndex: Uint8Array | string): CallFunction {
7
- return registry.findMetaCall(u8aToU8a(callIndex));
8
- }
9
-
10
- export function findError (registry: Registry, errorIndex: Uint8Array | string): RegistryError {
11
- return registry.findMetaError(u8aToU8a(errorIndex));
12
- }
@@ -1,83 +0,0 @@
1
-
2
- import type { SignerPayloadRawBase } from 'https://deno.land/x/pezkuwi/types/types/index.ts';
3
- import type { ApiOptions, ApiTypes, DecorateMethod, Signer } from '../types/index.ts';
4
-
5
- import { isString, objectSpread, u8aToHex, u8aToU8a } from 'https://deno.land/x/pezkuwi/util/mod.ts';
6
-
7
- import { Getters } from './Getters.ts';
8
-
9
- interface KeyringSigner {
10
- sign (message: Uint8Array): Uint8Array;
11
- }
12
-
13
- interface SignerRawOptions {
14
- signer?: Signer;
15
- }
16
-
17
- export abstract class ApiBase<ApiType extends ApiTypes> extends Getters<ApiType> {
18
- /**
19
- * @description Create an instance of the class
20
- *
21
- * @param options Options object to create API instance or a Provider instance
22
- *
23
- * @example
24
- * <BR>
25
- *
26
- * ```javascript
27
- * import Api from 'https://deno.land/x/pezkuwi/api/promise/index.ts';
28
- *
29
- * const api = new Api().isReady();
30
- *
31
- * api.rpc.subscribeNewHeads((header) => {
32
- * console.log(`new block #${header.number.toNumber()}`);
33
- * });
34
- * ```
35
- */
36
- constructor (options: ApiOptions = {}, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>) {
37
- super(options, type, decorateMethod);
38
- }
39
-
40
- /**
41
- * @description Connect from the underlying provider, halting all network traffic
42
- */
43
- public connect (): Promise<void> {
44
- return this._rpcCore.connect();
45
- }
46
-
47
- /**
48
- * @description Disconnect from the underlying provider, halting all network traffic
49
- */
50
- public disconnect (): Promise<void> {
51
- this._unsubscribe();
52
-
53
- return this._rpcCore.disconnect();
54
- }
55
-
56
- /**
57
- * @description Set an external signer which will be used to sign extrinsic when account passed in is not KeyringPair
58
- */
59
- public setSigner (signer: Signer | undefined): void {
60
- this._rx.signer = signer;
61
- }
62
-
63
- /**
64
- * @description Signs a raw signer payload, string or Uint8Array
65
- */
66
- public async sign (address: KeyringSigner | string, data: SignerPayloadRawBase, { signer }: SignerRawOptions = {}): Promise<string> {
67
- if (isString(address)) {
68
- const _signer = signer || this._rx.signer;
69
-
70
- if (!_signer?.signRaw) {
71
- throw new Error('No signer exists with a signRaw interface. You possibly need to pass through an explicit keypair for the origin so it can be used for signing.');
72
- }
73
-
74
- return (
75
- await _signer.signRaw(
76
- objectSpread({ type: 'bytes' }, data, { address })
77
- )
78
- ).signature;
79
- }
80
-
81
- return u8aToHex(address.sign(u8aToU8a(data.data)));
82
- }
83
- }
@@ -1,17 +0,0 @@
1
-
2
- import type { Metadata } from 'https://deno.land/x/pezkuwi/types/mod.ts';
3
- import type { RuntimeVersionPartial } from 'https://deno.land/x/pezkuwi/types/interfaces/index.ts';
4
- import type { DecoratedMeta } from 'https://deno.land/x/pezkuwi/types/metadata/decorate/types.ts';
5
- import type { Registry } from 'https://deno.land/x/pezkuwi/types/types/index.ts';
6
- import type { ApiDecoration, ApiTypes } from '../types/index.ts';
7
-
8
- export interface VersionedRegistry<ApiType extends ApiTypes> {
9
- counter: number;
10
- decoratedApi?: ApiDecoration<ApiType>;
11
- decoratedMeta?: DecoratedMeta;
12
- isDefault?: boolean;
13
- lastBlockHash?: Uint8Array | null;
14
- metadata: Metadata;
15
- registry: Registry;
16
- runtimeVersion: RuntimeVersionPartial;
17
- }
@@ -1,11 +0,0 @@
1
-
2
- import 'https://deno.land/x/pezkuwi/rpc-augment/mod.ts';
3
-
4
- export { Keyring } from 'https://deno.land/x/pezkuwi/keyring/mod.ts';
5
- export { HttpProvider, ScProvider, WsProvider } from 'https://deno.land/x/pezkuwi/rpc-provider/mod.ts';
6
-
7
- export { packageInfo } from './packageInfo.ts';
8
- export { SubmittableResult } from './submittable/index.ts';
9
-
10
- export * from './promise/index.ts';
11
- export * from './rx/index.ts';