@omisego/omg-js-utxo-merge
Advanced tools
Comparing version 1.0.0 to 1.0.1
25
index.js
@@ -20,3 +20,3 @@ | ||
console.log(`Merging ${utxos.length} utxos of ${currency}`) | ||
const submitted = await Promise.all(mergeUtxos(utxos, | ||
let submitted = await Promise.all(mergeUtxos(utxos, | ||
currency, | ||
@@ -28,2 +28,5 @@ address, | ||
// Filter out failed transactions | ||
submitted = submitted.filter(utxo => utxo.result) | ||
// We can use the results of the submitted transactions to construct | ||
@@ -58,6 +61,18 @@ // utxos before they're put into blocks and continue the merging process. | ||
// Submit each signed transaction | ||
return signed.map(async (tx) => ({ | ||
result: await submitFunc(tx.signed), | ||
value: tx.value | ||
})) | ||
return signed.map(async (tx) => { | ||
let result | ||
try { | ||
result = await submitFunc(tx.signed) | ||
} catch (err) { | ||
if (err.code.includes('submit:fees_not_covered')) { | ||
console.warn(`Cannot automatically merge ${currency} tokens.`) | ||
} else { | ||
console.error(`Error merging: ${err}`) | ||
} | ||
} | ||
return { | ||
result, | ||
value: tx.value | ||
} | ||
}) | ||
} | ||
@@ -64,0 +79,0 @@ |
{ | ||
"name": "@omisego/omg-js-utxo-merge", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,3 +15,3 @@ # omg-js-utxo-merge | ||
const childChain = new ChildChain('http://watcher-staging.omg.network/') | ||
const childChain = new ChildChain('http://watcher.ari.omg.network/') | ||
@@ -18,0 +18,0 @@ function signTransaction (unsignedTx, numUtxos, address) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4005
92