Skip to content

Commit

Permalink
Fix error display with bigint obj
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiarods committed Jan 5, 2024
1 parent eeef78a commit 89d7373
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/transaction-decoder/src/decoding/trace-decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ function getSecondLevelCalls(trace: TraceLog[]) {
return secondLevelCalls
}

function replacer(key: unknown, value: unknown) {
if (typeof value === 'bigint') {
return {
type: 'bigint',
value: value.toString(),
}
} else {
return value
}
}

const decodeTraceLog = (call: TraceLog, transaction: TransactionResponse) =>
Effect.gen(function* (_) {
if ('to' in call.action && 'input' in call.action) {
Expand Down Expand Up @@ -54,7 +65,7 @@ const decodeTraceLog = (call: TraceLog, transaction: TransactionResponse) =>
)
}

return yield* _(Effect.fail(new DecodeError(`Could not decode trace log ${JSON.stringify(call)}`)))
return yield* _(Effect.fail(new DecodeError(`Could not decode trace log ${JSON.stringify(call, replacer)}`)))
})

export const decodeTransactionTrace = ({
Expand Down

0 comments on commit 89d7373

Please sign in to comment.