Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
dekanbro committed Sep 11, 2023
1 parent 603d828 commit 13e1b62
Showing 1 changed file with 37 additions and 35 deletions.
72 changes: 37 additions & 35 deletions libs/tx-builder/src/utils/txBuilderUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ export const executeTx = async (args: {
console.log('**TX Error**');
console.error(error);
// catch error if transaction hash is not found
// this happens when coming from a safe connection and it returns safeTxHash
if (String(error).indexOf('TransactionNotFoundError') > -1) {
console.log('Something went wrong in retrieving transaction hash...');
console.log('**Something went wrong in retrieving transaction hash...**');
console.log('**wait for a few seconds and check safe service**');
await sleep(5000);
console.log('**done waiting**');
await sleep(6000);
const url = ENDPOINTS['GNOSIS_API'][chainId];
if (!url) {
return {
Expand All @@ -138,8 +138,11 @@ export const executeTx = async (args: {
const safeReceipt = await fetch.get<{ transactionHash: `0x${string}` }>(
`${url}/multisig-transactions/${txHash}`
);
console.log('**safeReceipt**', safeReceipt);
console.log('**Rerun with new hash**');
console.log(
'**safeReceipt with onchain transactionHash**',
safeReceipt
);
console.log('**Rerun with new hash**');

executeTx({
...args,
Expand All @@ -149,38 +152,37 @@ export const executeTx = async (args: {
console.error({
error: formatFetchError({ type: 'GNOSIS_ERROR', errorObject: err }),
});
console.log('**Rerun**');
executeTx(args);
return;
}
console.log('**Cant find hash, bail out.**');

// // set transaction to success
// setTransactions((prevState) => ({
// ...prevState,
// [txHash]: { ...tx, status: 'success' },
// }));
// set transaction to success
setTransactions((prevState) => ({
...prevState,
[txHash]: { ...tx, status: 'success' },
}));

// // Empty receipt to pass to onPollSuccess
// lifeCycleFns?.onPollSuccess?.(
// 'Something went wrong in retrieving transaction hash...',
// {
// blockHash: zeroAddress,
// blockNumber: BigInt(0),
// from: zeroAddress,
// status: 'success',
// contractAddress: zeroAddress,
// cumulativeGasUsed: BigInt(0),
// effectiveGasPrice: BigInt(0),
// gasUsed: BigInt(0),
// logs: [],
// logsBloom: zeroAddress,
// to: zeroAddress,
// transactionHash: txHash,
// transactionIndex: 0,
// type: 'none',
// },
// appState
// );
// Empty receipt to pass to onPollSuccess
lifeCycleFns?.onPollSuccess?.(
'Something went wrong in retrieving transaction hash...',
{
blockHash: zeroAddress,
blockNumber: BigInt(0),
from: zeroAddress,
status: 'success',
contractAddress: zeroAddress,
cumulativeGasUsed: BigInt(0),
effectiveGasPrice: BigInt(0),
gasUsed: BigInt(0),
logs: [],
logsBloom: zeroAddress,
to: zeroAddress,
transactionHash: txHash,
transactionIndex: 0,
type: 'none',
},
appState
);
return;
}
} else {
lifeCycleFns?.onTxError?.(error);
setTransactions((prevState) => ({
Expand Down

0 comments on commit 13e1b62

Please sign in to comment.