rpcserver: Refactor.#3503
Merged
JoeGruffins merged 5 commits intodecred:masterfrom Feb 11, 2026
Merged
Conversation
ae63ea4 to
e05ce09
Compare
Replace the CLI-style RawParams{PWArgs, Args} wire format with per-route
typed JSON parameter structs. This is a breaking wire format change from
positional string arrays to typed objects (e.g. {"appPass":"...","host":"...",
"isLimit":true,...}).
- Delete RawParams, errArgs, all 46 parseXxxArgs functions and helpers
- Add ~35 exported typed param structs with JSON tags in types.go
- Change handler signatures from func(s, *RawParams) to func(s, *msgjson.Message)
- Each handler unmarshals its own typed params from the message payload
- Simplify handleRequest to pass raw message directly to handlers
- Fix 4 inconsistent error constructors to use msgjson.NewError()
- Bump rpcSemverMajor from 0 to 1 (breaking change)
- Add bwctl/payload.go with buildPayload builders for CLI arg conversion
- Update bwctl/main.go to use buildPayload, bump requiredRPCServerVersion
- Rewrite handlers_test.go with typed params and makeMsg/makeBadMsg helpers
- Delete types_test.go (all tests referenced removed parse functions)
- Update rpcclient example to use HelpParams
- Add OpenAPI spec, Swagger UI endpoint, and README.md
Replace the hand-maintained helpMsg/helpMsgs system with a reflection-based routeInfo/routeInfos system that auto-generates parameter documentation from actual struct definitions. This makes it structurally impossible for help text to drift from param types. New reflection helpers (reflectFields, goTypeToHelpType, parseJSONTag) walk param structs in declaration order, flatten embedded structs, detect password fields (encode.PassBytes), and identify optional fields (pointer/omitempty). Bug fixes now automatic via correct param types: - cancelRoute: no longer falsely claims appPass is required - toggleWalletStatusRoute: no longer falsely claims appPass is required - discoverAcctRoute: removed stale "register" reference, fixed typo - setVotingPreferencesRoute: fixed incorrect summary
523e937 to
d441bbe
Compare
Add two new RPC endpoints that expose existing core methods: - walletbalance: returns the balance for a single wallet by asset ID, calling core.AssetBalance. Avoids fetching all wallets when only one balance is needed. - walletstate: returns the full state for a single wallet by asset ID, calling core.WalletState. Returns wallet open/running/disabled status, balance, address, and other details without pulling all wallets.
d441bbe to
d6e9efc
Compare
Replace ~50 individual buildXxx functions in payload.go with a single generic buildFromStruct that uses reflection to walk param struct fields in declaration order — the same order used by the help system. This eliminates ordering mismatches between help output and CLI arg parsing. Export FieldInfo, ReflectFields, ParamType, and RouteExists from rpcserver so bwctl can derive field metadata at runtime. Auto-derive password prompts and cert file arg indices from struct tags instead of hardcoded maps. Complex routes register per-field custom parsers via routeOverrides.
d6e9efc to
75e5444
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switch from position based to key:value and update some other things. Make easily usable by ai by adding a swagger file.