edge-currency-plugins 1.0.0-rc.1

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 (233) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/lib/bch.js +15 -0
  4. package/lib/bsv.js +15 -0
  5. package/lib/btc.js +15 -0
  6. package/lib/common/constants.js +11 -0
  7. package/lib/common/fees/calcMinerFeePerByte.js +62 -0
  8. package/lib/common/fees/makeFees.js +182 -0
  9. package/lib/common/fees/processInfoServerFees.js +30 -0
  10. package/lib/common/fees/processMempoolSpaceFees.js +38 -0
  11. package/lib/common/plugin/makeCurrencyPlugin.js +66 -0
  12. package/lib/common/plugin/makeCurrencyTools.js +211 -0
  13. package/lib/common/plugin/makeEngineEmitter.js +102 -0
  14. package/lib/common/plugin/makeMetadata.js +99 -0
  15. package/lib/common/plugin/pluginState.js +253 -0
  16. package/lib/common/plugin/serverScores.js +328 -0
  17. package/lib/common/plugin/types.js +173 -0
  18. package/lib/common/plugin/utils.js +18 -0
  19. package/lib/common/utxobased/db/Models/ProcessorTransaction.js +122 -0
  20. package/lib/common/utxobased/db/Models/baselet.js +81 -0
  21. package/lib/common/utxobased/db/makeBaselets.js +123 -0
  22. package/lib/common/utxobased/db/makeMutex.js +17 -0
  23. package/lib/common/utxobased/db/makeProcessor.js +554 -0
  24. package/lib/common/utxobased/db/types.js +67 -0
  25. package/lib/common/utxobased/engine/await-lock.js +65 -0
  26. package/lib/common/utxobased/engine/constants.js +7 -0
  27. package/lib/common/utxobased/engine/makeServerStates.js +394 -0
  28. package/lib/common/utxobased/engine/makeUtxoEngine.js +690 -0
  29. package/lib/common/utxobased/engine/makeUtxoEngineState.js +1443 -0
  30. package/lib/common/utxobased/engine/makeUtxoWalletTools.js +216 -0
  31. package/lib/common/utxobased/engine/paymentRequest.js +102 -0
  32. package/lib/common/utxobased/engine/types.js +21 -0
  33. package/lib/common/utxobased/engine/util/defaultValidateConfirmations.js +19 -0
  34. package/lib/common/utxobased/engine/util/getOwnUtxosFromTx.js +54 -0
  35. package/lib/common/utxobased/engine/utils.js +239 -0
  36. package/lib/common/utxobased/info/all.js +67 -0
  37. package/lib/common/utxobased/info/badcoin.js +73 -0
  38. package/lib/common/utxobased/info/bitcoin.js +91 -0
  39. package/lib/common/utxobased/info/bitcoincash.js +93 -0
  40. package/lib/common/utxobased/info/bitcoincashtestnet.js +72 -0
  41. package/lib/common/utxobased/info/bitcoingold.js +85 -0
  42. package/lib/common/utxobased/info/bitcoingoldtestnet.js +71 -0
  43. package/lib/common/utxobased/info/bitcoinsv.js +76 -0
  44. package/lib/common/utxobased/info/bitcointestnet.js +81 -0
  45. package/lib/common/utxobased/info/dash.js +76 -0
  46. package/lib/common/utxobased/info/digibyte.js +76 -0
  47. package/lib/common/utxobased/info/dogecoin.js +76 -0
  48. package/lib/common/utxobased/info/eboost.js +70 -0
  49. package/lib/common/utxobased/info/feathercoin.js +76 -0
  50. package/lib/common/utxobased/info/groestlcoin.js +88 -0
  51. package/lib/common/utxobased/info/litecoin.js +82 -0
  52. package/lib/common/utxobased/info/qtum.js +67 -0
  53. package/lib/common/utxobased/info/ravencoin.js +70 -0
  54. package/lib/common/utxobased/info/scriptTemplates/bitcoincashScriptTemplates.js +56 -0
  55. package/lib/common/utxobased/info/scriptTemplates/types.js +14 -0
  56. package/lib/common/utxobased/info/smartcash.js +78 -0
  57. package/lib/common/utxobased/info/ufo.js +75 -0
  58. package/lib/common/utxobased/info/utxoPickers/dogeUtxoPicker.js +34 -0
  59. package/lib/common/utxobased/info/vertcoin.js +82 -0
  60. package/lib/common/utxobased/info/zcoin.js +72 -0
  61. package/lib/common/utxobased/keymanager/base.js +60 -0
  62. package/lib/common/utxobased/keymanager/bip69.js +31 -0
  63. package/lib/common/utxobased/keymanager/bitcoincashUtils/base32.js +88 -0
  64. package/lib/common/utxobased/keymanager/bitcoincashUtils/bn.js +210 -0
  65. package/lib/common/utxobased/keymanager/bitcoincashUtils/cashAddress.js +282 -0
  66. package/lib/common/utxobased/keymanager/cleaners.js +198 -0
  67. package/lib/common/utxobased/keymanager/coinmapper.js +12 -0
  68. package/lib/common/utxobased/keymanager/declarations/base58grscheck.d.js +1 -0
  69. package/lib/common/utxobased/keymanager/declarations/blake-hash.d.js +1 -0
  70. package/lib/common/utxobased/keymanager/declarations/bn.d.js +1 -0
  71. package/lib/common/utxobased/keymanager/declarations/bs58smartcheck.d.js +1 -0
  72. package/lib/common/utxobased/keymanager/declarations/wif-smart.d.js +1 -0
  73. package/lib/common/utxobased/keymanager/declarations/wifgrs.d.js +1 -0
  74. package/lib/common/utxobased/keymanager/keymanager.js +1214 -0
  75. package/lib/common/utxobased/keymanager/utxopicker/accumulative.js +52 -0
  76. package/lib/common/utxobased/keymanager/utxopicker/forceUseUtxo.js +59 -0
  77. package/lib/common/utxobased/keymanager/utxopicker/subtractFee.js +17 -0
  78. package/lib/common/utxobased/keymanager/utxopicker/types.js +42 -0
  79. package/lib/common/utxobased/keymanager/utxopicker/utils.js +159 -0
  80. package/lib/common/utxobased/keymanager/utxopicker.js +17 -0
  81. package/lib/common/utxobased/network/BlockBook.js +200 -0
  82. package/lib/common/utxobased/network/BlockBookAPI.js +335 -0
  83. package/lib/common/utxobased/network/Deferred.js +29 -0
  84. package/lib/common/utxobased/network/MakeSocketEmitter.js +35 -0
  85. package/lib/common/utxobased/network/Socket.js +362 -0
  86. package/lib/common/utxobased/network/nodejsWS.js +59 -0
  87. package/lib/common/utxobased/network/socketQueue.js +60 -0
  88. package/lib/common/utxobased/network/types.js +19 -0
  89. package/lib/common/utxobased/network/windowWS.js +54 -0
  90. package/lib/firo.js +15 -0
  91. package/lib/ftc.js +15 -0
  92. package/lib/index.js +19 -0
  93. package/lib/ltc.js +15 -0
  94. package/lib/src/bch.d.ts +3 -0
  95. package/lib/src/bsv.d.ts +3 -0
  96. package/lib/src/btc.d.ts +3 -0
  97. package/lib/src/common/constants.d.ts +9 -0
  98. package/lib/src/common/fees/calcMinerFeePerByte.d.ts +13 -0
  99. package/lib/src/common/fees/makeFees.d.ts +20 -0
  100. package/lib/src/common/fees/processInfoServerFees.d.ts +7 -0
  101. package/lib/src/common/fees/processMempoolSpaceFees.d.ts +13 -0
  102. package/lib/src/common/plugin/makeCurrencyPlugin.d.ts +3 -0
  103. package/lib/src/common/plugin/makeCurrencyTools.d.ts +8 -0
  104. package/lib/src/common/plugin/makeEngineEmitter.d.ts +23 -0
  105. package/lib/src/common/plugin/makeMetadata.d.ts +14 -0
  106. package/lib/src/common/plugin/pluginState.d.ts +34 -0
  107. package/lib/src/common/plugin/serverScores.d.ts +61 -0
  108. package/lib/src/common/plugin/types.d.ts +135 -0
  109. package/lib/src/common/plugin/utils.d.ts +6 -0
  110. package/lib/src/common/utxobased/db/Models/ProcessorTransaction.d.ts +16 -0
  111. package/lib/src/common/utxobased/db/Models/baselet.d.ts +28 -0
  112. package/lib/src/common/utxobased/db/makeBaselets.d.ts +33 -0
  113. package/lib/src/common/utxobased/db/makeMutex.d.ts +3 -0
  114. package/lib/src/common/utxobased/db/makeProcessor.d.ts +42 -0
  115. package/lib/src/common/utxobased/db/types.d.ts +47 -0
  116. package/lib/src/common/utxobased/engine/await-lock.d.ts +29 -0
  117. package/lib/src/common/utxobased/engine/constants.d.ts +4 -0
  118. package/lib/src/common/utxobased/engine/makeServerStates.d.ts +37 -0
  119. package/lib/src/common/utxobased/engine/makeUtxoEngine.d.ts +3 -0
  120. package/lib/src/common/utxobased/engine/makeUtxoEngineState.d.ts +108 -0
  121. package/lib/src/common/utxobased/engine/makeUtxoWalletTools.d.ts +52 -0
  122. package/lib/src/common/utxobased/engine/paymentRequest.d.ts +18 -0
  123. package/lib/src/common/utxobased/engine/types.d.ts +19 -0
  124. package/lib/src/common/utxobased/engine/util/defaultValidateConfirmations.d.ts +3 -0
  125. package/lib/src/common/utxobased/engine/util/getOwnUtxosFromTx.d.ts +4 -0
  126. package/lib/src/common/utxobased/engine/utils.d.ts +43 -0
  127. package/lib/src/common/utxobased/info/all.d.ts +22 -0
  128. package/lib/src/common/utxobased/info/badcoin.d.ts +3 -0
  129. package/lib/src/common/utxobased/info/bitcoin.d.ts +3 -0
  130. package/lib/src/common/utxobased/info/bitcoincash.d.ts +3 -0
  131. package/lib/src/common/utxobased/info/bitcoincashtestnet.d.ts +3 -0
  132. package/lib/src/common/utxobased/info/bitcoingold.d.ts +3 -0
  133. package/lib/src/common/utxobased/info/bitcoingoldtestnet.d.ts +3 -0
  134. package/lib/src/common/utxobased/info/bitcoinsv.d.ts +3 -0
  135. package/lib/src/common/utxobased/info/bitcointestnet.d.ts +6 -0
  136. package/lib/src/common/utxobased/info/dash.d.ts +3 -0
  137. package/lib/src/common/utxobased/info/digibyte.d.ts +3 -0
  138. package/lib/src/common/utxobased/info/dogecoin.d.ts +3 -0
  139. package/lib/src/common/utxobased/info/eboost.d.ts +3 -0
  140. package/lib/src/common/utxobased/info/feathercoin.d.ts +6 -0
  141. package/lib/src/common/utxobased/info/groestlcoin.d.ts +3 -0
  142. package/lib/src/common/utxobased/info/litecoin.d.ts +6 -0
  143. package/lib/src/common/utxobased/info/qtum.d.ts +3 -0
  144. package/lib/src/common/utxobased/info/ravencoin.d.ts +3 -0
  145. package/lib/src/common/utxobased/info/scriptTemplates/bitcoincashScriptTemplates.d.ts +2 -0
  146. package/lib/src/common/utxobased/info/scriptTemplates/types.d.ts +9 -0
  147. package/lib/src/common/utxobased/info/smartcash.d.ts +3 -0
  148. package/lib/src/common/utxobased/info/ufo.d.ts +3 -0
  149. package/lib/src/common/utxobased/info/utxoPickers/dogeUtxoPicker.d.ts +2 -0
  150. package/lib/src/common/utxobased/info/vertcoin.d.ts +3 -0
  151. package/lib/src/common/utxobased/info/zcoin.d.ts +6 -0
  152. package/lib/src/common/utxobased/keymanager/base.d.ts +9 -0
  153. package/lib/src/common/utxobased/keymanager/bip69.d.ts +19 -0
  154. package/lib/src/common/utxobased/keymanager/bitcoincashUtils/base32.d.ts +19 -0
  155. package/lib/src/common/utxobased/keymanager/bitcoincashUtils/bn.d.ts +2 -0
  156. package/lib/src/common/utxobased/keymanager/bitcoincashUtils/cashAddress.d.ts +12 -0
  157. package/lib/src/common/utxobased/keymanager/cleaners.d.ts +55 -0
  158. package/lib/src/common/utxobased/keymanager/coinmapper.d.ts +2 -0
  159. package/lib/src/common/utxobased/keymanager/keymanager.d.ts +198 -0
  160. package/lib/src/common/utxobased/keymanager/utxopicker/accumulative.d.ts +2 -0
  161. package/lib/src/common/utxobased/keymanager/utxopicker/forceUseUtxo.d.ts +2 -0
  162. package/lib/src/common/utxobased/keymanager/utxopicker/subtractFee.d.ts +2 -0
  163. package/lib/src/common/utxobased/keymanager/utxopicker/types.d.ts +36 -0
  164. package/lib/src/common/utxobased/keymanager/utxopicker/utils.d.ts +15 -0
  165. package/lib/src/common/utxobased/keymanager/utxopicker.d.ts +8 -0
  166. package/lib/src/common/utxobased/network/BlockBook.d.ts +33 -0
  167. package/lib/src/common/utxobased/network/BlockBookAPI.d.ts +163 -0
  168. package/lib/src/common/utxobased/network/Deferred.d.ts +8 -0
  169. package/lib/src/common/utxobased/network/MakeSocketEmitter.d.ts +13 -0
  170. package/lib/src/common/utxobased/network/Socket.d.ts +41 -0
  171. package/lib/src/common/utxobased/network/nodejsWS.d.ts +2 -0
  172. package/lib/src/common/utxobased/network/socketQueue.d.ts +8 -0
  173. package/lib/src/common/utxobased/network/types.d.ts +17 -0
  174. package/lib/src/common/utxobased/network/windowWS.d.ts +2 -0
  175. package/lib/src/firo.d.ts +3 -0
  176. package/lib/src/ftc.d.ts +3 -0
  177. package/lib/src/index.d.ts +4 -0
  178. package/lib/src/ltc.d.ts +3 -0
  179. package/lib/src/tbch.d.ts +3 -0
  180. package/lib/src/tbtc.d.ts +3 -0
  181. package/lib/src/tbtg.d.ts +3 -0
  182. package/lib/src/types.d.ts +6 -0
  183. package/lib/src/util/delay.d.ts +1 -0
  184. package/lib/src/util/filterUndefined.d.ts +1 -0
  185. package/lib/src/util/indexAtProtected.d.ts +5 -0
  186. package/lib/src/util/typeUtil.d.ts +8 -0
  187. package/lib/src/util/undefinedIfEmptyString.d.ts +1 -0
  188. package/lib/src/util/unixTime.d.ts +1 -0
  189. package/lib/tbch.js +15 -0
  190. package/lib/tbtc.js +15 -0
  191. package/lib/tbtg.js +15 -0
  192. package/lib/test/common/fees/calcMinerFeePerByte.spec.d.ts +1 -0
  193. package/lib/test/common/fees/fees.spec.d.ts +1 -0
  194. package/lib/test/common/plugin/currencyPlugin.fixtures/common.d.ts +29 -0
  195. package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/bitcoin.d.ts +2 -0
  196. package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/bitcoincash.d.ts +2 -0
  197. package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/bitcoinsv.d.ts +2 -0
  198. package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/digibyte.d.ts +2 -0
  199. package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/feathercoin.d.ts +2 -0
  200. package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/groestlcoin.d.ts +2 -0
  201. package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/litecoin.d.ts +2 -0
  202. package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/smartcash.d.ts +2 -0
  203. package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/zcoin.d.ts +2 -0
  204. package/lib/test/common/plugin/currencyPlugin.fixtures/index.d.ts +2 -0
  205. package/lib/test/common/plugin/currencyPlugin.spec.d.ts +1 -0
  206. package/lib/test/common/plugin/makeMetadata.spec.d.ts +1 -0
  207. package/lib/test/common/plugin/serverScores.spec.d.ts +1 -0
  208. package/lib/test/common/utxobased/addressFormat/addressFormatIndex/addressFormat.spec.d.ts +1 -0
  209. package/lib/test/common/utxobased/db/Processor.spec.d.ts +1 -0
  210. package/lib/test/common/utxobased/engine/PaymentRequest.spec.d.ts +1 -0
  211. package/lib/test/common/utxobased/engine/UtxoWalletTools.spec.d.ts +1 -0
  212. package/lib/test/common/utxobased/engine/engine.fixtures/bitcoinTestnet/tests.d.ts +70 -0
  213. package/lib/test/common/utxobased/engine/engine.fixtures/index.d.ts +65 -0
  214. package/lib/test/common/utxobased/engine/engine.spec.d.ts +1 -0
  215. package/lib/test/common/utxobased/keymanager/coins/altcointestfixtures.d.ts +54 -0
  216. package/lib/test/common/utxobased/keymanager/coins/bitcoincashtransactiontest.spec.d.ts +1 -0
  217. package/lib/test/common/utxobased/keymanager/coins/bitcointransactiontest.spec.d.ts +1 -0
  218. package/lib/test/common/utxobased/keymanager/coins/cashaddr.spec.d.ts +1 -0
  219. package/lib/test/common/utxobased/keymanager/coins/checkdatasig.spec.d.ts +1 -0
  220. package/lib/test/common/utxobased/keymanager/coins/groestlcointransactiontest.spec.d.ts +1 -0
  221. package/lib/test/common/utxobased/keymanager/coins/keymanagertest.spec.d.ts +1 -0
  222. package/lib/test/common/utxobased/network/BlockBook.spec.d.ts +1 -0
  223. package/lib/test/util/objectKeys.d.ts +8 -0
  224. package/lib/test/util/testLog.d.ts +3 -0
  225. package/lib/test/utils.d.ts +10 -0
  226. package/lib/types.js +7 -0
  227. package/lib/util/delay.js +4 -0
  228. package/lib/util/filterUndefined.js +4 -0
  229. package/lib/util/indexAtProtected.js +9 -0
  230. package/lib/util/typeUtil.js +9 -0
  231. package/lib/util/undefinedIfEmptyString.js +2 -0
  232. package/lib/util/unixTime.js +2 -0
  233. package/package.json +101 -0
package/lib/tbtc.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _makeCurrencyPlugin = require('./common/plugin/makeCurrencyPlugin');
4
+ var _bitcointestnet = require('./common/utxobased/info/bitcointestnet');
5
+
6
+ const plugin = (options) =>
7
+ _makeCurrencyPlugin.makeCurrencyPlugin.call(void 0, options, _bitcointestnet.info)
8
+
9
+ if (typeof window !== 'undefined') {
10
+ _optionalChain([window, 'access', _ => _.addEdgeCorePlugins, 'optionalCall', _2 => _2({
11
+ [_bitcointestnet.info.currencyInfo.pluginId]: plugin
12
+ })])
13
+ }
14
+
15
+ exports. default = plugin
package/lib/tbtg.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _makeCurrencyPlugin = require('./common/plugin/makeCurrencyPlugin');
4
+ var _bitcoingoldtestnet = require('./common/utxobased/info/bitcoingoldtestnet');
5
+
6
+ const plugin = (options) =>
7
+ _makeCurrencyPlugin.makeCurrencyPlugin.call(void 0, options, _bitcoingoldtestnet.info)
8
+
9
+ if (typeof window !== 'undefined') {
10
+ _optionalChain([window, 'access', _ => _.addEdgeCorePlugins, 'optionalCall', _2 => _2({
11
+ [_bitcoingoldtestnet.info.currencyInfo.pluginId]: plugin
12
+ })])
13
+ }
14
+
15
+ exports. default = plugin
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import { EdgeEncodeUri, EdgeWalletInfo } from 'edge-core-js/types';
2
+ import { EncodeUriMetadata, ExtendedParseUri } from '../../../../src/common/plugin/types';
3
+ export interface FixtureType {
4
+ pluginId: string;
5
+ WALLET_TYPE: string;
6
+ WALLET_FORMAT: string;
7
+ 'Test Currency code': string;
8
+ key: number[];
9
+ xpub: string;
10
+ 'invalid key name': EdgeWalletInfo;
11
+ 'invalid wallet type': EdgeWalletInfo;
12
+ importKey: {
13
+ validKeys: string[];
14
+ invalidKeys: string[];
15
+ unsupportedKeys: string[];
16
+ };
17
+ parseUri: {
18
+ [testName: string]: [string, ExtendedParseUri] | [string];
19
+ };
20
+ encodeUri: {
21
+ [testName: string]: [EdgeEncodeUri & EncodeUriMetadata, string] | [EdgeEncodeUri & EncodeUriMetadata];
22
+ };
23
+ getSplittableTypes?: {
24
+ [walletFormat: string]: string[];
25
+ };
26
+ }
27
+ export declare const key: number[];
28
+ export declare const mnemonics: string[];
29
+ export declare const airbitzSeeds: string[];
@@ -0,0 +1,2 @@
1
+ import { FixtureType } from '../common';
2
+ export declare const bitcoin: FixtureType;
@@ -0,0 +1,2 @@
1
+ import { FixtureType } from '../common';
2
+ export declare const bitcoincash: FixtureType;
@@ -0,0 +1,2 @@
1
+ import { FixtureType } from '../common';
2
+ export declare const bitcoinsv: FixtureType;
@@ -0,0 +1,2 @@
1
+ import { FixtureType } from '../common';
2
+ export declare const digibyte: FixtureType;
@@ -0,0 +1,2 @@
1
+ import { FixtureType } from '../common';
2
+ export declare const feathercoin: FixtureType;
@@ -0,0 +1,2 @@
1
+ import { FixtureType } from '../common';
2
+ export declare const groestlcoin: FixtureType;
@@ -0,0 +1,2 @@
1
+ import { FixtureType } from '../common';
2
+ export declare const litecoin: FixtureType;
@@ -0,0 +1,2 @@
1
+ import { FixtureType } from '../common';
2
+ export declare const smartcash: FixtureType;
@@ -0,0 +1,2 @@
1
+ import { FixtureType } from '../common';
2
+ export declare const zcoin: FixtureType;
@@ -0,0 +1,2 @@
1
+ import { FixtureType } from './common';
2
+ export declare const fixtures: FixtureType[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,70 @@
1
+ import { EdgeSpendInfo } from 'edge-core-js/types';
2
+ export interface SpendTests {
3
+ [key: string]: EdgeSpendInfo;
4
+ }
5
+ declare const _default: {
6
+ dummyDataPath: string;
7
+ pluginId: string;
8
+ WALLET_TYPE: string;
9
+ WALLET_FORMAT: string;
10
+ TX_AMOUNT: number;
11
+ 'Test Currency code': string;
12
+ key: number[];
13
+ xpub: string;
14
+ 'invalid key name': {
15
+ type: string;
16
+ keys: {
17
+ bitcoinKeyz: string;
18
+ };
19
+ };
20
+ 'invalid wallet type': {
21
+ type: string;
22
+ keys: {
23
+ bitcoinKeyz: string;
24
+ };
25
+ };
26
+ 'Make Engine': {
27
+ network: string;
28
+ id: string;
29
+ userSettings: {
30
+ enableOverrideServers: boolean;
31
+ electrumServers: string[][];
32
+ };
33
+ };
34
+ 'Sign message': {
35
+ success: {
36
+ message: string;
37
+ address: string;
38
+ signature: string;
39
+ publicKey: string;
40
+ };
41
+ };
42
+ BlockHeight: {
43
+ uri: string;
44
+ defaultHeight: number;
45
+ };
46
+ ChangeSettings: {
47
+ blockbookServers: never[];
48
+ enableCustomServers: boolean;
49
+ };
50
+ 'Address used from cache': {
51
+ wrongFormat: string[];
52
+ notInWallet: string[];
53
+ empty: {
54
+ 'P2SH address': string;
55
+ };
56
+ nonEmpty: {
57
+ 'P2SH address 1': string;
58
+ 'P2SH address 2': string;
59
+ 'P2SH address 3': string;
60
+ };
61
+ };
62
+ 'Add Gap Limit': {
63
+ derived: string[];
64
+ future: never[];
65
+ };
66
+ Spend: SpendTests;
67
+ InsufficientFundsError: SpendTests;
68
+ Sweep: SpendTests;
69
+ };
70
+ export default _default;
@@ -0,0 +1,65 @@
1
+ export declare const fixtures: {
2
+ dummyDataPath: string;
3
+ pluginId: string;
4
+ WALLET_TYPE: string;
5
+ WALLET_FORMAT: string;
6
+ TX_AMOUNT: number;
7
+ 'Test Currency code': string;
8
+ key: number[];
9
+ xpub: string;
10
+ 'invalid key name': {
11
+ type: string;
12
+ keys: {
13
+ bitcoinKeyz: string;
14
+ };
15
+ };
16
+ 'invalid wallet type': {
17
+ type: string;
18
+ keys: {
19
+ bitcoinKeyz: string;
20
+ };
21
+ };
22
+ 'Make Engine': {
23
+ network: string;
24
+ id: string;
25
+ userSettings: {
26
+ enableOverrideServers: boolean;
27
+ electrumServers: string[][];
28
+ };
29
+ };
30
+ 'Sign message': {
31
+ success: {
32
+ message: string;
33
+ address: string;
34
+ signature: string;
35
+ publicKey: string;
36
+ };
37
+ };
38
+ BlockHeight: {
39
+ uri: string;
40
+ defaultHeight: number;
41
+ };
42
+ ChangeSettings: {
43
+ blockbookServers: never[];
44
+ enableCustomServers: boolean;
45
+ };
46
+ 'Address used from cache': {
47
+ wrongFormat: string[];
48
+ notInWallet: string[];
49
+ empty: {
50
+ 'P2SH address': string;
51
+ };
52
+ nonEmpty: {
53
+ 'P2SH address 1': string;
54
+ 'P2SH address 2': string;
55
+ 'P2SH address 3': string;
56
+ };
57
+ };
58
+ 'Add Gap Limit': {
59
+ derived: string[];
60
+ future: never[];
61
+ };
62
+ Spend: import("./bitcoinTestnet/tests").SpendTests;
63
+ InsufficientFundsError: import("./bitcoinTestnet/tests").SpendTests;
64
+ Sweep: import("./bitcoinTestnet/tests").SpendTests;
65
+ }[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,54 @@
1
+ import { AddressTypeEnum, BIP43PurposeTypeEnum, ScriptTypeEnum } from '../../../../../src/common/utxobased/keymanager/keymanager';
2
+ interface SeedToXPrivTests {
3
+ xpriv: string;
4
+ type: BIP43PurposeTypeEnum;
5
+ }
6
+ interface XPrivToXPubTests {
7
+ xpriv: string;
8
+ xpub: string;
9
+ type: BIP43PurposeTypeEnum;
10
+ }
11
+ interface WifToPrivateKeyTests {
12
+ wifKey: string;
13
+ }
14
+ interface XPrivToWifTests {
15
+ xpriv: string;
16
+ wifKey: string;
17
+ type: BIP43PurposeTypeEnum;
18
+ }
19
+ interface AddressToScriptPubkeyTests {
20
+ extraMessage?: string;
21
+ address: string;
22
+ scriptPubkey: string;
23
+ }
24
+ interface XPubToPubkeyTests {
25
+ xpub: string;
26
+ type: BIP43PurposeTypeEnum;
27
+ bip44ChangeIndex: 0 | 1;
28
+ bip44AddressIndex: number;
29
+ scriptType: ScriptTypeEnum;
30
+ addressType: AddressTypeEnum;
31
+ address: string;
32
+ legacyAddress?: string;
33
+ }
34
+ interface SignMessageTests {
35
+ wif: string;
36
+ message: string;
37
+ signature: string;
38
+ }
39
+ interface Coin {
40
+ name: string;
41
+ mnemonic: string;
42
+ seedToXPrivTests: SeedToXPrivTests[];
43
+ xprivToXPubTests: XPrivToXPubTests[];
44
+ wifToPrivateKeyTests?: WifToPrivateKeyTests[];
45
+ xprivToWifTests?: XPrivToWifTests[];
46
+ xpubToPubkeyTests: XPubToPubkeyTests[];
47
+ addressToScriptPubkeyTests: AddressToScriptPubkeyTests[];
48
+ signMessageTests?: SignMessageTests[];
49
+ }
50
+ interface Fixture {
51
+ coins: Coin[];
52
+ }
53
+ export declare const fixtures: Fixture;
54
+ export {};
@@ -0,0 +1,8 @@
1
+ interface ObjectType {
2
+ [key: string]: unknown;
3
+ }
4
+ /**
5
+ * A type safe way to get the keys of an object.
6
+ */
7
+ export declare const objectKeys: <T extends ObjectType>(object: T) => (keyof T)[];
8
+ export {};
@@ -0,0 +1,3 @@
1
+ import { EdgeLog } from 'edge-core-js/types';
2
+ export declare const noOp: (..._args: any[]) => void;
3
+ export declare const testLog: EdgeLog;
@@ -0,0 +1,10 @@
1
+ import { Disklet } from 'disklet';
2
+ import { EdgeIo, EdgeLog } from 'edge-core-js/types';
3
+ import { PluginInfo } from '../src/common/plugin/types';
4
+ export declare const makeFakePluginInfo: () => PluginInfo;
5
+ export declare const makeFakeLog: () => EdgeLog;
6
+ interface FakeIoConfig {
7
+ disklet?: Disklet;
8
+ }
9
+ export declare const makeFakeIo: (config?: FakeIoConfig | undefined) => EdgeIo;
10
+ export {};
package/lib/types.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+
4
+
5
+
6
+
7
+
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); const delay = async (ms) =>
2
+ await new Promise(resolve => {
3
+ setTimeout(resolve, ms)
4
+ }); exports.delay = delay
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// Accepts an array of values and returns a new array of values without undefined values.
2
+ const filterUndefined = (values) => {
3
+ return values.filter(value => value !== undefined)
4
+ }; exports.filterUndefined = filterUndefined
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
+ * Gets an element out of an array but includes protection if the index
3
+ * overflows the length of the array.
4
+ **/
5
+ const indexAtProtected = (
6
+ array,
7
+ index
8
+ ) =>
9
+ array != null ? array[Math.min(index, array.length - 1)] : undefined; exports.indexAtProtected = indexAtProtected
@@ -0,0 +1,9 @@
1
+ "use strict";/**
2
+ * Like Pick, but removed fields are optional.
3
+ */
4
+
5
+
6
+
7
+
8
+
9
+
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); const undefinedIfEmptyString = (str) =>
2
+ str !== '' ? str : undefined; exports.undefinedIfEmptyString = undefinedIfEmptyString
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); const unixTime = (ts = Date.now()) =>
2
+ Math.round(ts / 1000); exports.unixTime = unixTime
package/package.json ADDED
@@ -0,0 +1,101 @@
1
+ {
2
+ "name": "edge-currency-plugins",
3
+ "version": "1.0.0-rc.1",
4
+ "description": "Edge currency plugins to fetch and process wallet accounts, balances and transactions.",
5
+ "repository": "https://github.app/EdgeApp/edge-currency-plugins",
6
+ "license": "MIT",
7
+ "author": "Airbitz, Inc.",
8
+ "main": "./lib/index.js",
9
+ "browser": {
10
+ "ws": false
11
+ },
12
+ "types": "./lib/index.d.ts",
13
+ "files": [
14
+ "lib/*",
15
+ "package.json",
16
+ "README.md"
17
+ ],
18
+ "scripts": {
19
+ "clean": "rimraf lib",
20
+ "coverage": "nyc mocha && nyc report --reporter=cobertura --reporter=html",
21
+ "fix": "eslint . --fix",
22
+ "lib": "sucrase -q -t typescript,imports -d ./lib ./src",
23
+ "lint": "eslint .",
24
+ "precommit": "lint-staged && npm-run-all types test",
25
+ "prepare": "husky install && npm-run-all clean -p lib types",
26
+ "start": "node -r sucrase/register src/index.ts",
27
+ "start.dev": "nodemon",
28
+ "test": "mocha",
29
+ "types": "tsc",
30
+ "verify": "npm-run-all lint types"
31
+ },
32
+ "lint-staged": {
33
+ "*.{js,ts,json}": "eslint"
34
+ },
35
+ "dependencies": {
36
+ "altcoin-js": "https://github.com/EdgeApp/altcoin-js.git#master",
37
+ "async-mutex": "^0.2.6",
38
+ "baselet": "^0.2.2",
39
+ "biggystring": "^4.0.0",
40
+ "bip32": "^2.0.5",
41
+ "bip32grs": "^2.0.5",
42
+ "bip39": "^3.0.2",
43
+ "bitcoinjs-message": "^2.2.0",
44
+ "blake-hash": "^2.0.0",
45
+ "bn.js": "^5.1.2",
46
+ "bs58": "^4.0.1",
47
+ "bs58grscheck": "^2.1.2",
48
+ "bs58smartcheck": "^2.0.4",
49
+ "cleaners": "^0.3.12",
50
+ "disklet": "^0.4.5",
51
+ "edge-core-js": "^0.19.19",
52
+ "memlet": "^0.1.6",
53
+ "uri-js": "^4.4.0",
54
+ "url-parse": "^1.5.2",
55
+ "wif-smart": "^2.0.0",
56
+ "wifgrs": "^2.0.6",
57
+ "ws": "^7.4.6"
58
+ },
59
+ "devDependencies": {
60
+ "@types/bn.js": "^5.1.0",
61
+ "@types/bs58": "^4.0.1",
62
+ "@types/chai": "^4.2.9",
63
+ "@types/chai-as-promised": "^7.1.3",
64
+ "@types/jsonfile": "^6.0.1",
65
+ "@types/mocha": "^7.0.1",
66
+ "@types/node": "^16.11.18",
67
+ "@types/node-fetch": "2.x",
68
+ "@types/request": "^2.48.7",
69
+ "@types/url-parse": "^1.4.3",
70
+ "@types/ws": "^7.2.6",
71
+ "@typescript-eslint/eslint-plugin": "^4.8.2",
72
+ "@typescript-eslint/parser": "^4.8.2",
73
+ "chai": "^4.2.0",
74
+ "chai-as-promised": "^7.1.1",
75
+ "eslint": "^7.14.0",
76
+ "eslint-config-standard-kit": "0.15.1",
77
+ "eslint-plugin-import": "^2.22.1",
78
+ "eslint-plugin-json-files": "^1.3.0",
79
+ "eslint-plugin-node": "^11.1.0",
80
+ "eslint-plugin-prettier": "^3.1.4",
81
+ "eslint-plugin-promise": "^4.2.1",
82
+ "eslint-plugin-simple-import-sort": "^6.0.1",
83
+ "husky": "^7.0.4",
84
+ "jsonfile": "^6.1.0",
85
+ "lint-staged": "^10.5.3",
86
+ "mocha": "^8.1.3",
87
+ "mocha-junit-reporter": "^2.0.2",
88
+ "mocha-multi-reporters": "^1.5.1",
89
+ "mochawesome": "^7.0.1",
90
+ "node-fetch": "2.x",
91
+ "nodemon": "^2.0.15",
92
+ "npm-run-all": "^4.1.5",
93
+ "nyc": "^15.1.0",
94
+ "parcel": "^1.12.4",
95
+ "prettier": "^2.2.0",
96
+ "request": "^2.88.2",
97
+ "rimraf": "^3.0.2",
98
+ "sucrase": "^3.12.1",
99
+ "typescript": "^4.1.2"
100
+ }
101
+ }