Skip to content

Commit

Permalink
fix: undefined if tx not eligible for translation
Browse files Browse the repository at this point in the history
  • Loading branch information
lrnt committed Jan 17, 2023
1 parent 9b37cca commit 2a6bbe7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions extension/src/transactionTranslations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ export const findApplicableTranslation = (
transaction: MetaTransaction
): TransactionTranslation | undefined => {
for (const translation of translations) {
try {
if (translation.translate(transaction)) return translation
} catch (e) {
continue
}
if (translation.translate(transaction)) return translation
}
return undefined
}
4 changes: 2 additions & 2 deletions extension/src/transactionTranslations/uniswapMulticall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {

translate: (transaction) => {
if (!transaction.data) {
throw Error("Invalid translation: transaction doesn't have data")
return undefined
}

let functionCalls: string[] = []
Expand All @@ -34,7 +34,7 @@ export default {
}

if (functionCalls.length === 0) {
throw Error("Invalid translation: couldn't decode function data")
return undefined
}

return functionCalls.map((data) => ({ ...transaction, data }))
Expand Down

0 comments on commit 2a6bbe7

Please sign in to comment.