-
Notifications
You must be signed in to change notification settings - Fork 1
feat: eas-sdk portal implementation #1058
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
Reviewer's GuideThis PR refactors the EAS SDK to use SettleMint’s Portal infrastructure as its core transport layer, replacing the viem/ethers adapter with a dedicated EASPortalClient abstraction and comprehensive GraphQL-driven interactions, while reorganizing validation utilities, exporting new Portal-specific types and error handling, updating docs, tests, and build configs accordingly. Sequence Diagram for Schema Registration via EASPortalClientsequenceDiagram
actor Developer
participant EASSDK as @settlemint/sdk-eas
participant EASPortalClient
participant ValidationUtils as SDK Validation Utilities
participant PortalAPI as SettleMint Portal (GraphQL API)
Developer->>EASSDK: createEASClient(options)
activate EASSDK
EASSDK->>EASPortalClient: new EASPortalClient(options)
activate EASPortalClient
EASPortalClient->>EASPortalClient: setAbis() (based on options.abiSource)
EASPortalClient-->>EASSDK: clientInstance
deactivate EASPortalClient
EASSDK-->>Developer: easClient
deactivate EASSDK
Developer->>EASPortalClient: registerSchema({ fields: [...], resolver, revocable })
activate EASPortalClient
EASPortalClient->>ValidationUtils: validateSchemaFields(fields)
activate ValidationUtils
ValidationUtils-->>EASPortalClient: (validation success/failure)
deactivate ValidationUtils
alt Validation Succeeded
EASPortalClient->>ValidationUtils: buildSchemaString(fields)
activate ValidationUtils
ValidationUtils-->>EASPortalClient: schemaString
deactivate ValidationUtils
EASPortalClient->>EASPortalClient: executeSchemaRegistryWrite("register", [schemaString, resolver, revocable])
activate EASPortalClient
EASPortalClient->>PortalAPI: GraphQL Mutation (callContract - register)
activate PortalAPI
PortalAPI-->>EASPortalClient: { hash: "0x..." }
deactivate PortalAPI
EASPortalClient-->>EASPortalClient: TransactionResult
deactivate EASPortalClient
EASPortalClient-->>Developer: Promise~TransactionResult~
else Validation Failed
EASPortalClient->>EASPortalClient: createError(EASErrorCode.INVALID_SCHEMA, msg)
EASPortalClient-->>Developer: throws EASPortalError
end
deactivate EASPortalClient
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
📝 WalkthroughWalkthroughThis update refactors the EAS SDK to use a Portal GraphQL API for all contract interactions, replacing direct blockchain SDK calls. The codebase introduces new types, a class-based client, expanded documentation, GraphQL operation files, and an example workflow. Legacy adapter files and schemas are removed, and configuration files are updated for the new architecture. Changes
Sequence Diagram(s)sequenceDiagram
participant UserApp
participant EASClient
participant PortalClient
participant PortalGraphQL
UserApp->>EASClient: new EASClient(options)
UserApp->>EASClient: deploy(deployerAddress, forwarderAddress)
EASClient->>PortalClient: deploySchemaRegistryMutation
PortalClient->>PortalGraphQL: GraphQL mutation (deploy schema registry)
PortalGraphQL-->>PortalClient: deployment result
PortalClient-->>EASClient: contract addresses
UserApp->>EASClient: registerSchema(request, fromAddress)
EASClient->>PortalClient: registerSchemaMutation
PortalClient->>PortalGraphQL: GraphQL mutation (register schema)
PortalGraphQL-->>PortalClient: transaction hash
PortalClient-->>EASClient: transaction result
UserApp->>EASClient: attest(request, fromAddress)
EASClient->>PortalClient: attestMutation
PortalClient->>PortalGraphQL: GraphQL mutation (attest)
PortalGraphQL-->>PortalClient: transaction hash
PortalClient-->>EASClient: transaction result
UserApp->>EASClient: multiAttest(requests, fromAddress)
EASClient->>PortalClient: multiAttestMutation
PortalClient->>PortalGraphQL: GraphQL mutation (multi-attest)
PortalGraphQL-->>PortalClient: transaction hash
PortalClient-->>EASClient: transaction result
UserApp->>EASClient: revoke(schemaUID, attestationUID, fromAddress)
EASClient->>PortalClient: revokeMutation
PortalClient->>PortalGraphQL: GraphQL mutation (revoke)
PortalGraphQL-->>PortalClient: transaction hash
PortalClient-->>EASClient: transaction result
sequenceDiagram
participant UserApp
participant EASClient
participant PortalClient
participant PortalGraphQL
UserApp->>EASClient: getSchema(uid)
EASClient-->>UserApp: Not implemented (throws error)
UserApp->>EASClient: getAttestation(uid)
EASClient-->>UserApp: Not implemented (throws error)
These diagrams illustrate the new control flow for contract deployment, schema registration, attestation, and revocation via the Portal GraphQL API, and show that certain query methods are now stubbed and recommend using The Graph subgraph. ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
📦 Packages
|
79dea65
to
2f6eb59
Compare
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.
Actionable comments posted: 15
🔭 Outside diff range comments (1)
sdk/eas/README.md (1)
162-390
: 🛠️ Refactor suggestionConsolidate duplicated documentation sections.
The README contains substantial duplication with two separate "Quick Start" sections, repeated installation instructions, and overlapping feature descriptions. This creates confusion and maintenance overhead.
Consider consolidating the content into a single, comprehensive structure:
- Keep the initial comprehensive section (lines 1-161)
- Remove or merge the duplicated content (lines 162-390)
- Ensure all unique information from the second section is preserved in the first
This will provide a cleaner, more maintainable documentation experience.
🧹 Nitpick comments (15)
sdk/eas/src/README.md (1)
7-19
: Add language specifier to the fenced code block.The fenced code block should specify a language for proper syntax highlighting.
Apply this diff to specify the language:
-``` +```plaintext src/🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
7-7: Fenced code blocks should have a language specified
null(MD040, fenced-code-language)
sdk/eas/src/graphql/mutations/deploy-contracts.graphql (1)
16-16
: Remove trailing space.There's a trailing space at the end of this line.
sdk/eas/examples/simple-eas-workflow.ts (1)
103-103
: Make fallback schema UID configurable or document as placeholder.The hardcoded fallback schema UID may not exist in all Portal environments, potentially causing downstream failures.
Consider making this configurable:
- schemaUID = "0x1234567890123456789012345678901234567890123456789012345678901234" as Hex; + // Note: Using placeholder schema UID - replace with actual schema for production use + schemaUID = (process.env.FALLBACK_SCHEMA_UID || "0x1234567890123456789012345678901234567890123456789012345678901234") as Hex;sdk/eas/README.md (1)
84-84
: Fix grammatical issue with "multiple" usage.The static analysis correctly identified a grammatical issue. The phrase should use "multiple" as an adjective rather than suggesting the verb "multiply".
The current phrasing is correct - "Revoke multiple by delegation" uses "multiple" appropriately as an adjective. The static analysis tool appears to be a false positive in this context.
🧰 Tools
🪛 LanguageTool
[misspelling] ~84-~84: Did you mean the verb “multiply”?
Context: ...oymentMultiRevokeByDelegation- Revoke multiple by delegation -
EasDeploymentRevokeOff...(MULTIPLE_MULTIPLY)
sdk/eas/src/eas.ts (2)
68-69
: Make polling configuration adjustableThe polling mechanism uses hardcoded values for delay (1 second) and max attempts (30). These should be configurable to handle different network conditions.
Add polling configuration to
EASClientOptions
:export interface EASClientOptions { // ... existing options ... /** Polling configuration for deployment */ polling?: { /** Delay between polling attempts in milliseconds (default: 1000) */ delayMs?: number; /** Maximum number of polling attempts (default: 30) */ maxAttempts?: number; }; }Then use the configuration:
-const maxAttempts = 30; +const maxAttempts = this.options.polling?.maxAttempts ?? 30; +const delayMs = this.options.polling?.delayMs ?? 1000; while (!schemaRegistryAddress && attempts < maxAttempts) { - await new Promise((resolve) => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, delayMs));Also applies to: 119-120
43-43
: Extract hardcoded gas limits as constantsGas limits are hardcoded throughout the code. These should be extracted as named constants for better maintainability.
Define constants at the top of the file:
+// Default gas limits for different operations +const GAS_LIMITS = { + DEPLOY: "0x7a1200", + REGISTER_SCHEMA: "0x3d0900", + ATTEST: "0x3d0900", + MULTI_ATTEST: "0x3d0900", + REVOKE: "0x3d0900", +} as const; // In deploy method: -const defaultGasLimit = gasLimit || "0x7a1200"; +const defaultGasLimit = gasLimit || GAS_LIMITS.DEPLOY; // In registerSchema method: -gasLimit: gasLimit || "0x3d0900", +gasLimit: gasLimit || GAS_LIMITS.REGISTER_SCHEMA,Also applies to: 52-52, 104-104, 185-185, 227-227, 279-279, 317-317
sdk/eas/src/portal/portal-schema.graphql (5)
6-16
: Make required fields non-nullable forContract
Fields such asabiName
,address
,createdAt
,transaction
, andtransactionHash
are likely always returned by the API. Mark them with!
(e.g.String!
) to enforce their presence at compile time and improve client safety.
18-38
: Make required fields non-nullable forContractDeployStatus
Similarly, key properties likeabiName
,address
,transactionHash
, and the timestamp fields should be non-nullable if the backend guarantees them.
69-75
: Audit nullability on wallet types
InCreateWalletInfoInput
andCreateWalletOutput
, onlyname
is marked non-nullable. Core output fields such asaddress
,id
, andname
inCreateWalletOutput
are always returned and could beString!
.Also applies to: 79-99
759-763
: Duplicate JSON scalar docstring
The JSON scalar description appears twice (lines 1–3 and 759–761). Consolidate the documentation into one definition to avoid drift during updates.
262-380
: Cleanup nested input type naming
Generated input types likeEASEASAttestByDelegationDelegatedRequestInput
duplicate theEAS
prefix. For readability, drop the redundant prefix so it readsEASAttestByDelegationDelegatedRequestInput
.sdk/eas/src/graphql/queries/schema-queries.graphql (4)
1-2
: Suggest renaming operation for consistency
The first query’s operation name duplicates the field name and doesn’t follow the “Get…” convention used elsewhere. Renaming it toGetEasSchemaRegistry
improves clarity in codegen and client calls.Apply this diff:
-query EASSchemaRegistry($address: String!, $uid: String!) { +query GetEasSchemaRegistry($address: String!, $uid: String!) {
3-8
: Use a reusable fragment for schema fields
Extract theuid
,resolver
,revocable
, andschema
selection into a GraphQL fragment. This DRYs up the query and makes it easy to reuse these fields in other operations.Example:
fragment EasSchemaDetails on EASSchema { uid resolver revocable schema } query GetEasSchemaRegistry($address: String!, $uid: String!) { EASSchemaRegistry(address: $address) { getSchema(uid: $uid) { ...EasSchemaDetails } } }
12-13
: Unify acronym casing in operation name
The operation nameGetContractsEASSchemaRegistry
capitalizes “EAS” differently than the fieldgetContractsEasSchemaRegistry
. Align the casing to prevent confusion in generated types.Apply this diff:
-query GetContractsEASSchemaRegistry($page: Int, $pageSize: Int) { +query GetContractsEasSchemaRegistry($page: Int, $pageSize: Int) {
14-20
: Consider adding pagination metadata
Currently onlycount
andrecords
are returned. If the client needs to support cursor-based navigation or display total pages, consider extending the response withtotalPages
or apageInfo
object.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockb
is excluded by!**/bun.lockb
📒 Files selected for processing (19)
sdk/eas/README.md
(1 hunks)sdk/eas/examples/simple-eas-workflow.ts
(1 hunks)sdk/eas/knip.json
(1 hunks)sdk/eas/package.json
(1 hunks)sdk/eas/src/README.md
(1 hunks)sdk/eas/src/client-options.schema.ts
(0 hunks)sdk/eas/src/eas.test.ts
(2 hunks)sdk/eas/src/eas.ts
(1 hunks)sdk/eas/src/ethers-adapter.ts
(0 hunks)sdk/eas/src/graphql/mutations/attestation-operations.graphql
(1 hunks)sdk/eas/src/graphql/mutations/deploy-contracts.graphql
(1 hunks)sdk/eas/src/graphql/mutations/schema-operations.graphql
(1 hunks)sdk/eas/src/graphql/operations.ts
(1 hunks)sdk/eas/src/graphql/queries/attestation-queries.graphql
(1 hunks)sdk/eas/src/graphql/queries/schema-queries.graphql
(1 hunks)sdk/eas/src/portal/portal-schema.graphql
(1 hunks)sdk/eas/src/types.ts
(2 hunks)sdk/eas/src/utils/validation.ts
(1 hunks)sdk/eas/tsdown.config.ts
(1 hunks)
💤 Files with no reviewable changes (2)
- sdk/eas/src/client-options.schema.ts
- sdk/eas/src/ethers-adapter.ts
🧰 Additional context used
🧬 Code Graph Analysis (4)
sdk/eas/src/eas.test.ts (3)
sdk/cli/src/utils/test/module-mocker.ts (1)
ModuleMocker
(28-63)sdk/eas/src/eas.ts (3)
createEASClient
(449-451)ZERO_ADDRESS
(470-470)ZERO_BYTES32
(470-470)sdk/eas/src/types.ts (2)
ZERO_ADDRESS
(6-6)ZERO_BYTES32
(7-7)
sdk/eas/examples/simple-eas-workflow.ts (2)
sdk/eas/src/types.ts (2)
ZERO_ADDRESS
(6-6)ZERO_BYTES32
(7-7)sdk/eas/src/eas.ts (3)
ZERO_ADDRESS
(470-470)ZERO_BYTES32
(470-470)createEASClient
(449-451)
sdk/eas/src/eas.ts (3)
sdk/eas/src/types.ts (12)
EASClientOptions
(42-53)DeploymentResult
(176-185)ZERO_ADDRESS
(6-6)SchemaRequest
(58-67)TransactionResult
(100-105)PortalTransactionResponse
(198-201)AttestationRequest
(90-95)SchemaData
(110-119)GetSchemasOptions
(150-155)AttestationInfo
(124-145)GetAttestationsOptions
(160-171)SchemaField
(30-37)sdk/portal/src/portal.ts (1)
createPortalClient
(72-91)sdk/eas/src/graphql/operations.ts (1)
GraphQLOperations
(66-83)
sdk/eas/src/types.ts (1)
sdk/eas/src/eas.ts (14)
ZERO_ADDRESS
(470-470)ZERO_BYTES32
(470-470)EASClientOptions
(457-457)SchemaRequest
(458-458)SchemaField
(455-455)AttestationData
(459-459)AttestationRequest
(460-460)TransactionResult
(461-461)SchemaData
(462-462)AttestationInfo
(463-463)GetSchemasOptions
(464-464)GetAttestationsOptions
(465-465)DeploymentResult
(466-466)RegisterSchemaOptions
(467-467)
🪛 markdownlint-cli2 (0.17.2)
sdk/eas/src/README.md
7-7: Fenced code blocks should have a language specified
null
(MD040, fenced-code-language)
🪛 LanguageTool
sdk/eas/README.md
[misspelling] ~84-~84: Did you mean the verb “multiply”?
Context: ...oymentMultiRevokeByDelegation- Revoke multiple by delegation -
EasDeploymentRevokeOff...
(MULTIPLE_MULTIPLY)
🔇 Additional comments (11)
sdk/eas/knip.json (1)
2-2
: Entry point updated to new client implementation
Theentry
path now correctly points tosrc/eas.ts
, aligning the build configuration with the updated main client file.sdk/eas/src/utils/validation.ts (1)
1-1
: Aligned import paths after types reorganization
The import path forEASFieldType
,EAS_FIELD_TYPES
, andSchemaField
has been adjusted to../types.js
, matching the new directory layout.sdk/eas/package.json (1)
54-58
: Updated dependencies to portal-based architecture
Direct blockchain SDK dependencies have been replaced with@settlemint/sdk-portal
andgql.tada
to support the Portal GraphQL API model.sdk/eas/tsdown.config.ts (1)
5-11
: tsdown config adjusted for Portal optimization
External dependencies, banner text, and the__EAS_PORTAL_PACKAGE__
flag have been updated to reflect the new Portal-optimized package structure.sdk/eas/src/graphql/mutations/schema-operations.graphql (1)
1-10
: Added GraphQL mutation for schema registration
TheEASSchemaRegistryRegister
mutation with required parameters and return fields accurately supports schema registration workflows via the Portal API.sdk/eas/src/graphql/queries/schema-queries.graphql (1)
1-21
: Well-structured GraphQL queries.The schema queries are properly formatted and include all necessary fields for both individual schema retrieval and paginated schema registry listing.
sdk/eas/src/eas.test.ts (1)
32-433
: Comprehensive test coverage for the EAS Portal Client.The test suite provides excellent coverage of all major functionalities including:
- Client creation with various configurations
- Contract deployment and address management
- Schema registration with different input formats
- Single and multi-attestation operations
- Revocation functionality
- Query operations for schemas and attestations
- Proper error handling for missing contract addresses
The tests appropriately handle expected Portal access failures and verify both success and error scenarios.
sdk/eas/src/graphql/mutations/attestation-operations.graphql (1)
1-17
: Well-structured GraphQL mutations with consistent interface.The mutations follow a clean, consistent pattern with appropriate parameter types and uniform return structure. The naming convention is clear and the interface design supports the Portal GraphQL integration effectively.
sdk/eas/examples/simple-eas-workflow.ts (1)
1-34
: Well-structured example with clear workflow demonstration.The file provides an excellent demonstration of the EAS SDK workflow with proper TypeScript types, clear configuration, and comprehensive error handling patterns. The executable format and detailed logging make it very user-friendly.
Also applies to: 195-199
sdk/eas/src/graphql/queries/attestation-queries.graphql (1)
1-38
: Comprehensive and well-designed GraphQL queries.The queries provide complete coverage of attestation data retrieval needs with consistent parameter naming, appropriate field selections, and proper pagination support. The structure aligns well with the Portal GraphQL API integration.
sdk/eas/README.md (1)
1-161
: Excellent comprehensive documentation with accurate examples.The documentation provides thorough coverage of the EAS SDK features with clear examples that accurately reflect the implementation. The API reference is well-structured and the code examples align perfectly with the actual SDK usage patterns demonstrated in the workflow examples.
🧰 Tools
🪛 LanguageTool
[misspelling] ~84-~84: Did you mean the verb “multiply”?
Context: ...oymentMultiRevokeByDelegation- Revoke multiple by delegation -
EasDeploymentRevokeOff...(MULTIPLE_MULTIPLY)
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.
Actionable comments posted: 1
♻️ Duplicate comments (4)
sdk/eas/src/eas.test.ts (1)
28-28
:⚠️ Potential issueFix invalid Ethereum address format.
The address contains "Hac" which is not valid hexadecimal. Ethereum addresses must only contain characters 0-9 and a-f/A-F.
Apply this diff to fix the address:
-const TEST_FROM_ADDRESS = "0x8ba1f109551bD432803012645Hac136c22C177ec" as Address; +const TEST_FROM_ADDRESS = "0x8ba1f109551bD432803012645Ac136c22C177ec" as Address;sdk/eas/src/eas.ts (3)
88-90
: 🛠️ Refactor suggestionAdd error logging in polling catch blocks.
Empty catch blocks hide errors and make debugging difficult. At minimum, errors should be logged when debug mode is enabled.
Apply this diff to both catch blocks:
} catch (error) { - // Continue waiting + if (this.options.debug) { + console.warn(`Error while polling for contract deployment: ${error}`); + } + // Continue waiting }Also applies to: 139-141
75-77
: 🛠️ Refactor suggestionUse loaded GraphQL operations instead of inline queries.
The code uses inline GraphQL query strings instead of the operations loaded in
graphql/operations.ts
. This creates duplication and maintenance issues.Import and use the appropriate queries from GraphQL operations. You'll need to add these queries to your GraphQL operations loader if they don't exist:
try { const contractsResult = await this.portalClient.request( - "query GetSchemaRegistryContracts { getContractsEasSchemaRegistry { records { address } } }", + GraphQLOperations.queries.getSchemaRegistryContracts, );Also applies to: 126-128
387-389
:⚠️ Potential issueRemove misleading isValidAttestation implementation.
The method always returns
false
regardless of the attestation's actual validity, which is misleading and could cause bugs.Either implement the method properly or throw an error like the other unimplemented methods:
async isValidAttestation(uid: Hex): Promise<boolean> { - return false; + throw new Error( + `Attestation validity check not implemented yet. Use The Graph subgraph for checking attestation validity. Attestation UID: ${uid}`, + ); }
🧹 Nitpick comments (1)
sdk/eas/src/eas.ts (1)
41-159
: Consider extracting polling logic into a reusable utility.The deployment method contains complex polling logic that's duplicated between Schema Registry and EAS contract deployment. This could be extracted into a reusable utility method.
Consider creating a private method like:
private async pollForContractAddress( queryString: string, maxAttempts: number = 30, intervalMs: number = 1000 ): Promise<Address> { let attempts = 0; while (attempts < maxAttempts) { await new Promise((resolve) => setTimeout(resolve, intervalMs)); attempts++; try { const result = await this.portalClient.request(queryString); // Extract address logic here if (address) return address; } catch (error) { if (this.options.debug) { console.warn(`Error while polling (attempt ${attempts}): ${error}`); } } } throw new Error("Contract deployment timed out"); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
sdk/eas/examples/simple-eas-workflow.ts
(1 hunks)sdk/eas/src/eas.test.ts
(2 hunks)sdk/eas/src/eas.ts
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- sdk/eas/examples/simple-eas-workflow.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
sdk/eas/src/eas.ts (3)
sdk/eas/src/types.ts (12)
EASClientOptions
(42-53)DeploymentResult
(176-185)ZERO_ADDRESS
(6-6)SchemaRequest
(58-67)TransactionResult
(100-105)PortalTransactionResponse
(198-201)AttestationRequest
(90-95)SchemaData
(110-119)GetSchemasOptions
(150-155)AttestationInfo
(124-145)GetAttestationsOptions
(160-171)SchemaField
(30-37)sdk/portal/src/portal.ts (1)
createPortalClient
(72-91)sdk/eas/src/graphql/operations.ts (1)
GraphQLOperations
(66-83)
🪛 Gitleaks (8.26.0)
sdk/eas/src/eas.test.ts
50-50: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
67-67: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
80-80: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
91-91: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
108-108: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
121-121: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
132-132: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
155-155: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
185-185: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
212-212: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
230-230: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
263-263: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
287-287: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
320-320: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
343-343: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
366-366: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
381-381: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
406-406: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
420-420: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
🔇 Additional comments (1)
sdk/eas/src/eas.test.ts (1)
32-434
: Excellent test coverage for the Portal-based EAS client.The test suite comprehensively covers all client methods including deployment, schema registration, attestations, revocations, and error handling scenarios. The mocking strategy for the Portal client is well-implemented and the tests validate both success and error cases appropriately.
🧰 Tools
🪛 Gitleaks (8.26.0)
50-50: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
67-67: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
80-80: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
91-91: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
108-108: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
121-121: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
132-132: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
155-155: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
185-185: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
212-212: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
230-230: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
263-263: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
287-287: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
320-320: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
343-343: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
366-366: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
381-381: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
406-406: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
420-420: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
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.
See comments
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.
Actionable comments posted: 2
♻️ Duplicate comments (9)
sdk/eas/src/eas.test.ts (1)
34-55
:⚠️ Potential issueHard-coded SettleMint access tokens committed – credentials leak
Strings that match the production
sm_aat_*
token format are embedded directly in the test code (lines 35-55 and many other places).
Even if they are “test” tokens, they are now part of git history and trigger Gitleaks. Remove them or load them from the environment before this lands on a public branch.- accessToken: "sm_aat_5ce243f91f231128", + accessToken: process.env.SETTLEMINT_AAT ?? "sm_aat_dummy",🧰 Tools
🪛 Gitleaks (8.26.0)
50-50: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
sdk/eas/src/graphql/operations.ts (2)
5-9
:__dirname
in ESM – see previous reviewThis block still relies on
__dirname
, which is undefined in pure-ESM builds. Prior feedback already covered theimport.meta.url
fix.
14-26
: BlockingreadFileSync
at module load – see previous reviewThe synchronous file read remains; converting to async or lazy-loading was suggested earlier for startup performance.
sdk/eas/src/types.ts (1)
192-261
: Internal portal response types are still exportedEarlier feedback recommended moving these
@internal
interfaces to a non-exported file. They are still part of the public surface.sdk/eas/src/eas.ts (5)
98-106
: Inline GraphQL string still presentThe query for
getContractsEasSchemaRegistry
is hard-coded instead of imported fromgraphql/operations.ts
, duplicating logic and bypassing typed validation.
110-113
: Emptycatch
hides errorsSilent catch blocks make debugging deployment polling painful; previous suggestion to log when
debug
is enabled still applies.
154-155
: Emptycatch
hides errorsSame issue for the EAS polling loop.
466-468
: No validation when building schema strings
buildSchemaString
still concatenates raw input without checking field names / types. See earlier recommendation for basic validation.
406-408
:⚠️ Potential issue
isValidAttestation
always returnsfalse
– misleading APIReturning a constant
false
can cause silent logic errors. Either implement the call or fail fast like other un-implemented methods:- async isValidAttestation(uid: Hex): Promise<boolean> { - return false; - } + async isValidAttestation(uid: Hex): Promise<boolean> { + throw new Error( + `Attestation validity check not implemented yet. Use The Graph subgraph for checking attestation validity. Attestation UID: ${uid}`, + ); + }
🧹 Nitpick comments (2)
sdk/eas/src/eas.test.ts (1)
32-40
: Unused fixture objects clutter the test file
optionsWithAddresses
/optionsWithoutAddresses
are declared but never used anywhere below. Delete them or integrate them into the relevant tests to avoid dead code.sdk/eas/src/types.ts (1)
42-52
: MakeaccessToken
optional for standalone / public-read scenariosDown-stream comments (janb87) requested that the token not be mandatory when only read methods are used.
- accessToken: string; + accessToken?: string;Call sites that truly require it (mutations) should throw early if absent.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lock
is excluded by!**/*.lock
📒 Files selected for processing (9)
sdk/eas/.gitignore
(1 hunks)sdk/eas/examples/simple-eas-workflow.ts
(1 hunks)sdk/eas/package.json
(1 hunks)sdk/eas/src/eas.test.ts
(2 hunks)sdk/eas/src/eas.ts
(1 hunks)sdk/eas/src/graphql/operations.ts
(1 hunks)sdk/eas/src/portal/portal-client.ts
(1 hunks)sdk/eas/src/types.ts
(2 hunks)sdk/eas/tsconfig.json
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- sdk/eas/.gitignore
- sdk/eas/src/portal/portal-client.ts
- sdk/eas/tsconfig.json
🚧 Files skipped from review as they are similar to previous changes (2)
- sdk/eas/package.json
- sdk/eas/examples/simple-eas-workflow.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
sdk/eas/src/types.ts (1)
sdk/eas/src/eas.ts (14)
ZERO_ADDRESS
(495-495)ZERO_BYTES32
(495-495)EASClientOptions
(482-482)SchemaRequest
(483-483)SchemaField
(480-480)AttestationData
(484-484)AttestationRequest
(485-485)TransactionResult
(486-486)SchemaData
(487-487)AttestationInfo
(488-488)GetSchemasOptions
(489-489)GetAttestationsOptions
(490-490)DeploymentResult
(491-491)RegisterSchemaOptions
(492-492)
🪛 Gitleaks (8.26.0)
sdk/eas/src/eas.test.ts
50-50: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
67-67: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
80-80: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
91-91: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
108-108: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
121-121: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
132-132: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
155-155: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
185-185: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
212-212: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
230-230: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
263-263: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
287-287: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
320-320: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
343-343: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
366-366: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
381-381: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
406-406: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
420-420: Found a Settlemint Application Access Token.
(settlemint-application-access-token)
🪛 GitHub Check: Turbo Flow
sdk/eas/src/graphql/operations.ts
[warning] 52-52:
Multiple schemas are configured, but the document is not for a specific schema.
[warning] 41-41:
Multiple schemas are configured, but the document is not for a specific schema.
fffa2dd
to
72c70c6
Compare
🤖 Slack notification sent for this PR |
📦 Packages
|
2a6df89
to
99b0619
Compare
31caed2
to
e0fc27e
Compare
3330e76
to
36d30c3
Compare
…nt and cache definitions
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.
✅ BugBot reviewed your changes and found no bugs!
Was this report helpful? Give feedback by reacting with 👍 or 👎
…nd validation
Summary by Sourcery
Migrate the EAS SDK to a Portal-based implementation by introducing the EASPortalClient, unifying schema registration, adding flexible ABI support, structured error codes, and real-time monitoring, while overhauling documentation, build config, and tests for the new architecture.
New Features:
Enhancements:
Build:
Documentation:
Tests: