Skip to content

Commit

Permalink
Merge branch 'main' into recheck-tokens-after-block
Browse files Browse the repository at this point in the history
  • Loading branch information
Romsters authored Dec 11, 2023
2 parents ac2bba4 + ad69966 commit 16d0cd9
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions packages/app/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,24 @@ export const mapOrder = (array: any[], order: string[], key: string) => {
});
};

export function decodeLogWithABI(log: TransactionLogEntry, abi: AbiFragment[]): TransactionEvent {
export function decodeLogWithABI(log: TransactionLogEntry, abi: AbiFragment[]): TransactionEvent | undefined {
const contractInterface = new utils.Interface(abi);
const decodedLog = contractInterface.parseLog({
topics: log.topics,
data: log.data,
});
return {
name: decodedLog.name,
inputs: decodedLog.eventFragment.inputs.map((input) => ({
name: input.name,
type: input.type as InputType,
value: decodedLog.args[input.name]?.toString(),
})),
};
try {
const decodedLog = contractInterface.parseLog({
topics: log.topics,
data: log.data,
});
return {
name: decodedLog.name,
inputs: decodedLog.eventFragment.inputs.map((input) => ({
name: input.name,
type: input.type as InputType,
value: decodedLog.args[input.name]?.toString(),
})),
};
} catch {
return undefined;
}
}

export function sortTokenTransfers(transfers: TokenTransfer[]): TokenTransfer[] {
Expand Down

0 comments on commit 16d0cd9

Please sign in to comment.