edge-currency-plugins 1.0.0-rc.4 → 1.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.
- package/lib/common/utxobased/engine/makeUtxoEngine.js +4 -1
- package/lib/common/utxobased/engine/makeUtxoEngineState.js +1 -1
- package/lib/common/utxobased/info/bitcoincash.js +1 -1
- package/lib/common/utxobased/info/bitcoinsv.js +3 -3
- package/lib/common/utxobased/keymanager/utxopicker/accumulative.js +1 -1
- package/lib/common/utxobased/keymanager/utxopicker/forceUseUtxo.js +1 -1
- package/lib/common/utxobased/keymanager/utxopicker/subtractFee.js +1 -1
- package/lib/common/utxobased/network/Socket.js +9 -4
- package/package.json +2 -2
|
@@ -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 (
|
|
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
|
|
|
@@ -450,7 +450,7 @@ var _utils3 = require('./utils');
|
|
|
450
450
|
const utxoMap = new Map()
|
|
451
451
|
for (const utxo of utxos) {
|
|
452
452
|
const utxoSet = _nullishCoalesce(utxoMap.get(utxo.scriptPubkey), () => ( new Set()))
|
|
453
|
-
if (utxoMap.has(utxo.scriptPubkey)
|
|
453
|
+
if (!utxoMap.has(utxo.scriptPubkey))
|
|
454
454
|
utxoMap.set(utxo.scriptPubkey, utxoSet)
|
|
455
455
|
utxoSet.add(utxo)
|
|
456
456
|
}
|
|
@@ -41,9 +41,9 @@ const currencyInfo = {
|
|
|
41
41
|
metaTokens: [],
|
|
42
42
|
|
|
43
43
|
// Explorers:
|
|
44
|
-
blockExplorer: 'https://
|
|
45
|
-
addressExplorer: 'https://
|
|
46
|
-
transactionExplorer: 'https://
|
|
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 }
|
|
@@ -275,7 +275,12 @@ const WAKE_UP_MS = 5000 // interval at which we wakeUp and potentially onQueueSp
|
|
|
275
275
|
if (!subscription.subscribed) {
|
|
276
276
|
subscription.deferred.reject()
|
|
277
277
|
}
|
|
278
|
-
|
|
278
|
+
try {
|
|
279
|
+
subscription.cb(subscription.cleaner(json.data))
|
|
280
|
+
} catch (error) {
|
|
281
|
+
console.log({ uri, error, json, subscription })
|
|
282
|
+
throw error
|
|
283
|
+
}
|
|
279
284
|
return
|
|
280
285
|
}
|
|
281
286
|
}
|
|
@@ -296,9 +301,9 @@ const WAKE_UP_MS = 5000 // interval at which we wakeUp and potentially onQueueSp
|
|
|
296
301
|
} else {
|
|
297
302
|
message.task.deferred.resolve(json.data)
|
|
298
303
|
}
|
|
299
|
-
} catch (
|
|
300
|
-
|
|
301
|
-
message.task.deferred.reject(
|
|
304
|
+
} catch (error) {
|
|
305
|
+
console.log({ uri, error, json, message })
|
|
306
|
+
message.task.deferred.reject(error)
|
|
302
307
|
}
|
|
303
308
|
}
|
|
304
309
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-currency-plugins",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
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",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"bs58smartcheck": "^2.0.4",
|
|
49
49
|
"cleaners": "^0.3.12",
|
|
50
50
|
"disklet": "^0.4.5",
|
|
51
|
-
"edge-core-js": "^0.19.
|
|
51
|
+
"edge-core-js": "^0.19.20",
|
|
52
52
|
"memlet": "^0.1.6",
|
|
53
53
|
"uri-js": "^4.4.0",
|
|
54
54
|
"url-parse": "^1.5.2",
|