edge-currency-plugins 2.5.4 → 2.6.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 (74) hide show
  1. package/lib/bch.js +2 -2
  2. package/lib/bsv.js +2 -2
  3. package/lib/btc.js +2 -2
  4. package/lib/common/plugin/{makeCurrencyPlugin.js → CurrencyPlugin.js} +13 -9
  5. package/lib/common/plugin/{makeMetadata.js → Metadata.js} +4 -4
  6. package/lib/common/plugin/{pluginState.js → PluginState.js} +6 -6
  7. package/lib/common/plugin/{serverScores.js → ServerScores.js} +8 -1
  8. package/lib/common/plugin/types.js +8 -0
  9. package/lib/common/utxobased/db/{makeProcessor.js → Processor.js} +3 -3
  10. package/lib/common/utxobased/engine/{makeServerStates.js → ServerStates.js} +140 -45
  11. package/lib/common/utxobased/engine/{makeUtxoEngine.js → UtxoEngine.js} +18 -18
  12. package/lib/common/utxobased/engine/{makeUtxoEngineState.js → UtxoEngineState.js} +27 -22
  13. package/lib/common/utxobased/engine/types.js +5 -0
  14. package/lib/common/utxobased/info/bitcoin.js +6 -0
  15. package/lib/common/utxobased/info/bitcoincash.js +6 -0
  16. package/lib/common/utxobased/info/dash.js +6 -0
  17. package/lib/common/utxobased/info/digibyte.js +6 -0
  18. package/lib/common/utxobased/info/dogecoin.js +6 -0
  19. package/lib/common/utxobased/info/groestlcoin.js +6 -0
  20. package/lib/common/utxobased/info/litecoin.js +6 -0
  21. package/lib/common/utxobased/network/{BlockBook.js → Blockbook.js} +28 -24
  22. package/lib/common/utxobased/network/Socket.js +4 -4
  23. package/lib/firo.js +2 -2
  24. package/lib/ftc.js +2 -2
  25. package/lib/index.js +2 -2
  26. package/lib/ltc.js +2 -2
  27. package/lib/src/common/plugin/{makeEngineEmitter.d.ts → EngineEmitter.d.ts} +1 -1
  28. package/lib/src/common/plugin/{makeMetadata.d.ts → Metadata.d.ts} +1 -1
  29. package/lib/src/common/plugin/{pluginState.d.ts → PluginState.d.ts} +2 -2
  30. package/lib/src/common/plugin/{serverScores.d.ts → ServerScores.d.ts} +1 -1
  31. package/lib/src/common/plugin/types.d.ts +9 -2
  32. package/lib/src/common/utxobased/db/Models/ProcessorTransaction.d.ts +3 -3
  33. package/lib/src/common/utxobased/db/util/utxo.d.ts +1 -1
  34. package/lib/src/common/utxobased/engine/{makeServerStates.d.ts → ServerStates.d.ts} +8 -5
  35. package/lib/src/common/utxobased/engine/{makeUtxoEngineState.d.ts → UtxoEngineState.d.ts} +9 -9
  36. package/lib/src/common/utxobased/engine/{makeUtxoWalletTools.d.ts → UtxoWalletTools.d.ts} +2 -2
  37. package/lib/src/common/utxobased/engine/types.d.ts +4 -0
  38. package/lib/src/common/utxobased/engine/util/getOwnUtxosFromTx.d.ts +1 -1
  39. package/lib/src/common/utxobased/network/{BlockBook.d.ts → Blockbook.d.ts} +10 -10
  40. package/lib/src/common/utxobased/network/Socket.d.ts +1 -1
  41. package/lib/tbch.js +2 -2
  42. package/lib/tbtc.js +2 -2
  43. package/lib/tbtg.js +2 -2
  44. package/package.json +1 -1
  45. /package/lib/common/plugin/{makeCurrencyTools.js → CurrencyTools.js} +0 -0
  46. /package/lib/common/plugin/{makeEngineEmitter.js → EngineEmitter.js} +0 -0
  47. /package/lib/common/utxobased/db/{makeBaselets.js → Baselets.js} +0 -0
  48. /package/lib/common/utxobased/db/{makeMutex.js → Mutex.js} +0 -0
  49. /package/lib/common/utxobased/engine/{makeUtxoWalletTools.js → UtxoWalletTools.js} +0 -0
  50. /package/lib/common/utxobased/network/{MakeSocketEmitter.js → SocketEmitter.js} +0 -0
  51. /package/lib/common/utxobased/network/{BlockBookAPI.js → blockbookApi.js} +0 -0
  52. /package/lib/src/common/plugin/{makeCurrencyPlugin.d.ts → CurrencyPlugin.d.ts} +0 -0
  53. /package/lib/src/common/plugin/{makeCurrencyTools.d.ts → CurrencyTools.d.ts} +0 -0
  54. /package/lib/src/common/utxobased/db/{makeBaselets.d.ts → Baselets.d.ts} +0 -0
  55. /package/lib/src/common/utxobased/db/{makeMutex.d.ts → Mutex.d.ts} +0 -0
  56. /package/lib/src/common/utxobased/db/{makeProcessor.d.ts → Processor.d.ts} +0 -0
  57. /package/lib/src/common/utxobased/engine/{makeUtxoEngine.d.ts → UtxoEngine.d.ts} +0 -0
  58. /package/lib/src/common/utxobased/network/{MakeSocketEmitter.d.ts → SocketEmitter.d.ts} +0 -0
  59. /package/lib/src/common/utxobased/network/{BlockBookAPI.d.ts → blockbookApi.d.ts} +0 -0
  60. /package/lib/test/common/plugin/{currencyPlugin.fixtures → CurrencyPlugin.fixtures}/common.d.ts +0 -0
  61. /package/lib/test/common/plugin/{currencyPlugin.fixtures → CurrencyPlugin.fixtures}/currencies/bitcoin.d.ts +0 -0
  62. /package/lib/test/common/plugin/{currencyPlugin.fixtures → CurrencyPlugin.fixtures}/currencies/bitcoincash.d.ts +0 -0
  63. /package/lib/test/common/plugin/{currencyPlugin.fixtures → CurrencyPlugin.fixtures}/currencies/bitcoinsv.d.ts +0 -0
  64. /package/lib/test/common/plugin/{currencyPlugin.fixtures → CurrencyPlugin.fixtures}/currencies/digibyte.d.ts +0 -0
  65. /package/lib/test/common/plugin/{currencyPlugin.fixtures → CurrencyPlugin.fixtures}/currencies/feathercoin.d.ts +0 -0
  66. /package/lib/test/common/plugin/{currencyPlugin.fixtures → CurrencyPlugin.fixtures}/currencies/groestlcoin.d.ts +0 -0
  67. /package/lib/test/common/plugin/{currencyPlugin.fixtures → CurrencyPlugin.fixtures}/currencies/litecoin.d.ts +0 -0
  68. /package/lib/test/common/plugin/{currencyPlugin.fixtures → CurrencyPlugin.fixtures}/currencies/smartcash.d.ts +0 -0
  69. /package/lib/test/common/plugin/{currencyPlugin.fixtures → CurrencyPlugin.fixtures}/currencies/zcoin.d.ts +0 -0
  70. /package/lib/test/common/plugin/{currencyPlugin.fixtures → CurrencyPlugin.fixtures}/index.d.ts +0 -0
  71. /package/lib/test/common/plugin/{currencyPlugin.spec.d.ts → CurrencyPlugin.spec.d.ts} +0 -0
  72. /package/lib/test/common/plugin/{makeMetadata.spec.d.ts → Metadata.spec.d.ts} +0 -0
  73. /package/lib/test/common/plugin/{serverScores.spec.d.ts → ServerScores.spec.d.ts} +0 -0
  74. /package/lib/test/common/utxobased/network/{BlockBook.spec.d.ts → Blockbook.spec.d.ts} +0 -0
@@ -7,7 +7,7 @@ var _cleaners = require('cleaners');
7
7
 
8
8
 
9
9
 
10
- var _makeEngineEmitter = require('../../plugin/makeEngineEmitter');
10
+ var _EngineEmitter = require('../../plugin/EngineEmitter');
11
11
 
12
12
 
13
13
 
@@ -18,13 +18,13 @@ var _makeEngineEmitter = require('../../plugin/makeEngineEmitter');
18
18
 
19
19
 
20
20
  var _utils = require('../../plugin/utils');
21
-
22
21
  var _ProcessorTransaction = require('../db/Models/ProcessorTransaction');
23
22
 
24
23
 
25
24
 
26
25
 
27
26
 
27
+
28
28
  var _types5 = require('../db/types');
29
29
  var _cleaners3 = require('../keymanager/cleaners');
30
30
 
@@ -42,13 +42,12 @@ var _keymanager = require('../keymanager/keymanager');
42
42
 
43
43
 
44
44
 
45
- var _BlockBookAPI = require('../network/BlockBookAPI');
45
+ var _blockbookApi = require('../network/blockbookApi');
46
46
  var _Deferred = require('../network/Deferred'); var _Deferred2 = _interopRequireDefault(_Deferred);
47
47
 
48
48
  var _awaitlock = require('./await-lock'); var _awaitlock2 = _interopRequireDefault(_awaitlock);
49
49
  var _constants = require('./constants');
50
- var _makeServerStates = require('./makeServerStates');
51
-
50
+ var _ServerStates = require('./ServerStates');
52
51
 
53
52
 
54
53
 
@@ -89,19 +88,23 @@ var _utils3 = require('./utils');
89
88
 
90
89
 
91
90
 
91
+
92
92
 
93
93
 
94
94
  function makeUtxoEngineState(
95
95
  config
96
96
  ) {
97
97
  const {
98
+ initOptions,
99
+ io,
100
+ options,
101
+ pluginState,
98
102
  pluginInfo,
99
- walletInfo,
100
- walletTools,
101
- options: { emitter, log },
102
103
  processor,
103
- pluginState
104
+ walletInfo,
105
+ walletTools
104
106
  } = config
107
+ const { emitter, log } = options
105
108
 
106
109
  const { walletFormats } = walletInfo.keys
107
110
 
@@ -170,14 +173,16 @@ var _utils3 = require('./utils');
170
173
  `processed changed, percent: ${percent}, processedCount: ${processedCount}, totalCount: ${expectedProccessCount}`
171
174
  )
172
175
  processedPercent = percent
173
- emitter.emit(_makeEngineEmitter.EngineEvent.ADDRESSES_CHECKED, percent)
176
+ emitter.emit(_EngineEmitter.EngineEvent.ADDRESSES_CHECKED, percent)
174
177
  }
175
178
  }
176
179
 
177
180
  const lock = new (0, _awaitlock2.default)()
178
181
 
179
- const serverStates = _makeServerStates.makeServerStates.call(void 0, {
182
+ const serverStates = _ServerStates.makeServerStates.call(void 0, {
180
183
  engineEmitter: emitter,
184
+ initOptions,
185
+ io,
181
186
  log,
182
187
  pluginInfo,
183
188
  pluginState,
@@ -191,7 +196,7 @@ var _utils3 = require('./utils');
191
196
  emitter,
192
197
  taskCache,
193
198
  updateProgressRatio,
194
- io: config.io,
199
+ io,
195
200
  log,
196
201
  serverStates,
197
202
  pluginState,
@@ -218,7 +223,7 @@ var _utils3 = require('./utils');
218
223
  }
219
224
 
220
225
  emitter.on(
221
- _makeEngineEmitter.EngineEvent.BLOCK_HEIGHT_CHANGED,
226
+ _EngineEmitter.EngineEvent.BLOCK_HEIGHT_CHANGED,
222
227
  async (_uri, _blockHeight) => {
223
228
  const txs = await processor.fetchTransactions({
224
229
  blockHeight: 0
@@ -231,7 +236,7 @@ var _utils3 = require('./utils');
231
236
  )
232
237
 
233
238
  emitter.on(
234
- _makeEngineEmitter.EngineEvent.NEW_ADDRESS_TRANSACTION,
239
+ _EngineEmitter.EngineEvent.NEW_ADDRESS_TRANSACTION,
235
240
  async (_uri, response) => {
236
241
  const state = taskCache.addressSubscribeCache[response.address]
237
242
  if (state != null) {
@@ -317,7 +322,7 @@ var _utils3 = require('./utils');
317
322
  // because we want to only propagate the wallet balance change event after
318
323
  // initialization is complete.
319
324
  emitter.emit(
320
- _makeEngineEmitter.EngineEvent.ADDRESS_BALANCE_CHANGED,
325
+ _EngineEmitter.EngineEvent.ADDRESS_BALANCE_CHANGED,
321
326
  pluginInfo.currencyInfo.currencyCode,
322
327
  addressBalanceChanges
323
328
  )
@@ -695,7 +700,7 @@ const addToAddressTransactionCache = async (
695
700
  args
696
701
  ) => {
697
702
  const { emitter, walletTools, processor, pluginInfo, tx, walletId } = args
698
- emitter.emit(_makeEngineEmitter.EngineEvent.TRANSACTIONS_CHANGED, [
703
+ emitter.emit(_EngineEmitter.EngineEvent.TRANSACTIONS_CHANGED, [
699
704
  await _ProcessorTransaction.toEdgeTransaction.call(void 0, {
700
705
  walletId,
701
706
  tx,
@@ -1002,7 +1007,7 @@ const updateTransactionsSpecific = (
1002
1007
  taskCache.updateTransactionSpecificCache[txId] = { processing: false }
1003
1008
  })
1004
1009
  return {
1005
- ..._BlockBookAPI.transactionMessageSpecific.call(void 0, txId),
1010
+ ..._blockbookApi.transactionMessageSpecific.call(void 0, txId),
1006
1011
  deferred
1007
1012
  }
1008
1013
  }
@@ -1073,7 +1078,7 @@ const updateTransactions = (
1073
1078
  taskCache.updateTransactionCache[txId] = { processing: false }
1074
1079
  })
1075
1080
  return {
1076
- ..._BlockBookAPI.transactionMessage.call(void 0, txId),
1081
+ ..._blockbookApi.transactionMessage.call(void 0, txId),
1077
1082
  deferred
1078
1083
  }
1079
1084
  }
@@ -1293,7 +1298,7 @@ const processAddressTransactions = async (
1293
1298
  })
1294
1299
 
1295
1300
  return {
1296
- ..._BlockBookAPI.addressMessage.call(void 0, address, asBlockbookAddress, {
1301
+ ..._blockbookApi.addressMessage.call(void 0, address, asBlockbookAddress, {
1297
1302
  details: 'txs',
1298
1303
  from: addressData.lastQueriedBlockHeight,
1299
1304
  pageSize: _constants.BLOCKBOOK_TXS_PER_PAGE,
@@ -1426,7 +1431,7 @@ const processAddressUtxos = async (
1426
1431
  })
1427
1432
 
1428
1433
  return {
1429
- ..._BlockBookAPI.addressUtxosMessage.call(void 0, address, asBlockbookAddress),
1434
+ ..._blockbookApi.addressUtxosMessage.call(void 0, address, asBlockbookAddress),
1430
1435
  deferred
1431
1436
  }
1432
1437
  }
@@ -1501,7 +1506,7 @@ const processProcessorUtxos = async (
1501
1506
  if (newBalance !== oldBalance) {
1502
1507
  log('address balance changed:', { scriptPubkey, oldBalance, newBalance })
1503
1508
  emitter.emit(
1504
- _makeEngineEmitter.EngineEvent.ADDRESS_BALANCE_CHANGED,
1509
+ _EngineEmitter.EngineEvent.ADDRESS_BALANCE_CHANGED,
1505
1510
  currencyInfo.currencyCode,
1506
1511
  [
1507
1512
  {
@@ -1630,7 +1635,7 @@ const processRawUtxo = async (
1630
1635
  }
1631
1636
  })
1632
1637
  return {
1633
- ..._BlockBookAPI.transactionMessage.call(void 0, utxo.txid),
1638
+ ..._blockbookApi.transactionMessage.call(void 0, utxo.txid),
1634
1639
  deferred
1635
1640
  }
1636
1641
  } else {
@@ -12,6 +12,11 @@ var _cleaners = require('cleaners');
12
12
  var _types3 = require('../../plugin/types');
13
13
 
14
14
 
15
+
16
+ const asUtxoInitOptions = _cleaners.asObject.call(void 0, {
17
+ nowNodeApiKey: _cleaners.asOptional.call(void 0, _cleaners.asString)
18
+ }); exports.asUtxoInitOptions = asUtxoInitOptions
19
+
15
20
  const asUtxoUserSettings = _cleaners.asObject.call(void 0, {
16
21
  blockbookServers: _cleaners.asMaybe.call(void 0, _cleaners.asArray.call(void 0, _cleaners.asString), []),
17
22
  enableCustomServers: _cleaners.asMaybe.call(void 0, _cleaners.asBoolean, false)
@@ -54,6 +54,12 @@ const currencyInfo = {
54
54
  }
55
55
 
56
56
  const engineInfo = {
57
+ serverConfigs: [
58
+ {
59
+ type: 'blockbook-nownode',
60
+ uris: ['btcbook.nownodes.io']
61
+ }
62
+ ],
57
63
  formats: ['bip49', 'bip84', 'bip44', 'bip32'],
58
64
  forks: ['bitcoincash', 'bitcoingold'],
59
65
  gapLimit: 25,
@@ -56,6 +56,12 @@ const currencyInfo = {
56
56
  }
57
57
 
58
58
  const engineInfo = {
59
+ serverConfigs: [
60
+ {
61
+ type: 'blockbook-nownode',
62
+ uris: ['bchbook.nownodes.io']
63
+ }
64
+ ],
59
65
  formats: ['bip44', 'bip32'],
60
66
  forks: [], // 'bitcoinsv' is currently disabled, so not included in the forks
61
67
  gapLimit: 10,
@@ -49,6 +49,12 @@ const currencyInfo = {
49
49
  }
50
50
 
51
51
  const engineInfo = {
52
+ serverConfigs: [
53
+ {
54
+ type: 'blockbook-nownode',
55
+ uris: ['dashbook.nownodes.io']
56
+ }
57
+ ],
52
58
  formats: ['bip44', 'bip32'],
53
59
  gapLimit: 10,
54
60
  defaultFee: 10000,
@@ -40,6 +40,12 @@ const currencyInfo = {
40
40
  }
41
41
 
42
42
  const engineInfo = {
43
+ serverConfigs: [
44
+ {
45
+ type: 'blockbook-nownode',
46
+ uris: ['dgbbook.nownodes.io']
47
+ }
48
+ ],
43
49
  formats: ['bip49', 'bip84', 'bip44', 'bip32'],
44
50
  forks: [],
45
51
  gapLimit: 10,
@@ -45,6 +45,12 @@ const currencyInfo = {
45
45
  }
46
46
 
47
47
  const engineInfo = {
48
+ serverConfigs: [
49
+ {
50
+ type: 'blockbook-nownode',
51
+ uris: ['https://dogebook.nownodes.io']
52
+ }
53
+ ],
48
54
  formats: ['bip44', 'bip32'],
49
55
  gapLimit: 10,
50
56
  defaultFee: 1000,
@@ -46,6 +46,12 @@ const currencyInfo = {
46
46
  }
47
47
 
48
48
  const engineInfo = {
49
+ serverConfigs: [
50
+ {
51
+ type: 'blockbook-nownode',
52
+ uris: ['grsbook.nownodes.io']
53
+ }
54
+ ],
49
55
  formats: ['bip49', 'bip84', 'bip44', 'bip32'],
50
56
  gapLimit: 10,
51
57
  defaultFee: 100000,
@@ -52,6 +52,12 @@ var _commonInfo = require('./commonInfo');
52
52
  }; exports.currencyInfo = currencyInfo
53
53
 
54
54
  const engineInfo = {
55
+ serverConfigs: [
56
+ {
57
+ type: 'blockbook-nownode',
58
+ uris: ['ltcbook.nownodes.io']
59
+ }
60
+ ],
55
61
  formats: ['bip49', 'bip84', 'bip44', 'bip32'],
56
62
  gapLimit: 10,
57
63
  defaultFee: 50000,
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
3
 
4
- var _makeEngineEmitter = require('../../plugin/makeEngineEmitter');
4
+ var _EngineEmitter = require('../../plugin/EngineEmitter');
5
5
 
6
6
 
7
7
 
@@ -20,9 +20,8 @@ var _makeEngineEmitter = require('../../plugin/makeEngineEmitter');
20
20
 
21
21
 
22
22
 
23
- var _BlockBookAPI = require('./BlockBookAPI');
23
+ var _blockbookApi = require('./blockbookApi');
24
24
  var _Deferred = require('./Deferred'); var _Deferred2 = _interopRequireDefault(_Deferred);
25
-
26
25
  var _Socket = require('./Socket');
27
26
 
28
27
 
@@ -70,17 +69,18 @@ var _Socket = require('./Socket');
70
69
 
71
70
 
72
71
 
73
- function makeBlockBook(config) {
72
+
73
+ function makeBlockbook(config) {
74
74
  const {
75
- wsAddress,
76
- socketEmitter,
75
+ asAddress,
76
+ connectionUri,
77
77
  engineEmitter,
78
78
  log,
79
79
  onQueueSpaceCB,
80
- walletId,
81
- asAddress
80
+ socketEmitter,
81
+ walletId
82
82
  } = config
83
- log(`makeBlockBook with uri ${wsAddress}`)
83
+ log(`makeBlockbook with uri ${connectionUri}`)
84
84
 
85
85
  const instance = {
86
86
  isConnected: false,
@@ -96,7 +96,7 @@ var _Socket = require('./Socket');
96
96
  broadcastTx
97
97
  }
98
98
 
99
- const socket = _Socket.makeSocket.call(void 0, wsAddress, {
99
+ const socket = _Socket.makeSocket.call(void 0, connectionUri, {
100
100
  healthCheck: ping,
101
101
  onQueueSpaceCB,
102
102
  log,
@@ -105,7 +105,7 @@ var _Socket = require('./Socket');
105
105
  })
106
106
 
107
107
  async function connect() {
108
- log(`connecting to blockbook socket with uri ${wsAddress}`)
108
+ log(`connecting to blockbook socket with uri ${connectionUri}`)
109
109
  if (instance.isConnected) return
110
110
 
111
111
  await socket.connect()
@@ -114,7 +114,7 @@ var _Socket = require('./Socket');
114
114
 
115
115
  async function disconnect() {
116
116
  log(
117
- `disconnecting from blockbook socket with uri ${wsAddress}, currently connected: ${instance.isConnected}`
117
+ `disconnecting from blockbook socket with uri ${connectionUri}, currently connected: ${instance.isConnected}`
118
118
  )
119
119
  if (!instance.isConnected) return
120
120
 
@@ -133,28 +133,28 @@ var _Socket = require('./Socket');
133
133
  }
134
134
 
135
135
  async function ping() {
136
- await promisifyWsMessage(_BlockBookAPI.pingMessage.call(void 0, ))
136
+ await promisifyWsMessage(_blockbookApi.pingMessage.call(void 0, ))
137
137
  }
138
138
 
139
139
  async function fetchInfo() {
140
- return await promisifyWsMessage(_BlockBookAPI.infoMessage.call(void 0, ))
140
+ return await promisifyWsMessage(_blockbookApi.infoMessage.call(void 0, ))
141
141
  }
142
142
 
143
143
  async function fetchAddressUtxos(
144
144
  account
145
145
  ) {
146
- return await promisifyWsMessage(_BlockBookAPI.addressUtxosMessage.call(void 0, account))
146
+ return await promisifyWsMessage(_blockbookApi.addressUtxosMessage.call(void 0, account))
147
147
  }
148
148
 
149
149
  async function fetchTransaction(hash) {
150
- return await promisifyWsMessage(_BlockBookAPI.transactionMessage.call(void 0, hash))
150
+ return await promisifyWsMessage(_blockbookApi.transactionMessage.call(void 0, hash))
151
151
  }
152
152
 
153
153
  async function fetchAddress(
154
154
  address,
155
155
  params = {}
156
156
  ) {
157
- return await promisifyWsMessage(_BlockBookAPI.addressMessage.call(void 0, address, asAddress, params))
157
+ return await promisifyWsMessage(_blockbookApi.addressMessage.call(void 0, address, asAddress, params))
158
158
  }
159
159
 
160
160
  async function watchBlocks(
@@ -162,13 +162,13 @@ var _Socket = require('./Socket');
162
162
  ) {
163
163
  const socketCb = async (res) => {
164
164
  engineEmitter.emit(
165
- _makeEngineEmitter.EngineEvent.BLOCK_HEIGHT_CHANGED,
166
- wsAddress,
165
+ _EngineEmitter.EngineEvent.BLOCK_HEIGHT_CHANGED,
166
+ connectionUri,
167
167
  res.height
168
168
  )
169
169
  }
170
170
  socket.subscribe({
171
- ..._BlockBookAPI.subscribeNewBlockMessage.call(void 0, ),
171
+ ..._blockbookApi.subscribeNewBlockMessage.call(void 0, ),
172
172
  cb: socketCb,
173
173
  deferred: deferredBlockSub,
174
174
  subscribed: false
@@ -180,10 +180,14 @@ var _Socket = require('./Socket');
180
180
  deferredAddressSub
181
181
  ) {
182
182
  const socketCb = async (res) => {
183
- engineEmitter.emit(_makeEngineEmitter.EngineEvent.NEW_ADDRESS_TRANSACTION, wsAddress, res)
183
+ engineEmitter.emit(
184
+ _EngineEmitter.EngineEvent.NEW_ADDRESS_TRANSACTION,
185
+ connectionUri,
186
+ res
187
+ )
184
188
  }
185
189
  socket.subscribe({
186
- ..._BlockBookAPI.subscribeAddressesMessage.call(void 0, addresses, asAddress),
190
+ ..._blockbookApi.subscribeAddressesMessage.call(void 0, addresses, asAddress),
187
191
  cb: socketCb,
188
192
  deferred: deferredAddressSub,
189
193
  subscribed: false
@@ -193,8 +197,8 @@ var _Socket = require('./Socket');
193
197
  async function broadcastTx(
194
198
  transaction
195
199
  ) {
196
- return await promisifyWsMessage(_BlockBookAPI.broadcastTxMessage.call(void 0, transaction))
200
+ return await promisifyWsMessage(_blockbookApi.broadcastTxMessage.call(void 0, transaction))
197
201
  }
198
202
 
199
203
  return instance
200
- } exports.makeBlockBook = makeBlockBook;
204
+ } exports.makeBlockbook = makeBlockbook;
@@ -3,8 +3,8 @@
3
3
 
4
4
  var _utils = require('../../plugin/utils');
5
5
 
6
- var _MakeSocketEmitter = require('./MakeSocketEmitter');
7
6
  var _nodejsWS = require('./nodejsWS');
7
+ var _SocketEmitter = require('./SocketEmitter');
8
8
  var _socketQueue = require('./socketQueue');
9
9
  var _types3 = require('./types');
10
10
  var _windowWS = require('./windowWS');
@@ -120,7 +120,7 @@ const WAKE_UP_MS = 5000 // interval at which we wakeUp and potentially onQueueSp
120
120
  }
121
121
  pendingMessages = {}
122
122
  try {
123
- emitter.emit(_MakeSocketEmitter.SocketEvent.CONNECTION_CLOSE, uri, err)
123
+ emitter.emit(_SocketEmitter.SocketEvent.CONNECTION_CLOSE, uri, err)
124
124
  } catch (e) {
125
125
  log.error(e.message)
126
126
  }
@@ -135,7 +135,7 @@ const WAKE_UP_MS = 5000 // interval at which we wakeUp and potentially onQueueSp
135
135
  connected = true
136
136
  lastKeepAlive = Date.now()
137
137
  try {
138
- emitter.emit(_MakeSocketEmitter.SocketEvent.CONNECTION_OPEN, uri)
138
+ emitter.emit(_SocketEmitter.SocketEvent.CONNECTION_OPEN, uri)
139
139
  } catch (e) {
140
140
  handleError(e)
141
141
  }
@@ -224,7 +224,7 @@ const WAKE_UP_MS = 5000 // interval at which we wakeUp and potentially onQueueSp
224
224
  config
225
225
  .healthCheck()
226
226
  .then(() => {
227
- emitter.emit(_MakeSocketEmitter.SocketEvent.CONNECTION_TIMER, uri, now)
227
+ emitter.emit(_SocketEmitter.SocketEvent.CONNECTION_TIMER, uri, now)
228
228
  })
229
229
  .catch((e) => handleError(e))
230
230
  }
package/lib/firo.js CHANGED
@@ -1,10 +1,10 @@
1
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
2
 
3
- var _makeCurrencyPlugin = require('./common/plugin/makeCurrencyPlugin');
3
+ var _CurrencyPlugin = require('./common/plugin/CurrencyPlugin');
4
4
  var _zcoin = require('./common/utxobased/info/zcoin');
5
5
 
6
6
  const plugin = (options) =>
7
- _makeCurrencyPlugin.makeCurrencyPlugin.call(void 0, options, _zcoin.info)
7
+ _CurrencyPlugin.makeCurrencyPlugin.call(void 0, options, _zcoin.info)
8
8
 
9
9
  if (typeof window !== 'undefined') {
10
10
  _optionalChain([window, 'access', _ => _.addEdgeCorePlugins, 'optionalCall', _2 => _2({
package/lib/ftc.js CHANGED
@@ -1,10 +1,10 @@
1
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
2
 
3
- var _makeCurrencyPlugin = require('./common/plugin/makeCurrencyPlugin');
3
+ var _CurrencyPlugin = require('./common/plugin/CurrencyPlugin');
4
4
  var _feathercoin = require('./common/utxobased/info/feathercoin');
5
5
 
6
6
  const plugin = (options) =>
7
- _makeCurrencyPlugin.makeCurrencyPlugin.call(void 0, options, _feathercoin.info)
7
+ _CurrencyPlugin.makeCurrencyPlugin.call(void 0, options, _feathercoin.info)
8
8
 
9
9
  if (typeof window !== 'undefined') {
10
10
  _optionalChain([window, 'access', _ => _.addEdgeCorePlugins, 'optionalCall', _2 => _2({
package/lib/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createNamedExportFrom(obj, localName, importedName) { Object.defineProperty(exports, localName, {enumerable: true, get: () => obj[importedName]}); } 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
2
 
3
- var _makeCurrencyPlugin = require('./common/plugin/makeCurrencyPlugin');
3
+ var _CurrencyPlugin = require('./common/plugin/CurrencyPlugin');
4
4
  var _all = require('./common/utxobased/info/all');
5
5
 
6
6
  const plugins = {}
7
7
 
8
8
  for (const info of _all.all) {
9
9
  plugins[info.currencyInfo.pluginId] = (options) =>
10
- _makeCurrencyPlugin.makeCurrencyPlugin.call(void 0, options, info)
10
+ _CurrencyPlugin.makeCurrencyPlugin.call(void 0, options, info)
11
11
  }
12
12
 
13
13
  if (typeof window !== 'undefined') {
package/lib/ltc.js CHANGED
@@ -1,10 +1,10 @@
1
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
2
 
3
- var _makeCurrencyPlugin = require('./common/plugin/makeCurrencyPlugin');
3
+ var _CurrencyPlugin = require('./common/plugin/CurrencyPlugin');
4
4
  var _litecoin = require('./common/utxobased/info/litecoin');
5
5
 
6
6
  const plugin = (options) =>
7
- _makeCurrencyPlugin.makeCurrencyPlugin.call(void 0, options, _litecoin.info)
7
+ _CurrencyPlugin.makeCurrencyPlugin.call(void 0, options, _litecoin.info)
8
8
 
9
9
  if (typeof window !== 'undefined') {
10
10
  _optionalChain([window, 'access', _ => _.addEdgeCorePlugins, 'optionalCall', _2 => _2({
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { EdgeCurrencyEngineCallbacks, EdgeTransaction, EdgeTxidMap } from 'edge-core-js/types';
3
3
  import { EventEmitter } from 'events';
4
- import { SubscribeAddressResponse } from '../utxobased/network/BlockBookAPI';
4
+ import { SubscribeAddressResponse } from '../utxobased/network/blockbookApi';
5
5
  export declare interface EngineEmitter {
6
6
  emit: ((event: EngineEvent.TRANSACTIONS_CHANGED, transactions: EdgeTransaction[]) => boolean) & ((event: EngineEvent.ADDRESS_BALANCE_CHANGED, currencyCode: string, addressBalanceChanges: Array<{
7
7
  scriptPubkey: string;
@@ -1,6 +1,6 @@
1
1
  import { Disklet } from 'disklet';
2
2
  import { EdgeLog } from 'edge-core-js/types';
3
- import { EngineEmitter } from './makeEngineEmitter';
3
+ import { EngineEmitter } from './EngineEmitter';
4
4
  import { LocalWalletMetadata } from './types';
5
5
  interface MetadataConfig {
6
6
  disklet: Disklet;
@@ -1,7 +1,7 @@
1
1
  import { Disklet } from 'disklet';
2
2
  import { EdgeIo, EdgeLog } from 'edge-core-js/types';
3
- import { UtxoEngineState } from '../utxobased/engine/makeUtxoEngineState';
4
3
  import { UtxoUserSettings } from '../utxobased/engine/types';
4
+ import { UtxoEngineState } from '../utxobased/engine/UtxoEngineState';
5
5
  /** A JSON object (as opposed to an array or primitive). */
6
6
  interface JsonObject {
7
7
  [name: string]: unknown;
@@ -26,7 +26,7 @@ export interface PluginState {
26
26
  serverScoreDown: (uri: string) => void;
27
27
  serverScoreUp: (uri: string, score: number) => void;
28
28
  clearCache: () => Promise<void>;
29
- getLocalServers: (numServersWanted: number, includePatterns: string[]) => string[];
29
+ getLocalServers: (numServersWanted: number, includePatterns?: Array<string | RegExp>) => string[];
30
30
  refreshServers: () => Promise<void>;
31
31
  updateServers: (settings: UtxoUserSettings) => Promise<void>;
32
32
  }
@@ -56,6 +56,6 @@ export declare class ServerScores {
56
56
  serverScoreUp(servers: ServerList, serverUrl: string, responseTimeMilliseconds: number, changeScore?: number): void;
57
57
  serverScoreDown(servers: ServerList, serverUrl: string, changeScore?: number): void;
58
58
  setResponseTime(servers: ServerList, serverUrl: string, responseTimeMilliseconds: number): void;
59
- getServers(servers: ServerList, numServersWanted: number, includePatterns?: string[]): string[];
59
+ getServers(servers: ServerList, numServersWanted: number, includePatterns?: Array<string | RegExp>): string[];
60
60
  }
61
61
  export {};
@@ -6,10 +6,11 @@ import { Disklet } from 'disklet';
6
6
  import { EdgeCurrencyEngineOptions, EdgeCurrencyInfo, EdgeCurrencyTools, EdgeIo, EdgeParsedUri, EdgeWalletInfo } from 'edge-core-js/types';
7
7
  import * as wif from 'wif';
8
8
  import { IProcessorTransaction, IUTXO } from '../utxobased/db/types';
9
+ import { UtxoInitOptions } from '../utxobased/engine/types';
9
10
  import { ScriptTemplates } from '../utxobased/info/scriptTemplates/types';
10
11
  import { UtxoPicker } from '../utxobased/keymanager/utxopicker';
11
- import { EngineEmitter } from './makeEngineEmitter';
12
- import { PluginState } from './pluginState';
12
+ import { EngineEmitter } from './EngineEmitter';
13
+ import { PluginState } from './PluginState';
13
14
  export declare type CurrencyFormat = ReturnType<typeof asCurrencyFormat>;
14
15
  export declare const asCurrencyFormat: Cleaner<"bip32" | "bip44" | "bip49" | "bip84">;
15
16
  export interface ChangePath {
@@ -42,9 +43,14 @@ export interface EngineInfo {
42
43
  mempoolSpaceFeeInfoServer?: string;
43
44
  defaultFeeInfo: FeeInfo;
44
45
  scriptTemplates?: ScriptTemplates;
46
+ serverConfigs?: ServerConfig[];
45
47
  asBlockbookAddress?: Cleaner<string>;
46
48
  txSpecificHandling?: (tx: IProcessorTransaction, specialTx: unknown) => IProcessorTransaction;
47
49
  }
50
+ export interface ServerConfig {
51
+ type: 'blockbook-nownode';
52
+ uris: string[];
53
+ }
48
54
  /**
49
55
  * Coin Info
50
56
  */
@@ -124,6 +130,7 @@ export interface EngineConfig {
124
130
  pluginDisklet: Disklet;
125
131
  currencyTools: EdgeCurrencyTools;
126
132
  options: EngineOptions;
133
+ initOptions: UtxoInitOptions;
127
134
  io: EdgeIo;
128
135
  pluginState: PluginState;
129
136
  }
@@ -1,13 +1,13 @@
1
1
  import { EdgeTransaction } from 'edge-core-js/types';
2
2
  import { PluginInfo } from '../../../plugin/types';
3
- import { UTXOPluginWalletTools } from '../../engine/makeUtxoWalletTools';
4
- import { Processor } from '../makeProcessor';
3
+ import { UtxoWalletTools } from '../../engine/UtxoWalletTools';
4
+ import { Processor } from '../Processor';
5
5
  import { IProcessorTransaction } from '../types';
6
6
  export declare const fromEdgeTransaction: (tx: EdgeTransaction) => IProcessorTransaction;
7
7
  interface ToEdgeTransactionArgs {
8
8
  walletId: string;
9
9
  tx: IProcessorTransaction;
10
- walletTools: UTXOPluginWalletTools;
10
+ walletTools: UtxoWalletTools;
11
11
  processor: Processor;
12
12
  pluginInfo: PluginInfo;
13
13
  }
@@ -1,3 +1,3 @@
1
- import { Processor } from '../makeProcessor';
1
+ import { Processor } from '../Processor';
2
2
  import { IProcessorTransaction, IUTXO } from '../types';
3
3
  export declare const utxoFromProcessorTransactionInput: (processor: Processor, processorTransaction: IProcessorTransaction, inputIndex: number) => Promise<IUTXO>;