-
Notifications
You must be signed in to change notification settings - Fork 773
Simplify json-rpc client handling #4079
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes previous Client
interfaces in favor of concrete client structs, exposes the underlying Requester
for custom RPC implementations, and updates method signatures across various wallets and VM packages to use pointer receivers.
- Exposed
Requester
on client structs for custom RPC requesters - Converted many
Client
methods and constructors to pointer receivers - Removed redundant interface definitions and unified client code structure
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
wallet/subnet/primary/api.go | Switched UTXO client assignments and pointer types |
wallet/chain/* | Updated client parameters to pointer types |
vms/platformvm/client.go | Removed interface, added concrete Client with Requester |
vms/avm/*.go | Removed interfaces, switched to exported structs with Requester |
vms/example/xsvm/api/client.go | Switched to concrete Client struct and pointer receiver |
indexer/client.go | Removed interface, added concrete Client struct |
api/*/client.go | Removed interface, added concrete Client with Requester |
tests/* | Updated tests to use new pointer-based client types |
Comments suppressed due to low confidence (8)
vms/platformvm/client.go:32
- Add a doc comment for the exported NewClient function, e.g.,
// NewClient returns a new P-chain Client configured to the given endpoint URI.
func NewClient(uri string) *Client {
indexer/client.go:26
- Add a doc comment for the exported NewClient function, e.g.,
// NewClient creates an indexer client for the given endpoint URI.
func NewClient(uri string) *Client {
api/info/client.go:21
- Add a doc comment for the exported NewClient function, e.g.,
// NewClient returns an Info API client pointed at the given URI.
func NewClient(uri string) *Client {
api/health/client.go:17
- Add a doc comment for the exported NewClient function, e.g.,
// NewClient returns a Health API client configured to the given URI.
func NewClient(uri string) *Client {
api/admin/client.go:21
- Add a doc comment for the exported NewClient function, e.g.,
// NewClient returns an Admin API client for the given URI.
func NewClient(uri string) *Client {
vms/avm/client.go:28
- Add a doc comment for the exported NewClient function, e.g.,
// NewClient returns an X-Chain client for the specified URI and chain alias.
func NewClient(uri, chain string) *Client {
vms/example/xsvm/api/client.go:22
- Add a doc comment for the exported NewClient function, e.g.,
// NewClient returns an xsvm API client for the given URI and chain ID.
func NewClient(uri, chain string) *Client {
vms/avm/wallet_client.go:30
- Add a doc comment for the exported NewWalletClient function, e.g.,
// NewWalletClient returns a wallet client for the specified AVM chain.
func NewWalletClient(uri, chain string) *WalletClient {
Why this should be merged
Resolves #4056
How this works
This PR:
Client
interfaces, instead exposing the structs directly.Requester
is exported, soClient
s can be constructed with customRequester
s.How this was tested
CI
Need to be documented in RELEASES.md?
No.