Skip to content

Commit

Permalink
remove redundant action button state
Browse files Browse the repository at this point in the history
Signed-off-by: ryanwolhuter <[email protected]>
  • Loading branch information
ryanwolhuter committed Oct 17, 2023
1 parent 7f28a19 commit 7e133e2
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions src/plugins/oSnap/components/HandleOutcome/HandleOutcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,7 @@ type ProposalExecutionStep =
| 'assertion-passed-in-oo'
| 'transactions-executed';
type Action1State =
| 'idle'
| 'approve-bond'
| 'submit-proposal'
| 'execute-proposal';
const isLoading = ref(true);
const actionButtonState = ref<Action1State>('idle');
const proposalExecutionDetails = ref<ProposalExecutionDetails>();
const hasConnectedWallet = computed(() => !!web3.value.account);
Expand Down Expand Up @@ -120,8 +113,6 @@ async function updateDetails() {
async function onApproveBond() {
const txPendingId = createPendingTransaction();
try {
actionButtonState.value = 'approve-bond';
await ensureRightNetwork(props.network);
const approvingBond = approveBond(
Expand All @@ -132,23 +123,20 @@ async function onApproveBond() {
const step = await approvingBond.next();
if (step.value)
updatePendingTransaction(txPendingId, { hash: step.value.hash });
actionButtonState.value = 'idle';
await approvingBond.next();
notify('Successfully approved bond');
await sleep(3e3);
await updateDetails();
} catch (e) {
console.error(e);
notify(['red', 'Failed to approve bond']);
actionButtonState.value = 'idle';
} finally {
removePendingTransaction(txPendingId);
}
}
async function onSubmitProposal() {
if (!getInstance().isAuthenticated.value) return;
actionButtonState.value = 'submit-proposal';
const txPendingId = createPendingTransaction();
try {
await ensureRightNetwork(props.network);
Expand All @@ -161,7 +149,6 @@ async function onSubmitProposal() {
const step = await proposalSubmission.next();
if (step.value)
updatePendingTransaction(txPendingId, { hash: step.value.hash });
actionButtonState.value = 'idle';
await proposalSubmission.next();
notify('Proposal submitted successfully');
await sleep(3e3);
Expand All @@ -170,21 +157,17 @@ async function onSubmitProposal() {
notify(['red', 'Failed to submit proposal']);
console.error(e);
} finally {
actionButtonState.value = 'idle';
removePendingTransaction(txPendingId);
}
}
async function onExecuteProposal() {
if (!getInstance().isAuthenticated.value) return;
actionButtonState.value = 'execute-proposal';
const txPendingId = createPendingTransaction();
try {
await ensureRightNetwork(props.network);
} catch (e) {
console.error(e);
actionButtonState.value = 'idle';
return;
}
try {
Expand All @@ -196,14 +179,12 @@ async function onExecuteProposal() {
const step = await executingProposal.next();
if (step.value)
updatePendingTransaction(txPendingId, { hash: step.value.hash });
actionButtonState.value = 'idle';
await executingProposal.next();
notify('Proposal executed successfully');
await sleep(3e3);
await updateDetails();
} catch (err) {
notify(['red', 'Failed to execute proposal']);
actionButtonState.value = 'idle';
} finally {
removePendingTransaction(txPendingId);
}
Expand Down

0 comments on commit 7e133e2

Please sign in to comment.