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

Generate SDK contract wrappers #3740

Open
lock9 opened this issue Dec 9, 2024 · 4 comments
Open

Generate SDK contract wrappers #3740

lock9 opened this issue Dec 9, 2024 · 4 comments
Labels
feature Completely new functionality I3 Minimal impact neotest Neotest framework and coverage tool S3 Minimally significant U4 Nothing urgent

Comments

@lock9
Copy link

lock9 commented Dec 9, 2024

Is your feature request related to a problem? Please describe.

I'm using the neotest package to test my smart contract and noticed the need to manually configure the hash and method names. This process is error-prone and reduces development efficiency. Neo Go already generates contract bindings, but these cannot be used with neotest.

Please consider adding support to generate an 'offchain' SDK.

Describe the solution you'd like

Enhance the generate-wrapper command to create 'offchain' contract bindings.

Describe alternatives you've considered

This feature is implemented in my TS SDK but generates TypeScript, not Go code.

Additional context

Adding this feature would save significant development time, reduce errors, and minimize frustration. It will enable auto-complete, preventing common issues such as incorrect method names, parameter counts, orders, and types. Return type conversion is also important, but may be harder to implement.

Don't forget to add labels!

  • CLI
  • feature
@lock9 lock9 added feature Completely new functionality I2 Regular impact labels Dec 9, 2024
@lock9 lock9 changed the title Generate SDK contract warppers Generate SDK contract wrappers Dec 9, 2024
@roman-khimov
Copy link
Member

We provide contract bindings that work via RPC (generate-rpcwrapper). But neotest is not RPC-based, so they can't be easily reused. Also, there is a question of these bindings usability specifically for testing, sometimes you want to make abnormal calls in tests and they can not provide this.

@roman-khimov roman-khimov added neotest Neotest framework and coverage tool I3 Minimal impact U4 Nothing urgent S3 Minimally significant and removed I2 Regular impact labels Dec 9, 2024
@AnnaShaleva
Copy link
Member

But neotest is not RPC-based

BTW, we have #3245 for that. But in general I agree, neotest is a testing tool, so we need to keep these non-contract-specific APIs anyway.

@lock9
Copy link
Author

lock9 commented Dec 9, 2024

We provide contract bindings that work via RPC (generate-rpcwrapper). But neotest is not RPC-based, so they can't be easily reused. Also, there is a question of these bindings usability specifically for testing, sometimes you want to make abnormal calls in tests and they can not provide this.

It generated the file correctly, but I don't know how to use it. Is there any example that I can check? (using a generated rpc file)

@AnnaShaleva
Copy link
Member

Is there any example that I can check? (using a generated rpc file)

You can't use auto-generated RPC bindings with neotest because neotest doesn't work over RPC. But if you're looking for RPC bindings usage examples by their own, then it's a bit different story, the usage pattern is similar to Actor/Invoker pattern but with contract-specific methods:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Completely new functionality I3 Minimal impact neotest Neotest framework and coverage tool S3 Minimally significant U4 Nothing urgent
Projects
None yet
Development

No branches or pull requests

3 participants