Skip to content

Feature/new rpc methods#2

Open
leinss wants to merge 18 commits intomainfrom
feature/new_rpc_methods
Open

Feature/new rpc methods#2
leinss wants to merge 18 commits intomainfrom
feature/new_rpc_methods

Conversation

@leinss
Copy link

@leinss leinss commented Dec 15, 2025

This pull request updates the Circles SDK documentation and TypeScript client to reflect major improvements in the new RPC host and its methods. The changes focus on simplifying SDK integrations, introducing cursor-based pagination, and improving performance and ergonomics for developers. The most important updates are grouped below:

Documentation: Migration Guide and Usage Patterns

  • Added a comprehensive migration guide (NEW_RPC_METHODS.md) detailing how to transition from legacy multi-call flows to new aggregated, paginated RPC endpoints, with before/after code samples, endpoint mappings, and a migration checklist.

TypeScript SDK: Pagination and API Improvements

  • Introduced new types (FilterPredicate, PagedEventsResponse) and refactored the events method in query.ts to support advanced filtering and cursor-based pagination, aligning with the new RPC host. [1] [2]
  • Updated TrustMethods.getAggregatedTrustRelations to use the new server-side aggregation RPC method for improved performance, replacing manual client-side aggregation. [1] [2]

Documentation: Group and Membership Methods

  • Updated documentation for group-related methods (findGroups, getGroupMemberships, getGroupMembers) to describe new pagination patterns and return types (PagedResponse), with revised examples and parameter descriptions. [1] [2] [3] [4] [5]
  • Clarified the usage and return values for getGroupHolders, emphasizing ordering and pagination details.

These changes ensure SDK consumers can efficiently migrate to and take advantage of the new, more ergonomic and performant RPC methods.

- Refactor profile methods to return consolidated profile views and search results.
- Introduce SdkMethods class for efficient multi-call patterns, including profile view and trust network summary.
- Update token methods to streamline token holder retrieval with pagination.
- Revamp transaction methods to support enriched transaction history with participant profiles.
- Add integration tests for new SDK functionalities, ensuring pagination and search accuracy.
- Introduce new types for enriched responses and token holder rows in SDK types.
- Update dependencies in utils package for improved functionality.
@socket-security
Copy link

socket-security bot commented Dec 15, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​noble/​hashes@​2.0.110010010085100

View full report

@leinss leinss requested a review from web3skeptic December 15, 2025 06:38
web3skeptic and others added 5 commits December 22, 2025 17:27
- Change WebSocket path from /ws to /ws/subscribe
- Use circles_subscribe method instead of eth_subscribe
- Send params as object { address } instead of array ["circles", json]
- Handle circles_subscription events instead of eth_subscription
Staging RPC doesn't support eth_call directly - it's at /chain-rpc.
- Add chainRpcUrl to CirclesConfig interface
- Core class uses chainRpcUrl for contract reads, falls back to circlesRpcUrl
Replace client-side cursor logic with server's circles_paginated_query.
The server returns an opaque nextCursor string — removes ~130 lines of
fragile cursor filter construction (buildCursorFilter, combineFilters,
createComparisonPredicate, etc.).

Public API unchanged: queryNextPage(), currentPage.results, currentPage.hasMore

- pagedQuery.ts: call circles_paginated_query with [params, nextCursor]
- types.ts: FlexiblePagedResult uses string nextCursor (was Record cursors)
- rpc.ts: add PaginatedQueryResponse type
52 integration tests covering all 11 SDK method classes against staging.

Fixes 10 type mismatches discovered during testing:
- NetworkSnapshot: {BlockNumber, Addresses} (PascalCase)
- ValidInvitersResponse: validInviters → results
- AggregatedTrustRelationsResponse: {mutual,trusts,trustedBy} → {results}
- TokenInfo: token → tokenAddress, remove absent event fields
- EnrichedTransaction: flat → nested {event, participants}
- TableInfo: PascalCase flat → lowercase nested
- QueryMethods.query(): add column-to-object transformation
- AllInvitationsResponse: remove absent 'all' field
- SdkMethods.getAggregatedTrustRelations: return AggregatedTrustRelation[]
- ProfileSearchResponse: remove absent totalCount

Also fixes InvitationMethods.getInvitedBy() which was silently broken
(typed circles_query response as array instead of {columns, rows}).
@leinss leinss force-pushed the feature/new_rpc_methods branch from 706c219 to d39dab3 Compare February 17, 2026 05:18
The RPC host uses cursor-based pagination (string cursor), not offset-based.
Fixes what appeared to be an RPC bug — offset was actually the wrong param type.
Adds hasMore/nextCursor to ProfileSearchResponse, adds disjointness test.
Replace multi-query client-side logic with single RPC calls:
- getEscrowInvitations: 5 round-trips → 1 (circles_getEscrowInvitations)
- getAtScaleInvitations: 2 round-trips → 1 (circles_getAtScaleInvitations)
- getInvitedBy: raw circles_query → circles_getInvitationOrigin
- Add getTrustInvitations, getInvitationOrigin methods
- Add InvitationOriginResponse type
- Net -121 lines of client-side query/filter logic
Replace multi-query circles_query approach with single RPC call.
Remove transformQueryResponse helper (no longer needed).
Return type changed from Address[] to InvitationsFromResponse.
…improvements

- CommonAvatar: add getInvitationsFrom, getAllInvitations, getInvitationOrigin
- Sdk: expose invitation namespace
- Runner: improve safe-runner chain type handling
- Types: extend AvatarRow, add CirclesQuery type
Reflects new invitation endpoints, cursor pagination, SDK methods,
runner chain-types, and type additions.
- backward-compat.test.ts: validates new RPC endpoints vs old circles_query
  (8/10 pass; 2 expected diffs due to server-side LIMIT 200 vs unlimited)
- SDK_RPC_MISMATCHES.md: track resolved type/response mismatches
- BREAKING_CHANGES.md: document getInvitationsFrom return type change
- NEW_RPC_METHODS.md: full migration guide with all new endpoints
…tics

- Accepted: new endpoint (LIMIT 200) is superset of circles_query (LIMIT 100)
- Pending: different source tables (CrcV2_Trust vs V_Crc.TrustRelations view)
  with different deduplication; validate shape instead of exact set equality
Document /ws/subscribe (circles_subscribe) and /ws/chain (eth_subscribe).
Includes new invitation types, WebSocket endpoints, cursor pagination,
SdkMethods class, runner chain-types, and InvitationFarm/ReferralsModule ABIs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments