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
@@ -0,0 +1,70 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ const currencyInfo = {
6
+ pluginId: 'ravencoin',
7
+ walletType: 'wallet:ravencoin',
8
+ currencyCode: 'RVN',
9
+ displayName: 'Ravencoin',
10
+ denominations: [{ name: 'RVN', multiplier: '100000000', symbol: 'R' }],
11
+
12
+ // Configuration options:
13
+ defaultSettings: {
14
+ customFeeSettings: ['satPerByte'],
15
+ blockbookServers: [
16
+ 'wss://blockbook.ravencoin.org',
17
+ 'wss://blockbook-rvn-sfo3.edge.app'
18
+ ],
19
+ enableCustomServers: false
20
+ },
21
+ customFeeTemplate: [
22
+ {
23
+ type: 'nativeAmount',
24
+ key: 'satPerByte',
25
+ displayName: 'Satoshis Per Byte',
26
+ displayMultiplier: '0'
27
+ }
28
+ ],
29
+ metaTokens: [],
30
+
31
+ // Explorers:
32
+ addressExplorer: 'https://ravencoin.network/address/%s',
33
+ blockExplorer: 'https://ravencoin.network/block/%s',
34
+ transactionExplorer: 'https://ravencoin.network/tx/%s'
35
+ }
36
+
37
+ const engineInfo = {
38
+ formats: ['bip44', 'bip32'],
39
+ gapLimit: 10,
40
+ defaultFee: 1000,
41
+ feeUpdateInterval: 60000,
42
+ simpleFeeSettings: {
43
+ highFee: '150',
44
+ lowFee: '20',
45
+ standardFeeLow: '50',
46
+ standardFeeHigh: '100',
47
+ standardFeeLowAmount: '173200',
48
+ standardFeeHighAmount: '8670000'
49
+ }
50
+ }
51
+
52
+ const coinInfo = {
53
+ name: 'ravencoin',
54
+ segwit: false,
55
+ coinType: 175,
56
+ prefixes: {
57
+ messagePrefix: ['\x18Bitcoin Signed Message:\n'],
58
+ wif: [0x80],
59
+ legacyXPriv: [0x0488ade4],
60
+ legacyXPub: [0x0488b21e],
61
+ pubkeyHash: [0x3c],
62
+ scriptHash: [0x7a]
63
+ }
64
+ }; exports.coinInfo = coinInfo
65
+
66
+ const info = {
67
+ currencyInfo,
68
+ engineInfo,
69
+ coinInfo: exports.coinInfo
70
+ }; exports.info = info
@@ -0,0 +1,56 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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
+ const OP_CHECKDATASIGVERIFY = 'bb'
4
+ const OP_CHECKDATASIG = 'ba'
5
+ const OP_CHECKSIG = 'ac'
6
+ const CDS_SIGNATURE =
7
+ '30440220256c12175e809381f97637933ed6ab97737d263eaaebca6add21bced67fd12a402205ce29ecc1369d6fc1b51977ed38faaf41119e3be1d7edfafd7cfaf0b6061bd07'
8
+ const CDS_MESSAGE = ''
9
+ const CDS_PUBKEY =
10
+ '038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508'
11
+
12
+ const hexToVarByte = (hex) => {
13
+ const len = hex.length / 2
14
+ const str = len.toString(16)
15
+ const hexLen = str.length % 2 === 0 ? str : `0${str}`
16
+ return hexLen + hex
17
+ }
18
+
19
+ const cds = (
20
+ cdsSigs,
21
+ cdsMsg,
22
+ cdsPubKey,
23
+ pubKey
24
+ ) => {
25
+ const cdsSuffix = `${hexToVarByte(pubKey)}${OP_CHECKSIG}`
26
+ const cdsPrefix = `${hexToVarByte(cdsSigs)}${hexToVarByte(
27
+ cdsMsg
28
+ )}${hexToVarByte(cdsPubKey)}`
29
+ return [cdsPrefix, cdsSuffix]
30
+ }
31
+
32
+ const scriptTemplates = {
33
+ replayProtection: (pubKey) => {
34
+ return cds(CDS_SIGNATURE, CDS_MESSAGE, CDS_PUBKEY, pubKey).join(
35
+ OP_CHECKDATASIGVERIFY
36
+ )
37
+ },
38
+ checkdatasig: (
39
+ pubKey,
40
+ optionalArgs
41
+ ) => {
42
+ const cdsSig = _nullishCoalesce(_optionalChain([optionalArgs, 'optionalAccess', _ => _.cdsSig]), () => ( ''))
43
+ const cdsMsg = _nullishCoalesce(_optionalChain([optionalArgs, 'optionalAccess', _2 => _2.cdsMsg]), () => ( ''))
44
+ const cdsPubKey = _nullishCoalesce(_optionalChain([optionalArgs, 'optionalAccess', _3 => _3.cdsPubKey]), () => ( ''))
45
+ return cds(cdsSig, cdsMsg, cdsPubKey, pubKey).join(OP_CHECKDATASIG)
46
+ },
47
+ checkdatasigverify: (
48
+ pubKey,
49
+ optionalArgs
50
+ ) => {
51
+ const cdsSig = _nullishCoalesce(_optionalChain([optionalArgs, 'optionalAccess', _4 => _4.cdsSig]), () => ( ''))
52
+ const cdsMsg = _nullishCoalesce(_optionalChain([optionalArgs, 'optionalAccess', _5 => _5.cdsMsg]), () => ( ''))
53
+ const cdsPubKey = _nullishCoalesce(_optionalChain([optionalArgs, 'optionalAccess', _6 => _6.cdsPubKey]), () => ( ''))
54
+ return cds(cdsSig, cdsMsg, cdsPubKey, pubKey).join(OP_CHECKDATASIGVERIFY)
55
+ }
56
+ }; exports.scriptTemplates = scriptTemplates
@@ -0,0 +1,78 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _altcoinjs = require('altcoin-js');
2
+ var _bs58smartcheck = require('bs58smartcheck'); var base58smart = _interopRequireWildcard(_bs58smartcheck);
3
+
4
+ var _wifsmart = require('wif-smart'); var wifsmart = _interopRequireWildcard(_wifsmart);
5
+
6
+
7
+
8
+ const currencyInfo = {
9
+ pluginId: 'smartcash',
10
+ walletType: 'wallet:smartcash',
11
+ currencyCode: 'SMART',
12
+ displayName: 'SmartCash',
13
+ denominations: [
14
+ { name: 'SMART', multiplier: '100000000', symbol: 'S' },
15
+ { name: 'mSMART', multiplier: '100000', symbol: 'mS' }
16
+ ],
17
+
18
+ // Configuration options:
19
+ defaultSettings: {
20
+ customFeeSettings: ['satPerByte'],
21
+ blockbookServers: [],
22
+ enableCustomServers: false
23
+ },
24
+ customFeeTemplate: [
25
+ {
26
+ type: 'nativeAmount',
27
+ key: 'satPerByte',
28
+ displayName: 'Satoshis Per Byte',
29
+ displayMultiplier: '0'
30
+ }
31
+ ],
32
+ metaTokens: [],
33
+
34
+ // Explorers:
35
+ addressExplorer: 'https://insight.smartcash.cc/address/%s',
36
+ blockExplorer: 'https://insight.smartcash.cc/block/%s',
37
+ transactionExplorer: 'https://insight.smartcash.cc/tx/%s'
38
+ }
39
+
40
+ const engineInfo = {
41
+ formats: ['bip44', 'bip32'],
42
+ gapLimit: 10,
43
+ defaultFee: 100000,
44
+ feeUpdateInterval: 60000,
45
+ simpleFeeSettings: {
46
+ highFee: '1500',
47
+ lowFee: '200',
48
+ standardFeeLow: '500',
49
+ standardFeeHigh: '1000',
50
+ standardFeeLowAmount: '1732000',
51
+ standardFeeHighAmount: '86700000'
52
+ }
53
+ }
54
+
55
+ const coinInfo = {
56
+ name: 'smartcash',
57
+ segwit: false,
58
+ coinType: 224,
59
+ sighashFunction: _altcoinjs.crypto.sha256,
60
+ txHashFunction: _altcoinjs.crypto.sha256,
61
+ bs58DecodeFunc: base58smart.decode,
62
+ bs58EncodeFunc: base58smart.encode,
63
+ wifEncodeFunc: wifsmart.encode,
64
+ prefixes: {
65
+ messagePrefix: ['\x18Bitcoin Signed Message:\n'],
66
+ wif: [0xbf],
67
+ legacyXPriv: [0x0488ade4],
68
+ legacyXPub: [0x0488b21e],
69
+ pubkeyHash: [0x3f],
70
+ scriptHash: [0x12]
71
+ }
72
+ }; exports.coinInfo = coinInfo
73
+
74
+ const info = {
75
+ currencyInfo,
76
+ engineInfo,
77
+ coinInfo: exports.coinInfo
78
+ }; exports.info = info
@@ -0,0 +1,75 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ const currencyInfo = {
6
+ pluginId: 'ufo',
7
+ walletType: 'wallet:ufo',
8
+ currencyCode: 'UFO',
9
+ displayName: 'UFO',
10
+ denominations: [
11
+ { name: 'UFO', multiplier: '100000000', symbol: 'Ʉ' },
12
+ { name: 'kUFO', multiplier: '100000000000', symbol: 'kɄ' }
13
+ ],
14
+
15
+ // Configuration options:
16
+ defaultSettings: {
17
+ customFeeSettings: ['satPerByte'],
18
+ blockbookServers: ['wss://blockbook.ufobject.com'],
19
+ enableCustomServers: false
20
+ },
21
+ customFeeTemplate: [
22
+ {
23
+ type: 'nativeAmount',
24
+ key: 'satPerByte',
25
+ displayName: 'Satoshis Per Byte',
26
+ displayMultiplier: '0'
27
+ }
28
+ ],
29
+ metaTokens: [],
30
+
31
+ // Explorers:
32
+ addressExplorer: 'https://explorer.ufobject.com/address/%s',
33
+ blockExplorer: 'https://explorer.ufobject.com/block/%s',
34
+ transactionExplorer: 'https://explorer.ufobject.com/tx/%s'
35
+ }
36
+
37
+ const engineInfo = {
38
+ formats: ['bip49', 'bip84', 'bip44', 'bip32'],
39
+ gapLimit: 10,
40
+ defaultFee: 50000,
41
+ feeUpdateInterval: 60000,
42
+ simpleFeeSettings: {
43
+ highFee: '2250',
44
+ lowFee: '1000',
45
+ standardFeeLow: '1100',
46
+ standardFeeHigh: '2000',
47
+ standardFeeLowAmount: '51282051282051',
48
+ standardFeeHighAmount: '5128205128205100'
49
+ }
50
+ }
51
+
52
+ const coinInfo = {
53
+ name: 'uniformfiscalobject',
54
+ segwit: true,
55
+ coinType: 202,
56
+ prefixes: {
57
+ messagePrefix: ['\x18Bitcoin Signed Message:\n'],
58
+ wif: [0x9b],
59
+ legacyXPriv: [0x0488ade4],
60
+ legacyXPub: [0x0488b21e],
61
+ wrappedSegwitXPriv: [0x049d7878],
62
+ wrappedSegwitXPub: [0x049d7cb2],
63
+ segwitXPriv: [0x04b2430c],
64
+ segwitXPub: [0x04b24746],
65
+ pubkeyHash: [0x1b],
66
+ scriptHash: [0x44, 0x05],
67
+ bech32: ['uf']
68
+ }
69
+ }; exports.coinInfo = coinInfo
70
+
71
+ const info = {
72
+ currencyInfo,
73
+ engineInfo,
74
+ coinInfo: exports.coinInfo
75
+ }; exports.info = info
@@ -0,0 +1,34 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _accumulative = require('../../keymanager/utxopicker/accumulative');
7
+ var _forceUseUtxo = require('../../keymanager/utxopicker/forceUseUtxo');
8
+ var _subtractFee = require('../../keymanager/utxopicker/subtractFee');
9
+
10
+ function makeDogeUtxoPicker() {
11
+ // According to https://github.com/dogecoin/dogecoin/discussions/2347 the min fee rate is now 0.001 Doge per Kilobyte
12
+ const minRelayFeeRate = 0.001 / 1000
13
+
14
+ return {
15
+ forceUseUtxo: (args) => {
16
+ if (args.feeRate < minRelayFeeRate) {
17
+ args.feeRate = minRelayFeeRate
18
+ }
19
+ return _forceUseUtxo.forceUseUtxo.call(void 0, args)
20
+ },
21
+ subtractFee: (args) => {
22
+ if (args.feeRate < minRelayFeeRate) {
23
+ args.feeRate = minRelayFeeRate
24
+ }
25
+ return _subtractFee.subtractFee.call(void 0, args)
26
+ },
27
+ accumulative: (args) => {
28
+ if (args.feeRate < minRelayFeeRate) {
29
+ args.feeRate = minRelayFeeRate
30
+ }
31
+ return _accumulative.accumulative.call(void 0, args)
32
+ }
33
+ }
34
+ } exports.makeDogeUtxoPicker = makeDogeUtxoPicker;
@@ -0,0 +1,82 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ const currencyInfo = {
6
+ pluginId: 'vertcoin',
7
+ walletType: 'wallet:vertcoin',
8
+ currencyCode: 'VTC',
9
+ displayName: 'Vertcoin',
10
+ denominations: [
11
+ { name: 'VTC', multiplier: '100000000', symbol: 'V' },
12
+ { name: 'mVTC', multiplier: '100000', symbol: 'mV' }
13
+ ],
14
+
15
+ // Configuration options:
16
+ defaultSettings: {
17
+ customFeeSettings: ['satPerByte'],
18
+ blockbookServers: [
19
+ 'wss://vtc1.trezor.io',
20
+ 'wss://vtc2.trezor.io',
21
+ 'wss://vtc3.trezor.io',
22
+ 'wss://vtc4.trezor.io',
23
+ 'wss://vtc5.trezor.io'
24
+ ],
25
+ enableCustomServers: false
26
+ },
27
+ customFeeTemplate: [
28
+ {
29
+ type: 'nativeAmount',
30
+ key: 'satPerByte',
31
+ displayName: 'Satoshis Per Byte',
32
+ displayMultiplier: '0'
33
+ }
34
+ ],
35
+ metaTokens: [],
36
+
37
+ // Explorers:
38
+ addressExplorer: 'https://insight.vertcoin.org/address/%s',
39
+ blockExplorer: 'https://insight.vertcoin.org/block/%s',
40
+ transactionExplorer: 'https://insight.vertcoin.org/tx/%s'
41
+ }
42
+
43
+ const engineInfo = {
44
+ formats: ['bip49', 'bip84', 'bip44', 'bip32'],
45
+ forks: [],
46
+ gapLimit: 10,
47
+ defaultFee: 1000,
48
+ feeUpdateInterval: 60000,
49
+ simpleFeeSettings: {
50
+ highFee: '150',
51
+ lowFee: '20',
52
+ standardFeeLow: '50',
53
+ standardFeeHigh: '100',
54
+ standardFeeLowAmount: '173200',
55
+ standardFeeHighAmount: '8670000'
56
+ }
57
+ }
58
+
59
+ const coinInfo = {
60
+ name: 'vertcoin',
61
+ segwit: true,
62
+ coinType: 28,
63
+ prefixes: {
64
+ messagePrefix: ['\x18Bitcoin Signed Message:\n'],
65
+ wif: [0x80],
66
+ legacyXPriv: [0x0488ade4],
67
+ legacyXPub: [0x0488b21e],
68
+ wrappedSegwitXPriv: [0x0488ade4],
69
+ wrappedSegwitXPub: [0x0488b21e],
70
+ segwitXPriv: [0x0488ade4],
71
+ segwitXPub: [0x0488b21e],
72
+ pubkeyHash: [0x47],
73
+ scriptHash: [0x05],
74
+ bech32: ['vtc']
75
+ }
76
+ }; exports.coinInfo = coinInfo
77
+
78
+ const info = {
79
+ currencyInfo,
80
+ engineInfo,
81
+ coinInfo: exports.coinInfo
82
+ }; exports.info = info
@@ -0,0 +1,72 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _constants = require('../../constants');
4
+
5
+
6
+ const currencyInfo = {
7
+ pluginId: 'zcoin',
8
+ walletType: 'wallet:zcoin',
9
+ displayName: 'Firo',
10
+ currencyCode: 'FIRO',
11
+ denominations: [
12
+ { name: 'FIRO', multiplier: '100000000', symbol: 'ƒ' },
13
+ { name: 'mFIRO', multiplier: '100000', symbol: 'mƒ' }
14
+ ],
15
+
16
+ // Configuration options:
17
+ defaultSettings: {
18
+ customFeeSettings: ['satPerByte'],
19
+ blockbookServers: ['wss://blockbook.firo.org'],
20
+ enableCustomServers: false
21
+ },
22
+ customFeeTemplate: [
23
+ {
24
+ type: 'nativeAmount',
25
+ key: 'satPerByte',
26
+ displayName: 'Satoshis Per Byte',
27
+ displayMultiplier: '0'
28
+ }
29
+ ],
30
+ metaTokens: [],
31
+
32
+ // Explorers:
33
+ addressExplorer: 'https://insight.zcoin.io/address/%s',
34
+ blockExplorer: 'https://insight.zcoin.io/block/%s',
35
+ transactionExplorer: 'https://insight.zcoin.io/tx/%s',
36
+
37
+ // Images:
38
+ symbolImage: `${_constants.IMAGE_SERVER_URL}/zcoin-logo-solo-64.png`,
39
+ symbolImageDarkMono: `${_constants.IMAGE_SERVER_URL}/zcoin-logo-solo-64.png`
40
+ }; exports.currencyInfo = currencyInfo
41
+
42
+ const engineInfo = {
43
+ formats: ['bip44', 'bip32'],
44
+ uriPrefix: 'firo',
45
+ gapLimit: 10,
46
+ defaultFee: 1000,
47
+ feeUpdateInterval: 60000,
48
+ simpleFeeSettings: {
49
+ highFee: '150',
50
+ lowFee: '20',
51
+ standardFeeLow: '50',
52
+ standardFeeHigh: '100',
53
+ standardFeeLowAmount: '173200',
54
+ standardFeeHighAmount: '8670000'
55
+ }
56
+ }; exports.engineInfo = engineInfo
57
+
58
+ const coinInfo = {
59
+ name: 'zcoin',
60
+ segwit: false,
61
+ coinType: 136,
62
+ prefixes: {
63
+ messagePrefix: ['\x18Zcoin Signed Message:\n'],
64
+ wif: [0xd2],
65
+ legacyXPriv: [0x0488ade4],
66
+ legacyXPub: [0x0488b21e],
67
+ pubkeyHash: [0x52],
68
+ scriptHash: [0x7]
69
+ }
70
+ }; exports.coinInfo = coinInfo
71
+
72
+ const info = { currencyInfo: exports.currencyInfo, engineInfo: exports.engineInfo, coinInfo: exports.coinInfo }; exports.info = info
@@ -0,0 +1,60 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }'use strict'
2
+
3
+ var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
4
+ var _buffer = require('buffer');
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ function base58Base(
13
+ checksumFn
14
+ ) {
15
+ // Encode a buffer as a base58-check encoded string
16
+ function encode(payload) {
17
+ const checksum = checksumFn(payload)
18
+
19
+ return _bs582.default.encode(_buffer.Buffer.concat([payload, checksum], payload.length + 4))
20
+ }
21
+
22
+ function decodeRaw(buffer) {
23
+ const payload = buffer.slice(0, -4)
24
+ const checksum = buffer.slice(-4)
25
+ const newChecksum = checksumFn(payload)
26
+
27
+ if (
28
+ ((checksum[0] ^ newChecksum[0]) |
29
+ (checksum[1] ^ newChecksum[1]) |
30
+ (checksum[2] ^ newChecksum[2]) |
31
+ (checksum[3] ^ newChecksum[3])) ===
32
+ 1
33
+ )
34
+ return
35
+
36
+ return payload
37
+ }
38
+
39
+ // Decode a base58-check encoded string to a buffer, no result if checksum is wrong
40
+ function decodeUnsafe(stringPayload) {
41
+ const buffer = _bs582.default.decodeUnsafe(stringPayload)
42
+ if (buffer == null) return
43
+
44
+ return decodeRaw(buffer)
45
+ }
46
+
47
+ function decode(payload) {
48
+ if (payload == null) throw new Error('Invalid base58 string')
49
+ const buffer = _bs582.default.decode(payload)
50
+ const bPayload = decodeRaw(buffer)
51
+ if (bPayload == null) throw new Error('Invalid checksum')
52
+ return bPayload
53
+ }
54
+
55
+ return {
56
+ encode,
57
+ decode,
58
+ decodeUnsafe
59
+ }
60
+ } exports.base58Base = base58Base;
@@ -0,0 +1,31 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});/***
2
+ * https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki
3
+ */
4
+
5
+
6
+
7
+ /***
8
+ * Previous transaction hashes (in reversed byte-order) are to be sorted in ascending order, lexicographically.
9
+ * In the event of two matching transaction hashes,
10
+ * the respective previous output indices will be compared by their integer value, in ascending order.
11
+ * If the previous output indices match, the inputs are considered equal.
12
+ */
13
+ const sortInputs = (inputs) =>
14
+ [...inputs].sort((a, b) => {
15
+ const aHash = Buffer.from(a.hash).reverse()
16
+ const bHash = Buffer.from(b.hash).reverse()
17
+ const compare = aHash.compare(bHash)
18
+ return compare !== 0 ? compare : a.index - b.index
19
+ }); exports.sortInputs = sortInputs
20
+
21
+ /***
22
+ * Transaction output amounts (as 64-bit unsigned integers) are to be sorted in ascending order.
23
+ * In the event of two matching output amounts,
24
+ * the respective output scriptPubKeys (as a byte-array) will be compared lexicographically, in ascending order.
25
+ * If the scriptPubKeys match, the outputs are considered equal.
26
+ * If the previous output indices match, the inputs are considered equal.
27
+ */
28
+ const sortOutputs = (outputs) =>
29
+ [...outputs].sort((a, b) =>
30
+ a.value === b.value ? a.script.compare(b.script) : a.value - b.value
31
+ ); exports.sortOutputs = sortOutputs
@@ -0,0 +1,88 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// @flow
2
+ /***
3
+ * https://github.com/bitcoincashjs/cashaddr
4
+ * Copyright (c) 2018 Matias Alejo Garcia
5
+ * Copyright (c) 2017 Emilio Almansi
6
+ * Distributed under the MIT software license, see the accompanying
7
+ * file LICENSE or http://www.opensource.org/licenses/mit-license.php.
8
+ */
9
+
10
+ /***
11
+ * Charset containing the 32 symbols used in the base32 encoding.
12
+ */
13
+ const CHARSET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l'
14
+
15
+ /***
16
+ * Inverted index mapping each symbol into its index within the charset.
17
+ */
18
+
19
+
20
+
21
+
22
+
23
+ const CHARSET_INVERSE_INDEX = {
24
+ q: 0,
25
+ p: 1,
26
+ z: 2,
27
+ r: 3,
28
+ y: 4,
29
+ 9: 5,
30
+ x: 6,
31
+ 8: 7,
32
+ g: 8,
33
+ f: 9,
34
+ 2: 10,
35
+ t: 11,
36
+ v: 12,
37
+ d: 13,
38
+ w: 14,
39
+ 0: 15,
40
+ s: 16,
41
+ 3: 17,
42
+ j: 18,
43
+ n: 19,
44
+ 5: 20,
45
+ 4: 21,
46
+ k: 22,
47
+ h: 23,
48
+ c: 24,
49
+ e: 25,
50
+ 6: 26,
51
+ m: 27,
52
+ u: 28,
53
+ a: 29,
54
+ 7: 30,
55
+ l: 31
56
+ }
57
+
58
+ /***
59
+ * Encodes the given array of 5-bit integers as a base32-encoded string.
60
+ *
61
+ * @param {Array} data Array of integers between 0 and 31 inclusive.
62
+ */
63
+ function encode(data) {
64
+ let base32 = ''
65
+ for (let i = 0; i < data.length; i++) {
66
+ const value = data[i]
67
+ if (value < 0 || value > 32) throw new Error(`InvalidArgument: ${value}`)
68
+ base32 += CHARSET[value]
69
+ }
70
+ return base32
71
+ } exports.encode = encode;
72
+
73
+ /***
74
+ * Decodes the given base32-encoded string into an array of 5-bit integers.
75
+ *
76
+ * @param {string} base32
77
+ */
78
+ function decode(base32) {
79
+ const data = []
80
+ for (let i = 0; i < base32.length; i++) {
81
+ const value = base32[i]
82
+ if (!(value in CHARSET_INVERSE_INDEX)) {
83
+ throw new Error(`InvalidArgument: ${value} not in CHARSET_INVERSE_INDEX`)
84
+ }
85
+ data.push(CHARSET_INVERSE_INDEX[value])
86
+ }
87
+ return data
88
+ } exports.decode = decode;