clarinet icon indicating copy to clipboard operation
clarinet copied to clipboard

Change function argument types from string to ClarityValue in Tx.contractCall

Open friedger opened this issue 4 years ago • 3 comments

As an app developer using stacks.js, I use ClarityValues to provide function arguments. It would be nice if I could use the same arguments in clarinet tests.

E.g.

 tupleCV({
            version: bufferCV(Buffer.from('01000000', 'hex')),
            ins: listCV([uintCV(1)])})

vs.

types.tuple({
            version: "0x01000000",
            ins: types.list([types.uint(1)])})

friedger avatar May 21 '21 13:05 friedger

@friedger I believe right now @stacks/transactions is not fully compatible with Deno due to smart-buffer dependency, therefore we can't use it "just like that". We can either write custom implementation coupled with Clarinet or try make stacks.js compatible with Deno.

LNow avatar May 25 '21 10:05 LNow

We could also introduce a light compatibility layer in deno/index.ts that exposes the same API.

export const uintCV(uint: number) => types.uint(uint);

Thoughts?

MarvinJanssen avatar Jun 25 '21 19:06 MarvinJanssen

We could also introduce a light compatibility layer in deno/index.ts that exposes the same API.

Actually that could be a good first step in making unified API.

Another approach that I think we could look at is denoifying stacks.js

LNow avatar Jun 30 '21 19:06 LNow

In progress as part of #1065. Super happy to be able to revive old issue like this one 🙌 I'll close as duplicated since it's now part of a bigger initiative

hugoclrd avatar Jul 17 '23 11:07 hugoclrd