mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2026-03-01 04:28:51 +00:00
Generate SDK contract wrappers #1445
Labels
No labels
I1
I2
I3
I4
S1
S2
S3
S4
U0
U1
U2
U3
U3
U4
blocked
bug
bug
cli
compiler
config
config
consensus
dependencies
discussion
documentation
enhancement
epic
feature
go
good first issue
help wanted
neotest
network
oracle
performance
question
rpc
security
smartcontract
task
task
task
test
vm
wallet
windows
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neo-go#1445
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lock9 on GitHub (Dec 9, 2024).
Is your feature request related to a problem? Please describe.
I'm using the
neotestpackage 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-wrappercommand 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!
feature@roman-khimov commented on GitHub (Dec 9, 2024):
We provide contract bindings that work via RPC (
generate-rpcwrapper). Butneotestis 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.@AnnaShaleva commented on GitHub (Dec 9, 2024):
BTW, we have https://github.com/nspcc-dev/neo-go/issues/3245 for that. But in general I agree,
neotestis a testing tool, so we need to keep these non-contract-specific APIs anyway.@lock9 commented on GitHub (Dec 9, 2024):
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 commented on GitHub (Dec 10, 2024):
You can't use auto-generated RPC bindings with
neotestbecauseneotestdoesn'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 toActor/Invokerpattern but with contract-specific methods:nspcc-dev/neo-go-sc-wrkshp@c0d3328aa4/dApp/dApp.go (L495)contains a tiny piece of example on how to use this wrappernspcc-dev/neo-go-sc-wrkshp@c0d3328aa4/dApp/dApp.go (L266)contains examples of Actor/Invoker usages as far as native contract-specific bindings provided by NeoGo.