Skip to content

Commit

Permalink
change map by for and try to avoid pass step if the address is not set (
Browse files Browse the repository at this point in the history
irfanbozkurt#38)

Co-authored-by: escottalexander <[email protected]>
  • Loading branch information
Franpastoragusti and escottalexander authored Aug 5, 2024
1 parent e64d080 commit 01d27ee
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions packages/nextjs/hooks/flashbotRecoveryBundle/useRecoveryProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const useRecoveryProcess = () => {
if (!address) {
setStepActive(RecoveryProcessStatus.NO_CONNECTED_ACCOUNT);
return false;
} else if (address != safeAddress || safeAddress == DUMMY_ADDRESS) {
} else if (address != safeAddress || safeAddress == DUMMY_ADDRESS || address == DUMMY_ADDRESS) {
setStepActive(RecoveryProcessStatus.NO_SAFE_ACCOUNT);
return false;
}
Expand Down Expand Up @@ -260,10 +260,12 @@ export const useRecoveryProcess = () => {
safeAddress: string;
hackedAddress: string;
}): RecoveryTx[] => {
return transactions.map(item => {
const result: RecoveryTx[] = []
for (const item of transactions) {
let newTX:RecoveryTx = {...item}
if (item.type === "erc20") {
const data = item as ERC20Tx;
const newErc20tx: ERC20Tx = {
newTX= {
type: data.type,
info: data.info,
symbol: data.symbol,
Expand All @@ -277,12 +279,11 @@ export const useRecoveryProcess = () => {
]) as `0x${string}`,
},
};
return newErc20tx;
}

if (item.type === "erc721") {
const data = item as ERC721Tx;
const newErc721Tx: ERC721Tx = {
newTX= {
type: data.type,
info: data.info,
symbol: data.symbol,
Expand All @@ -297,12 +298,11 @@ export const useRecoveryProcess = () => {
]) as `0x${string}`,
},
};
return newErc721Tx;
}

if (item.type === "erc1155") {
const data = item as ERC1155Tx;
const newErc1155Tx: ERC1155Tx = {
newTX= {
type: data.type,
info: data.info,
uri: data.uri,
Expand All @@ -320,11 +320,10 @@ export const useRecoveryProcess = () => {
]) as `0x${string}`,
},
};
return newErc1155Tx;
}

return item;
});
result.push(newTX)
}
return result;
};

const startRecoveryProcess = async ({
Expand Down

0 comments on commit 01d27ee

Please sign in to comment.