@seedprotocol/publish 0.6.10 → 0.7.0
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/dist/chainConfig-BJ8C_RRz.js +1455 -0
- package/dist/chainConfig-BJ8C_RRz.js.map +1 -0
- package/dist/chainConfig-DWynbnb8.js +1455 -0
- package/dist/chainConfig-DWynbnb8.js.map +1 -0
- package/dist/chainConfig-DmuPBs3D.js +1455 -0
- package/dist/chainConfig-DmuPBs3D.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/ensureAutomationSessionKey-BVmh030S.js +84 -0
- package/dist/ensureAutomationSessionKey-BVmh030S.js.map +1 -0
- package/dist/ensureAutomationSessionKey-CxpJY_uH.js +84 -0
- package/dist/ensureAutomationSessionKey-CxpJY_uH.js.map +1 -0
- package/dist/ensureAutomationSessionKey-DwRm4YMJ.js +84 -0
- package/dist/ensureAutomationSessionKey-DwRm4YMJ.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-CmxyX_EN.js +23 -0
- package/dist/ensureModularPublishBootstrap-CmxyX_EN.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-DRFhp-O2.js +23 -0
- package/dist/ensureModularPublishBootstrap-DRFhp-O2.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-DegJnYKL.js +23 -0
- package/dist/ensureModularPublishBootstrap-DegJnYKL.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-0nKg13WN.js +47 -0
- package/dist/ensureSmartWalletThenPublish-0nKg13WN.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-BdqeUL6t.js +47 -0
- package/dist/ensureSmartWalletThenPublish-BdqeUL6t.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-BfEndtFo.js +47 -0
- package/dist/ensureSmartWalletThenPublish-BfEndtFo.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/managedAccountAdmin-ByEX_Eg2.js +28 -0
- package/dist/managedAccountAdmin-ByEX_Eg2.js.map +1 -0
- package/dist/managedAccountAdmin-DS6nniiu.js +28 -0
- package/dist/managedAccountAdmin-DS6nniiu.js.map +1 -0
- package/dist/managedAccountAdmin-DwFI-ZfE.js +28 -0
- package/dist/managedAccountAdmin-DwFI-ZfE.js.map +1 -0
- package/dist/publishAuthorization-C-XYb9Ef.js +4034 -0
- package/dist/publishAuthorization-C-XYb9Ef.js.map +1 -0
- package/dist/publishAuthorization-CG23g8w2.js +3987 -0
- package/dist/publishAuthorization-CG23g8w2.js.map +1 -0
- package/dist/publishAuthorization-CvK_coYp.js +4011 -0
- package/dist/publishAuthorization-CvK_coYp.js.map +1 -0
- package/dist/publishThirdwebClient-BQ_KnMi5.js +18 -0
- package/dist/publishThirdwebClient-BQ_KnMi5.js.map +1 -0
- package/dist/publishThirdwebClient-BmqsJCjp.js +18 -0
- package/dist/publishThirdwebClient-BmqsJCjp.js.map +1 -0
- package/dist/publishThirdwebClient-D-K2WEeM.js +18 -0
- package/dist/publishThirdwebClient-D-K2WEeM.js.map +1 -0
- package/dist/resolveRevokeAccount-9-OzXVdp.js +38 -0
- package/dist/resolveRevokeAccount-9-OzXVdp.js.map +1 -0
- package/dist/resolveRevokeAccount-CXa5XlOv.js +38 -0
- package/dist/resolveRevokeAccount-CXa5XlOv.js.map +1 -0
- package/dist/resolveRevokeAccount-QgZ6YZuS.js +38 -0
- package/dist/resolveRevokeAccount-QgZ6YZuS.js.map +1 -0
- package/dist/services/publish/actors/checking.d.ts.map +1 -1
- package/dist/services/publish/actors/createAttestations.d.ts.map +1 -1
- package/dist/services/publish/actors/createAttestationsDirectToEas.d.ts.map +1 -1
- package/dist/services/publish/actors/multiPublishReceipt.d.ts +58 -0
- package/dist/services/publish/actors/multiPublishReceipt.d.ts.map +1 -0
- package/dist/services/publish/actors/persistSeedUid.d.ts.map +1 -1
- package/dist/services/publish/actors/recordMultiPublishReceipt.d.ts +45 -0
- package/dist/services/publish/actors/recordMultiPublishReceipt.d.ts.map +1 -0
- package/dist/services/publish/helpers/getPublishUploadData.d.ts.map +1 -1
- package/dist/services/publishCost/types.d.ts +3 -1
- package/dist/services/publishCost/types.d.ts.map +1 -1
- package/dist/services/publishManager/actions/publishDone.d.ts.map +1 -1
- package/dist/services/publishManager/actions/stopAll.d.ts.map +1 -1
- package/dist/services/publishManager/actions/stopPublish.d.ts.map +1 -1
- package/dist/services/publishManager/actors/restoreFromDb.d.ts.map +1 -1
- package/dist/services/publishManager/index.d.ts +3 -3
- package/dist/services/publishManager/index.d.ts.map +1 -1
- package/dist/services/publishManager/publishLocks.d.ts +22 -0
- package/dist/services/publishManager/publishLocks.d.ts.map +1 -0
- package/dist/services/revoke/revokeAttestations.d.ts.map +1 -1
- package/dist/thirdweb.js +6 -6
- package/dist/worker-CJRUAOAn.js +69 -0
- package/dist/worker-CJRUAOAn.js.map +1 -0
- package/dist/worker-FmHZbku5.js +72 -0
- package/dist/worker-FmHZbku5.js.map +1 -0
- package/dist/worker-qoGuo876.js +69 -0
- package/dist/worker-qoGuo876.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chainConfig-DWynbnb8.js","names":[],"sources":["../src/helpers/constants.ts","../src/helpers/defaultChain.ts","../src/helpers/abi/eas.ts","../src/helpers/abi/publisher.ts","../src/helpers/abi/factory.ts","../src/helpers/abi/executor.ts","../src/helpers/abi/seedExecutorRouter.ts","../src/helpers/abi/schemaRegistry.ts","../src/errors.ts","../src/helpers/chainClient.ts","../src/helpers/contracts/index.ts","../src/helpers/easDirect.ts","../src/helpers/publishWalletRegistry.ts","../src/helpers/retryNonceTooLow.ts","../src/helpers/seedSigner.ts","../src/helpers/thirdwebChain.ts","../src/helpers/gasLog.ts","../src/helpers/adapters/thirdwebAccount.ts","../src/helpers/verifyPublishChain.ts","../src/services/revoke/revokeAttestations.ts","../src/config.ts","../src/helpers/chainConfig.ts"],"sourcesContent":["/**\n * Constants for the publish package.\n */\n/**\n * @deprecated OP Stack predeploy; wrong on non-OP chains. Use `getPublishConfig().schemaRegistryAddress`.\n */\nexport const SCHEMA_REGISTRY_ADDRESS =\n '0x4200000000000000000000000000000000000020' as const\n\n/** Schema #1 (Name a Schema) - universal UID for naming attestations */\nexport const EAS_SCHEMA_NAME_ATTESTATION_UID =\n '0x44d562ac1d7cd77e232978687fea027ace48f719cf1d58c7888e509663bb87fc' as const\n\n/**\n * Thirdweb ManagedAccount factories Seed Protocol has deployed, keyed by chain id.\n * Chains not listed here need `PublishConfig.managedAccountFactoryAddress` for managed / modular flows.\n */\nexport const MANAGED_ACCOUNT_FACTORY_ADDRESSES: Readonly<Record<number, `0x${string}`>> = {\n 11155420: '0x76f47d88bfaf670f5208911181fcdc0e160cb16d',\n}\n\n/**\n * @deprecated Optimism Sepolia only. Use `getPublishConfig().thirdwebAccountFactoryAddress`.\n */\nexport const THIRDWEB_ACCOUNT_FACTORY_ADDRESS =\n '0x76f47d88bfaf670f5208911181fcdc0e160cb16d' as const\n\n/**\n * @deprecated OP Stack predeploy; wrong on non-OP chains. Use `getPublishConfig().easContractAddress`.\n */\nexport const EAS_CONTRACT_ADDRESS =\n '0x4200000000000000000000000000000000000021' as const\n\n/**\n * Optimism Sepolia address of the deployment the **`multiPublish` ABI** was generated from.\n *\n * **Do not use as the transaction `to` for user publishes.** Runtime `multiPublish` targets the\n * publisher’s deployed ManagedAccount (non-modular), `managedAddress` (modular), or is not used\n * when attesting via direct EAS (EOA path).\n */\nexport const MULTI_PUBLISH_ABI_REFERENCE_ADDRESS_OP_SEPOLIA =\n '0xcd8c945872df8e664e55cf8885c85ea3ea8f2148' as const\n\n/**\n * @deprecated Misleading name: this is the ABI reference deployment, not a shared on-chain router.\n * Use {@link MULTI_PUBLISH_ABI_REFERENCE_ADDRESS_OP_SEPOLIA}.\n */\nexport const SEED_PROTOCOL_CONTRACT_ADDRESS_OP_SEPOLIA =\n MULTI_PUBLISH_ABI_REFERENCE_ADDRESS_OP_SEPOLIA\n\nexport const PublishMachineStates = {\n SUCCESS: 'success',\n FAILURE: 'failure',\n} as const\n\n/** States that run for a long time without snapshot changes; need periodic saves. */\nexport const LONG_RUNNING_PUBLISH_STATES = [\n 'pollingForConfirmation',\n 'uploadingData',\n 'uploadingViaBundler',\n 'uploadingViaBundlerPhase2',\n] as const\n\nexport const PERIODIC_SAVE_INTERVAL_MS = 30_000\n","import type { Chain } from 'viem'\nimport { optimismSepolia } from 'viem/chains'\n\n/** Default chain when apps omit `PublishConfig.chain`. */\nexport const DEFAULT_PUBLISH_CHAIN: Chain = optimismSepolia\n","/**\n * EAS contract ABI fragments + custom errors for revert decoding.\n */\n\nexport const EAS_ERRORS_ABI = [\n { type: 'error' as const, name: 'AccessDenied', inputs: [] },\n { type: 'error' as const, name: 'AlreadyRevoked', inputs: [] },\n { type: 'error' as const, name: 'InvalidRevocation', inputs: [] },\n { type: 'error' as const, name: 'InvalidRevocations', inputs: [] },\n { type: 'error' as const, name: 'InvalidSchema', inputs: [] },\n { type: 'error' as const, name: 'Irrevocable', inputs: [] },\n { type: 'error' as const, name: 'NotFound', inputs: [] },\n { type: 'error' as const, name: 'NotPayable', inputs: [] },\n { type: 'error' as const, name: 'InsufficientValue', inputs: [] },\n { type: 'error' as const, name: 'InvalidLength', inputs: [] },\n] as const\n\nconst attestationRequestData = [\n { name: 'recipient', type: 'address' },\n { name: 'expirationTime', type: 'uint64' },\n { name: 'revocable', type: 'bool' },\n { name: 'refUID', type: 'bytes32' },\n { name: 'data', type: 'bytes' },\n { name: 'value', type: 'uint256' },\n] as const\n\nexport const easAbi = [\n {\n type: 'function',\n name: 'attest',\n stateMutability: 'payable',\n inputs: [\n {\n name: 'request',\n type: 'tuple',\n components: [\n { name: 'schema', type: 'bytes32' },\n {\n name: 'data',\n type: 'tuple',\n components: attestationRequestData,\n },\n ],\n },\n ],\n outputs: [{ type: 'bytes32' }],\n },\n {\n type: 'function',\n name: 'multiAttest',\n stateMutability: 'payable',\n inputs: [\n {\n name: 'requests',\n type: 'tuple[]',\n components: [\n { name: 'schema', type: 'bytes32' },\n {\n name: 'data',\n type: 'tuple[]',\n components: attestationRequestData,\n },\n ],\n },\n ],\n outputs: [{ type: 'bytes32[]' }],\n },\n {\n type: 'function',\n name: 'multiRevoke',\n stateMutability: 'payable',\n inputs: [\n {\n name: 'multiRequests',\n type: 'tuple[]',\n components: [\n { name: 'schema', type: 'bytes32' },\n {\n name: 'data',\n type: 'tuple[]',\n components: [\n { name: 'uid', type: 'bytes32' },\n { name: 'value', type: 'uint256' },\n ],\n },\n ],\n },\n ],\n outputs: [],\n },\n {\n type: 'event',\n name: 'Attested',\n inputs: [\n { name: 'recipient', type: 'address', indexed: true },\n { name: 'attester', type: 'address', indexed: true },\n { name: 'uid', type: 'bytes32', indexed: false },\n { name: 'schemaUID', type: 'bytes32', indexed: true },\n ],\n },\n ...EAS_ERRORS_ABI,\n] as const\n","/** Attestation request tuple shared by multiPublish variants. */\nconst attestationDataComponents = [\n { name: 'recipient', type: 'address' },\n { name: 'expirationTime', type: 'uint64' },\n { name: 'revocable', type: 'bool' },\n { name: 'refUID', type: 'bytes32' },\n { name: 'data', type: 'bytes' },\n { name: 'value', type: 'uint256' },\n] as const\n\nconst listOfAttestationsComponents = [\n { name: 'schema', type: 'bytes32' },\n {\n name: 'data',\n type: 'tuple[]',\n components: attestationDataComponents,\n },\n] as const\n\n/**\n * `multiPublish` (selector 0x2a29fadc) on SeedProtocolExtension and SeedProtocolExecutor, which take\n * the same `PublishRequestData`: `propertiesToUpdate` names its target by `publishIndex`, the\n * target's position in `requests`.\n */\nexport const multiPublishAbi = [\n {\n type: 'function',\n name: 'multiPublish',\n stateMutability: 'payable',\n inputs: [\n {\n name: 'requests',\n type: 'tuple[]',\n components: [\n { name: 'localId', type: 'string' },\n { name: 'seedUid', type: 'bytes32' },\n { name: 'seedSchemaUid', type: 'bytes32' },\n { name: 'versionUid', type: 'bytes32' },\n { name: 'versionSchemaUid', type: 'bytes32' },\n { name: 'seedIsRevocable', type: 'bool' },\n {\n name: 'listOfAttestations',\n type: 'tuple[]',\n components: listOfAttestationsComponents,\n },\n {\n name: 'propertiesToUpdate',\n type: 'tuple[]',\n components: [\n { name: 'publishIndex', type: 'uint256' },\n { name: 'propertySchemaUid', type: 'bytes32' },\n ],\n },\n ],\n },\n ],\n outputs: [{ type: 'bytes32[]' }],\n },\n] as const\n\nexport const publisherReadWriteAbi = [\n {\n type: 'function',\n name: 'getEas',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ type: 'address' }],\n },\n {\n type: 'function',\n name: 'setEas',\n stateMutability: 'nonpayable',\n inputs: [{ name: '_eas', type: 'address' }],\n outputs: [{ type: 'string' }],\n },\n {\n type: 'function',\n name: 'isActiveSigner',\n stateMutability: 'view',\n inputs: [{ name: 'signer', type: 'address' }],\n outputs: [{ type: 'bool' }],\n },\n {\n type: 'function',\n name: 'isAdmin',\n stateMutability: 'view',\n inputs: [{ name: 'signer', type: 'address' }],\n outputs: [{ type: 'bool' }],\n },\n] as const\n\n/** Extension / ManagedAccount publisher events. */\nexport const publisherEventsAbi = [\n {\n type: 'event',\n name: 'CreatedAttestation',\n inputs: [\n {\n name: 'result',\n type: 'tuple',\n indexed: false,\n components: [\n { name: 'schemaUid', type: 'bytes32' },\n { name: 'attestationUid', type: 'bytes32' },\n ],\n },\n ],\n },\n {\n type: 'event',\n name: 'SeedPublished',\n inputs: [{ name: 'returnedDataFromEAS', type: 'bytes', indexed: false }],\n },\n] as const\n","/** Thirdweb ManagedAccount factory ABI (see `MANAGED_ACCOUNT_FACTORY_ADDRESSES` for deployments). */\nexport const managedAccountFactoryAbi = [\n {\n type: 'function',\n name: 'getAddress',\n stateMutability: 'view',\n inputs: [\n { name: '_adminSigner', type: 'address' },\n { name: '_data', type: 'bytes' },\n ],\n outputs: [{ type: 'address' }],\n },\n {\n type: 'function',\n name: 'createAccount',\n stateMutability: 'nonpayable',\n inputs: [\n { name: '_admin', type: 'address' },\n { name: '_data', type: 'bytes' },\n ],\n outputs: [{ type: 'address' }],\n },\n {\n type: 'function',\n name: 'getImplementationForFunction',\n stateMutability: 'view',\n inputs: [{ name: '_functionSelector', type: 'bytes4' }],\n outputs: [{ type: 'address' }],\n },\n] as const\n","import { multiPublishAbi } from './publisher'\n\n/**\n * Modular executor module events (0x043462…).\n * CreatedAttestation matches publisher; SeedPublished uses typed bytes32 args.\n */\nexport const executorEventsAbi = [\n {\n type: 'event',\n name: 'CreatedAttestation',\n inputs: [\n {\n name: 'result',\n type: 'tuple',\n indexed: false,\n components: [\n { name: 'schemaUid', type: 'bytes32' },\n { name: 'attestationUid', type: 'bytes32' },\n ],\n },\n ],\n },\n {\n type: 'event',\n name: 'SeedPublished',\n inputs: [\n { name: 'seedUid', type: 'bytes32', indexed: false },\n { name: 'versionUid', type: 'bytes32', indexed: false },\n ],\n },\n] as const\n\n/**\n * SeedProtocolExecutor (ERC-7579 executor module) calls and errors.\n * `multiPublish` takes the same `PublishRequestData` as the ManagedAccount extension (selector\n * 0x2a29fadc), so it shares `multiPublishAbi`'s entry.\n */\nexport const executorModuleAbi = [\n multiPublishAbi[0],\n {\n type: 'function',\n name: 'isInitialized',\n stateMutability: 'view',\n inputs: [{ name: 'account', type: 'address' }],\n outputs: [{ name: '', type: 'bool' }],\n },\n {\n type: 'function',\n name: 'getEAS',\n stateMutability: 'view',\n inputs: [{ name: 'account', type: 'address' }],\n outputs: [{ name: '', type: 'address' }],\n },\n {\n type: 'event',\n name: 'ModuleInitialized',\n inputs: [\n { name: 'account', type: 'address', indexed: true },\n { name: 'eas', type: 'address', indexed: true },\n ],\n },\n { type: 'error', name: 'AlreadyInitialized', inputs: [{ name: 'account', type: 'address' }] },\n { type: 'error', name: 'NotInitialized', inputs: [{ name: 'account', type: 'address' }] },\n { type: 'error', name: 'InvalidEASAddress', inputs: [] },\n { type: 'error', name: 'AttestationFailed', inputs: [] },\n { type: 'error', name: 'MultiAttestFailed', inputs: [] },\n] as const\n","/**\n * `SeedExecutorRouterExtension`, routed on ManagedAccounts by the factory\n * (seed-protocol contracts/SeedExecutorRouterExtension.sol). Installs the Seed executor on a\n * Router account.\n */\nexport const seedExecutorRouterAbi = [\n { type: 'function', name: 'installSeedExecutor', stateMutability: 'nonpayable', inputs: [], outputs: [] },\n {\n type: 'function',\n name: 'getSeedExecutor',\n stateMutability: 'view',\n inputs: [],\n outputs: [\n { name: 'executor', type: 'address' },\n { name: 'eas', type: 'address' },\n ],\n },\n {\n type: 'function',\n name: 'isModuleInstalled',\n stateMutability: 'view',\n inputs: [\n { name: 'moduleTypeId', type: 'uint256' },\n { name: 'module', type: 'address' },\n { name: 'additionalContext', type: 'bytes' },\n ],\n outputs: [{ name: '', type: 'bool' }],\n },\n {\n type: 'event',\n name: 'SeedExecutorInstalled',\n inputs: [{ name: 'executor', type: 'address', indexed: true }],\n },\n { type: 'error', name: 'Unauthorized', inputs: [{ name: 'caller', type: 'address' }] },\n { type: 'error', name: 'SeedExecutorAlreadyInstalled', inputs: [] },\n { type: 'error', name: 'SeedExecutorNotInstalled', inputs: [] },\n] as const\n\n/** ERC-7579 module type id for executors. */\nexport const MODULE_TYPE_EXECUTOR = 2n\n","/** EAS Schema Registry on OP Stack predeploy. */\nexport const schemaRegistryAbi = [\n {\n type: 'function',\n name: 'getSchema',\n stateMutability: 'view',\n inputs: [{ name: 'uid', type: 'bytes32' }],\n outputs: [\n {\n name: '',\n type: 'tuple',\n components: [\n { name: 'uid', type: 'bytes32' },\n { name: 'resolver', type: 'address' },\n { name: 'revocable', type: 'bool' },\n { name: 'schema', type: 'string' },\n ],\n },\n ],\n },\n {\n type: 'function',\n name: 'register',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'schema', type: 'string' },\n { name: 'resolver', type: 'address' },\n { name: 'revocable', type: 'bool' },\n ],\n outputs: [{ type: 'bytes32' }],\n },\n] as const\n","export class AttestationVerificationError extends Error {\n constructor(\n message: string,\n public readonly seedLocalId: string,\n public readonly expectedSchemas: string[],\n public readonly foundSchemas: string[],\n public readonly code: 'METADATA_PROPERTIES_MISSING' = 'METADATA_PROPERTIES_MISSING',\n ) {\n super(message)\n this.name = 'AttestationVerificationError'\n }\n}\n\nexport type ManagedAccountPublishErrorCode =\n | 'MANAGED_ACCOUNT_NOT_DEPLOYED'\n | 'MANAGED_ACCOUNT_UNAVAILABLE'\n | 'EXECUTOR_MODULE_NOT_INSTALLED'\n | 'MANAGED_ACCOUNT_SET_EAS_FAILED'\n | 'MODULAR_SIGNER_ACTIVATION_FAILED'\n | 'AUTOMATION_UNSUPPORTED_ACCOUNT'\n | 'AUTOMATION_PREFLIGHT_FAILED'\n | 'PUBLISH_PREFLIGHT_FAILED'\n | 'USEROP_FAILED_NO_REASON'\n | 'USEROP_REVERTED'\n\n/**\n * Best-effort string for RPC / thirdweb / viem failures that are not plain `Error`\n * (so logs and UIs can show the real revert or RPC reason).\n */\nexport function stringifyUnderlyingCause(u: unknown, maxLen = 700): string {\n if (u == null) return ''\n if (u instanceof Error) {\n const nested = u.cause instanceof Error ? ` | cause: ${u.cause.message}` : ''\n return (u.message + nested).slice(0, maxLen)\n }\n if (typeof u === 'object') {\n const o = u as Record<string, unknown>\n const parts: string[] = []\n if (typeof o.message === 'string') parts.push(o.message)\n if (typeof o.shortMessage === 'string') parts.push(o.shortMessage)\n if (typeof o.details === 'string') parts.push(o.details)\n if (typeof o.reason === 'string') parts.push(o.reason)\n if (parts.length) return parts.join(' | ').slice(0, maxLen)\n try {\n return JSON.stringify(u).slice(0, maxLen)\n } catch {\n return String(u).slice(0, maxLen)\n }\n }\n return String(u).slice(0, maxLen)\n}\n\n/**\n * Thrown or returned when the managed publishing account (on the publish chain) is missing,\n * unreachable, missing the executor module for the modular executor path, or EAS\n * pointer setup (`getEas` / `setEas`) fails, or modular session-signer activation fails.\n */\nexport class ManagedAccountPublishError extends Error {\n /** Original error when connection or deployment failed (avoids shadowing `Error.cause`). */\n public readonly underlyingCause?: unknown\n\n constructor(\n message: string,\n public readonly code: ManagedAccountPublishErrorCode,\n public readonly managedAddress?: string,\n underlyingCause?: unknown,\n ) {\n const extra =\n underlyingCause != null && underlyingCause !== ''\n ? ` (${stringifyUnderlyingCause(underlyingCause)})`\n : ''\n super(message + extra)\n this.name = 'ManagedAccountPublishError'\n this.underlyingCause = underlyingCause\n }\n}\n\n/** Thrown by `waitForPublishReceipt` when the transaction was mined but reverted. */\nexport class PublishTransactionRevertedError extends Error {\n constructor(\n public readonly transactionHash: string,\n /** The viem `TransactionReceipt`. */\n public readonly receipt: unknown,\n ) {\n super(`Transaction ${transactionHash} reverted.`)\n this.name = 'PublishTransactionRevertedError'\n }\n}\n\n/**\n * True when `e` is a managed-account publish error. Uses `name` + `code` as a fallback\n * when `instanceof` fails across duplicate bundled class identities.\n */\nexport function isManagedAccountPublishError(e: unknown): e is ManagedAccountPublishError {\n if (e instanceof ManagedAccountPublishError) return true\n if (typeof e !== 'object' || e === null) return false\n const o = e as { name?: string; code?: unknown }\n return o.name === 'ManagedAccountPublishError' && typeof o.code === 'string'\n}\n\nexport type Eip7702ModularAccountPublishErrorCode =\n | 'EIP7702_MODULAR_ACCOUNT_UNAVAILABLE'\n | 'EIP7702_MODULAR_NOT_UPGRADED'\n | 'EIP7702_MODULAR_DEPLOY_FAILED'\n | 'EIP7702_MODULAR_NOT_CONFIRMED'\n\n/**\n * Thrown when the in-app modular (EIP-7702) wallet is missing, not upgraded on-chain, or deploy/bootstrap failed.\n */\nexport class Eip7702ModularAccountPublishError extends Error {\n public readonly underlyingCause?: unknown\n\n constructor(\n message: string,\n public readonly code: Eip7702ModularAccountPublishErrorCode,\n public readonly modularAddress?: string,\n underlyingCause?: unknown,\n ) {\n const extra =\n underlyingCause != null && underlyingCause !== ''\n ? ` (${stringifyUnderlyingCause(underlyingCause)})`\n : ''\n super(message + extra)\n this.name = 'Eip7702ModularAccountPublishError'\n this.underlyingCause = underlyingCause\n }\n}\n\nconst eip7702ModularCodes: Eip7702ModularAccountPublishErrorCode[] = [\n 'EIP7702_MODULAR_ACCOUNT_UNAVAILABLE',\n 'EIP7702_MODULAR_NOT_UPGRADED',\n 'EIP7702_MODULAR_DEPLOY_FAILED',\n 'EIP7702_MODULAR_NOT_CONFIRMED',\n]\n\nexport function isEip7702ModularAccountPublishError(e: unknown): e is Eip7702ModularAccountPublishError {\n if (e instanceof Eip7702ModularAccountPublishError) return true\n if (typeof e !== 'object' || e === null) return false\n const o = e as { name?: string; code?: unknown }\n return (\n o.name === 'Eip7702ModularAccountPublishError' &&\n typeof o.code === 'string' &&\n (eip7702ModularCodes as string[]).includes(o.code)\n )\n}\n\n/**\n * True when the RPC/contract error indicates the account is **not** Thirdweb ModularCore\n * (no Router / `getInstalledModules`), e.g. default EIP-4337 smart accounts.\n * Includes viem \"Cannot decode zero data\" when `eth_call` returns `0x` for a missing Router view.\n */\nexport function isRouterNonModularCoreAccountError(cause: unknown): boolean {\n const msg = stringifyUnderlyingCause(cause)\n if (/Router:\\s*function does not exist/i.test(msg)) return true\n if (/Cannot decode zero data\\s*\\(\\s*[\"']0x[\"']\\s*\\)/i.test(msg)) return true\n return false\n}\n","import {\n createPublicClient,\n http,\n type Address,\n type Hex,\n type PublicClient,\n type TransactionReceipt,\n} from 'viem'\nimport { getPublishConfig } from '../config'\nimport { PublishTransactionRevertedError } from '../errors'\nimport { getPublishRpcUrl, getPublishViemChain } from './chainConfig'\n\ntype PublishPublicClient = PublicClient\n\nlet _client: PublishPublicClient | null = null\nlet _clientKey: string | null = null\n\nfunction publishRpcFetchOptions(): { headers: { 'x-secret-key': string } } | undefined {\n try {\n const secret = getPublishConfig().thirdwebSecretKey\n if (!secret) return undefined\n return { headers: { 'x-secret-key': secret } }\n } catch {\n return undefined\n }\n}\n\nfunction createPublishPublicClient(): PublishPublicClient {\n const chain = getPublishViemChain()\n const rpcUrl = getPublishRpcUrl()\n const fetchOptions = publishRpcFetchOptions()\n return createPublicClient({\n chain,\n transport: http(rpcUrl, fetchOptions ? { fetchOptions } : undefined),\n })\n}\n\n/**\n * Viem public client for reads / receipts on the configured publish chain.\n */\nexport function getPublishPublicClient(): PublishPublicClient {\n const chain = getPublishViemChain()\n const rpcUrl = getPublishRpcUrl()\n let secret = ''\n try {\n secret = getPublishConfig().thirdwebSecretKey ?? ''\n } catch {\n secret = ''\n }\n const key = `${chain.id}:${rpcUrl}:${secret ? '1' : '0'}:${secret}`\n if (!_client || _clientKey !== key) {\n _clientKey = key\n _client = createPublishPublicClient()\n }\n return _client\n}\n\n/** Reset cached client (tests). */\nexport function resetPublishPublicClient(): void {\n _client = null\n _clientKey = null\n}\n\n/**\n * Waits for `transactionHash` to be mined and returns its receipt.\n *\n * @throws PublishTransactionRevertedError when the transaction reverted. A successful receipt\n * only covers the outer transaction: for a sponsored (relayed) send, check the receipt's logs to\n * confirm the inner call did what it should.\n */\nexport async function waitForPublishReceipt(transactionHash: Hex): Promise<TransactionReceipt> {\n const receipt = await getPublishPublicClient().waitForTransactionReceipt({ hash: transactionHash })\n if (receipt.status === 'reverted') throw new PublishTransactionRevertedError(transactionHash, receipt)\n return receipt\n}\n\n/**\n * Calls `read` until `accept` passes on its result, up to `attempts` times, and returns the last\n * result either way. For reads right after a receipt: a load-balanced RPC can serve them from a\n * node that has not seen the receipt's block yet, and pinning `blockNumber` does not help there.\n */\nexport async function readUntil<T>(\n read: () => Promise<T>,\n accept: (value: T) => boolean,\n { attempts = 5, intervalMs = 2_000 }: { attempts?: number; intervalMs?: number } = {},\n): Promise<T> {\n let value = await read()\n for (let i = 1; i < attempts && !accept(value); i++) {\n await new Promise((resolve) => setTimeout(resolve, intervalMs))\n value = await read()\n }\n return value\n}\n\nexport async function isContractDeployed(address: string): Promise<boolean> {\n const code = await getPublishPublicClient().getBytecode({\n address: address as Address,\n })\n return !!code && code !== '0x'\n}\n\nexport async function getBlockTimestampMs(blockNumber: bigint): Promise<number | null> {\n try {\n const block = await getPublishPublicClient().getBlock({ blockNumber })\n if (block?.timestamp != null) return Number(block.timestamp) * 1000\n } catch {\n // ignore\n }\n return null\n}\n\nconst DEFAULT_DEPLOY_POLL_ATTEMPTS = 5\nconst DEFAULT_DEPLOY_POLL_INTERVAL_MS = 6_000\n\n/** Polls chain bytecode until the smart account is deployed or attempts are exhausted. */\nexport async function pollSmartWalletDeployed(\n smartWalletAddress: string,\n attempts: number = DEFAULT_DEPLOY_POLL_ATTEMPTS,\n intervalMs: number = DEFAULT_DEPLOY_POLL_INTERVAL_MS,\n): Promise<boolean> {\n for (let i = 0; i < attempts; i++) {\n if (await isContractDeployed(smartWalletAddress)) {\n return true\n }\n if (i < attempts - 1) {\n await new Promise<void>((resolve) => {\n setTimeout(resolve, intervalMs)\n })\n }\n }\n return false\n}\n","import {\n encodeFunctionData,\n getAbiItem,\n toFunctionSelector,\n zeroAddress,\n type Address,\n type Hex,\n} from 'viem'\nimport {\n multiPublishAbi,\n publisherReadWriteAbi,\n} from '../abi/publisher'\nimport { managedAccountFactoryAbi } from '../abi/factory'\nimport { executorModuleAbi } from '../abi/executor'\nimport { MODULE_TYPE_EXECUTOR, seedExecutorRouterAbi } from '../abi/seedExecutorRouter'\nimport { easAbi } from '../abi/eas'\nimport { schemaRegistryAbi } from '../abi/schemaRegistry'\nimport type { SeedTxRequest } from '../seedSigner'\nimport { getPublishPublicClient } from '../chainClient'\nimport { getPublishConfig, requireManagedAccountFactoryAddress } from '../../config'\n\nexport type MultiPublishRequest = {\n localId: string\n seedUid: `0x${string}`\n seedSchemaUid: `0x${string}`\n versionUid: `0x${string}`\n versionSchemaUid: `0x${string}`\n seedIsRevocable: boolean\n listOfAttestations: Array<{\n schema: `0x${string}`\n data: Array<{\n recipient: `0x${string}`\n expirationTime: bigint\n revocable: boolean\n refUID: `0x${string}`\n data: `0x${string}`\n value: bigint\n }>\n }>\n propertiesToUpdate: Array<{\n publishLocalId: string\n propertySchemaUid: `0x${string}`\n }>\n}\n\n/**\n * Resolves a request's `propertiesToUpdate` to `publishIndex`es: the position in `requests` of the\n * request whose `localId` each one names. Throws rather than guess, since the contract can't tell\n * when an index lands on the wrong request: on a duplicate `localId`, or a `publishLocalId` that is\n * missing, empty or not in `requests`.\n */\nfunction publishIndexResolver(requests: MultiPublishRequest[]) {\n const indexByLocalId = new Map<string, bigint>()\n requests.forEach((r, i) => {\n if (!r.localId) return\n if (indexByLocalId.has(r.localId)) {\n throw new Error(`multiPublish: duplicate localId \"${r.localId}\" in the batch`)\n }\n indexByLocalId.set(r.localId, BigInt(i))\n })\n return (r: MultiPublishRequest) =>\n (r.propertiesToUpdate ?? []).map((pu) => {\n if (!pu.publishLocalId) {\n throw new Error(`multiPublish: request \"${r.localId}\" has a cross-reference with no publishLocalId`)\n }\n const publishIndex = indexByLocalId.get(pu.publishLocalId)\n if (publishIndex === undefined) {\n throw new Error(\n `multiPublish: request \"${r.localId}\" cross-references localId \"${pu.publishLocalId}\", which isn't in the batch`,\n )\n }\n return { publishIndex, propertySchemaUid: pu.propertySchemaUid }\n })\n}\n\n/**\n * Encode `multiPublish` for the account's SeedProtocolExtension, mapping each `publishLocalId` to\n * its index in `requests`.\n */\nexport function encodeMultiPublish(\n to: Address,\n requests: MultiPublishRequest[],\n gas?: bigint,\n): SeedTxRequest {\n const publishIndexes = publishIndexResolver(requests)\n return {\n to,\n data: encodeFunctionData({\n abi: multiPublishAbi,\n functionName: 'multiPublish',\n args: [\n requests.map((r) => ({\n localId: r.localId,\n seedUid: r.seedUid,\n seedSchemaUid: r.seedSchemaUid,\n versionUid: r.versionUid,\n versionSchemaUid: r.versionSchemaUid,\n seedIsRevocable: r.seedIsRevocable,\n listOfAttestations: r.listOfAttestations,\n propertiesToUpdate: publishIndexes(r),\n })),\n ],\n }),\n gas,\n }\n}\n\n/**\n * Encode `multiPublish` for the SeedProtocolExecutor module, which takes the same request struct\n * as the extension: only the target differs from {@link encodeMultiPublish}.\n */\nexport function encodeExecutorMultiPublish(\n to: Address,\n requests: MultiPublishRequest[],\n gas?: bigint,\n): SeedTxRequest {\n return encodeMultiPublish(to, requests, gas)\n}\n\nexport async function readExecutorModuleIsInitialized(\n moduleAddress: Address,\n account: Address,\n): Promise<boolean> {\n return getPublishPublicClient().readContract({\n address: moduleAddress,\n abi: executorModuleAbi,\n functionName: 'isInitialized',\n args: [account],\n })\n}\n\nexport async function readExecutorModuleEas(\n moduleAddress: Address,\n account: Address,\n): Promise<Address> {\n return getPublishPublicClient().readContract({\n address: moduleAddress,\n abi: executorModuleAbi,\n functionName: 'getEAS',\n args: [account],\n })\n}\n\n/**\n * The executor and EAS pinned by the account's `SeedExecutorRouterExtension`, or `null` when the\n * account has no such extension (pre-rollout Router accounts, ModularCore accounts).\n */\nexport async function readSeedExecutorRouter(\n account: Address,\n): Promise<{ executor: Address; eas: Address } | null> {\n try {\n const [executor, eas] = await getPublishPublicClient().readContract({\n address: account,\n abi: seedExecutorRouterAbi,\n functionName: 'getSeedExecutor',\n })\n return { executor, eas }\n } catch {\n return null\n }\n}\n\n/**\n * The executor and EAS that accounts from `factory` get from their `SeedExecutorRouterExtension`,\n * or `null` when the factory routes no such extension. For checking `modularAccountModuleContract`\n * at startup instead of at the first publish. `factory` defaults to the configured factory.\n */\nexport async function readFactorySeedExecutor(\n factory: Address = requireManagedAccountFactoryAddress() as Address,\n): Promise<{ executor: Address; eas: Address } | null> {\n const client = getPublishPublicClient()\n const extension = await client.readContract({\n address: factory,\n abi: managedAccountFactoryAbi,\n functionName: 'getImplementationForFunction',\n args: [toFunctionSelector(getAbiItem({ abi: seedExecutorRouterAbi, name: 'getSeedExecutor' }))],\n })\n if (extension === zeroAddress) return null\n // The extension keeps both as immutables, so the implementation reports what accounts see.\n const [executor, eas] = await client.readContract({\n address: extension,\n abi: seedExecutorRouterAbi,\n functionName: 'getSeedExecutor',\n })\n return { executor, eas }\n}\n\n/** Whether the router extension reports `executor` installed on `account`. */\nexport async function readSeedExecutorInstalled(account: Address, executor: Address): Promise<boolean> {\n return getPublishPublicClient().readContract({\n address: account,\n abi: seedExecutorRouterAbi,\n functionName: 'isModuleInstalled',\n args: [MODULE_TYPE_EXECUTOR, executor, '0x'],\n })\n}\n\n/**\n * `installSeedExecutor()` on `account`. Admin-only: send it from the account's admin EOA\n * directly; a self-call via `execute` (what smart-account wallets send) is rejected.\n */\nexport function encodeInstallSeedExecutor(account: Address): SeedTxRequest {\n return {\n to: account,\n data: encodeFunctionData({ abi: seedExecutorRouterAbi, functionName: 'installSeedExecutor' }),\n }\n}\n\nexport function encodeSetEas(to: Address, eas: Address): SeedTxRequest {\n return {\n to,\n data: encodeFunctionData({\n abi: publisherReadWriteAbi,\n functionName: 'setEas',\n args: [eas],\n }),\n }\n}\n\nexport async function readGetEas(managedAddress: Address): Promise<Address> {\n return getPublishPublicClient().readContract({\n address: managedAddress,\n abi: publisherReadWriteAbi,\n functionName: 'getEas',\n })\n}\n\nexport async function readIsActiveSigner(\n managedAddress: Address,\n signer: Address,\n): Promise<boolean> {\n return getPublishPublicClient().readContract({\n address: managedAddress,\n abi: publisherReadWriteAbi,\n functionName: 'isActiveSigner',\n args: [signer],\n })\n}\n\nexport async function readIsAdmin(managedAddress: Address, signer: Address): Promise<boolean> {\n return getPublishPublicClient().readContract({\n address: managedAddress,\n abi: publisherReadWriteAbi,\n functionName: 'isAdmin',\n args: [signer],\n })\n}\n\nexport async function readFactoryGetAddress(\n adminSigner: Address,\n data: Hex = '0x',\n): Promise<Address> {\n return getPublishPublicClient().readContract({\n address: requireManagedAccountFactoryAddress() as Address,\n abi: managedAccountFactoryAbi,\n functionName: 'getAddress',\n args: [adminSigner, data],\n })\n}\n\nexport function encodeCreateAccount(\n admin: Address,\n data: Hex = '0x',\n): SeedTxRequest {\n return {\n to: requireManagedAccountFactoryAddress() as Address,\n data: encodeFunctionData({\n abi: managedAccountFactoryAbi,\n functionName: 'createAccount',\n args: [admin, data],\n }),\n }\n}\n\nexport type EasAttestParams = {\n schema: `0x${string}`\n data: {\n recipient?: `0x${string}`\n expirationTime?: bigint\n revocable?: boolean\n refUID: `0x${string}`\n data: `0x${string}`\n value?: bigint\n }\n}\n\nconst ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' as const\n\nexport function encodeEasAttest(params: EasAttestParams): SeedTxRequest {\n const { easContractAddress } = getPublishConfig()\n return {\n to: easContractAddress as Address,\n data: encodeFunctionData({\n abi: easAbi,\n functionName: 'attest',\n args: [\n {\n schema: params.schema,\n data: {\n recipient: (params.data.recipient ?? ZERO_ADDRESS) as Address,\n expirationTime: params.data.expirationTime ?? 0n,\n revocable: params.data.revocable ?? true,\n refUID: params.data.refUID,\n data: params.data.data,\n value: params.data.value ?? 0n,\n },\n },\n ],\n }),\n }\n}\n\nexport type MultiAttestationRequest = {\n schema: `0x${string}`\n data: Array<{\n recipient: `0x${string}`\n expirationTime: bigint\n revocable: boolean\n refUID: `0x${string}`\n data: `0x${string}`\n value: bigint\n }>\n}\n\nexport function encodeEasMultiAttest(requests: MultiAttestationRequest[]): SeedTxRequest {\n const { easContractAddress } = getPublishConfig()\n return {\n to: easContractAddress as Address,\n data: encodeFunctionData({\n abi: easAbi,\n functionName: 'multiAttest',\n args: [requests],\n }),\n }\n}\n\nexport type MultiRevocationRequest = {\n schema: `0x${string}`\n data: Array<{\n uid: `0x${string}`\n value?: bigint\n }>\n}\n\nexport function encodeEasMultiRevoke(requests: MultiRevocationRequest[]): SeedTxRequest {\n const { easContractAddress } = getPublishConfig()\n return {\n to: easContractAddress as Address,\n data: encodeFunctionData({\n abi: easAbi,\n functionName: 'multiRevoke',\n args: [\n requests.map((r) => ({\n schema: r.schema,\n data: r.data.map((d) => ({\n uid: d.uid,\n value: d.value ?? 0n,\n })),\n })),\n ],\n }),\n }\n}\n\nexport type SchemaRecord = {\n uid: string\n resolver: string\n revocable: boolean\n schema: string\n}\n\nconst ZERO_BYTES32 = '0x' + '0'.repeat(64)\n\nexport async function readSchemaRecord(uid: string): Promise<SchemaRecord | null> {\n const result = await getPublishPublicClient().readContract({\n address: getPublishConfig().schemaRegistryAddress as Address,\n abi: schemaRegistryAbi,\n functionName: 'getSchema',\n args: [uid as Hex],\n })\n if (!result || result.uid === ZERO_BYTES32) return null\n return {\n uid: result.uid,\n resolver: result.resolver,\n revocable: result.revocable,\n schema: result.schema,\n }\n}\n\nexport function encodeRegisterSchema(params: {\n schema: string\n resolverAddress: string\n revocable: boolean\n}): SeedTxRequest {\n return {\n to: getPublishConfig().schemaRegistryAddress as Address,\n data: encodeFunctionData({\n abi: schemaRegistryAbi,\n functionName: 'register',\n args: [params.schema, params.resolverAddress as Address, params.revocable],\n }),\n }\n}\n","import { encodeAbiParameters, parseEventLogs, type Log } from 'viem'\nimport { easAbi } from './abi/eas'\nimport {\n encodeEasAttest,\n encodeEasMultiAttest,\n encodeEasMultiRevoke,\n type EasAttestParams,\n type MultiAttestationRequest,\n type MultiRevocationRequest,\n} from './contracts'\nimport type { SeedTxRequest } from './seedSigner'\n\nexport type { EasAttestParams, MultiAttestationRequest, MultiRevocationRequest }\n\nconst ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' as const\nconst ZERO_BYTES32 = ('0x' + '0'.repeat(64)) as `0x${string}`\n\n/**\n * Prepares a single EAS attest call (encoded SeedTxRequest).\n */\nexport function prepareEasAttest(params: EasAttestParams): SeedTxRequest {\n return encodeEasAttest(params)\n}\n\n/**\n * Prepares an EAS multiAttest call for batch attestations.\n */\nexport function prepareEasMultiAttest(requests: MultiAttestationRequest[]): SeedTxRequest {\n return encodeEasMultiAttest(requests)\n}\n\n/**\n * Encodes a bytes32 value for Seed/Version attestation data.\n * Equivalent to Solidity abi.encode(bytes32).\n */\nexport function encodeBytes32(value: `0x${string}`): `0x${string}` {\n return encodeAbiParameters([{ type: 'bytes32' }], [value]) as `0x${string}`\n}\n\n/**\n * Extracts the attestation UID from an EAS attest transaction receipt.\n */\nexport function getAttestationUidFromReceipt(\n receipt: { logs?: Array<{ address?: string; data?: string; topics?: unknown[] }> },\n easContractAddress: string,\n): string | undefined {\n const all = getAttestedUidsFromReceipt(receipt, easContractAddress)\n return all[0]?.uid\n}\n\nexport type EasAttestedPair = { schemaUid: string; uid: string }\n\n/**\n * All `Attested` events from the EAS contract in this receipt, in log order.\n */\nexport function getAttestedUidsFromReceipt(\n receipt: { logs?: Array<{ address?: string; data?: string; topics?: unknown[] }> },\n easContractAddress: string,\n): EasAttestedPair[] {\n if (!receipt.logs?.length) return []\n const want = easContractAddress.toLowerCase()\n const logs = receipt.logs.filter((l) => l.address && l.address.toLowerCase() === want)\n if (!logs.length) return []\n try {\n const parsed = parseEventLogs({\n abi: easAbi,\n eventName: 'Attested',\n logs: logs as Log[],\n strict: false,\n })\n const out: EasAttestedPair[] = []\n for (const ev of parsed) {\n const uid = ev.args?.uid as string | undefined\n const schemaUid = ev.args?.schemaUID as string | undefined\n if (!uid || uid === ZERO_BYTES32) continue\n if (!schemaUid) continue\n out.push({ schemaUid, uid })\n }\n return out\n } catch {\n return []\n }\n}\n\n/**\n * Prepares an EAS multiRevoke call for batch revocation. Targets EAS directly; only the attester\n * (an EOA, or a ManagedAccount executing as itself) can revoke. The Seed executor module has no\n * revoke path.\n */\nexport function prepareEasMultiRevoke(requests: MultiRevocationRequest[]): SeedTxRequest {\n return encodeEasMultiRevoke(requests)\n}\n\nexport { ZERO_ADDRESS, ZERO_BYTES32 }\n","import { client as seedClient } from '@seedprotocol/sdk'\nimport type { PublishWallet, SeedSigner, SeedTxSender } from './seedSigner'\n\nexport type PublishWalletSession = PublishWallet & {\n /** Addresses to treat as owned in the Seed SDK (EOA + smart account, etc.). */\n ownedAddresses?: string[]\n /** Preferred publisher address for new seeds (defaults to signer.address). */\n publisherAddress?: string\n}\n\nlet session: PublishWalletSession | null = null\n\nfunction waitUntilSeedInitialized(): Promise<void> {\n if (seedClient.isInitialized()) return Promise.resolve()\n return new Promise((resolve) => {\n seedClient.onReady(() => resolve())\n })\n}\n\n/**\n * Register the active publish wallet (EIP-1193, ethers, Thirdweb adapter, etc.).\n * Syncs owned addresses into the Seed SDK when possible.\n */\nexport async function setPublishWallet(\n next: PublishWalletSession | null,\n): Promise<void> {\n session = next\n if (!next) return\n await waitUntilSeedInitialized()\n const owned = new Set<string>()\n for (const a of next.ownedAddresses ?? []) {\n if (a) owned.add(a.toLowerCase())\n }\n owned.add(next.signer.address.toLowerCase())\n owned.add(next.txSender.address.toLowerCase())\n if (next.publisherAddress) owned.add(next.publisherAddress.toLowerCase())\n try {\n await seedClient.setAddresses({ owned: [...owned] })\n const claimAs = next.publisherAddress ?? next.signer.address\n if (claimAs) {\n await seedClient.claimUnpublishedDrafts(claimAs)\n }\n } catch (err) {\n console.warn('[publishWalletRegistry] Failed to set seed client addresses:', err)\n }\n}\n\nexport function getPublishWallet(): PublishWalletSession | null {\n return session\n}\n\nexport function clearPublishWallet(): void {\n session = null\n}\n\n/** Convenience for callers that only need signing. */\nexport function getRegisteredSigner(): SeedSigner | null {\n return session?.signer ?? null\n}\n\n/** Convenience for callers that only need sending. */\nexport function getRegisteredTxSender(): SeedTxSender | null {\n return session?.txSender ?? null\n}\n","/** True for \"the nonce was already used\" rejections, which mean the tx was not accepted. */\nexport function isNonceTooLowError(err: unknown): boolean {\n const parts: string[] = []\n let cur: unknown = err\n for (let i = 0; cur && i < 5; i++) {\n const e = cur as { message?: unknown; shortMessage?: unknown; details?: unknown; code?: unknown; cause?: unknown }\n parts.push(String(e.message ?? ''), String(e.shortMessage ?? ''), String(e.details ?? ''), String(e.code ?? ''))\n cur = e.cause\n }\n return /nonce too low|nonce has already been used|NONCE_EXPIRED|nonce.*already.*(used|known)|lower than the current nonce/i.test(parts.join(' '))\n}\n\n/**\n * Retries `send` when the node rejects it for a stale nonce. A local fork's pending-nonce lookup\n * can trail the chain by a block, so back-to-back sends from one EOA may pick a used nonce.\n * Such a rejection means nothing was sent, so retrying cannot double-send.\n */\nexport async function retryNonceTooLow<T>(\n send: () => Promise<T>,\n { attempts = 3, delayMs = 1000 }: { attempts?: number; delayMs?: number } = {},\n): Promise<T> {\n for (let attempt = 1; ; attempt++) {\n try {\n return await send()\n } catch (err) {\n if (attempt >= attempts || !isNonceTooLowError(err)) throw err\n await new Promise((resolve) => setTimeout(resolve, delayMs))\n }\n }\n}\n","import type { Address, Hex, SignableMessage } from 'viem'\nimport { retryNonceTooLow } from './retryNonceTooLow'\nimport { ethers } from 'ethers'\n\n/** Encoded calldata ready for submission (viem path). */\nexport type SeedTxRequest = {\n to: Address\n data: Hex\n value?: bigint\n gas?: bigint\n}\n\n/**\n * Vendor-neutral key custody for Arweave DataItems and message signing.\n * Does not submit on-chain transactions.\n */\nexport interface SeedSigner {\n readonly address: Address\n\n /**\n * personal_sign. For Arweave/ANS-104 use `message: { raw: Hex | Uint8Array }`.\n * Plain string is UTF-8 prefixed hash.\n */\n signMessage(args: { message: SignableMessage }): Promise<Hex>\n}\n\n/**\n * Vendor-neutral transaction submission (EOA, AA, sponsored, etc.).\n */\nexport interface SeedTxSender {\n readonly address: Address\n\n /** Submit already-encoded calldata. */\n sendTransaction(tx: SeedTxRequest): Promise<{ transactionHash: Hex }>\n\n waitForReceipt?(transactionHash: Hex): Promise<{ status: 'success' | 'reverted' }>\n}\n\n/** Bundle used by publish / revoke flows that need both signing and sending. */\nexport type PublishWallet = {\n signer: SeedSigner\n txSender: SeedTxSender\n}\n\nconst SEED_SIGNER_BRAND = Symbol.for('seedprotocol.SeedSigner')\nconst SEED_TX_SENDER_BRAND = Symbol.for('seedprotocol.SeedTxSender')\n\ntype BrandedSeedSigner = SeedSigner & { readonly [SEED_SIGNER_BRAND]: true }\ntype BrandedSeedTxSender = SeedTxSender & { readonly [SEED_TX_SENDER_BRAND]: true }\n\nfunction brandSigner(signer: SeedSigner): SeedSigner {\n return Object.assign(signer, { [SEED_SIGNER_BRAND]: true as const }) as BrandedSeedSigner\n}\n\nfunction brandTxSender(sender: SeedTxSender): SeedTxSender {\n return Object.assign(sender, { [SEED_TX_SENDER_BRAND]: true as const }) as BrandedSeedTxSender\n}\n\nexport function isSeedSigner(value: unknown): value is SeedSigner {\n return !!value && typeof value === 'object' && SEED_SIGNER_BRAND in value\n}\n\nexport function isSeedTxSender(value: unknown): value is SeedTxSender {\n return !!value && typeof value === 'object' && SEED_TX_SENDER_BRAND in value\n}\n\nexport function isPublishWallet(value: unknown): value is PublishWallet {\n return (\n !!value &&\n typeof value === 'object' &&\n 'signer' in value &&\n 'txSender' in value &&\n isSeedSigner((value as PublishWallet).signer) &&\n isSeedTxSender((value as PublishWallet).txSender)\n )\n}\n\n/**\n * Wrap an ethers Wallet for tests / EOA scripts (signs + sends; no AA sponsorship).\n * Suitable for ANS-104 DataItem signing. Not a ManagedAccount session-key UserOp sender —\n * for automation on-chain publish, use a PublishWallet whose txSender submits UserOps\n * through the ManagedAccount (see docs/PUBLISH_AUTOMATION.md).\n */\nexport function fromEthersWallet(wallet: ethers.Wallet): PublishWallet {\n const address = wallet.address as Address\n const signer = brandSigner({\n address,\n signMessage: async ({ message }) => {\n if (typeof message === 'string') {\n return (await wallet.signMessage(message)) as Hex\n }\n const raw = message.raw\n const bytes =\n typeof raw === 'string'\n ? ethers.getBytes(raw)\n : raw instanceof Uint8Array\n ? raw\n : new Uint8Array(raw)\n return (await wallet.signMessage(bytes)) as Hex\n },\n })\n const txSender = brandTxSender({\n address,\n sendTransaction: async (tx) => {\n const result = await retryNonceTooLow(() =>\n wallet.sendTransaction({\n to: tx.to,\n data: tx.data,\n value: tx.value,\n gasLimit: tx.gas,\n }),\n )\n return { transactionHash: result.hash as Hex }\n },\n })\n return { signer, txSender }\n}\n\n/**\n * Coerce a branded SeedSigner, PublishWallet.signer, or pass-through unknown branded value.\n * Does not wrap Thirdweb Accounts — use `fromThirdwebAccount` from `@seedprotocol/publish/thirdweb`.\n */\nexport function asSeedSigner(value: SeedSigner | PublishWallet): SeedSigner {\n if (isPublishWallet(value)) return value.signer\n if (isSeedSigner(value)) return value\n throw new Error(\n '@seedprotocol/publish: expected a SeedSigner or PublishWallet. Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.',\n )\n}\n\n/** Resolve tx sender from a PublishWallet or branded SeedTxSender. */\nexport function asSeedTxSender(value: SeedTxSender | PublishWallet): SeedTxSender {\n if (isPublishWallet(value)) return value.txSender\n if (isSeedTxSender(value)) return value\n throw new Error(\n '@seedprotocol/publish: expected a SeedTxSender or PublishWallet. Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.',\n )\n}\n\n/** Prefer PublishWallet; if only a branded SeedSigner is passed, throw (tx path needs a sender). */\nexport function asPublishWallet(value: PublishWallet | SeedSigner): PublishWallet {\n if (isPublishWallet(value)) return value\n throw new Error(\n '@seedprotocol/publish: expected a PublishWallet (signer + txSender). Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.',\n )\n}\n\n/** @internal used by optional Thirdweb adapter */\nexport { brandSigner, brandTxSender }\n","import { defineChain, optimismSepolia, type Chain as ThirdwebChain } from 'thirdweb/chains'\nimport type { Chain as ViemChain } from 'viem'\nimport { getConfigRef } from '../config'\nimport { DEFAULT_PUBLISH_CHAIN } from './defaultChain'\n\nlet cached: { key: string; chain: ThirdwebChain } | null = null\n\n/**\n * Thirdweb chain matching the publish chain (`PublishConfig.chain`) and RPC (`PublishConfig.rpcUrl`).\n * All Thirdweb wallet connect / deploy / contract calls must use this instead of a fixed chain.\n *\n * With `rpcUrl` set, Thirdweb uses it too, so Seed's own reads and Thirdweb's calls always reach\n * the same node (e.g. a local fork). Without it, Thirdweb uses its RPC edge, as viem does.\n *\n * Pass `source` when the config ref may not be set yet (e.g. first React render).\n */\nexport function getPublishThirdwebChain(source?: { chain?: ViemChain; rpcUrl?: string }): ThirdwebChain {\n const ref = source ?? getConfigRef() ?? {}\n const viemChain = ref.chain ?? DEFAULT_PUBLISH_CHAIN\n const rpcUrl = ref.rpcUrl?.trim() || undefined\n const key = `${viemChain.id}|${rpcUrl ?? ''}`\n if (cached?.key === key) return cached.chain\n\n let chain: ThirdwebChain\n if (viemChain.id === optimismSepolia.id && !rpcUrl) {\n chain = optimismSepolia\n } else {\n // Without `rpc`, defineChain fills in Thirdweb's RPC edge for the chain id.\n chain = defineChain({\n id: viemChain.id,\n name: viemChain.name,\n nativeCurrency: viemChain.nativeCurrency,\n testnet: viemChain.testnet ? true : undefined,\n blockExplorers: viemChain.blockExplorers\n ? Object.values(viemChain.blockExplorers).map(({ name, url, apiUrl }) => ({ name, url, apiUrl }))\n : undefined,\n ...(rpcUrl ? { rpc: rpcUrl } : {}),\n })\n }\n cached = { key, chain }\n return chain\n}\n\nconst LOCAL_CHAIN_IDS = new Set([31337, 1337])\n\n/**\n * True for a dev chain (Anvil / Hardhat ids) or any chain reached through a loopback or `.localhost`\n * RPC, such as a fork. Thirdweb's hosted bundler, paymaster and EIP-7702 relayer cannot reach these.\n */\nexport function isLocalThirdwebChain(chain: Pick<ThirdwebChain, 'id' | 'rpc'>): boolean {\n if (LOCAL_CHAIN_IDS.has(chain.id)) return true\n try {\n const host = new URL(chain.rpc).hostname.replace(/^\\[|\\]$/g, '')\n return host === 'localhost' || host === '127.0.0.1' || host === '::1' || host.endsWith('.localhost')\n } catch {\n return false\n }\n}\n","/**\n * Console logging for UserOp gas limits, to tell whether a gas problem starts in our code or in\n * thirdweb. Filter the console on `[seed:gas]`. Bigints print as decimal strings.\n */\nexport function logGas(stage: string, data: Record<string, unknown>): void {\n const printable = Object.fromEntries(\n Object.entries(data).map(([k, v]) => [k, typeof v === 'bigint' ? v.toString() : v]),\n )\n console.info(`[seed:gas] ${stage}`, printable)\n}\n\n/** The gas fields of a UserOp (or paymaster result), with `paymasterAndData` shortened. */\nexport function gasFields(op: Record<string, any>): Record<string, unknown> {\n const pad = op.paymasterAndData as string | undefined\n return {\n callGasLimit: op.callGasLimit,\n verificationGasLimit: op.verificationGasLimit,\n preVerificationGas: op.preVerificationGas,\n ...(pad !== undefined ? { paymasterAndData: pad.length > 20 ? `${pad.slice(0, 20)}… (${(pad.length - 2) / 2} bytes)` : pad } : {}),\n }\n}\n","import { prepareTransaction, sendTransaction, type ThirdwebClient } from 'thirdweb'\nimport type { Account } from 'thirdweb/wallets'\nimport type { Address, Hex } from 'viem'\nimport {\n brandSigner,\n brandTxSender,\n isPublishWallet,\n isSeedSigner,\n type PublishWallet,\n type SeedSigner,\n} from '../seedSigner'\nimport { getPublishThirdwebChain } from '../thirdwebChain'\nimport { retryNonceTooLow } from '../retryNonceTooLow'\nimport { logGas } from '../gasLog'\n\nexport type FromThirdwebAccountOptions = {\n /**\n * Thirdweb client for `prepareTransaction`. A Thirdweb Account does not carry a client.\n * Pass the secret-key client from the server, or omit this to use `getClient()`.\n */\n client?: ThirdwebClient\n}\n\n/**\n * Wrap a Thirdweb Account so AA gas sponsorship still flows through thirdweb `sendTransaction`.\n */\nexport function fromThirdwebAccount(\n account: Account,\n options?: FromThirdwebAccountOptions,\n): PublishWallet {\n const explicitClient = options?.client\n const address = account.address as Address\n const signer = brandSigner({\n address,\n signMessage: async ({ message }) => {\n const sig = await account.signMessage({ message })\n return sig as Hex\n },\n })\n const txSender = brandTxSender({\n address,\n sendTransaction: async (tx) => {\n const client = explicitClient ?? (await import('../publishThirdwebClient')).getClient()\n const chain = getPublishThirdwebChain()\n const transaction = prepareTransaction({\n client,\n chain,\n to: tx.to,\n data: tx.data,\n value: tx.value,\n gas: tx.gas,\n })\n logGas('sending transaction through thirdweb', {\n account: address,\n chainId: chain.id,\n to: tx.to,\n dataBytes: tx.data ? (tx.data.length - 2) / 2 : 0,\n txGas: tx.gas ?? '(none: thirdweb estimates)',\n })\n // Smart accounts send UserOps (EntryPoint nonces); this only matters for plain EOAs.\n let result\n try {\n result = await retryNonceTooLow(() => sendTransaction({ account, transaction }))\n } catch (error) {\n logGas('thirdweb sendTransaction failed', {\n account: address,\n error: error instanceof Error ? error.message : String(error),\n })\n throw error\n }\n logGas('thirdweb sendTransaction returned', { account: address, transactionHash: result.transactionHash })\n return { transactionHash: result.transactionHash as Hex }\n },\n })\n return { signer, txSender }\n}\n\n/**\n * Coerce Thirdweb Account, SeedSigner, or PublishWallet to PublishWallet.\n */\nexport function asThirdwebPublishWallet(\n accountOrWallet: Account | SeedSigner | PublishWallet,\n options?: FromThirdwebAccountOptions,\n): PublishWallet {\n if (isPublishWallet(accountOrWallet)) return accountOrWallet\n if (isSeedSigner(accountOrWallet)) {\n throw new Error(\n '@seedprotocol/publish/thirdweb: SeedSigner alone cannot send sponsored txs. Pass fromThirdwebAccount(account) or a PublishWallet.',\n )\n }\n return fromThirdwebAccount(accountOrWallet, options)\n}\n\n/** @deprecated Prefer {@link asThirdwebPublishWallet}; kept for call-site migration. */\nexport function asSeedSignerFromThirdweb(\n accountOrWallet: Account | SeedSigner | PublishWallet,\n): SeedSigner {\n if (isPublishWallet(accountOrWallet)) return accountOrWallet.signer\n if (isSeedSigner(accountOrWallet)) return accountOrWallet\n return fromThirdwebAccount(accountOrWallet).signer\n}\n","import { getPublishConfig } from '../config'\nimport { getPublishPublicClient, isContractDeployed } from './chainClient'\nimport { getPublishRpcUrl } from './chainConfig'\n\n/** Thrown by {@link verifyPublishChain}; `problems` lists every check that failed. */\nexport class PublishChainConfigError extends Error {\n override name = 'PublishChainConfigError'\n constructor(\n readonly chainId: number,\n readonly problems: string[],\n ) {\n super(\n `@seedprotocol/publish: chain ${chainId} is not set up for publishing:\\n- ${problems.join('\\n- ')}`,\n )\n }\n}\n\nlet verified: { key: string; result: Promise<void> } | null = null\n\nfunction configKey(): string {\n const cfg = getPublishConfig()\n return [\n cfg.chain.id,\n getPublishRpcUrl(),\n cfg.easContractAddress,\n cfg.schemaRegistryAddress,\n cfg.thirdwebAccountFactoryAddress ?? '',\n cfg.modularAccountModuleContract ?? '',\n ]\n .join('|')\n .toLowerCase()\n}\n\nasync function runChecks(): Promise<void> {\n const cfg = getPublishConfig()\n const { chain } = cfg\n const problems: string[] = []\n\n let rpcChainId: number | undefined\n try {\n rpcChainId = await getPublishPublicClient().getChainId()\n } catch (cause) {\n throw new PublishChainConfigError(chain.id, [\n `could not reach the RPC (${redactRpcUrl(getPublishRpcUrl())}): ${cause instanceof Error ? cause.message : String(cause)}`,\n ])\n }\n if (rpcChainId !== chain.id) {\n // Contract checks against the wrong chain would only add noise.\n throw new PublishChainConfigError(chain.id, [\n `the RPC reports chain ${rpcChainId}, but PublishConfig.chain is ${chain.name} (${chain.id}). Point rpcUrl at ${chain.name}.`,\n ])\n }\n\n const contracts: Array<[label: string, address: string | undefined, fix: string]> = [\n ['EAS contract', cfg.easContractAddress, 'set easContractAddress'],\n ['EAS SchemaRegistry', cfg.schemaRegistryAddress, 'set schemaRegistryAddress'],\n [\n 'ManagedAccount factory',\n cfg.thirdwebAccountFactoryAddress,\n 'deploy the factory or fix managedAccountFactoryAddress',\n ],\n [\n 'executor module',\n cfg.modularAccountModuleContract?.trim() || undefined,\n 'deploy the module or fix modularAccountModuleContract',\n ],\n ]\n const results = await Promise.all(\n contracts.map(async ([label, address, fix]) => {\n if (!address) return null\n const deployed = await isContractDeployed(address)\n return deployed ? null : `no ${label} at ${address} on ${chain.name}; ${fix}.`\n }),\n )\n for (const r of results) if (r) problems.push(r)\n\n if (problems.length > 0) throw new PublishChainConfigError(chain.id, problems)\n}\n\n/** Hide API keys embedded in RPC URLs (e.g. Thirdweb client ids) from error messages. */\nfunction redactRpcUrl(url: string): string {\n try {\n const u = new URL(url)\n return `${u.protocol}//${u.host}`\n } catch {\n return 'configured rpcUrl'\n }\n}\n\n/**\n * Checks that the configured chain is usable before anything is sent: the RPC reports\n * `PublishConfig.chain.id`, and EAS, the SchemaRegistry and (when configured) the ManagedAccount\n * factory and executor module have code at their addresses.\n *\n * Runs once per configuration (cached; a failure is retried on the next call). The publish\n * flow calls it before the first attestation; apps can call it at startup to fail early.\n *\n * @throws PublishChainConfigError listing every failed check\n */\nexport function verifyPublishChain(): Promise<void> {\n const key = configKey()\n if (verified?.key === key) return verified.result\n const result = runChecks()\n verified = { key, result }\n result.catch(() => {\n if (verified?.result === result) verified = null\n })\n return result\n}\n\n/** @internal Tests only. */\nexport function resetVerifiedPublishChain(): void {\n verified = null\n}\n","import { prepareEasMultiRevoke } from '~/helpers/easDirect'\nimport { waitForPublishReceipt } from '~/helpers/chainClient'\nimport { getPublishWallet } from '~/helpers/publishWalletRegistry'\nimport { fromThirdwebAccount } from '~/helpers/adapters/thirdwebAccount'\nimport type { PublishWallet } from '~/helpers/seedSigner'\nimport { getPublishConfig } from '~/config'\nimport { verifyPublishChain } from '~/helpers/verifyPublishChain'\nimport {\n getVersionsForSeedUid,\n getMetadataAttestationUidsForSeedUid,\n getAttesterForSeed,\n updateSeedRevokedAt,\n VERSION_SCHEMA_UID,\n isValidEasAttestationUid,\n getGetAdditionalSyncAddresses,\n assertLocalDbChain,\n} from '@seedprotocol/sdk'\n\n/**\n * True when the EAS attester is the configured executor module (legacy path where the\n * module itself was recorded as attester). ManagedAccount attesters are not blocked.\n */\nasync function isLegacyModularExecutorAttester(attester: string | null): Promise<boolean> {\n if (!attester) return false\n const additionalGetter = getGetAdditionalSyncAddresses()\n if (!additionalGetter) return false\n const additional = await additionalGetter()\n const attesterLower = attester.toLowerCase()\n return !!additional?.some((a: string | undefined) => a?.toLowerCase() === attesterLower)\n}\n\n/**\n * True when `wallet` is an automation session key on the ManagedAccount that attested the seed.\n * Read failures count as false: the revoke then goes to EAS, and the account rejects it.\n */\nasync function isAutomationRevoke(\n wallet: PublishWallet,\n attester: string | null,\n): Promise<boolean> {\n if (!attester || !getPublishConfig().modularAccountModuleContract?.trim()) return false\n const signerAddress = wallet.signer?.address\n if (!signerAddress || signerAddress.toLowerCase() === attester.toLowerCase()) return false\n try {\n const { isAutomationSessionActive } = await import('~/helpers/ensureAutomationSessionKey')\n return await isAutomationSessionActive(attester, signerAddress)\n } catch {\n return false\n }\n}\n\n/**\n * Revokes the Seed attestation and all Version and metadata attestations on EAS.\n * Prefer the registered publish wallet; fall back to Thirdweb connected account when present.\n *\n * Only the attester's owner can revoke: `multiRevoke` goes to EAS from the publishing account\n * (for a ManagedAccount, a UserOp `execute(EAS, multiRevoke)`). The Seed executor has no revoke,\n * so automation session keys and seeds attested by the executor itself cannot be revoked here.\n */\nexport async function revokeAttestations(params: {\n seedLocalId: string\n seedUid: string\n seedSchemaUid: string\n}): Promise<void> {\n const { seedLocalId, seedUid, seedSchemaUid } = params\n // Revoking on one chain must not update revokedAt for a seed attested on another.\n await assertLocalDbChain()\n await verifyPublishChain()\n const attester = await getAttesterForSeed({ seedLocalId, seedUid })\n if (await isLegacyModularExecutorAttester(attester)) {\n throw new Error(\n 'Revocation not supported for items attested by the Seed executor module: the executor has no revoke and is the only attester that could revoke them.',\n )\n }\n\n let wallet: PublishWallet | null = getPublishWallet()\n if (!wallet) {\n try {\n const { getConnectedAccount } = await import('~/helpers/thirdweb')\n const { resolveRevokeAccount } = await import('~/helpers/resolveRevokeAccount')\n const account = await getConnectedAccount()\n if (!account) {\n throw new Error('No wallet connected. Connect a wallet to revoke attestations.')\n }\n const revokeAccount = await resolveRevokeAccount({ account, attester })\n wallet = fromThirdwebAccount(revokeAccount)\n } catch (err) {\n if (err instanceof Error && err.message.includes('No wallet connected')) throw err\n if (err instanceof Error && err.message.includes('Revocation not supported')) throw err\n throw new Error(\n 'No wallet connected. Use useSeedWallet / setPublishWallet, or @seedprotocol/publish/thirdweb ConnectButton.',\n { cause: err },\n )\n }\n }\n\n const txSender = wallet.txSender\n if (await isAutomationRevoke(wallet, attester)) {\n throw new Error(\n 'Automation session keys cannot revoke attestations. Revoking is owner-only: connect the account that published this item.',\n )\n }\n\n const [versionRows, metadataRows] = await Promise.all([\n getVersionsForSeedUid(seedUid),\n getMetadataAttestationUidsForSeedUid(seedUid),\n ])\n\n const versionUids = versionRows\n .map((r: { uid: string }) => r.uid)\n .filter((uid: string) => isValidEasAttestationUid(uid))\n const metadataBySchema = new Map<string, string[]>()\n for (const { uid, schemaUid } of metadataRows) {\n if (!isValidEasAttestationUid(uid)) continue\n const list = metadataBySchema.get(schemaUid) ?? []\n list.push(uid)\n metadataBySchema.set(schemaUid, list)\n }\n\n const requests: Array<{\n schema: `0x${string}`\n data: Array<{ uid: `0x${string}`; value?: bigint }>\n }> = []\n\n for (const [schemaUid, uids] of metadataBySchema) {\n if (uids.length > 0) {\n requests.push({\n schema: schemaUid as `0x${string}`,\n data: uids.map((uid: string) => ({ uid: uid as `0x${string}` })),\n })\n }\n }\n\n if (versionUids.length > 0) {\n requests.push({\n schema: VERSION_SCHEMA_UID as `0x${string}`,\n data: versionUids.map((uid: string) => ({ uid: uid as `0x${string}` })),\n })\n }\n\n requests.push({\n schema: seedSchemaUid as `0x${string}`,\n data: [{ uid: seedUid as `0x${string}` }],\n })\n\n for (const req of requests) {\n if (req.data.length === 0) continue\n const multiRevokeTx = prepareEasMultiRevoke([req])\n try {\n const result = await txSender.sendTransaction(multiRevokeTx)\n await waitForPublishReceipt(result.transactionHash)\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : String(err)\n if (msg.includes('AccessDenied') || msg.includes('0x4ca88867')) {\n throw new Error(\n 'Only the original attester can revoke attestations. Connect the wallet that published this item.',\n )\n }\n if (msg.includes('AlreadyRevoked')) {\n continue\n }\n throw err\n }\n }\n\n const revokedAt = Math.floor(Date.now() / 1000)\n // Mark the revoked version and property attestations too, so local rows read as revoked before the\n // next EAS sync confirms it (sync keeps them as the item's last values, see ADR 0006).\n await updateSeedRevokedAt({\n seedLocalId,\n revokedAt,\n metadataUids: [...metadataBySchema.values()].flat(),\n versionUids,\n })\n}\n","import {\n DEFAULT_ARWEAVE_GRAPHQL_URL,\n setAdditionalSyncAddresses,\n setGetPublisherForNewSeeds,\n setRevokeExecutor,\n whenLeaderTab,\n type TransactionTag,\n} from '@seedprotocol/sdk'\nimport type { Chain } from 'viem'\nimport { revokeAttestations } from './services/revoke/revokeAttestations'\nimport {\n configureEasReadChain,\n expectEasReadChain,\n resolveEasChainDeployment,\n type EasChainDeployment,\n} from '@seedprotocol/eas'\nimport { MANAGED_ACCOUNT_FACTORY_ADDRESSES } from './helpers/constants'\nimport { ethers } from 'ethers'\nimport { DEFAULT_PUBLISH_CHAIN } from './helpers/defaultChain'\nimport { getPublishWallet } from './helpers/publishWalletRegistry'\n\n// initPublish will set the chain. Until then the SDK's EAS sync waits instead of reading the\n// default chain into a local DB that publish is about to point elsewhere.\nexpectEasReadChain('publish')\n\n/** Serialized upload item for Arweave signing (input to callback or used internally with JWK) */\nexport interface SerializedPublishUpload {\n versionLocalId: string\n itemPropertyName: string\n transactionJson: Record<string, unknown>\n}\n\n/** Result from Arweave signing (signed transaction + metadata) */\nexport interface ArweaveTransactionInfoResult {\n transaction: Record<string, unknown> & { chunks?: unknown }\n versionId: string\n modelName: string\n}\n\n/** Result from DataItem signing (compatible shape for createAttestations) */\nexport interface ArweaveDataItemInfoResult {\n transaction: { id: string }\n versionId?: string\n modelName?: string\n}\n\nexport type PublishAccountMode = 'eoa' | 'eip7702'\n\nexport interface ThirdwebWalletOptions {\n /**\n * Bundler for the managed (EIP-4337, EntryPoint v0.6) smart account's UserOps. Defaults to\n * Thirdweb's hosted bundler for the chain; required on a local chain. This is the bundler a\n * local twin uses, not the top-level {@link PublishConfig.bundlerUrl}.\n */\n bundlerUrl?: string\n /**\n * Sponsor gas through Thirdweb: the managed smart account's UserOps and, in `'EIP7702'` mode,\n * the in-app EOA's transactions. Default `true`. Set `false` where Thirdweb's paymaster is\n * unavailable (local chains); the accounts then pay their own gas and must hold ETH.\n */\n sponsorGas?: boolean\n /**\n * How the user's in-app EOA (the managed account's admin) sends its own transactions, such as\n * installing the Seed executor: `'EIP7702'` (default) goes through Thirdweb's hosted EIP-7702\n * service (gas-sponsored per `sponsorGas`); `'EOA'` sends plain transactions and needs ETH.\n * A local chain requires `'EOA'`: the wallet throws for `'EIP7702'` there. The address is the\n * same either way.\n */\n modularWalletMode?: 'EIP7702' | 'EOA'\n}\n\nexport interface PublishConfig {\n /**\n * Thirdweb client id — only required when using `@seedprotocol/publish/thirdweb`.\n * When set without `rpcUrl`, the public client falls back to Thirdweb’s RPC edge.\n * Browser client ids are usually locked to app origins; Node servers should also set\n * `thirdwebSecretKey` or those RPC and bundler calls return 401.\n */\n thirdwebClientId?: string\n /**\n * Thirdweb secret key for server-side clients. Sent as `x-secret-key` on viem reads\n * of the Thirdweb RPC URL, and passed to `createThirdwebClient` for sends.\n * Do not ship this to the browser. It does not replace `rpcUrl` or `thirdwebClientId`\n * when building the viem RPC URL.\n */\n thirdwebSecretKey?: string\n /**\n * Viem chain for reads, writes and wallet connection. Defaults to Optimism Sepolia.\n * Any EVM chain with EAS deployed works. Chains in `EAS_CHAIN_DEPLOYMENTS` (`@seedprotocol/eas`)\n * resolve contract addresses automatically; others need {@link easContractAddress} and\n * {@link schemaRegistryAddress}.\n */\n chain?: Chain\n /** EAS contract on {@link chain}. Defaults to the known deployment for `chain.id`. */\n easContractAddress?: string\n /** EAS SchemaRegistry on {@link chain}. Defaults to the known deployment for `chain.id`. */\n schemaRegistryAddress?: string\n /**\n * Thirdweb ManagedAccount factory on {@link chain}. Only used by managed / modular account flows.\n * Built in for Optimism Sepolia; required on other chains when those flows are enabled.\n */\n managedAccountFactoryAddress?: string\n /**\n * JSON-RPC URL for the publish chain. Required when `thirdwebClientId` is unset.\n * Prefer a public chain RPC from Node. A domain-locked client id in the default\n * Thirdweb URL returns 401 unless `thirdwebSecretKey` is also set.\n * Thirdweb wallets and contract calls use it too; without it they use Thirdweb's RPC edge.\n */\n rpcUrl?: string\n /**\n * Thirdweb in-app wallet settings (`@seedprotocol/publish/thirdweb`). Defaults suit Thirdweb-hosted\n * chains; a local chain (e.g. the OP Sepolia twin) needs `bundlerUrl`, `sponsorGas: false` and\n * `modularWalletMode: 'EOA'`.\n */\n thirdweb?: ThirdwebWalletOptions\n /**\n * EntryPoint v0.8 bundler for the permissionless EIP-7702 `SeedTxSender` used by non-Thirdweb\n * wallets. Setting it switches `accountMode` to `eip7702`. Not used by Thirdweb wallets: a local\n * twin's (v0.6) bundler goes in {@link ThirdwebWalletOptions.bundlerUrl}. A bundler that\n * reports no v0.8 support is rejected when the sender is created.\n */\n bundlerUrl?: string\n /**\n * Paymaster / sponsorship endpoint for permissionless EIP-7702 sends.\n */\n paymasterUrl?: string\n /**\n * How non-Thirdweb wallets submit txs. Defaults to `eip7702` when `bundlerUrl` is set, else `eoa`.\n */\n accountMode?: PublishAccountMode\n /** Upload API base URL (e.g. from VITE_UPLOAD_API_BASE_URL or NEXT_PUBLIC_UPLOAD_API_BASE_URL). Also used for bundler when useArweaveBundler is true. */\n uploadApiBaseUrl: string\n /**\n * Gateway transport for publish + read paths. Prefer resolving once via\n * `resolveSeedGatewayEndpoints(seedGatewayConfigFromSeedConfig(config))` at app bootstrap\n * and passing `uploadApiBaseUrl` / `arweaveGraphqlUrl` from the result.\n */\n gatewayTransport?: 'http-gateway' | 'hyper' | 'hybrid'\n /** Operator Gateway Hyper key (z32) — informational; sidecar is configured separately. */\n gatewayHyperKey?: string\n /**\n * Optional origin for verifying uploads via `GET /api/upload/arweave/data/:id`.\n * Defaults to {@link uploadApiBaseUrl} (e.g. set `ARWEAVE_UPLOAD_API_BASE_URL` as `uploadApiBaseUrl`).\n */\n arweaveUploadVerificationBaseUrl?: string\n /**\n * Arweave gateway GraphQL URL for resolving L1 bundle tx ids after bundler upload.\n * Defaults to {@link DEFAULT_ARWEAVE_GRAPHQL_URL}.\n */\n arweaveGraphqlUrl?: string\n /**\n * Bypass the SeedProtocol contract and call EAS attest/multiAttest directly from the user's wallet.\n * Default: false (uses contract multiPublish).\n */\n useDirectEas?: boolean\n /**\n * Seed executor module (SeedProtocolExecutor). Must match the executor pinned by the\n * ManagedAccount's `SeedExecutorRouterExtension` (`readFactorySeedExecutor` reads it from the\n * factory). When set, onConnect / publish prep install it with `installSeedExecutor()` if\n * missing; accounts without the extension are skipped.\n */\n modularAccountModuleContract?: string\n /** Unused: `installSeedExecutor()` takes no install data. */\n modularAccountModuleData?: string\n /**\n * Use the modular executor for multiPublish.\n * Default: false (uses the smart wallet executor).\n */\n useModularExecutor?: boolean\n /**\n * When true (and `useModularExecutor`), attempts to deploy / bootstrap the modular in-app wallet’s\n * EIP-7702 smart account on the publish chain via Thirdweb’s `deploySmartAccount` when bytecode is still empty.\n * When **undefined** and `useModularExecutor` is true, defaults to **true**. Set explicitly to **false** to surface\n * an error instead of auto-deploying.\n */\n autoDeployEip7702ModularAccount?: boolean\n /**\n * When true (and `useModularExecutor`), attempts to deploy the ManagedAccount via the factory\n * if it is not yet deployed on the publish chain. Default: false (surface `managed_not_ready` instead).\n */\n autoDeployManagedAccount?: boolean\n /**\n * Optional override for automatic ManagedAccount factory deploy when {@link autoDeployManagedAccount} is true.\n * When unset, uses Thirdweb `deploySmartAccount` on the managed EIP-4337 in-app wallet account.\n */\n deployManagedAccount?: (params: {\n managedAddress: string\n managedSigningAccount: import('./helpers/seedSigner').PublishWallet\n }) => Promise<void>\n /**\n * Called when optional wallet setup steps fail after connect (e.g. executor module install).\n */\n onWalletSetupWarning?: (error: unknown) => void\n /**\n * EXPERIMENTAL: Use Arweave bundler for instant uploads instead of reimbursement + chunk upload.\n * When true, skips sendReimbursementRequest, pollForConfirmation, and chunk-by-chunk uploadData.\n * Uses uploadApiBaseUrl for the bundler endpoint. Not yet validated for production.\n */\n useArweaveBundler?: boolean\n /**\n * Tags appended to every Arweave upload after Content-SHA-256 / Content-Type (e.g. App-Name).\n * Merged at publish time with {@link CreatePublishOptions.arweaveUploadTags} as\n * `[...config, ...options]`.\n */\n arweaveUploadTags?: TransactionTag[]\n /**\n * Default Html embedded data-URI policy for publishes when not overridden per {@link CreatePublishOptions}.\n * Default behavior when unset: `materialize`.\n */\n htmlEmbeddedDataUriPolicy?: import('./types').HtmlEmbeddedDataUriPolicy\n /**\n * Optional fallback: Sign Arweave upload transactions (non-bundler path). Prefer passing at createPublish time.\n */\n signArweaveTransactions?: (\n uploads: SerializedPublishUpload[]\n ) => Promise<ArweaveTransactionInfoResult[]>\n /**\n * Optional fallback: Arweave JWK for in-process signing (non-bundler path). Prefer passing at createPublish time.\n */\n arweaveJwk?: { kty: string; n: string; e: string; d?: string; [key: string]: unknown }\n /**\n * Optional fallback: Signer for DataItem creation when useArweaveBundler is true. Prefer passing at createPublish time.\n */\n dataItemSigner?: ethers.Wallet | import('./helpers/seedSigner').SeedSigner\n /**\n * Optional fallback: Sign DataItems when useArweaveBundler is true. Prefer passing at createPublish time.\n * Each upload includes `tags` (content + configured {@link arweaveUploadTags}); forward them into the DataItem.\n */\n signDataItems?: (\n uploads: import('./services/publish/helpers/getPublishUploadData').PublishUploadData[]\n ) => Promise<ArweaveDataItemInfoResult[]>\n /**\n * Optional USD spot prices for publish cost estimates. When unset, Coinbase ETH-USD / AR-USD spots are used.\n * Results are cached for 60s.\n */\n getTokenPrices?: () => Promise<{ ethUsd: number; arUsd: number }>\n /**\n * Called when an author publish run reaches success with the resolved batch UID list.\n * Tool backends use this to call {@link import('./services/publishedBy').attestPublishedBy}.\n * Per-publish {@link CreatePublishOptions.onPublished} overrides this when set.\n */\n onPublished?: import('./services/publishedBy').OnPublishedCallback\n}\n\n/** Options passed at createPublish time. Signers here override config fallbacks. */\nexport interface CreatePublishOptions {\n /** `patch` (default): pending properties only. `new_version`: new Version attestation + all properties. */\n publishMode?: import('./types').PublishMode\n /**\n * Required when useArweaveBundler: sign DataItems (wallet flow).\n * Use each upload's `tags` when building the signed DataItem.\n */\n signDataItems?: (\n uploads: import('./services/publish/helpers/getPublishUploadData').PublishUploadData[]\n ) => Promise<ArweaveDataItemInfoResult[]>\n /** Required when useArweaveBundler: signer for DataItems (backend/script flow) */\n dataItemSigner?: ethers.Wallet | import('./helpers/seedSigner').SeedSigner\n /** Required when NOT useArweaveBundler: sign Arweave transactions */\n signArweaveTransactions?: (\n uploads: SerializedPublishUpload[]\n ) => Promise<ArweaveTransactionInfoResult[]>\n /** Required when NOT useArweaveBundler: JWK for in-process signing */\n arweaveJwk?: { kty: string; n: string; e: string; d?: string; [key: string]: unknown }\n /**\n * Extra tags for this publish only, appended after {@link PublishConfig.arweaveUploadTags}.\n * Resolved order: `[...initPublishTags, ...theseTags]`.\n */\n arweaveUploadTags?: TransactionTag[]\n /**\n * Default for Html embedded data-URI handling when a property does not set `htmlEmbeddedDataUriPolicy`.\n * Default: `materialize`.\n */\n htmlEmbeddedDataUriPolicy?: import('./types').HtmlEmbeddedDataUriPolicy\n /**\n * Called when this publish run succeeds with the resolved Seed/Version/property UID batch.\n * Overrides {@link PublishConfig.onPublished} when both are set.\n */\n onPublished?: import('./services/publishedBy').OnPublishedCallback\n}\n\n/** Internal: module-level config ref set by PublishProvider on mount. */\nlet configRef: PublishConfig | null = null\n\n/**\n * Internal: Set config ref. Called by PublishProvider on mount or initPublish.\n */\nexport function setConfigRef(c: PublishConfig | null): void {\n configRef = c\n}\n\n/**\n * Internal: Get current config ref. Used by PublishProvider when config is not passed.\n */\nexport function getConfigRef(): PublishConfig | null {\n return configRef\n}\n\n/**\n * Initialize the publish package. Call once before using PublishManager or other publish APIs.\n * Registers the config and SDK hooks (revoke executor, getPublisherForNewSeeds, etc.).\n * For React apps, you can alternatively pass config to PublishProvider.\n */\nexport function initPublish(c: PublishConfig): void {\n // Fail fast on chains without a known EAS deployment and no address overrides.\n const easChain = resolvePublishEasChain(c)\n // Point SDK reads (EAS sync, schema lookups) at the chain we publish to. Throws when\n // SeedConfig.eas.chainId names a different chain.\n configureEasReadChain('publish', { chainId: easChain.chainId, indexerUrl: easChain.indexerUrl })\n setConfigRef(c)\n setGetPublisherForNewSeeds(async () => {\n const wallet = getPublishWallet()\n if (wallet?.publisherAddress) return wallet.publisherAddress\n if (wallet?.signer?.address) return wallet.signer.address\n return undefined\n })\n setRevokeExecutor(revokeAttestations)\n // Polls every 45 s; one tab is enough (docs/MULTI_TAB.md). Starts on takeover if this tab\n // isn't the leader yet.\n void whenLeaderTab()\n .then(() => import('./services/arweaveL1Finalize/worker'))\n .then((m) => {\n m.startArweaveL1FinalizeWorker()\n })\n setAdditionalSyncAddresses(async () => {\n if (c.useModularExecutor && c.modularAccountModuleContract) {\n return [c.modularAccountModuleContract]\n }\n return []\n })\n}\n\n/** Alias for initPublish. Use initPublish for the primary API. */\nexport const configurePublish = initPublish\n\nexport interface ResolvedPublishConfig extends PublishConfig {\n /**\n * ManagedAccount factory on the publish chain, or undefined when none is known for this chain.\n * Use {@link requireManagedAccountFactoryAddress} where a factory is mandatory.\n */\n thirdwebAccountFactoryAddress: string | undefined\n uploadApiBaseUrl: string\n /** Resolved verification origin (defaults to uploadApiBaseUrl). */\n arweaveUploadVerificationBaseUrl: string\n /** Resolved GraphQL endpoint for L1 tx resolution (defaults to DEFAULT_ARWEAVE_GRAPHQL_URL). */\n arweaveGraphqlUrl: string\n easContractAddress: string\n schemaRegistryAddress: string\n /** EAS deployment for the publish chain (addresses, indexer and explorer URLs). */\n easChain: EasChainDeployment\n useDirectEas: boolean\n modularAccountModuleData: string\n useModularExecutor: boolean\n useArweaveBundler: boolean\n /** Resolved: defaults to false. */\n autoDeployManagedAccount: boolean\n /**\n * Resolved: when `useModularExecutor` is true, defaults to true unless explicitly false.\n */\n autoDeployEip7702ModularAccount: boolean\n /** Resolved viem chain (defaults to Optimism Sepolia; see `DEFAULT_PUBLISH_CHAIN`). */\n chain: Chain\n /** Resolved account mode for non-Thirdweb senders. */\n accountMode: PublishAccountMode\n /** Resolved Thirdweb wallet settings (defaults applied). */\n thirdweb: ResolvedThirdwebWalletOptions\n}\n\nexport type ResolvedThirdwebWalletOptions = {\n bundlerUrl: string | undefined\n sponsorGas: boolean\n modularWalletMode: 'EIP7702' | 'EOA'\n}\n\n/** Applies defaults to {@link PublishConfig.thirdweb}. */\nexport function resolveThirdwebWalletOptions(\n config: Pick<PublishConfig, 'thirdweb'> | null | undefined,\n): ResolvedThirdwebWalletOptions {\n const tw = config?.thirdweb ?? {}\n return {\n bundlerUrl: tw.bundlerUrl?.trim() || undefined,\n sponsorGas: tw.sponsorGas ?? true,\n modularWalletMode: tw.modularWalletMode ?? 'EIP7702',\n }\n}\n\n/**\n * Returns the resolved publish config: defaults, env-driven fields, and\n * {@link ResolvedPublishConfig.autoDeployEip7702ModularAccount}.\n *\n * Reads the ref set by {@link initPublish} or {@link PublishProvider} with a `config` prop.\n * **Throws** if publish has not been initialized (same error as other publish APIs).\n */\nexport function getPublishConfig(): ResolvedPublishConfig {\n const config = configRef\n if (!config) {\n throw new Error(\n '@seedprotocol/publish: Call initPublish() or ensure PublishProvider is mounted with config before using the publish package'\n )\n }\n const useArweaveBundler = config.useArweaveBundler ?? false\n const arweaveUploadVerificationBaseUrl =\n config.arweaveUploadVerificationBaseUrl ?? config.uploadApiBaseUrl\n const arweaveGraphqlUrl = config.arweaveGraphqlUrl ?? DEFAULT_ARWEAVE_GRAPHQL_URL\n const useModularExecutor = config.useModularExecutor ?? false\n const chain = config.chain ?? DEFAULT_PUBLISH_CHAIN\n const easChain = resolvePublishEasChain(config)\n const accountMode: PublishAccountMode =\n config.accountMode ?? (config.bundlerUrl ? 'eip7702' : 'eoa')\n return {\n ...config,\n thirdwebAccountFactoryAddress:\n config.managedAccountFactoryAddress ?? MANAGED_ACCOUNT_FACTORY_ADDRESSES[chain.id],\n easContractAddress: easChain.easContractAddress,\n schemaRegistryAddress: easChain.schemaRegistryAddress,\n easChain,\n useDirectEas: config.useDirectEas ?? false,\n modularAccountModuleData: config.modularAccountModuleData ?? '0x',\n useModularExecutor,\n useArweaveBundler,\n arweaveUploadVerificationBaseUrl,\n arweaveGraphqlUrl,\n autoDeployManagedAccount: config.autoDeployManagedAccount ?? false,\n autoDeployEip7702ModularAccount: resolveAutoDeployEip7702ModularAccount(config, useModularExecutor),\n chain,\n accountMode,\n thirdweb: resolveThirdwebWalletOptions(config),\n }\n}\n\n/**\n * EAS deployment for the configured chain, with {@link PublishConfig.easContractAddress} /\n * {@link PublishConfig.schemaRegistryAddress} overrides applied.\n */\nexport function resolvePublishEasChain(config: PublishConfig): EasChainDeployment {\n const chain = config.chain ?? DEFAULT_PUBLISH_CHAIN\n try {\n return resolveEasChainDeployment(chain.id, {\n name: chain.name,\n easContractAddress: config.easContractAddress as `0x${string}` | undefined,\n schemaRegistryAddress: config.schemaRegistryAddress as `0x${string}` | undefined,\n })\n } catch (error) {\n throw new Error(\n `@seedprotocol/publish: ${chain.name} (chain ${chain.id}) has no known EAS deployment. Pass easContractAddress and schemaRegistryAddress in initPublish / PublishProvider config.`,\n { cause: error },\n )\n }\n}\n\n/** ManagedAccount factory for the publish chain; throws when none is configured. */\nexport function requireManagedAccountFactoryAddress(): string {\n const { thirdwebAccountFactoryAddress, chain } = getPublishConfig()\n if (!thirdwebAccountFactoryAddress) {\n throw new Error(\n `@seedprotocol/publish: no ManagedAccount factory is known for ${chain.name} (chain ${chain.id}). Pass managedAccountFactoryAddress in publish config, or use the EOA / direct EAS path.`,\n )\n }\n return thirdwebAccountFactoryAddress\n}\n\n/** @internal Exported for unit tests. */\nexport function resolveAutoDeployEip7702ModularAccount(\n config: PublishConfig,\n useModularExecutor: boolean,\n): boolean {\n if (config.autoDeployEip7702ModularAccount === true) return true\n if (config.autoDeployEip7702ModularAccount === false) return false\n return useModularExecutor\n}\n","import type { Chain } from 'viem'\nimport { getPublishConfig } from '../config'\nimport { DEFAULT_PUBLISH_CHAIN } from './defaultChain'\n\nexport { DEFAULT_PUBLISH_CHAIN }\n\n/**\n * Resolved viem chain for public client + adapters.\n */\nexport function getPublishViemChain(): Chain {\n try {\n return getPublishConfig().chain ?? DEFAULT_PUBLISH_CHAIN\n } catch {\n return DEFAULT_PUBLISH_CHAIN\n }\n}\n\n/**\n * Resolved RPC URL. Prefer explicit `rpcUrl`; fall back to Thirdweb edge URL when client id is set.\n */\nexport function getPublishRpcUrl(): string {\n const config = getPublishConfig()\n if (config.rpcUrl) return config.rpcUrl\n if (config.thirdwebClientId) {\n const chainId = (config.chain ?? DEFAULT_PUBLISH_CHAIN).id\n return `https://${chainId}.rpc.thirdweb.com/${config.thirdwebClientId}`\n }\n throw new Error(\n '@seedprotocol/publish: rpcUrl is required when thirdwebClientId is not set. A thirdwebSecretKey authenticates Thirdweb RPC but does not build this URL. Pass rpcUrl or thirdwebClientId in initPublish / PublishProvider config.',\n )\n}\n\n/** Display name of the publish chain for user-facing messages. */\nexport function getPublishChainName(): string {\n return getPublishViemChain().name\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