Skip to content

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

Merged
merged 8 commits into from
Jul 11, 2025
Merged

Simplify json-rpc client handling #4079

merged 8 commits into from
Jul 11, 2025

Conversation

StephenButtolph
Copy link
Contributor

Why this should be merged

Resolves #4056

How this works

This PR:

  1. Removes the various Client interfaces, instead exposing the structs directly.
  2. Additionally, the Requester is exported, so Clients can be constructed with custom Requesters.

How this was tested

CI

Need to be documented in RELEASES.md?

No.

@Copilot Copilot AI review requested due to automatic review settings July 11, 2025 16:55
Copy link
Contributor

@Copilot Copilot AI left a 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 {

@StephenButtolph StephenButtolph disabled auto-merge July 11, 2025 17:21
@StephenButtolph StephenButtolph merged commit 2ddfa05 into master Jul 11, 2025
29 checks passed
@StephenButtolph StephenButtolph deleted the simplify-clients branch July 11, 2025 17:21
@github-project-automation github-project-automation bot moved this to Done 🎉 in avalanchego Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Allow creating platformvm.Client with custom EndpointRequester
2 participants