edge-currency-plugins 1.0.0-rc.3 → 1.0.0-rc.6

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.
@@ -286,7 +286,10 @@ var _utils = require('./utils');
286
286
  await _asyncNullishCoalesce(await _asyncOptionalChain([options, 'optionalAccess', async _6 => _6.utxos]), async () => (
287
287
  ((await processor.fetchUtxos({ utxoIds: [] })) )))
288
288
 
289
- if (bs.gt(totalAmountToSend, `${_utils.sumUtxos.call(void 0, utxos)}`)) {
289
+ if (
290
+ bs.gt(totalAmountToSend, `${_utils.sumUtxos.call(void 0, utxos)}`) ||
291
+ utxos.length === 0
292
+ ) {
290
293
  throw new (0, _types.InsufficientFundsError)(currencyInfo.currencyCode)
291
294
  }
292
295
 
@@ -140,8 +140,11 @@ var _utils3 = require('./utils');
140
140
  **/
141
141
  const processesPerAddress = 2
142
142
  let processedCount = 0
143
- let processedPercent = 0
143
+ let processedPercent = 0 // last sync ratio emitted
144
144
  const updateProgressRatio = async () => {
145
+ // Avoid re-sending sync ratios / sending ratios larger than 1
146
+ if (processedPercent >= 1) return
147
+
145
148
  // We expect the total number of progress updates to equal the number of
146
149
  // addresses multiplied the number of processes per address.
147
150
  const expectedProccessCount =
@@ -41,9 +41,9 @@ const currencyInfo = {
41
41
  metaTokens: [],
42
42
 
43
43
  // Explorers:
44
- blockExplorer: 'https://blockchair.com/bitcoin-sv/block/%s',
45
- addressExplorer: 'https://blockchair.com/bitcoin-sv/address/%s',
46
- transactionExplorer: 'https://blockchair.com/bitcoin-sv/transaction/%s',
44
+ blockExplorer: 'https://whatsonchain.com/block/%s',
45
+ addressExplorer: 'https://whatsonchain.com/address/%s',
46
+ transactionExplorer: 'https://whatsonchain.com/tx/%s',
47
47
 
48
48
  // Images:
49
49
  symbolImage: `${_constants.IMAGE_SERVER_URL}/bitcoinsv-logo-solo-64.png`,
@@ -47,6 +47,6 @@ var _utils = require('./utils'); var utils = _interopRequireWildcard(_utils);
47
47
 
48
48
  return {
49
49
  changeUsed: false,
50
- fee: feeRate * utils.transactionBytes(inputs, outputs)
50
+ fee: Math.ceil(feeRate * utils.transactionBytes(inputs, outputs))
51
51
  }
52
52
  } exports.accumulative = accumulative;
@@ -54,6 +54,6 @@ var _utils = require('./utils'); var utils = _interopRequireWildcard(_utils);
54
54
 
55
55
  return {
56
56
  changeUsed: false,
57
- fee: feeRate * utils.transactionBytes(inputs, outputs)
57
+ fee: Math.ceil(feeRate * utils.transactionBytes(inputs, outputs))
58
58
  }
59
59
  } exports.forceUseUtxo = forceUseUtxo;
@@ -10,7 +10,7 @@ var _utils = require('./utils'); var utils = _interopRequireWildcard(_utils);
10
10
  scriptPubkey: Buffer.from(target.script, 'hex')
11
11
  }))
12
12
 
13
- const fee = feeRate * utils.transactionBytes(utxos, outputs)
13
+ const fee = Math.ceil(feeRate * utils.transactionBytes(utxos, outputs))
14
14
  targets[0].value -= fee
15
15
  outputs[0].value -= fee
16
16
  return { inputs: utxos, outputs, fee, changeUsed: false }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-currency-plugins",
3
- "version": "1.0.0-rc.3",
3
+ "version": "1.0.0-rc.6",
4
4
  "description": "Edge currency plugins to fetch and process wallet accounts, balances and transactions.",
5
5
  "repository": "https://github.com/EdgeApp/edge-currency-plugins",
6
6
  "license": "MIT",