edge-currency-plugins 3.15.0 → 3.17.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 (33) hide show
  1. package/android/src/main/assets/edge-currency-plugins/edge-currency-plugins.js +51 -49
  2. package/lib/common/plugin/EngineEmitter.js +10 -0
  3. package/lib/common/plugin/PluginState.js +87 -1
  4. package/lib/common/plugin/types.js +11 -0
  5. package/lib/common/utxobased/engine/ServerStates.js +257 -9
  6. package/lib/common/utxobased/engine/UtxoEngineProcessor.js +147 -22
  7. package/lib/common/utxobased/info/all.js +6 -0
  8. package/lib/common/utxobased/info/bitcoin.js +1 -1
  9. package/lib/common/utxobased/info/ecashbitcoin.js +90 -0
  10. package/lib/common/utxobased/info/ecashbitcoinbetanet.js +91 -0
  11. package/lib/common/utxobased/keymanager/keymanager.js +6 -1
  12. package/lib/common/utxobased/network/Blockbook.js +9 -2
  13. package/lib/common/utxobased/network/BlockbookElectrum.js +243 -77
  14. package/lib/common/utxobased/network/Socket.js +34 -22
  15. package/lib/common/utxobased/network/electrumApi.js +49 -1
  16. package/lib/src/common/plugin/EngineEmitter.d.ts +7 -2
  17. package/lib/src/common/plugin/PluginState.d.ts +30 -0
  18. package/lib/src/common/plugin/types.d.ts +10 -0
  19. package/lib/src/common/utxobased/engine/ServerStates.d.ts +32 -0
  20. package/lib/src/common/utxobased/engine/UtxoEngineProcessor.d.ts +5 -1
  21. package/lib/src/common/utxobased/info/all.d.ts +2 -0
  22. package/lib/src/common/utxobased/info/ecashbitcoin.d.ts +3 -0
  23. package/lib/src/common/utxobased/info/ecashbitcoinbetanet.d.ts +3 -0
  24. package/lib/src/common/utxobased/network/Blockbook.d.ts +6 -1
  25. package/lib/src/common/utxobased/network/BlockbookElectrum.d.ts +2 -0
  26. package/lib/src/common/utxobased/network/Socket.d.ts +4 -0
  27. package/lib/src/common/utxobased/network/electrumApi.d.ts +21 -0
  28. package/lib/test/common/plugin/PluginState.spec.d.ts +1 -0
  29. package/lib/test/common/utxobased/engine/AddressRepair.spec.d.ts +1 -0
  30. package/lib/test/common/utxobased/engine/UtxoEngineProcessor.spec.d.ts +1 -0
  31. package/lib/test/common/utxobased/keymanager/coins/ecashbitcointransactiontest.spec.d.ts +1 -0
  32. package/lib/test/common/utxobased/network/BlockbookElectrum.spec.d.ts +1 -0
  33. package/package.json +1 -1
@@ -38,6 +38,7 @@ var _keymanager = require('../keymanager/keymanager');
38
38
 
39
39
 
40
40
 
41
+ var _BlockbookElectrum = require('../network/BlockbookElectrum');
41
42
 
42
43
  var _awaitlock = require('./await-lock'); var _awaitlock2 = _interopRequireDefault(_awaitlock);
43
44
  var _constants = require('./constants');
@@ -126,6 +127,11 @@ var _utils3 = require('./utils');
126
127
  pendingTimeouts.clear()
127
128
  }
128
129
 
130
+ // Addresses whose history an Electrum server answered. Electrum only
131
+ // reports how many transactions an address has, so a Blockbook server
132
+ // queries these again once one is picking tasks:
133
+ const electrumHistoryAddresses = new Set()
134
+
129
135
  const clearTaskCache = () => {
130
136
  for (const key of Object.keys(taskCache.addressForTransactionsCache)) {
131
137
  _utils.removeItem.call(void 0, taskCache.addressForTransactionsCache, key)
@@ -148,6 +154,7 @@ var _utils3 = require('./utils');
148
154
  for (const key of Object.keys(taskCache.transactionUpdateCache)) {
149
155
  _utils.removeItem.call(void 0, taskCache.transactionUpdateCache, key)
150
156
  }
157
+ electrumHistoryAddresses.clear()
151
158
  }
152
159
 
153
160
  /**
@@ -156,9 +163,25 @@ var _utils3 = require('./utils');
156
163
  * 2. Address UTXO processing
157
164
  **/
158
165
  const processesPerAddress = 2
159
- let processedCount = 0
166
+ // Which of the two processes have completed, per address (by scriptPubkey).
167
+ // Flags rather than a running count, so an address re-queued after a server
168
+ // drop is not counted twice and the ratio cannot pass 1 with work pending.
169
+ const progressByScriptPubkey = new Map
170
+
171
+
172
+ ()
160
173
  let processedPercent = 0 // last sync ratio emitted
161
- const updateProgressRatio = async () => {
174
+ const updateProgressRatio = async (
175
+ scriptPubkey,
176
+ process
177
+ ) => {
178
+ const progress = _nullishCoalesce(progressByScriptPubkey.get(scriptPubkey), () => ( {
179
+ txs: false,
180
+ utxos: false
181
+ }))
182
+ progress[process] = true
183
+ progressByScriptPubkey.set(scriptPubkey, progress)
184
+
162
185
  // Avoid re-sending sync ratios / sending ratios larger than 1
163
186
  if (processedPercent >= 1) return
164
187
 
@@ -167,8 +190,11 @@ var _utils3 = require('./utils');
167
190
  const expectedProcessCount =
168
191
  Object.keys(taskCache.addressSubscribeCache).length * processesPerAddress
169
192
 
170
- // Increment the processed count
171
- processedCount = processedCount + 1
193
+ let processedCount = 0
194
+ for (const { txs, utxos } of progressByScriptPubkey.values()) {
195
+ if (txs) processedCount++
196
+ if (utxos) processedCount++
197
+ }
172
198
 
173
199
  // If we have no addresses, we should not have not yet began processing.
174
200
  if (expectedProcessCount === 0) throw new Error('No addresses to process')
@@ -205,6 +231,28 @@ var _utils3 = require('./utils');
205
231
  }
206
232
  }
207
233
 
234
+ /**
235
+ * Queues already-processed addresses to be queried again. Each query starts
236
+ * from the address's stored lastQueriedBlockHeight, and the address only
237
+ * counts as processed once the new queries complete. Returns how many
238
+ * addresses were re-queued.
239
+ */
240
+ const reopenAddresses = (addresses) => {
241
+ let reopened = 0
242
+ for (const address of addresses) {
243
+ const cacheItem = taskCache.addressSubscribeCache[address]
244
+ if (cacheItem == null || !cacheItem.processing) continue
245
+ cacheItem.processing = false
246
+ taskCache.addressForUtxosCache[address] = {
247
+ processing: false,
248
+ path: cacheItem.path
249
+ }
250
+ progressByScriptPubkey.delete(walletTools.addressToScriptPubkey(address))
251
+ reopened++
252
+ }
253
+ return reopened
254
+ }
255
+
208
256
  const lock = new (0, _awaitlock2.default)()
209
257
 
210
258
  const serverStates = _ServerStates.makeServerStates.call(void 0, {
@@ -224,6 +272,8 @@ var _utils3 = require('./utils');
224
272
  emitter,
225
273
  taskCache,
226
274
  pendingTimeouts,
275
+ electrumHistoryAddresses,
276
+ reopenAddresses,
227
277
  updateProgressRatio,
228
278
  updateSeenTxCheckpoint,
229
279
  io,
@@ -244,8 +294,14 @@ var _utils3 = require('./utils');
244
294
  if (running) return
245
295
  running = true
246
296
 
247
- await initializeAddressSubscriptions()
248
- await setLookAhead(common)
297
+ try {
298
+ await initializeAddressSubscriptions()
299
+ await setLookAhead(common)
300
+ } catch (error) {
301
+ // Let the next call try again instead of skipping the initialization:
302
+ running = false
303
+ throw error
304
+ }
249
305
  }
250
306
 
251
307
  emitter.on(
@@ -265,6 +321,18 @@ var _utils3 = require('./utils');
265
321
  }
266
322
  )
267
323
 
324
+ emitter.on(_EngineEmitter.EngineEvent.SERVER_DROPPED, (uri) => {
325
+ // Everything this server told us about may stop short of the chain tip.
326
+ // Re-open every address so the surviving connection re-queries it. Each
327
+ // query starts from the address's stored lastQueriedBlockHeight, which is
328
+ // never above the height of the server that answered it, so the range
329
+ // the dropped server missed is fetched again.
330
+ const requeued = reopenAddresses(
331
+ Object.keys(taskCache.addressSubscribeCache)
332
+ )
333
+ log(`${uri} dropped, re-queued ${requeued} addresses`)
334
+ })
335
+
268
336
  emitter.on(
269
337
  _EngineEmitter.EngineEvent.NEW_ADDRESS_TRANSACTION,
270
338
  async (_uri, response) => {
@@ -290,6 +358,30 @@ var _utils3 = require('./utils');
290
358
  }
291
359
  )
292
360
 
361
+ // The DataLayer can count an address that it can no longer read, such as
362
+ // when a write to disk was cut short. Every address derives from the wallet
363
+ // keys and its path, so rebuild the missing row instead of failing the
364
+ // engine. The rebuilt row has no sync state, so the address syncs again.
365
+ const repairAddress = async (path) => {
366
+ const { format, changeIndex, addressIndex } = path
367
+ const pathName = `${format}/${changeIndex}/${addressIndex}`
368
+ log.warn(`Repairing missing data-layer address with '${pathName}' path`)
369
+
370
+ const { scriptPubkey, redeemScript } = walletTools.getScriptPubkey(path)
371
+ await dataLayer.saveAddress(
372
+ _types5.makeAddressData.call(void 0, { scriptPubkey, redeemScript, path })
373
+ )
374
+
375
+ // Read the row back, since the save keeps any state that survived:
376
+ const addressData = await dataLayer.fetchAddress(path)
377
+ if (addressData == null) {
378
+ throw new Error(
379
+ `Missing data-layer address with '${pathName}' path during initialization`
380
+ )
381
+ }
382
+ return addressData
383
+ }
384
+
293
385
  // Initialize the addressSubscribeCache with the existing addresses already
294
386
  // processed by the DataLayer. This happens only once before any call to
295
387
  // setLookAhead.
@@ -318,16 +410,13 @@ var _utils3 = require('./utils');
318
410
  addressIndex < branchAddressCount;
319
411
  addressIndex++
320
412
  ) {
321
- const addressData = await dataLayer.fetchAddress({
413
+ const path = {
322
414
  format,
323
415
  changeIndex: branch,
324
416
  addressIndex
325
- })
326
- if (addressData == null) {
327
- throw new Error(
328
- `Missing data-layer address with '${format}/${branch}/${addressIndex}' path during initialization`
329
- )
330
417
  }
418
+ const addressData =
419
+ await _asyncNullishCoalesce((await dataLayer.fetchAddress(path)), async () => ( (await repairAddress(path))))
331
420
  const { address } = walletTools.scriptPubkeyToAddress({
332
421
  changePath,
333
422
  scriptPubkey: addressData.scriptPubkey
@@ -360,7 +449,7 @@ var _utils3 = require('./utils');
360
449
  return {
361
450
  processedPercent,
362
451
  async start() {
363
- processedCount = 0
452
+ progressByScriptPubkey.clear()
364
453
  processedPercent = 0
365
454
 
366
455
  await run()
@@ -692,6 +781,14 @@ const internalGetFreshAddress = async (
692
781
 
693
782
 
694
783
 
784
+
785
+
786
+
787
+
788
+
789
+
790
+
791
+
695
792
 
696
793
 
697
794
 
@@ -850,6 +947,15 @@ const needsTxSpecific = (common) => {
850
947
  const serverState = common.serverStates.getServerState(serverUri)
851
948
  if (serverState == null) return false
852
949
 
950
+ // Re-query the addresses whose history came from Electrum, now that a
951
+ // Blockbook server can answer with their transactions:
952
+ const { electrumHistoryAddresses } = common
953
+ if (!_BlockbookElectrum.isElectrumUri.call(void 0, serverUri) && electrumHistoryAddresses.size > 0) {
954
+ const reopened = common.reopenAddresses(electrumHistoryAddresses)
955
+ electrumHistoryAddresses.clear()
956
+ common.log(`${serverUri} re-queued ${reopened} addresses Electrum answered`)
957
+ }
958
+
853
959
  // subscribe all servers to new blocks
854
960
  if (serverState.blockSubscriptionStatus === 'unsubscribed') {
855
961
  common.serverStates.watchBlocks(serverUri)
@@ -1020,7 +1126,7 @@ const needsTxSpecific = (common) => {
1020
1126
  )) {
1021
1127
  if (
1022
1128
  !cacheItem.processing &&
1023
- common.serverStates.serverCanGetAddress(serverUri, address)
1129
+ common.serverStates.serverCanGetAddressHistory(serverUri, address)
1024
1130
  ) {
1025
1131
  cacheItem.processing = true
1026
1132
 
@@ -1208,6 +1314,18 @@ async function* processAddressForTransactions(
1208
1314
  throw new Error(`could not find address with script pubkey ${scriptPubkey}`)
1209
1315
  }
1210
1316
 
1317
+ // The address was queued with the height of whichever server subscribed
1318
+ // it, but any server can answer the query. Never record more than the
1319
+ // answering server has indexed, so a lagging server cannot move
1320
+ // lastQueriedBlockHeight past blocks it never saw. A height of 0 means this
1321
+ // server has not reported one yet, so nothing it answers can be trusted to
1322
+ // move the cursor; the next query covers the range again. Electrum answers
1323
+ // carry no transactions, so they never move it either:
1324
+ const queriedHeight =
1325
+ serverState.blockHeight > 0 && !_BlockbookElectrum.isElectrumUri.call(void 0, serverUri)
1326
+ ? Math.min(blockHeight, serverState.blockHeight)
1327
+ : addressData.lastQueriedBlockHeight
1328
+
1211
1329
  try {
1212
1330
  const addressResponse = yield* common.serverStates.addressQueryTask(
1213
1331
  serverUri,
@@ -1287,23 +1405,29 @@ async function* processAddressForTransactions(
1287
1405
  addressForTransactionsCache[address] = {
1288
1406
  ...cacheItem,
1289
1407
  processing: false,
1290
- page: page + 1
1408
+ page: page + 1,
1409
+ blockHeight: queriedHeight
1291
1410
  }
1292
1411
  return true
1293
1412
  }
1294
1413
 
1295
1414
  // Update the lastQueriedBlockHeight for the address
1296
- addressData.lastQueriedBlockHeight = blockHeight
1415
+ addressData.lastQueriedBlockHeight = queriedHeight
1297
1416
 
1298
1417
  // Save/update the fully-processed address
1299
1418
  await common.dataLayer.saveAddress(addressData)
1300
1419
 
1301
- // Update the progress now that the transactions for an address have processed
1302
- await common.updateProgressRatio()
1420
+ // Electrum saved no transactions, so a Blockbook server queries this
1421
+ // address again once one is picking tasks:
1422
+ if (_BlockbookElectrum.isElectrumUri.call(void 0, serverUri)) common.electrumHistoryAddresses.add(address)
1303
1423
 
1304
- // Call setLookAhead to update the lookahead
1424
+ // Extend the lookahead before counting progress, so any addresses it adds
1425
+ // are in the total before this address's flag can bring the ratio to 1:
1305
1426
  await setLookAhead(common)
1306
1427
 
1428
+ // Update the progress now that the transactions for an address have processed
1429
+ await common.updateProgressRatio(scriptPubkey, 'txs')
1430
+
1307
1431
  // Add the address to the server cache
1308
1432
  serverState.addresses.add(address)
1309
1433
 
@@ -1573,13 +1697,14 @@ const processDataLayerUtxos = async (
1573
1697
  })
1574
1698
  }
1575
1699
 
1576
- // Update the progress now that the UTXOs for an address have been processed
1577
- await common.updateProgressRatio()
1578
-
1700
+ // Extend the lookahead first, as in processAddressForTransactions:
1579
1701
  await setLookAhead(common).catch(err => {
1580
1702
  common.log.error(err)
1581
1703
  throw err
1582
1704
  })
1705
+
1706
+ // Update the progress now that the UTXOs for an address have been processed
1707
+ await common.updateProgressRatio(scriptPubkey, 'utxos')
1583
1708
  }
1584
1709
 
1585
1710
  /**
@@ -12,6 +12,8 @@ var _digibyte = require('./digibyte'); _createNamedExportFrom(_digibyte, 'digiby
12
12
  var _dogecoin = require('./dogecoin'); _createNamedExportFrom(_dogecoin, 'dogecoin', 'info');
13
13
  var _eboost = require('./eboost'); _createNamedExportFrom(_eboost, 'eboost', 'info');
14
14
  var _ecash = require('./ecash'); _createNamedExportFrom(_ecash, 'ecash', 'info');
15
+ var _ecashbitcoin = require('./ecashbitcoin'); _createNamedExportFrom(_ecashbitcoin, 'ecashbitcoin', 'info');
16
+ var _ecashbitcoinbetanet = require('./ecashbitcoinbetanet'); _createNamedExportFrom(_ecashbitcoinbetanet, 'ecashbitcoinbetanet', 'info');
15
17
  var _feathercoin = require('./feathercoin'); _createNamedExportFrom(_feathercoin, 'feathercoin', 'info');
16
18
  var _groestlcoin = require('./groestlcoin'); _createNamedExportFrom(_groestlcoin, 'groestlcoin', 'info');
17
19
  var _litecoin = require('./litecoin'); _createNamedExportFrom(_litecoin, 'litecoin', 'info');
@@ -45,6 +47,8 @@ var _zcoin = require('./zcoin'); _createNamedExportFrom(_zcoin, 'zcoin', 'info')
45
47
 
46
48
 
47
49
 
50
+
51
+
48
52
 
49
53
 
50
54
 
@@ -63,6 +67,8 @@ var _zcoin = require('./zcoin'); _createNamedExportFrom(_zcoin, 'zcoin', 'info')
63
67
  _dogecoin.info,
64
68
  _eboost.info,
65
69
  _ecash.info,
70
+ _ecashbitcoin.info,
71
+ _ecashbitcoinbetanet.info,
66
72
  _feathercoin.info,
67
73
  _groestlcoin.info,
68
74
  _litecoin.info,
@@ -62,7 +62,7 @@ const engineInfo = {
62
62
  }
63
63
  ],
64
64
  formats: ['bip49', 'bip84', 'bip44', 'bip32'],
65
- forks: ['bitcoincash', 'bitcoingold'],
65
+ forks: ['bitcoincash', 'bitcoingold', 'ecashbitcoin', 'ecashbitcoinbetanet'],
66
66
  gapLimit: 25,
67
67
  feeUpdateInterval: 60000,
68
68
  mempoolSpaceFeeInfoServer: 'https://mempool.space/api/v1/fees/precise',
@@ -0,0 +1,90 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _maximumFeeRateCalculator = require('../../plugin/util/maximumFeeRateCalculator');
5
+
6
+
7
+
8
+
9
+ var _commonInfo = require('./commonInfo');
10
+
11
+ const currencyInfo = {
12
+ assetDisplayName: 'eCash',
13
+ canReplaceByFee: true,
14
+ chainDisplayName: 'eCash',
15
+ currencyCode: 'ECX',
16
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
17
+ memoOptions: _commonInfo.utxoMemoOptions,
18
+ pluginId: 'ecashbitcoin',
19
+ walletType: 'wallet:ecashbitcoin',
20
+
21
+ // Explorers:
22
+ blockExplorer: 'https://explorer.ecash.ninja/block/%s',
23
+ addressExplorer: 'https://explorer.ecash.ninja/address/%s',
24
+ transactionExplorer: 'https://explorer.ecash.ninja/tx/%s',
25
+
26
+ denominations: [
27
+ { name: 'ECX', multiplier: '100000000' },
28
+ { name: 'sats', multiplier: '1', symbol: 's' }
29
+ ],
30
+
31
+ // Deprecated:
32
+ ..._commonInfo.legacyMemoInfo,
33
+ defaultSettings: {
34
+ customFeeSettings: ['satPerByte'],
35
+ blockbookServers: ['wss://blockbook.ecash.ninja/websocket'],
36
+ enableCustomServers: false
37
+ },
38
+ displayName: 'eCash',
39
+ metaTokens: []
40
+ }
41
+
42
+ const engineInfo = {
43
+ formats: ['bip49', 'bip84', 'bip44', 'bip32'],
44
+ // Matches Bitcoin, so wallets split from Bitcoin find every pre-fork address:
45
+ gapLimit: 25,
46
+ feeUpdateInterval: 60000,
47
+ mempoolSpaceFeeInfoServer: 'https://explorer.ecash.ninja/api/v1/fees/precise',
48
+ defaultFeeInfo: {
49
+ lowFeeFudgeFactor: undefined,
50
+ standardFeeLowFudgeFactor: undefined,
51
+ standardFeeHighFudgeFactor: undefined,
52
+ highFeeFudgeFactor: undefined,
53
+
54
+ highFee: '10',
55
+ lowFee: '1',
56
+ standardFeeLow: '2',
57
+ standardFeeHigh: '5',
58
+ standardFeeLowAmount: '173200',
59
+ standardFeeHighAmount: '8670000',
60
+ maximumFeeRate: _maximumFeeRateCalculator.maximumFeeRateCalculator.call(void 0, currencyInfo, 100)
61
+ }
62
+ }
63
+
64
+ const coinInfo = {
65
+ name: 'ecashbitcoin',
66
+ segwit: true,
67
+ coinType: 0,
68
+ // LOCKTIME_THRESHOLD - 2, final only on eCash mainnet:
69
+ lockTime: 499999998,
70
+
71
+ prefixes: {
72
+ messagePrefix: ['\x18Bitcoin Signed Message:\n'],
73
+ wif: [0x80],
74
+ legacyXPriv: [0x0488ade4],
75
+ legacyXPub: [0x0488b21e],
76
+ wrappedSegwitXPriv: [0x049d7878],
77
+ wrappedSegwitXPub: [0x049d7cb2],
78
+ segwitXPriv: [0x04b2430c],
79
+ segwitXPub: [0x04b24746],
80
+ pubkeyHash: [0x00],
81
+ scriptHash: [0x05],
82
+ bech32: ['bc']
83
+ }
84
+ }; exports.coinInfo = coinInfo
85
+
86
+ const info = {
87
+ currencyInfo,
88
+ engineInfo,
89
+ coinInfo: exports.coinInfo
90
+ }; exports.info = info
@@ -0,0 +1,91 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _maximumFeeRateCalculator = require('../../plugin/util/maximumFeeRateCalculator');
5
+
6
+
7
+
8
+
9
+ var _commonInfo = require('./commonInfo');
10
+
11
+ const currencyInfo = {
12
+ assetDisplayName: 'eCash Betanet',
13
+ canReplaceByFee: true,
14
+ chainDisplayName: 'eCash Betanet',
15
+ currencyCode: 'BETAECX',
16
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
17
+ memoOptions: _commonInfo.utxoMemoOptions,
18
+ pluginId: 'ecashbitcoinbetanet',
19
+ walletType: 'wallet:ecashbitcoinbetanet',
20
+
21
+ // Explorers:
22
+ blockExplorer: 'https://explorer.beta.ecash.ninja/block/%s',
23
+ addressExplorer: 'https://explorer.beta.ecash.ninja/address/%s',
24
+ transactionExplorer: 'https://explorer.beta.ecash.ninja/tx/%s',
25
+
26
+ denominations: [
27
+ { name: 'BETAECX', multiplier: '100000000' },
28
+ { name: 'sats', multiplier: '1', symbol: 's' }
29
+ ],
30
+
31
+ // Deprecated:
32
+ ..._commonInfo.legacyMemoInfo,
33
+ defaultSettings: {
34
+ customFeeSettings: ['satPerByte'],
35
+ blockbookServers: ['wss://blockbook.beta.ecash.ninja/websocket'],
36
+ enableCustomServers: false
37
+ },
38
+ displayName: 'eCash Betanet',
39
+ metaTokens: []
40
+ }
41
+
42
+ const engineInfo = {
43
+ formats: ['bip49', 'bip84', 'bip44', 'bip32'],
44
+ // Matches Bitcoin, so wallets split from Bitcoin find every pre-fork address:
45
+ gapLimit: 25,
46
+ feeUpdateInterval: 60000,
47
+ mempoolSpaceFeeInfoServer:
48
+ 'https://explorer.beta.ecash.ninja/api/v1/fees/precise',
49
+ defaultFeeInfo: {
50
+ lowFeeFudgeFactor: undefined,
51
+ standardFeeLowFudgeFactor: undefined,
52
+ standardFeeHighFudgeFactor: undefined,
53
+ highFeeFudgeFactor: undefined,
54
+
55
+ highFee: '10',
56
+ lowFee: '1',
57
+ standardFeeLow: '2',
58
+ standardFeeHigh: '5',
59
+ standardFeeLowAmount: '173200',
60
+ standardFeeHighAmount: '8670000',
61
+ maximumFeeRate: _maximumFeeRateCalculator.maximumFeeRateCalculator.call(void 0, currencyInfo, 100)
62
+ }
63
+ }
64
+
65
+ const coinInfo = {
66
+ name: 'ecashbitcoinbetanet',
67
+ segwit: true,
68
+ coinType: 0,
69
+ // LOCKTIME_THRESHOLD - 1, final only on eCash betanet:
70
+ lockTime: 499999999,
71
+
72
+ prefixes: {
73
+ messagePrefix: ['\x18Bitcoin Signed Message:\n'],
74
+ wif: [0x80],
75
+ legacyXPriv: [0x0488ade4],
76
+ legacyXPub: [0x0488b21e],
77
+ wrappedSegwitXPriv: [0x049d7878],
78
+ wrappedSegwitXPub: [0x049d7cb2],
79
+ segwitXPriv: [0x04b2430c],
80
+ segwitXPub: [0x04b24746],
81
+ pubkeyHash: [0x00],
82
+ scriptHash: [0x05],
83
+ bech32: ['bc']
84
+ }
85
+ }; exports.coinInfo = coinInfo
86
+
87
+ const info = {
88
+ currencyInfo,
89
+ engineInfo,
90
+ coinInfo: exports.coinInfo
91
+ }; exports.info = info
@@ -1083,14 +1083,18 @@ function signBip322Witness(
1083
1083
 
1084
1084
  function makeTx(args) {
1085
1085
  const { log, outputSort, memos, memoIndex } = args
1086
+ const coin = _coinmapper.getCoinFromString.call(void 0, args.coin)
1087
+
1086
1088
  let sequence = 0xffffffff
1087
1089
  if (args.enableRbf) {
1088
1090
  sequence -= 2
1091
+ } else if (coin.lockTime != null) {
1092
+ // Nodes ignore nLockTime unless an input sequence is non-final:
1093
+ sequence -= 1
1089
1094
  }
1090
1095
 
1091
1096
  // get coin specific replay protection sighhash bits
1092
1097
  let sighashType = _altcoinjs.Transaction.SIGHASH_ALL
1093
- const coin = _coinmapper.getCoinFromString.call(void 0, args.coin)
1094
1098
  if (coin.sighash != null) {
1095
1099
  sighashType = coin.sighash
1096
1100
  }
@@ -1246,6 +1250,7 @@ function signBip322Witness(
1246
1250
  }
1247
1251
 
1248
1252
  const psbt = new (0, _altcoinjs.Psbt)()
1253
+ if (coin.lockTime != null) psbt.setLocktime(coin.lockTime)
1249
1254
  try {
1250
1255
  psbt.addInputs(sortedInputs)
1251
1256
  psbt.addOutputs(sortedOutputs)
@@ -101,6 +101,11 @@ var _Socket = require('./Socket');
101
101
 
102
102
 
103
103
 
104
+
105
+
106
+
107
+
108
+
104
109
 
105
110
 
106
111
 
@@ -229,7 +234,7 @@ var _Socket = require('./Socket');
229
234
  )
230
235
  }
231
236
  socket.subscribe({
232
- ..._blockbookApi.subscribeNewBlockMessage.call(void 0, ),
237
+ ...(_nullishCoalesce(config.subscribeNewBlockMessage, () => ( (0, _blockbookApi.subscribeNewBlockMessage))))(),
233
238
  cb: socketCb,
234
239
  deferred: deferredBlockSub,
235
240
  subscribed: false
@@ -277,7 +282,9 @@ var _Socket = require('./Socket');
277
282
  taskGeneratorFn,
278
283
  log,
279
284
  emitter: socketEmitter,
280
- walletId
285
+ walletId,
286
+ keepAliveMs: config.keepAliveMs,
287
+ wakeUpMs: config.wakeUpMs
281
288
  })
282
289
 
283
290
  async function ping() {