Skip to content

Commit

Permalink
fix: fix custom contract proposal creation and view (#4524)
Browse files Browse the repository at this point in the history
Signed-off-by: david <[email protected]>
  • Loading branch information
daywiss authored Jan 20, 2024
1 parent bd4f743 commit c3d3b72
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/plugins/oSnap/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 5 additions & 3 deletions src/plugins/oSnap/Proposal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const selectedMethod = computed(
methods.value[0]
);
const parameters = ref<string[]>([]);
const selectedParameters = ref<string[]>([]);
function updateTransaction() {
if (!isValueValid || !isToValid || !isAbiValid) return;
Expand All @@ -48,15 +47,15 @@ function updateTransaction() {
value: value.value,
abi: abi.value,
method: selectedMethod.value,
parameters: selectedParameters.value
parameters: parameters.value
});
if (validateTransaction(transaction)) {
emit('updateTransaction', transaction);
return;
}
} catch (error) {
console.warn('invalid transaction');
console.warn('ContractInteraction - Invalid Transaction:',error);
}
}
Expand All @@ -66,7 +65,7 @@ function updateParameter(index: number, value: string) {
}
function updateMethod(methodName: string) {
selectedParameters.value = [];
parameters.value = [];
selectedMethodName.value = methodName;
updateTransaction();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function updateTransaction(transaction: TTransaction) {
v-if="transaction.type === 'contractInteraction'"
:transaction="newTransaction as ContractInteractionTransaction"
:network="network"
@update-transaction="updateTransaction"
/>

<TransferFunds
Expand Down

0 comments on commit c3d3b72

Please sign in to comment.