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

Make the invoke_contract public in cis2client so that custom methods can be called from cis2 contract. #407

Open
dhruvja opened this issue Mar 3, 2024 · 3 comments

Comments

@dhruvja
Copy link

dhruvja commented Mar 3, 2024

Description
With cis2client, we can only call a handful of methods like transfer, balanceOf etc. But ideally we would wanna call burn, mint and many more. This would help users call any method from the token contract which implements cis2. Users can use the invoke_contract implemented by Host but the error handling is better in cis2client which is customized for it.

Solution
Make the invoke_contract found in cis2client as public.
Here:

fn invoke_contract<State, P: Serial, R: Deserial, E: Deserial>(

The similar can be done for invoke_contract_read_only method as well.

@dhruvja
Copy link
Author

dhruvja commented Mar 3, 2024

Well we can always implement the conversion by ourselves, but its a feature thats good to have.

@abizjak
Copy link
Contributor

abizjak commented Mar 4, 2024

I don't think it's right to make this public since invoking other methods does not have anything to do with cis2.

However if I read your feedback more broadly, it would make sense to add a method to HasHost that automatically parses the response into a type you provide instead of returning the raw return value.

This seems like it would accomplish what you want, right?

@dhruvja
Copy link
Author

dhruvja commented Mar 4, 2024

oh yes indeed. Yes thats what i would love to achieve. Looking at cis2 invoke contract, i was able to do the same. But having it done by invoke_contract would be ideal. Thanks

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

No branches or pull requests

2 participants