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
@@ -1,21 +1,34 @@
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: 'litecoin',
10
- walletType: 'wallet:litecoin',
12
+ canReplaceByFee: false,
11
13
  currencyCode: 'LTC',
14
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
12
15
  displayName: 'Litecoin',
16
+ memoOptions: _commonInfo.utxoMemoOptions,
17
+ pluginId: 'litecoin',
18
+ walletType: 'wallet:litecoin',
19
+
20
+ // Explorers:
21
+ blockExplorer: 'https://blockchair.com/litecoin/block/%s',
22
+ addressExplorer: 'https://blockchair.com/litecoin/address/%s',
23
+ transactionExplorer: 'https://blockchair.com/litecoin/transaction/%s',
24
+
13
25
  denominations: [
14
26
  { name: 'LTC', multiplier: '100000000', symbol: 'Ł' },
15
27
  { name: 'mLTC', multiplier: '100000', symbol: 'mŁ' }
16
28
  ],
17
29
 
18
- // Configuration options:
30
+ // Deprecated:
31
+ ..._commonInfo.legacyMemoInfo,
19
32
  defaultSettings: {
20
33
  customFeeSettings: ['satPerByte'],
21
34
  blockbookServers: [
@@ -27,27 +40,6 @@ var _commonInfo = require('./commonInfo');
27
40
  ],
28
41
  enableCustomServers: false
29
42
  },
30
- canReplaceByFee: false,
31
- customFeeTemplate: [
32
- {
33
- type: 'nativeAmount',
34
- key: 'satPerByte',
35
- displayName: 'Satoshis Per Byte',
36
- displayMultiplier: '0'
37
- }
38
- ],
39
- ..._commonInfo.memoInfo,
40
-
41
- // Explorers:
42
- blockExplorer: 'https://blockchair.com/litecoin/block/%s',
43
- addressExplorer: 'https://blockchair.com/litecoin/address/%s',
44
- transactionExplorer: 'https://blockchair.com/litecoin/transaction/%s',
45
-
46
- // Images:
47
- symbolImage: `${_constants.IMAGE_SERVER_URL}/litecoin-logo-solo-64.png`,
48
- symbolImageDarkMono: `${_constants.IMAGE_SERVER_URL}/litecoin-logo-solo-64.png`,
49
-
50
- // Deprecated:
51
43
  metaTokens: []
52
44
  }; exports.currencyInfo = currencyInfo
53
45
 
@@ -55,7 +47,7 @@ var _commonInfo = require('./commonInfo');
55
47
  serverConfigs: [
56
48
  {
57
49
  type: 'blockbook-nownode',
58
- uris: ['ltcbook.nownodes.io']
50
+ uris: ['https://ltcbook.nownodes.io']
59
51
  }
60
52
  ],
61
53
  formats: ['bip49', 'bip84', 'bip44', 'bip32'],
@@ -2,37 +2,34 @@
2
2
 
3
3
 
4
4
  var _maximumFeeRateCalculator = require('../../plugin/util/maximumFeeRateCalculator');
5
+
6
+
7
+
8
+
5
9
  var _commonInfo = require('./commonInfo');
6
10
 
7
11
  const currencyInfo = {
8
- pluginId: 'qtum',
9
- walletType: 'wallet:qtum',
10
12
  currencyCode: 'QTUM',
13
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
11
14
  displayName: 'Qtum',
12
- denominations: [{ name: 'QTUM', multiplier: '100000000', symbol: 'Q' }],
13
-
14
- // Configuration options:
15
- defaultSettings: {
16
- customFeeSettings: ['satPerByte'],
17
- blockbookServers: [],
18
- enableCustomServers: false
19
- },
20
- customFeeTemplate: [
21
- {
22
- type: 'nativeAmount',
23
- key: 'satPerByte',
24
- displayName: 'Satoshis Per Byte',
25
- displayMultiplier: '0'
26
- }
27
- ],
28
- ..._commonInfo.memoInfo,
15
+ memoOptions: _commonInfo.utxoMemoOptions,
16
+ pluginId: 'qtum',
17
+ walletType: 'wallet:qtum',
29
18
 
30
19
  // Explorers:
31
20
  addressExplorer: 'https://explorer.qtum.org/address/%s',
32
21
  blockExplorer: 'https://explorer.qtum.org/block/%s',
33
22
  transactionExplorer: 'https://explorer.qtum.org/tx/%s',
34
23
 
24
+ denominations: [{ name: 'QTUM', multiplier: '100000000', symbol: 'Q' }],
25
+
35
26
  // Deprecated:
27
+ ..._commonInfo.legacyMemoInfo,
28
+ defaultSettings: {
29
+ customFeeSettings: ['satPerByte'],
30
+ blockbookServers: [],
31
+ enableCustomServers: false
32
+ },
36
33
  metaTokens: []
37
34
  }
38
35
 
@@ -2,37 +2,34 @@
2
2
 
3
3
 
4
4
  var _maximumFeeRateCalculator = require('../../plugin/util/maximumFeeRateCalculator');
5
+
6
+
7
+
8
+
5
9
  var _commonInfo = require('./commonInfo');
6
10
 
7
11
  const currencyInfo = {
8
- pluginId: 'ravencoin',
9
- walletType: 'wallet:ravencoin',
10
12
  currencyCode: 'RVN',
13
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
11
14
  displayName: 'Ravencoin',
12
- denominations: [{ name: 'RVN', multiplier: '100000000', symbol: 'R' }],
13
-
14
- // Configuration options:
15
- defaultSettings: {
16
- customFeeSettings: ['satPerByte'],
17
- blockbookServers: ['wss://blockbook.ravencoin.org'],
18
- enableCustomServers: false
19
- },
20
- customFeeTemplate: [
21
- {
22
- type: 'nativeAmount',
23
- key: 'satPerByte',
24
- displayName: 'Satoshis Per Byte',
25
- displayMultiplier: '0'
26
- }
27
- ],
28
- ..._commonInfo.memoInfo,
15
+ memoOptions: _commonInfo.utxoMemoOptions,
16
+ pluginId: 'ravencoin',
17
+ walletType: 'wallet:ravencoin',
29
18
 
30
19
  // Explorers:
31
20
  addressExplorer: 'https://ravencoin.network/address/%s',
32
21
  blockExplorer: 'https://ravencoin.network/block/%s',
33
22
  transactionExplorer: 'https://ravencoin.network/tx/%s',
34
23
 
24
+ denominations: [{ name: 'RVN', multiplier: '100000000', symbol: 'R' }],
25
+
35
26
  // Deprecated:
27
+ ..._commonInfo.legacyMemoInfo,
28
+ defaultSettings: {
29
+ customFeeSettings: ['satPerByte'],
30
+ blockbookServers: ['wss://blockbook.ravencoin.org'],
31
+ enableCustomServers: false
32
+ },
36
33
  metaTokens: []
37
34
  }
38
35
 
@@ -5,40 +5,37 @@ var _wifsmart = require('wif-smart'); var wifsmart = _interopRequireWildcard(_wi
5
5
 
6
6
 
7
7
  var _maximumFeeRateCalculator = require('../../plugin/util/maximumFeeRateCalculator');
8
+
9
+
10
+
11
+
8
12
  var _commonInfo = require('./commonInfo');
9
13
 
10
14
  const currencyInfo = {
11
- pluginId: 'smartcash',
12
- walletType: 'wallet:smartcash',
13
15
  currencyCode: 'SMART',
16
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
14
17
  displayName: 'SmartCash',
18
+ memoOptions: _commonInfo.utxoMemoOptions,
19
+ pluginId: 'smartcash',
20
+ walletType: 'wallet:smartcash',
21
+
22
+ // Explorers:
23
+ addressExplorer: 'https://insight.smartcash.cc/address/%s',
24
+ blockExplorer: 'https://insight.smartcash.cc/block/%s',
25
+ transactionExplorer: 'https://insight.smartcash.cc/tx/%s',
26
+
15
27
  denominations: [
16
28
  { name: 'SMART', multiplier: '100000000', symbol: 'S' },
17
29
  { name: 'mSMART', multiplier: '100000', symbol: 'mS' }
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
- customFeeTemplate: [
27
- {
28
- type: 'nativeAmount',
29
- key: 'satPerByte',
30
- displayName: 'Satoshis Per Byte',
31
- displayMultiplier: '0'
32
- }
33
- ],
34
- ..._commonInfo.memoInfo,
35
-
36
- // Explorers:
37
- addressExplorer: 'https://insight.smartcash.cc/address/%s',
38
- blockExplorer: 'https://insight.smartcash.cc/block/%s',
39
- transactionExplorer: 'https://insight.smartcash.cc/tx/%s',
40
-
41
- // Deprecated:
42
39
  metaTokens: []
43
40
  }
44
41
 
@@ -2,40 +2,37 @@
2
2
 
3
3
 
4
4
  var _maximumFeeRateCalculator = require('../../plugin/util/maximumFeeRateCalculator');
5
+
6
+
7
+
8
+
5
9
  var _commonInfo = require('./commonInfo');
6
10
 
7
11
  const currencyInfo = {
8
- pluginId: 'ufo',
9
- walletType: 'wallet:ufo',
10
12
  currencyCode: 'UFO',
13
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
11
14
  displayName: 'UFO',
15
+ memoOptions: _commonInfo.utxoMemoOptions,
16
+ pluginId: 'ufo',
17
+ walletType: 'wallet:ufo',
18
+
19
+ // Explorers:
20
+ addressExplorer: 'https://explorer.ufobject.com/address/%s',
21
+ blockExplorer: 'https://explorer.ufobject.com/block/%s',
22
+ transactionExplorer: 'https://explorer.ufobject.com/tx/%s',
23
+
12
24
  denominations: [
13
25
  { name: 'UFO', multiplier: '100000000', symbol: 'Ʉ' },
14
26
  { name: 'kUFO', multiplier: '100000000000', symbol: 'kɄ' }
15
27
  ],
16
28
 
17
- // Configuration options:
29
+ // Deprecated:
30
+ ..._commonInfo.legacyMemoInfo,
18
31
  defaultSettings: {
19
32
  customFeeSettings: ['satPerByte'],
20
33
  blockbookServers: ['wss://blockbook.ufobject.com'],
21
34
  enableCustomServers: false
22
35
  },
23
- customFeeTemplate: [
24
- {
25
- type: 'nativeAmount',
26
- key: 'satPerByte',
27
- displayName: 'Satoshis Per Byte',
28
- displayMultiplier: '0'
29
- }
30
- ],
31
- ..._commonInfo.memoInfo,
32
-
33
- // Explorers:
34
- addressExplorer: 'https://explorer.ufobject.com/address/%s',
35
- blockExplorer: 'https://explorer.ufobject.com/block/%s',
36
- transactionExplorer: 'https://explorer.ufobject.com/tx/%s',
37
-
38
- // Deprecated:
39
36
  metaTokens: []
40
37
  }
41
38
 
@@ -2,19 +2,32 @@
2
2
 
3
3
 
4
4
  var _maximumFeeRateCalculator = require('../../plugin/util/maximumFeeRateCalculator');
5
+
6
+
7
+
8
+
5
9
  var _commonInfo = require('./commonInfo');
6
10
 
7
11
  const currencyInfo = {
8
- pluginId: 'vertcoin',
9
- walletType: 'wallet:vertcoin',
10
12
  currencyCode: 'VTC',
13
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
11
14
  displayName: 'Vertcoin',
15
+ memoOptions: _commonInfo.utxoMemoOptions,
16
+ pluginId: 'vertcoin',
17
+ walletType: 'wallet:vertcoin',
18
+
19
+ // Explorers:
20
+ addressExplorer: 'https://insight.vertcoin.org/address/%s',
21
+ blockExplorer: 'https://insight.vertcoin.org/block/%s',
22
+ transactionExplorer: 'https://insight.vertcoin.org/tx/%s',
23
+
12
24
  denominations: [
13
25
  { name: 'VTC', multiplier: '100000000', symbol: 'V' },
14
26
  { name: 'mVTC', multiplier: '100000', symbol: 'mV' }
15
27
  ],
16
28
 
17
- // Configuration options:
29
+ // Deprecated:
30
+ ..._commonInfo.legacyMemoInfo,
18
31
  defaultSettings: {
19
32
  customFeeSettings: ['satPerByte'],
20
33
  blockbookServers: [
@@ -26,22 +39,6 @@ const currencyInfo = {
26
39
  ],
27
40
  enableCustomServers: false
28
41
  },
29
- customFeeTemplate: [
30
- {
31
- type: 'nativeAmount',
32
- key: 'satPerByte',
33
- displayName: 'Satoshis Per Byte',
34
- displayMultiplier: '0'
35
- }
36
- ],
37
- ..._commonInfo.memoInfo,
38
-
39
- // Explorers:
40
- addressExplorer: 'https://insight.vertcoin.org/address/%s',
41
- blockExplorer: 'https://insight.vertcoin.org/block/%s',
42
- transactionExplorer: 'https://insight.vertcoin.org/tx/%s',
43
-
44
- // Deprecated:
45
42
  metaTokens: []
46
43
  }
47
44
 
@@ -1,50 +1,48 @@
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 = {
12
+ currencyCode: 'FIRO',
13
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
14
+ displayName: 'Firo',
15
+ memoOptions: _commonInfo.utxoMemoOptions,
9
16
  pluginId: 'zcoin',
10
17
  walletType: 'wallet:zcoin',
11
- displayName: 'Firo',
12
- currencyCode: 'FIRO',
18
+
19
+ // Explorers:
20
+ addressExplorer: 'https://insight.zcoin.io/address/%s',
21
+ blockExplorer: 'https://insight.zcoin.io/block/%s',
22
+ transactionExplorer: 'https://insight.zcoin.io/tx/%s',
23
+
13
24
  denominations: [
14
25
  { name: 'FIRO', multiplier: '100000000', symbol: 'ƒ' },
15
26
  { name: 'mFIRO', multiplier: '100000', symbol: 'mƒ' }
16
27
  ],
17
28
 
18
- // Configuration options:
29
+ // Deprecated:
30
+ ..._commonInfo.legacyMemoInfo,
19
31
  defaultSettings: {
20
32
  customFeeSettings: ['satPerByte'],
21
33
  blockbookServers: ['wss://blockbook.firo.org'],
22
34
  enableCustomServers: false
23
35
  },
24
- customFeeTemplate: [
25
- {
26
- type: 'nativeAmount',
27
- key: 'satPerByte',
28
- displayName: 'Satoshis Per Byte',
29
- displayMultiplier: '0'
30
- }
31
- ],
32
- ..._commonInfo.memoInfo,
33
-
34
- // Explorers:
35
- addressExplorer: 'https://insight.zcoin.io/address/%s',
36
- blockExplorer: 'https://insight.zcoin.io/block/%s',
37
- transactionExplorer: 'https://insight.zcoin.io/tx/%s',
38
-
39
- // Images:
40
- symbolImage: `${_constants.IMAGE_SERVER_URL}/zcoin-logo-solo-64.png`,
41
- symbolImageDarkMono: `${_constants.IMAGE_SERVER_URL}/zcoin-logo-solo-64.png`,
42
-
43
- // Deprecated:
44
36
  metaTokens: []
45
37
  }; exports.currencyInfo = currencyInfo
46
38
 
47
39
  const engineInfo = {
40
+ serverConfigs: [
41
+ {
42
+ type: 'blockbook-nownode',
43
+ uris: ['https://firobook.nownodes.io']
44
+ }
45
+ ],
48
46
  formats: ['bip44', 'bip32'],
49
47
  uriPrefix: 'firo',
50
48
  gapLimit: 10,
@@ -1078,7 +1078,7 @@ const wifToPrivateKeyEncodingInternal = (
1078
1078
  // This is how much fee is needed to validate the spend
1079
1079
  const feeDelta = result.fee - (inputsValue - targetsValue)
1080
1080
  throw new (0, _types9.InsufficientFundsErrorPlus)({
1081
- currencyCode: args.currencyCode,
1081
+ tokenId: null,
1082
1082
  networkFee: result.fee.toString(),
1083
1083
  networkFeeShortage: feeDelta.toString()
1084
1084
  })
@@ -8,9 +8,10 @@ var _types = require('edge-core-js/types');
8
8
 
9
9
 
10
10
 
11
+
11
12
  class InsufficientFundsErrorPlus extends _types.InsufficientFundsError {
12
13
 
13
- constructor(opts = {}) {
14
+ constructor(opts) {
14
15
  super(opts)
15
16
  const { networkFeeShortage } = opts
16
17
  this.networkFeeShortage = networkFeeShortage