edge-currency-plugins 2.6.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +61 -2
  2. package/android/build.gradle +45 -0
  3. package/android/src/main/AndroidManifest.xml +2 -0
  4. package/android/src/main/assets/edge-currency-plugins/669.chunk.js +1 -0
  5. package/android/src/main/assets/edge-currency-plugins/edge-currency-plugins.js +76 -0
  6. package/android/src/main/java/app/edge/reactnative/currencyplugins/EdgeCurrencyPluginsModule.java +26 -0
  7. package/android/src/main/java/app/edge/reactnative/currencyplugins/EdgeCurrencyPluginsPackage.java +24 -0
  8. package/edge-currency-plugins.d.ts +34 -0
  9. package/edge-currency-plugins.podspec +28 -0
  10. package/ios/EdgeCurrencyPluginsModule.m +4 -0
  11. package/ios/EdgeCurrencyPluginsModule.swift +20 -0
  12. package/ios/edge-currency-plugins.xcodeproj/project.pbxproj +1 -0
  13. package/lib/common/constants.js +1 -2
  14. package/lib/common/plugin/CurrencyPlugin.js +17 -1
  15. package/lib/common/utxobased/db/Models/ProcessorTransaction.js +3 -2
  16. package/lib/common/utxobased/db/Processor.js +5 -0
  17. package/lib/common/utxobased/engine/ServerStates.js +159 -28
  18. package/lib/common/utxobased/engine/UtxoEngine.js +3 -2
  19. package/lib/common/utxobased/engine/UtxoEngineState.js +66 -72
  20. package/lib/common/utxobased/engine/types.js +3 -1
  21. package/lib/common/utxobased/info/badcoin.js +16 -19
  22. package/lib/common/utxobased/info/bitcoin.js +18 -26
  23. package/lib/common/utxobased/info/bitcoincash.js +18 -26
  24. package/lib/common/utxobased/info/bitcoincashtestnet.js +17 -17
  25. package/lib/common/utxobased/info/bitcoingold.js +16 -19
  26. package/lib/common/utxobased/info/bitcoingoldtestnet.js +16 -11
  27. package/lib/common/utxobased/info/bitcoinsv.js +16 -24
  28. package/lib/common/utxobased/info/bitcointestnet.js +17 -25
  29. package/lib/common/utxobased/info/commonInfo.js +20 -11
  30. package/lib/common/utxobased/info/dash.js +18 -21
  31. package/lib/common/utxobased/info/digibyte.js +17 -20
  32. package/lib/common/utxobased/info/dogecoin.js +17 -20
  33. package/lib/common/utxobased/info/eboost.js +16 -19
  34. package/lib/common/utxobased/info/feathercoin.js +16 -24
  35. package/lib/common/utxobased/info/groestlcoin.js +19 -22
  36. package/lib/common/utxobased/info/litecoin.js +18 -26
  37. package/lib/common/utxobased/info/qtum.js +16 -19
  38. package/lib/common/utxobased/info/ravencoin.js +16 -19
  39. package/lib/common/utxobased/info/smartcash.js +16 -19
  40. package/lib/common/utxobased/info/ufo.js +16 -19
  41. package/lib/common/utxobased/info/vertcoin.js +16 -19
  42. package/lib/common/utxobased/info/zcoin.js +22 -24
  43. package/lib/common/utxobased/keymanager/keymanager.js +1 -1
  44. package/lib/common/utxobased/keymanager/types.js +2 -1
  45. package/lib/common/utxobased/network/Blockbook.js +178 -105
  46. package/lib/common/utxobased/network/BlockbookElectrum.js +216 -0
  47. package/lib/common/utxobased/network/Socket.js +130 -66
  48. package/lib/common/utxobased/network/blockbookApi.js +6 -6
  49. package/lib/common/utxobased/network/electrumApi.js +203 -0
  50. package/lib/{types.js → declare-modules.d.js} +2 -0
  51. package/lib/index.js +7 -3
  52. package/lib/react-native.js +26 -0
  53. package/lib/src/common/constants.d.ts +0 -1
  54. package/lib/src/common/utxobased/db/Processor.d.ts +6 -1
  55. package/lib/src/common/utxobased/engine/ServerStates.d.ts +8 -0
  56. package/lib/src/common/utxobased/engine/UtxoEngineState.d.ts +1 -4
  57. package/lib/src/common/utxobased/info/commonInfo.d.ts +4 -2
  58. package/lib/src/common/utxobased/keymanager/types.d.ts +3 -3
  59. package/lib/src/common/utxobased/network/Blockbook.d.ts +20 -7
  60. package/lib/src/common/utxobased/network/BlockbookElectrum.d.ts +25 -0
  61. package/lib/src/common/utxobased/network/Socket.d.ts +11 -0
  62. package/lib/src/common/utxobased/network/blockbookApi.d.ts +2 -16
  63. package/lib/src/common/utxobased/network/electrumApi.d.ts +90 -0
  64. package/lib/src/index.d.ts +5 -1
  65. package/lib/src/react-native.d.ts +10 -0
  66. package/lib/test/utils.d.ts +4 -0
  67. package/package.json +24 -11
  68. package/lib/src/types.d.ts +0 -6
@@ -39,10 +39,6 @@ var _keymanager = require('../keymanager/keymanager');
39
39
 
40
40
 
41
41
 
42
-
43
-
44
-
45
- var _blockbookApi = require('../network/blockbookApi');
46
42
  var _Deferred = require('../network/Deferred'); var _Deferred2 = _interopRequireDefault(_Deferred);
47
43
 
48
44
  var _awaitlock = require('./await-lock'); var _awaitlock2 = _interopRequireDefault(_awaitlock);
@@ -158,19 +154,19 @@ var _utils3 = require('./utils');
158
154
 
159
155
  // We expect the total number of progress updates to equal the number of
160
156
  // addresses multiplied the number of processes per address.
161
- const expectedProccessCount =
157
+ const expectedProcessCount =
162
158
  Object.keys(taskCache.addressSubscribeCache).length * processesPerAddress
163
159
 
164
160
  // Increment the processed count
165
161
  processedCount = processedCount + 1
166
162
 
167
163
  // If we have no addresses, we should not have not yet began processing.
168
- if (expectedProccessCount === 0) throw new Error('No addresses to process')
164
+ if (expectedProcessCount === 0) throw new Error('No addresses to process')
169
165
 
170
- const percent = processedCount / expectedProccessCount
166
+ const percent = processedCount / expectedProcessCount
171
167
  if (percent - processedPercent > _constants.CACHE_THROTTLE || percent === 1) {
172
168
  log(
173
- `processed changed, percent: ${percent}, processedCount: ${processedCount}, totalCount: ${expectedProccessCount}`
169
+ `processed changed, percent: ${percent}, processedCount: ${processedCount}, totalCount: ${expectedProcessCount}`
174
170
  )
175
171
  processedPercent = percent
176
172
  emitter.emit(_EngineEmitter.EngineEvent.ADDRESSES_CHECKED, percent)
@@ -204,14 +200,9 @@ var _utils3 = require('./utils');
204
200
  lock
205
201
  }
206
202
 
207
- const pickNextTaskCB = async (
208
- uri
209
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
210
- ) => {
211
- return await exports.pickNextTask.call(void 0, { ...commonArgs, uri })
212
- }
213
-
214
- serverStates.setPickNextTaskCB(pickNextTaskCB)
203
+ serverStates.setPickNextTaskCB(async serverUri => {
204
+ return await exports.pickNextTask.call(void 0, commonArgs, serverUri)
205
+ })
215
206
 
216
207
  let running = false
217
208
  const run = async () => {
@@ -711,15 +702,11 @@ const addToAddressTransactionCache = async (
711
702
  ])
712
703
  }; exports.transactionChanged = transactionChanged
713
704
 
714
-
715
-
716
-
717
-
718
705
  const pickNextTask = async (
719
- args
720
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
706
+ args,
707
+ serverUri
721
708
  ) => {
722
- const { pluginInfo, taskCache, uri, serverStates } = args
709
+ const { pluginInfo, taskCache, serverStates } = args
723
710
 
724
711
  const {
725
712
  addressSubscribeCache,
@@ -738,12 +725,12 @@ const addToAddressTransactionCache = async (
738
725
  **/
739
726
  const needsTxSpecific = pluginInfo.engineInfo.txSpecificHandling != null
740
727
 
741
- const serverState = serverStates.getServerState(uri)
728
+ const serverState = serverStates.getServerState(serverUri)
742
729
  if (serverState == null) return
743
730
 
744
731
  // subscribe all servers to new blocks
745
732
  if (serverState.blockSubscriptionStatus === 'unsubscribed') {
746
- serverStates.watchBlocks(uri)
733
+ serverStates.watchBlocks(serverUri)
747
734
  return true
748
735
  }
749
736
 
@@ -780,7 +767,7 @@ const addToAddressTransactionCache = async (
780
767
  purposeType === _keymanager.BIP43PurposeTypeEnum.ReplayProtection
781
768
  ) {
782
769
  // if we do need to make a network call, check with the serverState
783
- if (!serverStates.serverCanGetTx(uri, utxo.txid)) return
770
+ if (!serverStates.serverCanGetTx(serverUri, utxo.txid)) return
784
771
  }
785
772
  state.processing = true
786
773
  _utils.removeItem.call(void 0, rawUtxoCache, utxoId)
@@ -788,6 +775,7 @@ const addToAddressTransactionCache = async (
788
775
  ...args,
789
776
  ...state,
790
777
  address: state.address,
778
+ serverUri,
791
779
  utxo,
792
780
  id: `${utxo.txid}_${utxo.vout}`
793
781
  })
@@ -798,7 +786,10 @@ const addToAddressTransactionCache = async (
798
786
  // Loop to process addresses to utxos
799
787
  for (const [address, state] of Object.entries(addressUtxoCache)) {
800
788
  // Check if we need to fetch address UTXOs
801
- if (!state.processing && serverStates.serverCanGetAddress(uri, address)) {
789
+ if (
790
+ !state.processing &&
791
+ serverStates.serverCanGetAddress(serverUri, address)
792
+ ) {
802
793
  state.processing = true
803
794
 
804
795
  _utils.removeItem.call(void 0, addressUtxoCache, address)
@@ -807,7 +798,8 @@ const addToAddressTransactionCache = async (
807
798
  const wsTask = await processAddressUtxos({
808
799
  ...args,
809
800
  ...state,
810
- address
801
+ address,
802
+ serverUri
811
803
  })
812
804
  wsTask.deferred.promise
813
805
  .then(() => {
@@ -826,12 +818,12 @@ const addToAddressTransactionCache = async (
826
818
  if (Object.keys(addressSubscribeCache).length > 0) {
827
819
  // These are addresses to which the server has not subscribed
828
820
  const newAddresses = []
829
- const blockHeight = serverStates.getBlockHeight(uri)
821
+ const blockHeight = serverStates.getBlockHeight(serverUri)
830
822
 
831
823
  // Loop each address in the cache
832
824
  for (const [address, state] of Object.entries(addressSubscribeCache)) {
833
825
  const isAddressNewlySubscribed = !serverStates.serverIsAwareOfAddress(
834
- uri,
826
+ serverUri,
835
827
  address
836
828
  )
837
829
 
@@ -864,7 +856,7 @@ const addToAddressTransactionCache = async (
864
856
 
865
857
  // Subscribe to any new addresses
866
858
  if (newAddresses.length > 0) {
867
- serverStates.watchAddresses(uri, newAddresses)
859
+ serverStates.watchAddresses(serverUri, newAddresses)
868
860
  return true
869
861
  }
870
862
  }
@@ -875,12 +867,13 @@ const addToAddressTransactionCache = async (
875
867
  for (const [txId, state] of Object.entries(
876
868
  updateTransactionSpecificCache
877
869
  )) {
878
- if (!state.processing && serverStates.serverCanGetTx(uri, txId)) {
870
+ if (!state.processing && serverStates.serverCanGetTx(serverUri, txId)) {
879
871
  hasProcessedAtLeastOnce = true
880
872
  state.processing = true
881
873
  _utils.removeItem.call(void 0, updateTransactionSpecificCache, txId)
882
874
  const updateTransactionSpecificTask = updateTransactionsSpecific({
883
875
  ...args,
876
+ serverUri,
884
877
  txId
885
878
  })
886
879
  // once resolved, add the txid to the server cache
@@ -904,14 +897,15 @@ const addToAddressTransactionCache = async (
904
897
  if (Object.keys(updateTransactionCache).length > 0) {
905
898
  let hasProcessedAtLeastOnce = false
906
899
  for (const [txId, state] of Object.entries(updateTransactionCache)) {
907
- if (!state.processing && serverStates.serverCanGetTx(uri, txId)) {
900
+ if (!state.processing && serverStates.serverCanGetTx(serverUri, txId)) {
908
901
  hasProcessedAtLeastOnce = true
909
902
  state.processing = true
910
903
  _utils.removeItem.call(void 0, updateTransactionCache, txId)
911
904
  const updateTransactionTask = updateTransactions({
912
905
  ...args,
913
- txId,
914
- needsTxSpecific
906
+ serverUri,
907
+ needsTxSpecific,
908
+ txId
915
909
  })
916
910
  // once resolved, add the txid to the server cache
917
911
  updateTransactionTask.deferred.promise
@@ -932,7 +926,10 @@ const addToAddressTransactionCache = async (
932
926
 
933
927
  // loop to get and process transaction history of single addresses, triggers setLookAhead
934
928
  for (const [address, state] of Object.entries(addressTransactionCache)) {
935
- if (!state.processing && serverStates.serverCanGetAddress(uri, address)) {
929
+ if (
930
+ !state.processing &&
931
+ serverStates.serverCanGetAddress(serverUri, address)
932
+ ) {
936
933
  state.processing = true
937
934
 
938
935
  _utils.removeItem.call(void 0, addressTransactionCache, address)
@@ -942,7 +939,8 @@ const addToAddressTransactionCache = async (
942
939
  ...args,
943
940
  addressTransactionState: state,
944
941
  address,
945
- needsTxSpecific
942
+ needsTxSpecific,
943
+ serverUri
946
944
  })
947
945
  wsTask.deferred.promise
948
946
  .then(() => {
@@ -962,6 +960,7 @@ const addToAddressTransactionCache = async (
962
960
 
963
961
 
964
962
 
963
+
965
964
  const updateTransactionsSpecific = (
966
965
  args
967
966
  ) => {
@@ -969,9 +968,10 @@ const updateTransactionsSpecific = (
969
968
  walletInfo,
970
969
  emitter,
971
970
  walletTools,
972
- txId,
973
971
  pluginInfo,
974
972
  processor,
973
+ serverUri,
974
+ txId,
975
975
  taskCache
976
976
  } = args
977
977
  const deferred = new _Deferred2.default()
@@ -1006,10 +1006,12 @@ const updateTransactionsSpecific = (
1006
1006
  args.log('error in updateTransactionsSpecific:', err)
1007
1007
  taskCache.updateTransactionSpecificCache[txId] = { processing: false }
1008
1008
  })
1009
- return {
1010
- ..._blockbookApi.transactionMessageSpecific.call(void 0, txId),
1009
+
1010
+ return args.serverStates.transactionSpecialQueryTask(
1011
+ serverUri,
1012
+ txId,
1011
1013
  deferred
1012
- }
1014
+ )
1013
1015
  }
1014
1016
 
1015
1017
 
@@ -1017,6 +1019,7 @@ const updateTransactionsSpecific = (
1017
1019
 
1018
1020
 
1019
1021
 
1022
+
1020
1023
  const updateTransactions = (
1021
1024
  args
1022
1025
  ) => {
@@ -1028,6 +1031,7 @@ const updateTransactions = (
1028
1031
  needsTxSpecific,
1029
1032
  pluginInfo,
1030
1033
  processor,
1034
+ serverUri,
1031
1035
  taskCache
1032
1036
  } = args
1033
1037
  const deferred = new _Deferred2.default()
@@ -1077,10 +1081,8 @@ const updateTransactions = (
1077
1081
  args.log('error in updateTransactions:', err)
1078
1082
  taskCache.updateTransactionCache[txId] = { processing: false }
1079
1083
  })
1080
- return {
1081
- ..._blockbookApi.transactionMessage.call(void 0, txId),
1082
- deferred
1083
- }
1084
+
1085
+ return args.serverStates.transactionQueryTask(serverUri, txId, deferred)
1084
1086
  }
1085
1087
 
1086
1088
 
@@ -1215,12 +1217,9 @@ const processAddressTransactions = async (
1215
1217
  walletTools,
1216
1218
  taskCache,
1217
1219
  pluginState,
1218
- uri
1220
+ serverUri
1219
1221
  } = args
1220
1222
  const { page = 1, blockHeight } = addressTransactionState
1221
- const {
1222
- engineInfo: { asBlockbookAddress }
1223
- } = pluginInfo
1224
1223
  const addressTransactionCache = taskCache.addressTransactionCache
1225
1224
 
1226
1225
  const scriptPubkey = walletTools.addressToScriptPubkey(address)
@@ -1233,7 +1232,7 @@ const processAddressTransactions = async (
1233
1232
  const deferred = new _Deferred2.default()
1234
1233
  deferred.promise
1235
1234
  .then(async (value) => {
1236
- pluginState.serverScoreUp(uri, Date.now() - queryTime)
1235
+ pluginState.serverScoreUp(serverUri, Date.now() - queryTime)
1237
1236
  const { transactions = [], txs, unconfirmedTxs, totalPages } = value
1238
1237
 
1239
1238
  // If address is used and previously not marked as used, mark as used.
@@ -1297,15 +1296,15 @@ const processAddressTransactions = async (
1297
1296
  addressTransactionCache[address] = addressTransactionState
1298
1297
  })
1299
1298
 
1300
- return {
1301
- ..._blockbookApi.addressMessage.call(void 0, address, asBlockbookAddress, {
1302
- details: 'txs',
1303
- from: addressData.lastQueriedBlockHeight,
1304
- pageSize: _constants.BLOCKBOOK_TXS_PER_PAGE,
1299
+ return args.serverStates.addressQueryTask(
1300
+ serverUri,
1301
+ address,
1302
+ {
1303
+ lastQueriedBlockHeight: addressData.lastQueriedBlockHeight,
1305
1304
  page
1306
- }),
1305
+ },
1307
1306
  deferred
1308
- }
1307
+ )
1309
1308
  }
1310
1309
 
1311
1310
 
@@ -1386,19 +1385,15 @@ const processAddressUtxos = async (
1386
1385
  processor,
1387
1386
  taskCache,
1388
1387
  path,
1389
- pluginInfo,
1390
1388
  pluginState,
1391
- uri
1389
+ serverUri
1392
1390
  } = args
1393
- const {
1394
- engineInfo: { asBlockbookAddress }
1395
- } = pluginInfo
1396
1391
  const { addressUtxoCache, rawUtxoCache, processorUtxoCache } = taskCache
1397
1392
  const queryTime = Date.now()
1398
1393
  const deferred = new _Deferred2.default()
1399
1394
  deferred.promise
1400
1395
  .then(async (utxos) => {
1401
- pluginState.serverScoreUp(uri, Date.now() - queryTime)
1396
+ pluginState.serverScoreUp(serverUri, Date.now() - queryTime)
1402
1397
  const scriptPubkey = walletTools.addressToScriptPubkey(address)
1403
1398
  const addressData = await processor.fetchAddress(scriptPubkey)
1404
1399
  if (addressData == null || addressData.path == null) {
@@ -1430,10 +1425,7 @@ const processAddressUtxos = async (
1430
1425
  }
1431
1426
  })
1432
1427
 
1433
- return {
1434
- ..._blockbookApi.addressUtxosMessage.call(void 0, address, asBlockbookAddress),
1435
- deferred
1436
- }
1428
+ return args.serverStates.utxoListQueryTask(serverUri, address, deferred)
1437
1429
  }
1438
1430
 
1439
1431
 
@@ -1561,7 +1553,7 @@ const processRawUtxo = async (
1561
1553
  taskCache,
1562
1554
  requiredCount,
1563
1555
  pluginState,
1564
- uri,
1556
+ serverUri,
1565
1557
  log
1566
1558
  } = args
1567
1559
  const { rawUtxoCache, processorUtxoCache } = taskCache
@@ -1613,7 +1605,7 @@ const processRawUtxo = async (
1613
1605
  const deferred = new _Deferred2.default()
1614
1606
  deferred.promise
1615
1607
  .then((txResponse) => {
1616
- pluginState.serverScoreUp(uri, Date.now() - queryTime)
1608
+ pluginState.serverScoreUp(serverUri, Date.now() - queryTime)
1617
1609
  const processedTx = processTransactionResponse({
1618
1610
  ...args,
1619
1611
  txResponse
@@ -1634,10 +1626,12 @@ const processRawUtxo = async (
1634
1626
  requiredCount
1635
1627
  }
1636
1628
  })
1637
- return {
1638
- ..._blockbookApi.transactionMessage.call(void 0, utxo.txid),
1629
+
1630
+ return args.serverStates.transactionQueryTask(
1631
+ serverUri,
1632
+ utxo.txid,
1639
1633
  deferred
1640
- }
1634
+ )
1641
1635
  } else {
1642
1636
  script = tx.hex
1643
1637
  }
@@ -42,13 +42,15 @@ var _types3 = require('../../plugin/types');
42
42
  publicAddress: _cleaners.asString
43
43
  }); exports.asUtxoSignMessageOtherParams = asUtxoSignMessageOtherParams
44
44
 
45
+ const asOutputSort = _cleaners.asValue.call(void 0, 'bip69', 'targets')
46
+
45
47
 
46
48
 
47
49
 
48
50
  const asUtxoSpendInfoOtherParams = _cleaners.asObject.call(void 0, {
49
51
  enableRbf: _cleaners.asOptional.call(void 0, _cleaners.asBoolean),
50
52
  forceChangeAddress: _cleaners.asOptional.call(void 0, _cleaners.asString),
51
- outputSort: _cleaners.asOptional.call(void 0, _cleaners.asValue.call(void 0, 'bip69', 'targets'), 'bip69'),
53
+ outputSort: _cleaners.asOptional.call(void 0, asOutputSort, 'bip69'),
52
54
  txOptions: _cleaners.asOptional.call(void 0, _types3.asTxOptions),
53
55
  utxoSourceAddress: _cleaners.asOptional.call(void 0, _cleaners.asString)
54
56
  }); exports.asUtxoSpendInfoOtherParams = asUtxoSpendInfoOtherParams
@@ -1,40 +1,37 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
+
5
+
6
+
7
+
4
8
  var _commonInfo = require('./commonInfo');
5
9
 
6
10
  const currencyInfo = {
7
- pluginId: 'badcoin',
8
- walletType: 'wallet:badcoin',
9
11
  currencyCode: 'BAD',
12
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
10
13
  displayName: 'Badcoin',
14
+ memoOptions: _commonInfo.utxoMemoOptions,
15
+ pluginId: 'badcoin',
16
+ walletType: 'wallet:badcoin',
17
+
18
+ // Explorers:
19
+ addressExplorer: 'https://www.blockingbad.com/address/%s',
20
+ blockExplorer: 'https://www.blockingbad.com/block/%s',
21
+ transactionExplorer: 'https://www.blockingbad.com/tx/%s',
22
+
11
23
  denominations: [
12
24
  { name: 'BAD', multiplier: '100000000', symbol: 'BAD' },
13
25
  { name: 'mBAD', multiplier: '100000', symbol: 'mBAD' }
14
26
  ],
15
27
 
16
- // Configuration options:
28
+ // Deprecated:
29
+ ..._commonInfo.legacyMemoInfo,
17
30
  defaultSettings: {
18
31
  customFeeSettings: ['satPerByte'],
19
32
  blockbookServers: [],
20
33
  enableCustomServers: false
21
34
  },
22
- customFeeTemplate: [
23
- {
24
- type: 'nativeAmount',
25
- key: 'satPerByte',
26
- displayName: 'Satoshis Per Byte',
27
- displayMultiplier: '0'
28
- }
29
- ],
30
- ..._commonInfo.memoInfo,
31
-
32
- // Explorers:
33
- addressExplorer: 'https://www.blockingbad.com/address/%s',
34
- blockExplorer: 'https://www.blockingbad.com/block/%s',
35
- transactionExplorer: 'https://www.blockingbad.com/tx/%s',
36
-
37
- // Deprecated:
38
35
  metaTokens: []
39
36
  }
40
37
 
@@ -1,15 +1,27 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _constants = require('../../constants');
4
3
 
5
4
  var _maximumFeeRateCalculator = require('../../plugin/util/maximumFeeRateCalculator');
5
+
6
+
7
+
8
+
6
9
  var _commonInfo = require('./commonInfo');
7
10
 
8
11
  const currencyInfo = {
9
- pluginId: 'bitcoin',
10
- walletType: 'wallet:bitcoin',
12
+ canReplaceByFee: true,
11
13
  currencyCode: 'BTC',
14
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
12
15
  displayName: 'Bitcoin',
16
+ memoOptions: _commonInfo.utxoMemoOptions,
17
+ pluginId: 'bitcoin',
18
+ walletType: 'wallet:bitcoin',
19
+
20
+ // Explorers:
21
+ blockExplorer: 'https://blockchair.com/bitcoin/block/%s',
22
+ addressExplorer: 'https://blockchair.com/bitcoin/address/%s',
23
+ transactionExplorer: 'https://blockchair.com/bitcoin/transaction/%s',
24
+
13
25
  denominations: [
14
26
  { name: 'BTC', multiplier: '100000000', symbol: '₿' },
15
27
  { name: 'mBTC', multiplier: '100000', symbol: 'm₿' },
@@ -17,7 +29,8 @@ const currencyInfo = {
17
29
  { name: 'sats', multiplier: '1', symbol: 's' }
18
30
  ],
19
31
 
20
- // Configuration options:
32
+ // Deprecated:
33
+ ..._commonInfo.legacyMemoInfo,
21
34
  defaultSettings: {
22
35
  customFeeSettings: ['satPerByte'],
23
36
  blockbookServers: [
@@ -29,27 +42,6 @@ const currencyInfo = {
29
42
  ],
30
43
  enableCustomServers: false
31
44
  },
32
- canReplaceByFee: true,
33
- customFeeTemplate: [
34
- {
35
- type: 'nativeAmount',
36
- key: 'satPerByte',
37
- displayName: 'Satoshis Per Byte',
38
- displayMultiplier: '0'
39
- }
40
- ],
41
- ..._commonInfo.memoInfo,
42
-
43
- // Explorers:
44
- blockExplorer: 'https://blockchair.com/bitcoin/block/%s',
45
- addressExplorer: 'https://blockchair.com/bitcoin/address/%s',
46
- transactionExplorer: 'https://blockchair.com/bitcoin/transaction/%s',
47
-
48
- // Images:
49
- symbolImage: `${_constants.IMAGE_SERVER_URL}/bitcoin-logo-solo-64.png`,
50
- symbolImageDarkMono: `${_constants.IMAGE_SERVER_URL}/bitcoin-logo-solo-64.png`,
51
-
52
- // Deprecated:
53
45
  metaTokens: []
54
46
  }
55
47
 
@@ -57,7 +49,7 @@ const engineInfo = {
57
49
  serverConfigs: [
58
50
  {
59
51
  type: 'blockbook-nownode',
60
- uris: ['btcbook.nownodes.io']
52
+ uris: ['https://btcbook.nownodes.io']
61
53
  }
62
54
  ],
63
55
  formats: ['bip49', 'bip84', 'bip44', 'bip32'],
@@ -2,24 +2,37 @@
2
2
  var _cleaners = require('cleaners');
3
3
 
4
4
 
5
- var _constants = require('../../constants');
6
5
 
7
6
  var _maximumFeeRateCalculator = require('../../plugin/util/maximumFeeRateCalculator');
7
+
8
+
9
+
10
+
8
11
  var _commonInfo = require('./commonInfo');
9
12
  var _bitcoincashScriptTemplates = require('./scriptTemplates/bitcoincashScriptTemplates');
10
13
 
11
14
  const currencyInfo = {
12
- pluginId: 'bitcoincash',
13
- walletType: 'wallet:bitcoincash',
14
15
  currencyCode: 'BCH',
16
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
15
17
  displayName: 'Bitcoin Cash',
18
+ memoOptions: _commonInfo.utxoMemoOptions,
19
+ pluginId: 'bitcoincash',
20
+ walletType: 'wallet:bitcoincash',
21
+
22
+ // Explorers:
23
+ blockExplorer: 'https://blockchair.com/bitcoin-cash/block/%s',
24
+ addressExplorer: 'https://blockchair.com/bitcoin-cash/address/%s',
25
+ transactionExplorer: 'https://blockchair.com/bitcoin-cash/transaction/%s',
26
+ xpubExplorer: 'https://bch1.trezor.io/xpub/%s',
27
+
16
28
  denominations: [
17
29
  { name: 'BCH', multiplier: '100000000', symbol: '₿' },
18
30
  { name: 'mBCH', multiplier: '100000', symbol: 'm₿' },
19
31
  { name: 'cash', multiplier: '100', symbol: 'ƀ' }
20
32
  ],
21
33
 
22
- // Configuration options:
34
+ // Deprecated:
35
+ ..._commonInfo.legacyMemoInfo,
23
36
  defaultSettings: {
24
37
  customFeeSettings: ['satPerByte'],
25
38
  blockbookServers: [
@@ -31,27 +44,6 @@ const currencyInfo = {
31
44
  ],
32
45
  enableCustomServers: false
33
46
  },
34
- customFeeTemplate: [
35
- {
36
- type: 'nativeAmount',
37
- key: 'satPerByte',
38
- displayName: 'Satoshis Per Byte',
39
- displayMultiplier: '0'
40
- }
41
- ],
42
- ..._commonInfo.memoInfo,
43
-
44
- // Explorers:
45
- blockExplorer: 'https://blockchair.com/bitcoin-cash/block/%s',
46
- addressExplorer: 'https://blockchair.com/bitcoin-cash/address/%s',
47
- transactionExplorer: 'https://blockchair.com/bitcoin-cash/transaction/%s',
48
- xpubExplorer: 'https://bch1.trezor.io/xpub/%s',
49
-
50
- // Images:
51
- symbolImage: `${_constants.IMAGE_SERVER_URL}/bitcoincash-logo-solo-64.png`,
52
- symbolImageDarkMono: `${_constants.IMAGE_SERVER_URL}/bitcoincash-logo-solo-64.png`,
53
-
54
- // Deprecated:
55
47
  metaTokens: []
56
48
  }
57
49
 
@@ -59,7 +51,7 @@ const engineInfo = {
59
51
  serverConfigs: [
60
52
  {
61
53
  type: 'blockbook-nownode',
62
- uris: ['bchbook.nownodes.io']
54
+ uris: ['https://bchbook.nownodes.io']
63
55
  }
64
56
  ],
65
57
  formats: ['bip44', 'bip32'],
@@ -1,41 +1,41 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _altcoinjs = require('altcoin-js');
2
2
 
3
3
 
4
- var _constants = require('../../constants');
4
+
5
+
6
+
7
+
5
8
 
6
9
  var _commonInfo = require('./commonInfo');
7
10
  var _bitcoincashScriptTemplates = require('./scriptTemplates/bitcoincashScriptTemplates');
8
11
 
9
12
  const currencyInfo = {
10
- pluginId: 'bitcoincashtestnet',
11
- walletType: 'wallet:bitcoincashtestnet',
12
13
  currencyCode: 'TBCH',
13
14
  displayName: 'Bitcoin Cash',
15
+ memoOptions: _commonInfo.utxoMemoOptions,
16
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
17
+ pluginId: 'bitcoincashtestnet',
18
+ walletType: 'wallet:bitcoincashtestnet',
19
+
20
+ // Explorers:
21
+ blockExplorer: 'https://blockchair.com/bitcoin-cash/block/%s',
22
+ addressExplorer: 'https://blockchair.com/bitcoin-cash/address/%s',
23
+ transactionExplorer: 'https://blockchair.com/bitcoin-cash/transaction/%s',
24
+ xpubExplorer: 'https://blockchair.com/bitcoin-cash/xpub/%s',
25
+
14
26
  denominations: [
15
27
  { name: 'TBCH', multiplier: '100000000', symbol: '₿' },
16
28
  { name: 'mTBCH', multiplier: '100000', symbol: 'm₿' },
17
29
  { name: 'cash', multiplier: '100', symbol: 'ƀ' }
18
30
  ],
19
31
 
20
- // Configuration options:
32
+ // Deprecated:
33
+ ..._commonInfo.legacyMemoInfo,
21
34
  defaultSettings: {
22
35
  customFeeSettings: ['satPerByte'],
23
36
  blockbookServers: [],
24
37
  enableCustomServers: false
25
38
  },
26
- ..._commonInfo.memoInfo,
27
-
28
- // Explorers:
29
- blockExplorer: 'https://blockchair.com/bitcoin-cash/block/%s',
30
- addressExplorer: 'https://blockchair.com/bitcoin-cash/address/%s',
31
- transactionExplorer: 'https://blockchair.com/bitcoin-cash/transaction/%s',
32
- xpubExplorer: 'https://blockchair.com/bitcoin-cash/xpub/%s',
33
-
34
- // Images:
35
- symbolImage: `${_constants.IMAGE_SERVER_URL}/bitcoincash-logo-solo-64.png`,
36
- symbolImageDarkMono: `${_constants.IMAGE_SERVER_URL}/bitcoincash-logo-solo-64.png`,
37
-
38
- // Deprecated:
39
39
  metaTokens: []
40
40
  }
41
41