Skip to content

Commit

Permalink
fix duplicate signing request for shield
Browse files Browse the repository at this point in the history
  • Loading branch information
brenzi committed Oct 10, 2024
1 parent 0ef32a7 commit dbac2a6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,7 @@ const isFetchingIncogniteeBalance = ref(true);
const isUpdatingIncogniteeBalance = ref(false);
const isChoosingAccount = ref(false);
const disableGetter = ref(false);
const isSignerBusy = ref(false);
const existential_deposit_paseo = 10000000000;
const txStatus = ref("");
Expand Down Expand Up @@ -1725,7 +1726,7 @@ const txResHandlerPaseo = ({ events = [], status, txHash }) => {
status.isFinalized
? (txStatus.value = `πŸ˜€ Finalized. Finalized. You should see your Incognitee balance increase in seconds. Please move to the Private Balance tab`)
: (txStatus.value = `βŒ› Current transaction status: ${status.type}. please be patient a few more seconds. you should see your Paseo balance going down`);
isSignerBusy.value = false;
// Loop through Vec<EventRecord> to display all events
events.forEach(({ _, event: { data, method, section } }) => {
if (section + ":" + method === "system:ExtrinsicFailed") {
Expand Down Expand Up @@ -1760,7 +1761,9 @@ const txResHandlerPaseo = ({ events = [], status, txHash }) => {
}
txStatus.value = `😞 Transaction Failed! ${section}.${method}::${errorInfo}`;
} else if (section + ":" + method === "system:ExtrinsicSuccess") {
txStatus.value`❀️️ Transaction successful!`;
console.log(
`βœ… Transaction successful with status: ${status} hash: ${txHash}`,
);
}
});
};
Expand All @@ -1769,7 +1772,13 @@ const txErrHandlerPaseo = (err) =>
(txStatus.value = `😞 Transaction Failed: ${err.toString()}`);
const shield = async () => {
console.log("shielding .....");
txStatus.value = "βŒ› connecting to Paseo....please be patient";
if (isSignerBusy.value) {
// fixme! this is a hack. don't know why extension pops up twice without this
console.log("signer busy. aborting repeated attempt...");
return;
}
isSignerBusy.value = true;
txStatus.value = "βŒ› awaiting signature and connection";
if (incogniteeStore.vault) {
const balance = accountStore.paseoBalance;
const amount = Math.pow(10, 10) * shieldAmount.value;
Expand Down

0 comments on commit dbac2a6

Please sign in to comment.