@atomicfinance/bitcoin-wallet-provider 4.2.8 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/.turbo/turbo-build.log +5 -4
  2. package/.turbo/turbo-lint$colon$fix.log +4 -0
  3. package/.turbo/turbo-lint.log +5 -0
  4. package/.turbo/turbo-test.log +0 -0
  5. package/.yalc/@node-dlc/core/.nyc_output/687a3c14-9765-45fd-a1fe-f7db3d56fee4.json +1 -0
  6. package/.yalc/@node-dlc/core/.nyc_output/processinfo/687a3c14-9765-45fd-a1fe-f7db3d56fee4.json +1 -0
  7. package/.yalc/@node-dlc/core/.nyc_output/processinfo/index.json +1 -0
  8. package/.yalc/@node-dlc/core/README.md +11 -0
  9. package/.yalc/@node-dlc/core/__tests__/core.spec.ts +7 -0
  10. package/.yalc/@node-dlc/core/__tests__/dlc/CETCalculator.spec.ts +1029 -0
  11. package/.yalc/@node-dlc/core/__tests__/dlc/CoinSelect.spec.ts +179 -0
  12. package/.yalc/@node-dlc/core/__tests__/dlc/PolynomialPayoutCurve.spec.ts +345 -0
  13. package/.yalc/@node-dlc/core/__tests__/dlc/TxBuilder.spec.ts +424 -0
  14. package/.yalc/@node-dlc/core/__tests__/dlc/finance/Builder.spec.ts +492 -0
  15. package/.yalc/@node-dlc/core/__tests__/dlc/finance/CoveredCall.spec.ts +112 -0
  16. package/.yalc/@node-dlc/core/__tests__/dlc/finance/CsoInfo.spec.ts +1124 -0
  17. package/.yalc/@node-dlc/core/__tests__/dlc/finance/LongCall.spec.ts +55 -0
  18. package/.yalc/@node-dlc/core/__tests__/dlc/finance/LongPut.spec.ts +55 -0
  19. package/.yalc/@node-dlc/core/__tests__/dlc/finance/OptionInfo.spec.ts +226 -0
  20. package/.yalc/@node-dlc/core/__tests__/dlc/finance/ShortPut.spec.ts +62 -0
  21. package/.yalc/@node-dlc/core/__tests__/tsconfig.json +8 -0
  22. package/.yalc/@node-dlc/core/__tests__/utils/precision.spec.ts +40 -0
  23. package/.yalc/@node-dlc/core/coverage/lcov-report/base.css +224 -0
  24. package/.yalc/@node-dlc/core/coverage/lcov-report/block-navigation.js +79 -0
  25. package/.yalc/@node-dlc/core/coverage/lcov-report/favicon.png +0 -0
  26. package/.yalc/@node-dlc/core/coverage/lcov-report/index.html +171 -0
  27. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/AsyncProcessingQueue.ts.html +269 -0
  28. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/Base32.ts.html +86 -0
  29. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/BigIntUtils.ts.html +86 -0
  30. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/BitField.ts.html +86 -0
  31. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/ChannelId.ts.html +86 -0
  32. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/LinkedList.ts.html +413 -0
  33. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/LinkedListNode.ts.html +122 -0
  34. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/Queue.ts.html +188 -0
  35. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/ShortChannelId.ts.html +86 -0
  36. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/ShortChannelIdUtils.ts.html +107 -0
  37. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/CETCalculator.ts.html +1430 -0
  38. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/CoinSelect.ts.html +431 -0
  39. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/HyperbolaPayoutCurve.ts.html +644 -0
  40. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/PolynomialPayoutCurve.ts.html +878 -0
  41. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/TxBuilder.ts.html +1088 -0
  42. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/TxFinalizer.ts.html +731 -0
  43. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/Builder.ts.html +2270 -0
  44. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/CoveredCall.ts.html +410 -0
  45. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/CsoInfo.ts.html +1574 -0
  46. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/LinearPayout.ts.html +362 -0
  47. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/LongCall.ts.html +302 -0
  48. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/LongPut.ts.html +302 -0
  49. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/OptionInfo.ts.html +626 -0
  50. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/ShortPut.ts.html +305 -0
  51. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/finance/index.html +216 -0
  52. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/dlc/index.html +186 -0
  53. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/index.html +261 -0
  54. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/index.ts.html +278 -0
  55. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/ChannelId.ts.html +242 -0
  56. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/ChannelKeys.ts.html +407 -0
  57. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/CommitmentNumber.ts.html +362 -0
  58. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/CommitmentSecret.ts.html +203 -0
  59. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/CommitmentSecretStore.ts.html +332 -0
  60. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/Htlc.ts.html +236 -0
  61. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/HtlcDirection.ts.html +131 -0
  62. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/ScriptFactory.ts.html +530 -0
  63. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/TxFactory.ts.html +1094 -0
  64. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/lightning/index.html +231 -0
  65. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/utils/BigIntUtils.ts.html +272 -0
  66. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/utils/Precision.ts.html +149 -0
  67. package/.yalc/@node-dlc/core/coverage/lcov-report/lib/utils/index.html +126 -0
  68. package/.yalc/@node-dlc/core/coverage/lcov-report/prettify.css +1 -0
  69. package/.yalc/@node-dlc/core/coverage/lcov-report/prettify.js +2 -0
  70. package/.yalc/@node-dlc/core/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  71. package/.yalc/@node-dlc/core/coverage/lcov-report/sorter.js +170 -0
  72. package/.yalc/@node-dlc/core/coverage/lcov.info +2426 -0
  73. package/.yalc/@node-dlc/core/dist/AsyncProcessingQueue.d.ts +22 -0
  74. package/.yalc/@node-dlc/core/dist/AsyncProcessingQueue.js +55 -0
  75. package/.yalc/@node-dlc/core/dist/AsyncProcessingQueue.js.map +1 -0
  76. package/.yalc/@node-dlc/core/dist/Base32.d.ts +1 -0
  77. package/.yalc/@node-dlc/core/dist/Base32.js +7 -0
  78. package/.yalc/@node-dlc/core/dist/Base32.js.map +1 -0
  79. package/.yalc/@node-dlc/core/dist/BigIntUtils.d.ts +1 -0
  80. package/.yalc/@node-dlc/core/dist/BigIntUtils.js +8 -0
  81. package/.yalc/@node-dlc/core/dist/BigIntUtils.js.map +1 -0
  82. package/.yalc/@node-dlc/core/dist/BitField.d.ts +1 -0
  83. package/.yalc/@node-dlc/core/dist/BitField.js +7 -0
  84. package/.yalc/@node-dlc/core/dist/BitField.js.map +1 -0
  85. package/.yalc/@node-dlc/core/dist/ChannelId.d.ts +1 -0
  86. package/.yalc/@node-dlc/core/dist/ChannelId.js +7 -0
  87. package/.yalc/@node-dlc/core/dist/ChannelId.js.map +1 -0
  88. package/.yalc/@node-dlc/core/dist/LinkedList.d.ts +30 -0
  89. package/.yalc/@node-dlc/core/dist/LinkedList.js +104 -0
  90. package/.yalc/@node-dlc/core/dist/LinkedList.js.map +1 -0
  91. package/.yalc/@node-dlc/core/dist/LinkedListNode.d.ts +9 -0
  92. package/.yalc/@node-dlc/core/dist/LinkedListNode.js +15 -0
  93. package/.yalc/@node-dlc/core/dist/LinkedListNode.js.map +1 -0
  94. package/.yalc/@node-dlc/core/dist/Queue.d.ts +22 -0
  95. package/.yalc/@node-dlc/core/dist/Queue.js +38 -0
  96. package/.yalc/@node-dlc/core/dist/Queue.js.map +1 -0
  97. package/.yalc/@node-dlc/core/dist/ShortChannelId.d.ts +1 -0
  98. package/.yalc/@node-dlc/core/dist/ShortChannelId.js +7 -0
  99. package/.yalc/@node-dlc/core/dist/ShortChannelId.js.map +1 -0
  100. package/.yalc/@node-dlc/core/dist/ShortChannelIdUtils.d.ts +1 -0
  101. package/.yalc/@node-dlc/core/dist/ShortChannelIdUtils.js +12 -0
  102. package/.yalc/@node-dlc/core/dist/ShortChannelIdUtils.js.map +1 -0
  103. package/.yalc/@node-dlc/core/dist/dlc/CETCalculator.d.ts +50 -0
  104. package/.yalc/@node-dlc/core/dist/dlc/CETCalculator.js +332 -0
  105. package/.yalc/@node-dlc/core/dist/dlc/CETCalculator.js.map +1 -0
  106. package/.yalc/@node-dlc/core/dist/dlc/CoinSelect.d.ts +23 -0
  107. package/.yalc/@node-dlc/core/dist/dlc/CoinSelect.js +77 -0
  108. package/.yalc/@node-dlc/core/dist/dlc/CoinSelect.js.map +1 -0
  109. package/.yalc/@node-dlc/core/dist/dlc/HyperbolaPayoutCurve.d.ts +20 -0
  110. package/.yalc/@node-dlc/core/dist/dlc/HyperbolaPayoutCurve.js +117 -0
  111. package/.yalc/@node-dlc/core/dist/dlc/HyperbolaPayoutCurve.js.map +1 -0
  112. package/.yalc/@node-dlc/core/dist/dlc/PayoutCurve.d.ts +5 -0
  113. package/.yalc/@node-dlc/core/dist/dlc/PayoutCurve.js +3 -0
  114. package/.yalc/@node-dlc/core/dist/dlc/PayoutCurve.js.map +1 -0
  115. package/.yalc/@node-dlc/core/dist/dlc/PolynomialPayoutCurve.d.ts +52 -0
  116. package/.yalc/@node-dlc/core/dist/dlc/PolynomialPayoutCurve.js +173 -0
  117. package/.yalc/@node-dlc/core/dist/dlc/PolynomialPayoutCurve.js.map +1 -0
  118. package/.yalc/@node-dlc/core/dist/dlc/TxBuilder.d.ts +55 -0
  119. package/.yalc/@node-dlc/core/dist/dlc/TxBuilder.js +217 -0
  120. package/.yalc/@node-dlc/core/dist/dlc/TxBuilder.js.map +1 -0
  121. package/.yalc/@node-dlc/core/dist/dlc/TxFinalizer.d.ts +40 -0
  122. package/.yalc/@node-dlc/core/dist/dlc/TxFinalizer.js +146 -0
  123. package/.yalc/@node-dlc/core/dist/dlc/TxFinalizer.js.map +1 -0
  124. package/.yalc/@node-dlc/core/dist/dlc/finance/Builder.d.ts +193 -0
  125. package/.yalc/@node-dlc/core/dist/dlc/finance/Builder.js +422 -0
  126. package/.yalc/@node-dlc/core/dist/dlc/finance/Builder.js.map +1 -0
  127. package/.yalc/@node-dlc/core/dist/dlc/finance/CoveredCall.d.ts +13 -0
  128. package/.yalc/@node-dlc/core/dist/dlc/finance/CoveredCall.js +67 -0
  129. package/.yalc/@node-dlc/core/dist/dlc/finance/CoveredCall.js.map +1 -0
  130. package/.yalc/@node-dlc/core/dist/dlc/finance/CsoInfo.d.ts +114 -0
  131. package/.yalc/@node-dlc/core/dist/dlc/finance/CsoInfo.js +290 -0
  132. package/.yalc/@node-dlc/core/dist/dlc/finance/CsoInfo.js.map +1 -0
  133. package/.yalc/@node-dlc/core/dist/dlc/finance/LinearPayout.d.ts +6 -0
  134. package/.yalc/@node-dlc/core/dist/dlc/finance/LinearPayout.js +79 -0
  135. package/.yalc/@node-dlc/core/dist/dlc/finance/LinearPayout.js.map +1 -0
  136. package/.yalc/@node-dlc/core/dist/dlc/finance/LongCall.d.ts +13 -0
  137. package/.yalc/@node-dlc/core/dist/dlc/finance/LongCall.js +47 -0
  138. package/.yalc/@node-dlc/core/dist/dlc/finance/LongCall.js.map +1 -0
  139. package/.yalc/@node-dlc/core/dist/dlc/finance/LongPut.d.ts +13 -0
  140. package/.yalc/@node-dlc/core/dist/dlc/finance/LongPut.js +47 -0
  141. package/.yalc/@node-dlc/core/dist/dlc/finance/LongPut.js.map +1 -0
  142. package/.yalc/@node-dlc/core/dist/dlc/finance/OptionInfo.d.ts +20 -0
  143. package/.yalc/@node-dlc/core/dist/dlc/finance/OptionInfo.js +101 -0
  144. package/.yalc/@node-dlc/core/dist/dlc/finance/OptionInfo.js.map +1 -0
  145. package/.yalc/@node-dlc/core/dist/dlc/finance/ShortPut.d.ts +12 -0
  146. package/.yalc/@node-dlc/core/dist/dlc/finance/ShortPut.js +46 -0
  147. package/.yalc/@node-dlc/core/dist/dlc/finance/ShortPut.js.map +1 -0
  148. package/.yalc/@node-dlc/core/dist/index.d.ts +39 -0
  149. package/.yalc/@node-dlc/core/dist/index.js +78 -0
  150. package/.yalc/@node-dlc/core/dist/index.js.map +1 -0
  151. package/.yalc/@node-dlc/core/dist/lightning/ChannelId.d.ts +31 -0
  152. package/.yalc/@node-dlc/core/dist/lightning/ChannelId.js +52 -0
  153. package/.yalc/@node-dlc/core/dist/lightning/ChannelId.js.map +1 -0
  154. package/.yalc/@node-dlc/core/dist/lightning/ChannelKeys.d.ts +55 -0
  155. package/.yalc/@node-dlc/core/dist/lightning/ChannelKeys.js +105 -0
  156. package/.yalc/@node-dlc/core/dist/lightning/ChannelKeys.js.map +1 -0
  157. package/.yalc/@node-dlc/core/dist/lightning/CommitmentNumber.d.ts +55 -0
  158. package/.yalc/@node-dlc/core/dist/lightning/CommitmentNumber.js +76 -0
  159. package/.yalc/@node-dlc/core/dist/lightning/CommitmentNumber.js.map +1 -0
  160. package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecret.d.ts +26 -0
  161. package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecret.js +44 -0
  162. package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecret.js.map +1 -0
  163. package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecretStore.d.ts +41 -0
  164. package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecretStore.js +79 -0
  165. package/.yalc/@node-dlc/core/dist/lightning/CommitmentSecretStore.js.map +1 -0
  166. package/.yalc/@node-dlc/core/dist/lightning/Htlc.d.ts +46 -0
  167. package/.yalc/@node-dlc/core/dist/lightning/Htlc.js +46 -0
  168. package/.yalc/@node-dlc/core/dist/lightning/Htlc.js.map +1 -0
  169. package/.yalc/@node-dlc/core/dist/lightning/HtlcDirection.d.ts +16 -0
  170. package/.yalc/@node-dlc/core/dist/lightning/HtlcDirection.js +21 -0
  171. package/.yalc/@node-dlc/core/dist/lightning/HtlcDirection.js.map +1 -0
  172. package/.yalc/@node-dlc/core/dist/lightning/ScriptFactory.d.ts +76 -0
  173. package/.yalc/@node-dlc/core/dist/lightning/ScriptFactory.js +102 -0
  174. package/.yalc/@node-dlc/core/dist/lightning/ScriptFactory.js.map +1 -0
  175. package/.yalc/@node-dlc/core/dist/lightning/TxFactory.d.ts +83 -0
  176. package/.yalc/@node-dlc/core/dist/lightning/TxFactory.js +222 -0
  177. package/.yalc/@node-dlc/core/dist/lightning/TxFactory.js.map +1 -0
  178. package/.yalc/@node-dlc/core/dist/utils/BigIntUtils.d.ts +9 -0
  179. package/.yalc/@node-dlc/core/dist/utils/BigIntUtils.js +59 -0
  180. package/.yalc/@node-dlc/core/dist/utils/BigIntUtils.js.map +1 -0
  181. package/.yalc/@node-dlc/core/dist/utils/Precision.d.ts +13 -0
  182. package/.yalc/@node-dlc/core/dist/utils/Precision.js +28 -0
  183. package/.yalc/@node-dlc/core/dist/utils/Precision.js.map +1 -0
  184. package/.yalc/@node-dlc/core/lib/AsyncProcessingQueue.ts +63 -0
  185. package/.yalc/@node-dlc/core/lib/Base32.ts +2 -0
  186. package/.yalc/@node-dlc/core/lib/BigIntUtils.ts +2 -0
  187. package/.yalc/@node-dlc/core/lib/BitField.ts +2 -0
  188. package/.yalc/@node-dlc/core/lib/ChannelId.ts +2 -0
  189. package/.yalc/@node-dlc/core/lib/LinkedList.ts +111 -0
  190. package/.yalc/@node-dlc/core/lib/LinkedListNode.ts +14 -0
  191. package/.yalc/@node-dlc/core/lib/Queue.ts +36 -0
  192. package/.yalc/@node-dlc/core/lib/ShortChannelId.ts +2 -0
  193. package/.yalc/@node-dlc/core/lib/ShortChannelIdUtils.ts +9 -0
  194. package/.yalc/@node-dlc/core/lib/dlc/CETCalculator.ts +450 -0
  195. package/.yalc/@node-dlc/core/lib/dlc/CoinSelect.ts +117 -0
  196. package/.yalc/@node-dlc/core/lib/dlc/HyperbolaPayoutCurve.ts +188 -0
  197. package/.yalc/@node-dlc/core/lib/dlc/PayoutCurve.ts +6 -0
  198. package/.yalc/@node-dlc/core/lib/dlc/PolynomialPayoutCurve.ts +266 -0
  199. package/.yalc/@node-dlc/core/lib/dlc/TxBuilder.ts +336 -0
  200. package/.yalc/@node-dlc/core/lib/dlc/TxFinalizer.ts +217 -0
  201. package/.yalc/@node-dlc/core/lib/dlc/finance/Builder.ts +730 -0
  202. package/.yalc/@node-dlc/core/lib/dlc/finance/CoveredCall.ts +110 -0
  203. package/.yalc/@node-dlc/core/lib/dlc/finance/CsoInfo.ts +498 -0
  204. package/.yalc/@node-dlc/core/lib/dlc/finance/LinearPayout.ts +94 -0
  205. package/.yalc/@node-dlc/core/lib/dlc/finance/LongCall.ts +74 -0
  206. package/.yalc/@node-dlc/core/lib/dlc/finance/LongPut.ts +74 -0
  207. package/.yalc/@node-dlc/core/lib/dlc/finance/OptionInfo.ts +182 -0
  208. package/.yalc/@node-dlc/core/lib/dlc/finance/ShortPut.ts +75 -0
  209. package/.yalc/@node-dlc/core/lib/index.ts +66 -0
  210. package/.yalc/@node-dlc/core/lib/lightning/ChannelId.ts +54 -0
  211. package/.yalc/@node-dlc/core/lib/lightning/ChannelKeys.ts +109 -0
  212. package/.yalc/@node-dlc/core/lib/lightning/CommitmentNumber.ts +94 -0
  213. package/.yalc/@node-dlc/core/lib/lightning/CommitmentSecret.ts +41 -0
  214. package/.yalc/@node-dlc/core/lib/lightning/CommitmentSecretStore.ts +84 -0
  215. package/.yalc/@node-dlc/core/lib/lightning/Htlc.ts +52 -0
  216. package/.yalc/@node-dlc/core/lib/lightning/HtlcDirection.ts +17 -0
  217. package/.yalc/@node-dlc/core/lib/lightning/ScriptFactory.ts +150 -0
  218. package/.yalc/@node-dlc/core/lib/lightning/TxFactory.ts +338 -0
  219. package/.yalc/@node-dlc/core/lib/utils/BigIntUtils.ts +64 -0
  220. package/.yalc/@node-dlc/core/lib/utils/Precision.ts +23 -0
  221. package/.yalc/@node-dlc/core/package.json +38 -0
  222. package/.yalc/@node-dlc/core/tsconfig.json +8 -0
  223. package/.yalc/@node-dlc/core/yalc.sig +1 -0
  224. package/CHANGELOG.md +11 -0
  225. package/package.json +6 -6
  226. package/yalc.lock +10 -0
@@ -0,0 +1,22 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ /**
4
+ * Serializes execution of events. This class is constructed with
5
+ * a delegate function that is executed for each item that is enqueued.
6
+ */
7
+ export declare class AsyncProcessingQueue<T> extends EventEmitter {
8
+ private _fn;
9
+ private _queue;
10
+ private _flushHandle;
11
+ constructor(fn: (...args: T[]) => Promise<void>);
12
+ /**
13
+ * Adds a new item to the processing queue
14
+ */
15
+ enqueue(value: T): void;
16
+ /**
17
+ * Gets the number of pending items in the processor queue
18
+ * @type {number}
19
+ */
20
+ get size(): number;
21
+ private _flush;
22
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncProcessingQueue = void 0;
4
+ const events_1 = require("events");
5
+ const Queue_1 = require("./Queue");
6
+ /**
7
+ * Serializes execution of events. This class is constructed with
8
+ * a delegate function that is executed for each item that is enqueued.
9
+ */
10
+ class AsyncProcessingQueue extends events_1.EventEmitter {
11
+ constructor(fn) {
12
+ super();
13
+ this._fn = fn;
14
+ this._queue = new Queue_1.Queue();
15
+ this._flush = this._flush.bind(this);
16
+ }
17
+ /**
18
+ * Adds a new item to the processing queue
19
+ */
20
+ enqueue(value) {
21
+ this._queue.enqueue(value);
22
+ // Postpone flushing until end of event loop to allow multiple operations
23
+ // to enqueue. This handle will be cleared once flushing has completed.
24
+ if (!this._flushHandle)
25
+ this._flushHandle = setImmediate(this._flush);
26
+ }
27
+ /**
28
+ * Gets the number of pending items in the processor queue
29
+ * @type {number}
30
+ */
31
+ get size() {
32
+ return this._queue.length;
33
+ }
34
+ async _flush() {
35
+ // emit that flushing is starting
36
+ this.emit('flushing');
37
+ // process all items on the queue, even items that
38
+ // are added to the queue while flushing is occuring
39
+ while (this._queue.length > 0) {
40
+ try {
41
+ const value = this._queue.dequeue();
42
+ await this._fn(value);
43
+ }
44
+ catch (ex) {
45
+ this.emit('error', ex);
46
+ }
47
+ }
48
+ // emit flushing has completed
49
+ this.emit('flushed');
50
+ // clear flush handle so that next enqueue will trigger a flush
51
+ this._flushHandle = undefined;
52
+ }
53
+ }
54
+ exports.AsyncProcessingQueue = AsyncProcessingQueue;
55
+ //# sourceMappingURL=AsyncProcessingQueue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncProcessingQueue.js","sourceRoot":"","sources":["../lib/AsyncProcessingQueue.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAEtC,mCAAgC;AAEhC;;;GAGG;AACH,MAAa,oBAAwB,SAAQ,qBAAY;IAOvD,YAAY,EAAmC;QAC7C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,IAAI,aAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACI,OAAO,CAAC,KAAQ;QACrB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE3B,yEAAyE;QACzE,uEAAuE;QACvE,IAAI,CAAC,IAAI,CAAC,YAAY;YAAE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxE,CAAC;IAED;;;OAGG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAEO,KAAK,CAAC,MAAM;QAClB,iCAAiC;QACjC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEtB,kDAAkD;QAClD,oDAAoD;QACpD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7B,IAAI;gBACF,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpC,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;aACvB;YAAC,OAAO,EAAE,EAAE;gBACX,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;aACxB;SACF;QAED,8BAA8B;QAC9B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAErB,+DAA+D;QAC/D,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;IAChC,CAAC;CACF;AAtDD,oDAsDC"}
@@ -0,0 +1 @@
1
+ export { Base32 } from '@node-dlc/common';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Base32 = void 0;
4
+ // Re-export Base32 from common package to maintain backward compatibility
5
+ var common_1 = require("@node-dlc/common");
6
+ Object.defineProperty(exports, "Base32", { enumerable: true, get: function () { return common_1.Base32; } });
7
+ //# sourceMappingURL=Base32.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Base32.js","sourceRoot":"","sources":["../lib/Base32.ts"],"names":[],"mappings":";;;AAAA,0EAA0E;AAC1E,2CAA0C;AAAjC,gGAAA,MAAM,OAAA"}
@@ -0,0 +1 @@
1
+ export { bigintToBuffer, calcBytes } from '@node-dlc/common';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calcBytes = exports.bigintToBuffer = void 0;
4
+ // Re-export BigIntUtils functions from common package to maintain backward compatibility
5
+ var common_1 = require("@node-dlc/common");
6
+ Object.defineProperty(exports, "bigintToBuffer", { enumerable: true, get: function () { return common_1.bigintToBuffer; } });
7
+ Object.defineProperty(exports, "calcBytes", { enumerable: true, get: function () { return common_1.calcBytes; } });
8
+ //# sourceMappingURL=BigIntUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BigIntUtils.js","sourceRoot":"","sources":["../lib/BigIntUtils.ts"],"names":[],"mappings":";;;AAAA,yFAAyF;AACzF,2CAA6D;AAApD,wGAAA,cAAc,OAAA;AAAE,mGAAA,SAAS,OAAA"}
@@ -0,0 +1 @@
1
+ export { BitField } from '@node-dlc/common';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BitField = void 0;
4
+ // Re-export BitField from common package to maintain backward compatibility
5
+ var common_1 = require("@node-dlc/common");
6
+ Object.defineProperty(exports, "BitField", { enumerable: true, get: function () { return common_1.BitField; } });
7
+ //# sourceMappingURL=BitField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BitField.js","sourceRoot":"","sources":["../lib/BitField.ts"],"names":[],"mappings":";;;AAAA,4EAA4E;AAC5E,2CAA4C;AAAnC,kGAAA,QAAQ,OAAA"}
@@ -0,0 +1 @@
1
+ export { ChannelId } from '@node-dlc/common';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChannelId = void 0;
4
+ // Re-export ChannelId from common package to maintain backward compatibility
5
+ var common_1 = require("@node-dlc/common");
6
+ Object.defineProperty(exports, "ChannelId", { enumerable: true, get: function () { return common_1.ChannelId; } });
7
+ //# sourceMappingURL=ChannelId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChannelId.js","sourceRoot":"","sources":["../lib/ChannelId.ts"],"names":[],"mappings":";;;AAAA,6EAA6E;AAC7E,2CAA6C;AAApC,mGAAA,SAAS,OAAA"}
@@ -0,0 +1,30 @@
1
+ import { LinkedListNode } from './LinkedListNode';
2
+ /**
3
+ * Implementation of a doubly linked-list that maintains both head and tail.
4
+ * Tail maintenance allows for O(1) insertions at tail
5
+ */
6
+ export declare class LinkedList<T> {
7
+ length: number;
8
+ head: LinkedListNode<T>;
9
+ tail: LinkedListNode<T>;
10
+ /**
11
+ * Adds a node to the end of a linked List
12
+ * @param T value
13
+ * @returns {LinkedListNode}
14
+ */
15
+ add(value: T): LinkedListNode<T>;
16
+ /**
17
+ * Finds the node at a specific position
18
+ */
19
+ valueAt(index: number): T;
20
+ /**
21
+ * Finds the node for the index or throws an out of range exception
22
+ */
23
+ nodeAt(index: number): LinkedListNode<T>;
24
+ /**
25
+ * Removes the node at the index and returns its value.
26
+ * Head or tail removal is an O(1) operation. For removal of other indexes
27
+ * is at worst O(N).
28
+ */
29
+ remove(index: number): T;
30
+ }
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LinkedList = void 0;
4
+ const LinkedListNode_1 = require("./LinkedListNode");
5
+ /**
6
+ * Implementation of a doubly linked-list that maintains both head and tail.
7
+ * Tail maintenance allows for O(1) insertions at tail
8
+ */
9
+ class LinkedList {
10
+ constructor() {
11
+ this.length = 0;
12
+ this.head = null;
13
+ this.tail = null;
14
+ }
15
+ /**
16
+ * Adds a node to the end of a linked List
17
+ * @param T value
18
+ * @returns {LinkedListNode}
19
+ */
20
+ add(value) {
21
+ const node = new LinkedListNode_1.LinkedListNode(value);
22
+ // when empty list
23
+ if (!this.head) {
24
+ this.head = node;
25
+ this.tail = node;
26
+ this.length++;
27
+ return node;
28
+ }
29
+ // non-empty, append to tail
30
+ node.prev = this.tail;
31
+ this.tail.next = node;
32
+ this.tail = node;
33
+ this.length++;
34
+ return node;
35
+ }
36
+ /**
37
+ * Finds the node at a specific position
38
+ */
39
+ valueAt(index) {
40
+ const node = this.nodeAt(index);
41
+ if (node)
42
+ return node.value;
43
+ }
44
+ /**
45
+ * Finds the node for the index or throws an out of range exception
46
+ */
47
+ nodeAt(index) {
48
+ // error when index out of range
49
+ if (index < 0 || index > this.length) {
50
+ throw new RangeError('Index out of range');
51
+ }
52
+ // seek until index is found
53
+ let currentNode = this.head;
54
+ let count = 0;
55
+ while (count < index) {
56
+ currentNode = currentNode.next;
57
+ count++;
58
+ }
59
+ return currentNode;
60
+ }
61
+ /**
62
+ * Removes the node at the index and returns its value.
63
+ * Head or tail removal is an O(1) operation. For removal of other indexes
64
+ * is at worst O(N).
65
+ */
66
+ remove(index) {
67
+ // error when index out of range
68
+ if (index < 0 || index > this.length) {
69
+ throw new RangeError('Index out of range');
70
+ }
71
+ let removeNode;
72
+ let prevNode = null;
73
+ let nextNode = null;
74
+ // first node simply removes the node at the tip
75
+ if (index === 0) {
76
+ removeNode = this.head;
77
+ nextNode = this.head.next;
78
+ // adjust head
79
+ this.head = nextNode;
80
+ }
81
+ // last node, update the tail and mark next as null
82
+ if (index === this.length - 1) {
83
+ removeNode = this.tail;
84
+ prevNode = this.tail.prev;
85
+ // adjust tail
86
+ this.tail = prevNode;
87
+ }
88
+ // middle node
89
+ if (!removeNode) {
90
+ removeNode = this.nodeAt(index);
91
+ prevNode = removeNode.prev;
92
+ nextNode = removeNode.next;
93
+ }
94
+ // splice out the node afer null checking
95
+ if (prevNode)
96
+ prevNode.next = nextNode;
97
+ if (nextNode)
98
+ nextNode.prev = prevNode;
99
+ this.length--;
100
+ return removeNode.value;
101
+ }
102
+ }
103
+ exports.LinkedList = LinkedList;
104
+ //# sourceMappingURL=LinkedList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkedList.js","sourceRoot":"","sources":["../lib/LinkedList.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,9 @@
1
+ export declare class LinkedListNode<T> {
2
+ value: T;
3
+ prev: LinkedListNode<T>;
4
+ next: LinkedListNode<T>;
5
+ /**
6
+ * Creates a linked list node with the specified data
7
+ */
8
+ constructor(value: T);
9
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LinkedListNode = void 0;
4
+ class LinkedListNode {
5
+ /**
6
+ * Creates a linked list node with the specified data
7
+ */
8
+ constructor(value) {
9
+ this.value = value;
10
+ this.prev = null;
11
+ this.next = null;
12
+ }
13
+ }
14
+ exports.LinkedListNode = LinkedListNode;
15
+ //# sourceMappingURL=LinkedListNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkedListNode.js","sourceRoot":"","sources":["../lib/LinkedListNode.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IAKzB;;OAEG;IACH,YAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAbD,wCAaC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * FIFO queue implemented with O(1) enqueue and dequeue operations
3
+ */
4
+ export declare class Queue<T> {
5
+ private _list;
6
+ /**
7
+ * Peak the tip value
8
+ */
9
+ peak(): T;
10
+ /**
11
+ * Returns the length of the queue
12
+ */
13
+ get length(): number;
14
+ /**
15
+ * Enqueue a value
16
+ */
17
+ enqueue(value: T): void;
18
+ /**
19
+ * Dequeue top most value
20
+ */
21
+ dequeue(): T;
22
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Queue = void 0;
4
+ const LinkedList_1 = require("./LinkedList");
5
+ /**
6
+ * FIFO queue implemented with O(1) enqueue and dequeue operations
7
+ */
8
+ class Queue {
9
+ constructor() {
10
+ this._list = new LinkedList_1.LinkedList();
11
+ }
12
+ /**
13
+ * Peak the tip value
14
+ */
15
+ peak() {
16
+ return this._list.head && this._list.head.value;
17
+ }
18
+ /**
19
+ * Returns the length of the queue
20
+ */
21
+ get length() {
22
+ return this._list.length;
23
+ }
24
+ /**
25
+ * Enqueue a value
26
+ */
27
+ enqueue(value) {
28
+ this._list.add(value);
29
+ }
30
+ /**
31
+ * Dequeue top most value
32
+ */
33
+ dequeue() {
34
+ return this._list.remove(0);
35
+ }
36
+ }
37
+ exports.Queue = Queue;
38
+ //# sourceMappingURL=Queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Queue.js","sourceRoot":"","sources":["../lib/Queue.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAE1C;;GAEG;AACH,MAAa,KAAK;IAAlB;QACU,UAAK,GAAkB,IAAI,uBAAU,EAAK,CAAC;IA6BrD,CAAC;IA3BC;;OAEG;IACI,IAAI;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED;;OAEG;IACI,OAAO,CAAC,KAAQ;QACrB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;CACF;AA9BD,sBA8BC"}
@@ -0,0 +1 @@
1
+ export { ShortChannelId } from '@node-dlc/common';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShortChannelId = void 0;
4
+ // Re-export ShortChannelId from common package to maintain backward compatibility
5
+ var common_1 = require("@node-dlc/common");
6
+ Object.defineProperty(exports, "ShortChannelId", { enumerable: true, get: function () { return common_1.ShortChannelId; } });
7
+ //# sourceMappingURL=ShortChannelId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShortChannelId.js","sourceRoot":"","sources":["../lib/ShortChannelId.ts"],"names":[],"mappings":";;;AAAA,kFAAkF;AAClF,2CAAkD;AAAzC,wGAAA,cAAc,OAAA"}
@@ -0,0 +1 @@
1
+ export { shortChannelIdFromBuffer, shortChannelIdFromNumber, shortChannelIdFromString, shortChannelIdToBuffer, shortChannelIdToNumber, shortChannelIdToString, } from '@node-dlc/common';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shortChannelIdToString = exports.shortChannelIdToNumber = exports.shortChannelIdToBuffer = exports.shortChannelIdFromString = exports.shortChannelIdFromNumber = exports.shortChannelIdFromBuffer = void 0;
4
+ // Re-export ShortChannelId utilities from common package to maintain backward compatibility
5
+ var common_1 = require("@node-dlc/common");
6
+ Object.defineProperty(exports, "shortChannelIdFromBuffer", { enumerable: true, get: function () { return common_1.shortChannelIdFromBuffer; } });
7
+ Object.defineProperty(exports, "shortChannelIdFromNumber", { enumerable: true, get: function () { return common_1.shortChannelIdFromNumber; } });
8
+ Object.defineProperty(exports, "shortChannelIdFromString", { enumerable: true, get: function () { return common_1.shortChannelIdFromString; } });
9
+ Object.defineProperty(exports, "shortChannelIdToBuffer", { enumerable: true, get: function () { return common_1.shortChannelIdToBuffer; } });
10
+ Object.defineProperty(exports, "shortChannelIdToNumber", { enumerable: true, get: function () { return common_1.shortChannelIdToNumber; } });
11
+ Object.defineProperty(exports, "shortChannelIdToString", { enumerable: true, get: function () { return common_1.shortChannelIdToString; } });
12
+ //# sourceMappingURL=ShortChannelIdUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShortChannelIdUtils.js","sourceRoot":"","sources":["../lib/ShortChannelIdUtils.ts"],"names":[],"mappings":";;;AAAA,4FAA4F;AAC5F,2CAO0B;AANxB,kHAAA,wBAAwB,OAAA;AACxB,kHAAA,wBAAwB,OAAA;AACxB,kHAAA,wBAAwB,OAAA;AACxB,gHAAA,sBAAsB,OAAA;AACtB,gHAAA,sBAAsB,OAAA;AACtB,gHAAA,sBAAsB,OAAA"}
@@ -0,0 +1,50 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { HyperbolaPayoutCurve } from './HyperbolaPayoutCurve';
3
+ import { PolynomialPayoutCurve } from './PolynomialPayoutCurve';
4
+ export declare function zipWithIndex<T>(arr: T[]): [T, number][];
5
+ export declare function dropUntil<T>(data: T[], check: (_: T) => boolean): T[];
6
+ export declare function decompose(num: bigint, base: number, numDigits: number): number[];
7
+ export declare function separatePrefix(start: bigint, end: bigint, base: number, numDigits: number): {
8
+ prefixDigits: number[];
9
+ startDigits: number[];
10
+ endDigits: number[];
11
+ };
12
+ export declare function frontGroupings(digits: number[], base: number): number[][];
13
+ export declare function backGroupings(digits: number[], base: number): number[][];
14
+ export declare function middleGroupings(firstDigitStart: number, firstDigitEnd: number): number[][];
15
+ export declare function groupByIgnoringDigits(start: bigint, end: bigint, base: number, numDigits: number): number[][];
16
+ export interface RoundingInterval {
17
+ beginInterval: bigint;
18
+ roundingMod: bigint;
19
+ }
20
+ export type CETPayout = {
21
+ indexFrom: bigint;
22
+ indexTo: bigint;
23
+ payout: bigint;
24
+ };
25
+ /**
26
+ * Performs optimized evaluation and rounding for strictly monotonic hyperbolas on intervals (from, to)
27
+ * e.g. hyperbolas with the form b = c = 0
28
+ *
29
+ * The next start of a payout range is determined by finding the outcome at the next mid-rounding payout.
30
+ * Uses an inverse function of the hyperbola to find the outcome.
31
+ *
32
+ * Optimizes rounding from O(to - from) to O(totalCollateral / rounding)
33
+ *
34
+ *
35
+ * Evaluates and rounds a payout_function equivalent to:
36
+ *
37
+ * payout_function_v0
38
+ * num_pieces: 1
39
+ * endpoint_0: from
40
+ * endpoint_payout_0: fromPayout
41
+ * extra_precision_0: 0
42
+ * payout_curve_piece: HyperbolaPayoutCurve
43
+ * endpoint_1: to
44
+ * endpoint_payout_1: toPayout
45
+ */
46
+ export declare function splitIntoRanges(from: bigint, to: bigint, fromPayout: bigint, // endpoint_payout
47
+ toPayout: bigint, // endpoint_payout
48
+ totalCollateral: bigint, curve: HyperbolaPayoutCurve | PolynomialPayoutCurve, roundingIntervals: RoundingInterval[]): CETPayout[];
49
+ export declare const mergePayouts: (payouts: CETPayout[]) => CETPayout[];
50
+ export declare function roundPayout(payout: BigNumber, rounding: bigint): bigint;