Open
Conversation
- 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.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
- 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}).
706c219 to
d39dab3
Compare
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.
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.
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
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
FilterPredicate,PagedEventsResponse) and refactored theeventsmethod inquery.tsto support advanced filtering and cursor-based pagination, aligning with the new RPC host. [1] [2]TrustMethods.getAggregatedTrustRelationsto use the new server-side aggregation RPC method for improved performance, replacing manual client-side aggregation. [1] [2]Documentation: Group and Membership Methods
findGroups,getGroupMemberships,getGroupMembers) to describe new pagination patterns and return types (PagedResponse), with revised examples and parameter descriptions. [1] [2] [3] [4] [5]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.