From 5b4c0239ebe96be2ed8fa40159106d0637202edc Mon Sep 17 00:00:00 2001 From: Hank Stoever Date: Wed, 4 Sep 2024 10:15:45 -0700 Subject: [PATCH] fix: generating variables for Clarity v3 contracts --- .changeset/large-clouds-jam.md | 6 ++++++ demo-project/contracts/tester.clar | 4 ++++ demo-project/esm/index.ts | 22 +++++++--------------- packages/cli/src/files/variables.ts | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 .changeset/large-clouds-jam.md diff --git a/.changeset/large-clouds-jam.md b/.changeset/large-clouds-jam.md new file mode 100644 index 0000000..df57da3 --- /dev/null +++ b/.changeset/large-clouds-jam.md @@ -0,0 +1,6 @@ +--- +'demo-project': patch +'@clarigen/cli': patch +--- + +Fixes an issue with generating variables for Clarity version 3 contracts diff --git a/demo-project/contracts/tester.clar b/demo-project/contracts/tester.clar index faf5e28..8187e59 100644 --- a/demo-project/contracts/tester.clar +++ b/demo-project/contracts/tester.clar @@ -64,4 +64,8 @@ (print u100) (err u210) ) +) + +(define-read-only (get-tenure-info-test) + (get-tenure-info? burnchain-header-hash u1) ) \ No newline at end of file diff --git a/demo-project/esm/index.ts b/demo-project/esm/index.ts index b679448..4ea1dee 100644 --- a/demo-project/esm/index.ts +++ b/demo-project/esm/index.ts @@ -468,6 +468,12 @@ export const contracts = { args: [{ name: 'val', type: { 'string-ascii': { length: 33 } } }], outputs: { type: { 'string-ascii': { length: 33 } } }, } as TypedAbiFunction<[val: TypedAbiArg], string>, + getTenureInfoTest: { + name: 'get-tenure-info-test', + access: 'read_only', + args: [], + outputs: { type: { optional: { buffer: { length: 32 } } } }, + } as TypedAbiFunction<[], Uint8Array | null>, getTup: { name: 'get-tup', access: 'read_only', @@ -575,21 +581,7 @@ export const contracts = { access: 'variable', } as TypedAbiVariable, }, - constants: { - ERR_ONE: { - isOk: false, - value: 1n, - }, - ERR_TWO: { - isOk: false, - value: 2n, - }, - errThree: { - isOk: false, - value: 3n, - }, - numVar: 0n, - }, + constants: {}, non_fungible_tokens: [ { name: 'nft', type: 'uint128' }, { diff --git a/packages/cli/src/files/variables.ts b/packages/cli/src/files/variables.ts index 45d7185..7f9d8ed 100644 --- a/packages/cli/src/files/variables.ts +++ b/packages/cli/src/files/variables.ts @@ -47,7 +47,7 @@ export function getVariablesV2(contract: SessionContract, simnet: Simnet, verbos fakeId, fullSrc, { - clarityVersion: 2, + clarityVersion: 3, }, deployer );