beignet 0.0.21 → 0.0.22

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 (258) hide show
  1. package/dist/electrum/index.js +10 -10
  2. package/dist/electrum/index.js.map +1 -1
  3. package/dist/types/electrum/index.d.ts +5 -1
  4. package/dist/types/types/wallet.d.ts +2 -0
  5. package/dist/types/wallet/constants.d.ts +0 -5
  6. package/dist/types/wallet/index.d.ts +2 -0
  7. package/dist/types/wallet.js.map +1 -1
  8. package/dist/wallet/constants.js +1 -7
  9. package/dist/wallet/constants.js.map +1 -1
  10. package/dist/wallet/index.js +5 -11
  11. package/dist/wallet/index.js.map +1 -1
  12. package/docs/html/assets/search.js +1 -1
  13. package/docs/html/classes/Electrum.html +79 -70
  14. package/docs/html/classes/Transaction.html +59 -28
  15. package/docs/html/classes/Wallet.html +224 -174
  16. package/docs/html/enums/EAddressType.html +22 -7
  17. package/docs/html/enums/EAvailableNetworks.html +19 -11
  18. package/docs/html/enums/EBoostType.html +14 -6
  19. package/docs/html/enums/EElectrumNetworks.html +15 -7
  20. package/docs/html/enums/EFeeId.html +17 -9
  21. package/docs/html/enums/EPaymentType.html +14 -6
  22. package/docs/html/enums/EProtocol.html +14 -6
  23. package/docs/html/enums/EUnit.html +15 -7
  24. package/docs/html/functions/availableNetworks.html +12 -4
  25. package/docs/html/functions/constructByteCountParam.html +12 -4
  26. package/docs/html/functions/decodeOpReturnMessage.html +12 -4
  27. package/docs/html/functions/decodeRawTransaction.html +12 -4
  28. package/docs/html/functions/err.html +12 -4
  29. package/docs/html/functions/formatKeyDerivationPath.html +12 -4
  30. package/docs/html/functions/formatPeerData.html +12 -4
  31. package/docs/html/functions/generateMnemonic.html +12 -4
  32. package/docs/html/functions/generateWalletId.html +12 -4
  33. package/docs/html/functions/getAddressFromKeyPair.html +222 -0
  34. package/docs/html/functions/getAddressFromScriptPubKey.html +12 -4
  35. package/docs/html/functions/getAddressTypeFromPath.html +12 -4
  36. package/docs/html/functions/getAddressesFromPrivateKey.html +222 -0
  37. package/docs/html/functions/getByteCount.html +12 -4
  38. package/docs/html/functions/getDataFallback.html +12 -4
  39. package/docs/html/functions/getDefaultPort.html +12 -4
  40. package/docs/html/functions/getDefaultWalletData.html +12 -4
  41. package/docs/html/functions/getDefaultWalletDataKeys.html +12 -4
  42. package/docs/html/functions/getElectrumNetwork.html +216 -0
  43. package/docs/html/functions/getHighestUsedIndexFromTxHashes.html +12 -4
  44. package/docs/html/functions/getKeyDerivationPath.html +12 -4
  45. package/docs/html/functions/getKeyDerivationPathObject.html +12 -4
  46. package/docs/html/functions/getKeyDerivationPathString.html +12 -4
  47. package/docs/html/functions/getKeyValue.html +12 -4
  48. package/docs/html/functions/getPeers.html +12 -4
  49. package/docs/html/functions/getProtocolForPort.html +12 -4
  50. package/docs/html/functions/getScriptHash.html +12 -4
  51. package/docs/html/functions/getSeed.html +12 -4
  52. package/docs/html/functions/getSeedHash.html +12 -4
  53. package/docs/html/functions/getSha256.html +12 -4
  54. package/docs/html/functions/getStorageKeyValues.html +12 -4
  55. package/docs/html/{variables/mostUsedExchangeTickers.html → functions/getTapRootAddressFromPublicKey.html} +74 -97
  56. package/docs/html/functions/getTxFee.html +12 -4
  57. package/docs/html/functions/getWalletDataStorageKey.html +12 -4
  58. package/docs/html/functions/isP2trPrefix.html +217 -0
  59. package/docs/html/functions/isValidBech32mEncodedString.html +12 -4
  60. package/docs/html/functions/objectKeys-1.html +12 -4
  61. package/docs/html/functions/objectsMatch.html +12 -4
  62. package/docs/html/functions/ok.html +12 -4
  63. package/docs/html/functions/parseOnChainPaymentRequest.html +12 -4
  64. package/docs/html/functions/reduceValue.html +12 -4
  65. package/docs/html/functions/removeDustOutputs.html +12 -4
  66. package/docs/html/functions/setReplaceByFee.html +12 -4
  67. package/docs/html/functions/shuffleArray.html +12 -4
  68. package/docs/html/functions/{getExchangeRates.html → sleep.html} +22 -12
  69. package/docs/html/functions/validateAddress.html +12 -4
  70. package/docs/html/functions/validateMnemonic.html +12 -4
  71. package/docs/html/functions/validateTransaction.html +12 -4
  72. package/docs/html/index.html +22 -6
  73. package/docs/html/interfaces/IAddInput.html +16 -8
  74. package/docs/html/interfaces/IAddress.html +17 -9
  75. package/docs/html/interfaces/IAddressData.html +15 -7
  76. package/docs/html/interfaces/IAddressType.html +12 -4
  77. package/docs/html/interfaces/IAddressTypeData.html +18 -10
  78. package/docs/html/interfaces/IAddresses.html +12 -4
  79. package/docs/html/interfaces/IBoostedTransaction.html +16 -8
  80. package/docs/html/interfaces/IBoostedTransactions.html +12 -4
  81. package/docs/html/interfaces/ICreateTransaction.html +14 -6
  82. package/docs/html/interfaces/ICustomGetAddress.html +15 -7
  83. package/docs/html/interfaces/ICustomGetScriptHash.html +14 -6
  84. package/docs/html/interfaces/IElectrumGetAddressBalanceRes.html +15 -7
  85. package/docs/html/interfaces/IFormattedPeerData.html +17 -9
  86. package/docs/html/interfaces/IFormattedTransaction.html +31 -23
  87. package/docs/html/interfaces/IFormattedTransactions.html +12 -4
  88. package/docs/html/interfaces/IGenerateAddresses.html +19 -11
  89. package/docs/html/interfaces/IGenerateAddressesResponse.html +14 -6
  90. package/docs/html/interfaces/IGetAddress.html +15 -7
  91. package/docs/html/interfaces/IGetAddressBalanceRes.html +14 -6
  92. package/docs/html/interfaces/IGetAddressByPath.html +14 -6
  93. package/docs/html/interfaces/IGetAddressHistoryResponse.html +19 -11
  94. package/docs/html/interfaces/IGetAddressResponse.html +15 -7
  95. package/docs/html/interfaces/IGetAddressScriptHashBalances.html +17 -9
  96. package/docs/html/interfaces/IGetAddressScriptHashesHistoryResponse.html +17 -9
  97. package/docs/html/interfaces/{IExchangeRates.html → IGetAddressesFromKeyPair.html} +45 -23
  98. package/docs/html/interfaces/IGetAddressesFromPrivateKey.html +234 -0
  99. package/docs/html/interfaces/IGetDerivationPath.html +18 -10
  100. package/docs/html/interfaces/IGetFeeEstimatesResponse.html +16 -8
  101. package/docs/html/interfaces/IGetHeaderResponse.html +17 -9
  102. package/docs/html/interfaces/IGetNextAvailableAddressResponse.html +16 -8
  103. package/docs/html/interfaces/IGetTransactions.html +17 -9
  104. package/docs/html/interfaces/IGetTransactionsFromInputs.html +17 -9
  105. package/docs/html/interfaces/IGetUtxosResponse.html +14 -6
  106. package/docs/html/interfaces/IHeader.html +15 -7
  107. package/docs/html/interfaces/IIndexes.html +16 -8
  108. package/docs/html/interfaces/IKeyDerivationPath.html +17 -9
  109. package/docs/html/interfaces/IKeyDerivationPathData.html +14 -6
  110. package/docs/html/interfaces/INewBlock.html +14 -6
  111. package/docs/html/interfaces/IOnchainFees.html +17 -9
  112. package/docs/html/interfaces/IOutput.html +15 -7
  113. package/docs/html/interfaces/IPeerData.html +15 -7
  114. package/docs/html/interfaces/IPrivateKeyInfo.html +248 -0
  115. package/docs/html/interfaces/IRbfData.html +18 -10
  116. package/docs/html/interfaces/ISend.html +14 -6
  117. package/docs/html/interfaces/ISendTransaction.html +28 -20
  118. package/docs/html/interfaces/ISendTx.html +15 -7
  119. package/docs/html/interfaces/ISetupTransaction.html +17 -9
  120. package/docs/html/interfaces/ISubscribeToAddress.html +16 -8
  121. package/docs/html/interfaces/ISubscribeToHeader.html +16 -8
  122. package/docs/html/interfaces/ISweepPrivateKey.html +255 -0
  123. package/docs/html/interfaces/ISweepPrivateKeyRes.html +241 -0
  124. package/docs/html/interfaces/ITargets.html +16 -8
  125. package/docs/html/interfaces/ITransaction.html +17 -9
  126. package/docs/html/interfaces/ITxHash.html +13 -5
  127. package/docs/html/interfaces/ITxHashes.html +15 -7
  128. package/docs/html/interfaces/IUtxo.html +27 -21
  129. package/docs/html/interfaces/IVin.html +17 -9
  130. package/docs/html/interfaces/IVout.html +15 -7
  131. package/docs/html/interfaces/IWallet.html +53 -20
  132. package/docs/html/interfaces/IWalletData.html +30 -29
  133. package/docs/html/types/ElectrumConnectionPubSub.html +12 -4
  134. package/docs/html/types/ElectrumConnectionSubscription.html +13 -5
  135. package/docs/html/types/InputData.html +12 -4
  136. package/docs/html/types/ObjectKeys.html +12 -4
  137. package/docs/html/types/Result.html +12 -4
  138. package/docs/html/types/TAddressIndexInfo.html +12 -4
  139. package/docs/html/types/TAddressLabel.html +12 -4
  140. package/docs/html/types/TAddressType.html +12 -4
  141. package/docs/html/types/TAddressTypeContent.html +12 -4
  142. package/docs/html/types/TAddressTypes.html +12 -4
  143. package/docs/html/types/TAvailableNetworks.html +12 -4
  144. package/docs/html/types/TConnectToElectrumRes.html +12 -4
  145. package/docs/html/types/TDecodeRawTx.html +12 -4
  146. package/docs/html/types/TElectrumNetworks.html +12 -4
  147. package/docs/html/types/TGetAddressHistory.html +12 -4
  148. package/docs/html/types/TGetByteCountInput.html +12 -4
  149. package/docs/html/types/TGetByteCountInputs.html +12 -4
  150. package/docs/html/types/TGetByteCountOutput.html +12 -4
  151. package/docs/html/types/TGetByteCountOutputs.html +12 -4
  152. package/docs/html/types/TGetData.html +12 -4
  153. package/docs/html/types/TGetTotalFeeObj.html +12 -4
  154. package/docs/html/types/TKeyDerivationAccount.html +12 -4
  155. package/docs/html/types/TKeyDerivationChange.html +12 -4
  156. package/docs/html/types/TKeyDerivationCoinType.html +12 -4
  157. package/docs/html/types/TKeyDerivationIndex.html +12 -4
  158. package/docs/html/types/TKeyDerivationPurpose.html +12 -4
  159. package/docs/html/types/TMessageDataMap.html +12 -4
  160. package/docs/html/types/TMessageKeys.html +12 -4
  161. package/docs/html/types/TOnMessage.html +12 -4
  162. package/docs/html/types/TProcessUnconfirmedTransactions.html +12 -4
  163. package/docs/html/types/TProtocol.html +12 -4
  164. package/docs/html/types/TServer.html +12 -4
  165. package/docs/html/types/TSetData.html +12 -4
  166. package/docs/html/types/TSetupTransactionResponse.html +12 -4
  167. package/docs/html/types/TStorage.html +12 -4
  168. package/docs/html/types/TSubscribedReceive.html +12 -4
  169. package/docs/html/types/TTransactionMessage.html +12 -4
  170. package/docs/html/types/TTxResponse.html +12 -4
  171. package/docs/html/types/TTxResult.html +12 -4
  172. package/docs/html/types/TUnspentAddressScriptHashData.html +12 -4
  173. package/docs/html/types/TWalletDataKeys.html +12 -4
  174. package/docs/html/variables/defaultElectrumPorts.html +12 -4
  175. package/docs/html/variables/electrumConnection.html +12 -4
  176. package/docs/markdown/README.md +224 -128
  177. package/docs/markdown/classes/Electrum.md +74 -72
  178. package/docs/markdown/classes/Transaction.md +48 -23
  179. package/docs/markdown/classes/Wallet.md +240 -181
  180. package/docs/markdown/enums/EAddressType.md +14 -3
  181. package/docs/markdown/enums/EAvailableNetworks.md +7 -7
  182. package/docs/markdown/enums/EBoostType.md +2 -2
  183. package/docs/markdown/enums/EElectrumNetworks.md +3 -3
  184. package/docs/markdown/enums/EFeeId.md +5 -5
  185. package/docs/markdown/enums/EPaymentType.md +2 -2
  186. package/docs/markdown/enums/EProtocol.md +2 -2
  187. package/docs/markdown/enums/EUnit.md +3 -3
  188. package/docs/markdown/interfaces/IAddInput.md +4 -4
  189. package/docs/markdown/interfaces/IAddress.md +5 -5
  190. package/docs/markdown/interfaces/IAddressData.md +3 -3
  191. package/docs/markdown/interfaces/IAddressTypeData.md +6 -6
  192. package/docs/markdown/interfaces/IBoostedTransaction.md +4 -4
  193. package/docs/markdown/interfaces/ICreateTransaction.md +2 -2
  194. package/docs/markdown/interfaces/ICustomGetAddress.md +3 -3
  195. package/docs/markdown/interfaces/ICustomGetScriptHash.md +2 -2
  196. package/docs/markdown/interfaces/IElectrumGetAddressBalanceRes.md +3 -3
  197. package/docs/markdown/interfaces/IFormattedPeerData.md +5 -5
  198. package/docs/markdown/interfaces/IFormattedTransaction.md +19 -19
  199. package/docs/markdown/interfaces/IGenerateAddresses.md +7 -7
  200. package/docs/markdown/interfaces/IGenerateAddressesResponse.md +2 -2
  201. package/docs/markdown/interfaces/IGetAddress.md +3 -3
  202. package/docs/markdown/interfaces/IGetAddressBalanceRes.md +2 -2
  203. package/docs/markdown/interfaces/IGetAddressByPath.md +2 -2
  204. package/docs/markdown/interfaces/IGetAddressHistoryResponse.md +7 -7
  205. package/docs/markdown/interfaces/IGetAddressResponse.md +3 -3
  206. package/docs/markdown/interfaces/IGetAddressScriptHashBalances.md +5 -5
  207. package/docs/markdown/interfaces/IGetAddressScriptHashesHistoryResponse.md +5 -5
  208. package/docs/markdown/interfaces/IGetAddressesFromKeyPair.md +30 -0
  209. package/docs/markdown/interfaces/IGetAddressesFromPrivateKey.md +30 -0
  210. package/docs/markdown/interfaces/IGetDerivationPath.md +6 -6
  211. package/docs/markdown/interfaces/IGetFeeEstimatesResponse.md +4 -4
  212. package/docs/markdown/interfaces/IGetHeaderResponse.md +5 -5
  213. package/docs/markdown/interfaces/IGetNextAvailableAddressResponse.md +4 -4
  214. package/docs/markdown/interfaces/IGetTransactions.md +5 -5
  215. package/docs/markdown/interfaces/IGetTransactionsFromInputs.md +5 -5
  216. package/docs/markdown/interfaces/IGetUtxosResponse.md +2 -2
  217. package/docs/markdown/interfaces/IHeader.md +3 -3
  218. package/docs/markdown/interfaces/IIndexes.md +4 -4
  219. package/docs/markdown/interfaces/IKeyDerivationPath.md +5 -5
  220. package/docs/markdown/interfaces/IKeyDerivationPathData.md +2 -2
  221. package/docs/markdown/interfaces/INewBlock.md +2 -2
  222. package/docs/markdown/interfaces/IOnchainFees.md +5 -5
  223. package/docs/markdown/interfaces/IOutput.md +3 -3
  224. package/docs/markdown/interfaces/IPeerData.md +3 -3
  225. package/docs/markdown/interfaces/IPrivateKeyInfo.md +52 -0
  226. package/docs/markdown/interfaces/IRbfData.md +6 -6
  227. package/docs/markdown/interfaces/ISend.md +2 -2
  228. package/docs/markdown/interfaces/ISendTransaction.md +16 -16
  229. package/docs/markdown/interfaces/ISendTx.md +3 -3
  230. package/docs/markdown/interfaces/ISetupTransaction.md +5 -5
  231. package/docs/markdown/interfaces/ISubscribeToAddress.md +4 -4
  232. package/docs/markdown/interfaces/ISubscribeToHeader.md +4 -4
  233. package/docs/markdown/interfaces/ISweepPrivateKey.md +63 -0
  234. package/docs/markdown/interfaces/ISweepPrivateKeyRes.md +41 -0
  235. package/docs/markdown/interfaces/ITargets.md +4 -4
  236. package/docs/markdown/interfaces/ITransaction.md +5 -5
  237. package/docs/markdown/interfaces/ITxHash.md +1 -1
  238. package/docs/markdown/interfaces/ITxHashes.md +3 -3
  239. package/docs/markdown/interfaces/IUtxo.md +18 -23
  240. package/docs/markdown/interfaces/IVin.md +5 -5
  241. package/docs/markdown/interfaces/IVout.md +3 -3
  242. package/docs/markdown/interfaces/IWallet.md +50 -15
  243. package/docs/markdown/interfaces/IWalletData.md +18 -29
  244. package/package.json +3 -3
  245. package/src/electrum/index.ts +17 -11
  246. package/src/types/wallet.ts +2 -0
  247. package/src/wallet/constants.ts +0 -8
  248. package/src/wallet/index.ts +7 -8
  249. package/dist/mempool/index.js +0 -28
  250. package/dist/mempool/index.js.map +0 -1
  251. package/dist/types/mempool/index.d.ts +0 -15
  252. package/dist/types/mempool.js +0 -3
  253. package/dist/types/mempool.js.map +0 -1
  254. package/dist/types/types/mempool.d.ts +0 -16
  255. package/dist/types/utils/exchange-rate.d.ts +0 -30
  256. package/dist/utils/exchange-rate.js +0 -49
  257. package/dist/utils/exchange-rate.js.map +0 -1
  258. package/docs/markdown/interfaces/IExchangeRates.md +0 -7
@@ -14,7 +14,6 @@
14
14
  - [boostedTransactions](IWalletData.md#boostedtransactions)
15
15
  - [changeAddressIndex](IWalletData.md#changeaddressindex)
16
16
  - [changeAddresses](IWalletData.md#changeaddresses)
17
- - [exchangeRates](IWalletData.md#exchangerates)
18
17
  - [feeEstimates](IWalletData.md#feeestimates)
19
18
  - [header](IWalletData.md#header)
20
19
  - [id](IWalletData.md#id)
@@ -34,7 +33,7 @@
34
33
 
35
34
  #### Defined in
36
35
 
37
- [types/wallet.ts:155](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L155)
36
+ [types/wallet.ts:158](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L158)
38
37
 
39
38
  ___
40
39
 
@@ -44,7 +43,7 @@ ___
44
43
 
45
44
  #### Defined in
46
45
 
47
- [types/wallet.ts:151](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L151)
46
+ [types/wallet.ts:154](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L154)
48
47
 
49
48
  ___
50
49
 
@@ -54,7 +53,7 @@ ___
54
53
 
55
54
  #### Defined in
56
55
 
57
- [types/wallet.ts:153](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L153)
56
+ [types/wallet.ts:156](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L156)
58
57
 
59
58
  ___
60
59
 
@@ -64,7 +63,7 @@ ___
64
63
 
65
64
  #### Defined in
66
65
 
67
- [types/wallet.ts:165](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L165)
66
+ [types/wallet.ts:168](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L168)
68
67
 
69
68
  ___
70
69
 
@@ -74,7 +73,7 @@ ___
74
73
 
75
74
  #### Defined in
76
75
 
77
- [types/wallet.ts:160](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L160)
76
+ [types/wallet.ts:163](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L163)
78
77
 
79
78
  ___
80
79
 
@@ -84,7 +83,7 @@ ___
84
83
 
85
84
  #### Defined in
86
85
 
87
- [types/wallet.ts:163](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L163)
86
+ [types/wallet.ts:166](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L166)
88
87
 
89
88
  ___
90
89
 
@@ -94,7 +93,7 @@ ___
94
93
 
95
94
  #### Defined in
96
95
 
97
- [types/wallet.ts:156](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L156)
96
+ [types/wallet.ts:159](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L159)
98
97
 
99
98
  ___
100
99
 
@@ -104,17 +103,7 @@ ___
104
103
 
105
104
  #### Defined in
106
105
 
107
- [types/wallet.ts:154](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L154)
108
-
109
- ___
110
-
111
- ### exchangeRates
112
-
113
- • **exchangeRates**: [`IExchangeRates`](IExchangeRates.md)
114
-
115
- #### Defined in
116
-
117
- [types/wallet.ts:167](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L167)
106
+ [types/wallet.ts:157](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L157)
118
107
 
119
108
  ___
120
109
 
@@ -124,7 +113,7 @@ ___
124
113
 
125
114
  #### Defined in
126
115
 
127
- [types/wallet.ts:168](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L168)
116
+ [types/wallet.ts:170](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L170)
128
117
 
129
118
  ___
130
119
 
@@ -134,7 +123,7 @@ ___
134
123
 
135
124
  #### Defined in
136
125
 
137
- [types/wallet.ts:152](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L152)
126
+ [types/wallet.ts:155](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L155)
138
127
 
139
128
  ___
140
129
 
@@ -144,7 +133,7 @@ ___
144
133
 
145
134
  #### Defined in
146
135
 
147
- [types/wallet.ts:150](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L150)
136
+ [types/wallet.ts:153](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L153)
148
137
 
149
138
  ___
150
139
 
@@ -154,7 +143,7 @@ ___
154
143
 
155
144
  #### Defined in
156
145
 
157
- [types/wallet.ts:157](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L157)
146
+ [types/wallet.ts:160](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L160)
158
147
 
159
148
  ___
160
149
 
@@ -164,7 +153,7 @@ ___
164
153
 
165
154
  #### Defined in
166
155
 
167
- [types/wallet.ts:158](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L158)
156
+ [types/wallet.ts:161](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L161)
168
157
 
169
158
  ___
170
159
 
@@ -174,7 +163,7 @@ ___
174
163
 
175
164
  #### Defined in
176
165
 
177
- [types/wallet.ts:166](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L166)
166
+ [types/wallet.ts:169](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L169)
178
167
 
179
168
  ___
180
169
 
@@ -184,7 +173,7 @@ ___
184
173
 
185
174
  #### Defined in
186
175
 
187
- [types/wallet.ts:164](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L164)
176
+ [types/wallet.ts:167](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L167)
188
177
 
189
178
  ___
190
179
 
@@ -194,7 +183,7 @@ ___
194
183
 
195
184
  #### Defined in
196
185
 
197
- [types/wallet.ts:162](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L162)
186
+ [types/wallet.ts:165](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L165)
198
187
 
199
188
  ___
200
189
 
@@ -204,7 +193,7 @@ ___
204
193
 
205
194
  #### Defined in
206
195
 
207
- [types/wallet.ts:161](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L161)
196
+ [types/wallet.ts:164](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L164)
208
197
 
209
198
  ___
210
199
 
@@ -214,4 +203,4 @@ ___
214
203
 
215
204
  #### Defined in
216
205
 
217
- [types/wallet.ts:159](https://github.com/synonymdev/beignet/blob/583604f/src/types/wallet.ts#L159)
206
+ [types/wallet.ts:162](https://github.com/synonymdev/beignet/blob/05d5011/src/types/wallet.ts#L162)
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "beignet",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "A self-custodial, JS Bitcoin wallet management library.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "test": "yarn build && env mocha --exit -r ts-node/register 'tests/**/*.ts'",
8
8
  "test:wallet": "yarn build && env mocha --exit -r ts-node/register 'tests/wallet.test.ts'",
9
9
  "test:electrum": "yarn build && env mocha --exit -r ts-node/register 'tests/electrum.test.ts'",
10
- "test:derivation": " yarn build && env mocha --exit -r ts-node/register 'tests/derivation.test.ts'",
11
- "test:transaction": " yarn build && env mocha --exit -r ts-node/register 'tests/transaction.test.ts'",
10
+ "test:derivation": "yarn build && env mocha --exit -r ts-node/register 'tests/derivation.test.ts'",
11
+ "test:transaction": "yarn build && env mocha --exit -r ts-node/register 'tests/transaction.test.ts'",
12
12
  "test:storage": "yarn build && env mocha --exit -r ts-node/register 'tests/storage.test.ts'",
13
13
  "example": "ts-node example",
14
14
  "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
@@ -39,7 +39,7 @@ import {
39
39
  sleep
40
40
  } from '../utils';
41
41
  import { Wallet } from '../wallet';
42
- import { CHUNK_LIMIT, GAP_LIMIT } from '../wallet/constants';
42
+ import { GAP_LIMIT } from '../wallet/constants';
43
43
  import { getScriptHash } from '../utils';
44
44
  import { POLLING_INTERVAL } from '../shapes';
45
45
  import { Block } from 'bitcoinjs-lib';
@@ -68,13 +68,17 @@ export class Electrum {
68
68
  public electrumNetwork: EElectrumNetworks;
69
69
  public connectedToElectrum: boolean;
70
70
  public onReceive?: (data: unknown) => void;
71
+ public batchLimit: number;
72
+ public batchDelay: number;
71
73
  constructor({
72
74
  wallet,
73
75
  servers,
74
76
  network,
75
77
  onReceive,
76
78
  tls: _tls,
77
- net: _net
79
+ net: _net,
80
+ batchLimit = 15,
81
+ batchDelay = 50
78
82
  }: {
79
83
  wallet: Wallet;
80
84
  servers?: TServer | TServer[];
@@ -82,6 +86,8 @@ export class Electrum {
82
86
  onReceive?: (data: unknown) => void;
83
87
  tls?: TLSSocket;
84
88
  net?: Server;
89
+ batchLimit?: number;
90
+ batchDelay?: number;
85
91
  }) {
86
92
  this._wallet = wallet;
87
93
  this.sendMessage = wallet.sendMessage;
@@ -92,6 +98,8 @@ export class Electrum {
92
98
  this.onReceive = onReceive;
93
99
  this.tls = _tls ?? tls;
94
100
  this.net = _net ?? net;
101
+ this.batchLimit = batchLimit;
102
+ this.batchDelay = batchDelay;
95
103
  if (!this.tls || !this.net) {
96
104
  throw new Error(
97
105
  'TLS and NET modules are not available and were not passed as instances'
@@ -312,10 +320,9 @@ export class Electrum {
312
320
  const combinedResponse: TTxResponse[] = [];
313
321
  const promises: Promise<IGetAddressScriptHashesHistoryResponse>[] = [];
314
322
 
315
- const chunkLimit = CHUNK_LIMIT[this.network];
316
323
  // split payload in chunks of 10 addresses per-request
317
- for (let i = 0; i < scriptHashes.length; i += chunkLimit) {
318
- const chunk = scriptHashes.slice(i, i + chunkLimit);
324
+ for (let i = 0; i < scriptHashes.length; i += this.batchLimit) {
325
+ const chunk = scriptHashes.slice(i, i + this.batchLimit);
319
326
  const payload = {
320
327
  key: 'scriptHash',
321
328
  data: chunk
@@ -326,14 +333,14 @@ export class Electrum {
326
333
  network: this.electrumNetwork
327
334
  })
328
335
  );
329
- await sleep(50);
336
+ await sleep(this.batchDelay);
330
337
  promises.push(
331
338
  electrum.getAddressScriptHashesMempool({
332
339
  scriptHashes: payload,
333
340
  network: this.electrumNetwork
334
341
  })
335
342
  );
336
- await sleep(50);
343
+ await sleep(this.batchDelay);
337
344
  }
338
345
 
339
346
  const responses = await Promise.all(promises);
@@ -501,10 +508,9 @@ export class Electrum {
501
508
  const result: ITransaction<IUtxo>[] = [];
502
509
  const promises: Promise<IGetTransactions>[] = [];
503
510
 
504
- const chunkLimit = CHUNK_LIMIT[this.network];
505
511
  // split payload in chunks of 10 transactions per-request
506
- for (let i = 0; i < txHashes.length; i += chunkLimit) {
507
- const chunk = txHashes.slice(i, i + chunkLimit);
512
+ for (let i = 0; i < txHashes.length; i += this.batchLimit) {
513
+ const chunk = txHashes.slice(i, i + this.batchLimit);
508
514
 
509
515
  const data = {
510
516
  key: 'tx_hash',
@@ -517,7 +523,7 @@ export class Electrum {
517
523
  network: this.electrumNetwork
518
524
  })
519
525
  );
520
- await sleep(50);
526
+ await sleep(this.batchDelay);
521
527
  }
522
528
  const responses = await Promise.all(promises);
523
529
  responses.forEach((response) => {
@@ -193,6 +193,8 @@ export interface IWallet {
193
193
  servers?: TServer | TServer[];
194
194
  tls?: TLSSocket;
195
195
  net?: Server;
196
+ batchLimit?: number; // Maximum number of requests to be sent in a single batch
197
+ batchDelay?: number; // Delay (in milliseconds) between each batch of requests
196
198
  };
197
199
  remainOffline?: boolean;
198
200
  onMessage?: TOnMessage;
@@ -1,5 +1,3 @@
1
- import { EAvailableNetworks } from '../types';
2
-
3
1
  export const BITKIT_WALLET_SEED_HASH_PREFIX = Buffer.from(
4
2
  '@Bitkit/wallet-uuid'
5
3
  );
@@ -12,12 +10,6 @@ export const GENERATE_ADDRESS_AMOUNT = 5;
12
10
  // TODO: Add this as a settings for users to adjust when needed.
13
11
  export const GAP_LIMIT = 20;
14
12
 
15
- export const CHUNK_LIMIT = {
16
- [EAvailableNetworks.bitcoin]: 10,
17
- [EAvailableNetworks.bitcoinTestnet]: 15,
18
- [EAvailableNetworks.bitcoinRegtest]: 4
19
- };
20
-
21
13
  //How much of the users funds we allow to be used for Lightning.
22
14
  export const SPENDING_LIMIT_RATIO = 0.8;
23
15
 
@@ -94,7 +94,6 @@ import {
94
94
  import { Electrum } from '../electrum';
95
95
  import { Transaction } from '../transaction';
96
96
  import {
97
- CHUNK_LIMIT,
98
97
  GAP_LIMIT,
99
98
  GENERATE_ADDRESS_AMOUNT,
100
99
  TRANSACTION_DEFAULTS
@@ -136,6 +135,8 @@ export class Wallet {
136
135
  servers?: TServer | TServer[];
137
136
  tls?: TLSSocket;
138
137
  net?: Server;
138
+ batchLimit?: number; // Maximum number of requests to be sent in a single batch
139
+ batchDelay?: number; // Delay (in milliseconds) between each batch of requests
139
140
  };
140
141
  public electrum: Electrum;
141
142
  public addressType: EAddressType;
@@ -152,7 +153,7 @@ export class Wallet {
152
153
  network = EAvailableNetworks.mainnet,
153
154
  addressType = EAddressType.p2wpkh,
154
155
  storage,
155
- electrumOptions,
156
+ electrumOptions = {},
156
157
  onMessage = (): null => null,
157
158
  customGetAddress,
158
159
  customGetScriptHash,
@@ -199,9 +200,7 @@ export class Wallet {
199
200
  this.electrum = new Electrum({
200
201
  wallet: this,
201
202
  network: this.network,
202
- servers: electrumOptions?.servers,
203
- tls: electrumOptions?.tls,
204
- net: electrumOptions?.net
203
+ ...electrumOptions
205
204
  });
206
205
  this.rbf = rbf;
207
206
  this.selectedFeeId = selectedFeeId;
@@ -2365,9 +2364,9 @@ export class Wallet {
2365
2364
  try {
2366
2365
  const inputData: InputData = {};
2367
2366
 
2368
- const chunkLimit = CHUNK_LIMIT[this.network];
2369
- for (let i = 0; i < inputs.length; i += chunkLimit) {
2370
- const chunk = inputs.slice(i, i + chunkLimit);
2367
+ const batchLimit = this.electrum.batchLimit;
2368
+ for (let i = 0; i < inputs.length; i += batchLimit) {
2369
+ const chunk = inputs.slice(i, i + batchLimit);
2371
2370
 
2372
2371
  const getTransactionsResponse =
2373
2372
  await this.electrum.getTransactionsFromInputs({
@@ -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` }