Call the contract with stacks.js using the same parameters according to the transaction of the wallet got an error
llwinner opened this issue · 7 comments
I delegate some STX with LoskStacks and I can see the transaction in Leather Wallet.
Now I want to call delegate function with stacks.js, so I use the same parameters, but one parameter: user-pox-addr {hashbytes: (buff 32), version: (buff 1)} I check the transaction about this parameter:
I use the same string:
When I run the code, I got an error:
Clarity function delegate-stx
expects argument 5 to be of type (tuple (hashbytes (buff 32)) (version (buff 1))), not (tuple (hashbytes (buff 42)) (version (buff 4)))
The length of hashbytes(0x....8b5) is 42.
Why I use the same parameter got an error?
What should I do?
Please help me, thanks!
bufferCVFromString
converts text into a buffer. You want to convert hex into a buffer. Better use bufferCV(hexToBytes(...))
. See https://stacks.js.org/functions/_stacks_common.hexToBytes
In general discord is better for these kind of questions. This is not a support forum.
@friedger Thanks for your reply! I will go to discord to ask this kind of question.
@friedger Excuse me I want to join the discord which in README, but it tells me: The invitation may have expired, or you may not have permission to join.
I can't join it.
Please help me, thanks!
Thanks for the comments 🙏🏻
We also have a new Cl
namespace that can be imported from @stacks/transactions which is great for discoverability of the different methods