Skip to content

Commit

Permalink
GPR | Sale Widget | validate 1 txn failed to execute (#1037)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhesgodi committed Oct 22, 2023
1 parent 63062cd commit c46c967
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export const useSignOrder = (input: SignOrderInput) => {
await txnResponse?.wait(1);

transactionHash = txnResponse?.hash;
return transactionHash;
} catch (e) {
// TODO: check error type to send
// SaleErrorTypes.WALLET_REJECTED or SaleErrorTypes.WALLET_REJECTED_NO_FUNDS
Expand All @@ -220,9 +221,8 @@ export const useSignOrder = (input: SignOrderInput) => {
type: errorType,
data: { error: e },
});
return undefined;
}

return transactionHash;
},
[provider],
);
Expand Down Expand Up @@ -289,7 +289,7 @@ export const useSignOrder = (input: SignOrderInput) => {
});
return [];
}

let successful = true;
const execTransactions: ExecutedTransaction[] = [];
for (const transaction of signData.transactions) {
const {
Expand All @@ -302,13 +302,16 @@ export const useSignOrder = (input: SignOrderInput) => {
const hash = await sendTransaction(to, data, gasEstimate, method);

if (!hash) {
successful = false;
break;
}

execTransactions.push({ method, hash });
}

setExecuteDone();
if (successful) {
setExecuteDone();
}
return execTransactions;
};

Expand Down

0 comments on commit c46c967

Please sign in to comment.