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,156 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const _ = __importStar(require("lodash"));
26
+ const ripple_binary_codec_1 = __importDefault(require("ripple-binary-codec"));
27
+ const hashes_1 = require("../common/hashes");
28
+ const utils = __importStar(require("./utils"));
29
+ const transaction_1 = __importDefault(require("./parse/transaction"));
30
+ const transaction_2 = __importDefault(require("./transaction"));
31
+ const common_1 = require("../common");
32
+ function parseBinaryTransaction(transaction) {
33
+ const tx = ripple_binary_codec_1.default.decode(transaction.tx_blob);
34
+ tx.hash = hashes_1.computeTransactionHash(tx);
35
+ tx.ledger_index = transaction.ledger_index;
36
+ return {
37
+ tx: tx,
38
+ meta: ripple_binary_codec_1.default.decode(transaction.meta),
39
+ validated: transaction.validated
40
+ };
41
+ }
42
+ function parseAccountTxTransaction(tx, includeRawTransaction) {
43
+ const _tx = tx.tx_blob ? parseBinaryTransaction(tx) : tx;
44
+ return transaction_1.default(Object.assign({}, _tx.tx, { meta: _tx.meta, validated: _tx.validated }), includeRawTransaction);
45
+ }
46
+ function counterpartyFilter(filters, tx) {
47
+ if (tx.address === filters.counterparty) {
48
+ return true;
49
+ }
50
+ const specification = tx.specification;
51
+ if (specification &&
52
+ ((specification.destination &&
53
+ specification.destination.address === filters.counterparty) ||
54
+ specification.counterparty === filters.counterparty)) {
55
+ return true;
56
+ }
57
+ return false;
58
+ }
59
+ function transactionFilter(address, filters, tx) {
60
+ if (filters.excludeFailures && tx.outcome.result !== 'tesSUCCESS') {
61
+ return false;
62
+ }
63
+ if (filters.types && !filters.types.includes(tx.type)) {
64
+ return false;
65
+ }
66
+ if (filters.initiated === true && tx.address !== address) {
67
+ return false;
68
+ }
69
+ if (filters.initiated === false && tx.address === address) {
70
+ return false;
71
+ }
72
+ if (filters.counterparty && !counterpartyFilter(filters, tx)) {
73
+ return false;
74
+ }
75
+ return true;
76
+ }
77
+ function orderFilter(options, tx) {
78
+ return (!options.startTx ||
79
+ (options.earliestFirst
80
+ ? utils.compareTransactions(tx, options.startTx) > 0
81
+ : utils.compareTransactions(tx, options.startTx) < 0));
82
+ }
83
+ function formatPartialResponse(address, options, data) {
84
+ const parse = (tx) => parseAccountTxTransaction(tx, options.includeRawTransactions);
85
+ return {
86
+ marker: data.marker,
87
+ results: data.transactions
88
+ .filter((tx) => tx.validated)
89
+ .map(parse)
90
+ .filter(_.partial(transactionFilter, address, options))
91
+ .filter(_.partial(orderFilter, options))
92
+ };
93
+ }
94
+ function getAccountTx(connection, address, options, marker, limit) {
95
+ const request = {
96
+ command: 'account_tx',
97
+ account: address,
98
+ ledger_index_min: options.minLedgerVersion || -1,
99
+ ledger_index_max: options.maxLedgerVersion || -1,
100
+ forward: options.earliestFirst,
101
+ binary: options.binary,
102
+ limit: utils.clamp(limit, 10, 400),
103
+ marker: marker
104
+ };
105
+ return connection
106
+ .request(request)
107
+ .then((response) => formatPartialResponse(address, options, response));
108
+ }
109
+ function checkForLedgerGaps(connection, options, transactions) {
110
+ let { minLedgerVersion, maxLedgerVersion } = options;
111
+ if (options.limit && transactions.length === options.limit) {
112
+ if (options.earliestFirst) {
113
+ maxLedgerVersion = transactions[transactions.length - 1].outcome.ledgerVersion;
114
+ }
115
+ else {
116
+ minLedgerVersion = transactions[transactions.length - 1].outcome.ledgerVersion;
117
+ }
118
+ }
119
+ return utils
120
+ .hasCompleteLedgerRange(connection, minLedgerVersion, maxLedgerVersion)
121
+ .then((hasCompleteLedgerRange) => {
122
+ if (!hasCompleteLedgerRange) {
123
+ throw new common_1.errors.MissingLedgerHistoryError();
124
+ }
125
+ });
126
+ }
127
+ function formatResponse(connection, options, transactions) {
128
+ const sortedTransactions = options.earliestFirst
129
+ ? transactions.sort(utils.compareTransactions)
130
+ : transactions.sort(utils.compareTransactions).reverse();
131
+ return checkForLedgerGaps(connection, options, sortedTransactions).then(() => sortedTransactions);
132
+ }
133
+ function getTransactionsInternal(connection, address, options) {
134
+ const getter = _.partial(getAccountTx, connection, address, options);
135
+ const format = _.partial(formatResponse, connection, options);
136
+ return utils.getRecursive(getter, options.limit).then(format);
137
+ }
138
+ function getTransactions(address, options = {}) {
139
+ common_1.validate.getTransactions({ address, options });
140
+ address = common_1.ensureClassicAddress(address);
141
+ const defaults = { maxLedgerVersion: -1 };
142
+ if (options.start) {
143
+ return transaction_2.default.call(this, options.start).then((tx) => {
144
+ const ledgerVersion = tx.outcome.ledgerVersion;
145
+ const bound = options.earliestFirst
146
+ ? { minLedgerVersion: ledgerVersion }
147
+ : { maxLedgerVersion: ledgerVersion };
148
+ const startOptions = Object.assign({}, defaults, options, { startTx: tx }, bound);
149
+ return getTransactionsInternal(this.connection, address, startOptions);
150
+ });
151
+ }
152
+ const newOptions = Object.assign({}, defaults, options);
153
+ return getTransactionsInternal(this.connection, address, newOptions);
154
+ }
155
+ exports.default = getTransactions;
156
+ //# sourceMappingURL=transactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.js","sourceRoot":"","sources":["../../../src/ledger/transactions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA2B;AAC3B,8EAAwC;AACxC,6CAAuD;AACvD,+CAAgC;AAChC,sEAAkD;AAClD,gEAA0C;AAC1C,sCAA4E;AAqB5E,SAAS,sBAAsB,CAAC,WAAW;IACzC,MAAM,EAAE,GAAG,6BAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;IAC7C,EAAE,CAAC,IAAI,GAAG,+BAAsB,CAAC,EAAE,CAAC,CAAA;IACpC,EAAE,CAAC,YAAY,GAAG,WAAW,CAAC,YAAY,CAAA;IAC1C,OAAO;QACL,EAAE,EAAE,EAAE;QACN,IAAI,EAAE,6BAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;QACrC,SAAS,EAAE,WAAW,CAAC,SAAS;KACjC,CAAA;AACH,CAAC;AAED,SAAS,yBAAyB,CAAC,EAAE,EAAE,qBAA8B;IACnE,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAExD,OAAO,qBAAgB,CACrB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAC,CAAC,EACrE,qBAAqB,CACtB,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAO,EAAE,EAA4B;IAC/D,IAAI,EAAE,CAAC,OAAO,KAAK,OAAO,CAAC,YAAY,EAAE;QACvC,OAAO,IAAI,CAAA;KACZ;IACD,MAAM,aAAa,GAAQ,EAAE,CAAC,aAAa,CAAA;IAC3C,IACE,aAAa;QACb,CAAC,CAAC,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AED,kBAAe,eAAe,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { RippleAPI } from '..';
2
+ import { FormattedTrustline } from '../common/types/objects/trustlines';
3
+ export declare type GetTrustlinesOptions = {
4
+ counterparty?: string;
5
+ currency?: string;
6
+ limit?: number;
7
+ ledgerVersion?: number;
8
+ };
9
+ declare function getTrustlines(this: RippleAPI, address: string, options?: GetTrustlinesOptions): Promise<FormattedTrustline[]>;
10
+ export default getTrustlines;
11
+ //# sourceMappingURL=trustlines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trustlines.d.ts","sourceRoot":"","sources":["../../../src/ledger/trustlines.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAA;AAErE,oBAAY,oBAAoB,GAAG;IACjC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAMD,iBAAe,aAAa,CAC1B,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAqB/B;AAED,eAAe,aAAa,CAAA"}
@@ -0,0 +1,58 @@
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
+ const _ = __importStar(require("lodash"));
35
+ const common_1 = require("../common");
36
+ const account_trustline_1 = __importDefault(require("./parse/account-trustline"));
37
+ function currencyFilter(currency, trustline) {
38
+ return currency === null || trustline.specification.currency === currency;
39
+ }
40
+ function getTrustlines(address, options = {}) {
41
+ var _a;
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ common_1.validate.getTrustlines({ address, options });
44
+ address = common_1.ensureClassicAddress(address);
45
+ const responses = yield this._requestAll('account_lines', {
46
+ account: address,
47
+ ledger_index: (_a = options.ledgerVersion) !== null && _a !== void 0 ? _a : yield this.getLedgerVersion(),
48
+ limit: options.limit,
49
+ peer: options.counterparty
50
+ });
51
+ const trustlines = _.flatMap(responses, (response) => response.lines);
52
+ return trustlines.map(account_trustline_1.default).filter((trustline) => {
53
+ return currencyFilter(options.currency || null, trustline);
54
+ });
55
+ });
56
+ }
57
+ exports.default = getTrustlines;
58
+ //# sourceMappingURL=trustlines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trustlines.js","sourceRoot":"","sources":["../../../src/ledger/trustlines.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA2B;AAC3B,sCAAwD;AACxD,kFAA6D;AAW7D,SAAS,cAAc,CAAC,QAAgB,EAAE,SAA6B;IACrE,OAAO,QAAQ,KAAK,IAAI,IAAI,SAAS,CAAC,aAAa,CAAC,QAAQ,KAAK,QAAQ,CAAA;AAC3E,CAAC;AAED,SAAe,aAAa,CAE1B,OAAe,EACf,UAAgC,EAAE;;;QAGlC,iBAAQ,CAAC,aAAa,CAAC,EAAC,OAAO,EAAE,OAAO,EAAC,CAAC,CAAA;QAK1C,OAAO,GAAG,6BAAoB,CAAC,OAAO,CAAC,CAAA;QAGvC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE;YACxD,OAAO,EAAE,OAAO;YAChB,YAAY,QAAE,OAAO,CAAC,aAAa,mCAAI,MAAM,IAAI,CAAC,gBAAgB,EAAE;YACpE,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,IAAI,EAAE,OAAO,CAAC,YAAY;SAC3B,CAAC,CAAA;QAEF,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACrE,OAAO,UAAU,CAAC,GAAG,CAAC,2BAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE;YAChE,OAAO,cAAc,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE,SAAS,CAAC,CAAA;QAC5D,CAAC,CAAC,CAAA;;CACH;AAED,kBAAe,aAAa,CAAA"}
@@ -0,0 +1,33 @@
1
+ import * as _ from 'lodash';
2
+ import * as common from '../common';
3
+ import { Connection } from '../common';
4
+ import { FormattedTransactionType } from '../transaction/types';
5
+ import { Issue } from '../common/types/objects';
6
+ import { RippleAPI } from '..';
7
+ export declare type RecursiveData = {
8
+ marker: string;
9
+ results: Array<any>;
10
+ };
11
+ export declare type Getter = (marker?: string, limit?: number) => Promise<RecursiveData>;
12
+ declare function clamp(value: number, min: number, max: number): number;
13
+ declare function getXRPBalance(connection: Connection, address: string, ledgerVersion?: number): Promise<string>;
14
+ declare function getRecursive(getter: Getter, limit?: number): Promise<Array<any>>;
15
+ declare function renameCounterpartyToIssuer<T>(obj: T & {
16
+ counterparty?: string;
17
+ issuer?: string;
18
+ }): T & {
19
+ issuer?: string;
20
+ };
21
+ export declare type RequestBookOffersArgs = {
22
+ taker_gets: Issue;
23
+ taker_pays: Issue;
24
+ };
25
+ declare function renameCounterpartyToIssuerInOrder(order: RequestBookOffersArgs): RequestBookOffersArgs & _.Dictionary<Issue & {
26
+ issuer?: string;
27
+ }>;
28
+ declare function compareTransactions(first: FormattedTransactionType, second: FormattedTransactionType): number;
29
+ declare function hasCompleteLedgerRange(connection: Connection, minLedgerVersion?: number, maxLedgerVersion?: number): Promise<boolean>;
30
+ declare function isPendingLedgerVersion(connection: Connection, maxLedgerVersion?: number): Promise<boolean>;
31
+ declare function ensureLedgerVersion(this: RippleAPI, options: any): Promise<object>;
32
+ export { getXRPBalance, ensureLedgerVersion, compareTransactions, renameCounterpartyToIssuer, renameCounterpartyToIssuerInOrder, getRecursive, hasCompleteLedgerRange, isPendingLedgerVersion, clamp, common };
33
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/ledger/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAA;AAE3B,OAAO,KAAK,MAAM,MAAM,WAAW,CAAA;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAA;AACpC,OAAO,EAAC,wBAAwB,EAAC,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAC,KAAK,EA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AgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,OAAO,CAAC,CAMlB;AAED,iBAAS,sBAAsB,CAC7B,UAAU,EAAE,UAAU,EACtB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,OAAO,CAAC,CAIlB;AAED,iBAAS,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAW3E;AAED,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,iCAAiC,EACjC,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,EACL,MAAM,EACP,CAAA"}
@@ -0,0 +1,107 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.common = exports.clamp = exports.isPendingLedgerVersion = exports.hasCompleteLedgerRange = exports.getRecursive = exports.renameCounterpartyToIssuerInOrder = exports.renameCounterpartyToIssuer = exports.compareTransactions = exports.ensureLedgerVersion = exports.getXRPBalance = void 0;
23
+ const _ = __importStar(require("lodash"));
24
+ const assert = __importStar(require("assert"));
25
+ const common = __importStar(require("../common"));
26
+ exports.common = common;
27
+ function clamp(value, min, max) {
28
+ assert.ok(min <= max, 'Illegal clamp bounds');
29
+ return Math.min(Math.max(value, min), max);
30
+ }
31
+ exports.clamp = clamp;
32
+ function getXRPBalance(connection, address, ledgerVersion) {
33
+ const request = {
34
+ command: 'account_info',
35
+ account: address,
36
+ ledger_index: ledgerVersion
37
+ };
38
+ return connection
39
+ .request(request)
40
+ .then((data) => common.dropsToXrp(data.account_data.Balance));
41
+ }
42
+ exports.getXRPBalance = getXRPBalance;
43
+ function getRecursiveRecur(getter, marker, limit) {
44
+ return getter(marker, limit).then((data) => {
45
+ const remaining = limit - data.results.length;
46
+ if (remaining > 0 && data.marker != null) {
47
+ return getRecursiveRecur(getter, data.marker, remaining).then((results) => data.results.concat(results));
48
+ }
49
+ return data.results.slice(0, limit);
50
+ });
51
+ }
52
+ function getRecursive(getter, limit) {
53
+ return getRecursiveRecur(getter, undefined, limit || Infinity);
54
+ }
55
+ exports.getRecursive = getRecursive;
56
+ function renameCounterpartyToIssuer(obj) {
57
+ const issuer = obj.counterparty != null
58
+ ? obj.counterparty
59
+ : obj.issuer != null
60
+ ? obj.issuer
61
+ : undefined;
62
+ const withIssuer = Object.assign({}, obj, { issuer });
63
+ delete withIssuer.counterparty;
64
+ return withIssuer;
65
+ }
66
+ exports.renameCounterpartyToIssuer = renameCounterpartyToIssuer;
67
+ function renameCounterpartyToIssuerInOrder(order) {
68
+ const taker_gets = renameCounterpartyToIssuer(order.taker_gets);
69
+ const taker_pays = renameCounterpartyToIssuer(order.taker_pays);
70
+ const changes = { taker_gets, taker_pays };
71
+ return Object.assign({}, order, _.omitBy(changes, value => value == null));
72
+ }
73
+ exports.renameCounterpartyToIssuerInOrder = renameCounterpartyToIssuerInOrder;
74
+ function signum(num) {
75
+ return num === 0 ? 0 : num > 0 ? 1 : -1;
76
+ }
77
+ function compareTransactions(first, second) {
78
+ if (!first.outcome || !second.outcome) {
79
+ return 0;
80
+ }
81
+ if (first.outcome.ledgerVersion === second.outcome.ledgerVersion) {
82
+ return signum(first.outcome.indexInLedger - second.outcome.indexInLedger);
83
+ }
84
+ return first.outcome.ledgerVersion < second.outcome.ledgerVersion ? -1 : 1;
85
+ }
86
+ exports.compareTransactions = compareTransactions;
87
+ function hasCompleteLedgerRange(connection, minLedgerVersion, maxLedgerVersion) {
88
+ const firstLedgerVersion = 32570;
89
+ return connection.hasLedgerVersions(minLedgerVersion || firstLedgerVersion, maxLedgerVersion);
90
+ }
91
+ exports.hasCompleteLedgerRange = hasCompleteLedgerRange;
92
+ function isPendingLedgerVersion(connection, maxLedgerVersion) {
93
+ return connection
94
+ .getLedgerVersion()
95
+ .then((ledgerVersion) => ledgerVersion < (maxLedgerVersion || 0));
96
+ }
97
+ exports.isPendingLedgerVersion = isPendingLedgerVersion;
98
+ function ensureLedgerVersion(options) {
99
+ if (Boolean(options) &&
100
+ options.ledgerVersion != null &&
101
+ options.ledgerVersion !== null) {
102
+ return Promise.resolve(options);
103
+ }
104
+ return this.getLedgerVersion().then((ledgerVersion) => Object.assign({}, options, { ledgerVersion }));
105
+ }
106
+ exports.ensureLedgerVersion = ensureLedgerVersion;
107
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ledger/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA2B;AAC3B,+CAAgC;AAChC,kDAAmC;AAgJjC,wBAAM;AAnIR,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IACpD,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,EAAE,sBAAsB,CAAC,CAAA;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;AAC5C,CAAC;AA+HC,sBAAK;AA7HP,SAAS,aAAa,CACpB,UAAsB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,OAAO,KAAK,CAAC,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC5E,CAAC;AAuCC,kDAAmB;AArCrB,SAAS,sBAAsB,CAC7B,UAAsB,EACtB,gBAAyB,EACzB,gBAAyB;IAEzB,MAAM,kBAAkB,GAAG,KAAK,CAAA;IAChC,OAAO,UAAU,CAAC,iBAAiB,CACjC,gBAAgB,IAAI,kBAAkB,EACtC,gBAAgB,CACjB,CAAA;AACH,CAAC;AA+BC,wDAAsB;AA7BxB,SAAS,sBAAsB,CAC7B,UAAsB,EACtB,gBAAyB;IAEzB,OAAO,UAAU;SACd,gBAAgB,EAAE;SAClB,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,GAAG,CAAC,gBAAgB,IAAI,CAAC,CAAC,CAAC,CAAA;AACrE,CAAC;AAuBC,wDAAsB;AArBxB,SAAS,mBAAmB,CAAkB,OAAY;IACxD,IACE,OAAO,CAAC,OAAO,CAAC;QAChB,OAAO,CAAC,aAAa,IAAI,IAAI;QAC7B,OAAO,CAAC,aAAa,KAAK,IAAI,EAC9B;QACA,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;KAChC;IACD,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE,CACpD,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAC,aAAa,EAAC,CAAC,CAC5C,CAAA;AACH,CAAC;AAIC,kDAAmB"}
@@ -0,0 +1,8 @@
1
+ import { deriveKeypair, deriveAddress } from 'ripple-keypairs';
2
+ declare function deriveXAddress(options: {
3
+ publicKey: string;
4
+ tag: number | false;
5
+ test: boolean;
6
+ }): string;
7
+ export { deriveKeypair, deriveAddress, deriveXAddress };
8
+ //# sourceMappingURL=derive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../../src/offline/derive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAG5D,iBAAS,cAAc,CAAC,OAAO,EAAE;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,GAAG,KAAK,CAAA;IACnB,IAAI,EAAE,OAAO,CAAA;CACd,GAAG,MAAM,CAGT;AAED,OAAO,EAAC,aAAa,EAAE,aAAa,EAAE,cAAc,EAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deriveXAddress = exports.deriveAddress = exports.deriveKeypair = void 0;
4
+ const ripple_keypairs_1 = require("ripple-keypairs");
5
+ Object.defineProperty(exports, "deriveKeypair", { enumerable: true, get: function () { return ripple_keypairs_1.deriveKeypair; } });
6
+ Object.defineProperty(exports, "deriveAddress", { enumerable: true, get: function () { return ripple_keypairs_1.deriveAddress; } });
7
+ const ripple_address_codec_1 = require("ripple-address-codec");
8
+ function deriveXAddress(options) {
9
+ const classicAddress = ripple_keypairs_1.deriveAddress(options.publicKey);
10
+ return ripple_address_codec_1.classicAddressToXAddress(classicAddress, options.tag, options.test);
11
+ }
12
+ exports.deriveXAddress = deriveXAddress;
13
+ //# sourceMappingURL=derive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive.js","sourceRoot":"","sources":["../../../src/offline/derive.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAYpD,8FAZA,+BAAa,OAYA;AAAE,8FAZA,+BAAa,OAYA;AAXpC,+DAA6D;AAE7D,SAAS,cAAc,CAAC,OAIvB;IACC,MAAM,cAAc,GAAG,+BAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACvD,OAAO,+CAAwB,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;AAC5E,CAAC;AAEqC,wCAAc"}
@@ -0,0 +1,15 @@
1
+ export declare type GeneratedAddress = {
2
+ xAddress: string;
3
+ classicAddress?: string;
4
+ address?: string;
5
+ secret: string;
6
+ };
7
+ export interface GenerateAddressOptions {
8
+ entropy?: Uint8Array | number[];
9
+ algorithm?: 'ecdsa-secp256k1' | 'ed25519';
10
+ test?: boolean;
11
+ includeClassicAddress?: boolean;
12
+ }
13
+ declare function generateAddressAPI(options?: GenerateAddressOptions): GeneratedAddress;
14
+ export { generateAddressAPI };
15
+ //# sourceMappingURL=generate-address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-address.d.ts","sourceRoot":"","sources":["../../../src/offline/generate-address.ts"],"names":[],"mappings":"AAIA,oBAAY,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,WAAW,sBAAsB;IAErC,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,EAAE,CAAA;IAG/B,SAAS,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAA;IAKzC,IAAI,CAAC,EAAE,OAAO,CAAA;IAGd,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC;AAED,iBAAS,kBAAkB,CAAC,OAAO,GAAE,sBAA2B,GAAG,gBAAgB,CA+BlF;AAED,OAAO,EAAC,kBAAkB,EAAC,CAAA"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateAddressAPI = void 0;
7
+ const ripple_address_codec_1 = require("ripple-address-codec");
8
+ const ripple_keypairs_1 = __importDefault(require("ripple-keypairs"));
9
+ const common_1 = require("../common");
10
+ function generateAddressAPI(options = {}) {
11
+ common_1.validate.generateAddress({ options });
12
+ try {
13
+ const generateSeedOptions = {
14
+ algorithm: options.algorithm
15
+ };
16
+ if (options.entropy) {
17
+ generateSeedOptions.entropy = Uint8Array.from(options.entropy);
18
+ }
19
+ const secret = ripple_keypairs_1.default.generateSeed(generateSeedOptions);
20
+ const keypair = ripple_keypairs_1.default.deriveKeypair(secret);
21
+ const classicAddress = ripple_keypairs_1.default.deriveAddress(keypair.publicKey);
22
+ const returnValue = {
23
+ xAddress: ripple_address_codec_1.classicAddressToXAddress(classicAddress, false, options && options.test),
24
+ secret
25
+ };
26
+ if (options.includeClassicAddress) {
27
+ returnValue.classicAddress = classicAddress;
28
+ returnValue.address = classicAddress;
29
+ }
30
+ return returnValue;
31
+ }
32
+ catch (error) {
33
+ throw new common_1.errors.UnexpectedError(error.message);
34
+ }
35
+ }
36
+ exports.generateAddressAPI = generateAddressAPI;
37
+ //# sourceMappingURL=generate-address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-address.js","sourceRoot":"","sources":["../../../src/offline/generate-address.ts"],"names":[],"mappings":";;;;;;AAAA,+DAA6D;AAC7D,sEAAsC;AACtC,sCAA0C;AAyB1C,SAAS,kBAAkB,CAAC,UAAkC,EAAE;IAC9D,iBAAQ,CAAC,eAAe,CAAC,EAAC,OAAO,EAAC,CAAC,CAAA;IACnC,IAAI;QACF,MAAM,mBAAmB,GAGrB;YACF,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAA;QACD,IAAI,OAAO,CAAC,OAAO,EAAE;YACnB,mBAAmB,CAAC,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;SAC/D;QACD,MAAM,MAAM,GAAG,yBAAQ,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAA;QACzD,MAAM,OAAO,GAAG,yBAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QAC9C,MAAM,cAAc,GAAG,yBAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAChE,MAAM,WAAW,GAAQ;YACvB,QAAQ,EAAE,+CAAwB,CAChC,cAAc,EACd,KAAK,EACL,OAAO,IAAI,OAAO,CAAC,IAAI,CACxB;YACD,MAAM;SACP,CAAA;QACD,IAAI,OAAO,CAAC,qBAAqB,EAAE;YACjC,WAAW,CAAC,cAAc,GAAG,cAAc,CAAA;YAC3C,WAAW,CAAC,OAAO,GAAG,cAAc,CAAA;SACrC;QACD,OAAO,WAAW,CAAA;KACnB;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,eAAM,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;KAChD;AACH,CAAC;AAEO,gDAAkB"}
@@ -0,0 +1,6 @@
1
+ export declare type ComputeLedgerHeaderHashOptions = {
2
+ computeTreeHashes?: boolean;
3
+ };
4
+ declare function computeLedgerHeaderHash(ledger: any, options?: ComputeLedgerHeaderHashOptions): string;
5
+ export default computeLedgerHeaderHash;
6
+ //# sourceMappingURL=ledgerhash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ledgerhash.d.ts","sourceRoot":"","sources":["../../../src/offline/ledgerhash.ts"],"names":[],"mappings":"AA0GA,oBAAY,8BAA8B,GAAG;IAC3C,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,iBAAS,uBAAuB,CAC9B,MAAM,EAAE,GAAG,EACX,OAAO,GAAE,8BAAmC,GAC3C,MAAM,CAMR;AAED,eAAe,uBAAuB,CAAA"}
@@ -0,0 +1,104 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ const _ = __importStar(require("lodash"));
23
+ const hashes_1 = require("../common/hashes");
24
+ const common = __importStar(require("../common"));
25
+ function convertLedgerHeader(header) {
26
+ return {
27
+ account_hash: header.stateHash,
28
+ close_time: common.iso8601ToRippleTime(header.closeTime),
29
+ close_time_resolution: header.closeTimeResolution,
30
+ close_flags: header.closeFlags,
31
+ hash: header.ledgerHash,
32
+ ledger_hash: header.ledgerHash,
33
+ ledger_index: header.ledgerVersion.toString(),
34
+ parent_hash: header.parentLedgerHash,
35
+ parent_close_time: common.iso8601ToRippleTime(header.parentCloseTime),
36
+ total_coins: header.totalDrops,
37
+ transaction_hash: header.transactionHash
38
+ };
39
+ }
40
+ function hashLedgerHeader(ledgerHeader) {
41
+ const header = convertLedgerHeader(ledgerHeader);
42
+ return hashes_1.computeLedgerHash(header);
43
+ }
44
+ function computeTransactionHash(ledger, options) {
45
+ let transactions;
46
+ if (ledger.rawTransactions) {
47
+ transactions = JSON.parse(ledger.rawTransactions);
48
+ }
49
+ else if (ledger.transactions) {
50
+ try {
51
+ transactions = ledger.transactions.map((tx) => JSON.parse(tx.rawTransaction));
52
+ }
53
+ catch (e) {
54
+ if (e.toString() ===
55
+ 'SyntaxError: Unexpected' + ' token u in JSON at position 0') {
56
+ throw new common.errors.ValidationError('ledger' + ' is missing raw transactions');
57
+ }
58
+ }
59
+ }
60
+ else {
61
+ if (options.computeTreeHashes) {
62
+ throw new common.errors.ValidationError('transactions' + ' property is missing from the ledger');
63
+ }
64
+ return ledger.transactionHash;
65
+ }
66
+ const txs = transactions.map((tx) => {
67
+ const mergeTx = Object.assign({}, _.omit(tx, 'tx'), tx.tx || {});
68
+ const renameMeta = Object.assign({}, _.omit(mergeTx, 'meta'), tx.meta ? { metaData: tx.meta } : {});
69
+ return renameMeta;
70
+ });
71
+ const transactionHash = hashes_1.computeTransactionTreeHash(txs);
72
+ if (ledger.transactionHash != null &&
73
+ ledger.transactionHash !== transactionHash) {
74
+ throw new common.errors.ValidationError('transactionHash in header' +
75
+ ' does not match computed hash of transactions', {
76
+ transactionHashInHeader: ledger.transactionHash,
77
+ computedHashOfTransactions: transactionHash
78
+ });
79
+ }
80
+ return transactionHash;
81
+ }
82
+ function computeStateHash(ledger, options) {
83
+ if (ledger.rawState == null) {
84
+ if (options.computeTreeHashes) {
85
+ throw new common.errors.ValidationError('rawState' + ' property is missing from the ledger');
86
+ }
87
+ return ledger.stateHash;
88
+ }
89
+ const state = JSON.parse(ledger.rawState);
90
+ const stateHash = hashes_1.computeStateTreeHash(state);
91
+ if (ledger.stateHash != null && ledger.stateHash !== stateHash) {
92
+ throw new common.errors.ValidationError('stateHash in header' + ' does not match computed hash of state');
93
+ }
94
+ return stateHash;
95
+ }
96
+ function computeLedgerHeaderHash(ledger, options = {}) {
97
+ const subhashes = {
98
+ transactionHash: computeTransactionHash(ledger, options),
99
+ stateHash: computeStateHash(ledger, options)
100
+ };
101
+ return hashLedgerHeader(Object.assign({}, ledger, subhashes));
102
+ }
103
+ exports.default = computeLedgerHeaderHash;
104
+ //# sourceMappingURL=ledgerhash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ledgerhash.js","sourceRoot":"","sources":["../../../src/offline/ledgerhash.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,0CAA2B;AAC3B,6CAIyB;AACzB,kDAAmC;AAEnC,SAAS,mBAAmB,CAAC,MAAM;IACjC,OAAO;QACL,YAAY,EAAE,MAAM,CAA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CACpD,CAAA;SACF;QACD,OAAO,MAAM,CAAC,SAAS,CAAA;KACxB;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACzC,MAAM,SAAS,GAAG,6BAAoB,CAAC,KAAK,CAAC,CAAA;IAC7C,IAAI,MAAM,CAAC,SAAS,IAAI,IAAI,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE;QAC9D,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,eAAe,CACrC,qBAAqB,GAAG,wCAAwC,CACjE,CAAA;KACF;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAMD,SAAS,uBAAuB,CAC9B,MAAW,EACX,UAA0C,EAAE;IAE5C,MAAM,SAAS,GAAG;QAChB,eAAe,EAAE,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC;QACxD,SAAS,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC;KAC7C,CAAA;IACD,OAAO,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAA;AAC/D,CAAC;AAED,kBAAe,uBAAuB,CAAA"}
@@ -0,0 +1,3 @@
1
+ declare function signPaymentChannelClaim(channel: string, amount: string, privateKey: string): string;
2
+ export default signPaymentChannelClaim;
3
+ //# sourceMappingURL=sign-payment-channel-claim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-payment-channel-claim.d.ts","sourceRoot":"","sources":["../../../src/offline/sign-payment-channel-claim.ts"],"names":[],"mappings":"AAKA,iBAAS,uBAAuB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,MAAM,CAQR;AAED,eAAe,uBAAuB,CAAA"}