Skip to content

Commit

Permalink
Merge pull request #471 from HausDAO/fix/struct-decoding
Browse files Browse the repository at this point in the history
fix decoding ABI params with struct type
  • Loading branch information
santteegt authored Jan 24, 2024
2 parents 2e17966 + f5e6b7c commit fe6e811
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions libs/tx-builder/src/utils/deepDecoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,17 @@ const decodeMethod = (options: {
const inputsWithValues = (inputs as any[]).map((input, index) => ({
name: input.name,
type: input.type,
value: Array.isArray(result.args?.[index])
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
(result.args?.[index] as Array<any>).length
// eslint-disable-next-line @typescript-eslint/no-explicit-any
value:
(result.args?.[index] as any).constructor === {}.constructor

Check warning on line 162 in libs/tx-builder/src/utils/deepDecoding.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
? JSON.stringify(result.args?.[index]) // struct as json object
: Array.isArray(result.args?.[index]) // array
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
(result.args?.[index] as Array<any>).toString()
: '[]'
: result.args?.[index]?.toString() || '0x',
(result.args?.[index] as Array<any>).length
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
(result.args?.[index] as Array<any>).toString()
: '[]'
: result.args?.[index]?.toString() || '0x',
}));

return {
Expand Down

0 comments on commit fe6e811

Please sign in to comment.