beignet 0.0.21 → 0.0.23

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 (273) hide show
  1. package/dist/electrum/index.js +105 -42
  2. package/dist/electrum/index.js.map +1 -1
  3. package/dist/types/electrum/index.d.ts +11 -4
  4. package/dist/types/electrum.js +8 -1
  5. package/dist/types/electrum.js.map +1 -1
  6. package/dist/types/types/electrum.d.ts +6 -0
  7. package/dist/types/types/transaction.d.ts +4 -0
  8. package/dist/types/types/wallet.d.ts +7 -1
  9. package/dist/types/utils/helpers.d.ts +2 -0
  10. package/dist/types/utils/wallet.d.ts +19 -1
  11. package/dist/types/wallet/constants.d.ts +0 -5
  12. package/dist/types/wallet/index.d.ts +14 -3
  13. package/dist/types/wallet.js.map +1 -1
  14. package/dist/utils/helpers.js +11 -1
  15. package/dist/utils/helpers.js.map +1 -1
  16. package/dist/utils/wallet.js +48 -1
  17. package/dist/utils/wallet.js.map +1 -1
  18. package/dist/wallet/constants.js +1 -7
  19. package/dist/wallet/constants.js.map +1 -1
  20. package/dist/wallet/index.js +181 -86
  21. package/dist/wallet/index.js.map +1 -1
  22. package/docs/html/assets/search.js +1 -1
  23. package/docs/html/classes/Electrum.html +79 -70
  24. package/docs/html/classes/Transaction.html +59 -28
  25. package/docs/html/classes/Wallet.html +224 -174
  26. package/docs/html/enums/EAddressType.html +22 -7
  27. package/docs/html/enums/EAvailableNetworks.html +19 -11
  28. package/docs/html/enums/EBoostType.html +14 -6
  29. package/docs/html/enums/EElectrumNetworks.html +15 -7
  30. package/docs/html/enums/EFeeId.html +17 -9
  31. package/docs/html/enums/EPaymentType.html +14 -6
  32. package/docs/html/enums/EProtocol.html +14 -6
  33. package/docs/html/enums/EUnit.html +15 -7
  34. package/docs/html/functions/availableNetworks.html +12 -4
  35. package/docs/html/functions/constructByteCountParam.html +12 -4
  36. package/docs/html/functions/decodeOpReturnMessage.html +12 -4
  37. package/docs/html/functions/decodeRawTransaction.html +12 -4
  38. package/docs/html/functions/err.html +12 -4
  39. package/docs/html/functions/formatKeyDerivationPath.html +12 -4
  40. package/docs/html/functions/formatPeerData.html +12 -4
  41. package/docs/html/functions/generateMnemonic.html +12 -4
  42. package/docs/html/functions/generateWalletId.html +12 -4
  43. package/docs/html/functions/getAddressFromKeyPair.html +222 -0
  44. package/docs/html/functions/getAddressFromScriptPubKey.html +12 -4
  45. package/docs/html/functions/getAddressTypeFromPath.html +12 -4
  46. package/docs/html/functions/getAddressesFromPrivateKey.html +222 -0
  47. package/docs/html/functions/getByteCount.html +12 -4
  48. package/docs/html/functions/getDataFallback.html +12 -4
  49. package/docs/html/functions/getDefaultPort.html +12 -4
  50. package/docs/html/functions/getDefaultWalletData.html +12 -4
  51. package/docs/html/functions/getDefaultWalletDataKeys.html +12 -4
  52. package/docs/html/functions/getElectrumNetwork.html +216 -0
  53. package/docs/html/functions/getHighestUsedIndexFromTxHashes.html +12 -4
  54. package/docs/html/functions/getKeyDerivationPath.html +12 -4
  55. package/docs/html/functions/getKeyDerivationPathObject.html +12 -4
  56. package/docs/html/functions/getKeyDerivationPathString.html +12 -4
  57. package/docs/html/functions/getKeyValue.html +12 -4
  58. package/docs/html/functions/getPeers.html +12 -4
  59. package/docs/html/functions/getProtocolForPort.html +12 -4
  60. package/docs/html/functions/getScriptHash.html +12 -4
  61. package/docs/html/functions/getSeed.html +12 -4
  62. package/docs/html/functions/getSeedHash.html +12 -4
  63. package/docs/html/functions/getSha256.html +12 -4
  64. package/docs/html/functions/getStorageKeyValues.html +12 -4
  65. package/docs/html/{variables/mostUsedExchangeTickers.html → functions/getTapRootAddressFromPublicKey.html} +74 -97
  66. package/docs/html/functions/getTxFee.html +12 -4
  67. package/docs/html/functions/getWalletDataStorageKey.html +12 -4
  68. package/docs/html/functions/isP2trPrefix.html +217 -0
  69. package/docs/html/functions/isValidBech32mEncodedString.html +12 -4
  70. package/docs/html/functions/objectKeys-1.html +12 -4
  71. package/docs/html/functions/objectsMatch.html +12 -4
  72. package/docs/html/functions/ok.html +12 -4
  73. package/docs/html/functions/parseOnChainPaymentRequest.html +12 -4
  74. package/docs/html/functions/reduceValue.html +12 -4
  75. package/docs/html/functions/removeDustOutputs.html +12 -4
  76. package/docs/html/functions/setReplaceByFee.html +12 -4
  77. package/docs/html/functions/shuffleArray.html +12 -4
  78. package/docs/html/functions/{getExchangeRates.html → sleep.html} +22 -12
  79. package/docs/html/functions/validateAddress.html +12 -4
  80. package/docs/html/functions/validateMnemonic.html +12 -4
  81. package/docs/html/functions/validateTransaction.html +12 -4
  82. package/docs/html/index.html +22 -6
  83. package/docs/html/interfaces/IAddInput.html +16 -8
  84. package/docs/html/interfaces/IAddress.html +17 -9
  85. package/docs/html/interfaces/IAddressData.html +15 -7
  86. package/docs/html/interfaces/IAddressType.html +12 -4
  87. package/docs/html/interfaces/IAddressTypeData.html +18 -10
  88. package/docs/html/interfaces/IAddresses.html +12 -4
  89. package/docs/html/interfaces/IBoostedTransaction.html +16 -8
  90. package/docs/html/interfaces/IBoostedTransactions.html +12 -4
  91. package/docs/html/interfaces/ICreateTransaction.html +14 -6
  92. package/docs/html/interfaces/ICustomGetAddress.html +15 -7
  93. package/docs/html/interfaces/ICustomGetScriptHash.html +14 -6
  94. package/docs/html/interfaces/IElectrumGetAddressBalanceRes.html +15 -7
  95. package/docs/html/interfaces/IFormattedPeerData.html +17 -9
  96. package/docs/html/interfaces/IFormattedTransaction.html +31 -23
  97. package/docs/html/interfaces/IFormattedTransactions.html +12 -4
  98. package/docs/html/interfaces/IGenerateAddresses.html +19 -11
  99. package/docs/html/interfaces/IGenerateAddressesResponse.html +14 -6
  100. package/docs/html/interfaces/IGetAddress.html +15 -7
  101. package/docs/html/interfaces/IGetAddressBalanceRes.html +14 -6
  102. package/docs/html/interfaces/IGetAddressByPath.html +14 -6
  103. package/docs/html/interfaces/IGetAddressHistoryResponse.html +19 -11
  104. package/docs/html/interfaces/IGetAddressResponse.html +15 -7
  105. package/docs/html/interfaces/IGetAddressScriptHashBalances.html +17 -9
  106. package/docs/html/interfaces/IGetAddressScriptHashesHistoryResponse.html +17 -9
  107. package/docs/html/interfaces/{IExchangeRates.html → IGetAddressesFromKeyPair.html} +45 -23
  108. package/docs/html/interfaces/IGetAddressesFromPrivateKey.html +234 -0
  109. package/docs/html/interfaces/IGetDerivationPath.html +18 -10
  110. package/docs/html/interfaces/IGetFeeEstimatesResponse.html +16 -8
  111. package/docs/html/interfaces/IGetHeaderResponse.html +17 -9
  112. package/docs/html/interfaces/IGetNextAvailableAddressResponse.html +16 -8
  113. package/docs/html/interfaces/IGetTransactions.html +17 -9
  114. package/docs/html/interfaces/IGetTransactionsFromInputs.html +17 -9
  115. package/docs/html/interfaces/IGetUtxosResponse.html +14 -6
  116. package/docs/html/interfaces/IHeader.html +15 -7
  117. package/docs/html/interfaces/IIndexes.html +16 -8
  118. package/docs/html/interfaces/IKeyDerivationPath.html +17 -9
  119. package/docs/html/interfaces/IKeyDerivationPathData.html +14 -6
  120. package/docs/html/interfaces/INewBlock.html +14 -6
  121. package/docs/html/interfaces/IOnchainFees.html +17 -9
  122. package/docs/html/interfaces/IOutput.html +15 -7
  123. package/docs/html/interfaces/IPeerData.html +15 -7
  124. package/docs/html/interfaces/IPrivateKeyInfo.html +248 -0
  125. package/docs/html/interfaces/IRbfData.html +18 -10
  126. package/docs/html/interfaces/ISend.html +14 -6
  127. package/docs/html/interfaces/ISendTransaction.html +28 -20
  128. package/docs/html/interfaces/ISendTx.html +15 -7
  129. package/docs/html/interfaces/ISetupTransaction.html +17 -9
  130. package/docs/html/interfaces/ISubscribeToAddress.html +16 -8
  131. package/docs/html/interfaces/ISubscribeToHeader.html +16 -8
  132. package/docs/html/interfaces/ISweepPrivateKey.html +255 -0
  133. package/docs/html/interfaces/ISweepPrivateKeyRes.html +241 -0
  134. package/docs/html/interfaces/ITargets.html +16 -8
  135. package/docs/html/interfaces/ITransaction.html +17 -9
  136. package/docs/html/interfaces/ITxHash.html +13 -5
  137. package/docs/html/interfaces/ITxHashes.html +15 -7
  138. package/docs/html/interfaces/IUtxo.html +27 -21
  139. package/docs/html/interfaces/IVin.html +17 -9
  140. package/docs/html/interfaces/IVout.html +15 -7
  141. package/docs/html/interfaces/IWallet.html +53 -20
  142. package/docs/html/interfaces/IWalletData.html +30 -29
  143. package/docs/html/types/ElectrumConnectionPubSub.html +12 -4
  144. package/docs/html/types/ElectrumConnectionSubscription.html +13 -5
  145. package/docs/html/types/InputData.html +12 -4
  146. package/docs/html/types/ObjectKeys.html +12 -4
  147. package/docs/html/types/Result.html +12 -4
  148. package/docs/html/types/TAddressIndexInfo.html +12 -4
  149. package/docs/html/types/TAddressLabel.html +12 -4
  150. package/docs/html/types/TAddressType.html +12 -4
  151. package/docs/html/types/TAddressTypeContent.html +12 -4
  152. package/docs/html/types/TAddressTypes.html +12 -4
  153. package/docs/html/types/TAvailableNetworks.html +12 -4
  154. package/docs/html/types/TConnectToElectrumRes.html +12 -4
  155. package/docs/html/types/TDecodeRawTx.html +12 -4
  156. package/docs/html/types/TElectrumNetworks.html +12 -4
  157. package/docs/html/types/TGetAddressHistory.html +12 -4
  158. package/docs/html/types/TGetByteCountInput.html +12 -4
  159. package/docs/html/types/TGetByteCountInputs.html +12 -4
  160. package/docs/html/types/TGetByteCountOutput.html +12 -4
  161. package/docs/html/types/TGetByteCountOutputs.html +12 -4
  162. package/docs/html/types/TGetData.html +12 -4
  163. package/docs/html/types/TGetTotalFeeObj.html +12 -4
  164. package/docs/html/types/TKeyDerivationAccount.html +12 -4
  165. package/docs/html/types/TKeyDerivationChange.html +12 -4
  166. package/docs/html/types/TKeyDerivationCoinType.html +12 -4
  167. package/docs/html/types/TKeyDerivationIndex.html +12 -4
  168. package/docs/html/types/TKeyDerivationPurpose.html +12 -4
  169. package/docs/html/types/TMessageDataMap.html +12 -4
  170. package/docs/html/types/TMessageKeys.html +12 -4
  171. package/docs/html/types/TOnMessage.html +12 -4
  172. package/docs/html/types/TProcessUnconfirmedTransactions.html +12 -4
  173. package/docs/html/types/TProtocol.html +12 -4
  174. package/docs/html/types/TServer.html +12 -4
  175. package/docs/html/types/TSetData.html +12 -4
  176. package/docs/html/types/TSetupTransactionResponse.html +12 -4
  177. package/docs/html/types/TStorage.html +12 -4
  178. package/docs/html/types/TSubscribedReceive.html +12 -4
  179. package/docs/html/types/TTransactionMessage.html +12 -4
  180. package/docs/html/types/TTxResponse.html +12 -4
  181. package/docs/html/types/TTxResult.html +12 -4
  182. package/docs/html/types/TUnspentAddressScriptHashData.html +12 -4
  183. package/docs/html/types/TWalletDataKeys.html +12 -4
  184. package/docs/html/variables/defaultElectrumPorts.html +12 -4
  185. package/docs/html/variables/electrumConnection.html +12 -4
  186. package/docs/markdown/README.md +224 -128
  187. package/docs/markdown/classes/Electrum.md +74 -72
  188. package/docs/markdown/classes/Transaction.md +48 -23
  189. package/docs/markdown/classes/Wallet.md +240 -181
  190. package/docs/markdown/enums/EAddressType.md +14 -3
  191. package/docs/markdown/enums/EAvailableNetworks.md +7 -7
  192. package/docs/markdown/enums/EBoostType.md +2 -2
  193. package/docs/markdown/enums/EElectrumNetworks.md +3 -3
  194. package/docs/markdown/enums/EFeeId.md +5 -5
  195. package/docs/markdown/enums/EPaymentType.md +2 -2
  196. package/docs/markdown/enums/EProtocol.md +2 -2
  197. package/docs/markdown/enums/EUnit.md +3 -3
  198. package/docs/markdown/interfaces/IAddInput.md +4 -4
  199. package/docs/markdown/interfaces/IAddress.md +5 -5
  200. package/docs/markdown/interfaces/IAddressData.md +3 -3
  201. package/docs/markdown/interfaces/IAddressTypeData.md +6 -6
  202. package/docs/markdown/interfaces/IBoostedTransaction.md +4 -4
  203. package/docs/markdown/interfaces/ICreateTransaction.md +2 -2
  204. package/docs/markdown/interfaces/ICustomGetAddress.md +3 -3
  205. package/docs/markdown/interfaces/ICustomGetScriptHash.md +2 -2
  206. package/docs/markdown/interfaces/IElectrumGetAddressBalanceRes.md +3 -3
  207. package/docs/markdown/interfaces/IFormattedPeerData.md +5 -5
  208. package/docs/markdown/interfaces/IFormattedTransaction.md +19 -19
  209. package/docs/markdown/interfaces/IGenerateAddresses.md +7 -7
  210. package/docs/markdown/interfaces/IGenerateAddressesResponse.md +2 -2
  211. package/docs/markdown/interfaces/IGetAddress.md +3 -3
  212. package/docs/markdown/interfaces/IGetAddressBalanceRes.md +2 -2
  213. package/docs/markdown/interfaces/IGetAddressByPath.md +2 -2
  214. package/docs/markdown/interfaces/IGetAddressHistoryResponse.md +7 -7
  215. package/docs/markdown/interfaces/IGetAddressResponse.md +3 -3
  216. package/docs/markdown/interfaces/IGetAddressScriptHashBalances.md +5 -5
  217. package/docs/markdown/interfaces/IGetAddressScriptHashesHistoryResponse.md +5 -5
  218. package/docs/markdown/interfaces/IGetAddressesFromKeyPair.md +30 -0
  219. package/docs/markdown/interfaces/IGetAddressesFromPrivateKey.md +30 -0
  220. package/docs/markdown/interfaces/IGetDerivationPath.md +6 -6
  221. package/docs/markdown/interfaces/IGetFeeEstimatesResponse.md +4 -4
  222. package/docs/markdown/interfaces/IGetHeaderResponse.md +5 -5
  223. package/docs/markdown/interfaces/IGetNextAvailableAddressResponse.md +4 -4
  224. package/docs/markdown/interfaces/IGetTransactions.md +5 -5
  225. package/docs/markdown/interfaces/IGetTransactionsFromInputs.md +5 -5
  226. package/docs/markdown/interfaces/IGetUtxosResponse.md +2 -2
  227. package/docs/markdown/interfaces/IHeader.md +3 -3
  228. package/docs/markdown/interfaces/IIndexes.md +4 -4
  229. package/docs/markdown/interfaces/IKeyDerivationPath.md +5 -5
  230. package/docs/markdown/interfaces/IKeyDerivationPathData.md +2 -2
  231. package/docs/markdown/interfaces/INewBlock.md +2 -2
  232. package/docs/markdown/interfaces/IOnchainFees.md +5 -5
  233. package/docs/markdown/interfaces/IOutput.md +3 -3
  234. package/docs/markdown/interfaces/IPeerData.md +3 -3
  235. package/docs/markdown/interfaces/IPrivateKeyInfo.md +52 -0
  236. package/docs/markdown/interfaces/IRbfData.md +6 -6
  237. package/docs/markdown/interfaces/ISend.md +2 -2
  238. package/docs/markdown/interfaces/ISendTransaction.md +16 -16
  239. package/docs/markdown/interfaces/ISendTx.md +3 -3
  240. package/docs/markdown/interfaces/ISetupTransaction.md +5 -5
  241. package/docs/markdown/interfaces/ISubscribeToAddress.md +4 -4
  242. package/docs/markdown/interfaces/ISubscribeToHeader.md +4 -4
  243. package/docs/markdown/interfaces/ISweepPrivateKey.md +63 -0
  244. package/docs/markdown/interfaces/ISweepPrivateKeyRes.md +41 -0
  245. package/docs/markdown/interfaces/ITargets.md +4 -4
  246. package/docs/markdown/interfaces/ITransaction.md +5 -5
  247. package/docs/markdown/interfaces/ITxHash.md +1 -1
  248. package/docs/markdown/interfaces/ITxHashes.md +3 -3
  249. package/docs/markdown/interfaces/IUtxo.md +18 -23
  250. package/docs/markdown/interfaces/IVin.md +5 -5
  251. package/docs/markdown/interfaces/IVout.md +3 -3
  252. package/docs/markdown/interfaces/IWallet.md +50 -15
  253. package/docs/markdown/interfaces/IWalletData.md +18 -29
  254. package/package.json +3 -3
  255. package/src/electrum/index.ts +147 -60
  256. package/src/types/electrum.ts +7 -0
  257. package/src/types/transaction.ts +5 -0
  258. package/src/types/wallet.ts +7 -1
  259. package/src/utils/helpers.ts +14 -0
  260. package/src/utils/wallet.ts +73 -0
  261. package/src/wallet/constants.ts +0 -8
  262. package/src/wallet/index.ts +262 -118
  263. package/tests/wallet.test.ts +71 -1
  264. package/dist/mempool/index.js +0 -28
  265. package/dist/mempool/index.js.map +0 -1
  266. package/dist/types/mempool/index.d.ts +0 -15
  267. package/dist/types/mempool.js +0 -3
  268. package/dist/types/mempool.js.map +0 -1
  269. package/dist/types/types/mempool.d.ts +0 -16
  270. package/dist/types/utils/exchange-rate.d.ts +0 -30
  271. package/dist/utils/exchange-rate.js +0 -49
  272. package/dist/utils/exchange-rate.js.map +0 -1
  273. package/docs/markdown/interfaces/IExchangeRates.md +0 -7
@@ -1,9 +1,17 @@
1
1
  import * as chai from 'chai';
2
2
  import { validateMnemonic } from 'bip39';
3
- import { IAddress, IAddresses, Wallet } from '../';
3
+ import {
4
+ filterAddressesObjForGapLimit,
5
+ IAddress,
6
+ IAddresses,
7
+ Wallet
8
+ } from '../';
4
9
  import {
5
10
  EAddressType,
6
11
  EAvailableNetworks,
12
+ filterAddressesForGapLimit,
13
+ filterAddressesObjForSingleIndex,
14
+ filterAddressesObjForStartingIndex,
7
15
  generateMnemonic,
8
16
  IGetUtxosResponse,
9
17
  Result
@@ -219,6 +227,68 @@ describe('Wallet Library', async function () {
219
227
  expect(getUtxosRes.value).to.deep.equal(expectedResult);
220
228
  });
221
229
 
230
+ it('Should return addresses in range of the provided gap limit', async () => {
231
+ const gapLimitOptions = {
232
+ lookAhead: 2,
233
+ lookBehind: 2
234
+ };
235
+ const addressesObj = wallet.data.addresses[EAddressType.p2wpkh];
236
+ const addresses: IAddress[] = Object.values(addressesObj);
237
+ const index: number = wallet.data.addressIndex[EAddressType.p2wpkh].index;
238
+ expect(addresses.length).to.equal(25);
239
+ expect(index).to.equal(5);
240
+ expect(Math.min(...addresses.map((a) => a.index))).to.equal(0);
241
+ expect(Math.max(...addresses.map((a) => a.index))).to.equal(24);
242
+
243
+ const filteredAddresses = filterAddressesForGapLimit({
244
+ addresses,
245
+ index,
246
+ gapLimitOptions
247
+ });
248
+ let indexes = filteredAddresses.map((a) => a.index);
249
+ let minIndex = Math.min(...indexes);
250
+ let maxIndex = Math.max(...indexes);
251
+ expect(filteredAddresses.length).to.equal(5);
252
+ expect(minIndex).to.equal(3);
253
+ expect(maxIndex).to.equal(7);
254
+
255
+ const filteredAddressesObj = filterAddressesObjForGapLimit({
256
+ addresses: addressesObj,
257
+ index,
258
+ gapLimitOptions
259
+ });
260
+ indexes = Object.values(filteredAddressesObj).map((a: IAddress) => a.index);
261
+ minIndex = Math.min(...indexes);
262
+ maxIndex = Math.max(...indexes);
263
+ expect(indexes.length).to.equal(5);
264
+ expect(minIndex).to.equal(3);
265
+ expect(maxIndex).to.equal(7);
266
+
267
+ const filteredStartingAddresses = filterAddressesObjForStartingIndex({
268
+ addresses: addressesObj,
269
+ index
270
+ });
271
+ indexes = Object.values(filteredStartingAddresses).map(
272
+ (a: IAddress) => a.index
273
+ );
274
+ minIndex = Math.min(...indexes);
275
+ maxIndex = Math.max(...indexes);
276
+ expect(indexes.length).to.equal(20);
277
+ expect(minIndex).to.equal(5);
278
+ expect(maxIndex).to.equal(24);
279
+
280
+ const filteredSingleAddress = filterAddressesObjForSingleIndex({
281
+ addresses: addressesObj,
282
+ addressIndex: index
283
+ });
284
+ const singleAddress = Object.values(filteredSingleAddress);
285
+ minIndex = Math.min(...singleAddress.map((a: IAddress) => a.index));
286
+ maxIndex = Math.max(...singleAddress.map((a: IAddress) => a.index));
287
+ expect(singleAddress.length).to.equal(1);
288
+ expect(minIndex).to.equal(5);
289
+ expect(maxIndex).to.equal(5);
290
+ });
291
+
222
292
  it('Should successfully return the private testnet key for a given path', async () => {
223
293
  const addresses: IAddresses = wallet.data.addresses['p2wpkh'];
224
294
 
@@ -1,28 +0,0 @@
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.Mempool = void 0;
7
- const mempool_js_1 = __importDefault(require("@mempool/mempool.js"));
8
- class Mempool {
9
- constructor({ wallet, hostname = 'mempool.space', network }) {
10
- this.mempoolNetwork = network === 'bitcoin' ? 'mainnet' : network;
11
- this.mempool = (0, mempool_js_1.default)({
12
- hostname,
13
- network: this.mempoolNetwork
14
- }).bitcoin;
15
- this._wallet = wallet;
16
- const ws = this.mempool.websocket.initClient({
17
- options: ['blocks', 'mempool-blocks']
18
- });
19
- ws.addEventListener('message', function incoming({ data }) {
20
- console.log('Data!!!!', data);
21
- });
22
- }
23
- get wallet() {
24
- return this._wallet;
25
- }
26
- }
27
- exports.Mempool = Mempool;
28
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mempool/index.ts"],"names":[],"mappings":";;;;;;AAEA,qEAA4C;AAG5C,MAAa,OAAO;IAQnB,YAAY,EACX,MAAM,EACN,QAAQ,GAAG,eAAe,EAC1B,OAAO,EAKP;QACA,IAAI,CAAC,cAAc,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;QAClE,IAAI,CAAC,OAAO,GAAG,IAAA,oBAAS,EAAC;YACxB,QAAQ;YACR,OAAO,EAAE,IAAI,CAAC,cAAc;SAC5B,CAAC,CAAC,OAAO,CAAC;QACX,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAGtB,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC;YAC5C,OAAO,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SACrC,CAAC,CAAC;QAEH,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,QAAQ,CAAC,EAAE,IAAI,EAAE;YACxD,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAc/B,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;CACD;AAlDD,0BAkDC"}
@@ -1,15 +0,0 @@
1
- import { Wallet } from '../wallet';
2
- import { EAvailableNetworks, TServer } from '../types';
3
- export declare class Mempool {
4
- private readonly _wallet;
5
- private mempool;
6
- servers?: TServer | TServer[];
7
- readonly mempoolNetwork: 'mainnet' | 'testnet' | 'regtest';
8
- onReceive?: (data: unknown) => void;
9
- constructor({ wallet, hostname, network }: {
10
- wallet: Wallet;
11
- hostname: string;
12
- network: EAvailableNetworks;
13
- });
14
- get wallet(): Wallet;
15
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=mempool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mempool.js","sourceRoot":"","sources":["../../src/types/mempool.ts"],"names":[],"mappings":""}
@@ -1,16 +0,0 @@
1
- import { AddressInstance } from '@mempool/mempool.js/lib/interfaces/bitcoin/addresses';
2
- import { BlockInstance } from '@mempool/mempool.js/lib/interfaces/bitcoin/blocks';
3
- import { DifficultyInstance } from '@mempool/mempool.js/lib/interfaces/bitcoin/difficulty';
4
- import { FeeInstance } from '@mempool/mempool.js/lib/interfaces/bitcoin/fees';
5
- import { MempoolInstance } from '@mempool/mempool.js/lib/interfaces/bitcoin/mempool';
6
- import { TxInstance } from '@mempool/mempool.js/lib/interfaces/bitcoin/transactions';
7
- import { WsInstance } from '@mempool/mempool.js/lib/interfaces/bitcoin/websockets';
8
- export interface IMempoolBitcoin {
9
- addresses: AddressInstance;
10
- blocks: BlockInstance;
11
- difficulty: DifficultyInstance;
12
- fees: FeeInstance;
13
- mempool: MempoolInstance;
14
- transactions: TxInstance;
15
- websocket: WsInstance;
16
- }
@@ -1,30 +0,0 @@
1
- import { Result } from './result';
2
- import { IExchangeRates } from '../types';
3
- export declare const mostUsedExchangeTickers: {
4
- USD: {
5
- currencySymbol: string;
6
- quote: string;
7
- quoteName: string;
8
- };
9
- GBP: {
10
- currencySymbol: string;
11
- quote: string;
12
- quoteName: string;
13
- };
14
- CAD: {
15
- currencySymbol: string;
16
- quote: string;
17
- quoteName: string;
18
- };
19
- CNY: {
20
- currencySymbol: string;
21
- quote: string;
22
- quoteName: string;
23
- };
24
- EUR: {
25
- currencySymbol: string;
26
- quote: string;
27
- quoteName: string;
28
- };
29
- };
30
- export declare const getExchangeRates: () => Promise<Result<IExchangeRates>>;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getExchangeRates = exports.mostUsedExchangeTickers = void 0;
4
- const result_1 = require("./result");
5
- const constants_1 = require("../wallet/constants");
6
- exports.mostUsedExchangeTickers = {
7
- USD: {
8
- currencySymbol: '$',
9
- quote: 'USD',
10
- quoteName: 'US Dollar'
11
- },
12
- GBP: {
13
- currencySymbol: '£',
14
- quote: 'GBP',
15
- quoteName: 'Great British Pound'
16
- },
17
- CAD: {
18
- currencySymbol: '$',
19
- quote: 'CAD',
20
- quoteName: 'Canadian Dollar'
21
- },
22
- CNY: {
23
- currencySymbol: '¥',
24
- quote: 'CNY',
25
- quoteName: 'Chinese Yuan Renminbi'
26
- },
27
- EUR: { currencySymbol: '€', quote: 'EUR', quoteName: 'Euro' }
28
- };
29
- const getExchangeRates = async () => {
30
- try {
31
- const response = await fetch(`${constants_1.BLOCKTANK_HOST}/fx/rates/btc`);
32
- const { tickers } = await response.json();
33
- const rates = tickers.reduce((acc, ticker) => {
34
- return Object.assign(Object.assign({}, acc), { [ticker.quote]: {
35
- currencySymbol: ticker.currencySymbol,
36
- quote: ticker.quote,
37
- quoteName: ticker.quoteName,
38
- rate: Math.round(Number(ticker.lastPrice) * 100) / 100,
39
- lastUpdatedAt: ticker.lastUpdatedAt
40
- } });
41
- }, {});
42
- return (0, result_1.ok)(rates);
43
- }
44
- catch (e) {
45
- return (0, result_1.err)(e);
46
- }
47
- };
48
- exports.getExchangeRates = getExchangeRates;
49
- //# sourceMappingURL=exchange-rate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exchange-rate.js","sourceRoot":"","sources":["../../src/utils/exchange-rate.ts"],"names":[],"mappings":";;;AAAA,qCAA2C;AAC3C,mDAAqD;AAGxC,QAAA,uBAAuB,GAAG;IACtC,GAAG,EAAE;QACJ,cAAc,EAAE,GAAG;QACnB,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,WAAW;KACtB;IACD,GAAG,EAAE;QACJ,cAAc,EAAE,GAAG;QACnB,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,qBAAqB;KAChC;IACD,GAAG,EAAE;QACJ,cAAc,EAAE,GAAG;QACnB,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,iBAAiB;KAC5B;IACD,GAAG,EAAE;QACJ,cAAc,EAAE,GAAG;QACnB,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,uBAAuB;KAClC;IACD,GAAG,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE;CAC7D,CAAC;AAkBK,MAAM,gBAAgB,GAAG,KAAK,IAAqC,EAAE;IAC3E,IAAI;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,0BAAc,eAAe,CAAC,CAAC;QAC/D,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAE1C,MAAM,KAAK,GAAmB,OAAO,CAAC,MAAM,CAC3C,CAAC,GAAmB,EAAE,MAAe,EAAE,EAAE;YACxC,uCACI,GAAG,KACN,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;oBACf,cAAc,EAAE,MAAM,CAAC,cAAc;oBACrC,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,SAAS,EAAE,MAAM,CAAC,SAAS;oBAC3B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG;oBACtD,aAAa,EAAE,MAAM,CAAC,aAAa;iBACnC,IACA;QACH,CAAC,EACD,EAAE,CACF,CAAC;QAEF,OAAO,IAAA,WAAE,EAAC,KAAK,CAAC,CAAC;KACjB;IAAC,OAAO,CAAC,EAAE;QACX,OAAO,IAAA,YAAG,EAAC,CAAC,CAAC,CAAC;KACd;AACF,CAAC,CAAC;AAzBW,QAAA,gBAAgB,oBAyB3B"}
@@ -1,7 +0,0 @@
1
- [beignet](../README.md) / IExchangeRates
2
-
3
- # Interface: IExchangeRates
4
-
5
- ## Indexable
6
-
7
- ▪ [key: `string`]: { `currencySymbol`: `string` ; `lastUpdatedAt`: `number` ; `quote`: `string` ; `quoteName`: `string` ; `rate`: `number` }