Skip to content

Commit

Permalink
fix: generating variables for Clarity v3 contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
hstove committed Sep 4, 2024
1 parent 2d08e47 commit 5b4c023
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .changeset/large-clouds-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'demo-project': patch
'@clarigen/cli': patch
---

Fixes an issue with generating variables for Clarity version 3 contracts
4 changes: 4 additions & 0 deletions demo-project/contracts/tester.clar
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@
(print u100)
(err u210)
)
)

(define-read-only (get-tenure-info-test)
(get-tenure-info? burnchain-header-hash u1)
)
22 changes: 7 additions & 15 deletions demo-project/esm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, 'val'>], 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',
Expand Down Expand Up @@ -575,21 +581,7 @@ export const contracts = {
access: 'variable',
} as TypedAbiVariable<bigint>,
},
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' },
{
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/files/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function getVariablesV2(contract: SessionContract, simnet: Simnet, verbos
fakeId,
fullSrc,
{
clarityVersion: 2,
clarityVersion: 3,
},
deployer
);
Expand Down

0 comments on commit 5b4c023

Please sign in to comment.