Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call the contract with stacks.js using the same parameters according to the transaction of the wallet got an error #1557

Closed
llwinner opened this issue Sep 28, 2023 · 7 comments

Comments

@llwinner
Copy link

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:
image
I use the same string:
image
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!

@friedger
Copy link
Collaborator

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

@friedger
Copy link
Collaborator

In general discord is better for these kind of questions. This is not a support forum.

@llwinner
Copy link
Author

@friedger Thanks for your reply! I will go to discord to ask this kind of question.

@llwinner
Copy link
Author

@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!

@friedger
Copy link
Collaborator

@llwinner
Copy link
Author

llwinner commented Oct 1, 2023

@friedger Thanks, I have joined the stacks discord by your link!

@janniks
Copy link
Collaborator

janniks commented Oct 1, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants