From 478de2a53ea02f0f04752c866ba61c95a0f9f137 Mon Sep 17 00:00:00 2001 From: Santiago Gonzalez Date: Mon, 30 Oct 2023 18:49:59 -0500 Subject: [PATCH 1/2] fix mintOrTransferAction value to sum up total value from array params --- .../src/utils/proposalDetailsHelpers.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libs/moloch-v3-macro-ui/src/utils/proposalDetailsHelpers.ts b/libs/moloch-v3-macro-ui/src/utils/proposalDetailsHelpers.ts index 71cfbcee..be5794d2 100644 --- a/libs/moloch-v3-macro-ui/src/utils/proposalDetailsHelpers.ts +++ b/libs/moloch-v3-macro-ui/src/utils/proposalDetailsHelpers.ts @@ -48,12 +48,20 @@ const getValueFromMintOrTransferAction = ( return 'decoding error'; } - const value = Array.isArray(actionData.params[1].value) - ? (actionData.params[1].value[0] as bigint) - : (actionData.params[1].value as bigint); + const value = actionData.params[1].type.endsWith('[]') + ? actionData.params[1].value + .toString() + .split(',') + .map((v) => BigInt(v)) + : [BigInt(actionData.params[1].value.toString())]; return formatValueTo({ - value: toWholeUnits(value.toString(), decimals), + value: toWholeUnits( + value + .reduce((val: bigint, accValue: bigint) => accValue + val, BigInt(0)) + .toString(), + decimals + ), decimals: 2, format: 'numberShort', }); From 0ce1e5d4ab1e6c11bb4d11e1fa018f15e2ab6be3 Mon Sep 17 00:00:00 2001 From: Santiago Gonzalez Date: Mon, 30 Oct 2023 18:51:42 -0500 Subject: [PATCH 2/2] fix empty array param display value to square brakets --- libs/tx-builder/src/utils/deepDecoding.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/tx-builder/src/utils/deepDecoding.ts b/libs/tx-builder/src/utils/deepDecoding.ts index f539d75e..c4d12c87 100644 --- a/libs/tx-builder/src/utils/deepDecoding.ts +++ b/libs/tx-builder/src/utils/deepDecoding.ts @@ -157,7 +157,11 @@ const decodeMethod = (options: { const inputsWithValues = (inputs as any[]).map((input, index) => ({ name: input.name, type: input.type, - value: result.args?.[index]?.toString() || '0x', + value: Array.isArray(result.args?.[index]) + ? (result.args?.[index] as Array).length + ? (result.args?.[index] as Array).toString() + : '[]' + : result.args?.[index]?.toString() || '0x', })); return {