riplle-lib 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (599) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +149 -0
  3. package/a4lpwwp5.cjs +1 -0
  4. package/build/ripple-latest-min.js +2 -0
  5. package/build/ripple-latest.js +5181 -0
  6. package/dist/npm/api.d.ts +272 -0
  7. package/dist/npm/api.d.ts.map +1 -0
  8. package/dist/npm/api.js +276 -0
  9. package/dist/npm/api.js.map +1 -0
  10. package/dist/npm/broadcast.d.ts +10 -0
  11. package/dist/npm/broadcast.d.ts.map +1 -0
  12. package/dist/npm/broadcast.js +67 -0
  13. package/dist/npm/broadcast.js.map +1 -0
  14. package/dist/npm/common/backoff.d.ts +14 -0
  15. package/dist/npm/common/backoff.d.ts.map +1 -0
  16. package/dist/npm/common/backoff.js +26 -0
  17. package/dist/npm/common/backoff.js.map +1 -0
  18. package/dist/npm/common/browser-hacks.d.ts +4 -0
  19. package/dist/npm/common/browser-hacks.d.ts.map +1 -0
  20. package/dist/npm/common/browser-hacks.js +21 -0
  21. package/dist/npm/common/browser-hacks.js.map +1 -0
  22. package/dist/npm/common/connection.d.ts +50 -0
  23. package/dist/npm/common/connection.d.ts.map +1 -0
  24. package/dist/npm/common/connection.js +467 -0
  25. package/dist/npm/common/connection.js.map +1 -0
  26. package/dist/npm/common/constants.d.ts +62 -0
  27. package/dist/npm/common/constants.d.ts.map +1 -0
  28. package/dist/npm/common/constants.js +54 -0
  29. package/dist/npm/common/constants.js.map +1 -0
  30. package/dist/npm/common/errors.d.ts +41 -0
  31. package/dist/npm/common/errors.d.ts.map +1 -0
  32. package/dist/npm/common/errors.js +101 -0
  33. package/dist/npm/common/errors.js.map +1 -0
  34. package/dist/npm/common/hashes/hash-prefix.d.ts +12 -0
  35. package/dist/npm/common/hashes/hash-prefix.d.ts.map +1 -0
  36. package/dist/npm/common/hashes/hash-prefix.js +15 -0
  37. package/dist/npm/common/hashes/hash-prefix.js.map +1 -0
  38. package/dist/npm/common/hashes/index.d.ts +13 -0
  39. package/dist/npm/common/hashes/index.d.ts.map +1 -0
  40. package/dist/npm/common/hashes/index.js +129 -0
  41. package/dist/npm/common/hashes/index.js.map +1 -0
  42. package/dist/npm/common/hashes/ledgerspaces.d.ts +21 -0
  43. package/dist/npm/common/hashes/ledgerspaces.d.ts.map +1 -0
  44. package/dist/npm/common/hashes/ledgerspaces.js +22 -0
  45. package/dist/npm/common/hashes/ledgerspaces.js.map +1 -0
  46. package/dist/npm/common/hashes/sha512Half.d.ts +3 -0
  47. package/dist/npm/common/hashes/sha512Half.d.ts.map +1 -0
  48. package/dist/npm/common/hashes/sha512Half.js +12 -0
  49. package/dist/npm/common/hashes/sha512Half.js.map +1 -0
  50. package/dist/npm/common/hashes/shamap.d.ts +38 -0
  51. package/dist/npm/common/hashes/shamap.d.ts.map +1 -0
  52. package/dist/npm/common/hashes/shamap.js +121 -0
  53. package/dist/npm/common/hashes/shamap.js.map +1 -0
  54. package/dist/npm/common/index.d.ts +10 -0
  55. package/dist/npm/common/index.d.ts.map +1 -0
  56. package/dist/npm/common/index.js +57 -0
  57. package/dist/npm/common/index.js.map +1 -0
  58. package/dist/npm/common/rangeset.d.ts +13 -0
  59. package/dist/npm/common/rangeset.d.ts.map +1 -0
  60. package/dist/npm/common/rangeset.js +72 -0
  61. package/dist/npm/common/rangeset.js.map +1 -0
  62. package/dist/npm/common/schema-validator.d.ts +5 -0
  63. package/dist/npm/common/schema-validator.d.ts.map +1 -0
  64. package/dist/npm/common/schema-validator.js +190 -0
  65. package/dist/npm/common/schema-validator.js.map +1 -0
  66. package/dist/npm/common/schemas/input/api-options.json +69 -0
  67. package/dist/npm/common/schemas/input/combine.json +19 -0
  68. package/dist/npm/common/schemas/input/compute-ledger-hash.json +13 -0
  69. package/dist/npm/common/schemas/input/generate-address.json +37 -0
  70. package/dist/npm/common/schemas/input/generate-x-address.json +37 -0
  71. package/dist/npm/common/schemas/input/get-account-info.json +24 -0
  72. package/dist/npm/common/schemas/input/get-account-objects.json +56 -0
  73. package/dist/npm/common/schemas/input/get-balance-sheet.json +30 -0
  74. package/dist/npm/common/schemas/input/get-balances.json +37 -0
  75. package/dist/npm/common/schemas/input/get-fee.json +13 -0
  76. package/dist/npm/common/schemas/input/get-ledger.json +35 -0
  77. package/dist/npm/common/schemas/input/get-orderbook.json +33 -0
  78. package/dist/npm/common/schemas/input/get-orders.json +29 -0
  79. package/dist/npm/common/schemas/input/get-paths.json +69 -0
  80. package/dist/npm/common/schemas/input/get-payment-channel.json +14 -0
  81. package/dist/npm/common/schemas/input/get-settings.json +24 -0
  82. package/dist/npm/common/schemas/input/get-transaction.json +28 -0
  83. package/dist/npm/common/schemas/input/get-transactions.json +71 -0
  84. package/dist/npm/common/schemas/input/get-trustlines.json +37 -0
  85. package/dist/npm/common/schemas/input/prepare-check-cancel.json +18 -0
  86. package/dist/npm/common/schemas/input/prepare-check-cash.json +18 -0
  87. package/dist/npm/common/schemas/input/prepare-check-create.json +18 -0
  88. package/dist/npm/common/schemas/input/prepare-escrow-cancellation.json +18 -0
  89. package/dist/npm/common/schemas/input/prepare-escrow-creation.json +18 -0
  90. package/dist/npm/common/schemas/input/prepare-escrow-execution.json +18 -0
  91. package/dist/npm/common/schemas/input/prepare-order-cancellation.json +18 -0
  92. package/dist/npm/common/schemas/input/prepare-order.json +18 -0
  93. package/dist/npm/common/schemas/input/prepare-payment-channel-claim.json +18 -0
  94. package/dist/npm/common/schemas/input/prepare-payment-channel-create.json +18 -0
  95. package/dist/npm/common/schemas/input/prepare-payment-channel-fund.json +18 -0
  96. package/dist/npm/common/schemas/input/prepare-payment.json +18 -0
  97. package/dist/npm/common/schemas/input/prepare-settings.json +18 -0
  98. package/dist/npm/common/schemas/input/prepare-ticket-create.json +18 -0
  99. package/dist/npm/common/schemas/input/prepare-trustline.json +18 -0
  100. package/dist/npm/common/schemas/input/sign-payment-channel-claim.json +21 -0
  101. package/dist/npm/common/schemas/input/sign.json +55 -0
  102. package/dist/npm/common/schemas/input/submit.json +17 -0
  103. package/dist/npm/common/schemas/input/verify-payment-channel-claim.json +25 -0
  104. package/dist/npm/common/schemas/objects/address.json +12 -0
  105. package/dist/npm/common/schemas/objects/adjustment.json +12 -0
  106. package/dist/npm/common/schemas/objects/amount.json +10 -0
  107. package/dist/npm/common/schemas/objects/amountbase.json +44 -0
  108. package/dist/npm/common/schemas/objects/balance.json +45 -0
  109. package/dist/npm/common/schemas/objects/blob.json +8 -0
  110. package/dist/npm/common/schemas/objects/classic-address.json +9 -0
  111. package/dist/npm/common/schemas/objects/currency.json +8 -0
  112. package/dist/npm/common/schemas/objects/destination-address-tag.json +15 -0
  113. package/dist/npm/common/schemas/objects/destination-adjustment.json +9 -0
  114. package/dist/npm/common/schemas/objects/destination-exact-adjustment.json +18 -0
  115. package/dist/npm/common/schemas/objects/hash128.json +7 -0
  116. package/dist/npm/common/schemas/objects/hash256.json +7 -0
  117. package/dist/npm/common/schemas/objects/instructions.json +59 -0
  118. package/dist/npm/common/schemas/objects/issue.json +9 -0
  119. package/dist/npm/common/schemas/objects/lax-amount.json +14 -0
  120. package/dist/npm/common/schemas/objects/lax-lax-amount.json +14 -0
  121. package/dist/npm/common/schemas/objects/ledger-version.json +15 -0
  122. package/dist/npm/common/schemas/objects/max-adjustment.json +18 -0
  123. package/dist/npm/common/schemas/objects/memo.json +25 -0
  124. package/dist/npm/common/schemas/objects/memos.json +10 -0
  125. package/dist/npm/common/schemas/objects/min-adjustment.json +18 -0
  126. package/dist/npm/common/schemas/objects/orderbook.json +11 -0
  127. package/dist/npm/common/schemas/objects/private-key.json +7 -0
  128. package/dist/npm/common/schemas/objects/public-key.json +7 -0
  129. package/dist/npm/common/schemas/objects/quality.json +8 -0
  130. package/dist/npm/common/schemas/objects/sequence.json +8 -0
  131. package/dist/npm/common/schemas/objects/settings-plus-memos.json +120 -0
  132. package/dist/npm/common/schemas/objects/signature.json +7 -0
  133. package/dist/npm/common/schemas/objects/signed-value.json +8 -0
  134. package/dist/npm/common/schemas/objects/source-adjustment.json +9 -0
  135. package/dist/npm/common/schemas/objects/source-exact-adjustment.json +18 -0
  136. package/dist/npm/common/schemas/objects/tag.json +7 -0
  137. package/dist/npm/common/schemas/objects/ticket-sequence.json +8 -0
  138. package/dist/npm/common/schemas/objects/transaction-hash.json +8 -0
  139. package/dist/npm/common/schemas/objects/transaction-type.json +25 -0
  140. package/dist/npm/common/schemas/objects/tx-json.json +12 -0
  141. package/dist/npm/common/schemas/objects/uint32.json +8 -0
  142. package/dist/npm/common/schemas/objects/value.json +8 -0
  143. package/dist/npm/common/schemas/objects/x-address.json +9 -0
  144. package/dist/npm/common/schemas/output/generate-address.json +26 -0
  145. package/dist/npm/common/schemas/output/generate-x-address.json +18 -0
  146. package/dist/npm/common/schemas/output/get-account-info.json +40 -0
  147. package/dist/npm/common/schemas/output/get-account-objects.json +48 -0
  148. package/dist/npm/common/schemas/output/get-balance-sheet.json +33 -0
  149. package/dist/npm/common/schemas/output/get-balances.json +6 -0
  150. package/dist/npm/common/schemas/output/get-ledger.json +90 -0
  151. package/dist/npm/common/schemas/output/get-orderbook.json +17 -0
  152. package/dist/npm/common/schemas/output/get-orders.json +36 -0
  153. package/dist/npm/common/schemas/output/get-paths.json +24 -0
  154. package/dist/npm/common/schemas/output/get-payment-channel.json +67 -0
  155. package/dist/npm/common/schemas/output/get-server-info.json +117 -0
  156. package/dist/npm/common/schemas/output/get-settings.json +8 -0
  157. package/dist/npm/common/schemas/output/get-transaction.json +237 -0
  158. package/dist/npm/common/schemas/output/get-transactions.json +8 -0
  159. package/dist/npm/common/schemas/output/get-trustlines.json +49 -0
  160. package/dist/npm/common/schemas/output/ledger-event.json +46 -0
  161. package/dist/npm/common/schemas/output/order-change.json +40 -0
  162. package/dist/npm/common/schemas/output/orderbook-orders.json +58 -0
  163. package/dist/npm/common/schemas/output/outcome.json +57 -0
  164. package/dist/npm/common/schemas/output/prepare.json +47 -0
  165. package/dist/npm/common/schemas/output/sign-payment-channel-claim.json +7 -0
  166. package/dist/npm/common/schemas/output/sign.json +18 -0
  167. package/dist/npm/common/schemas/output/submit.json +37 -0
  168. package/dist/npm/common/schemas/output/verify-payment-channel-claim.json +6 -0
  169. package/dist/npm/common/schemas/specifications/account-delete.json +30 -0
  170. package/dist/npm/common/schemas/specifications/check-cancel.json +15 -0
  171. package/dist/npm/common/schemas/specifications/check-cash.json +27 -0
  172. package/dist/npm/common/schemas/specifications/check-create.json +32 -0
  173. package/dist/npm/common/schemas/specifications/deposit-preauth.json +22 -0
  174. package/dist/npm/common/schemas/specifications/escrow-cancellation.json +19 -0
  175. package/dist/npm/common/schemas/specifications/escrow-creation.json +42 -0
  176. package/dist/npm/common/schemas/specifications/escrow-execution.json +29 -0
  177. package/dist/npm/common/schemas/specifications/get-payment.json +39 -0
  178. package/dist/npm/common/schemas/specifications/order-cancellation.json +15 -0
  179. package/dist/npm/common/schemas/specifications/order.json +49 -0
  180. package/dist/npm/common/schemas/specifications/payment-channel-claim.json +39 -0
  181. package/dist/npm/common/schemas/specifications/payment-channel-create.json +40 -0
  182. package/dist/npm/common/schemas/specifications/payment-channel-fund.json +24 -0
  183. package/dist/npm/common/schemas/specifications/payment.json +39 -0
  184. package/dist/npm/common/schemas/specifications/settings.json +20 -0
  185. package/dist/npm/common/schemas/specifications/trustline.json +43 -0
  186. package/dist/npm/common/serverinfo.d.ts +34 -0
  187. package/dist/npm/common/serverinfo.d.ts.map +1 -0
  188. package/dist/npm/common/serverinfo.js +63 -0
  189. package/dist/npm/common/serverinfo.js.map +1 -0
  190. package/dist/npm/common/txflags.d.ts +51 -0
  191. package/dist/npm/common/txflags.d.ts.map +1 -0
  192. package/dist/npm/common/txflags.js +55 -0
  193. package/dist/npm/common/txflags.js.map +1 -0
  194. package/dist/npm/common/types/commands/account_info.d.ts +18 -0
  195. package/dist/npm/common/types/commands/account_info.d.ts.map +1 -0
  196. package/dist/npm/common/types/commands/account_info.js +3 -0
  197. package/dist/npm/common/types/commands/account_info.js.map +1 -0
  198. package/dist/npm/common/types/commands/account_lines.d.ts +18 -0
  199. package/dist/npm/common/types/commands/account_lines.d.ts.map +1 -0
  200. package/dist/npm/common/types/commands/account_lines.js +3 -0
  201. package/dist/npm/common/types/commands/account_lines.js.map +1 -0
  202. package/dist/npm/common/types/commands/account_objects.d.ts +27 -0
  203. package/dist/npm/common/types/commands/account_objects.d.ts.map +1 -0
  204. package/dist/npm/common/types/commands/account_objects.js +3 -0
  205. package/dist/npm/common/types/commands/account_objects.js.map +1 -0
  206. package/dist/npm/common/types/commands/account_offers.d.ts +25 -0
  207. package/dist/npm/common/types/commands/account_offers.d.ts.map +1 -0
  208. package/dist/npm/common/types/commands/account_offers.js +3 -0
  209. package/dist/npm/common/types/commands/account_offers.js.map +1 -0
  210. package/dist/npm/common/types/commands/book_offers.d.ts +24 -0
  211. package/dist/npm/common/types/commands/book_offers.d.ts.map +1 -0
  212. package/dist/npm/common/types/commands/book_offers.js +3 -0
  213. package/dist/npm/common/types/commands/book_offers.js.map +1 -0
  214. package/dist/npm/common/types/commands/gateway_balances.d.ts +24 -0
  215. package/dist/npm/common/types/commands/gateway_balances.d.ts.map +1 -0
  216. package/dist/npm/common/types/commands/gateway_balances.js +3 -0
  217. package/dist/npm/common/types/commands/gateway_balances.js.map +1 -0
  218. package/dist/npm/common/types/commands/index.d.ts +11 -0
  219. package/dist/npm/common/types/commands/index.d.ts.map +1 -0
  220. package/dist/npm/common/types/commands/index.js +23 -0
  221. package/dist/npm/common/types/commands/index.js.map +1 -0
  222. package/dist/npm/common/types/commands/ledger.d.ts +19 -0
  223. package/dist/npm/common/types/commands/ledger.d.ts.map +1 -0
  224. package/dist/npm/common/types/commands/ledger.js +3 -0
  225. package/dist/npm/common/types/commands/ledger.js.map +1 -0
  226. package/dist/npm/common/types/commands/ledger_data.d.ts +11 -0
  227. package/dist/npm/common/types/commands/ledger_data.d.ts.map +1 -0
  228. package/dist/npm/common/types/commands/ledger_data.js +3 -0
  229. package/dist/npm/common/types/commands/ledger_data.js.map +1 -0
  230. package/dist/npm/common/types/commands/ledger_entry.d.ts +30 -0
  231. package/dist/npm/common/types/commands/ledger_entry.d.ts.map +1 -0
  232. package/dist/npm/common/types/commands/ledger_entry.js +3 -0
  233. package/dist/npm/common/types/commands/ledger_entry.js.map +1 -0
  234. package/dist/npm/common/types/commands/server_info.d.ts +50 -0
  235. package/dist/npm/common/types/commands/server_info.d.ts.map +1 -0
  236. package/dist/npm/common/types/commands/server_info.js +3 -0
  237. package/dist/npm/common/types/commands/server_info.js.map +1 -0
  238. package/dist/npm/common/types/objects/adjustments.d.ts +17 -0
  239. package/dist/npm/common/types/objects/adjustments.d.ts.map +1 -0
  240. package/dist/npm/common/types/objects/adjustments.js +3 -0
  241. package/dist/npm/common/types/objects/adjustments.js.map +1 -0
  242. package/dist/npm/common/types/objects/amounts.d.ts +14 -0
  243. package/dist/npm/common/types/objects/amounts.d.ts.map +1 -0
  244. package/dist/npm/common/types/objects/amounts.js +3 -0
  245. package/dist/npm/common/types/objects/amounts.js.map +1 -0
  246. package/dist/npm/common/types/objects/index.d.ts +13 -0
  247. package/dist/npm/common/types/objects/index.d.ts.map +1 -0
  248. package/dist/npm/common/types/objects/index.js +25 -0
  249. package/dist/npm/common/types/objects/index.js.map +1 -0
  250. package/dist/npm/common/types/objects/ledger.d.ts +30 -0
  251. package/dist/npm/common/types/objects/ledger.d.ts.map +1 -0
  252. package/dist/npm/common/types/objects/ledger.js +3 -0
  253. package/dist/npm/common/types/objects/ledger.js.map +1 -0
  254. package/dist/npm/common/types/objects/ledger_data.d.ts +11 -0
  255. package/dist/npm/common/types/objects/ledger_data.d.ts.map +1 -0
  256. package/dist/npm/common/types/objects/ledger_data.js +3 -0
  257. package/dist/npm/common/types/objects/ledger_data.js.map +1 -0
  258. package/dist/npm/common/types/objects/ledger_entries.d.ts +159 -0
  259. package/dist/npm/common/types/objects/ledger_entries.d.ts.map +1 -0
  260. package/dist/npm/common/types/objects/ledger_entries.js +3 -0
  261. package/dist/npm/common/types/objects/ledger_entries.js.map +1 -0
  262. package/dist/npm/common/types/objects/memos.d.ts +6 -0
  263. package/dist/npm/common/types/objects/memos.d.ts.map +1 -0
  264. package/dist/npm/common/types/objects/memos.js +3 -0
  265. package/dist/npm/common/types/objects/memos.js.map +1 -0
  266. package/dist/npm/common/types/objects/orders.d.ts +14 -0
  267. package/dist/npm/common/types/objects/orders.d.ts.map +1 -0
  268. package/dist/npm/common/types/objects/orders.js +3 -0
  269. package/dist/npm/common/types/objects/orders.js.map +1 -0
  270. package/dist/npm/common/types/objects/queue_data.d.ts +16 -0
  271. package/dist/npm/common/types/objects/queue_data.d.ts.map +1 -0
  272. package/dist/npm/common/types/objects/queue_data.js +3 -0
  273. package/dist/npm/common/types/objects/queue_data.js.map +1 -0
  274. package/dist/npm/common/types/objects/settings.d.ts +31 -0
  275. package/dist/npm/common/types/objects/settings.d.ts.map +1 -0
  276. package/dist/npm/common/types/objects/settings.js +3 -0
  277. package/dist/npm/common/types/objects/settings.js.map +1 -0
  278. package/dist/npm/common/types/objects/signers.d.ts +7 -0
  279. package/dist/npm/common/types/objects/signers.d.ts.map +1 -0
  280. package/dist/npm/common/types/objects/signers.js +3 -0
  281. package/dist/npm/common/types/objects/signers.js.map +1 -0
  282. package/dist/npm/common/types/objects/transactions.d.ts +22 -0
  283. package/dist/npm/common/types/objects/transactions.d.ts.map +1 -0
  284. package/dist/npm/common/types/objects/transactions.js +3 -0
  285. package/dist/npm/common/types/objects/transactions.js.map +1 -0
  286. package/dist/npm/common/types/objects/trustlines.d.ts +40 -0
  287. package/dist/npm/common/types/objects/trustlines.d.ts.map +1 -0
  288. package/dist/npm/common/types/objects/trustlines.js +3 -0
  289. package/dist/npm/common/types/objects/trustlines.js.map +1 -0
  290. package/dist/npm/common/utils.d.ts +12 -0
  291. package/dist/npm/common/utils.d.ts.map +1 -0
  292. package/dist/npm/common/utils.js +157 -0
  293. package/dist/npm/common/utils.js.map +1 -0
  294. package/dist/npm/common/validate.d.ts +38 -0
  295. package/dist/npm/common/validate.d.ts.map +1 -0
  296. package/dist/npm/common/validate.js +79 -0
  297. package/dist/npm/common/validate.js.map +1 -0
  298. package/dist/npm/common/wswrapper.d.ts +15 -0
  299. package/dist/npm/common/wswrapper.d.ts.map +1 -0
  300. package/dist/npm/common/wswrapper.js +38 -0
  301. package/dist/npm/common/wswrapper.js.map +1 -0
  302. package/dist/npm/index.d.ts +6 -0
  303. package/dist/npm/index.d.ts.map +1 -0
  304. package/dist/npm/index.js +19 -0
  305. package/dist/npm/index.js.map +1 -0
  306. package/dist/npm/ledger/accountinfo.d.ts +14 -0
  307. package/dist/npm/ledger/accountinfo.d.ts.map +1 -0
  308. package/dist/npm/ledger/accountinfo.js +36 -0
  309. package/dist/npm/ledger/accountinfo.js.map +1 -0
  310. package/dist/npm/ledger/accountobjects.d.ts +4 -0
  311. package/dist/npm/ledger/accountobjects.d.ts.map +1 -0
  312. package/dist/npm/ledger/accountobjects.js +27 -0
  313. package/dist/npm/ledger/accountobjects.js.map +1 -0
  314. package/dist/npm/ledger/balance-sheet.d.ts +17 -0
  315. package/dist/npm/ledger/balance-sheet.d.ts.map +1 -0
  316. package/dist/npm/ledger/balance-sheet.js +52 -0
  317. package/dist/npm/ledger/balance-sheet.js.map +1 -0
  318. package/dist/npm/ledger/balances.d.ts +11 -0
  319. package/dist/npm/ledger/balances.d.ts.map +1 -0
  320. package/dist/npm/ledger/balances.js +61 -0
  321. package/dist/npm/ledger/balances.js.map +1 -0
  322. package/dist/npm/ledger/ledger.d.ts +12 -0
  323. package/dist/npm/ledger/ledger.d.ts.map +1 -0
  324. package/dist/npm/ledger/ledger.js +28 -0
  325. package/dist/npm/ledger/ledger.js.map +1 -0
  326. package/dist/npm/ledger/orderbook.d.ts +22 -0
  327. package/dist/npm/ledger/orderbook.d.ts.map +1 -0
  328. package/dist/npm/ledger/orderbook.js +100 -0
  329. package/dist/npm/ledger/orderbook.js.map +1 -0
  330. package/dist/npm/ledger/orders.d.ts +8 -0
  331. package/dist/npm/ledger/orders.d.ts.map +1 -0
  332. package/dist/npm/ledger/orders.js +56 -0
  333. package/dist/npm/ledger/orders.js.map +1 -0
  334. package/dist/npm/ledger/parse/account-delete.d.ts +8 -0
  335. package/dist/npm/ledger/parse/account-delete.d.ts.map +1 -0
  336. package/dist/npm/ledger/parse/account-delete.js +36 -0
  337. package/dist/npm/ledger/parse/account-delete.js.map +1 -0
  338. package/dist/npm/ledger/parse/account-order.d.ts +11 -0
  339. package/dist/npm/ledger/parse/account-order.d.ts.map +1 -0
  340. package/dist/npm/ledger/parse/account-order.js +40 -0
  341. package/dist/npm/ledger/parse/account-order.js.map +1 -0
  342. package/dist/npm/ledger/parse/account-trustline.d.ts +4 -0
  343. package/dist/npm/ledger/parse/account-trustline.d.ts.map +1 -0
  344. package/dist/npm/ledger/parse/account-trustline.js +28 -0
  345. package/dist/npm/ledger/parse/account-trustline.js.map +1 -0
  346. package/dist/npm/ledger/parse/amendment.d.ts +5 -0
  347. package/dist/npm/ledger/parse/amendment.d.ts.map +1 -0
  348. package/dist/npm/ledger/parse/amendment.js +9 -0
  349. package/dist/npm/ledger/parse/amendment.js.map +1 -0
  350. package/dist/npm/ledger/parse/amount.d.ts +4 -0
  351. package/dist/npm/ledger/parse/amount.d.ts.map +1 -0
  352. package/dist/npm/ledger/parse/amount.js +37 -0
  353. package/dist/npm/ledger/parse/amount.js.map +1 -0
  354. package/dist/npm/ledger/parse/cancellation.d.ts +3 -0
  355. package/dist/npm/ledger/parse/cancellation.d.ts.map +1 -0
  356. package/dist/npm/ledger/parse/cancellation.js +32 -0
  357. package/dist/npm/ledger/parse/cancellation.js.map +1 -0
  358. package/dist/npm/ledger/parse/check-cancel.d.ts +6 -0
  359. package/dist/npm/ledger/parse/check-cancel.d.ts.map +1 -0
  360. package/dist/npm/ledger/parse/check-cancel.js +33 -0
  361. package/dist/npm/ledger/parse/check-cancel.js.map +1 -0
  362. package/dist/npm/ledger/parse/check-cash.d.ts +9 -0
  363. package/dist/npm/ledger/parse/check-cash.d.ts.map +1 -0
  364. package/dist/npm/ledger/parse/check-cash.js +39 -0
  365. package/dist/npm/ledger/parse/check-cash.js.map +1 -0
  366. package/dist/npm/ledger/parse/check-create.d.ts +11 -0
  367. package/dist/npm/ledger/parse/check-create.d.ts.map +1 -0
  368. package/dist/npm/ledger/parse/check-create.js +42 -0
  369. package/dist/npm/ledger/parse/check-create.js.map +1 -0
  370. package/dist/npm/ledger/parse/deposit-preauth.d.ts +7 -0
  371. package/dist/npm/ledger/parse/deposit-preauth.d.ts.map +1 -0
  372. package/dist/npm/ledger/parse/deposit-preauth.js +34 -0
  373. package/dist/npm/ledger/parse/deposit-preauth.js.map +1 -0
  374. package/dist/npm/ledger/parse/escrow-cancellation.d.ts +3 -0
  375. package/dist/npm/ledger/parse/escrow-cancellation.d.ts.map +1 -0
  376. package/dist/npm/ledger/parse/escrow-cancellation.js +34 -0
  377. package/dist/npm/ledger/parse/escrow-cancellation.js.map +1 -0
  378. package/dist/npm/ledger/parse/escrow-creation.d.ts +3 -0
  379. package/dist/npm/ledger/parse/escrow-creation.d.ts.map +1 -0
  380. package/dist/npm/ledger/parse/escrow-creation.js +43 -0
  381. package/dist/npm/ledger/parse/escrow-creation.js.map +1 -0
  382. package/dist/npm/ledger/parse/escrow-execution.d.ts +3 -0
  383. package/dist/npm/ledger/parse/escrow-execution.d.ts.map +1 -0
  384. package/dist/npm/ledger/parse/escrow-execution.js +36 -0
  385. package/dist/npm/ledger/parse/escrow-execution.js.map +1 -0
  386. package/dist/npm/ledger/parse/fee-update.d.ts +9 -0
  387. package/dist/npm/ledger/parse/fee-update.d.ts.map +1 -0
  388. package/dist/npm/ledger/parse/fee-update.js +20 -0
  389. package/dist/npm/ledger/parse/fee-update.js.map +1 -0
  390. package/dist/npm/ledger/parse/fields.d.ts +3 -0
  391. package/dist/npm/ledger/parse/fields.d.ts.map +1 -0
  392. package/dist/npm/ledger/parse/fields.js +47 -0
  393. package/dist/npm/ledger/parse/fields.js.map +1 -0
  394. package/dist/npm/ledger/parse/flags.d.ts +16 -0
  395. package/dist/npm/ledger/parse/flags.d.ts.map +1 -0
  396. package/dist/npm/ledger/parse/flags.js +20 -0
  397. package/dist/npm/ledger/parse/flags.js.map +1 -0
  398. package/dist/npm/ledger/parse/ledger.d.ts +19 -0
  399. package/dist/npm/ledger/parse/ledger.d.ts.map +1 -0
  400. package/dist/npm/ledger/parse/ledger.js +76 -0
  401. package/dist/npm/ledger/parse/ledger.js.map +1 -0
  402. package/dist/npm/ledger/parse/order.d.ts +4 -0
  403. package/dist/npm/ledger/parse/order.d.ts.map +1 -0
  404. package/dist/npm/ledger/parse/order.js +50 -0
  405. package/dist/npm/ledger/parse/order.js.map +1 -0
  406. package/dist/npm/ledger/parse/orderbook-order.d.ts +17 -0
  407. package/dist/npm/ledger/parse/orderbook-order.d.ts.map +1 -0
  408. package/dist/npm/ledger/parse/orderbook-order.js +63 -0
  409. package/dist/npm/ledger/parse/orderbook-order.js.map +1 -0
  410. package/dist/npm/ledger/parse/pathfind.d.ts +4 -0
  411. package/dist/npm/ledger/parse/pathfind.d.ts.map +1 -0
  412. package/dist/npm/ledger/parse/pathfind.js +63 -0
  413. package/dist/npm/ledger/parse/pathfind.js.map +1 -0
  414. package/dist/npm/ledger/parse/payment-channel-claim.d.ts +3 -0
  415. package/dist/npm/ledger/parse/payment-channel-claim.d.ts.map +1 -0
  416. package/dist/npm/ledger/parse/payment-channel-claim.js +44 -0
  417. package/dist/npm/ledger/parse/payment-channel-claim.js.map +1 -0
  418. package/dist/npm/ledger/parse/payment-channel-create.d.ts +3 -0
  419. package/dist/npm/ledger/parse/payment-channel-create.d.ts.map +1 -0
  420. package/dist/npm/ledger/parse/payment-channel-create.js +43 -0
  421. package/dist/npm/ledger/parse/payment-channel-create.js.map +1 -0
  422. package/dist/npm/ledger/parse/payment-channel-fund.d.ts +3 -0
  423. package/dist/npm/ledger/parse/payment-channel-fund.d.ts.map +1 -0
  424. package/dist/npm/ledger/parse/payment-channel-fund.js +39 -0
  425. package/dist/npm/ledger/parse/payment-channel-fund.js.map +1 -0
  426. package/dist/npm/ledger/parse/payment-channel.d.ts +17 -0
  427. package/dist/npm/ledger/parse/payment-channel.d.ts.map +1 -0
  428. package/dist/npm/ledger/parse/payment-channel.js +24 -0
  429. package/dist/npm/ledger/parse/payment-channel.js.map +1 -0
  430. package/dist/npm/ledger/parse/payment.d.ts +3 -0
  431. package/dist/npm/ledger/parse/payment.d.ts.map +1 -0
  432. package/dist/npm/ledger/parse/payment.js +64 -0
  433. package/dist/npm/ledger/parse/payment.js.map +1 -0
  434. package/dist/npm/ledger/parse/settings.d.ts +3 -0
  435. package/dist/npm/ledger/parse/settings.d.ts.map +1 -0
  436. package/dist/npm/ledger/parse/settings.js +75 -0
  437. package/dist/npm/ledger/parse/settings.js.map +1 -0
  438. package/dist/npm/ledger/parse/ticket-create.d.ts +3 -0
  439. package/dist/npm/ledger/parse/ticket-create.d.ts.map +1 -0
  440. package/dist/npm/ledger/parse/ticket-create.js +33 -0
  441. package/dist/npm/ledger/parse/ticket-create.js.map +1 -0
  442. package/dist/npm/ledger/parse/transaction.d.ts +3 -0
  443. package/dist/npm/ledger/parse/transaction.d.ts.map +1 -0
  444. package/dist/npm/ledger/parse/transaction.js +98 -0
  445. package/dist/npm/ledger/parse/transaction.js.map +1 -0
  446. package/dist/npm/ledger/parse/trustline.d.ts +3 -0
  447. package/dist/npm/ledger/parse/trustline.d.ts.map +1 -0
  448. package/dist/npm/ledger/parse/trustline.js +50 -0
  449. package/dist/npm/ledger/parse/trustline.js.map +1 -0
  450. package/dist/npm/ledger/parse/utils.d.ts +10 -0
  451. package/dist/npm/ledger/parse/utils.d.ts.map +1 -0
  452. package/dist/npm/ledger/parse/utils.js +136 -0
  453. package/dist/npm/ledger/parse/utils.js.map +1 -0
  454. package/dist/npm/ledger/pathfind-types.d.ts +60 -0
  455. package/dist/npm/ledger/pathfind-types.d.ts.map +1 -0
  456. package/dist/npm/ledger/pathfind-types.js +3 -0
  457. package/dist/npm/ledger/pathfind-types.js.map +1 -0
  458. package/dist/npm/ledger/pathfind.d.ts +5 -0
  459. package/dist/npm/ledger/pathfind.d.ts.map +1 -0
  460. package/dist/npm/ledger/pathfind.js +141 -0
  461. package/dist/npm/ledger/pathfind.js.map +1 -0
  462. package/dist/npm/ledger/payment-channel.d.ts +5 -0
  463. package/dist/npm/ledger/payment-channel.d.ts.map +1 -0
  464. package/dist/npm/ledger/payment-channel.js +34 -0
  465. package/dist/npm/ledger/payment-channel.js.map +1 -0
  466. package/dist/npm/ledger/settings.d.ts +11 -0
  467. package/dist/npm/ledger/settings.d.ts.map +1 -0
  468. package/dist/npm/ledger/settings.js +53 -0
  469. package/dist/npm/ledger/settings.js.map +1 -0
  470. package/dist/npm/ledger/transaction.d.ts +10 -0
  471. package/dist/npm/ledger/transaction.d.ts.map +1 -0
  472. package/dist/npm/ledger/transaction.js +126 -0
  473. package/dist/npm/ledger/transaction.js.map +1 -0
  474. package/dist/npm/ledger/transactions.d.ts +20 -0
  475. package/dist/npm/ledger/transactions.d.ts.map +1 -0
  476. package/dist/npm/ledger/transactions.js +156 -0
  477. package/dist/npm/ledger/transactions.js.map +1 -0
  478. package/dist/npm/ledger/trustlines.d.ts +11 -0
  479. package/dist/npm/ledger/trustlines.d.ts.map +1 -0
  480. package/dist/npm/ledger/trustlines.js +58 -0
  481. package/dist/npm/ledger/trustlines.js.map +1 -0
  482. package/dist/npm/ledger/utils.d.ts +33 -0
  483. package/dist/npm/ledger/utils.d.ts.map +1 -0
  484. package/dist/npm/ledger/utils.js +107 -0
  485. package/dist/npm/ledger/utils.js.map +1 -0
  486. package/dist/npm/offline/derive.d.ts +8 -0
  487. package/dist/npm/offline/derive.d.ts.map +1 -0
  488. package/dist/npm/offline/derive.js +13 -0
  489. package/dist/npm/offline/derive.js.map +1 -0
  490. package/dist/npm/offline/generate-address.d.ts +15 -0
  491. package/dist/npm/offline/generate-address.d.ts.map +1 -0
  492. package/dist/npm/offline/generate-address.js +37 -0
  493. package/dist/npm/offline/generate-address.js.map +1 -0
  494. package/dist/npm/offline/ledgerhash.d.ts +6 -0
  495. package/dist/npm/offline/ledgerhash.d.ts.map +1 -0
  496. package/dist/npm/offline/ledgerhash.js +104 -0
  497. package/dist/npm/offline/ledgerhash.js.map +1 -0
  498. package/dist/npm/offline/sign-payment-channel-claim.d.ts +3 -0
  499. package/dist/npm/offline/sign-payment-channel-claim.d.ts.map +1 -0
  500. package/dist/npm/offline/sign-payment-channel-claim.js +38 -0
  501. package/dist/npm/offline/sign-payment-channel-claim.js.map +1 -0
  502. package/dist/npm/offline/utils.d.ts +10 -0
  503. package/dist/npm/offline/utils.d.ts.map +1 -0
  504. package/dist/npm/offline/utils.js +43 -0
  505. package/dist/npm/offline/utils.js.map +1 -0
  506. package/dist/npm/offline/verify-payment-channel-claim.d.ts +3 -0
  507. package/dist/npm/offline/verify-payment-channel-claim.d.ts.map +1 -0
  508. package/dist/npm/offline/verify-payment-channel-claim.js +18 -0
  509. package/dist/npm/offline/verify-payment-channel-claim.js.map +1 -0
  510. package/dist/npm/server/server.d.ts +8 -0
  511. package/dist/npm/server/server.d.ts.map +1 -0
  512. package/dist/npm/server/server.js +66 -0
  513. package/dist/npm/server/server.js.map +1 -0
  514. package/dist/npm/transaction/check-cancel.d.ts +8 -0
  515. package/dist/npm/transaction/check-cancel.d.ts.map +1 -0
  516. package/dist/npm/transaction/check-cancel.js +24 -0
  517. package/dist/npm/transaction/check-cancel.js.map +1 -0
  518. package/dist/npm/transaction/check-cash.d.ts +11 -0
  519. package/dist/npm/transaction/check-cash.d.ts.map +1 -0
  520. package/dist/npm/transaction/check-cash.js +55 -0
  521. package/dist/npm/transaction/check-cash.js.map +1 -0
  522. package/dist/npm/transaction/check-create.d.ts +13 -0
  523. package/dist/npm/transaction/check-create.d.ts.map +1 -0
  524. package/dist/npm/transaction/check-create.js +54 -0
  525. package/dist/npm/transaction/check-create.js.map +1 -0
  526. package/dist/npm/transaction/combine.d.ts +3 -0
  527. package/dist/npm/transaction/combine.d.ts.map +1 -0
  528. package/dist/npm/transaction/combine.js +62 -0
  529. package/dist/npm/transaction/combine.js.map +1 -0
  530. package/dist/npm/transaction/escrow-cancellation.d.ts +11 -0
  531. package/dist/npm/transaction/escrow-cancellation.d.ts.map +1 -0
  532. package/dist/npm/transaction/escrow-cancellation.js +46 -0
  533. package/dist/npm/transaction/escrow-cancellation.js.map +1 -0
  534. package/dist/npm/transaction/escrow-creation.d.ts +16 -0
  535. package/dist/npm/transaction/escrow-creation.d.ts.map +1 -0
  536. package/dist/npm/transaction/escrow-creation.js +69 -0
  537. package/dist/npm/transaction/escrow-creation.js.map +1 -0
  538. package/dist/npm/transaction/escrow-execution.d.ts +13 -0
  539. package/dist/npm/transaction/escrow-execution.d.ts.map +1 -0
  540. package/dist/npm/transaction/escrow-execution.js +58 -0
  541. package/dist/npm/transaction/escrow-execution.js.map +1 -0
  542. package/dist/npm/transaction/order.d.ts +6 -0
  543. package/dist/npm/transaction/order.d.ts.map +1 -0
  544. package/dist/npm/transaction/order.js +69 -0
  545. package/dist/npm/transaction/order.js.map +1 -0
  546. package/dist/npm/transaction/ordercancellation.d.ts +5 -0
  547. package/dist/npm/transaction/ordercancellation.d.ts.map +1 -0
  548. package/dist/npm/transaction/ordercancellation.js +50 -0
  549. package/dist/npm/transaction/ordercancellation.js.map +1 -0
  550. package/dist/npm/transaction/payment-channel-claim.d.ts +14 -0
  551. package/dist/npm/transaction/payment-channel-claim.d.ts.map +1 -0
  552. package/dist/npm/transaction/payment-channel-claim.js +76 -0
  553. package/dist/npm/transaction/payment-channel-claim.js.map +1 -0
  554. package/dist/npm/transaction/payment-channel-create.d.ts +14 -0
  555. package/dist/npm/transaction/payment-channel-create.d.ts.map +1 -0
  556. package/dist/npm/transaction/payment-channel-create.js +59 -0
  557. package/dist/npm/transaction/payment-channel-create.js.map +1 -0
  558. package/dist/npm/transaction/payment-channel-fund.d.ts +10 -0
  559. package/dist/npm/transaction/payment-channel-fund.d.ts.map +1 -0
  560. package/dist/npm/transaction/payment-channel-fund.js +51 -0
  561. package/dist/npm/transaction/payment-channel-fund.js.map +1 -0
  562. package/dist/npm/transaction/payment.d.ts +16 -0
  563. package/dist/npm/transaction/payment.d.ts.map +1 -0
  564. package/dist/npm/transaction/payment.js +163 -0
  565. package/dist/npm/transaction/payment.js.map +1 -0
  566. package/dist/npm/transaction/settings.d.ts +6 -0
  567. package/dist/npm/transaction/settings.d.ts.map +1 -0
  568. package/dist/npm/transaction/settings.js +130 -0
  569. package/dist/npm/transaction/settings.js.map +1 -0
  570. package/dist/npm/transaction/sign.d.ts +8 -0
  571. package/dist/npm/transaction/sign.d.ts.map +1 -0
  572. package/dist/npm/transaction/sign.js +173 -0
  573. package/dist/npm/transaction/sign.js.map +1 -0
  574. package/dist/npm/transaction/submit.d.ts +8 -0
  575. package/dist/npm/transaction/submit.d.ts.map +1 -0
  576. package/dist/npm/transaction/submit.js +59 -0
  577. package/dist/npm/transaction/submit.js.map +1 -0
  578. package/dist/npm/transaction/ticket.d.ts +9 -0
  579. package/dist/npm/transaction/ticket.d.ts.map +1 -0
  580. package/dist/npm/transaction/ticket.js +46 -0
  581. package/dist/npm/transaction/ticket.js.map +1 -0
  582. package/dist/npm/transaction/trustline.d.ts +6 -0
  583. package/dist/npm/transaction/trustline.d.ts.map +1 -0
  584. package/dist/npm/transaction/trustline.js +82 -0
  585. package/dist/npm/transaction/trustline.js.map +1 -0
  586. package/dist/npm/transaction/types.d.ts +138 -0
  587. package/dist/npm/transaction/types.d.ts.map +1 -0
  588. package/dist/npm/transaction/types.js +3 -0
  589. package/dist/npm/transaction/types.js.map +1 -0
  590. package/dist/npm/transaction/utils.d.ts +22 -0
  591. package/dist/npm/transaction/utils.d.ts.map +1 -0
  592. package/dist/npm/transaction/utils.js +285 -0
  593. package/dist/npm/transaction/utils.js.map +1 -0
  594. package/dist/npm/tsconfig.tsbuildinfo +4230 -0
  595. package/dist/npm/wallet/wallet-generation.d.ts +15 -0
  596. package/dist/npm/wallet/wallet-generation.d.ts.map +1 -0
  597. package/dist/npm/wallet/wallet-generation.js +150 -0
  598. package/dist/npm/wallet/wallet-generation.js.map +1 -0
  599. package/package.json +84 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../src/broadcast.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA2C;AAE3C,MAAM,kBAAmB,SAAQ,eAAS;IAIxC,YAAY,OAAO,EAAE,UAAsB,EAAE;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAA;QAJhB,kBAAa,GAAuB,SAAS,CAAA;QAM3C,MAAM,IAAI,GAAgB,OAAO,CAAC,GAAG,CACnC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,eAAS,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAC,MAAM,EAAC,CAAC,CAAC,CAChE,CAAA;QAGD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QAEjB,IAAI,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrC,IAAI,CAAC,IAAI,CAAC,GAAG;gBAEX,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;YACjE,CAAC,CAAA;QACH,CAAC,CAAC,CAAA;QAGF,IAAI,CAAC,OAAO,GAAG;;gBACb,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;YACrD,CAAC;SAAA,CAAA;QACD,IAAI,CAAC,UAAU,GAAG;;gBAChB,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,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,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAC/B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE;YACxD,IAAI,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE;gBACzC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACvB;SACF;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;CACF;AAEO,gDAAkB"}
@@ -0,0 +1,14 @@
1
+ export declare class ExponentialBackoff {
2
+ private readonly ms;
3
+ private readonly max;
4
+ private readonly factor;
5
+ private readonly jitter;
6
+ attempts: number;
7
+ constructor(opts?: {
8
+ min?: number;
9
+ max?: number;
10
+ });
11
+ duration(): number;
12
+ reset(): void;
13
+ }
14
+ //# sourceMappingURL=backoff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backoff.d.ts","sourceRoot":"","sources":["../../../src/common/backoff.ts"],"names":[],"mappings":"AAYA,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,QAAQ,EAAE,MAAM,CAAI;gBAER,IAAI,GAAE;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAM;IAQnD,QAAQ;IAaR,KAAK;CAGN"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExponentialBackoff = void 0;
4
+ class ExponentialBackoff {
5
+ constructor(opts = {}) {
6
+ this.factor = 2;
7
+ this.jitter = 0;
8
+ this.attempts = 0;
9
+ this.ms = opts.min || 100;
10
+ this.max = opts.max || 10000;
11
+ }
12
+ duration() {
13
+ var ms = this.ms * Math.pow(this.factor, this.attempts++);
14
+ if (this.jitter) {
15
+ var rand = Math.random();
16
+ var deviation = Math.floor(rand * this.jitter * ms);
17
+ ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
18
+ }
19
+ return Math.min(ms, this.max) | 0;
20
+ }
21
+ reset() {
22
+ this.attempts = 0;
23
+ }
24
+ }
25
+ exports.ExponentialBackoff = ExponentialBackoff;
26
+ //# sourceMappingURL=backoff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backoff.js","sourceRoot":"","sources":["../../../src/common/backoff.ts"],"names":[],"mappings":";;;AAYA,MAAa,kBAAkB;IAO7B,YAAY,OAAqC,EAAE;QAJlC,WAAM,GAAW,CAAC,CAAA;QAClB,WAAM,GAAW,CAAC,CAAA;QACnC,aAAQ,GAAW,CAAC,CAAA;QAGlB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,CAAA;QACzB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,KAAK,CAAA;IAC9B,CAAC;IAKD,QAAQ;QACN,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;QACzD,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;YACxB,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;YACnD,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAA;SACxE;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACnC,CAAC;IAKD,KAAK;QACH,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAA;IACnB,CAAC;CACF;AA/BD,gDA+BC"}
@@ -0,0 +1,4 @@
1
+ declare function setPrototypeOf(object: any, prototype: any): void;
2
+ declare function getConstructorName(object: object): string;
3
+ export { getConstructorName, setPrototypeOf };
4
+ //# sourceMappingURL=browser-hacks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-hacks.d.ts","sourceRoot":"","sources":["../../../src/common/browser-hacks.ts"],"names":[],"mappings":"AAAA,iBAAS,cAAc,CAAC,MAAM,KAAA,EAAE,SAAS,KAAA,QAMxC;AAED,iBAAS,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CASlD;AAED,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAC,CAAA"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setPrototypeOf = exports.getConstructorName = void 0;
4
+ function setPrototypeOf(object, prototype) {
5
+ Object.setPrototypeOf
6
+ ? Object.setPrototypeOf(object, prototype)
7
+ :
8
+ (object.__proto__ = prototype);
9
+ }
10
+ exports.setPrototypeOf = setPrototypeOf;
11
+ function getConstructorName(object) {
12
+ if (object.constructor.name) {
13
+ return object.constructor.name;
14
+ }
15
+ const constructorString = object.constructor.toString();
16
+ const functionConstructor = constructorString.match(/^function\s+([^(]*)/);
17
+ const classConstructor = constructorString.match(/^class\s([^\s]*)/);
18
+ return functionConstructor ? functionConstructor[1] : classConstructor[1];
19
+ }
20
+ exports.getConstructorName = getConstructorName;
21
+ //# sourceMappingURL=browser-hacks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-hacks.js","sourceRoot":"","sources":["../../../src/common/browser-hacks.ts"],"names":[],"mappings":";;;AAAA,SAAS,cAAc,CAAC,MAAM,EAAE,SAAS;IAEvC,MAAM,CAAC,cAAc;QACnB,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC;QAC1C,CAAC;YACC,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC,CAAA;AACpC,CAAC;AAa2B,wCAAc;AAX1C,SAAS,kBAAkB,CAAC,MAAc;IACxC,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE;QAC3B,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAA;KAC/B;IAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAA;IACvD,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;IAC1E,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;IACpE,OAAO,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;AAC3E,CAAC;AAEO,gDAAkB"}
@@ -0,0 +1,50 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ export interface ConnectionOptions {
4
+ trace?: boolean | ((id: string, message: string) => void);
5
+ proxy?: string;
6
+ proxyAuthorization?: string;
7
+ authorization?: string;
8
+ trustedCertificates?: string[];
9
+ key?: string;
10
+ passphrase?: string;
11
+ certificate?: string;
12
+ timeout: number;
13
+ connectionTimeout: number;
14
+ }
15
+ export declare type ConnectionUserOptions = Partial<ConnectionOptions>;
16
+ export declare class Connection extends EventEmitter {
17
+ private _url;
18
+ private _ws;
19
+ private _reconnectTimeoutID;
20
+ private _heartbeatIntervalID;
21
+ private _retryConnectionBackoff;
22
+ private _trace;
23
+ private _config;
24
+ private _ledger;
25
+ private _requestManager;
26
+ private _connectionManager;
27
+ constructor(url?: string, options?: ConnectionUserOptions);
28
+ private _onMessage;
29
+ private get _state();
30
+ private get _shouldBeConnected();
31
+ private _clearHeartbeatInterval;
32
+ private _startHeartbeatInterval;
33
+ private _heartbeat;
34
+ private _waitForReady;
35
+ private _subscribeToLedger;
36
+ private _onConnectionFailed;
37
+ isConnected(): boolean;
38
+ connect(): Promise<void>;
39
+ disconnect(): Promise<number | undefined>;
40
+ reconnect(): Promise<void>;
41
+ getFeeBase(): Promise<number>;
42
+ getFeeRef(): Promise<number>;
43
+ getLedgerVersion(): Promise<number>;
44
+ getReserveBase(): Promise<number>;
45
+ hasLedgerVersions(lowLedgerVersion: number, highLedgerVersion: number | undefined): Promise<boolean>;
46
+ hasLedgerVersion(ledgerVersion: number): Promise<boolean>;
47
+ request(request: any, timeout?: number): Promise<any>;
48
+ getUrl(): string;
49
+ }
50
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/common/connection.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAA;AAmBnC,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC,CAAA;IACzD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAOD,oBAAY,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AA4Q9D,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,IAAI,CA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+1,467 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.Connection = void 0;
35
+ const _ = __importStar(require("lodash"));
36
+ const events_1 = require("events");
37
+ const url_1 = require("url");
38
+ const ws_1 = __importDefault(require("ws"));
39
+ const rangeset_1 = __importDefault(require("./rangeset"));
40
+ const errors_1 = require("./errors");
41
+ const backoff_1 = require("./backoff");
42
+ const INTENTIONAL_DISCONNECT_CODE = 4000;
43
+ function createWebSocket(url, config) {
44
+ const options = {};
45
+ if (config.proxy != null) {
46
+ const parsedURL = url_1.parse(url);
47
+ const parsedProxyURL = url_1.parse(config.proxy);
48
+ const proxyOverrides = _.omitBy({
49
+ secureEndpoint: parsedURL.protocol === 'wss:',
50
+ secureProxy: parsedProxyURL.protocol === 'https:',
51
+ auth: config.proxyAuthorization,
52
+ ca: config.trustedCertificates,
53
+ key: config.key,
54
+ passphrase: config.passphrase,
55
+ cert: config.certificate
56
+ }, (value) => value == null);
57
+ const proxyOptions = Object.assign({}, parsedProxyURL, proxyOverrides);
58
+ let HttpsProxyAgent;
59
+ try {
60
+ HttpsProxyAgent = require('https-proxy-agent');
61
+ }
62
+ catch (error) {
63
+ throw new Error('"proxy" option is not supported in the browser');
64
+ }
65
+ options.agent = new HttpsProxyAgent(proxyOptions);
66
+ }
67
+ if (config.authorization != null) {
68
+ const base64 = Buffer.from(config.authorization).toString('base64');
69
+ options.headers = { Authorization: `Basic ${base64}` };
70
+ }
71
+ const optionsOverrides = _.omitBy({
72
+ ca: config.trustedCertificates,
73
+ key: config.key,
74
+ passphrase: config.passphrase,
75
+ cert: config.certificate
76
+ }, (value) => value == null);
77
+ const websocketOptions = Object.assign({}, options, optionsOverrides);
78
+ const websocket = new ws_1.default(url, null, websocketOptions);
79
+ if (typeof websocket.setMaxListeners === 'function') {
80
+ websocket.setMaxListeners(Infinity);
81
+ }
82
+ return websocket;
83
+ }
84
+ function websocketSendAsync(ws, message) {
85
+ return new Promise((resolve, reject) => {
86
+ ws.send(message, undefined, (error) => {
87
+ if (error) {
88
+ reject(new errors_1.DisconnectedError(error.message, error));
89
+ }
90
+ else {
91
+ resolve();
92
+ }
93
+ });
94
+ });
95
+ }
96
+ class LedgerHistory {
97
+ constructor() {
98
+ this.feeBase = null;
99
+ this.feeRef = null;
100
+ this.latestVersion = null;
101
+ this.reserveBase = null;
102
+ this.availableVersions = new rangeset_1.default();
103
+ }
104
+ hasVersion(version) {
105
+ return this.availableVersions.containsValue(version);
106
+ }
107
+ hasVersions(lowVersion, highVersion) {
108
+ return this.availableVersions.containsRange(lowVersion, highVersion);
109
+ }
110
+ update(ledgerMessage) {
111
+ this.feeBase = ledgerMessage.fee_base;
112
+ this.feeRef = ledgerMessage.fee_ref;
113
+ this.latestVersion = ledgerMessage.ledger_index;
114
+ this.reserveBase = ledgerMessage.reserve_base;
115
+ if (ledgerMessage.validated_ledgers) {
116
+ this.availableVersions.reset();
117
+ this.availableVersions.parseAndAddRanges(ledgerMessage.validated_ledgers);
118
+ }
119
+ else {
120
+ this.availableVersions.addValue(this.latestVersion);
121
+ }
122
+ }
123
+ }
124
+ class ConnectionManager {
125
+ constructor() {
126
+ this.promisesAwaitingConnection = [];
127
+ }
128
+ resolveAllAwaiting() {
129
+ this.promisesAwaitingConnection.map(({ resolve }) => resolve());
130
+ this.promisesAwaitingConnection = [];
131
+ }
132
+ rejectAllAwaiting(error) {
133
+ this.promisesAwaitingConnection.map(({ reject }) => reject(error));
134
+ this.promisesAwaitingConnection = [];
135
+ }
136
+ awaitConnection() {
137
+ return new Promise((resolve, reject) => {
138
+ this.promisesAwaitingConnection.push({ resolve, reject });
139
+ });
140
+ }
141
+ }
142
+ class RequestManager {
143
+ constructor() {
144
+ this.nextId = 0;
145
+ this.promisesAwaitingResponse = [];
146
+ }
147
+ cancel(id) {
148
+ const { timer } = this.promisesAwaitingResponse[id];
149
+ clearTimeout(timer);
150
+ delete this.promisesAwaitingResponse[id];
151
+ }
152
+ resolve(id, data) {
153
+ const { timer, resolve } = this.promisesAwaitingResponse[id];
154
+ clearTimeout(timer);
155
+ resolve(data);
156
+ delete this.promisesAwaitingResponse[id];
157
+ }
158
+ reject(id, error) {
159
+ const { timer, reject } = this.promisesAwaitingResponse[id];
160
+ clearTimeout(timer);
161
+ reject(error);
162
+ delete this.promisesAwaitingResponse[id];
163
+ }
164
+ rejectAll(error) {
165
+ this.promisesAwaitingResponse.forEach((_, id) => {
166
+ this.reject(id, error);
167
+ });
168
+ }
169
+ createRequest(data, timeout) {
170
+ const newId = this.nextId++;
171
+ const newData = JSON.stringify(Object.assign(Object.assign({}, data), { id: newId }));
172
+ const timer = setTimeout(() => this.reject(newId, new errors_1.TimeoutError()), timeout);
173
+ if (timer.unref) {
174
+ timer.unref();
175
+ }
176
+ const newPromise = new Promise((resolve, reject) => {
177
+ this.promisesAwaitingResponse[newId] = { resolve, reject, timer };
178
+ });
179
+ return [newId, newData, newPromise];
180
+ }
181
+ handleResponse(data) {
182
+ if (!Number.isInteger(data.id) || data.id < 0) {
183
+ throw new errors_1.ResponseFormatError('valid id not found in response', data);
184
+ }
185
+ if (!this.promisesAwaitingResponse[data.id]) {
186
+ return;
187
+ }
188
+ if (data.status === 'error') {
189
+ const error = new errors_1.RippledError(data.error_message || data.error, data);
190
+ this.reject(data.id, error);
191
+ return;
192
+ }
193
+ if (data.status !== 'success') {
194
+ const error = new errors_1.ResponseFormatError(`unrecognized status: ${data.status}`, data);
195
+ this.reject(data.id, error);
196
+ return;
197
+ }
198
+ this.resolve(data.id, data.result);
199
+ }
200
+ }
201
+ class Connection extends events_1.EventEmitter {
202
+ constructor(url, options = {}) {
203
+ super();
204
+ this._ws = null;
205
+ this._reconnectTimeoutID = null;
206
+ this._heartbeatIntervalID = null;
207
+ this._retryConnectionBackoff = new backoff_1.ExponentialBackoff({
208
+ min: 100,
209
+ max: 60 * 1000
210
+ });
211
+ this._trace = () => { };
212
+ this._ledger = new LedgerHistory();
213
+ this._requestManager = new RequestManager();
214
+ this._connectionManager = new ConnectionManager();
215
+ this._clearHeartbeatInterval = () => {
216
+ clearInterval(this._heartbeatIntervalID);
217
+ };
218
+ this._startHeartbeatInterval = () => {
219
+ this._clearHeartbeatInterval();
220
+ this._heartbeatIntervalID = setInterval(() => this._heartbeat(), this._config.timeout);
221
+ };
222
+ this._heartbeat = () => {
223
+ return this.request({ command: 'ping' }).catch(() => {
224
+ return this.reconnect().catch((error) => {
225
+ this.emit('error', 'reconnect', error.message, error);
226
+ });
227
+ });
228
+ };
229
+ this._onConnectionFailed = (errorOrCode) => {
230
+ if (this._ws) {
231
+ this._ws.removeAllListeners();
232
+ this._ws.on('error', () => {
233
+ });
234
+ this._ws.close();
235
+ this._ws = null;
236
+ }
237
+ if (typeof errorOrCode === 'number') {
238
+ this._connectionManager.rejectAllAwaiting(new errors_1.NotConnectedError(`Connection failed with code ${errorOrCode}.`, {
239
+ code: errorOrCode
240
+ }));
241
+ }
242
+ else if (errorOrCode && errorOrCode.message) {
243
+ this._connectionManager.rejectAllAwaiting(new errors_1.NotConnectedError(errorOrCode.message, errorOrCode));
244
+ }
245
+ else {
246
+ this._connectionManager.rejectAllAwaiting(new errors_1.NotConnectedError('Connection failed.'));
247
+ }
248
+ };
249
+ this.setMaxListeners(Infinity);
250
+ this._url = url;
251
+ this._config = Object.assign({ timeout: 20 * 1000, connectionTimeout: 5 * 1000 }, options);
252
+ if (typeof options.trace === 'function') {
253
+ this._trace = options.trace;
254
+ }
255
+ else if (options.trace === true) {
256
+ this._trace = console.log;
257
+ }
258
+ }
259
+ _onMessage(message) {
260
+ this._trace('receive', message);
261
+ let data;
262
+ try {
263
+ data = JSON.parse(message);
264
+ }
265
+ catch (error) {
266
+ this.emit('error', 'badMessage', error.message, message);
267
+ return;
268
+ }
269
+ if (data.type == null && data.error) {
270
+ this.emit('error', data.error, data.error_message, data);
271
+ return;
272
+ }
273
+ if (data.type) {
274
+ this.emit(data.type, data);
275
+ }
276
+ if (data.type === 'ledgerClosed') {
277
+ this._ledger.update(data);
278
+ }
279
+ if (data.type === 'response') {
280
+ try {
281
+ this._requestManager.handleResponse(data);
282
+ }
283
+ catch (error) {
284
+ this.emit('error', 'badMessage', error.message, message);
285
+ }
286
+ }
287
+ }
288
+ get _state() {
289
+ return this._ws ? this._ws.readyState : ws_1.default.CLOSED;
290
+ }
291
+ get _shouldBeConnected() {
292
+ return this._ws !== null;
293
+ }
294
+ _waitForReady() {
295
+ return new Promise((resolve, reject) => {
296
+ if (!this._shouldBeConnected) {
297
+ reject(new errors_1.NotConnectedError());
298
+ }
299
+ else if (this._state === ws_1.default.OPEN) {
300
+ resolve();
301
+ }
302
+ else {
303
+ this.once('connected', () => resolve());
304
+ }
305
+ });
306
+ }
307
+ _subscribeToLedger() {
308
+ return __awaiter(this, void 0, void 0, function* () {
309
+ const data = yield this.request({
310
+ command: 'subscribe',
311
+ streams: ['ledger']
312
+ });
313
+ if (_.isEmpty(data) || !data.ledger_index) {
314
+ try {
315
+ yield this.disconnect();
316
+ }
317
+ catch (error) {
318
+ }
319
+ finally {
320
+ throw new errors_1.RippledNotInitializedError('Rippled not initialized');
321
+ }
322
+ }
323
+ this._ledger.update(data);
324
+ });
325
+ }
326
+ isConnected() {
327
+ return this._state === ws_1.default.OPEN;
328
+ }
329
+ connect() {
330
+ if (this.isConnected()) {
331
+ return Promise.resolve();
332
+ }
333
+ if (this._state === ws_1.default.CONNECTING) {
334
+ return this._connectionManager.awaitConnection();
335
+ }
336
+ if (!this._url) {
337
+ return Promise.reject(new errors_1.ConnectionError('Cannot connect because no server was specified'));
338
+ }
339
+ if (this._ws) {
340
+ return Promise.reject(new errors_1.RippleError('Websocket connection never cleaned up.', {
341
+ state: this._state
342
+ }));
343
+ }
344
+ const connectionTimeoutID = setTimeout(() => {
345
+ this._onConnectionFailed(new errors_1.ConnectionError(`Error: connect() timed out after ${this._config.connectionTimeout} ms. ` +
346
+ `If your internet connection is working, the rippled server may be blocked or inaccessible. ` +
347
+ `You can also try setting the 'connectionTimeout' option in the RippleAPI constructor.`));
348
+ }, this._config.connectionTimeout);
349
+ this._ws = createWebSocket(this._url, this._config);
350
+ this._ws.on('error', this._onConnectionFailed);
351
+ this._ws.on('error', () => clearTimeout(connectionTimeoutID));
352
+ this._ws.on('close', this._onConnectionFailed);
353
+ this._ws.on('close', () => clearTimeout(connectionTimeoutID));
354
+ this._ws.once('open', () => __awaiter(this, void 0, void 0, function* () {
355
+ this._ws.removeAllListeners();
356
+ clearTimeout(connectionTimeoutID);
357
+ this._ws.on('message', (message) => this._onMessage(message));
358
+ this._ws.on('error', (error) => this.emit('error', 'websocket', error.message, error));
359
+ this._ws.once('close', (code) => {
360
+ this._clearHeartbeatInterval();
361
+ this._requestManager.rejectAll(new errors_1.DisconnectedError('websocket was closed'));
362
+ this._ws.removeAllListeners();
363
+ this._ws = null;
364
+ this.emit('disconnected', code);
365
+ if (code !== INTENTIONAL_DISCONNECT_CODE) {
366
+ const retryTimeout = this._retryConnectionBackoff.duration();
367
+ this._trace('reconnect', `Retrying connection in ${retryTimeout}ms.`);
368
+ this.emit('reconnecting', this._retryConnectionBackoff.attempts);
369
+ this._reconnectTimeoutID = setTimeout(() => {
370
+ this.reconnect().catch((error) => {
371
+ this.emit('error', 'reconnect', error.message, error);
372
+ });
373
+ }, retryTimeout);
374
+ }
375
+ });
376
+ try {
377
+ this._retryConnectionBackoff.reset();
378
+ yield this._subscribeToLedger();
379
+ this._startHeartbeatInterval();
380
+ this._connectionManager.resolveAllAwaiting();
381
+ this.emit('connected');
382
+ }
383
+ catch (error) {
384
+ this._connectionManager.rejectAllAwaiting(error);
385
+ yield this.disconnect().catch(() => { });
386
+ }
387
+ }));
388
+ return this._connectionManager.awaitConnection();
389
+ }
390
+ disconnect() {
391
+ clearTimeout(this._reconnectTimeoutID);
392
+ this._reconnectTimeoutID = null;
393
+ if (this._state === ws_1.default.CLOSED || !this._ws) {
394
+ return Promise.resolve(undefined);
395
+ }
396
+ return new Promise((resolve) => {
397
+ this._ws.once('close', (code) => resolve(code));
398
+ if (this._state !== ws_1.default.CLOSING) {
399
+ this._ws.close(INTENTIONAL_DISCONNECT_CODE);
400
+ }
401
+ });
402
+ }
403
+ reconnect() {
404
+ return __awaiter(this, void 0, void 0, function* () {
405
+ this.emit('reconnect');
406
+ yield this.disconnect();
407
+ yield this.connect();
408
+ });
409
+ }
410
+ getFeeBase() {
411
+ return __awaiter(this, void 0, void 0, function* () {
412
+ yield this._waitForReady();
413
+ return this._ledger.feeBase;
414
+ });
415
+ }
416
+ getFeeRef() {
417
+ return __awaiter(this, void 0, void 0, function* () {
418
+ yield this._waitForReady();
419
+ return this._ledger.feeRef;
420
+ });
421
+ }
422
+ getLedgerVersion() {
423
+ return __awaiter(this, void 0, void 0, function* () {
424
+ yield this._waitForReady();
425
+ return this._ledger.latestVersion;
426
+ });
427
+ }
428
+ getReserveBase() {
429
+ return __awaiter(this, void 0, void 0, function* () {
430
+ yield this._waitForReady();
431
+ return this._ledger.reserveBase;
432
+ });
433
+ }
434
+ hasLedgerVersions(lowLedgerVersion, highLedgerVersion) {
435
+ return __awaiter(this, void 0, void 0, function* () {
436
+ if (!highLedgerVersion) {
437
+ return this.hasLedgerVersion(lowLedgerVersion);
438
+ }
439
+ yield this._waitForReady();
440
+ return this._ledger.hasVersions(lowLedgerVersion, highLedgerVersion);
441
+ });
442
+ }
443
+ hasLedgerVersion(ledgerVersion) {
444
+ return __awaiter(this, void 0, void 0, function* () {
445
+ yield this._waitForReady();
446
+ return this._ledger.hasVersion(ledgerVersion);
447
+ });
448
+ }
449
+ request(request, timeout) {
450
+ return __awaiter(this, void 0, void 0, function* () {
451
+ if (!this._shouldBeConnected) {
452
+ throw new errors_1.NotConnectedError();
453
+ }
454
+ const [id, message, responsePromise] = this._requestManager.createRequest(request, timeout || this._config.timeout);
455
+ this._trace('send', message);
456
+ websocketSendAsync(this._ws, message).catch((error) => {
457
+ this._requestManager.reject(id, error);
458
+ });
459
+ return responsePromise;
460
+ });
461
+ }
462
+ getUrl() {
463
+ return this._url;
464
+ }
465
+ }
466
+ exports.Connection = Connection;
467
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/common/connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA2B;AAC3B,mCAAmC;AACnC,6BAAqC;AACrC,4CAA0B;AAC1B,0DAAiC;AACjC,qCASiB;AACjB,uCAA4C;AA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