From ca95cc21a3acc3cd1d50aa089e3d5fa8e8451cce Mon Sep 17 00:00:00 2001 From: Rahul Yadav Date: Tue, 24 Oct 2023 14:54:14 +0530 Subject: [PATCH] Fix minor bugs --- src/components/workspace/ABIUi/ABIUi.tsx | 3 ++- src/hooks/contract.hooks.ts | 7 ++++++- src/hooks/project.hooks.ts | 11 ++++++++++- src/interfaces/workspace.interface.ts | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/workspace/ABIUi/ABIUi.tsx b/src/components/workspace/ABIUi/ABIUi.tsx index 125f27e..28fbadd 100644 --- a/src/components/workspace/ABIUi/ABIUi.tsx +++ b/src/components/workspace/ABIUi/ABIUi.tsx @@ -61,6 +61,7 @@ const ABIUi: FC = ({ abi.name, contract as any, language, + abi?.kind, stack as any, network ); @@ -109,7 +110,7 @@ const ABIUi: FC = ({ className={s.formItemABI} rules={[{ required: true, message: 'Please input value' }]} > - + ))} diff --git a/src/hooks/contract.hooks.ts b/src/hooks/contract.hooks.ts index 5e317b9..37c65c3 100644 --- a/src/hooks/contract.hooks.ts +++ b/src/hooks/contract.hooks.ts @@ -195,6 +195,7 @@ export function useContractAction() { methodName: string, contract: SandboxContract | null = null, language: ContractLanguage, + kind?: string, stack?: TupleItem[], network?: Network | Partial ) { @@ -203,9 +204,12 @@ export function useContractAction() { const sender = sandboxWallet!!.getSender(); - let messageParams = { + let messageParams: any = { $$type: methodName, }; + if (kind === 'text') { + messageParams = methodName; + } stack?.forEach((item: any) => { messageParams = { ...messageParams, @@ -231,6 +235,7 @@ export function useContractAction() { methodName: string, contract: SandboxContract | null = null, language: ContractLanguage, + kind?: string, stack?: TupleItem[], network?: Network | Partial ) { diff --git a/src/hooks/project.hooks.ts b/src/hooks/project.hooks.ts index aeb3608..bf0b564 100644 --- a/src/hooks/project.hooks.ts +++ b/src/hooks/project.hooks.ts @@ -224,7 +224,15 @@ export function useProjectActions() { if (item.message.type === 'Deploy') { return; } - if (item.message.type) { + if (item.message.kind) { + if (item.message.kind !== 'typed') { + setters.push({ + name: item.message.text, + parameters: [], + kind: item.message.kind, + }); + return; + } const singleItem = (output.abi as any).types.find( (type: any) => type.name === item.message.type ); @@ -236,6 +244,7 @@ export function useProjectActions() { type: parameter.type.type, format: parameter.type.format, optional: parameter.type.optional, + kind: item.message.kind, }; }), }; diff --git a/src/interfaces/workspace.interface.ts b/src/interfaces/workspace.interface.ts index 98c57ad..9149610 100644 --- a/src/interfaces/workspace.interface.ts +++ b/src/interfaces/workspace.interface.ts @@ -59,6 +59,7 @@ export interface ABIParameter { export interface ABIField { name: string; + kind: string; parameters: ABIParameter[]; arguments: ABIParameter[]; returnTypes: ABIParameter;