@settlemint/sdk-eas 2.5.2-pr3f0fdd1a → 2.5.2-pr6b6b60bf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -29
- package/dist/browser/eas.d.ts +12 -61
- package/dist/browser/eas.js +26 -137
- package/dist/browser/eas.js.map +1 -1
- package/dist/eas.cjs +26 -137
- package/dist/eas.cjs.map +1 -1
- package/dist/eas.d.cts +12 -61
- package/dist/eas.d.ts +12 -61
- package/dist/eas.js +26 -137
- package/dist/eas.js.map +1 -1
- package/package.json +3 -3
package/dist/eas.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eas.cjs","names":["graphql: PortalClient[\"graphql\"]","zeroAddress","UrlSchema","options: EASClientOptions","deployerAddress: Address","forwarderAddress?: Address","gasLimit?: string","request: SchemaRequest","fromAddress: Address","request: AttestationRequest","requests: AttestationRequest[]","schemaUID: Hex","attestationUID: Hex","value?: bigint","uid: Hex","_options?: GetSchemasOptions","_options?: GetAttestationsOptions","data: Hex","fields: SchemaField[]"],"sources":["../src/portal/operations.ts","../src/schema.ts","../src/utils/validation.ts","../src/eas.ts"],"sourcesContent":["import type { PortalClient } from \"./portal-client.js\";\n\nexport const GraphQLOperations = {\n mutations: {\n deploySchemaRegistry: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation DeployContractEASSchemaRegistry(\n $from: String!\n $constructorArguments: DeployContractEASSchemaRegistryInput!\n $gasLimit: String!\n ) {\n DeployContractEASSchemaRegistry(from: $from, constructorArguments: $constructorArguments, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n\n deployEAS: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation DeployContractEAS($from: String!, $constructorArguments: DeployContractEASInput!, $gasLimit: String!) {\n DeployContractEAS(from: $from, constructorArguments: $constructorArguments, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n\n registerSchema: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation EASSchemaRegistryRegister(\n $address: String!\n $from: String!\n $input: EASSchemaRegistryRegisterInput!\n $gasLimit: String!\n ) {\n EASSchemaRegistryRegister(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n\n attest: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation EASAttest($address: String!, $from: String!, $input: EASAttestInput!, $gasLimit: String!) {\n EASAttest(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n\n multiAttest: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation EASMultiAttest($address: String!, $from: String!, $input: EASMultiAttestInput!, $gasLimit: String!) {\n EASMultiAttest(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n\n revoke: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation EASRevoke($address: String!, $from: String!, $input: EASRevokeInput!, $gasLimit: String!) {\n EASRevoke(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n },\n\n queries: {\n getSchema: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n query EASSchemaRegistryGetSchema($address: String!, $uid: String!) {\n EASSchemaRegistry(address: $address) {\n getSchema(uid: $uid) {\n uid\n resolver\n revocable\n schema\n }\n }\n }`),\n\n getAttestation: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n query EASGetAttestation($address: String!, $uid: String!) {\n EAS(address: $address) {\n getAttestation(uid: $uid) {\n uid\n schema\n attester\n recipient\n time\n expirationTime\n revocable\n refUID\n data\n revocationTime\n }\n }\n }`),\n\n isAttestationValid: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n query EASIsAttestationValid($address: String!, $uid: String!) {\n EAS(address: $address) {\n isAttestationValid(uid: $uid)\n }\n }`),\n\n getTimestamp: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n query EASGetTimestamp($address: String!, $data: String!) {\n EAS(address: $address) {\n getTimestamp(data: $data)\n }\n }`),\n },\n};\n","import { type Address, type Hex, zeroAddress } from \"viem\";\nimport type { z } from \"zod\";\nimport type { EASClientOptionsSchema } from \"./utils/validation.js\";\n\n/**\n * Common address constants\n */\nexport const ZERO_ADDRESS = zeroAddress;\nexport const ZERO_BYTES32 = \"0x0000000000000000000000000000000000000000000000000000000000000000\" as Hex;\n\n/**\n * Supported field types for EAS schema fields.\n * Maps to the Solidity types that can be used in EAS schemas.\n */\nexport const EAS_FIELD_TYPES = {\n string: \"string\",\n address: \"address\",\n bool: \"bool\",\n bytes: \"bytes\",\n bytes32: \"bytes32\",\n uint256: \"uint256\",\n int256: \"int256\",\n uint8: \"uint8\",\n int8: \"int8\",\n} as const;\n\nexport type EASFieldType = keyof typeof EAS_FIELD_TYPES;\n\n/**\n * Represents a single field in an EAS schema.\n */\nexport interface SchemaField {\n /** The name of the field */\n name: string;\n /** The Solidity type of the field */\n type: EASFieldType;\n /** Optional description of the field's purpose */\n description?: string;\n}\n\n/**\n * Configuration options for the EAS client\n */\nexport type EASClientOptions = z.infer<typeof EASClientOptionsSchema>;\n\n/**\n * Schema registration request\n */\nexport interface SchemaRequest {\n /** Schema fields (alternative to schema string) */\n fields?: SchemaField[];\n /** Raw schema string (alternative to fields) */\n schema?: string;\n /** Resolver contract address (use ZERO_ADDRESS for no resolver) */\n resolver: Address;\n /** Whether attestations using this schema can be revoked */\n revocable: boolean;\n}\n\n/**\n * Attestation data structure\n */\nexport interface AttestationData {\n /** Recipient of the attestation */\n recipient: Address;\n /** Expiration time (0 for no expiration) */\n expirationTime: bigint;\n /** Whether this attestation can be revoked */\n revocable: boolean;\n /** Reference UID (use ZERO_BYTES32 for no reference) */\n refUID: Hex;\n /** Encoded attestation data */\n data: Hex;\n /** Value sent with the attestation */\n value: bigint;\n}\n\n/**\n * Attestation request\n */\nexport interface AttestationRequest {\n /** Schema UID to attest against */\n schema: Hex;\n /** Attestation data */\n data: AttestationData;\n}\n\n/**\n * Transaction result\n */\nexport interface TransactionResult {\n /** Transaction hash */\n hash: Hex;\n /** Whether the transaction was successful */\n success: boolean;\n}\n\n/**\n * Schema information\n */\nexport interface SchemaData {\n /** Schema UID */\n uid: Hex;\n /** Resolver contract address */\n resolver: Address;\n /** Whether attestations can be revoked */\n revocable: boolean;\n /** Schema string */\n schema: string;\n}\n\n/**\n * Attestation information\n */\nexport interface AttestationInfo {\n /** Attestation UID */\n uid: Hex;\n /** Schema UID */\n schema: Hex;\n /** Address that created the attestation */\n attester: Address;\n /** Recipient of the attestation */\n recipient: Address;\n /** Creation timestamp */\n time: bigint;\n /** Expiration timestamp */\n expirationTime: bigint;\n /** Whether this attestation can be revoked */\n revocable: boolean;\n /** Reference UID */\n refUID: Hex;\n /** Encoded attestation data */\n data: Hex;\n /** Value sent with the attestation */\n value: bigint;\n}\n\n/**\n * Options for retrieving schemas\n */\nexport interface GetSchemasOptions {\n /** Maximum number of schemas to return */\n limit?: number;\n /** Number of schemas to skip */\n offset?: number;\n}\n\n/**\n * Options for retrieving attestations\n */\nexport interface GetAttestationsOptions {\n /** Maximum number of attestations to return */\n limit?: number;\n /** Number of attestations to skip */\n offset?: number;\n /** Filter by schema UID */\n schema?: Hex;\n /** Filter by attester address */\n attester?: Address;\n /** Filter by recipient address */\n recipient?: Address;\n}\n\n/**\n * Contract deployment result\n */\nexport interface DeploymentResult {\n /** Deployed EAS contract address */\n easAddress: Address;\n /** Deployed Schema Registry contract address */\n schemaRegistryAddress: Address;\n /** EAS deployment transaction hash (when address not immediately available) */\n easTransactionHash?: Hex;\n /** Schema Registry deployment transaction hash (when address not immediately available) */\n schemaRegistryTransactionHash?: Hex;\n}\n\n/**\n * @deprecated Use SchemaRequest instead\n * @internal\n */\nexport interface RegisterSchemaOptions extends SchemaRequest {}\n","import { ApplicationAccessTokenSchema, UrlSchema } from \"@settlemint/sdk-utils/validation\";\nimport { type Address, isAddress } from \"viem\";\nimport { z } from \"zod\";\n\nconst ethAddressSchema = z.custom<Address>(\n (val) => typeof val === \"string\" && isAddress(val),\n \"Invalid Ethereum address\",\n);\n\n/**\n * Zod schema for EASClientOptions.\n */\nexport const EASClientOptionsSchema = z.object({\n /**\n * The EAS instance URL\n */\n instance: UrlSchema,\n /**\n * The application access token\n */\n accessToken: ApplicationAccessTokenSchema.optional(),\n /**\n * The EAS contract address\n */\n easContractAddress: ethAddressSchema.optional(),\n /**\n * The schema registry contract address\n */\n schemaRegistryContractAddress: ethAddressSchema.optional(),\n /**\n * Whether to enable debug mode\n */\n debug: z.boolean().optional(),\n});\n","import { createPortalClient, waitForTransactionReceipt } from \"@settlemint/sdk-portal\";\nimport { createLogger, requestLogger } from \"@settlemint/sdk-utils/logging\";\nimport { validate } from \"@settlemint/sdk-utils/validation\";\nimport type { Address, Hex } from \"viem\";\nimport { GraphQLOperations } from \"./portal/operations.js\";\nimport type { PortalClient } from \"./portal/portal-client.js\";\nimport type { introspection } from \"./portal/portal-env.d.ts\";\nimport {\n type AttestationInfo,\n type AttestationRequest,\n type DeploymentResult,\n type EASClientOptions,\n type GetAttestationsOptions,\n type GetSchemasOptions,\n type SchemaData,\n type SchemaField,\n type SchemaRequest,\n type TransactionResult,\n ZERO_ADDRESS,\n} from \"./schema.js\";\nimport { EASClientOptionsSchema } from \"./utils/validation.js\";\n\nconst LOGGER = createLogger();\n\nconst DEFAULT_GAS_LIMIT = \"0x3d0900\";\n\n/**\n * Main EAS client class for interacting with Ethereum Attestation Service via Portal\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * // Deploy EAS contracts\n * const deployment = await easClient.deploy(\"0x1234...deployer-address\");\n * console.log(\"EAS deployed at:\", deployment.easAddress);\n * ```\n */\nexport class EASClient {\n private readonly options: EASClientOptions;\n private readonly portalClient: PortalClient[\"client\"];\n private readonly portalGraphql: PortalClient[\"graphql\"];\n private deployedAddresses?: DeploymentResult;\n\n /**\n * Create a new EAS client instance\n *\n * @param options - Configuration options for the EAS client\n */\n constructor(options: EASClientOptions) {\n this.options = validate(EASClientOptionsSchema, options);\n\n const { client: portalClient, graphql: portalGraphql } = createPortalClient<{\n introspection: introspection;\n disableMasking: true;\n scalars: {\n // Change unknown to the type you are using to store metadata\n JSON: unknown;\n };\n }>(\n {\n instance: this.options.instance,\n accessToken: this.options.accessToken,\n },\n {\n fetch: requestLogger(LOGGER, \"portal\", fetch) as typeof fetch,\n },\n );\n\n this.portalClient = portalClient;\n this.portalGraphql = portalGraphql;\n }\n\n /**\n * Deploy EAS contracts via Portal\n *\n * @param deployerAddress - The address that will deploy the contracts\n * @param forwarderAddress - Optional trusted forwarder address (defaults to zero address)\n * @param gasLimit - Optional gas limit for deployment transactions (defaults to \"0x7a1200\")\n * @returns Promise resolving to deployment result with contract addresses and transaction hashes\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * const deployment = await easClient.deploy(\n * \"0x1234567890123456789012345678901234567890\", // deployer address\n * \"0x0000000000000000000000000000000000000000\", // forwarder (optional)\n * \"0x7a1200\" // gas limit (optional)\n * );\n *\n * console.log(\"Schema Registry:\", deployment.schemaRegistryAddress);\n * console.log(\"EAS Contract:\", deployment.easAddress);\n * ```\n */\n public async deploy(\n deployerAddress: Address,\n forwarderAddress?: Address,\n gasLimit?: string,\n ): Promise<DeploymentResult> {\n const defaultForwarder = forwarderAddress || ZERO_ADDRESS;\n const defaultGasLimit = gasLimit || \"0x7a1200\";\n\n try {\n // Deploy Schema Registry first\n const schemaRegistryResponse = await this.portalClient.request(\n GraphQLOperations.mutations.deploySchemaRegistry(this.portalGraphql),\n {\n from: deployerAddress,\n constructorArguments: {\n forwarder: defaultForwarder,\n },\n gasLimit: defaultGasLimit,\n },\n );\n\n if (!schemaRegistryResponse.DeployContractEASSchemaRegistry?.transactionHash) {\n throw new Error(\"Schema Registry deployment failed - no transaction hash returned\");\n }\n\n const schemaRegistryTxHash = schemaRegistryResponse.DeployContractEASSchemaRegistry.transactionHash;\n\n // Wait for Schema Registry deployment and get contract address\n const schemaRegistryTransaction = await waitForTransactionReceipt(schemaRegistryTxHash as Hex, {\n portalGraphqlEndpoint: this.options.instance,\n accessToken: this.options.accessToken,\n timeout: 60_000,\n });\n\n if (!schemaRegistryTransaction?.receipt?.contractAddress) {\n throw new Error(\"Schema Registry deployment failed - could not get contract address from transaction receipt.\");\n }\n\n const schemaRegistryAddress = schemaRegistryTransaction.receipt.contractAddress;\n\n // Deploy EAS contract with correct Schema Registry address\n const easResponse = await this.portalClient.request(GraphQLOperations.mutations.deployEAS(this.portalGraphql), {\n from: deployerAddress,\n constructorArguments: {\n registry: schemaRegistryAddress,\n forwarder: defaultForwarder,\n },\n gasLimit: defaultGasLimit,\n });\n if (!easResponse.DeployContractEAS?.transactionHash) {\n throw new Error(\"EAS deployment failed - no transaction hash returned\");\n }\n\n const easTxHash = easResponse.DeployContractEAS.transactionHash as Hex;\n\n // Wait for EAS deployment and get contract address\n const easTransaction = await waitForTransactionReceipt(easTxHash, {\n portalGraphqlEndpoint: this.options.instance,\n accessToken: this.options.accessToken,\n timeout: 60_000,\n });\n\n if (!easTransaction?.receipt?.contractAddress) {\n throw new Error(\"EAS deployment failed - could not get contract address from transaction receipt.\");\n }\n const easAddress = easTransaction.receipt.contractAddress;\n\n this.deployedAddresses = {\n easAddress,\n schemaRegistryAddress,\n easTransactionHash: easTxHash as Hex,\n schemaRegistryTransactionHash: schemaRegistryTxHash as Hex,\n };\n\n return this.deployedAddresses;\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to deploy EAS contracts: ${error.message}`);\n }\n }\n\n /**\n * Register a new schema in the EAS Schema Registry\n *\n * @param request - Schema registration request containing schema definition\n * @param fromAddress - Address that will register the schema\n * @param gasLimit - Optional gas limit for the transaction (defaults to \"0x3d0900\")\n * @returns Promise resolving to transaction result\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * const schemaResult = await easClient.registerSchema(\n * {\n * schema: \"uint256 eventId, uint8 voteIndex\",\n * resolver: \"0x0000000000000000000000000000000000000000\",\n * revocable: true\n * },\n * \"0x1234567890123456789012345678901234567890\" // from address\n * );\n *\n * console.log(\"Schema registered:\", schemaResult.hash);\n * ```\n */\n public async registerSchema(\n request: SchemaRequest,\n fromAddress: Address,\n gasLimit?: string,\n ): Promise<TransactionResult> {\n const schemaRegistryAddress = this.getSchemaRegistryAddress();\n\n let schemaString = request.schema;\n if (request.fields && !schemaString) {\n schemaString = this.buildSchemaString(request.fields);\n }\n\n if (!schemaString) {\n throw new Error(\"Schema string is required. Provide either 'schema' or 'fields'.\");\n }\n\n try {\n const response = await this.portalClient.request(GraphQLOperations.mutations.registerSchema(this.portalGraphql), {\n address: schemaRegistryAddress,\n from: fromAddress,\n input: {\n schema: schemaString,\n resolver: request.resolver,\n revocable: request.revocable,\n },\n gasLimit: gasLimit || DEFAULT_GAS_LIMIT,\n });\n\n const transactionHash = response.EASSchemaRegistryRegister?.transactionHash;\n\n if (!transactionHash) {\n throw new Error(\"No transaction hash returned from Portal\");\n }\n\n return {\n hash: transactionHash as Hex,\n success: true,\n };\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to register schema: ${error.message}`);\n }\n }\n\n /**\n * Create an attestation\n *\n * @param request - Attestation request containing schema and data\n * @param fromAddress - Address that will create the attestation\n * @param gasLimit - Optional gas limit for the transaction (defaults to \"0x3d0900\")\n * @returns Promise resolving to transaction result\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * const attestationResult = await easClient.attest(\n * {\n * schema: \"0x1234567890123456789012345678901234567890123456789012345678901234\",\n * data: {\n * recipient: \"0x1234567890123456789012345678901234567890\",\n * expirationTime: BigInt(0), // No expiration\n * revocable: true,\n * refUID: \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n * data: \"0x1234\", // ABI-encoded data\n * value: BigInt(0)\n * }\n * },\n * \"0x1234567890123456789012345678901234567890\" // from address\n * );\n *\n * console.log(\"Attestation created:\", attestationResult.hash);\n * ```\n */\n public async attest(\n request: AttestationRequest,\n fromAddress: Address,\n gasLimit?: string,\n ): Promise<TransactionResult> {\n const easAddress = this.getEASAddress();\n\n try {\n const response = await this.portalClient.request(GraphQLOperations.mutations.attest(this.portalGraphql), {\n address: easAddress,\n from: fromAddress,\n input: {\n request: {\n schema: request.schema,\n data: {\n recipient: request.data.recipient,\n expirationTime: request.data.expirationTime.toString(),\n revocable: request.data.revocable,\n refUID: request.data.refUID,\n data: request.data.data,\n value: request.data.value?.toString() || \"0\",\n },\n },\n },\n gasLimit: gasLimit || DEFAULT_GAS_LIMIT,\n });\n\n const transactionHash = response.EASAttest?.transactionHash;\n\n if (!transactionHash) {\n throw new Error(\"No transaction hash returned from Portal\");\n }\n\n return {\n hash: transactionHash as Hex,\n success: true,\n };\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to create attestation: ${error.message}`);\n }\n }\n\n /**\n * Create multiple attestations in a single transaction\n *\n * @param requests - Array of attestation requests\n * @param fromAddress - Address that will create the attestations\n * @param gasLimit - Optional gas limit for the transaction (defaults to \"0x3d0900\")\n * @returns Promise resolving to transaction result\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * const multiAttestResult = await easClient.multiAttest(\n * [\n * {\n * schema: \"0x1234567890123456789012345678901234567890123456789012345678901234\",\n * data: {\n * recipient: \"0x1234567890123456789012345678901234567890\",\n * expirationTime: BigInt(0),\n * revocable: true,\n * refUID: \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n * data: \"0x1234\",\n * value: BigInt(0)\n * }\n * },\n * {\n * schema: \"0x5678901234567890123456789012345678901234567890123456789012345678\",\n * data: {\n * recipient: \"0x5678901234567890123456789012345678901234\",\n * expirationTime: BigInt(0),\n * revocable: false,\n * refUID: \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n * data: \"0x5678\",\n * value: BigInt(0)\n * }\n * }\n * ],\n * \"0x1234567890123456789012345678901234567890\" // from address\n * );\n *\n * console.log(\"Multiple attestations created:\", multiAttestResult.hash);\n * ```\n */\n public async multiAttest(\n requests: AttestationRequest[],\n fromAddress: Address,\n gasLimit?: string,\n ): Promise<TransactionResult> {\n if (requests.length === 0) {\n throw new Error(\"At least one attestation request is required\");\n }\n\n const easAddress = this.getEASAddress();\n\n try {\n const response = await this.portalClient.request(GraphQLOperations.mutations.multiAttest(this.portalGraphql), {\n address: easAddress,\n from: fromAddress,\n input: {\n multiRequests: requests.map((req) => ({\n schema: req.schema,\n data: [\n {\n recipient: req.data.recipient,\n expirationTime: req.data.expirationTime.toString(),\n revocable: req.data.revocable,\n refUID: req.data.refUID,\n data: req.data.data,\n value: req.data.value?.toString() || \"0\",\n },\n ],\n })),\n },\n gasLimit: gasLimit || DEFAULT_GAS_LIMIT,\n });\n\n const transactionHash = response.EASMultiAttest?.transactionHash;\n\n if (!transactionHash) {\n throw new Error(\"No transaction hash returned from Portal\");\n }\n\n return {\n hash: transactionHash as Hex,\n success: true,\n };\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to create multiple attestations: ${error.message}`);\n }\n }\n\n /**\n * Revoke an existing attestation\n *\n * @param schemaUID - UID of the schema used for the attestation\n * @param attestationUID - UID of the attestation to revoke\n * @param fromAddress - Address that will revoke the attestation\n * @param value - Optional ETH value to send with the revocation\n * @param gasLimit - Optional gas limit for the transaction (defaults to \"0x3d0900\")\n * @returns Promise resolving to transaction result\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * const revokeResult = await easClient.revoke(\n * \"0x1234567890123456789012345678901234567890123456789012345678901234\", // schema UID\n * \"0x5678901234567890123456789012345678901234567890123456789012345678\", // attestation UID\n * \"0x1234567890123456789012345678901234567890\", // from address\n * BigInt(0) // value (optional)\n * );\n *\n * console.log(\"Attestation revoked:\", revokeResult.hash);\n * ```\n */\n public async revoke(\n schemaUID: Hex,\n attestationUID: Hex,\n fromAddress: Address,\n value?: bigint,\n gasLimit?: string,\n ): Promise<TransactionResult> {\n try {\n const response = await this.portalClient.request(GraphQLOperations.mutations.revoke(this.portalGraphql), {\n address: this.getEASAddress(),\n from: fromAddress,\n input: {\n request: {\n schema: schemaUID,\n data: {\n uid: attestationUID,\n value: value?.toString() || \"0\",\n },\n },\n },\n gasLimit: gasLimit || DEFAULT_GAS_LIMIT,\n });\n\n const transactionHash = response.EASRevoke?.transactionHash;\n\n if (!transactionHash) {\n throw new Error(\"No transaction hash returned from Portal\");\n }\n\n return {\n hash: transactionHash as Hex,\n success: true,\n };\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to revoke attestation: ${error.message}`);\n }\n }\n\n /**\n * Get a schema by UID\n */\n public async getSchema(uid: Hex): Promise<SchemaData> {\n const schemaRegistryAddress = this.getSchemaRegistryAddress();\n\n try {\n const response = await this.portalClient.request(GraphQLOperations.queries.getSchema(this.portalGraphql), {\n address: schemaRegistryAddress,\n uid: uid,\n });\n\n const schemaResult = response.EASSchemaRegistry?.getSchema;\n\n if (!schemaResult) {\n throw new Error(`Schema not found: ${uid}`);\n }\n\n return {\n uid: schemaResult.uid as Hex,\n resolver: schemaResult.resolver as Address,\n revocable: Boolean(schemaResult.revocable),\n schema: schemaResult.schema || \"\",\n };\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to get schema: ${error.message}`);\n }\n }\n\n /**\n * Get all schemas with pagination\n *\n * Note: This method requires The Graph subgraph or additional indexing infrastructure\n * as Portal's direct contract queries don't support listing all schemas.\n * Consider using getSchema() for individual schema lookups.\n */\n public async getSchemas(_options?: GetSchemasOptions): Promise<SchemaData[]> {\n throw new Error(\n \"Schema listing not implemented yet. Portal's direct contract queries don't support listing all schemas. Use getSchema() for individual schema lookups or implement The Graph subgraph integration for bulk queries.\",\n );\n }\n\n /**\n * Get an attestation by UID\n */\n public async getAttestation(uid: Hex): Promise<AttestationInfo> {\n const easAddress = this.getEASAddress();\n\n try {\n const response = await this.portalClient.request(GraphQLOperations.queries.getAttestation(this.portalGraphql), {\n address: easAddress,\n uid: uid,\n });\n\n const attestationResult = response.EAS?.getAttestation;\n\n if (!attestationResult) {\n throw new Error(`Attestation not found: ${uid}`);\n }\n\n return {\n uid: attestationResult.uid as Hex,\n schema: attestationResult.schema as Hex,\n attester: attestationResult.attester as Address,\n recipient: attestationResult.recipient as Address,\n time: attestationResult.time ? BigInt(attestationResult.time) : BigInt(0),\n expirationTime: attestationResult.expirationTime ? BigInt(attestationResult.expirationTime) : BigInt(0),\n revocable: Boolean(attestationResult.revocable),\n refUID: attestationResult.refUID as Hex,\n data: attestationResult.data as Hex,\n value: BigInt(0), // Note: Portal schema doesn't include value, defaulting to 0\n };\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to get attestation: ${error.message}`);\n }\n }\n\n /**\n * Get attestations with pagination and filtering\n *\n * Note: This method requires The Graph subgraph or additional indexing infrastructure\n * as Portal's direct contract queries don't support listing all attestations.\n * Consider using getAttestation() for individual attestation lookups.\n */\n public async getAttestations(_options?: GetAttestationsOptions): Promise<AttestationInfo[]> {\n throw new Error(\n \"Attestation listing not implemented yet. Portal's direct contract queries don't support listing all attestations. Use getAttestation() for individual attestation lookups or implement The Graph subgraph integration for bulk queries.\",\n );\n }\n\n /**\n * Check if an attestation is valid\n */\n public async isValidAttestation(uid: Hex): Promise<boolean> {\n const easAddress = this.getEASAddress();\n\n try {\n const response = await this.portalClient.request(\n GraphQLOperations.queries.isAttestationValid(this.portalGraphql),\n {\n address: easAddress,\n uid: uid,\n },\n );\n\n return response.EAS?.isAttestationValid ?? false;\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to check attestation validity: ${error.message}`);\n }\n }\n\n /**\n * Get the timestamp for specific data\n *\n * @param data - The data to get timestamp for\n * @returns The timestamp when the data was timestamped\n */\n public async getTimestamp(data: Hex): Promise<bigint> {\n const easAddress = this.getEASAddress();\n\n try {\n const response = await this.portalClient.request(GraphQLOperations.queries.getTimestamp(this.portalGraphql), {\n address: easAddress,\n data: data,\n });\n\n const timestampResult = response.EAS?.getTimestamp;\n\n if (timestampResult === undefined || timestampResult === null) {\n throw new Error(`No timestamp found for data: ${data}`);\n }\n\n return BigInt(timestampResult);\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to get timestamp: ${error.message}`);\n }\n }\n\n /**\n * Get client configuration\n */\n public getOptions(): EASClientOptions {\n return { ...this.options };\n }\n\n /**\n * Get the Portal client instance for advanced operations\n */\n public getPortalClient(): PortalClient[\"client\"] {\n return this.portalClient;\n }\n\n /**\n * Get current contract addresses\n */\n public getContractAddresses(): { easAddress?: Address; schemaRegistryAddress?: Address } {\n return {\n easAddress: this.options.easContractAddress || this.deployedAddresses?.easAddress,\n schemaRegistryAddress:\n this.options.schemaRegistryContractAddress || this.deployedAddresses?.schemaRegistryAddress,\n };\n }\n\n private getEASAddress(): Address {\n if (this.options.easContractAddress) {\n return this.options.easContractAddress;\n }\n if (this.deployedAddresses?.easAddress) {\n return this.deployedAddresses.easAddress;\n }\n throw new Error(\"EAS contract address not available. Please provide it in options or deploy contracts first.\");\n }\n\n private getSchemaRegistryAddress(): Address {\n if (this.options.schemaRegistryContractAddress) {\n return this.options.schemaRegistryContractAddress;\n }\n if (this.deployedAddresses?.schemaRegistryAddress) {\n return this.deployedAddresses.schemaRegistryAddress;\n }\n throw new Error(\n \"Schema Registry contract address not available. Please provide it in options or deploy contracts first.\",\n );\n }\n\n private buildSchemaString(fields: SchemaField[]): string {\n return fields.map((field) => `${field.type} ${field.name}`).join(\", \");\n }\n}\n\n/**\n * Create an EAS client instance\n *\n * @param options - Configuration options for the EAS client\n * @returns EAS client instance\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * // Use the client\n * const deployment = await easClient.deploy(\"0x1234...deployer-address\");\n * ```\n */\nexport function createEASClient(options: EASClientOptions): EASClient {\n return new EASClient(options);\n}\n\n// Re-export GraphQL operations for advanced usage\nexport { GraphQLOperations } from \"./portal/operations.js\";\n// Re-export types and constants\nexport type {\n AttestationData,\n AttestationInfo,\n AttestationRequest,\n DeploymentResult,\n EASClientOptions,\n EASFieldType,\n GetAttestationsOptions,\n GetSchemasOptions,\n RegisterSchemaOptions,\n SchemaData,\n SchemaField,\n SchemaRequest,\n TransactionResult,\n} from \"./schema.js\";\nexport { EAS_FIELD_TYPES, ZERO_ADDRESS, ZERO_BYTES32 } from \"./schema.js\";\n// Re-export validation utilities\nexport { EASClientOptionsSchema } from \"./utils/validation.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,oBAAoB;CAC/B,WAAW;EACT,sBAAsB,CAACA,YACrB,SAAS;;;;;;;;;WASJ;EAEP,WAAW,CAACA,YACV,SAAS;;;;;WAKJ;EAEP,gBAAgB,CAACA,YACf,SAAS;;;;;;;;;;WAUJ;EAEP,QAAQ,CAACA,YACP,SAAS;;;;;WAKJ;EAEP,aAAa,CAACA,YACZ,SAAS;;;;;WAKJ;EAEP,QAAQ,CAACA,YACP,SAAS;;;;;WAKJ;CACR;CAED,SAAS;EACP,WAAW,CAACA,YACV,SAAS;;;;;;;;;;WAUJ;EAEP,gBA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GACvE,uBACE,KAAK,QAAQ,iCAAiC,KAAK,mBAAmB;EACzE;CACF;CAED,AAAQ,gBAAyB;AAC/B,MAAI,KAAK,QAAQ,oBAAoB;AACnC,UAAO,KAAK,QAAQ;EACrB;AACD,MAAI,KAAK,mBAAmB,YAAY;AACtC,UAAO,KAAK,kBAAkB;EAC/B;AACD,QAAM,IAAI,MAAM;CACjB;CAED,AAAQ,2BAAoC;AAC1C,MAAI,KAAK,QAAQ,+BAA+B;AAC9C,UAAO,KAAK,QAAQ;EACrB;AACD,MAAI,KAAK,mBAAmB,uBAAuB;AACjD,UAAO,KAAK,kBAAkB;EAC/B;AACD,QAAM,IAAI,MACR;CAEH;CAED,AAAQ,kBAAkBC,QAA+B;AACvD,SAAO,OAAO,IAAI,CAAC,WAAW,EAAE,MAAM,KAAK,GAAG,MAAM,KAAK,EAAE,CAAC,KAAK,KAAK;CACvE;AACF;;;;;;;;;;;;;;;;;;;;AAqBD,SAAgB,gBAAgBf,SAAsC;AACpE,QAAO,IAAI,UAAU;AACtB"}
|
|
1
|
+
{"version":3,"file":"eas.cjs","names":["graphql: PortalClient[\"graphql\"]","zeroAddress","UrlSchema","options: EASClientOptions","deployerAddress: Address","forwarderAddress?: Address","gasLimit?: string","request: SchemaRequest","fromAddress: Address","request: AttestationRequest","requests: AttestationRequest[]","schemaUID: Hex","attestationUID: Hex","value?: bigint","uid: Hex","_options?: GetSchemasOptions","_options?: GetAttestationsOptions","_uid: Hex","fields: SchemaField[]"],"sources":["../src/portal/operations.ts","../src/schema.ts","../src/utils/validation.ts","../src/eas.ts"],"sourcesContent":["import type { PortalClient } from \"./portal-client.js\";\n\nexport const GraphQLOperations = {\n mutations: {\n deploySchemaRegistry: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation DeployContractEASSchemaRegistry(\n $from: String!\n $constructorArguments: DeployContractEASSchemaRegistryInput!\n $gasLimit: String!\n ) {\n DeployContractEASSchemaRegistry(from: $from, constructorArguments: $constructorArguments, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n\n deployEAS: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation DeployContractEAS($from: String!, $constructorArguments: DeployContractEASInput!, $gasLimit: String!) {\n DeployContractEAS(from: $from, constructorArguments: $constructorArguments, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n\n registerSchema: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation EASSchemaRegistryRegister(\n $address: String!\n $from: String!\n $input: EASSchemaRegistryRegisterInput!\n $gasLimit: String!\n ) {\n EASSchemaRegistryRegister(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n\n attest: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation EASAttest($address: String!, $from: String!, $input: EASAttestInput!, $gasLimit: String!) {\n EASAttest(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n\n multiAttest: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation EASMultiAttest($address: String!, $from: String!, $input: EASMultiAttestInput!, $gasLimit: String!) {\n EASMultiAttest(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n\n revoke: (graphql: PortalClient[\"graphql\"]) =>\n graphql(`\n mutation EASRevoke($address: String!, $from: String!, $input: EASRevokeInput!, $gasLimit: String!) {\n EASRevoke(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {\n transactionHash\n }\n }`),\n },\n};\n","import { type Address, type Hex, zeroAddress } from \"viem\";\nimport type { z } from \"zod\";\nimport type { EASClientOptionsSchema } from \"./utils/validation.js\";\n\n/**\n * Common address constants\n */\nexport const ZERO_ADDRESS = zeroAddress;\nexport const ZERO_BYTES32 = \"0x0000000000000000000000000000000000000000000000000000000000000000\" as Hex;\n\n/**\n * Supported field types for EAS schema fields.\n * Maps to the Solidity types that can be used in EAS schemas.\n */\nexport const EAS_FIELD_TYPES = {\n string: \"string\",\n address: \"address\",\n bool: \"bool\",\n bytes: \"bytes\",\n bytes32: \"bytes32\",\n uint256: \"uint256\",\n int256: \"int256\",\n uint8: \"uint8\",\n int8: \"int8\",\n} as const;\n\nexport type EASFieldType = keyof typeof EAS_FIELD_TYPES;\n\n/**\n * Represents a single field in an EAS schema.\n */\nexport interface SchemaField {\n /** The name of the field */\n name: string;\n /** The Solidity type of the field */\n type: EASFieldType;\n /** Optional description of the field's purpose */\n description?: string;\n}\n\n/**\n * Configuration options for the EAS client\n */\nexport type EASClientOptions = z.infer<typeof EASClientOptionsSchema>;\n\n/**\n * Schema registration request\n */\nexport interface SchemaRequest {\n /** Schema fields (alternative to schema string) */\n fields?: SchemaField[];\n /** Raw schema string (alternative to fields) */\n schema?: string;\n /** Resolver contract address (use ZERO_ADDRESS for no resolver) */\n resolver: Address;\n /** Whether attestations using this schema can be revoked */\n revocable: boolean;\n}\n\n/**\n * Attestation data structure\n */\nexport interface AttestationData {\n /** Recipient of the attestation */\n recipient: Address;\n /** Expiration time (0 for no expiration) */\n expirationTime: bigint;\n /** Whether this attestation can be revoked */\n revocable: boolean;\n /** Reference UID (use ZERO_BYTES32 for no reference) */\n refUID: Hex;\n /** Encoded attestation data */\n data: Hex;\n /** Value sent with the attestation */\n value: bigint;\n}\n\n/**\n * Attestation request\n */\nexport interface AttestationRequest {\n /** Schema UID to attest against */\n schema: Hex;\n /** Attestation data */\n data: AttestationData;\n}\n\n/**\n * Transaction result\n */\nexport interface TransactionResult {\n /** Transaction hash */\n hash: Hex;\n /** Whether the transaction was successful */\n success: boolean;\n}\n\n/**\n * Schema information\n */\nexport interface SchemaData {\n /** Schema UID */\n uid: Hex;\n /** Resolver contract address */\n resolver: Address;\n /** Whether attestations can be revoked */\n revocable: boolean;\n /** Schema string */\n schema: string;\n}\n\n/**\n * Attestation information\n */\nexport interface AttestationInfo {\n /** Attestation UID */\n uid: Hex;\n /** Schema UID */\n schema: Hex;\n /** Address that created the attestation */\n attester: Address;\n /** Recipient of the attestation */\n recipient: Address;\n /** Creation timestamp */\n time: bigint;\n /** Expiration timestamp */\n expirationTime: bigint;\n /** Whether this attestation can be revoked */\n revocable: boolean;\n /** Reference UID */\n refUID: Hex;\n /** Encoded attestation data */\n data: Hex;\n /** Value sent with the attestation */\n value: bigint;\n}\n\n/**\n * Options for retrieving schemas\n */\nexport interface GetSchemasOptions {\n /** Maximum number of schemas to return */\n limit?: number;\n /** Number of schemas to skip */\n offset?: number;\n}\n\n/**\n * Options for retrieving attestations\n */\nexport interface GetAttestationsOptions {\n /** Maximum number of attestations to return */\n limit?: number;\n /** Number of attestations to skip */\n offset?: number;\n /** Filter by schema UID */\n schema?: Hex;\n /** Filter by attester address */\n attester?: Address;\n /** Filter by recipient address */\n recipient?: Address;\n}\n\n/**\n * Contract deployment result\n */\nexport interface DeploymentResult {\n /** Deployed EAS contract address */\n easAddress: Address;\n /** Deployed Schema Registry contract address */\n schemaRegistryAddress: Address;\n /** EAS deployment transaction hash (when address not immediately available) */\n easTransactionHash?: Hex;\n /** Schema Registry deployment transaction hash (when address not immediately available) */\n schemaRegistryTransactionHash?: Hex;\n}\n\n/**\n * @deprecated Use SchemaRequest instead\n * @internal\n */\nexport interface RegisterSchemaOptions extends SchemaRequest {}\n","import { ApplicationAccessTokenSchema, UrlSchema } from \"@settlemint/sdk-utils/validation\";\nimport { type Address, isAddress } from \"viem\";\nimport { z } from \"zod\";\n\nconst ethAddressSchema = z.custom<Address>(\n (val) => typeof val === \"string\" && isAddress(val),\n \"Invalid Ethereum address\",\n);\n\n/**\n * Zod schema for EASClientOptions.\n */\nexport const EASClientOptionsSchema = z.object({\n /**\n * The EAS instance URL\n */\n instance: UrlSchema,\n /**\n * The application access token\n */\n accessToken: ApplicationAccessTokenSchema.optional(),\n /**\n * The EAS contract address\n */\n easContractAddress: ethAddressSchema.optional(),\n /**\n * The schema registry contract address\n */\n schemaRegistryContractAddress: ethAddressSchema.optional(),\n /**\n * Whether to enable debug mode\n */\n debug: z.boolean().optional(),\n});\n","import { createPortalClient, waitForTransactionReceipt } from \"@settlemint/sdk-portal\";\nimport { createLogger, requestLogger } from \"@settlemint/sdk-utils/logging\";\nimport { validate } from \"@settlemint/sdk-utils/validation\";\nimport type { Address, Hex } from \"viem\";\nimport { GraphQLOperations } from \"./portal/operations.js\";\nimport type { PortalClient } from \"./portal/portal-client.js\";\nimport type { introspection } from \"./portal/portal-env.d.ts\";\nimport {\n type AttestationInfo,\n type AttestationRequest,\n type DeploymentResult,\n type EASClientOptions,\n type GetAttestationsOptions,\n type GetSchemasOptions,\n type SchemaData,\n type SchemaField,\n type SchemaRequest,\n type TransactionResult,\n ZERO_ADDRESS,\n} from \"./schema.js\";\nimport { EASClientOptionsSchema } from \"./utils/validation.js\";\n\nconst LOGGER = createLogger();\n\nconst DEFAULT_GAS_LIMIT = \"0x3d0900\";\n\n/**\n * Main EAS client class for interacting with Ethereum Attestation Service via Portal\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * // Deploy EAS contracts\n * const deployment = await easClient.deploy(\"0x1234...deployer-address\");\n * console.log(\"EAS deployed at:\", deployment.easAddress);\n * ```\n */\nexport class EASClient {\n private readonly options: EASClientOptions;\n private readonly portalClient: PortalClient[\"client\"];\n private readonly portalGraphql: PortalClient[\"graphql\"];\n private deployedAddresses?: DeploymentResult;\n\n /**\n * Create a new EAS client instance\n *\n * @param options - Configuration options for the EAS client\n */\n constructor(options: EASClientOptions) {\n this.options = validate(EASClientOptionsSchema, options);\n\n const { client: portalClient, graphql: portalGraphql } = createPortalClient<{\n introspection: introspection;\n disableMasking: true;\n scalars: {\n // Change unknown to the type you are using to store metadata\n JSON: unknown;\n };\n }>(\n {\n instance: this.options.instance,\n accessToken: this.options.accessToken,\n },\n {\n fetch: requestLogger(LOGGER, \"portal\", fetch) as typeof fetch,\n },\n );\n\n this.portalClient = portalClient;\n this.portalGraphql = portalGraphql;\n }\n\n /**\n * Deploy EAS contracts via Portal\n *\n * @param deployerAddress - The address that will deploy the contracts\n * @param forwarderAddress - Optional trusted forwarder address (defaults to zero address)\n * @param gasLimit - Optional gas limit for deployment transactions (defaults to \"0x7a1200\")\n * @returns Promise resolving to deployment result with contract addresses and transaction hashes\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * const deployment = await easClient.deploy(\n * \"0x1234567890123456789012345678901234567890\", // deployer address\n * \"0x0000000000000000000000000000000000000000\", // forwarder (optional)\n * \"0x7a1200\" // gas limit (optional)\n * );\n *\n * console.log(\"Schema Registry:\", deployment.schemaRegistryAddress);\n * console.log(\"EAS Contract:\", deployment.easAddress);\n * ```\n */\n public async deploy(\n deployerAddress: Address,\n forwarderAddress?: Address,\n gasLimit?: string,\n ): Promise<DeploymentResult> {\n const defaultForwarder = forwarderAddress || ZERO_ADDRESS;\n const defaultGasLimit = gasLimit || \"0x7a1200\";\n\n try {\n // Deploy Schema Registry first\n const schemaRegistryResponse = await this.portalClient.request(\n GraphQLOperations.mutations.deploySchemaRegistry(this.portalGraphql),\n {\n from: deployerAddress,\n constructorArguments: {\n forwarder: defaultForwarder,\n },\n gasLimit: defaultGasLimit,\n },\n );\n\n if (!schemaRegistryResponse.DeployContractEASSchemaRegistry?.transactionHash) {\n throw new Error(\"Schema Registry deployment failed - no transaction hash returned\");\n }\n\n const schemaRegistryTxHash = schemaRegistryResponse.DeployContractEASSchemaRegistry.transactionHash;\n\n // Wait for Schema Registry deployment and get contract address\n const schemaRegistryTransaction = await waitForTransactionReceipt(schemaRegistryTxHash as Hex, {\n portalGraphqlEndpoint: this.options.instance,\n accessToken: this.options.accessToken,\n timeout: 60_000,\n });\n\n if (!schemaRegistryTransaction?.receipt?.contractAddress) {\n throw new Error(\"Schema Registry deployment failed - could not get contract address from transaction receipt.\");\n }\n\n const schemaRegistryAddress = schemaRegistryTransaction.receipt.contractAddress;\n\n // Deploy EAS contract with correct Schema Registry address\n const easResponse = await this.portalClient.request(GraphQLOperations.mutations.deployEAS(this.portalGraphql), {\n from: deployerAddress,\n constructorArguments: {\n registry: schemaRegistryAddress,\n forwarder: defaultForwarder,\n },\n gasLimit: defaultGasLimit,\n });\n if (!easResponse.DeployContractEAS?.transactionHash) {\n throw new Error(\"EAS deployment failed - no transaction hash returned\");\n }\n\n const easTxHash = easResponse.DeployContractEAS.transactionHash as Hex;\n\n // Wait for EAS deployment and get contract address\n const easTransaction = await waitForTransactionReceipt(easTxHash, {\n portalGraphqlEndpoint: this.options.instance,\n accessToken: this.options.accessToken,\n timeout: 60_000,\n });\n\n if (!easTransaction?.receipt?.contractAddress) {\n throw new Error(\"EAS deployment failed - could not get contract address from transaction receipt.\");\n }\n const easAddress = easTransaction.receipt.contractAddress;\n\n this.deployedAddresses = {\n easAddress,\n schemaRegistryAddress,\n easTransactionHash: easTxHash as Hex,\n schemaRegistryTransactionHash: schemaRegistryTxHash as Hex,\n };\n\n return this.deployedAddresses;\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to deploy EAS contracts: ${error.message}`);\n }\n }\n\n /**\n * Register a new schema in the EAS Schema Registry\n *\n * @param request - Schema registration request containing schema definition\n * @param fromAddress - Address that will register the schema\n * @param gasLimit - Optional gas limit for the transaction (defaults to \"0x3d0900\")\n * @returns Promise resolving to transaction result\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * const schemaResult = await easClient.registerSchema(\n * {\n * schema: \"uint256 eventId, uint8 voteIndex\",\n * resolver: \"0x0000000000000000000000000000000000000000\",\n * revocable: true\n * },\n * \"0x1234567890123456789012345678901234567890\" // from address\n * );\n *\n * console.log(\"Schema registered:\", schemaResult.hash);\n * ```\n */\n public async registerSchema(\n request: SchemaRequest,\n fromAddress: Address,\n gasLimit?: string,\n ): Promise<TransactionResult> {\n const schemaRegistryAddress = this.getSchemaRegistryAddress();\n\n let schemaString = request.schema;\n if (request.fields && !schemaString) {\n schemaString = this.buildSchemaString(request.fields);\n }\n\n if (!schemaString) {\n throw new Error(\"Schema string is required. Provide either 'schema' or 'fields'.\");\n }\n\n try {\n const response = await this.portalClient.request(GraphQLOperations.mutations.registerSchema(this.portalGraphql), {\n address: schemaRegistryAddress,\n from: fromAddress,\n input: {\n schema: schemaString,\n resolver: request.resolver,\n revocable: request.revocable,\n },\n gasLimit: gasLimit || DEFAULT_GAS_LIMIT,\n });\n\n const transactionHash = response.EASSchemaRegistryRegister?.transactionHash;\n\n if (!transactionHash) {\n throw new Error(\"No transaction hash returned from Portal\");\n }\n\n return {\n hash: transactionHash as Hex,\n success: true,\n };\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to register schema: ${error.message}`);\n }\n }\n\n /**\n * Create an attestation\n *\n * @param request - Attestation request containing schema and data\n * @param fromAddress - Address that will create the attestation\n * @param gasLimit - Optional gas limit for the transaction (defaults to \"0x3d0900\")\n * @returns Promise resolving to transaction result\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * const attestationResult = await easClient.attest(\n * {\n * schema: \"0x1234567890123456789012345678901234567890123456789012345678901234\",\n * data: {\n * recipient: \"0x1234567890123456789012345678901234567890\",\n * expirationTime: BigInt(0), // No expiration\n * revocable: true,\n * refUID: \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n * data: \"0x1234\", // ABI-encoded data\n * value: BigInt(0)\n * }\n * },\n * \"0x1234567890123456789012345678901234567890\" // from address\n * );\n *\n * console.log(\"Attestation created:\", attestationResult.hash);\n * ```\n */\n public async attest(\n request: AttestationRequest,\n fromAddress: Address,\n gasLimit?: string,\n ): Promise<TransactionResult> {\n const easAddress = this.getEASAddress();\n\n try {\n const response = await this.portalClient.request(GraphQLOperations.mutations.attest(this.portalGraphql), {\n address: easAddress,\n from: fromAddress,\n input: {\n request: {\n schema: request.schema,\n data: {\n recipient: request.data.recipient,\n expirationTime: request.data.expirationTime.toString(),\n revocable: request.data.revocable,\n refUID: request.data.refUID,\n data: request.data.data,\n value: request.data.value?.toString() || \"0\",\n },\n },\n },\n gasLimit: gasLimit || DEFAULT_GAS_LIMIT,\n });\n\n const transactionHash = response.EASAttest?.transactionHash;\n\n if (!transactionHash) {\n throw new Error(\"No transaction hash returned from Portal\");\n }\n\n return {\n hash: transactionHash as Hex,\n success: true,\n };\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to create attestation: ${error.message}`);\n }\n }\n\n /**\n * Create multiple attestations in a single transaction\n *\n * @param requests - Array of attestation requests\n * @param fromAddress - Address that will create the attestations\n * @param gasLimit - Optional gas limit for the transaction (defaults to \"0x3d0900\")\n * @returns Promise resolving to transaction result\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * const multiAttestResult = await easClient.multiAttest(\n * [\n * {\n * schema: \"0x1234567890123456789012345678901234567890123456789012345678901234\",\n * data: {\n * recipient: \"0x1234567890123456789012345678901234567890\",\n * expirationTime: BigInt(0),\n * revocable: true,\n * refUID: \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n * data: \"0x1234\",\n * value: BigInt(0)\n * }\n * },\n * {\n * schema: \"0x5678901234567890123456789012345678901234567890123456789012345678\",\n * data: {\n * recipient: \"0x5678901234567890123456789012345678901234\",\n * expirationTime: BigInt(0),\n * revocable: false,\n * refUID: \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n * data: \"0x5678\",\n * value: BigInt(0)\n * }\n * }\n * ],\n * \"0x1234567890123456789012345678901234567890\" // from address\n * );\n *\n * console.log(\"Multiple attestations created:\", multiAttestResult.hash);\n * ```\n */\n public async multiAttest(\n requests: AttestationRequest[],\n fromAddress: Address,\n gasLimit?: string,\n ): Promise<TransactionResult> {\n if (requests.length === 0) {\n throw new Error(\"At least one attestation request is required\");\n }\n\n const easAddress = this.getEASAddress();\n\n try {\n const response = await this.portalClient.request(GraphQLOperations.mutations.multiAttest(this.portalGraphql), {\n address: easAddress,\n from: fromAddress,\n input: {\n multiRequests: requests.map((req) => ({\n schema: req.schema,\n data: [\n {\n recipient: req.data.recipient,\n expirationTime: req.data.expirationTime.toString(),\n revocable: req.data.revocable,\n refUID: req.data.refUID,\n data: req.data.data,\n value: req.data.value?.toString() || \"0\",\n },\n ],\n })),\n },\n gasLimit: gasLimit || DEFAULT_GAS_LIMIT,\n });\n\n const transactionHash = response.EASMultiAttest?.transactionHash;\n\n if (!transactionHash) {\n throw new Error(\"No transaction hash returned from Portal\");\n }\n\n return {\n hash: transactionHash as Hex,\n success: true,\n };\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to create multiple attestations: ${error.message}`);\n }\n }\n\n /**\n * Revoke an existing attestation\n *\n * @param schemaUID - UID of the schema used for the attestation\n * @param attestationUID - UID of the attestation to revoke\n * @param fromAddress - Address that will revoke the attestation\n * @param value - Optional ETH value to send with the revocation\n * @param gasLimit - Optional gas limit for the transaction (defaults to \"0x3d0900\")\n * @returns Promise resolving to transaction result\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * const revokeResult = await easClient.revoke(\n * \"0x1234567890123456789012345678901234567890123456789012345678901234\", // schema UID\n * \"0x5678901234567890123456789012345678901234567890123456789012345678\", // attestation UID\n * \"0x1234567890123456789012345678901234567890\", // from address\n * BigInt(0) // value (optional)\n * );\n *\n * console.log(\"Attestation revoked:\", revokeResult.hash);\n * ```\n */\n public async revoke(\n schemaUID: Hex,\n attestationUID: Hex,\n fromAddress: Address,\n value?: bigint,\n gasLimit?: string,\n ): Promise<TransactionResult> {\n try {\n const response = await this.portalClient.request(GraphQLOperations.mutations.revoke(this.portalGraphql), {\n address: this.getEASAddress(),\n from: fromAddress,\n input: {\n request: {\n schema: schemaUID,\n data: {\n uid: attestationUID,\n value: value?.toString() || \"0\",\n },\n },\n },\n gasLimit: gasLimit || DEFAULT_GAS_LIMIT,\n });\n\n const transactionHash = response.EASRevoke?.transactionHash;\n\n if (!transactionHash) {\n throw new Error(\"No transaction hash returned from Portal\");\n }\n\n return {\n hash: transactionHash as Hex,\n success: true,\n };\n } catch (err) {\n const error = err as Error;\n throw new Error(`Failed to revoke attestation: ${error.message}`);\n }\n }\n\n /**\n * Get a schema by UID\n *\n * TODO: Implement using The Graph subgraph for EAS data queries\n */\n public async getSchema(uid: Hex): Promise<SchemaData> {\n throw new Error(\n `Schema queries not implemented yet. Use The Graph subgraph for reading schema data. Schema UID: ${uid}`,\n );\n }\n\n /**\n * Get all schemas with pagination\n *\n * TODO: Implement using The Graph subgraph for EAS data queries\n */\n public async getSchemas(_options?: GetSchemasOptions): Promise<SchemaData[]> {\n throw new Error(\"Schema listing not implemented yet. Use The Graph subgraph for reading schema data.\");\n }\n\n /**\n * Get an attestation by UID\n *\n * TODO: Implement using The Graph subgraph for EAS data queries\n */\n public async getAttestation(uid: Hex): Promise<AttestationInfo> {\n throw new Error(\n `Attestation queries not implemented yet. Use The Graph subgraph for reading attestation data. Attestation UID: ${uid}`,\n );\n }\n\n /**\n * Get attestations with pagination and filtering\n *\n * TODO: Implement using The Graph subgraph for EAS data queries\n */\n public async getAttestations(_options?: GetAttestationsOptions): Promise<AttestationInfo[]> {\n throw new Error(\"Attestation listing not implemented yet. Use The Graph subgraph for reading attestation data.\");\n }\n\n /**\n * Check if an attestation is valid\n *\n * TODO: Implement using The Graph subgraph for EAS data queries\n */\n public async isValidAttestation(_uid: Hex): Promise<boolean> {\n return false;\n }\n\n /**\n * Get the current timestamp from the contract\n *\n * TODO: Fix Portal GraphQL query parameter encoding or use The Graph subgraph\n */\n public async getTimestamp(): Promise<bigint> {\n throw new Error(\"Timestamp query not implemented yet. Fix Portal query parameters or use The Graph subgraph.\");\n }\n\n /**\n * Get client configuration\n */\n public getOptions(): EASClientOptions {\n return { ...this.options };\n }\n\n /**\n * Get the Portal client instance for advanced operations\n */\n public getPortalClient(): PortalClient[\"client\"] {\n return this.portalClient;\n }\n\n /**\n * Get current contract addresses\n */\n public getContractAddresses(): { easAddress?: Address; schemaRegistryAddress?: Address } {\n return {\n easAddress: this.options.easContractAddress || this.deployedAddresses?.easAddress,\n schemaRegistryAddress:\n this.options.schemaRegistryContractAddress || this.deployedAddresses?.schemaRegistryAddress,\n };\n }\n\n private getEASAddress(): Address {\n if (this.options.easContractAddress) {\n return this.options.easContractAddress;\n }\n if (this.deployedAddresses?.easAddress) {\n return this.deployedAddresses.easAddress;\n }\n throw new Error(\"EAS contract address not available. Please provide it in options or deploy contracts first.\");\n }\n\n private getSchemaRegistryAddress(): Address {\n if (this.options.schemaRegistryContractAddress) {\n return this.options.schemaRegistryContractAddress;\n }\n if (this.deployedAddresses?.schemaRegistryAddress) {\n return this.deployedAddresses.schemaRegistryAddress;\n }\n throw new Error(\n \"Schema Registry contract address not available. Please provide it in options or deploy contracts first.\",\n );\n }\n\n private buildSchemaString(fields: SchemaField[]): string {\n return fields.map((field) => `${field.type} ${field.name}`).join(\", \");\n }\n}\n\n/**\n * Create an EAS client instance\n *\n * @param options - Configuration options for the EAS client\n * @returns EAS client instance\n *\n * @example\n * ```typescript\n * import { createEASClient } from \"@settlemint/sdk-eas\";\n *\n * const easClient = createEASClient({\n * instance: \"https://your-portal-instance.settlemint.com\",\n * accessToken: \"your-access-token\"\n * });\n *\n * // Use the client\n * const deployment = await easClient.deploy(\"0x1234...deployer-address\");\n * ```\n */\nexport function createEASClient(options: EASClientOptions): EASClient {\n return new EASClient(options);\n}\n\n// Re-export GraphQL operations for advanced usage\nexport { GraphQLOperations } from \"./portal/operations.js\";\n// Re-export types and constants\nexport type {\n AttestationData,\n AttestationInfo,\n AttestationRequest,\n DeploymentResult,\n EASClientOptions,\n EASFieldType,\n GetAttestationsOptions,\n GetSchemasOptions,\n RegisterSchemaOptions,\n SchemaData,\n SchemaField,\n SchemaRequest,\n TransactionResult,\n} from \"./schema.js\";\nexport { EAS_FIELD_TYPES, ZERO_ADDRESS, ZERO_BYTES32 } from \"./schema.js\";\n// Re-export validation utilities\nexport { EASClientOptionsSchema } from \"./utils/validation.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,oBAAoB,EAC/B,WAAW;CACT,sBAAsB,CAACA,YACrB,SAAS;;;;;;;;;WASJ;CAEP,WAAW,CAACA,YACV,SAAS;;;;;WAKJ;CAEP,gBAAgB,CAACA,YACf,SAAS;;;;;;;;;;WAUJ;CAEP,QAAQ,CAACA,YACP,SAAS;;;;;WAKJ;CAEP,aAAa,CAACA,YACZ,SAAS;;;;;WAKJ;CAEP,QAAQ,CAACA,YACP,SAAS;;;;;WAKJ;AACR,EACF;;;;;;;ACtDD,MAAa,eAAeC;AAC5B,MAAa,eAAe;;;;;AAM5B,MAAa,kBAAkB;CAC7B,QAAQ;CACR,SAAS;CACT,MAAM;CACN,OAAO;CACP,SAAS;CACT,SAAS;CACT,QAAQ;CACR,OAAO;CACP,MAAM;AACP;;;;ACpBD,MAAM,mBAAmB,MAAE,OACzB,CAAC,eAAe,QAAQ,YAAY,oBAAU,IAAI,EAClD,2BACD;;;;AAKD,MAAa,yBAAyB,MAAE,OAAO;CAI7C,UAAUC;CAIV,aAAa,+DAA6B,UAAU;CAIpD,oBAAoB,iBAAiB,UAAU;CAI/C,+BAA+B,iBAAiB,UAAU;CAI1D,OAAO,MAAE,SAAS,CAAC,UAAU;AAC9B,EAAC;;;;ACXF,MAAM,SAAS,kDAAc;AAE7B,MAAM,oBAA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B;;;;CAKD,AAAO,kBAA0C;AAC/C,SAAO,KAAK;CACb;;;;CAKD,AAAO,uBAAkF;AACvF,SAAO;GACL,YAAY,KAAK,QAAQ,sBAAsB,KAAK,mBAAmB;GACvE,uBACE,KAAK,QAAQ,iCAAiC,KAAK,mBAAmB;EACzE;CACF;CAED,AAAQ,gBAAyB;AAC/B,MAAI,KAAK,QAAQ,oBAAoB;AACnC,UAAO,KAAK,QAAQ;EACrB;AACD,MAAI,KAAK,mBAAmB,YAAY;AACtC,UAAO,KAAK,kBAAkB;EAC/B;AACD,QAAM,IAAI,MAAM;CACjB;CAED,AAAQ,2BAAoC;AAC1C,MAAI,KAAK,QAAQ,+BAA+B;AAC9C,UAAO,KAAK,QAAQ;EACrB;AACD,MAAI,KAAK,mBAAmB,uBAAuB;AACjD,UAAO,KAAK,kBAAkB;EAC/B;AACD,QAAM,IAAI,MACR;CAEH;CAED,AAAQ,kBAAkBC,QAA+B;AACvD,SAAO,OAAO,IAAI,CAAC,WAAW,EAAE,MAAM,KAAK,GAAG,MAAM,KAAK,EAAE,CAAC,KAAK,KAAK;CACvE;AACF;;;;;;;;;;;;;;;;;;;;AAqBD,SAAgB,gBAAgBf,SAAsC;AACpE,QAAO,IAAI,UAAU;AACtB"}
|
package/dist/eas.d.cts
CHANGED
|
@@ -4096,56 +4096,6 @@ declare const GraphQLOperations: {
|
|
|
4096
4096
|
address: string;
|
|
4097
4097
|
}, void>;
|
|
4098
4098
|
};
|
|
4099
|
-
queries: {
|
|
4100
|
-
getSchema: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
|
|
4101
|
-
EASSchemaRegistry: {
|
|
4102
|
-
getSchema: {
|
|
4103
|
-
uid: string | null;
|
|
4104
|
-
resolver: string | null;
|
|
4105
|
-
revocable: boolean | null;
|
|
4106
|
-
schema: string | null;
|
|
4107
|
-
} | null;
|
|
4108
|
-
} | null;
|
|
4109
|
-
}, {
|
|
4110
|
-
uid: string;
|
|
4111
|
-
address: string;
|
|
4112
|
-
}, void>;
|
|
4113
|
-
getAttestation: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
|
|
4114
|
-
EAS: {
|
|
4115
|
-
getAttestation: {
|
|
4116
|
-
uid: string | null;
|
|
4117
|
-
schema: string | null;
|
|
4118
|
-
attester: string | null;
|
|
4119
|
-
recipient: string | null;
|
|
4120
|
-
time: string | null;
|
|
4121
|
-
expirationTime: string | null;
|
|
4122
|
-
revocable: boolean | null;
|
|
4123
|
-
refUID: string | null;
|
|
4124
|
-
data: string | null;
|
|
4125
|
-
revocationTime: string | null;
|
|
4126
|
-
} | null;
|
|
4127
|
-
} | null;
|
|
4128
|
-
}, {
|
|
4129
|
-
uid: string;
|
|
4130
|
-
address: string;
|
|
4131
|
-
}, void>;
|
|
4132
|
-
isAttestationValid: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
|
|
4133
|
-
EAS: {
|
|
4134
|
-
isAttestationValid: boolean | null;
|
|
4135
|
-
} | null;
|
|
4136
|
-
}, {
|
|
4137
|
-
uid: string;
|
|
4138
|
-
address: string;
|
|
4139
|
-
}, void>;
|
|
4140
|
-
getTimestamp: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
|
|
4141
|
-
EAS: {
|
|
4142
|
-
getTimestamp: string | null;
|
|
4143
|
-
} | null;
|
|
4144
|
-
}, {
|
|
4145
|
-
data: string;
|
|
4146
|
-
address: string;
|
|
4147
|
-
}, void>;
|
|
4148
|
-
};
|
|
4149
4099
|
};
|
|
4150
4100
|
//#endregion
|
|
4151
4101
|
//#region src/eas.d.ts
|
|
@@ -4352,39 +4302,40 @@ declare class EASClient {
|
|
|
4352
4302
|
revoke(schemaUID: Hex, attestationUID: Hex, fromAddress: Address, value?: bigint, gasLimit?: string): Promise<TransactionResult>;
|
|
4353
4303
|
/**
|
|
4354
4304
|
* Get a schema by UID
|
|
4305
|
+
*
|
|
4306
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
4355
4307
|
*/
|
|
4356
4308
|
getSchema(uid: Hex): Promise<SchemaData>;
|
|
4357
4309
|
/**
|
|
4358
4310
|
* Get all schemas with pagination
|
|
4359
4311
|
*
|
|
4360
|
-
*
|
|
4361
|
-
* as Portal's direct contract queries don't support listing all schemas.
|
|
4362
|
-
* Consider using getSchema() for individual schema lookups.
|
|
4312
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
4363
4313
|
*/
|
|
4364
4314
|
getSchemas(_options?: GetSchemasOptions): Promise<SchemaData[]>;
|
|
4365
4315
|
/**
|
|
4366
4316
|
* Get an attestation by UID
|
|
4317
|
+
*
|
|
4318
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
4367
4319
|
*/
|
|
4368
4320
|
getAttestation(uid: Hex): Promise<AttestationInfo>;
|
|
4369
4321
|
/**
|
|
4370
4322
|
* Get attestations with pagination and filtering
|
|
4371
4323
|
*
|
|
4372
|
-
*
|
|
4373
|
-
* as Portal's direct contract queries don't support listing all attestations.
|
|
4374
|
-
* Consider using getAttestation() for individual attestation lookups.
|
|
4324
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
4375
4325
|
*/
|
|
4376
4326
|
getAttestations(_options?: GetAttestationsOptions): Promise<AttestationInfo[]>;
|
|
4377
4327
|
/**
|
|
4378
4328
|
* Check if an attestation is valid
|
|
4329
|
+
*
|
|
4330
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
4379
4331
|
*/
|
|
4380
|
-
isValidAttestation(
|
|
4332
|
+
isValidAttestation(_uid: Hex): Promise<boolean>;
|
|
4381
4333
|
/**
|
|
4382
|
-
* Get the timestamp
|
|
4334
|
+
* Get the current timestamp from the contract
|
|
4383
4335
|
*
|
|
4384
|
-
*
|
|
4385
|
-
* @returns The timestamp when the data was timestamped
|
|
4336
|
+
* TODO: Fix Portal GraphQL query parameter encoding or use The Graph subgraph
|
|
4386
4337
|
*/
|
|
4387
|
-
getTimestamp(
|
|
4338
|
+
getTimestamp(): Promise<bigint>;
|
|
4388
4339
|
/**
|
|
4389
4340
|
* Get client configuration
|
|
4390
4341
|
*/
|
package/dist/eas.d.ts
CHANGED
|
@@ -4096,56 +4096,6 @@ declare const GraphQLOperations: {
|
|
|
4096
4096
|
address: string;
|
|
4097
4097
|
}, void>;
|
|
4098
4098
|
};
|
|
4099
|
-
queries: {
|
|
4100
|
-
getSchema: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
|
|
4101
|
-
EASSchemaRegistry: {
|
|
4102
|
-
getSchema: {
|
|
4103
|
-
uid: string | null;
|
|
4104
|
-
resolver: string | null;
|
|
4105
|
-
revocable: boolean | null;
|
|
4106
|
-
schema: string | null;
|
|
4107
|
-
} | null;
|
|
4108
|
-
} | null;
|
|
4109
|
-
}, {
|
|
4110
|
-
uid: string;
|
|
4111
|
-
address: string;
|
|
4112
|
-
}, void>;
|
|
4113
|
-
getAttestation: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
|
|
4114
|
-
EAS: {
|
|
4115
|
-
getAttestation: {
|
|
4116
|
-
uid: string | null;
|
|
4117
|
-
schema: string | null;
|
|
4118
|
-
attester: string | null;
|
|
4119
|
-
recipient: string | null;
|
|
4120
|
-
time: string | null;
|
|
4121
|
-
expirationTime: string | null;
|
|
4122
|
-
revocable: boolean | null;
|
|
4123
|
-
refUID: string | null;
|
|
4124
|
-
data: string | null;
|
|
4125
|
-
revocationTime: string | null;
|
|
4126
|
-
} | null;
|
|
4127
|
-
} | null;
|
|
4128
|
-
}, {
|
|
4129
|
-
uid: string;
|
|
4130
|
-
address: string;
|
|
4131
|
-
}, void>;
|
|
4132
|
-
isAttestationValid: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
|
|
4133
|
-
EAS: {
|
|
4134
|
-
isAttestationValid: boolean | null;
|
|
4135
|
-
} | null;
|
|
4136
|
-
}, {
|
|
4137
|
-
uid: string;
|
|
4138
|
-
address: string;
|
|
4139
|
-
}, void>;
|
|
4140
|
-
getTimestamp: (graphql: PortalClient["graphql"]) => gql_tada0.TadaDocumentNode<{
|
|
4141
|
-
EAS: {
|
|
4142
|
-
getTimestamp: string | null;
|
|
4143
|
-
} | null;
|
|
4144
|
-
}, {
|
|
4145
|
-
data: string;
|
|
4146
|
-
address: string;
|
|
4147
|
-
}, void>;
|
|
4148
|
-
};
|
|
4149
4099
|
};
|
|
4150
4100
|
//#endregion
|
|
4151
4101
|
//#region src/eas.d.ts
|
|
@@ -4352,39 +4302,40 @@ declare class EASClient {
|
|
|
4352
4302
|
revoke(schemaUID: Hex, attestationUID: Hex, fromAddress: Address, value?: bigint, gasLimit?: string): Promise<TransactionResult>;
|
|
4353
4303
|
/**
|
|
4354
4304
|
* Get a schema by UID
|
|
4305
|
+
*
|
|
4306
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
4355
4307
|
*/
|
|
4356
4308
|
getSchema(uid: Hex): Promise<SchemaData>;
|
|
4357
4309
|
/**
|
|
4358
4310
|
* Get all schemas with pagination
|
|
4359
4311
|
*
|
|
4360
|
-
*
|
|
4361
|
-
* as Portal's direct contract queries don't support listing all schemas.
|
|
4362
|
-
* Consider using getSchema() for individual schema lookups.
|
|
4312
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
4363
4313
|
*/
|
|
4364
4314
|
getSchemas(_options?: GetSchemasOptions): Promise<SchemaData[]>;
|
|
4365
4315
|
/**
|
|
4366
4316
|
* Get an attestation by UID
|
|
4317
|
+
*
|
|
4318
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
4367
4319
|
*/
|
|
4368
4320
|
getAttestation(uid: Hex): Promise<AttestationInfo>;
|
|
4369
4321
|
/**
|
|
4370
4322
|
* Get attestations with pagination and filtering
|
|
4371
4323
|
*
|
|
4372
|
-
*
|
|
4373
|
-
* as Portal's direct contract queries don't support listing all attestations.
|
|
4374
|
-
* Consider using getAttestation() for individual attestation lookups.
|
|
4324
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
4375
4325
|
*/
|
|
4376
4326
|
getAttestations(_options?: GetAttestationsOptions): Promise<AttestationInfo[]>;
|
|
4377
4327
|
/**
|
|
4378
4328
|
* Check if an attestation is valid
|
|
4329
|
+
*
|
|
4330
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
4379
4331
|
*/
|
|
4380
|
-
isValidAttestation(
|
|
4332
|
+
isValidAttestation(_uid: Hex): Promise<boolean>;
|
|
4381
4333
|
/**
|
|
4382
|
-
* Get the timestamp
|
|
4334
|
+
* Get the current timestamp from the contract
|
|
4383
4335
|
*
|
|
4384
|
-
*
|
|
4385
|
-
* @returns The timestamp when the data was timestamped
|
|
4336
|
+
* TODO: Fix Portal GraphQL query parameter encoding or use The Graph subgraph
|
|
4386
4337
|
*/
|
|
4387
|
-
getTimestamp(
|
|
4338
|
+
getTimestamp(): Promise<bigint>;
|
|
4388
4339
|
/**
|
|
4389
4340
|
* Get client configuration
|
|
4390
4341
|
*/
|
package/dist/eas.js
CHANGED
|
@@ -6,9 +6,8 @@ import { isAddress, zeroAddress } from "viem";
|
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
|
|
8
8
|
//#region src/portal/operations.ts
|
|
9
|
-
const GraphQLOperations = {
|
|
10
|
-
|
|
11
|
-
deploySchemaRegistry: (graphql) => graphql(`
|
|
9
|
+
const GraphQLOperations = { mutations: {
|
|
10
|
+
deploySchemaRegistry: (graphql) => graphql(`
|
|
12
11
|
mutation DeployContractEASSchemaRegistry(
|
|
13
12
|
$from: String!
|
|
14
13
|
$constructorArguments: DeployContractEASSchemaRegistryInput!
|
|
@@ -18,13 +17,13 @@ const GraphQLOperations = {
|
|
|
18
17
|
transactionHash
|
|
19
18
|
}
|
|
20
19
|
}`),
|
|
21
|
-
|
|
20
|
+
deployEAS: (graphql) => graphql(`
|
|
22
21
|
mutation DeployContractEAS($from: String!, $constructorArguments: DeployContractEASInput!, $gasLimit: String!) {
|
|
23
22
|
DeployContractEAS(from: $from, constructorArguments: $constructorArguments, gasLimit: $gasLimit) {
|
|
24
23
|
transactionHash
|
|
25
24
|
}
|
|
26
25
|
}`),
|
|
27
|
-
|
|
26
|
+
registerSchema: (graphql) => graphql(`
|
|
28
27
|
mutation EASSchemaRegistryRegister(
|
|
29
28
|
$address: String!
|
|
30
29
|
$from: String!
|
|
@@ -35,68 +34,25 @@ const GraphQLOperations = {
|
|
|
35
34
|
transactionHash
|
|
36
35
|
}
|
|
37
36
|
}`),
|
|
38
|
-
|
|
37
|
+
attest: (graphql) => graphql(`
|
|
39
38
|
mutation EASAttest($address: String!, $from: String!, $input: EASAttestInput!, $gasLimit: String!) {
|
|
40
39
|
EASAttest(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {
|
|
41
40
|
transactionHash
|
|
42
41
|
}
|
|
43
42
|
}`),
|
|
44
|
-
|
|
43
|
+
multiAttest: (graphql) => graphql(`
|
|
45
44
|
mutation EASMultiAttest($address: String!, $from: String!, $input: EASMultiAttestInput!, $gasLimit: String!) {
|
|
46
45
|
EASMultiAttest(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {
|
|
47
46
|
transactionHash
|
|
48
47
|
}
|
|
49
48
|
}`),
|
|
50
|
-
|
|
49
|
+
revoke: (graphql) => graphql(`
|
|
51
50
|
mutation EASRevoke($address: String!, $from: String!, $input: EASRevokeInput!, $gasLimit: String!) {
|
|
52
51
|
EASRevoke(address: $address, from: $from, input: $input, gasLimit: $gasLimit) {
|
|
53
52
|
transactionHash
|
|
54
53
|
}
|
|
55
54
|
}`)
|
|
56
|
-
|
|
57
|
-
queries: {
|
|
58
|
-
getSchema: (graphql) => graphql(`
|
|
59
|
-
query EASSchemaRegistryGetSchema($address: String!, $uid: String!) {
|
|
60
|
-
EASSchemaRegistry(address: $address) {
|
|
61
|
-
getSchema(uid: $uid) {
|
|
62
|
-
uid
|
|
63
|
-
resolver
|
|
64
|
-
revocable
|
|
65
|
-
schema
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}`),
|
|
69
|
-
getAttestation: (graphql) => graphql(`
|
|
70
|
-
query EASGetAttestation($address: String!, $uid: String!) {
|
|
71
|
-
EAS(address: $address) {
|
|
72
|
-
getAttestation(uid: $uid) {
|
|
73
|
-
uid
|
|
74
|
-
schema
|
|
75
|
-
attester
|
|
76
|
-
recipient
|
|
77
|
-
time
|
|
78
|
-
expirationTime
|
|
79
|
-
revocable
|
|
80
|
-
refUID
|
|
81
|
-
data
|
|
82
|
-
revocationTime
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}`),
|
|
86
|
-
isAttestationValid: (graphql) => graphql(`
|
|
87
|
-
query EASIsAttestationValid($address: String!, $uid: String!) {
|
|
88
|
-
EAS(address: $address) {
|
|
89
|
-
isAttestationValid(uid: $uid)
|
|
90
|
-
}
|
|
91
|
-
}`),
|
|
92
|
-
getTimestamp: (graphql) => graphql(`
|
|
93
|
-
query EASGetTimestamp($address: String!, $data: String!) {
|
|
94
|
-
EAS(address: $address) {
|
|
95
|
-
getTimestamp(data: $data)
|
|
96
|
-
}
|
|
97
|
-
}`)
|
|
98
|
-
}
|
|
99
|
-
};
|
|
55
|
+
} };
|
|
100
56
|
|
|
101
57
|
//#endregion
|
|
102
58
|
//#region src/schema.ts
|
|
@@ -527,118 +483,51 @@ var EASClient = class {
|
|
|
527
483
|
}
|
|
528
484
|
/**
|
|
529
485
|
* Get a schema by UID
|
|
486
|
+
*
|
|
487
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
530
488
|
*/
|
|
531
489
|
async getSchema(uid) {
|
|
532
|
-
|
|
533
|
-
try {
|
|
534
|
-
const response = await this.portalClient.request(GraphQLOperations.queries.getSchema(this.portalGraphql), {
|
|
535
|
-
address: schemaRegistryAddress,
|
|
536
|
-
uid
|
|
537
|
-
});
|
|
538
|
-
const schemaResult = response.EASSchemaRegistry?.getSchema;
|
|
539
|
-
if (!schemaResult) {
|
|
540
|
-
throw new Error(`Schema not found: ${uid}`);
|
|
541
|
-
}
|
|
542
|
-
return {
|
|
543
|
-
uid: schemaResult.uid,
|
|
544
|
-
resolver: schemaResult.resolver,
|
|
545
|
-
revocable: Boolean(schemaResult.revocable),
|
|
546
|
-
schema: schemaResult.schema || ""
|
|
547
|
-
};
|
|
548
|
-
} catch (err) {
|
|
549
|
-
const error = err;
|
|
550
|
-
throw new Error(`Failed to get schema: ${error.message}`);
|
|
551
|
-
}
|
|
490
|
+
throw new Error(`Schema queries not implemented yet. Use The Graph subgraph for reading schema data. Schema UID: ${uid}`);
|
|
552
491
|
}
|
|
553
492
|
/**
|
|
554
493
|
* Get all schemas with pagination
|
|
555
494
|
*
|
|
556
|
-
*
|
|
557
|
-
* as Portal's direct contract queries don't support listing all schemas.
|
|
558
|
-
* Consider using getSchema() for individual schema lookups.
|
|
495
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
559
496
|
*/
|
|
560
497
|
async getSchemas(_options) {
|
|
561
|
-
throw new Error("Schema listing not implemented yet.
|
|
498
|
+
throw new Error("Schema listing not implemented yet. Use The Graph subgraph for reading schema data.");
|
|
562
499
|
}
|
|
563
500
|
/**
|
|
564
501
|
* Get an attestation by UID
|
|
502
|
+
*
|
|
503
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
565
504
|
*/
|
|
566
505
|
async getAttestation(uid) {
|
|
567
|
-
|
|
568
|
-
try {
|
|
569
|
-
const response = await this.portalClient.request(GraphQLOperations.queries.getAttestation(this.portalGraphql), {
|
|
570
|
-
address: easAddress,
|
|
571
|
-
uid
|
|
572
|
-
});
|
|
573
|
-
const attestationResult = response.EAS?.getAttestation;
|
|
574
|
-
if (!attestationResult) {
|
|
575
|
-
throw new Error(`Attestation not found: ${uid}`);
|
|
576
|
-
}
|
|
577
|
-
return {
|
|
578
|
-
uid: attestationResult.uid,
|
|
579
|
-
schema: attestationResult.schema,
|
|
580
|
-
attester: attestationResult.attester,
|
|
581
|
-
recipient: attestationResult.recipient,
|
|
582
|
-
time: attestationResult.time ? BigInt(attestationResult.time) : BigInt(0),
|
|
583
|
-
expirationTime: attestationResult.expirationTime ? BigInt(attestationResult.expirationTime) : BigInt(0),
|
|
584
|
-
revocable: Boolean(attestationResult.revocable),
|
|
585
|
-
refUID: attestationResult.refUID,
|
|
586
|
-
data: attestationResult.data,
|
|
587
|
-
value: BigInt(0)
|
|
588
|
-
};
|
|
589
|
-
} catch (err) {
|
|
590
|
-
const error = err;
|
|
591
|
-
throw new Error(`Failed to get attestation: ${error.message}`);
|
|
592
|
-
}
|
|
506
|
+
throw new Error(`Attestation queries not implemented yet. Use The Graph subgraph for reading attestation data. Attestation UID: ${uid}`);
|
|
593
507
|
}
|
|
594
508
|
/**
|
|
595
509
|
* Get attestations with pagination and filtering
|
|
596
510
|
*
|
|
597
|
-
*
|
|
598
|
-
* as Portal's direct contract queries don't support listing all attestations.
|
|
599
|
-
* Consider using getAttestation() for individual attestation lookups.
|
|
511
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
600
512
|
*/
|
|
601
513
|
async getAttestations(_options) {
|
|
602
|
-
throw new Error("Attestation listing not implemented yet.
|
|
514
|
+
throw new Error("Attestation listing not implemented yet. Use The Graph subgraph for reading attestation data.");
|
|
603
515
|
}
|
|
604
516
|
/**
|
|
605
517
|
* Check if an attestation is valid
|
|
518
|
+
*
|
|
519
|
+
* TODO: Implement using The Graph subgraph for EAS data queries
|
|
606
520
|
*/
|
|
607
|
-
async isValidAttestation(
|
|
608
|
-
|
|
609
|
-
try {
|
|
610
|
-
const response = await this.portalClient.request(GraphQLOperations.queries.isAttestationValid(this.portalGraphql), {
|
|
611
|
-
address: easAddress,
|
|
612
|
-
uid
|
|
613
|
-
});
|
|
614
|
-
return response.EAS?.isAttestationValid ?? false;
|
|
615
|
-
} catch (err) {
|
|
616
|
-
const error = err;
|
|
617
|
-
throw new Error(`Failed to check attestation validity: ${error.message}`);
|
|
618
|
-
}
|
|
521
|
+
async isValidAttestation(_uid) {
|
|
522
|
+
return false;
|
|
619
523
|
}
|
|
620
524
|
/**
|
|
621
|
-
* Get the timestamp
|
|
525
|
+
* Get the current timestamp from the contract
|
|
622
526
|
*
|
|
623
|
-
*
|
|
624
|
-
* @returns The timestamp when the data was timestamped
|
|
527
|
+
* TODO: Fix Portal GraphQL query parameter encoding or use The Graph subgraph
|
|
625
528
|
*/
|
|
626
|
-
async getTimestamp(
|
|
627
|
-
|
|
628
|
-
try {
|
|
629
|
-
const response = await this.portalClient.request(GraphQLOperations.queries.getTimestamp(this.portalGraphql), {
|
|
630
|
-
address: easAddress,
|
|
631
|
-
data
|
|
632
|
-
});
|
|
633
|
-
const timestampResult = response.EAS?.getTimestamp;
|
|
634
|
-
if (timestampResult === undefined || timestampResult === null) {
|
|
635
|
-
throw new Error(`No timestamp found for data: ${data}`);
|
|
636
|
-
}
|
|
637
|
-
return BigInt(timestampResult);
|
|
638
|
-
} catch (err) {
|
|
639
|
-
const error = err;
|
|
640
|
-
throw new Error(`Failed to get timestamp: ${error.message}`);
|
|
641
|
-
}
|
|
529
|
+
async getTimestamp() {
|
|
530
|
+
throw new Error("Timestamp query not implemented yet. Fix Portal query parameters or use The Graph subgraph.");
|
|
642
531
|
}
|
|
643
532
|
/**
|
|
644
533
|
* Get client configuration
|