From c3d3b72a30ae2604516fbc530ce812974c52f5ce Mon Sep 17 00:00:00 2001 From: David A <4429761+daywiss@users.noreply.github.com> Date: Fri, 19 Jan 2024 21:54:08 -0600 Subject: [PATCH] fix: fix custom contract proposal creation and view (#4524) Signed-off-by: david --- src/plugins/oSnap/Create.vue | 1 - src/plugins/oSnap/Proposal.vue | 8 +++++--- .../components/TransactionBuilder/ContractInteraction.vue | 7 +++---- .../oSnap/components/TransactionBuilder/Transaction.vue | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/plugins/oSnap/Create.vue b/src/plugins/oSnap/Create.vue index f584f3145fb..ddc061f73e6 100644 --- a/src/plugins/oSnap/Create.vue +++ b/src/plugins/oSnap/Create.vue @@ -58,7 +58,6 @@ function removeTransaction(transactionIndex: number) { function updateTransaction(transaction: Transaction, transactionIndex: number) { if (!newPluginData.value.safe) return; - newPluginData.value.safe.transactions[transactionIndex] = transaction; update(newPluginData.value); } diff --git a/src/plugins/oSnap/Proposal.vue b/src/plugins/oSnap/Proposal.vue index d079a9accdd..7d677e595a7 100644 --- a/src/plugins/oSnap/Proposal.vue +++ b/src/plugins/oSnap/Proposal.vue @@ -54,12 +54,14 @@ function enrichTransactionForDisplay(transaction: Transaction) { return { ...commonProperties, type: 'Raw' }; } if (transaction.type === 'contractInteraction') { - const { methodName, parameters } = transaction; + const { method, parameters } = transaction; return { ...commonProperties, type: 'Contract interaction', - 'method name': methodName, - parameters: parameters?.join(', ') + 'method name': method.name, + ...Object.fromEntries(method.inputs.map((input,i)=>{ + return [`${input.name} (param ${i+1}): `,parameters[i]] + })) }; } if (transaction.type === 'transferFunds') { diff --git a/src/plugins/oSnap/components/TransactionBuilder/ContractInteraction.vue b/src/plugins/oSnap/components/TransactionBuilder/ContractInteraction.vue index 0f53c3a493e..a787fdf488f 100644 --- a/src/plugins/oSnap/components/TransactionBuilder/ContractInteraction.vue +++ b/src/plugins/oSnap/components/TransactionBuilder/ContractInteraction.vue @@ -38,7 +38,6 @@ const selectedMethod = computed( methods.value[0] ); const parameters = ref([]); -const selectedParameters = ref([]); function updateTransaction() { if (!isValueValid || !isToValid || !isAbiValid) return; @@ -48,7 +47,7 @@ function updateTransaction() { value: value.value, abi: abi.value, method: selectedMethod.value, - parameters: selectedParameters.value + parameters: parameters.value }); if (validateTransaction(transaction)) { @@ -56,7 +55,7 @@ function updateTransaction() { return; } } catch (error) { - console.warn('invalid transaction'); + console.warn('ContractInteraction - Invalid Transaction:',error); } } @@ -66,7 +65,7 @@ function updateParameter(index: number, value: string) { } function updateMethod(methodName: string) { - selectedParameters.value = []; + parameters.value = []; selectedMethodName.value = methodName; updateTransaction(); } diff --git a/src/plugins/oSnap/components/TransactionBuilder/Transaction.vue b/src/plugins/oSnap/components/TransactionBuilder/Transaction.vue index e5e7c0a5523..08dcfe2b22a 100644 --- a/src/plugins/oSnap/components/TransactionBuilder/Transaction.vue +++ b/src/plugins/oSnap/components/TransactionBuilder/Transaction.vue @@ -66,6 +66,7 @@ function updateTransaction(transaction: TTransaction) { v-if="transaction.type === 'contractInteraction'" :transaction="newTransaction as ContractInteractionTransaction" :network="network" + @update-transaction="updateTransaction" />