@metaverse-network-sdk/api
Advanced tools
Comparing version 0.0.1-51-4 to 0.0.1-51-6
@@ -233,4 +233,16 @@ "use strict"; | ||
} | ||
if (((res.isInBlock) && txErrors.length > 0) || hasBatchErrors) { | ||
console.log(`Failed. Block hash: ${res.status.asInBlock.toHex()}`); | ||
if (res.isFinalized && txErrors.length == 0 && !hasBatchErrors) { | ||
setStatus(`😉 Finalized. Block hash: ${res.status.asFinalized.toString()}`); | ||
setIsLoading(false); | ||
inBlock.resolve({ events: res.events, blockHash: res.status.asFinalized, txHash: signed.hash }); | ||
finalized.resolve({ events: res.events, blockHash: res.status.asFinalized, txHash: signed.hash }); | ||
sendPromise.then((unsup) => unsup()); | ||
} | ||
else if (((res.isFinalized || res.isInBlock) && txErrors.length > 0) || hasBatchErrors) { | ||
if (res.isInBlock) { | ||
console.log(`Failed. Block hash: ${res.status.asInBlock.toHex()}`); | ||
} | ||
else { | ||
console.log(`Failed. Block hash: ${res.status.asFinalized.toHex()}`); | ||
} | ||
let err = ""; | ||
@@ -284,6 +296,11 @@ if (hasBatchErrors) { | ||
else if (res.isInBlock) { | ||
setStatus(`Transaction Successful`); | ||
setIsLoading(false); | ||
inBlock.resolve({ events: res.events, blockHash: res.status.asInBlock, txHash: signed.hash }); | ||
sendPromise.then((unsup) => unsup()); | ||
if (!options.waitToFinalized) { | ||
setStatus(`Transaction Successful`); | ||
setIsLoading(false); | ||
inBlock.resolve({ events: res.events, blockHash: res.status.asInBlock, txHash: signed.hash }); | ||
sendPromise.then((unsup) => unsup()); | ||
} | ||
else { | ||
setStatus(`Transaction already included in Block. Waiting for Finality`); | ||
} | ||
} | ||
@@ -290,0 +307,0 @@ else if (res.status.isInvalid || |
{ | ||
"name": "@metaverse-network-sdk/api", | ||
"version": "0.0.1-51-4", | ||
"version": "0.0.1-51-6", | ||
"description": "Extended API library for polkadot.js", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
32605
475