From f5e6b7cdebc5729e68cb53e69c94ff1f4d2641a4 Mon Sep 17 00:00:00 2001 From: Santiago Gonzalez Date: Thu, 18 Jan 2024 15:33:50 -0500 Subject: [PATCH] fix decoding ABI params with struct type --- libs/tx-builder/src/utils/deepDecoding.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libs/tx-builder/src/utils/deepDecoding.ts b/libs/tx-builder/src/utils/deepDecoding.ts index 1c4f4b35..d1583f1d 100644 --- a/libs/tx-builder/src/utils/deepDecoding.ts +++ b/libs/tx-builder/src/utils/deepDecoding.ts @@ -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).length + // eslint-disable-next-line @typescript-eslint/no-explicit-any + value: + (result.args?.[index] as any).constructor === {}.constructor + ? 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).toString() - : '[]' - : result.args?.[index]?.toString() || '0x', + (result.args?.[index] as Array).length + ? // eslint-disable-next-line @typescript-eslint/no-explicit-any + (result.args?.[index] as Array).toString() + : '[]' + : result.args?.[index]?.toString() || '0x', })); return {