From c85f84eafe1847b42e1b1643b591e71d210de607 Mon Sep 17 00:00:00 2001 From: Hugo Caillard <911307+hugocaillard@users.noreply.github.com> Date: Mon, 29 Jan 2024 15:41:39 +0100 Subject: [PATCH] fix: fix sdk tests --- components/clarinet-sdk/src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/clarinet-sdk/src/index.ts b/components/clarinet-sdk/src/index.ts index 45c8c77ef..82741a665 100644 --- a/components/clarinet-sdk/src/index.ts +++ b/components/clarinet-sdk/src/index.ts @@ -102,13 +102,14 @@ export type GetDataVar = (contract: string, dataVar: string) => ClarityValue; export type GetMapEntry = (contract: string, mapName: string, mapKey: ClarityValue) => ClarityValue; export type GetContractAST = (contractId: string) => ContractAST; export type GetContractsInterfaces = () => Map; +export type RunSnippet = (snippet: string) => ClarityValue | string; // because the session is wrapped in a proxy the types need to be hardcoded export type Simnet = { [K in keyof SDK]: K extends "callReadOnlyFn" | "callPublicFn" ? CallFn : K extends "runSnippet" - ? ClarityValue + ? RunSnippet : K extends "deployContract" ? DeployContract : K extends "transferSTX" @@ -174,7 +175,7 @@ const getSessionProxy = () => ({ } if (prop === "runSnippet") { - return (snippet: string) => { + const runSnippet: RunSnippet = (snippet) => { const response = session[prop](snippet); if (response.startsWith("0x")) { return Cl.deserialize(response); @@ -182,6 +183,7 @@ const getSessionProxy = () => ({ return response; } }; + return runSnippet; } if (prop === "deployContract") {