Skip to content

Add JSON-RPC batch support for contract reads #88

Description

@Lakes41

Difficulty: Advanced

Type: Feature

Summary

Add support for batching compatible contract read calls into one JSON-RPC request. This helps integrations reduce RPC overhead when checking many wallets or guilds.

Current Behaviour

Each contract read sends a separate eth_call request. Applications that need multiple balances or owner lookups must manage batching themselves.

Expected Behaviour

The SDK should expose batch helpers for safe read-only contract calls and return ordered per-item results.

Suggested Implementation

Add methods such as getMembershipTokenBalancesBatch or a lower-level batchEthCall helper. Preserve input order, support partial failures, and avoid batching unsupported mutating operations.

Files or Areas Likely Affected

  • src/contracts/contractClient.ts
  • src/contracts/contract.types.ts
  • tests/contracts.test.ts
  • docs/api-reference.md
  • docs/integration-guide.md

Acceptance Criteria

  • Batch token balance reads preserve input order
  • Batch guild owner reads preserve input order where applicable
  • Partial RPC failures are reported per item
  • Invalid inputs are rejected before the RPC request is built
  • Tests cover success, partial failure, malformed RPC response, and ordering
  • Documentation explains provider compatibility assumptions

Additional Notes

Assumption: this should use JSON-RPC batch requests only for read-only methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions