@seedprotocol/publish 0.7.5 → 0.7.6

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.
Files changed (25) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/{chainConfig-CY22-kWO.js → chainConfig-NziDkhH8.js} +1375 -1389
  3. package/dist/chainConfig-NziDkhH8.js.map +1 -0
  4. package/dist/{ensureAutomationSessionKey-CKFyZNj7.js → ensureAutomationSessionKey-C5uScAY8.js} +3 -3
  5. package/dist/{ensureAutomationSessionKey-CKFyZNj7.js.map → ensureAutomationSessionKey-C5uScAY8.js.map} +1 -1
  6. package/dist/{ensureModularPublishBootstrap-DQDSbkQy.js → ensureModularPublishBootstrap-BX9PwXBl.js} +3 -3
  7. package/dist/{ensureModularPublishBootstrap-DQDSbkQy.js.map → ensureModularPublishBootstrap-BX9PwXBl.js.map} +1 -1
  8. package/dist/{ensureSmartWalletThenPublish-By_Xv7xG.js → ensureSmartWalletThenPublish-y8mmtR_N.js} +2 -2
  9. package/dist/{ensureSmartWalletThenPublish-By_Xv7xG.js.map → ensureSmartWalletThenPublish-y8mmtR_N.js.map} +1 -1
  10. package/dist/index.js +2 -2
  11. package/dist/{managedAccountAdmin-DBAX8yny.js → managedAccountAdmin-DDuGmmYZ.js} +2 -2
  12. package/dist/{managedAccountAdmin-DBAX8yny.js.map → managedAccountAdmin-DDuGmmYZ.js.map} +1 -1
  13. package/dist/{publishAuthorization-D2wbNc-H.js → publishAuthorization-5uWpBRgf.js} +2 -2
  14. package/dist/{publishAuthorization-D2wbNc-H.js.map → publishAuthorization-5uWpBRgf.js.map} +1 -1
  15. package/dist/{resolveRevokeAccount-B7cj6OyT.js → resolveRevokeAccount-DVGdovxJ.js} +2 -2
  16. package/dist/{resolveRevokeAccount-B7cj6OyT.js.map → resolveRevokeAccount-DVGdovxJ.js.map} +1 -1
  17. package/dist/services/publish/actors/uploadViaBundler.d.ts.map +1 -1
  18. package/dist/services/publish/helpers/uploadToTurbo.d.ts.map +1 -1
  19. package/dist/services/publish/helpers/verifyAttestations.d.ts +14 -2
  20. package/dist/services/publish/helpers/verifyAttestations.d.ts.map +1 -1
  21. package/dist/thirdweb.js +5 -5
  22. package/dist/{worker-CBBwWaxo.js → worker-Ct3bqLZX.js} +2 -2
  23. package/dist/{worker-CBBwWaxo.js.map → worker-Ct3bqLZX.js.map} +1 -1
  24. package/package.json +8 -8
  25. package/dist/chainConfig-CY22-kWO.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { Rt as t, U as n, Ut as r, Vt as i, Wt as a, _t as o, qt as s, rt as c, t as l } from "./chainConfig-CY22-kWO.js";
3
- import { d as u, p as d } from "./publishAuthorization-D2wbNc-H.js";
2
+ import { Rt as t, U as n, Ut as r, Vt as i, Wt as a, _t as o, qt as s, rt as c, t as l } from "./chainConfig-NziDkhH8.js";
3
+ import { d as u, p as d } from "./publishAuthorization-5uWpBRgf.js";
4
4
  import { getContract as f, sendTransaction as p } from "thirdweb";
5
5
  import { addSessionKey as m, removeSessionKey as h, shouldUpdateSessionKey as g } from "thirdweb/extensions/erc4337";
6
6
  //#region src/helpers/ensureAutomationSessionKey.ts
@@ -80,4 +80,4 @@ async function w(e, n) {
80
80
  //#endregion
81
81
  export { C as i, _ as n, w as r, S as t };
82
82
 
83
- //# sourceMappingURL=ensureAutomationSessionKey-CKFyZNj7.js.map
83
+ //# sourceMappingURL=ensureAutomationSessionKey-C5uScAY8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ensureAutomationSessionKey-CKFyZNj7.js","names":["__exportAll","readIsActiveSigner","getManagedAccountWallet","readUntil","isContractDeployed","waitForPublishReceipt","getPublishThirdwebChain","ManagedAccountPublishError","getClient","getPublishChainName","buildAutomationSessionKeyPermissions","toThirdwebSessionKeyPermissions","ensureAutomationSessionKey_exports","ensureAutomationSessionKey","isAutomationSessionActive","removeAutomationSessionKey","MSG_UNAVAILABLE","MSG_ACTIVATION_FAILED","MSG_REMOVAL_FAILED","getManagedAccountForSessionKeyAdmin","managedWallet","managedAccount","managedAddress","params","accountContract","getContract","permissions","shouldUpdate","shouldUpdateSessionKey","cause","tx","addSessionKey","result","sendTransaction","sessionKeyAddress","removeSessionKey"],"sources":["../src/helpers/ensureAutomationSessionKey.ts"],"sourcesContent":["import { getContract, sendTransaction } from 'thirdweb'\nimport {\n addSessionKey,\n removeSessionKey,\n shouldUpdateSessionKey,\n} from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { isContractDeployed, readUntil, waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport {\n buildAutomationSessionKeyPermissions,\n toThirdwebSessionKeyPermissions,\n} from './automationSessionKeyPermissions'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_UNAVAILABLE = () =>\n `Could not connect the managed publishing account to authorize an automation session key on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the automation session key on your publishing account on ${getPublishChainName()}.`\nconst MSG_REMOVAL_FAILED = () =>\n `Could not remove the automation session key from your publishing account on ${getPublishChainName()}.`\n\nasync function getManagedAccountForSessionKeyAdmin(managedAddress: string) {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n MSG_UNAVAILABLE(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n return managedAccount\n}\n\n/**\n * Ensures `sessionKeyAddress` is an active automation session signer on the ManagedAccount\n * with **executor-module-only** approved targets. Signed by the managed EIP-4337 wallet (user).\n */\nexport async function ensureAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n /** Unix seconds end time for the session key (optional). */\n expiresAt?: number\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress, expiresAt } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = toThirdwebSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({ expiresAt }),\n )\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress,\n newPermissions: permissions,\n })\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n\n if (shouldUpdate) {\n try {\n const tx = addSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n permissions,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n }\n\n // Right after addSessionKey, a lagging RPC node can still report the key inactive.\n const active = await readUntil(\n () => isAutomationSessionActive(managedAddress, sessionKeyAddress),\n Boolean,\n { attempts: shouldUpdate ? 5 : 1 },\n )\n if (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n\n/**\n * Removes an automation session key from the ManagedAccount (user-signed via managed wallet).\n */\nexport async function removeAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n\n try {\n const tx = removeSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_REMOVAL_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n\n/**\n * True when `sessionKeyAddress` is an active signer on the ManagedAccount.\n * Returns `false` when the ManagedAccount has no bytecode (undeployed ≠ unauthorized).\n * Throws when bytecode or `isActiveSigner` cannot be read on a live account (RPC / decode),\n * so unattended automation does not silently fall through to in-app bootstrap.\n */\nexport async function isAutomationSessionActive(\n managedAddress: string,\n sessionKeyAddress: string,\n): Promise<boolean> {\n try {\n if (!(await isContractDeployed(managedAddress))) {\n return false\n }\n return await readIsActiveSigner(\n managedAddress as Address,\n sessionKeyAddress as Address,\n )\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n"],"mappings":";;;;;;;;;;IAkBMgB,UACJ,8FAA8FP,EAAoB,EAAE,6BAChHQ,UACJ,gFAAgFR,EAAoB,EAAE,IAClGS,UACJ,+EAA+ET,EAAoB,EAAE;AAEvG,eAAeU,EAAoC,GAAwB;CACzE,IAAMC,IAAgBlB,EAAwB;CAC9C,MAAMkB,EAAc,YAAY;EAAE,QAAQZ,EAAU;EAAG,OAAOF,EAAwB;CAAE,CAAC;CACzF,IAAMe,IAAiBD,EAAc,WAAW;CAChD,IAAI,CAACC,GACH,MAAM,IAAId,EACRS,EAAgB,GAChB,oCACAM,CACF;CAEF,OAAOD;AACT;AAMA,eAAsBR,EAA2B,GAK/B;CAChB,IAAM,EAAE,mBAAgB,sBAAmB,iBAAcU,GACnDF,IAAiB,MAAMF,EAAoCG,CAAc,GAEzEE,IAAkBC,EAAY;EAClC,QA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MV,EAAmBkB,CAAc,IAGtC,MAAMrB,EACXqB,GACAY,CACF,IALS;CAMX,SAASL,GAAO;EACd,MAAM,IAAItB,EACRU,EAAsB,GACtB,oCACAK,GACAO,CACF;CACF;AACF"}
1
+ {"version":3,"file":"ensureAutomationSessionKey-C5uScAY8.js","names":["__exportAll","readIsActiveSigner","getManagedAccountWallet","readUntil","isContractDeployed","waitForPublishReceipt","getPublishThirdwebChain","ManagedAccountPublishError","getClient","getPublishChainName","buildAutomationSessionKeyPermissions","toThirdwebSessionKeyPermissions","ensureAutomationSessionKey_exports","ensureAutomationSessionKey","isAutomationSessionActive","removeAutomationSessionKey","MSG_UNAVAILABLE","MSG_ACTIVATION_FAILED","MSG_REMOVAL_FAILED","getManagedAccountForSessionKeyAdmin","managedWallet","managedAccount","managedAddress","params","accountContract","getContract","permissions","shouldUpdate","shouldUpdateSessionKey","cause","tx","addSessionKey","result","sendTransaction","sessionKeyAddress","removeSessionKey"],"sources":["../src/helpers/ensureAutomationSessionKey.ts"],"sourcesContent":["import { getContract, sendTransaction } from 'thirdweb'\nimport {\n addSessionKey,\n removeSessionKey,\n shouldUpdateSessionKey,\n} from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { isContractDeployed, readUntil, waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport {\n buildAutomationSessionKeyPermissions,\n toThirdwebSessionKeyPermissions,\n} from './automationSessionKeyPermissions'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_UNAVAILABLE = () =>\n `Could not connect the managed publishing account to authorize an automation session key on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the automation session key on your publishing account on ${getPublishChainName()}.`\nconst MSG_REMOVAL_FAILED = () =>\n `Could not remove the automation session key from your publishing account on ${getPublishChainName()}.`\n\nasync function getManagedAccountForSessionKeyAdmin(managedAddress: string) {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n MSG_UNAVAILABLE(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n return managedAccount\n}\n\n/**\n * Ensures `sessionKeyAddress` is an active automation session signer on the ManagedAccount\n * with **executor-module-only** approved targets. Signed by the managed EIP-4337 wallet (user).\n */\nexport async function ensureAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n /** Unix seconds end time for the session key (optional). */\n expiresAt?: number\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress, expiresAt } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = toThirdwebSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({ expiresAt }),\n )\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress,\n newPermissions: permissions,\n })\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n\n if (shouldUpdate) {\n try {\n const tx = addSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n permissions,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n }\n\n // Right after addSessionKey, a lagging RPC node can still report the key inactive.\n const active = await readUntil(\n () => isAutomationSessionActive(managedAddress, sessionKeyAddress),\n Boolean,\n { attempts: shouldUpdate ? 5 : 1 },\n )\n if (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n\n/**\n * Removes an automation session key from the ManagedAccount (user-signed via managed wallet).\n */\nexport async function removeAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n\n try {\n const tx = removeSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_REMOVAL_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n\n/**\n * True when `sessionKeyAddress` is an active signer on the ManagedAccount.\n * Returns `false` when the ManagedAccount has no bytecode (undeployed ≠ unauthorized).\n * Throws when bytecode or `isActiveSigner` cannot be read on a live account (RPC / decode),\n * so unattended automation does not silently fall through to in-app bootstrap.\n */\nexport async function isAutomationSessionActive(\n managedAddress: string,\n sessionKeyAddress: string,\n): Promise<boolean> {\n try {\n if (!(await isContractDeployed(managedAddress))) {\n return false\n }\n return await readIsActiveSigner(\n managedAddress as Address,\n sessionKeyAddress as Address,\n )\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n"],"mappings":";;;;;;;;;;IAkBMgB,UACJ,8FAA8FP,EAAoB,EAAE,6BAChHQ,UACJ,gFAAgFR,EAAoB,EAAE,IAClGS,UACJ,+EAA+ET,E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EE,IAAkBC,EAAY;EAClC,QAAQjB,EAAU;EAClB,OAAOF,EAAwB;EAC/B,SAASgB;CACX,CAAC;CAED,IAAI;EACF,IAAMQ,IAAKK,EAAiB;GAC1B,UAAUX;GACV,SAASH;GACT;EACF,CAAC,GACKW,IAAS,MAAMC,EAAgB;GAAE,SAASZ;GAAgB,aAAaS;EAAG,CAAC;EACjF,MAAMzB,EAAsB2B,EAAO,eAAgC;CACrE,SAASH,GAAO;EACd,MAAM,IAAItB,EACRW,EAAmB,GACnB,oCACAI,GACAO,CACF;CACF;AACF;AAQA,eAAsBf,EACpB,GACA,GACkB;CAClB,IAAI;EAIF,OAHM,MAAMV,EAAmBkB,CAAc,IAGtC,MAAMrB,EACXqB,GACAY,CACF,IALS;CAMX,SAASL,GAAO;EACd,MAAM,IAAItB,EACRU,EAAsB,GACtB,oCACAK,GACAO,CACF;CACF;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { T as t, U as n, Z as r, _t as i, gt as a, qt as o, rt as s, t as c } from "./chainConfig-CY22-kWO.js";
3
- import { t as l } from "./managedAccountAdmin-DBAX8yny.js";
2
+ import { T as t, U as n, Z as r, _t as i, gt as a, qt as o, rt as s, t as c } from "./chainConfig-NziDkhH8.js";
3
+ import { t as l } from "./managedAccountAdmin-DDuGmmYZ.js";
4
4
  //#region src/helpers/ensureModularPublishBootstrap.ts
5
5
  var u = /* @__PURE__ */ e({ ensureModularPublishBootstrap: () => d });
6
6
  async function d(e) {
@@ -18,4 +18,4 @@ async function d(e) {
18
18
  //#endregion
19
19
  export { u as n, d as t };
20
20
 
21
- //# sourceMappingURL=ensureModularPublishBootstrap-DQDSbkQy.js.map
21
+ //# sourceMappingURL=ensureModularPublishBootstrap-BX9PwXBl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ensureModularPublishBootstrap-DQDSbkQy.js","names":["__exportAll","ensureManagedAccountEasConfigured","getManagedAccountWallet","syncPublishInAppAuthToken","getPublishThirdwebChain","fromThirdwebAccount","ManagedAccountPublishError","getClient","getPublishChainName","getManagedAccountAdmin","ensureModularPublishBootstrap_exports","ensureModularPublishBootstrap","managedWallet","managedAccount","managedAddress"],"sources":["../src/helpers/ensureModularPublishBootstrap.ts"],"sourcesContent":["import type { Account } from 'thirdweb/wallets'\nimport { ManagedAccountPublishError } from '../errors'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { getPublishChainName } from './chainConfig'\nimport { ensureManagedAccountEasConfigured } from './ensureManagedAccountEasConfigured'\nimport { getManagedAccountAdmin } from './managedAccountAdmin'\nimport { getClient, getManagedAccountWallet, syncPublishInAppAuthToken } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\n/**\n * Returns the account that sends interactive `multiPublish`: the user's managed (EIP-4337) smart\n * account. Its UserOps execute `multiPublish` on the account itself, a self-call the Seed\n * extension accepts; session keys and other non-admin callers are rejected with `Unauthorized`.\n *\n * Also checks the account's EAS pointer. Only pre-rollout accounts that report no EAS get\n * `setEas`, sent by the admin EOA.\n */\nexport async function ensureModularPublishBootstrap(managedAddress: string): Promise<Account> {\n syncPublishInAppAuthToken()\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n `Could not connect the managed publishing account on ${getPublishChainName()}. Reconnect with the same sign-in method and try again.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n if (managedAccount.address.toLowerCase() !== managedAddress.toLowerCase()) {\n throw new ManagedAccountPublishError(\n `The connected managed account (${managedAccount.address}) is not the publishing account ${managedAddress}. Reconnect with the sign-in method that owns it.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n\n await ensureManagedAccountEasConfigured(managedAddress, async () =>\n fromThirdwebAccount(await getManagedAccountAdmin(managedAddress)),\n )\n return managedAccount\n}\n"],"mappings":";;;;;AAiBA,eAAsBW,EAA8B,GAA0C;CAC5F,EAA0B;CAC1B,IAAMC,IAAgBV,EAAwB;CAC9C,MAAMU,EAAc,YAAY;EAAE,QAAQL,EAAU;EAAG,OAAOH,EAAwB;CAAE,CAAC;CACzF,IAAMS,IAAiBD,EAAc,WAAW;CAChD,IAAI,CAACC,GACH,MAAM,IAAIP,EACR,uDAAuDE,EAAoB,EAAE,0DAC7E,+BACAM,CACF;CAEF,IAAID,EAAe,QAAQ,YAAY,MAAMC,EAAe,YAAY,GACtE,MAAM,IAAIR,EACR,kCAAkCO,EAAe,QAAQ,kCAAkCC,EAAe,oDAC1G,+BACAA,CACF;CAMF,OAHA,MAAMb,EAAkCa,GAAgB,YACtDT,EAAoB,MAAMI,EAAuBK,CAAc,CAAC,CAClE,GACOD;AACT"}
1
+ {"version":3,"file":"ensureModularPublishBootstrap-BX9PwXBl.js","names":["__exportAll","ensureManagedAccountEasConfigured","getManagedAccountWallet","syncPublishInAppAuthToken","getPublishThirdwebChain","fromThirdwebAccount","ManagedAccountPublishError","getClient","getPublishChainName","getManagedAccountAdmin","ensureModularPublishBootstrap_exports","ensureModularPublishBootstrap","managedWallet","managedAccount","managedAddress"],"sources":["../src/helpers/ensureModularPublishBootstrap.ts"],"sourcesContent":["import type { Account } from 'thirdweb/wallets'\nimport { ManagedAccountPublishError } from '../errors'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { getPublishChainName } from './chainConfig'\nimport { ensureManagedAccountEasConfigured } from './ensureManagedAccountEasConfigured'\nimport { getManagedAccountAdmin } from './managedAccountAdmin'\nimport { getClient, getManagedAccountWallet, syncPublishInAppAuthToken } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\n/**\n * Returns the account that sends interactive `multiPublish`: the user's managed (EIP-4337) smart\n * account. Its UserOps execute `multiPublish` on the account itself, a self-call the Seed\n * extension accepts; session keys and other non-admin callers are rejected with `Unauthorized`.\n *\n * Also checks the account's EAS pointer. Only pre-rollout accounts that report no EAS get\n * `setEas`, sent by the admin EOA.\n */\nexport async function ensureModularPublishBootstrap(managedAddress: string): Promise<Account> {\n syncPublishInAppAuthToken()\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n `Could not connect the managed publishing account on ${getPublishChainName()}. Reconnect with the same sign-in method and try again.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n if (managedAccount.address.toLowerCase() !== managedAddress.toLowerCase()) {\n throw new ManagedAccountPublishError(\n `The connected managed account (${managedAccount.address}) is not the publishing account ${managedAddress}. Reconnect with the sign-in method that owns it.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n\n await ensureManagedAccountEasConfigured(managedAddress, async () =>\n fromThirdwebAccount(await getManagedAccountAdmin(managedAddress)),\n )\n return managedAccount\n}\n"],"mappings":";;;;;AAiBA,eAAsBW,EAA8B,GAA0C;CAC5F,EAA0B;CAC1B,IAAMC,IAAgBV,EAAwB;CAC9C,MAAMU,EAAc,YAAY;EAAE,QAAQL,EAAU;EAAG,OAAOH,EAAwB;CAAE,CAAC;CACzF,IAAMS,IAAiBD,EAAc,WAAW;CAChD,IAAI,CAACC,GACH,MAAM,IAAIP,EACR,uDAAuDE,EAAoB,EAAE,0DAC7E,+BACAM,CACF;CAEF,IAAID,EAAe,QAAQ,YAAY,MAAMC,EAAe,YAAY,GACtE,MAAM,IAAIR,EACR,kCAAkCO,EAAe,QAAQ,kCAAkCC,EAAe,oDAC1G,+BACAA,CACF;CAMF,OAHA,MAAMb,EAAkCa,GAAgB,YACtDT,EAAoB,MAAMI,EAAuBK,CAAc,CAAC,CAClE,GACOD;AACT"}
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { H as t, Tt as n, V as r, X as i, _t as a, a as o, f as s, gt as c, qt as l, t as u, wt as d } from "./chainConfig-CY22-kWO.js";
2
+ import { H as t, Tt as n, V as r, X as i, _t as a, a as o, f as s, gt as c, qt as l, t as u, wt as d } from "./chainConfig-NziDkhH8.js";
3
3
  import { r as f } from "./publishWalletRegistry-BaQe9rIR.js";
4
4
  import { ethers as p } from "ethers";
5
5
  //#region src/helpers/ensureSmartWalletThenPublish.ts
@@ -44,4 +44,4 @@ async function v(e, n, u, d) {
44
44
  //#endregion
45
45
  export { m as n, v as t };
46
46
 
47
- //# sourceMappingURL=ensureSmartWalletThenPublish-By_Xv7xG.js.map
47
+ //# sourceMappingURL=ensureSmartWalletThenPublish-y8mmtR_N.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ensureSmartWalletThenPublish-By_Xv7xG.js","names":["__exportAll","getConnectedModularAccount","isSeedSigner","getConnectedManagedAccountAddress","resolveSmartWalletForPublish","getPublishThirdwebChain","getPublishConfig","startPublish","fromThirdwebAccount","ManagedAccountPublishError","getPublishChainName","isPublishWallet","getPublishWallet","ensureSmartWalletThenPublish_exports","ensureSmartWalletThenPublish","MSG_NO_ACCOUNT_MODULAR","MSG_MANAGED_UNAVAILABLE","coerceDataItemSigner","signer","ethers","config","address","getAddress","modularAccount","managedAddress","cause","wallet","item","options","resolved","activeAccount"],"sources":["../src/helpers/ensureSmartWalletThenPublish.ts"],"sourcesContent":["import type { Item } from '@seedprotocol/sdk'\nimport type { Account } from 'thirdweb/wallets'\nimport {\n getConnectedManagedAccountAddress,\n getConnectedModularAccount,\n resolveSmartWalletForPublish,\n} from './thirdweb'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { isPublishWallet, isSeedSigner, type PublishWallet, type SeedSigner } from './seedSigner'\nimport { ethers } from 'ethers'\nimport { startPublish } from './ensureWalletThenPublish'\nimport { getPublishWallet } from './publishWalletRegistry'\nimport type { CreatePublishOptions } from '../config'\nimport { getPublishConfig } from '../config'\nimport { ManagedAccountPublishError } from '../errors'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nexport type EnsureSmartWalletResult =\n | Extract<import('./ensureWalletThenPublish').EnsureWalletThenPublishResult, { outcome: 'started' | 'already_publishing' }>\n | { outcome: 'no_address' }\n | { outcome: 'needs_deploy' }\n | { outcome: 'managed_not_ready'; error: ManagedAccountPublishError }\n\nconst MSG_NO_ACCOUNT_MODULAR =\n 'A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.'\n\nconst MSG_MANAGED_UNAVAILABLE = () =>\n `Could not connect the managed publishing account on ${getPublishChainName()}. Reconnect with the same sign-in method and try again.`\n\nfunction coerceDataItemSigner(\n signer: CreatePublishOptions['dataItemSigner'] | Account | SeedSigner | PublishWallet | undefined,\n): CreatePublishOptions['dataItemSigner'] {\n if (!signer) return undefined\n if (signer instanceof ethers.Wallet) return signer\n if (isPublishWallet(signer)) return signer.signer\n if (isSeedSigner(signer)) return signer\n return fromThirdwebAccount(signer as Account).signer\n}\n\n/**\n * Thirdweb path: resolves the smart wallet for the current account; if deployed, starts publish.\n * Prefer {@link ensureWalletThenPublish} for vendor-neutral entry.\n */\nexport async function ensureSmartWalletThenPublish(\n item: Item<any>,\n activeAccount: Account | null | undefined,\n getAddress: () => Promise<string | null>,\n options?: CreatePublishOptions,\n): Promise<EnsureSmartWalletResult> {\n const config = getPublishConfig()\n const address = await getAddress()\n if (!address || !address.trim()) {\n return { outcome: 'no_address' }\n }\n\n if (config.useModularExecutor) {\n const modularAccount = await getConnectedModularAccount()\n if (!modularAccount) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(MSG_NO_ACCOUNT_MODULAR, 'MANAGED_ACCOUNT_UNAVAILABLE'),\n }\n }\n\n let managedAddress: string\n try {\n managedAddress = await getConnectedManagedAccountAddress(getPublishThirdwebChain())\n } catch (cause) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(\n MSG_MANAGED_UNAVAILABLE(),\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n undefined,\n cause,\n ),\n }\n }\n\n const wallet = fromThirdwebAccount(modularAccount, { kind: 'smart' })\n return startPublish(item, managedAddress, wallet, {\n ...options,\n dataItemSigner: coerceDataItemSigner(options?.dataItemSigner) ?? wallet.signer,\n })\n }\n\n const resolved = await resolveSmartWalletForPublish(activeAccount ?? null)\n if ('address' in resolved) {\n const wallet = fromThirdwebAccount(resolved.account, { kind: 'smart' })\n return startPublish(item, resolved.address, wallet, {\n ...options,\n // The smart account can't sign data items; ConnectButton registers its admin EOA for that.\n dataItemSigner:\n coerceDataItemSigner(options?.dataItemSigner) ?? getPublishWallet()?.dataItemSigner,\n })\n }\n return { outcome: 'needs_deploy' }\n}\n"],"mappings":";;;;;sEAwBMe,IACJ,+GAEIC,UACJ,uDAAuDN,EAAoB,EAAE;AAE/E,SAASO,EACP,GACwC;CACxC,IAAKC,GAIL,OAHIA,aAAkBC,EAAO,SAAeD,IACxCP,EAAgBO,CAAM,IAAUA,EAAO,SACvChB,EAAagB,CAAM,IAAUA,IAC1BV,EAAoBU,CAAiB,CAAC,CAAC;AAChD;AAMA,eAAsBJ,EACpB,GACA,GACA,GACA,GACkC;CAClC,IAAMM,IAASd,EAAiB,GAC1Be,IAAU,MAAMC,EAAW;CACjC,IAAI,CAACD,KAAW,CAACA,EAAQ,KAAK,GAC5B,OAAO,EAAE,SAAS,aAAa;CAGjC,IAAID,EAAO,oBAAoB;EAC7B,IAAMG,IAAiB,MAAMtB,EAA2B;EACxD,IAAI,CAACsB,GACH,OAAO;GACL,SAAS;GACT,OAAO,IAAId,EAA2BM,GAAwB,6BAA6B;EAC7F;EAGF,IAAIS;EACJ,IAAI;GACF,IAAiB,MAAMrB,EAAkCE,EAAwB,CAAC;EACpF,SAASoB,GAAO;GACd,OAAO;IACL,SAAS;IACT,OAAO,IAAIhB,EACTO,EAAwB,GACxB,+BACA,KAAA,GACAS,CACF;GACF;EACF;EAEA,IAAMC,IAASlB,EAAoBe,GAAgB,EAAE,MAAM,QAAQ,CAAC;EACpE,OAAOhB,EAAaoB,GAAMH,GAAgBE,GAAQ;GAChD,GAAGE;GACH,gBAAgBX,EAAqBW,GAAS,cAAc,KAAKF,EAAO;EAC1E,CAAC;CACH;CAEA,IAAMG,IAAW,MAAMzB,EAA6B0B,KAAiB,IAAI;CACzE,IAAI,aAAaD,GAAU;EACzB,IAAMH,IAASlB,EAAoBqB,EAAS,SAAS,EAAE,MAAM,QAAQ,CAAC;EACtE,OAAOtB,EAAaoB,GAAME,EAAS,SAASH,GAAQ;GAClD,GAAGE;GAEH,gBACEX,EAAqBW,GAAS,cAAc,KAAKhB,EAAiB,CAAC,EAAE;EACzE,CAAC;CACH;CACA,OAAO,EAAE,SAAS,eAAe;AACnC"}
1
+ {"version":3,"file":"ensureSmartWalletThenPublish-y8mmtR_N.js","names":["__exportAll","getConnectedModularAccount","isSeedSigner","getConnectedManagedAccountAddress","resolveSmartWalletForPublish","getPublishThirdwebChain","getPublishConfig","startPublish","fromThirdwebAccount","ManagedAccountPublishError","getPublishChainName","isPublishWallet","getPublishWallet","ensureSmartWalletThenPublish_exports","ensureSmartWalletThenPublish","MSG_NO_ACCOUNT_MODULAR","MSG_MANAGED_UNAVAILABLE","coerceDataItemSigner","signer","ethers","config","address","getAddress","modularAccount","managedAddress","cause","wallet","item","options","resolved","activeAccount"],"sources":["../src/helpers/ensureSmartWalletThenPublish.ts"],"sourcesContent":["import type { Item } from '@seedprotocol/sdk'\nimport type { Account } from 'thirdweb/wallets'\nimport {\n getConnectedManagedAccountAddress,\n getConnectedModularAccount,\n resolveSmartWalletForPublish,\n} from './thirdweb'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { isPublishWallet, isSeedSigner, type PublishWallet, type SeedSigner } from './seedSigner'\nimport { ethers } from 'ethers'\nimport { startPublish } from './ensureWalletThenPublish'\nimport { getPublishWallet } from './publishWalletRegistry'\nimport type { CreatePublishOptions } from '../config'\nimport { getPublishConfig } from '../config'\nimport { ManagedAccountPublishError } from '../errors'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nexport type EnsureSmartWalletResult =\n | Extract<import('./ensureWalletThenPublish').EnsureWalletThenPublishResult, { outcome: 'started' | 'already_publishing' }>\n | { outcome: 'no_address' }\n | { outcome: 'needs_deploy' }\n | { outcome: 'managed_not_ready'; error: ManagedAccountPublishError }\n\nconst MSG_NO_ACCOUNT_MODULAR =\n 'A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.'\n\nconst MSG_MANAGED_UNAVAILABLE = () =>\n `Could not connect the managed publishing account on ${getPublishChainName()}. Reconnect with the same sign-in method and try again.`\n\nfunction coerceDataItemSigner(\n signer: CreatePublishOptions['dataItemSigner'] | Account | SeedSigner | PublishWallet | undefined,\n): CreatePublishOptions['dataItemSigner'] {\n if (!signer) return undefined\n if (signer instanceof ethers.Wallet) return signer\n if (isPublishWallet(signer)) return signer.signer\n if (isSeedSigner(signer)) return signer\n return fromThirdwebAccount(signer as Account).signer\n}\n\n/**\n * Thirdweb path: resolves the smart wallet for the current account; if deployed, starts publish.\n * Prefer {@link ensureWalletThenPublish} for vendor-neutral entry.\n */\nexport async function ensureSmartWalletThenPublish(\n item: Item<any>,\n activeAccount: Account | null | undefined,\n getAddress: () => Promise<string | null>,\n options?: CreatePublishOptions,\n): Promise<EnsureSmartWalletResult> {\n const config = getPublishConfig()\n const address = await getAddress()\n if (!address || !address.trim()) {\n return { outcome: 'no_address' }\n }\n\n if (config.useModularExecutor) {\n const modularAccount = await getConnectedModularAccount()\n if (!modularAccount) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(MSG_NO_ACCOUNT_MODULAR, 'MANAGED_ACCOUNT_UNAVAILABLE'),\n }\n }\n\n let managedAddress: string\n try {\n managedAddress = await getConnectedManagedAccountAddress(getPublishThirdwebChain())\n } catch (cause) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(\n MSG_MANAGED_UNAVAILABLE(),\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n undefined,\n cause,\n ),\n }\n }\n\n const wallet = fromThirdwebAccount(modularAccount, { kind: 'smart' })\n return startPublish(item, managedAddress, wallet, {\n ...options,\n dataItemSigner: coerceDataItemSigner(options?.dataItemSigner) ?? wallet.signer,\n })\n }\n\n const resolved = await resolveSmartWalletForPublish(activeAccount ?? null)\n if ('address' in resolved) {\n const wallet = fromThirdwebAccount(resolved.account, { kind: 'smart' })\n return startPublish(item, resolved.address, wallet, {\n ...options,\n // The smart account can't sign data items; ConnectButton registers its admin EOA for that.\n dataItemSigner:\n coerceDataItemSigner(options?.dataItemSigner) ?? getPublishWallet()?.dataItemSigner,\n })\n }\n return { outcome: 'needs_deploy' }\n}\n"],"mappings":";;;;;sEAwBMe,IACJ,+GAEIC,UACJ,uDAAuDN,EAAoB,EAAE;AAE/E,SAASO,EACP,GACwC;CACxC,IAAKC,GAIL,OAHIA,aAAkBC,EAAO,SAAeD,IACxCP,EAAgBO,CAAM,IAAUA,EAAO,SACvChB,EAAagB,CAAM,IAAUA,IAC1BV,EAAoBU,CAAiB,CAAC,CAAC;AAChD;AAMA,eAAsBJ,EACpB,GACA,GACA,GACA,GACkC;CAClC,IAAMM,IAASd,EAAiB,GAC1Be,IAAU,MAAMC,EAAW;CACjC,IAAI,CAACD,KAAW,CAACA,EAAQ,KAAK,GAC5B,OAAO,EAAE,SAAS,aAAa;CAGjC,IAAID,EAAO,oBAAoB;EAC7B,IAAMG,IAAiB,MAAMtB,EAA2B;EACxD,IAAI,CAACsB,GACH,OAAO;GACL,SAAS;GACT,OAAO,IAAId,EAA2BM,GAAwB,6BAA6B;EAC7F;EAGF,IAAIS;EACJ,IAAI;GACF,IAAiB,MAAMrB,EAAkCE,EAAwB,CAAC;EACpF,SAASoB,GAAO;GACd,OAAO;IACL,SAAS;IACT,OAAO,IAAIhB,EACTO,EAAwB,GACxB,+BACA,KAAA,GACAS,CACF;GACF;EACF;EAEA,IAAMC,IAASlB,EAAoBe,GAAgB,EAAE,MAAM,QAAQ,CAAC;EACpE,OAAOhB,EAAaoB,GAAMH,GAAgBE,GAAQ;GAChD,GAAGE;GACH,gBAAgBX,EAAqBW,GAAS,cAAc,KAAKF,EAAO;EAC1E,CAAC;CACH;CAEA,IAAMG,IAAW,MAAMzB,EAA6B0B,KAAiB,IAAI;CACzE,IAAI,aAAaD,GAAU;EACzB,IAAMH,IAASlB,EAAoBqB,EAAS,SAAS,EAAE,MAAM,QAAQ,CAAC;EACtE,OAAOtB,EAAaoB,GAAME,EAAS,SAASH,GAAQ;GAClD,GAAGE;GAEH,gBACEX,EAAqBW,GAAS,cAAc,KAAKhB,EAAiB,CAAC,EAAE;EACzE,CAAC;CACH;CACA,OAAO,EAAE,SAAS,eAAe;AACnC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { $t as e, At as t, Bt as n, C as r, Ct as i, D as a, Dt as o, E as s, Et as c, F as l, Ft as u, Gt as d, It as f, Jt as p, Kt as m, Lt as h, Mt as g, Nt as _, O as v, Ot as y, P as ee, Pt as te, Qt as ne, Rt as re, S as ie, St as ae, T as oe, Tt as se, Vt as ce, Wt as b, Xt as le, Yt as ue, Zt as de, _ as fe, a as x, an as pe, at as me, b as he, bt as ge, c as _e, cn as ve, ct as ye, d as be, dt as xe, en as Se, ft as Ce, g as we, h as Te, i as Ee, in as De, it as Oe, jt as ke, k as Ae, kt as je, l as Me, lt as Ne, m as Pe, n as Fe, nn as Ie, o as Le, on as Re, ot as ze, p as Be, pt as Ve, qt as He, r as Ue, rn as We, s as Ge, sn as S, st as Ke, t as qe, tn as Je, u as Ye, ut as Xe, v as Ze, vt as Qe, w as $e, wt as C, x as et, xt as tt, y as nt, yt as rt } from "./chainConfig-CY22-kWO.js";
1
+ import { $t as e, At as t, Bt as n, C as r, Ct as i, D as a, Dt as o, E as s, Et as c, F as l, Ft as u, Gt as d, It as f, Jt as p, Kt as m, Lt as h, Mt as g, Nt as _, O as v, Ot as y, P as ee, Pt as te, Qt as ne, Rt as re, S as ie, St as ae, T as oe, Tt as se, Vt as ce, Wt as b, Xt as le, Yt as ue, Zt as de, _ as fe, a as x, an as pe, at as me, b as he, bt as ge, c as _e, cn as ve, ct as ye, d as be, dt as xe, en as Se, ft as Ce, g as we, h as Te, i as Ee, in as De, it as Oe, jt as ke, k as Ae, kt as je, l as Me, lt as Ne, m as Pe, n as Fe, nn as Ie, o as Le, on as Re, ot as ze, p as Be, pt as Ve, qt as He, r as Ue, rn as We, s as Ge, sn as S, st as Ke, t as qe, tn as Je, u as Ye, ut as Xe, v as Ze, vt as Qe, w as $e, wt as C, x as et, xt as tt, y as nt, yt as rt } from "./chainConfig-NziDkhH8.js";
2
2
  import { i as it, r as w, t as at } from "./publishWalletRegistry-BaQe9rIR.js";
3
- import { a as ot, c as st, g as ct, h as lt, i as ut, l as dt, n as ft, o as pt, r as mt, s as ht, t as gt } from "./publishAuthorization-D2wbNc-H.js";
3
+ import { a as ot, c as st, g as ct, h as lt, i as ut, l as dt, n as ft, o as pt, r as mt, s as ht, t as gt } from "./publishAuthorization-5uWpBRgf.js";
4
4
  import { n as _t, r as vt } from "./collectBatchUids-CnIe9jUB.js";
5
5
  import { BaseDb as T, arweaveL1FinalizeJobs as E, isItemOwned as yt, publishProcesses as D, uploadProcesses as bt } from "@seedprotocol/sdk";
6
6
  import { createWalletClient as xt, custom as St, defineChain as Ct } from "viem";
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { W as t, Z as n, _t as r, qt as i, rt as a, t as o, zt as s } from "./chainConfig-CY22-kWO.js";
2
+ import { W as t, Z as n, _t as r, qt as i, rt as a, t as o, zt as s } from "./chainConfig-NziDkhH8.js";
3
3
  //#region src/helpers/managedAccountAdmin.ts
4
4
  var c = /* @__PURE__ */ e({ getManagedAccountAdmin: () => l });
5
5
  async function l(e) {
@@ -23,4 +23,4 @@ async function l(e) {
23
23
  //#endregion
24
24
  export { c as n, l as t };
25
25
 
26
- //# sourceMappingURL=managedAccountAdmin-DBAX8yny.js.map
26
+ //# sourceMappingURL=managedAccountAdmin-DDuGmmYZ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"managedAccountAdmin-DBAX8yny.js","names":["__exportAll","getModularAccountWallet","syncPublishInAppAuthToken","getPublishThirdwebChain","ManagedAccountPublishError","getClient","getPublishChainName","readIsAdmin","managedAccountAdmin_exports","getManagedAccountAdmin","wallet","admin","managedAddress","isAdmin","cause"],"sources":["../src/helpers/managedAccountAdmin.ts"],"sourcesContent":["import type { Address } from 'viem'\nimport type { Account } from 'thirdweb/wallets'\nimport { ManagedAccountPublishError } from '../errors'\nimport { getPublishChainName } from './chainConfig'\nimport { readIsAdmin } from './contracts'\nimport { getClient, getModularAccountWallet, syncPublishInAppAuthToken } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\n/**\n * Connects the user's in-app EOA, the ManagedAccount's admin, for admin-only transactions such as\n * `installSeedExecutor`. Those must come from the admin directly: the new contracts reject them as\n * self-calls from the smart account. `PublishConfig.thirdweb.modularWalletMode` decides whether\n * the EOA sends gas-sponsored EIP-7702 transactions (default) or plain funded ones.\n *\n * @throws ManagedAccountPublishError `MANAGED_ACCOUNT_UNAVAILABLE` when the wallet is not\n * connected or is not an admin of `managedAddress`\n */\nexport async function getManagedAccountAdmin(managedAddress: string): Promise<Account> {\n syncPublishInAppAuthToken()\n const wallet = getModularAccountWallet()\n await wallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const admin = wallet.getAccount()\n if (!admin) {\n throw new ManagedAccountPublishError(\n `Could not connect the in-app wallet that administers your publishing account on ${getPublishChainName()}. Reconnect with the same sign-in method and try again.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n let isAdmin: boolean\n try {\n isAdmin = await readIsAdmin(managedAddress as Address, admin.address as Address)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n `Could not check the admins of your publishing account on ${getPublishChainName()}.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n cause,\n )\n }\n if (!isAdmin) {\n throw new ManagedAccountPublishError(\n `The connected in-app wallet (${admin.address}) is not an admin of publishing account ${managedAddress}.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n return admin\n}\n"],"mappings":";;;;AAiBA,eAAsBS,EAAuB,GAA0C;CACrF,EAA0B;CAC1B,IAAMC,IAAST,EAAwB;CACvC,MAAMS,EAAO,YAAY;EAAE,QAAQL,EAAU;EAAG,OAAOF,EAAwB;CAAE,CAAC;CAClF,IAAMQ,IAAQD,EAAO,WAAW;CAChC,IAAI,CAACC,GACH,MAAM,IAAIP,EACR,mFAAmFE,EAAoB,EAAE,0DACzG,+BACAM,CACF;CAEF,IAAIC;CACJ,IAAI;EACF,IAAU,MAAMN,EAAYK,GAA2BD,EAAM,OAAkB;CACjF,SAASG,GAAO;EACd,MAAM,IAAIV,EACR,4DAA4DE,EAAoB,EAAE,IAClF,+BACAM,GACAE,CACF;CACF;CACA,IAAI,CAACD,GACH,MAAM,IAAIT,EACR,gCAAgCO,EAAM,QAAQ,0CAA0CC,EAAe,IACvG,+BACAA,CACF;CAEF,OAAOD;AACT"}
1
+ {"version":3,"file":"managedAccountAdmin-DDuGmmYZ.js","names":["__exportAll","getModularAccountWallet","syncPublishInAppAuthToken","getPublishThirdwebChain","ManagedAccountPublishError","getClient","getPublishChainName","readIsAdmin","managedAccountAdmin_exports","getManagedAccountAdmin","wallet","admin","managedAddress","isAdmin","cause"],"sources":["../src/helpers/managedAccountAdmin.ts"],"sourcesContent":["import type { Address } from 'viem'\nimport type { Account } from 'thirdweb/wallets'\nimport { ManagedAccountPublishError } from '../errors'\nimport { getPublishChainName } from './chainConfig'\nimport { readIsAdmin } from './contracts'\nimport { getClient, getModularAccountWallet, syncPublishInAppAuthToken } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\n/**\n * Connects the user's in-app EOA, the ManagedAccount's admin, for admin-only transactions such as\n * `installSeedExecutor`. Those must come from the admin directly: the new contracts reject them as\n * self-calls from the smart account. `PublishConfig.thirdweb.modularWalletMode` decides whether\n * the EOA sends gas-sponsored EIP-7702 transactions (default) or plain funded ones.\n *\n * @throws ManagedAccountPublishError `MANAGED_ACCOUNT_UNAVAILABLE` when the wallet is not\n * connected or is not an admin of `managedAddress`\n */\nexport async function getManagedAccountAdmin(managedAddress: string): Promise<Account> {\n syncPublishInAppAuthToken()\n const wallet = getModularAccountWallet()\n await wallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const admin = wallet.getAccount()\n if (!admin) {\n throw new ManagedAccountPublishError(\n `Could not connect the in-app wallet that administers your publishing account on ${getPublishChainName()}. Reconnect with the same sign-in method and try again.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n let isAdmin: boolean\n try {\n isAdmin = await readIsAdmin(managedAddress as Address, admin.address as Address)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n `Could not check the admins of your publishing account on ${getPublishChainName()}.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n cause,\n )\n }\n if (!isAdmin) {\n throw new ManagedAccountPublishError(\n `The connected in-app wallet (${admin.address}) is not an admin of publishing account ${managedAddress}.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n return admin\n}\n"],"mappings":";;;;AAiBA,eAAsBS,EAAuB,GAA0C;CACrF,EAA0B;CAC1B,IAAMC,IAAST,EAAwB;CACvC,MAAMS,EAAO,YAAY;EAAE,QAAQL,EAAU;EAAG,OAAOF,EAAwB;CAAE,CAAC;CAClF,IAAMQ,IAAQD,EAAO,WAAW;CAChC,IAAI,CAACC,GACH,MAAM,IAAIP,EACR,mFAAmFE,EAAoB,EAAE,0DACzG,+BACAM,CACF;CAEF,IAAIC;CACJ,IAAI;EACF,IAAU,MAAMN,EAAYK,GAA2BD,EAAM,OAAkB;CACjF,SAASG,GAAO;EACd,MAAM,IAAIV,EACR,4DAA4DE,EAAoB,EAAE,IAClF,+BACAM,GACAE,CACF;CACF;CACA,IAAI,CAACD,GACH,MAAM,IAAIT,EACR,gCAAgCO,EAAM,QAAQ,0CAA0CC,EAAe,IACvG,+BACAA,CACF;CAEF,OAAOD;AACT"}
@@ -1,4 +1,4 @@
1
- import { At as e, D as t, Et as n, O as r, Ot as i, Wt as a, a as o, k as s, kt as c, wt as l } from "./chainConfig-CY22-kWO.js";
1
+ import { At as e, D as t, Et as n, O as r, Ot as i, Wt as a, a as o, k as s, kt as c, wt as l } from "./chainConfig-NziDkhH8.js";
2
2
  import { keccak256 as u, toUtf8Bytes as d } from "ethers";
3
3
  import { SchemaEncoder as f, SchemaRegistry as p, ZERO_BYTES32 as m } from "@ethereum-attestation-service/eas-sdk";
4
4
  import { createContext as h, useContext as g } from "react";
@@ -173,4 +173,4 @@ async function q(e) {
173
173
  //#endregion
174
174
  export { G as a, H as c, N as d, P as f, A as g, k as h, q as i, K as l, j as m, x as n, W as o, F as p, C as r, U as s, y as t, M as u };
175
175
 
176
- //# sourceMappingURL=publishAuthorization-D2wbNc-H.js.map
176
+ //# sourceMappingURL=publishAuthorization-5uWpBRgf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"publishAuthorization-D2wbNc-H.js","names":["ZERO_ADDRESS","prepareEasMultiRevoke","prepareNameSchemaAttestation","isSeedTxSender","getSchemaRecord","getAttestationUidFromReceipt","waitForPublishReceipt","getPublishConfig","registerSchema","prepareEasAttest","isPublishWallet","PUBLISH_AUTHORIZATION_SCHEMA_DEF$1","PUBLISH_AUTHORIZATION_SCHEMA_NAME$1","PUBLISH_AUTHORIZATION_SCOPES$1","PublishConfigContext","createContext","usePublishConfig","config","useContext","approvedTargetsForAutomationPublish","module","PUBLISH_AUTOMATION_SCOPES","buildAutomationSessionKeyPermissions","out","params","hashAutomationSessionKeyPermissions","material","permissions","a","scopes","keccak256","toUtf8Bytes","toThirdwebSessionKeyPermissions","base","RESOLVER_ADDRESS","REVOCABLE","ZERO_ADDRESS$1","resolveTxSender","account","sendAndWait","result","txSender","tx","assertAddress","t","addr","label","getPublishAuthorizationSchemaUid","SchemaRegistry","PUBLISH_AUTHORIZATION_SCHEMA_DEF","ensurePublishAuthorizationSchema","sender","schemaUid","PUBLISH_AUTHORIZATION_SCHEMA_NAME","encodePublishAuthorizationAttestationData","SchemaEncoder","normalizeBytes32Hex","attestPublishAuthorization","identity","sessionKey","app","grantedAt","expiresAt","PUBLISH_AUTHORIZATION_SCOPES","permissionsHash","ZERO_BYTES32","expirationTime","PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS","data","receipt","uid","easContractAddress","isValidEasAttestationUid","revokePublishAuthorization","assessPublishAuthorizationLive","row","getPublishAuthorizationFromEas","r","decoded","decodePublishAuthorizationData","assessPublishAuthorization"],"sources":["../src/react/PublishConfigContext.tsx","../src/helpers/approvedTargetsForAutomationPublish.ts","../src/helpers/automationSessionKeyPermissions.ts","../src/services/publishAuthorization/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { PublishConfig } from '../config'\n\nexport const PublishConfigContext = createContext<PublishConfig | null>(null)\n\nexport function usePublishConfig(): PublishConfig {\n const config = useContext(PublishConfigContext)\n if (!config) {\n throw new Error(\n 'usePublishConfig: PublishConfig is missing. Pass config to PublishProvider or call initPublish() before render.',\n )\n }\n return config\n}\n","import { getPublishConfig } from '../config'\n\n/**\n * Allowlisted call targets for session keys on a ManagedAccount.\n * Returns only the configured Seed executor module — never the ManagedAccount or raw EAS\n * (those would allow `setEas` / arbitrary attestations).\n *\n * @throws if `modularAccountModuleContract` is unset or invalid\n */\nexport function approvedTargetsForAutomationPublish(): `0x${string}`[] {\n const module = getPublishConfig().modularAccountModuleContract?.trim()\n if (!module || !/^0x[0-9a-fA-F]{40}$/.test(module)) {\n throw new Error(\n '@seedprotocol/publish: session keys require PublishConfig.modularAccountModuleContract ' +\n '(their only approved target is the Seed executor module).',\n )\n }\n return [module.toLowerCase() as `0x${string}`]\n}\n","import { keccak256, toUtf8Bytes } from 'ethers'\nimport { approvedTargetsForAutomationPublish } from './approvedTargetsForAutomationPublish'\n\n/** Fixed v1 scopes for publish automation grants. */\nexport const PUBLISH_AUTOMATION_SCOPES = 'publish,revoke' as const\n\nexport type AutomationSessionKeyPermissions = {\n approvedTargets: `0x${string}`[]\n nativeTokenLimitPerTransaction: number\n /** Unix seconds; omit for Thirdweb default long window. */\n expiresAt?: number\n}\n\n/**\n * Canonical permissions for an automation session key (module-only targets).\n */\nexport function buildAutomationSessionKeyPermissions(params?: {\n expiresAt?: number\n}): AutomationSessionKeyPermissions {\n const approvedTargets = approvedTargetsForAutomationPublish()\n const out: AutomationSessionKeyPermissions = {\n approvedTargets,\n nativeTokenLimitPerTransaction: 0,\n }\n if (typeof params?.expiresAt === 'number' && params.expiresAt > 0) {\n out.expiresAt = Math.trunc(params.expiresAt)\n }\n return out\n}\n\n/**\n * Deterministic permissions hash for the PublishAuthorization sidecar.\n * Material: sorted targets | nativeLimit | expiresAt (0 if unset) | scopes\n */\nexport function hashAutomationSessionKeyPermissions(\n permissions: AutomationSessionKeyPermissions,\n scopes: string = PUBLISH_AUTOMATION_SCOPES,\n): `0x${string}` {\n const targets = [...permissions.approvedTargets].map((a) => a.toLowerCase()).sort().join(',')\n const limit = permissions.nativeTokenLimitPerTransaction\n const expiresAt = permissions.expiresAt ?? 0\n const material = `${targets}|${limit}|${expiresAt}|${scopes.trim()}`\n return keccak256(toUtf8Bytes(material)) as `0x${string}`\n}\n\n/** Shape passed to Thirdweb `addSessionKey` / `shouldUpdateSessionKey`. */\nexport function toThirdwebSessionKeyPermissions(permissions: AutomationSessionKeyPermissions): {\n approvedTargets: `0x${string}`[]\n nativeTokenLimitPerTransaction: number\n permissionEndTimestamp?: Date\n} {\n const base = {\n approvedTargets: permissions.approvedTargets,\n nativeTokenLimitPerTransaction: permissions.nativeTokenLimitPerTransaction,\n }\n if (permissions.expiresAt != null && permissions.expiresAt > 0) {\n return {\n ...base,\n permissionEndTimestamp: new Date(permissions.expiresAt * 1000),\n }\n }\n return base\n}\n","import {\n PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS,\n PUBLISH_AUTHORIZATION_SCHEMA_DEF,\n PUBLISH_AUTHORIZATION_SCHEMA_NAME,\n PUBLISH_AUTHORIZATION_SCOPES,\n assessPublishAuthorization,\n decodePublishAuthorizationData,\n getPublishAuthorizationFromEas,\n type PublishAuthorizationAssessResult,\n type PublishAuthorizationDecoded,\n} from '@seedprotocol/eas'\nimport { SchemaEncoder, ZERO_BYTES32 } from '@ethereum-attestation-service/eas-sdk'\nimport { SchemaRegistry } from '@ethereum-attestation-service/eas-sdk'\nimport { prepareEasAttest, prepareEasMultiRevoke } from '~/helpers/easDirect'\nimport { getSchemaRecord, registerSchema } from '~/helpers/schemaRegistry'\nimport { prepareNameSchemaAttestation } from '~/helpers/nameSchemaAttestation'\nimport { waitForPublishReceipt } from '~/helpers/chainClient'\nimport { getPublishConfig } from '~/config'\nimport {\n isPublishWallet,\n isSeedTxSender,\n type PublishWallet,\n type SeedTxSender,\n} from '~/helpers/seedSigner'\nimport { getAttestationUidFromReceipt } from '~/helpers/easDirect'\nimport { normalizeBytes32Hex, isValidEasAttestationUid } from '@seedprotocol/eas'\nimport {\n buildAutomationSessionKeyPermissions,\n hashAutomationSessionKeyPermissions,\n PUBLISH_AUTOMATION_SCOPES,\n} from '~/helpers/automationSessionKeyPermissions'\n\nexport {\n PUBLISH_AUTHORIZATION_SCHEMA_DEF,\n PUBLISH_AUTHORIZATION_SCHEMA_NAME,\n PUBLISH_AUTHORIZATION_SCOPES,\n} from '@seedprotocol/eas'\n\nconst RESOLVER_ADDRESS = '0x0000000000000000000000000000000000000000'\nconst REVOCABLE = true\nconst ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'\n\nfunction resolveTxSender(account: PublishWallet | SeedTxSender): SeedTxSender {\n if (isPublishWallet(account)) return account.txSender\n if (isSeedTxSender(account)) return account\n throw new Error(\n '@seedprotocol/publish: publish authorization write APIs require a PublishWallet or SeedTxSender',\n )\n}\n\nasync function sendAndWait(\n txSender: SeedTxSender,\n tx: Parameters<SeedTxSender['sendTransaction']>[0],\n) {\n const result = await txSender.sendTransaction(tx)\n return waitForPublishReceipt(result.transactionHash)\n}\n\nfunction assertAddress(label: string, addr: string): `0x${string}` {\n const t = addr.trim()\n if (!/^0x[0-9a-fA-F]{40}$/.test(t)) {\n throw new Error(`@seedprotocol/publish: ${label} must be a valid address`)\n }\n return t as `0x${string}`\n}\n\n/** Deterministic on-chain schema UID for {@link PUBLISH_AUTHORIZATION_SCHEMA_DEF}. */\nexport function getPublishAuthorizationSchemaUid(): `0x${string}` {\n return SchemaRegistry.getSchemaUID(\n PUBLISH_AUTHORIZATION_SCHEMA_DEF,\n RESOLVER_ADDRESS as `0x${string}`,\n REVOCABLE,\n ) as `0x${string}`\n}\n\n/**\n * Registers the PublishAuthorization EAS schema (if missing) and creates a Schema #1 name attestation.\n */\nexport async function ensurePublishAuthorizationSchema(\n account: PublishWallet | SeedTxSender,\n): Promise<`0x${string}`> {\n const sender = resolveTxSender(account)\n const schemaUid = getPublishAuthorizationSchemaUid()\n const onChain = await getSchemaRecord(schemaUid)\n if (!onChain) {\n await sendAndWait(\n sender,\n registerSchema({\n schema: PUBLISH_AUTHORIZATION_SCHEMA_DEF,\n resolverAddress: RESOLVER_ADDRESS,\n revocable: REVOCABLE,\n }),\n )\n await sendAndWait(\n sender,\n prepareNameSchemaAttestation({\n schemaUid,\n schemaName: PUBLISH_AUTHORIZATION_SCHEMA_NAME,\n }),\n )\n }\n return schemaUid\n}\n\nexport function encodePublishAuthorizationAttestationData(params: {\n identity: string\n sessionKey: string\n app: string\n scopes: string\n grantedAt: number\n expiresAt: number\n permissionsHash: string\n}): `0x${string}` {\n const schemaEncoder = new SchemaEncoder(PUBLISH_AUTHORIZATION_SCHEMA_DEF)\n const encodedData = schemaEncoder.encodeData([\n { name: 'identity', value: params.identity as `0x${string}`, type: 'address' },\n { name: 'sessionKey', value: params.sessionKey as `0x${string}`, type: 'address' },\n { name: 'app', value: params.app as `0x${string}`, type: 'address' },\n { name: 'scopes', value: params.scopes, type: 'string' },\n { name: 'grantedAt', value: params.grantedAt, type: 'uint64' },\n { name: 'expiresAt', value: params.expiresAt, type: 'uint64' },\n {\n name: 'permissionsHash',\n value: normalizeBytes32Hex(params.permissionsHash) as `0x${string}`,\n type: 'bytes32',\n },\n ])\n return encodedData as `0x${string}`\n}\n\nexport type AttestPublishAuthorizationParams = {\n /** Must be the ManagedAccount (identity) wallet — becomes EAS attester. */\n wallet: PublishWallet | SeedTxSender\n identity: string\n sessionKey: string\n /** Optional app label address; defaults to zero address. */\n app?: string\n scopes?: string\n grantedAt?: number\n expiresAt?: number\n permissionsHash?: string\n ensureSchema?: boolean\n /** Override EAS expirationTime (unix seconds). */\n expirationTime?: number\n}\n\nexport type AttestPublishAuthorizationResult = {\n uid: `0x${string}`\n schemaUid: `0x${string}`\n permissionsHash: `0x${string}`\n grantedAt: number\n expiresAt: number\n expirationTime: number\n}\n\n/**\n * ManagedAccount attests a PublishAuthorization grant (recipient = session key).\n */\nexport async function attestPublishAuthorization(\n params: AttestPublishAuthorizationParams,\n): Promise<AttestPublishAuthorizationResult> {\n const sender = resolveTxSender(params.wallet)\n const schemaUid =\n params.ensureSchema === false\n ? getPublishAuthorizationSchemaUid()\n : await ensurePublishAuthorizationSchema(params.wallet)\n\n const identity = assertAddress('identity', params.identity)\n const sessionKey = assertAddress('sessionKey', params.sessionKey)\n const app = params.app?.trim()\n ? assertAddress('app', params.app)\n : (ZERO_ADDRESS as `0x${string}`)\n\n const grantedAt = params.grantedAt ?? Math.floor(Date.now() / 1000)\n const expiresAt =\n typeof params.expiresAt === 'number' && params.expiresAt > 0\n ? Math.trunc(params.expiresAt)\n : 0\n const scopes = params.scopes ?? PUBLISH_AUTHORIZATION_SCOPES\n\n const permissionsHash = normalizeBytes32Hex(\n params.permissionsHash ??\n hashAutomationSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({\n expiresAt: expiresAt > 0 ? expiresAt : undefined,\n }),\n scopes === PUBLISH_AUTHORIZATION_SCOPES ? PUBLISH_AUTOMATION_SCOPES : scopes,\n ),\n ) as `0x${string}`\n\n if (permissionsHash === ZERO_BYTES32) {\n throw new Error(\n '@seedprotocol/publish: attestPublishAuthorization requires a non-zero permissionsHash',\n )\n }\n\n const expirationTime =\n typeof params.expirationTime === 'number' && params.expirationTime > 0\n ? params.expirationTime\n : expiresAt > 0\n ? expiresAt\n : grantedAt + PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS\n\n const data = encodePublishAuthorizationAttestationData({\n identity,\n sessionKey,\n app,\n scopes,\n grantedAt,\n expiresAt,\n permissionsHash,\n })\n\n const tx = prepareEasAttest({\n schema: schemaUid,\n data: {\n recipient: sessionKey,\n expirationTime: BigInt(expirationTime),\n revocable: true,\n refUID: ZERO_BYTES32 as `0x${string}`,\n data,\n value: 0n,\n },\n })\n\n const receipt = await sendAndWait(sender, tx)\n if (!receipt) {\n throw new Error('@seedprotocol/publish: attestPublishAuthorization failed — no receipt')\n }\n const { easContractAddress } = getPublishConfig()\n const uid = getAttestationUidFromReceipt(receipt, easContractAddress)\n if (!uid || !isValidEasAttestationUid(uid)) {\n throw new Error(\n '@seedprotocol/publish: attestPublishAuthorization failed — could not parse attestation UID',\n )\n }\n\n return {\n uid: uid as `0x${string}`,\n schemaUid,\n permissionsHash,\n grantedAt,\n expiresAt,\n expirationTime,\n }\n}\n\n/**\n * Revoke a PublishAuthorization sidecar (must be signed by the original ManagedAccount attester).\n */\nexport async function revokePublishAuthorization(params: {\n wallet: PublishWallet | SeedTxSender\n uid: string\n schemaUid?: string\n}): Promise<void> {\n const sender = resolveTxSender(params.wallet)\n const schemaUid = (params.schemaUid ?? getPublishAuthorizationSchemaUid()) as `0x${string}`\n const uid = normalizeBytes32Hex(params.uid) as `0x${string}`\n if (!isValidEasAttestationUid(uid)) {\n throw new Error(\n '@seedprotocol/publish: revokePublishAuthorization requires a valid attestation uid',\n )\n }\n\n const tx = prepareEasMultiRevoke([\n {\n schema: schemaUid,\n data: [{ uid }],\n },\n ])\n const receipt = await sendAndWait(sender, tx)\n if (!receipt) {\n throw new Error('@seedprotocol/publish: revokePublishAuthorization failed — no receipt')\n }\n}\n\nexport type AssessPublishAuthorizationLiveResult = {\n uid: string\n decoded: PublishAuthorizationDecoded\n assess: PublishAuthorizationAssessResult\n expirationTime?: number | null\n}\n\n/**\n * Load a PublishAuthorization attestation by uid (via identity filter + client match) and assess.\n * Prefer filtering with {@link getPublishAuthorizationFromEas} when you know identity/sessionKey.\n */\nexport async function assessPublishAuthorizationLive(params: {\n uid: string\n identities: string[]\n}): Promise<AssessPublishAuthorizationLiveResult | null> {\n const rows = await getPublishAuthorizationFromEas({\n identities: params.identities,\n excludeRevoked: false,\n })\n const row = rows.find((r) => r.id?.toLowerCase() === params.uid.toLowerCase())\n if (!row) return null\n const decoded = decodePublishAuthorizationData(row.decodedDataJson ?? '[]')\n const expirationTime =\n typeof row.expirationTime === 'number'\n ? row.expirationTime\n : typeof row.expirationTime === 'string'\n ? Number(row.expirationTime)\n : null\n return {\n uid: row.id,\n decoded,\n assess: assessPublishAuthorization({ decoded, expirationTime }),\n expirationTime,\n }\n}\n"],"mappings":";;;;;;AAGA,IAAac,IAAuBC,EAAoC,IAAI;AAE5E,SAAgBC,IAAkC;CAChD,IAAMC,IAASC,EAAWJ,CAAoB;CAC9C,IAAI,CAACG,GACH,MAAU,MACR,iHACF;CAEF,OAAOA;AACT;;;ACJA,SAAgBE,IAAuD;CACrE,IAAMC,IAASb,EAAiB,CAAC,CAAC,8BAA8B,KAAK;CACrE,IAAI,CAACa,KAAU,CAAC,sBAAsB,KAAKA,CAAM,GAC/C,MAAU,MACR,kJAEF;CAEF,OAAO,CAACA,EAAO,YAAY,CAAkB;AAC/C;;;ACdA,IAAaC,I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AE,GAE1C,MAAU,MAAM,uEAAuE;AAE3F;AAaA,eAAsBsB,EAA+B,GAGI;CAKvD,IAAMC,KAAM,MAJOC,EAA+B;EAChD,YAAYpD,EAAO;EACnB,gBAAgB;CAClB,CAAC,EAAA,CACgB,MAAM,MAAMqD,EAAE,IAAI,YAAY,MAAMrD,EAAO,IAAI,YAAY,CAAC;CAC7E,IAAI,CAACmD,GAAK,OAAO;CACjB,IAAMG,IAAUC,EAA+BJ,EAAI,mBAAmB,IAAI,GACpET,IACJ,OAAOS,EAAI,kBAAmB,WAC1BA,EAAI,iBACJ,OAAOA,EAAI,kBAAmB,WAC5B,OAAOA,EAAI,cAAc,IACzB;CACR,OAAO;EACL,KAAKA,EAAI;EACT;EACA,QAAQK,EAA2B;GAAE;GAAS;EAAe,CAAC;EAC9D;CACF;AACF"}
1
+ {"version":3,"file":"publishAuthorization-5uWpBRgf.js","names":["ZERO_ADDRESS","prepareEasMultiRevoke","prepareNameSchemaAttestation","isSeedTxSender","getSchemaRecord","getAttestationUidFromReceipt","waitForPublishReceipt","getPublishConfig","registerSchema","prepareEasAttest","isPublishWallet","PUBLISH_AUTHORIZATION_SCHEMA_DEF$1","PUBLISH_AUTHORIZATION_SCHEMA_NAME$1","PUBLISH_AUTHORIZATION_SCOPES$1","PublishConfigContext","createContext","usePublishConfig","config","useContext","approvedTargetsForAutomationPublish","module","PUBLISH_AUTOMATION_SCOPES","buildAutomationSessionKeyPermissions","out","params","hashAutomationSessionKeyPermissions","material","permissions","a","scopes","keccak256","toUtf8Bytes","toThirdwebSessionKeyPermissions","base","RESOLVER_ADDRESS","REVOCABLE","ZERO_ADDRESS$1","resolveTxSender","account","sendAndWait","result","txSender","tx","assertAddress","t","addr","label","getPublishAuthorizationSchemaUid","SchemaRegistry","PUBLISH_AUTHORIZATION_SCHEMA_DEF","ensurePublishAuthorizationSchema","sender","schemaUid","PUBLISH_AUTHORIZATION_SCHEMA_NAME","encodePublishAuthorizationAttestationData","SchemaEncoder","normalizeBytes32Hex","attestPublishAuthorization","identity","sessionKey","app","grantedAt","expiresAt","PUBLISH_AUTHORIZATION_SCOPES","permissionsHash","ZERO_BYTES32","expirationTime","PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS","data","receipt","uid","easContractAddress","isValidEasAttestationUid","revokePublishAuthorization","assessPublishAuthorizationLive","row","getPublishAuthorizationFromEas","r","decoded","decodePublishAuthorizationData","assessPublishAuthorization"],"sources":["../src/react/PublishConfigContext.tsx","../src/helpers/approvedTargetsForAutomationPublish.ts","../src/helpers/automationSessionKeyPermissions.ts","../src/services/publishAuthorization/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { PublishConfig } from '../config'\n\nexport const PublishConfigContext = createContext<PublishConfig | null>(null)\n\nexport function usePublishConfig(): PublishConfig {\n const config = useContext(PublishConfigContext)\n if (!config) {\n throw new Error(\n 'usePublishConfig: PublishConfig is missing. Pass config to PublishProvider or call initPublish() before render.',\n )\n }\n return config\n}\n","import { getPublishConfig } from '../config'\n\n/**\n * Allowlisted call targets for session keys on a ManagedAccount.\n * Returns only the configured Seed executor module — never the ManagedAccount or raw EAS\n * (those would allow `setEas` / arbitrary attestations).\n *\n * @throws if `modularAccountModuleContract` is unset or invalid\n */\nexport function approvedTargetsForAutomationPublish(): `0x${string}`[] {\n const module = getPublishConfig().modularAccountModuleContract?.trim()\n if (!module || !/^0x[0-9a-fA-F]{40}$/.test(module)) {\n throw new Error(\n '@seedprotocol/publish: session keys require PublishConfig.modularAccountModuleContract ' +\n '(their only approved target is the Seed executor module).',\n )\n }\n return [module.toLowerCase() as `0x${string}`]\n}\n","import { keccak256, toUtf8Bytes } from 'ethers'\nimport { approvedTargetsForAutomationPublish } from './approvedTargetsForAutomationPublish'\n\n/** Fixed v1 scopes for publish automation grants. */\nexport const PUBLISH_AUTOMATION_SCOPES = 'publish,revoke' as const\n\nexport type AutomationSessionKeyPermissions = {\n approvedTargets: `0x${string}`[]\n nativeTokenLimitPerTransaction: number\n /** Unix seconds; omit for Thirdweb default long window. */\n expiresAt?: number\n}\n\n/**\n * Canonical permissions for an automation session key (module-only targets).\n */\nexport function buildAutomationSessionKeyPermissions(params?: {\n expiresAt?: number\n}): AutomationSessionKeyPermissions {\n const approvedTargets = approvedTargetsForAutomationPublish()\n const out: AutomationSessionKeyPermissions = {\n approvedTargets,\n nativeTokenLimitPerTransaction: 0,\n }\n if (typeof params?.expiresAt === 'number' && params.expiresAt > 0) {\n out.expiresAt = Math.trunc(params.expiresAt)\n }\n return out\n}\n\n/**\n * Deterministic permissions hash for the PublishAuthorization sidecar.\n * Material: sorted targets | nativeLimit | expiresAt (0 if unset) | scopes\n */\nexport function hashAutomationSessionKeyPermissions(\n permissions: AutomationSessionKeyPermissions,\n scopes: string = PUBLISH_AUTOMATION_SCOPES,\n): `0x${string}` {\n const targets = [...permissions.approvedTargets].map((a) => a.toLowerCase()).sort().join(',')\n const limit = permissions.nativeTokenLimitPerTransaction\n const expiresAt = permissions.expiresAt ?? 0\n const material = `${targets}|${limit}|${expiresAt}|${scopes.trim()}`\n return keccak256(toUtf8Bytes(material)) as `0x${string}`\n}\n\n/** Shape passed to Thirdweb `addSessionKey` / `shouldUpdateSessionKey`. */\nexport function toThirdwebSessionKeyPermissions(permissions: AutomationSessionKeyPermissions): {\n approvedTargets: `0x${string}`[]\n nativeTokenLimitPerTransaction: number\n permissionEndTimestamp?: Date\n} {\n const base = {\n approvedTargets: permissions.approvedTargets,\n nativeTokenLimitPerTransaction: permissions.nativeTokenLimitPerTransaction,\n }\n if (permissions.expiresAt != null && permissions.expiresAt > 0) {\n return {\n ...base,\n permissionEndTimestamp: new Date(permissions.expiresAt * 1000),\n }\n }\n return base\n}\n","import {\n PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS,\n PUBLISH_AUTHORIZATION_SCHEMA_DEF,\n PUBLISH_AUTHORIZATION_SCHEMA_NAME,\n PUBLISH_AUTHORIZATION_SCOPES,\n assessPublishAuthorization,\n decodePublishAuthorizationData,\n getPublishAuthorizationFromEas,\n type PublishAuthorizationAssessResult,\n type PublishAuthorizationDecoded,\n} from '@seedprotocol/eas'\nimport { SchemaEncoder, ZERO_BYTES32 } from '@ethereum-attestation-service/eas-sdk'\nimport { SchemaRegistry } from '@ethereum-attestation-service/eas-sdk'\nimport { prepareEasAttest, prepareEasMultiRevoke } from '~/helpers/easDirect'\nimport { getSchemaRecord, registerSchema } from '~/helpers/schemaRegistry'\nimport { prepareNameSchemaAttestation } from '~/helpers/nameSchemaAttestation'\nimport { waitForPublishReceipt } from '~/helpers/chainClient'\nimport { getPublishConfig } from '~/config'\nimport {\n isPublishWallet,\n isSeedTxSender,\n type PublishWallet,\n type SeedTxSender,\n} from '~/helpers/seedSigner'\nimport { getAttestationUidFromReceipt } from '~/helpers/easDirect'\nimport { normalizeBytes32Hex, isValidEasAttestationUid } from '@seedprotocol/eas'\nimport {\n buildAutomationSessionKeyPermissions,\n hashAutomationSessionKeyPermissions,\n PUBLISH_AUTOMATION_SCOPES,\n} from '~/helpers/automationSessionKeyPermissions'\n\nexport {\n PUBLISH_AUTHORIZATION_SCHEMA_DEF,\n PUBLISH_AUTHORIZATION_SCHEMA_NAME,\n PUBLISH_AUTHORIZATION_SCOPES,\n} from '@seedprotocol/eas'\n\nconst RESOLVER_ADDRESS = '0x0000000000000000000000000000000000000000'\nconst REVOCABLE = true\nconst ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'\n\nfunction resolveTxSender(account: PublishWallet | SeedTxSender): SeedTxSender {\n if (isPublishWallet(account)) return account.txSender\n if (isSeedTxSender(account)) return account\n throw new Error(\n '@seedprotocol/publish: publish authorization write APIs require a PublishWallet or SeedTxSender',\n )\n}\n\nasync function sendAndWait(\n txSender: SeedTxSender,\n tx: Parameters<SeedTxSender['sendTransaction']>[0],\n) {\n const result = await txSender.sendTransaction(tx)\n return waitForPublishReceipt(result.transactionHash)\n}\n\nfunction assertAddress(label: string, addr: string): `0x${string}` {\n const t = addr.trim()\n if (!/^0x[0-9a-fA-F]{40}$/.test(t)) {\n throw new Error(`@seedprotocol/publish: ${label} must be a valid address`)\n }\n return t as `0x${string}`\n}\n\n/** Deterministic on-chain schema UID for {@link PUBLISH_AUTHORIZATION_SCHEMA_DEF}. */\nexport function getPublishAuthorizationSchemaUid(): `0x${string}` {\n return SchemaRegistry.getSchemaUID(\n PUBLISH_AUTHORIZATION_SCHEMA_DEF,\n RESOLVER_ADDRESS as `0x${string}`,\n REVOCABLE,\n ) as `0x${string}`\n}\n\n/**\n * Registers the PublishAuthorization EAS schema (if missing) and creates a Schema #1 name attestation.\n */\nexport async function ensurePublishAuthorizationSchema(\n account: PublishWallet | SeedTxSender,\n): Promise<`0x${string}`> {\n const sender = resolveTxSender(account)\n const schemaUid = getPublishAuthorizationSchemaUid()\n const onChain = await getSchemaRecord(schemaUid)\n if (!onChain) {\n await sendAndWait(\n sender,\n registerSchema({\n schema: PUBLISH_AUTHORIZATION_SCHEMA_DEF,\n resolverAddress: RESOLVER_ADDRESS,\n revocable: REVOCABLE,\n }),\n )\n await sendAndWait(\n sender,\n prepareNameSchemaAttestation({\n schemaUid,\n schemaName: PUBLISH_AUTHORIZATION_SCHEMA_NAME,\n }),\n )\n }\n return schemaUid\n}\n\nexport function encodePublishAuthorizationAttestationData(params: {\n identity: string\n sessionKey: string\n app: string\n scopes: string\n grantedAt: number\n expiresAt: number\n permissionsHash: string\n}): `0x${string}` {\n const schemaEncoder = new SchemaEncoder(PUBLISH_AUTHORIZATION_SCHEMA_DEF)\n const encodedData = schemaEncoder.encodeData([\n { name: 'identity', value: params.identity as `0x${string}`, type: 'address' },\n { name: 'sessionKey', value: params.sessionKey as `0x${string}`, type: 'address' },\n { name: 'app', value: params.app as `0x${string}`, type: 'address' },\n { name: 'scopes', value: params.scopes, type: 'string' },\n { name: 'grantedAt', value: params.grantedAt, type: 'uint64' },\n { name: 'expiresAt', value: params.expiresAt, type: 'uint64' },\n {\n name: 'permissionsHash',\n value: normalizeBytes32Hex(params.permissionsHash) as `0x${string}`,\n type: 'bytes32',\n },\n ])\n return encodedData as `0x${string}`\n}\n\nexport type AttestPublishAuthorizationParams = {\n /** Must be the ManagedAccount (identity) wallet — becomes EAS attester. */\n wallet: PublishWallet | SeedTxSender\n identity: string\n sessionKey: string\n /** Optional app label address; defaults to zero address. */\n app?: string\n scopes?: string\n grantedAt?: number\n expiresAt?: number\n permissionsHash?: string\n ensureSchema?: boolean\n /** Override EAS expirationTime (unix seconds). */\n expirationTime?: number\n}\n\nexport type AttestPublishAuthorizationResult = {\n uid: `0x${string}`\n schemaUid: `0x${string}`\n permissionsHash: `0x${string}`\n grantedAt: number\n expiresAt: number\n expirationTime: number\n}\n\n/**\n * ManagedAccount attests a PublishAuthorization grant (recipient = session key).\n */\nexport async function attestPublishAuthorization(\n params: AttestPublishAuthorizationParams,\n): Promise<AttestPublishAuthorizationResult> {\n const sender = resolveTxSender(params.wallet)\n const schemaUid =\n params.ensureSchema === false\n ? getPublishAuthorizationSchemaUid()\n : await ensurePublishAuthorizationSchema(params.wallet)\n\n const identity = assertAddress('identity', params.identity)\n const sessionKey = assertAddress('sessionKey', params.sessionKey)\n const app = params.app?.trim()\n ? assertAddress('app', params.app)\n : (ZERO_ADDRESS as `0x${string}`)\n\n const grantedAt = params.grantedAt ?? Math.floor(Date.now() / 1000)\n const expiresAt =\n typeof params.expiresAt === 'number' && params.expiresAt > 0\n ? Math.trunc(params.expiresAt)\n : 0\n const scopes = params.scopes ?? PUBLISH_AUTHORIZATION_SCOPES\n\n const permissionsHash = normalizeBytes32Hex(\n params.permissionsHash ??\n hashAutomationSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({\n expiresAt: expiresAt > 0 ? expiresAt : undefined,\n }),\n scopes === PUBLISH_AUTHORIZATION_SCOPES ? PUBLISH_AUTOMATION_SCOPES : scopes,\n ),\n ) as `0x${string}`\n\n if (permissionsHash === ZERO_BYTES32) {\n throw new Error(\n '@seedprotocol/publish: attestPublishAuthorization requires a non-zero permissionsHash',\n )\n }\n\n const expirationTime =\n typeof params.expirationTime === 'number' && params.expirationTime > 0\n ? params.expirationTime\n : expiresAt > 0\n ? expiresAt\n : grantedAt + PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS\n\n const data = encodePublishAuthorizationAttestationData({\n identity,\n sessionKey,\n app,\n scopes,\n grantedAt,\n expiresAt,\n permissionsHash,\n })\n\n const tx = prepareEasAttest({\n schema: schemaUid,\n data: {\n recipient: sessionKey,\n expirationTime: BigInt(expirationTime),\n revocable: true,\n refUID: ZERO_BYTES32 as `0x${string}`,\n data,\n value: 0n,\n },\n })\n\n const receipt = await sendAndWait(sender, tx)\n if (!receipt) {\n throw new Error('@seedprotocol/publish: attestPublishAuthorization failed — no receipt')\n }\n const { easContractAddress } = getPublishConfig()\n const uid = getAttestationUidFromReceipt(receipt, easContractAddress)\n if (!uid || !isValidEasAttestationUid(uid)) {\n throw new Error(\n '@seedprotocol/publish: attestPublishAuthorization failed — could not parse attestation UID',\n )\n }\n\n return {\n uid: uid as `0x${string}`,\n schemaUid,\n permissionsHash,\n grantedAt,\n expiresAt,\n expirationTime,\n }\n}\n\n/**\n * Revoke a PublishAuthorization sidecar (must be signed by the original ManagedAccount attester).\n */\nexport async function revokePublishAuthorization(params: {\n wallet: PublishWallet | SeedTxSender\n uid: string\n schemaUid?: string\n}): Promise<void> {\n const sender = resolveTxSender(params.wallet)\n const schemaUid = (params.schemaUid ?? getPublishAuthorizationSchemaUid()) as `0x${string}`\n const uid = normalizeBytes32Hex(params.uid) as `0x${string}`\n if (!isValidEasAttestationUid(uid)) {\n throw new Error(\n '@seedprotocol/publish: revokePublishAuthorization requires a valid attestation uid',\n )\n }\n\n const tx = prepareEasMultiRevoke([\n {\n schema: schemaUid,\n data: [{ uid }],\n },\n ])\n const receipt = await sendAndWait(sender, tx)\n if (!receipt) {\n throw new Error('@seedprotocol/publish: revokePublishAuthorization failed — no receipt')\n }\n}\n\nexport type AssessPublishAuthorizationLiveResult = {\n uid: string\n decoded: PublishAuthorizationDecoded\n assess: PublishAuthorizationAssessResult\n expirationTime?: number | null\n}\n\n/**\n * Load a PublishAuthorization attestation by uid (via identity filter + client match) and assess.\n * Prefer filtering with {@link getPublishAuthorizationFromEas} when you know identity/sessionKey.\n */\nexport async function assessPublishAuthorizationLive(params: {\n uid: string\n identities: string[]\n}): Promise<AssessPublishAuthorizationLiveResult | null> {\n const rows = await getPublishAuthorizationFromEas({\n identities: params.identities,\n excludeRevoked: false,\n })\n const row = rows.find((r) => r.id?.toLowerCase() === params.uid.toLowerCase())\n if (!row) return null\n const decoded = decodePublishAuthorizationData(row.decodedDataJson ?? '[]')\n const expirationTime =\n typeof row.expirationTime === 'number'\n ? row.expirationTime\n : typeof row.expirationTime === 'string'\n ? Number(row.expirationTime)\n : null\n return {\n uid: row.id,\n decoded,\n assess: assessPublishAuthorization({ decoded, expirationTime }),\n expirationTime,\n }\n}\n"],"mappings":";;;;;;AAGA,IAAac,IAAuBC,EAAoC,IAAI;AAE5E,SAAgBC,IAAkC;CAChD,IAAMC,IAASC,EAAWJ,CAAoB;CAC9C,IAAI,CAACG,GACH,MAAU,MACR,iHACF;CAEF,OAAOA;AACT;;;ACJA,SAAgBE,IAAuD;CACrE,IAAMC,IAASb,EAAiB,CAAC,CAAC,8BAA8B,KAAK;CACrE,IAAI,CAACa,KAAU,CAAC,sBAAsB,KAAKA,CAAM,GAC/C,MAAU,MACR,kJAEF;CAEF,OAAO,CAACA,EAAO,YAAY,CAAkB;AAC/C;;;ACdA,IAAaC,IAA4B;AAYzC,SAAgBC,EAAqC,GAEjB;CAElC,IAAMC,IAAuC;EAC3C,iBAFsBJ,EAEtB;EACA,gCAAgC;CAClC;CAIA,OAHI,OAAOK,GAAQ,aAAc,YAAYA,EAAO,YAAY,MAC9D,EAAI,YAAY,KAAK,MAAMA,EAAO,SAAS,IAEtCD;AACT;AAMA,SAAgBE,EACd,GACA,IAAiBJ,GACF;CAIf,IAAMK,IAAW,GAHD,CAAC,GAAG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J,EAAI,mBAAmB,IAAI,GACpET,IACJ,OAAOS,EAAI,kBAAmB,WAC1BA,EAAI,iBACJ,OAAOA,EAAI,kBAAmB,WAC5B,OAAOA,EAAI,cAAc,IACzB;CACR,OAAO;EACL,KAAKA,EAAI;EACT;EACA,QAAQK,EAA2B;GAAE;GAAS;EAAe,CAAC;EAC9D;CACF;AACF"}
@@ -1,4 +1,4 @@
1
- import { J as e, K as t, U as n, V as r, Z as i, _t as a, a as o, rt as s } from "./chainConfig-CY22-kWO.js";
1
+ import { J as e, K as t, U as n, V as r, Z as i, _t as a, a as o, rt as s } from "./chainConfig-NziDkhH8.js";
2
2
  import { getGetAdditionalSyncAddresses as c } from "@seedprotocol/sdk";
3
3
  //#region src/helpers/resolveRevokeAccount.ts
4
4
  async function l(l) {
@@ -34,4 +34,4 @@ async function l(l) {
34
34
  //#endregion
35
35
  export { l as resolveRevokeAccount };
36
36
 
37
- //# sourceMappingURL=resolveRevokeAccount-B7cj6OyT.js.map
37
+ //# sourceMappingURL=resolveRevokeAccount-DVGdovxJ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveRevokeAccount-B7cj6OyT.js","names":["isSmartWalletDeployed","getSmartWalletAddressForAdmin","getManagedAccountWallet","getConnectedManagedAccountAddress","syncPublishInAppAuthToken","getPublishThirdwebChain","getPublishConfig","getClient","resolveRevokeAccount","params","attester","account","additionalGetter","getGetAdditionalSyncAddresses","attesterIsExecutorModule","additional","attesterLower","a","derivedManagedAccount","managedAddress","managedAccountWallet","managedAccount","modularAccountModuleContract"],"sources":["../src/helpers/resolveRevokeAccount.ts"],"sourcesContent":["import type { Account } from 'thirdweb/wallets'\nimport { getGetAdditionalSyncAddresses } from '@seedprotocol/sdk'\nimport { getPublishConfig } from '~/config'\nimport {\n getClient,\n getSmartWalletAddressForAdmin,\n isSmartWalletDeployed,\n getManagedAccountWallet,\n getConnectedManagedAccountAddress,\n syncPublishInAppAuthToken,\n} from '~/helpers/thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\n/**\n * Resolves which account to use for revoking attestations.\n * When the attester is the user's ManagedAccount (EIP4337) but they're connected\n * with a different wallet (e.g. EOA or modular account), attempts to use the\n * ManagedAccount wallet for the revoke.\n *\n * When the attester is the legacy executor module address, attempts the ManagedAccount\n * wallet if `modularAccountModuleContract` is configured (executor-routed multiRevoke).\n * Throws only when the module was the attester and no ManagedAccount path is available.\n */\nexport async function resolveRevokeAccount(params: {\n account: Account\n attester: string | null\n}): Promise<Account> {\n const { account, attester } = params\n\n if (!attester || account.address.toLowerCase() === attester.toLowerCase()) {\n return account\n }\n\n const additionalGetter = getGetAdditionalSyncAddresses()\n let attesterIsExecutorModule = false\n if (additionalGetter) {\n const additional = await additionalGetter()\n const attesterLower = attester.toLowerCase()\n attesterIsExecutorModule = !!additional?.some(\n (a: string | undefined) => a?.toLowerCase() === attesterLower,\n )\n }\n\n try {\n const derivedManagedAccount = await getSmartWalletAddressForAdmin(account.address)\n const attesterLower = attester.toLowerCase()\n const derivedLower = derivedManagedAccount.toLowerCase()\n\n if (attesterLower === derivedLower || attesterIsExecutorModule) {\n const managedAddress = attesterIsExecutorModule\n ? await getConnectedManagedAccountAddress(getPublishThirdwebChain()).catch(() => derivedManagedAccount)\n : derivedManagedAccount\n const deployed = await isSmartWalletDeployed(managedAddress)\n if (deployed) {\n // Same as ensureModularPublishBootstrap: the managed wallet reads the in-app session token.\n syncPublishInAppAuthToken()\n const managedAccountWallet = getManagedAccountWallet()\n await managedAccountWallet.autoConnect({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n })\n const managedAccount = managedAccountWallet.getAccount()\n if (managedAccount) {\n return managedAccount\n }\n }\n }\n } catch {\n // Fall through\n }\n\n if (attesterIsExecutorModule) {\n const { modularAccountModuleContract } = getPublishConfig()\n if (!modularAccountModuleContract?.trim()) {\n throw new Error(\n 'Revocation not supported for items published via the modular executor.',\n )\n }\n // Module configured but ManagedAccount wallet unavailable\n throw new Error(\n 'Revocation not supported for items published via the modular executor. Connect the ManagedAccount that controls the executor module.',\n )\n }\n\n return account\n}\n"],"mappings":";;;AAuBA,eAAsBQ,EAAqB,GAGtB;CACnB,IAAM,EAAE,YAAS,gBAAaC;CAE9B,IAAI,CAACC,KAAYC,EAAQ,QAAQ,YAAY,MAAMD,EAAS,YAAY,GACtE,OAAOC;CAGT,IAAMC,IAAmBC,EAA8B,GACnDC,IAA2B;CAC/B,IAAIF,GAAkB;EACpB,IAAMG,IAAa,MAAMH,EAAiB,GACpCI,IAAgBN,EAAS,YAAY;EAC3C,IAA2B,CAAC,CAACK,GAAY,MACtC,MAA0BE,GAAG,YAAY,MAAMD,CAClD;CACF;CAEA,IAAI;EACF,IAAME,IAAwB,MAAMjB,EAA8BU,EAAQ,OAAO;EAIjF,IAHsBD,EAAS,YAG3B,MAFiBQ,EAAsB,YAErB,KAAgBJ,GAA0B;GAC9D,IAAMK,IAAiBL,IACnB,MAAMX,EAAkCE,EAAwB,CAAC,CAAC,CAAC,YAAYa,CAAqB,IACpGA;GAEJ,IAAI,MADmBlB,EAAsBmB,CAAc,GAC7C;IAEZ,EAA0B;IAC1B,IAAMC,IAAuBlB,EAAwB;IACrD,MAAMkB,EAAqB,YAAY;KACrC,QAAQb,EAAU;KAClB,OAAOF,EAAwB;IACjC,CAAC;IACD,IAAMgB,IAAiBD,EAAqB,WAAW;IACvD,IAAIC,GACF,OAAOA;GAEX;EACF;CACF,QAAQ,CAER;CAEA,IAAIP,GAA0B;EAC5B,IAAM,EAAE,oCAAiCR,EAAiB;EAO1D,MANKgB,GAA8B,KAAK,IAM9B,MACR,sIACF,IAPY,MACR,wEACF;CAMJ;CAEA,OAAOX;AACT"}
1
+ {"version":3,"file":"resolveRevokeAccount-DVGdovxJ.js","names":["isSmartWalletDeployed","getSmartWalletAddressForAdmin","getManagedAccountWallet","getConnectedManagedAccountAddress","syncPublishInAppAuthToken","getPublishThirdwebChain","getPublishConfig","getClient","resolveRevokeAccount","params","attester","account","additionalGetter","getGetAdditionalSyncAddresses","attesterIsExecutorModule","additional","attesterLower","a","derivedManagedAccount","managedAddress","managedAccountWallet","managedAccount","modularAccountModuleContract"],"sources":["../src/helpers/resolveRevokeAccount.ts"],"sourcesContent":["import type { Account } from 'thirdweb/wallets'\nimport { getGetAdditionalSyncAddresses } from '@seedprotocol/sdk'\nimport { getPublishConfig } from '~/config'\nimport {\n getClient,\n getSmartWalletAddressForAdmin,\n isSmartWalletDeployed,\n getManagedAccountWallet,\n getConnectedManagedAccountAddress,\n syncPublishInAppAuthToken,\n} from '~/helpers/thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\n/**\n * Resolves which account to use for revoking attestations.\n * When the attester is the user's ManagedAccount (EIP4337) but they're connected\n * with a different wallet (e.g. EOA or modular account), attempts to use the\n * ManagedAccount wallet for the revoke.\n *\n * When the attester is the legacy executor module address, attempts the ManagedAccount\n * wallet if `modularAccountModuleContract` is configured (executor-routed multiRevoke).\n * Throws only when the module was the attester and no ManagedAccount path is available.\n */\nexport async function resolveRevokeAccount(params: {\n account: Account\n attester: string | null\n}): Promise<Account> {\n const { account, attester } = params\n\n if (!attester || account.address.toLowerCase() === attester.toLowerCase()) {\n return account\n }\n\n const additionalGetter = getGetAdditionalSyncAddresses()\n let attesterIsExecutorModule = false\n if (additionalGetter) {\n const additional = await additionalGetter()\n const attesterLower = attester.toLowerCase()\n attesterIsExecutorModule = !!additional?.some(\n (a: string | undefined) => a?.toLowerCase() === attesterLower,\n )\n }\n\n try {\n const derivedManagedAccount = await getSmartWalletAddressForAdmin(account.address)\n const attesterLower = attester.toLowerCase()\n const derivedLower = derivedManagedAccount.toLowerCase()\n\n if (attesterLower === derivedLower || attesterIsExecutorModule) {\n const managedAddress = attesterIsExecutorModule\n ? await getConnectedManagedAccountAddress(getPublishThirdwebChain()).catch(() => derivedManagedAccount)\n : derivedManagedAccount\n const deployed = await isSmartWalletDeployed(managedAddress)\n if (deployed) {\n // Same as ensureModularPublishBootstrap: the managed wallet reads the in-app session token.\n syncPublishInAppAuthToken()\n const managedAccountWallet = getManagedAccountWallet()\n await managedAccountWallet.autoConnect({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n })\n const managedAccount = managedAccountWallet.getAccount()\n if (managedAccount) {\n return managedAccount\n }\n }\n }\n } catch {\n // Fall through\n }\n\n if (attesterIsExecutorModule) {\n const { modularAccountModuleContract } = getPublishConfig()\n if (!modularAccountModuleContract?.trim()) {\n throw new Error(\n 'Revocation not supported for items published via the modular executor.',\n )\n }\n // Module configured but ManagedAccount wallet unavailable\n throw new Error(\n 'Revocation not supported for items published via the modular executor. Connect the ManagedAccount that controls the executor module.',\n )\n }\n\n return account\n}\n"],"mappings":";;;AAuBA,eAAsBQ,EAAqB,GAGtB;CACnB,IAAM,EAAE,YAAS,gBAAaC;CAE9B,IAAI,CAACC,KAAYC,EAAQ,QAAQ,YAAY,MAAMD,EAAS,YAAY,GACtE,OAAOC;CAGT,IAAMC,IAAmBC,EAA8B,GACnDC,IAA2B;CAC/B,IAAIF,GAAkB;EACpB,IAAMG,IAAa,MAAMH,EAAiB,GACpCI,IAAgBN,EAAS,YAAY;EAC3C,IAA2B,CAAC,CAACK,GAAY,MACtC,MAA0BE,GAAG,YAAY,MAAMD,CAClD;CACF;CAEA,IAAI;EACF,IAAME,IAAwB,MAAMjB,EAA8BU,EAAQ,OAAO;EAIjF,IAHsBD,EAAS,YAG3B,MAFiBQ,EAAsB,YAErB,KAAgBJ,GAA0B;GAC9D,IAAMK,IAAiBL,IACnB,MAAMX,EAAkCE,EAAwB,CAAC,CAAC,CAAC,YAAYa,CAAqB,IACpGA;GAEJ,IAAI,MADmBlB,EAAsBmB,CAAc,GAC7C;IAEZ,EAA0B;IAC1B,IAAMC,IAAuBlB,EAAwB;IACrD,MAAMkB,EAAqB,YAAY;KACrC,QAAQb,EAAU;KAClB,OAAOF,EAAwB;IACjC,CAAC;IACD,IAAMgB,IAAiBD,EAAqB,WAAW;IACvD,IAAIC,GACF,OAAOA;GAEX;EACF;CACF,QAAQ,CAER;CAEA,IAAIP,GAA0B;EAC5B,IAAM,EAAE,oCAAiCR,EAAiB;EAO1D,MANKgB,GAA8B,KAAK,IAM9B,MACR,sIACF,IAPY,MACR,wEACF;CAMJ;CAEA,OAAOX;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"uploadViaBundler.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/actors/uploadViaBundler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAqC3D;;;;;GAKG;AACH,uFAAuF;AACvF,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,QAAQ,CAAC,IAAI,+BAA8B;;CAO5C;AAED,eAAO,MAAM,gBAAgB;aAAwC,qBAAqB;eAoKzF,CAAA"}
1
+ {"version":3,"file":"uploadViaBundler.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/actors/uploadViaBundler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAmC3D;;;;;GAKG;AACH,uFAAuF;AACvF,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,QAAQ,CAAC,IAAI,+BAA8B;;CAO5C;AAED,eAAO,MAAM,gBAAgB;aAAwC,qBAAqB;eA0HzF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"uploadToTurbo.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/helpers/uploadToTurbo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAsCvD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,OAAO,EAAE,EAChB,KAAK,EAAE,WAAW,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,EAC9D,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAcf"}
1
+ {"version":3,"file":"uploadToTurbo.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/helpers/uploadToTurbo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAoCvD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,OAAO,EAAE,EAChB,KAAK,EAAE,WAAW,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,EAC9D,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAcf"}
@@ -11,10 +11,22 @@ type VerifyAttestationsInput = {
11
11
  seedLocalId: string;
12
12
  };
13
13
  };
14
+ /** Test seams: the indexer query and the retry timing. */
15
+ type VerifyAttestationsOptions = {
16
+ getProperties?: (args: {
17
+ versionUids: string[];
18
+ }) => Promise<{
19
+ schemaId?: string;
20
+ }[]>;
21
+ delayMs?: number;
22
+ maxAttempts?: number;
23
+ };
14
24
  /**
15
25
  * Verifies that property/metadata attestations created during publish exist on EAS.
16
- * Throws AttestationVerificationError if any expected attestations are missing.
26
+ * The indexer can lag the chain, so a failed query or a result missing expected schemas is
27
+ * retried every `delayMs` up to `maxAttempts` times. Throws AttestationVerificationError if
28
+ * schemas are still missing after the last attempt, or the last query error if every query threw.
17
29
  */
18
- export declare function verifyAttestations({ normalizedRequests, item, }: VerifyAttestationsInput): Promise<void>;
30
+ export declare function verifyAttestations({ normalizedRequests, item }: VerifyAttestationsInput, { getProperties, delayMs, maxAttempts, }?: VerifyAttestationsOptions): Promise<void>;
19
31
  export {};
20
32
  //# sourceMappingURL=verifyAttestations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"verifyAttestations.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/helpers/verifyAttestations.ts"],"names":[],"mappings":"AAwBA,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC9C,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,kBAAkB,EAAE,iBAAiB,EAAE,CAAA;IACvC,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAA;CAC9B,CAAA;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,kBAAkB,EAClB,IAAI,GACL,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqDzC"}
1
+ {"version":3,"file":"verifyAttestations.d.ts","sourceRoot":"","sources":["../../../../src/services/publish/helpers/verifyAttestations.ts"],"names":[],"mappings":"AAwBA,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC9C,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,kBAAkB,EAAE,iBAAiB,EAAE,CAAA;IACvC,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAA;CAC9B,CAAA;AAED,0DAA0D;AAC1D,KAAK,yBAAyB,GAAG;IAC/B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAA;IACrF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,uBAAuB,EACrD,EACE,aAAwC,EACxC,OAAyB,EACzB,WAAiC,GAClC,GAAE,yBAA8B,GAChC,OAAO,CAAC,IAAI,CAAC,CA4Df"}
package/dist/thirdweb.js CHANGED
@@ -1,9 +1,9 @@
1
- import { $ as e, A as t, B as n, G as r, H as i, Ht as a, I as o, J as s, K as c, Kt as l, L as u, M as d, N as f, P as ee, Q as te, R as ne, Rt as p, U as m, V as h, Vt as re, W as g, Wt as ie, X as ae, Y as oe, Z as _, _t as v, a as y, et as se, gt as b, ht as ce, i as le, j as ue, m as x, mt as de, nt as fe, o as pe, q as S, qt as C, rt as w, t as T, tt as me, z as E } from "./chainConfig-CY22-kWO.js";
1
+ import { $ as e, A as t, B as n, G as r, H as i, Ht as a, I as o, J as s, K as c, Kt as l, L as u, M as d, N as f, P as ee, Q as te, R as ne, Rt as p, U as m, V as h, Vt as re, W as g, Wt as ie, X as ae, Y as oe, Z as _, _t as v, a as y, et as se, gt as b, ht as ce, i as le, j as ue, m as x, mt as de, nt as fe, o as pe, q as S, qt as C, rt as w, t as T, tt as me, z as E } from "./chainConfig-NziDkhH8.js";
2
2
  import { i as he, t as D } from "./publishWalletRegistry-BaQe9rIR.js";
3
- import { a as O, d as k, f as A, g as j, h as M, l as N, m as P, p as F, u as I } from "./publishAuthorization-D2wbNc-H.js";
4
- import { t as L } from "./ensureSmartWalletThenPublish-By_Xv7xG.js";
5
- import { t as R } from "./ensureModularPublishBootstrap-DQDSbkQy.js";
6
- import { i as z, r as B, t as V } from "./ensureAutomationSessionKey-CKFyZNj7.js";
3
+ import { a as O, d as k, f as A, g as j, h as M, l as N, m as P, p as F, u as I } from "./publishAuthorization-5uWpBRgf.js";
4
+ import { t as L } from "./ensureSmartWalletThenPublish-y8mmtR_N.js";
5
+ import { t as R } from "./ensureModularPublishBootstrap-BX9PwXBl.js";
6
+ import { i as z, r as B, t as V } from "./ensureAutomationSessionKey-C5uScAY8.js";
7
7
  import { client as H } from "@seedprotocol/sdk";
8
8
  import { deploySmartAccount as ge, getContract as U, sendTransaction as _e } from "thirdweb";
9
9
  import { ConnectButton as ve, ThirdwebProvider as ye, darkTheme as be, useActiveAccount as xe, useActiveWallet as Se, useActiveWalletConnectionStatus as Ce, useIsAutoConnecting as we } from "thirdweb/react";
@@ -1,4 +1,4 @@
1
- import { a as e, nn as t } from "./chainConfig-CY22-kWO.js";
1
+ import { a as e, nn as t } from "./chainConfig-NziDkhH8.js";
2
2
  import { BaseDb as n, arweaveL1FinalizeJobs as r, getArweaveUploadStatus as i, isArweaveL1AnchoringComplete as a, queryArweaveGatewayTransactionWithFallback as o, restoreDataItemIdsOverwrittenByL1 as s } from "@seedprotocol/sdk";
3
3
  import c from "debug";
4
4
  import { eq as l } from "drizzle-orm";
@@ -84,4 +84,4 @@ async function g() {
84
84
  //#endregion
85
85
  export { m as startArweaveL1FinalizeWorker, h as stopArweaveL1FinalizeWorker };
86
86
 
87
- //# sourceMappingURL=worker-CBBwWaxo.js.map
87
+ //# sourceMappingURL=worker-Ct3bqLZX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-CBBwWaxo.js","names":["getPublishConfig","resolvePublishPayment","debug","logger","TICK_MS","intervalId","restoredOverwrittenIds","startArweaveL1FinalizeWorker","runArweaveL1FinalizeTick","stopArweaveL1FinalizeWorker","config","BaseDb","db","restoreDataItemIdsOverwrittenByL1","restored","ambiguous","error","pending","arweaveL1FinalizeJobs","eq","uploadBase","graphqlUrl","uploadedToTurbo","job","dataItemId","l1TxId","gql","queryArweaveGatewayTransactionWithFallback","bundled","status","getArweaveUploadStatus","statusStr","isArweaveL1AnchoringComplete","resolvedL1","err"],"sources":["../src/services/arweaveL1Finalize/worker.ts"],"sourcesContent":["import {\n arweaveL1FinalizeJobs,\n BaseDb,\n getArweaveUploadStatus,\n isArweaveL1AnchoringComplete,\n queryArweaveGatewayTransactionWithFallback,\n restoreDataItemIdsOverwrittenByL1,\n} from '@seedprotocol/sdk'\nimport { eq } from 'drizzle-orm'\nimport { getPublishConfig } from '~/config'\nimport { resolvePublishPayment } from '~/payment'\nimport debug from 'debug'\n\nconst logger = debug('seedProtocol:arweaveL1Finalize:worker')\n\n/**\n * Tracks bundler uploads until their bundle is anchored on Arweave L1, recording the L1 / bundle id\n * in `arweave_l1_finalize_jobs`. Local metadata keeps the data item id, which is what was attested\n * and what gateways serve the item under.\n */\nconst TICK_MS = 45_000\n\nlet intervalId: ReturnType<typeof setInterval> | null = null\nlet restoredOverwrittenIds = false\n\nexport function startArweaveL1FinalizeWorker(): void {\n if (intervalId != null) return\n intervalId = setInterval(() => {\n void runArweaveL1FinalizeTick()\n }, TICK_MS)\n void runArweaveL1FinalizeTick()\n}\n\nexport function stopArweaveL1FinalizeWorker(): void {\n if (intervalId != null) {\n clearInterval(intervalId)\n intervalId = null\n }\n}\n\nasync function runArweaveL1FinalizeTick(): Promise<void> {\n let config: ReturnType<typeof getPublishConfig>\n try {\n config = getPublishConfig()\n } catch {\n return\n }\n if (!config.useArweaveBundler) return\n\n // initPublish may start this worker before Seed platformClassesInit configures BaseDb.\n if (!BaseDb.isAppDbReady()) return\n const db = BaseDb.getAppDb()\n if (!db) return\n\n // The worker used to replace local data item ids with the bundle's L1 id; put them back once.\n if (!restoredOverwrittenIds) {\n restoredOverwrittenIds = true\n try {\n const { restored, ambiguous } = await restoreDataItemIdsOverwrittenByL1()\n if (restored || ambiguous) {\n logger(`restored ${restored} data item ids overwritten by L1 ids; ${ambiguous} bundles ambiguous, left as they are`)\n }\n } catch (error) {\n logger('restoring data item ids failed', error)\n }\n }\n\n const pending = await db\n .select()\n .from(arweaveL1FinalizeJobs)\n .where(eq(arweaveL1FinalizeJobs.phase, 'pending_l1'))\n .limit(25)\n\n if (pending.length === 0) return\n\n const uploadBase = config.arweaveUploadVerificationBaseUrl\n const graphqlUrl = config.arweaveGraphqlUrl\n // User-paid uploads went to Turbo; the upload API doesn't know them, so finish from GraphQL.\n const uploadedToTurbo = resolvePublishPayment(config).storage.uploadTo === 'turbo'\n\n for (const job of pending) {\n const dataItemId = job.dataItemId\n try {\n let l1TxId = job.l1TransactionId\n\n if (uploadedToTurbo) {\n const gql = await queryArweaveGatewayTransactionWithFallback(graphqlUrl, dataItemId)\n const bundled = gql?.bundledInId ?? l1TxId ?? null\n if (bundled && gql?.blockHeight != null) {\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n phase: 'confirmed',\n statusJson: JSON.stringify(gql),\n l1TransactionId: bundled,\n bundleId: bundled,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n }\n continue\n }\n\n if (!l1TxId) {\n const gql = await queryArweaveGatewayTransactionWithFallback(graphqlUrl, dataItemId)\n const bundled = gql?.bundledInId ?? null\n if (bundled) {\n l1TxId = bundled\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n l1TransactionId: bundled,\n bundleId: bundled,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n }\n }\n\n const status = await getArweaveUploadStatus(uploadBase, dataItemId)\n const statusStr = status ? JSON.stringify(status) : null\n\n if (status && isArweaveL1AnchoringComplete(status)) {\n const resolvedL1 =\n l1TxId ??\n status.bundleId ??\n status.turbo?.bundleId ??\n job.l1TransactionId ??\n null\n\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n phase: 'confirmed',\n statusJson: statusStr,\n l1TransactionId: resolvedL1 ?? job.l1TransactionId,\n bundleId: status.bundleId ?? job.bundleId,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n continue\n }\n\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n statusJson: statusStr,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n } catch (err) {\n logger('tick error for job', job.id, err)\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n errorMessage: err instanceof Error ? err.message : String(err),\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n }\n }\n}\n"],"mappings":";;;;;AAaA,IAAMG,IAASD,EAAM,uCAAuC,GAOtDE,IAAU,MAEZC,IAAoD,MACpDC,IAAyB;AAE7B,SAAgBC,IAAqC;CACnD,AAAIF,MACJ,IAAa,kBAAkB;EAC7B,EAA8B;CAChC,GAAGD,CAAO,GACVI,EAA8B;AAChC;AAEA,SAAgBC,IAAoC;CAClD,AAAIJ,KAAc,SAChB,cAAcA,CAAU,GACxB,IAAa;AAEjB;AAEA,eAAeG,IAA0C;CACvD,IAAIE;CACJ,IAAI;EACF,IAASV,EAAiB;CAC5B,QAAQ;EACN;CACF;CAIA,IAHI,CAACU,EAAO,qBAGR,CAACC,EAAO,aAAa,GAAG;CAC5B,IAAMC,IAAKD,EAAO,SAAS;CAC3B,IAAI,CAACC,GAAI;CAGT,IAAI,CAACN,GAAwB;EAC3B,IAAyB;EACzB,IAAI;GACF,IAAM,EAAE,aAAU,iBAAc,MAAMO,EAAkC;GACxE,CAAIC,KAAYC,MACdZ,EAAO,YAAYW,EAAS,wCAAwCC,EAAU,qCAAqC;EAEvH,SAASC,GAAO;GACd,EAAO,kCAAkCA,CAAK;EAChD;CACF;CAEA,IAAMC,IAAU,MAAML,EACnB,OAAO,CAAC,CACR,KAAKM,CAAqB,CAAC,CAC3B,MAAMC,EAAGD,EAAsB,OAAO,YAAY,CAAC,CAAC,CACpD,MAAM,EAAE;CAEX,IAAID,EAAQ,WAAW,GAAG;CAE1B,IAAMG,IAAaV,EAAO,kCACpBW,IAAaX,EAAO,mBAEpBY,IAAkBrB,EAAsBS,CAAM,CAAC,CAAC,QAAQ,aAAa;CAE3E,KAAK,IAAMa,KAAON,GAAS;EACzB,IAAMO,IAAaD,EAAI;EACvB,IAAI;GACF,IAAIE,IAASF,EAAI;GAEjB,IAAID,GAAiB;IACnB,IAAMI,IAAM,MAAM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GAAK;GAEZ,AADA/B,EAAO,sBAAsBoB,EAAI,IAAIW,CAAG,GACxC,MAAMtB,EACH,OAAOM,CAAqB,CAAC,CAC7B,IAAI;IACH,cAAcgB,aAAe,QAAQA,EAAI,UAAU,OAAOA,CAAG;IAC7D,WAAW,KAAK,IAAI;GACtB,CAAC,CAAC,CACD,MAAMf,EAAGD,EAAsB,IAAIK,EAAI,EAAG,CAAC;EAChD;CACF;AACF"}
1
+ {"version":3,"file":"worker-Ct3bqLZX.js","names":["getPublishConfig","resolvePublishPayment","debug","logger","TICK_MS","intervalId","restoredOverwrittenIds","startArweaveL1FinalizeWorker","runArweaveL1FinalizeTick","stopArweaveL1FinalizeWorker","config","BaseDb","db","restoreDataItemIdsOverwrittenByL1","restored","ambiguous","error","pending","arweaveL1FinalizeJobs","eq","uploadBase","graphqlUrl","uploadedToTurbo","job","dataItemId","l1TxId","gql","queryArweaveGatewayTransactionWithFallback","bundled","status","getArweaveUploadStatus","statusStr","isArweaveL1AnchoringComplete","resolvedL1","err"],"sources":["../src/services/arweaveL1Finalize/worker.ts"],"sourcesContent":["import {\n arweaveL1FinalizeJobs,\n BaseDb,\n getArweaveUploadStatus,\n isArweaveL1AnchoringComplete,\n queryArweaveGatewayTransactionWithFallback,\n restoreDataItemIdsOverwrittenByL1,\n} from '@seedprotocol/sdk'\nimport { eq } from 'drizzle-orm'\nimport { getPublishConfig } from '~/config'\nimport { resolvePublishPayment } from '~/payment'\nimport debug from 'debug'\n\nconst logger = debug('seedProtocol:arweaveL1Finalize:worker')\n\n/**\n * Tracks bundler uploads until their bundle is anchored on Arweave L1, recording the L1 / bundle id\n * in `arweave_l1_finalize_jobs`. Local metadata keeps the data item id, which is what was attested\n * and what gateways serve the item under.\n */\nconst TICK_MS = 45_000\n\nlet intervalId: ReturnType<typeof setInterval> | null = null\nlet restoredOverwrittenIds = false\n\nexport function startArweaveL1FinalizeWorker(): void {\n if (intervalId != null) return\n intervalId = setInterval(() => {\n void runArweaveL1FinalizeTick()\n }, TICK_MS)\n void runArweaveL1FinalizeTick()\n}\n\nexport function stopArweaveL1FinalizeWorker(): void {\n if (intervalId != null) {\n clearInterval(intervalId)\n intervalId = null\n }\n}\n\nasync function runArweaveL1FinalizeTick(): Promise<void> {\n let config: ReturnType<typeof getPublishConfig>\n try {\n config = getPublishConfig()\n } catch {\n return\n }\n if (!config.useArweaveBundler) return\n\n // initPublish may start this worker before Seed platformClassesInit configures BaseDb.\n if (!BaseDb.isAppDbReady()) return\n const db = BaseDb.getAppDb()\n if (!db) return\n\n // The worker used to replace local data item ids with the bundle's L1 id; put them back once.\n if (!restoredOverwrittenIds) {\n restoredOverwrittenIds = true\n try {\n const { restored, ambiguous } = await restoreDataItemIdsOverwrittenByL1()\n if (restored || ambiguous) {\n logger(`restored ${restored} data item ids overwritten by L1 ids; ${ambiguous} bundles ambiguous, left as they are`)\n }\n } catch (error) {\n logger('restoring data item ids failed', error)\n }\n }\n\n const pending = await db\n .select()\n .from(arweaveL1FinalizeJobs)\n .where(eq(arweaveL1FinalizeJobs.phase, 'pending_l1'))\n .limit(25)\n\n if (pending.length === 0) return\n\n const uploadBase = config.arweaveUploadVerificationBaseUrl\n const graphqlUrl = config.arweaveGraphqlUrl\n // User-paid uploads went to Turbo; the upload API doesn't know them, so finish from GraphQL.\n const uploadedToTurbo = resolvePublishPayment(config).storage.uploadTo === 'turbo'\n\n for (const job of pending) {\n const dataItemId = job.dataItemId\n try {\n let l1TxId = job.l1TransactionId\n\n if (uploadedToTurbo) {\n const gql = await queryArweaveGatewayTransactionWithFallback(graphqlUrl, dataItemId)\n const bundled = gql?.bundledInId ?? l1TxId ?? null\n if (bundled && gql?.blockHeight != null) {\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n phase: 'confirmed',\n statusJson: JSON.stringify(gql),\n l1TransactionId: bundled,\n bundleId: bundled,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n }\n continue\n }\n\n if (!l1TxId) {\n const gql = await queryArweaveGatewayTransactionWithFallback(graphqlUrl, dataItemId)\n const bundled = gql?.bundledInId ?? null\n if (bundled) {\n l1TxId = bundled\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n l1TransactionId: bundled,\n bundleId: bundled,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n }\n }\n\n const status = await getArweaveUploadStatus(uploadBase, dataItemId)\n const statusStr = status ? JSON.stringify(status) : null\n\n if (status && isArweaveL1AnchoringComplete(status)) {\n const resolvedL1 =\n l1TxId ??\n status.bundleId ??\n status.turbo?.bundleId ??\n job.l1TransactionId ??\n null\n\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n phase: 'confirmed',\n statusJson: statusStr,\n l1TransactionId: resolvedL1 ?? job.l1TransactionId,\n bundleId: status.bundleId ?? job.bundleId,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n continue\n }\n\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n statusJson: statusStr,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n } catch (err) {\n logger('tick error for job', job.id, err)\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n errorMessage: err instanceof Error ? err.message : String(err),\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n }\n }\n}\n"],"mappings":";;;;;AAaA,IAAMG,IAASD,EAAM,uCAAuC,GAOtDE,IAAU,MAEZC,IAAoD,MACpDC,IAAyB;AAE7B,SAAgBC,IAAqC;CACnD,AAAIF,MACJ,IAAa,kBAAkB;EAC7B,EAA8B;CAChC,GAAGD,CAAO,GACVI,EAA8B;AAChC;AAEA,SAAgBC,IAAoC;CAClD,AAAIJ,KAAc,SAChB,cAAcA,CAAU,GACxB,IAAa;AAEjB;AAEA,eAAeG,IAA0C;CACvD,IAAIE;CACJ,IAAI;EACF,IAASV,EAAiB;CAC5B,QAAQ;EACN;CACF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AC7B,IAAI;KACH,iBAAiBU;KACjB,UAAUA;KACV,WAAW,KAAK,IAAI;IACtB,CAAC,CAAC,CACD,MAAMT,EAAGD,EAAsB,IAAIK,EAAI,EAAG,CAAC;GAElD;GAEA,IAAMM,IAAS,MAAMC,EAAuBV,GAAYI,CAAU,GAC5DO,IAAYF,IAAS,KAAK,UAAUA,CAAM,IAAI;GAEpD,IAAIA,KAAUG,EAA6BH,CAAM,GAAG;IAClD,IAAMI,IACJR,KACAI,EAAO,YACPA,EAAO,OAAO,YACdN,EAAI,mBACJ;IAEF,MAAMX,EACH,OAAOM,CAAqB,CAAC,CAC7B,IAAI;KACH,OAAO;KACP,YAAYa;KACZ,iBAAiBE,KAAcV,EAAI;KACnC,UAAUM,EAAO,YAAYN,EAAI;KACjC,WAAW,KAAK,IAAI;IACtB,CAAC,CAAC,CACD,MAAMJ,EAAGD,EAAsB,IAAIK,EAAI,EAAG,CAAC;IAC9C;GACF;GAEA,MAAMX,EACH,OAAOM,CAAqB,CAAC,CAC7B,IAAI;IACH,YAAYa;IACZ,WAAW,KAAK,IAAI;GACtB,CAAC,CAAC,CACD,MAAMZ,EAAGD,EAAsB,IAAIK,EAAI,EAAG,CAAC;EAChD,SAASW,GAAK;GAEZ,AADA/B,EAAO,sBAAsBoB,EAAI,IAAIW,CAAG,GACxC,MAAMtB,EACH,OAAOM,CAAqB,CAAC,CAC7B,IAAI;IACH,cAAcgB,aAAe,QAAQA,EAAI,UAAU,OAAOA,CAAG;IAC7D,WAAW,KAAK,IAAI;GACtB,CAAC,CAAC,CACD,MAAMf,EAAGD,EAAsB,IAAIK,EAAI,EAAG,CAAC;EAChD;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seedprotocol/publish",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "Publish Seed Protocol items to Arweave and EAS: publish state machine, React provider and hooks, wallet integration and optional thirdweb adapters",
5
5
  "keywords": [
6
6
  "seed-protocol",
@@ -46,12 +46,12 @@
46
46
  "scripts": {
47
47
  "build": "tsc -p tsconfig.build.json && vite build",
48
48
  "prepublishOnly": "npm run build && node ../../scripts/sync-versions.js",
49
- "test": "bun test src/helpers/defaultApprovedTargetsForModularPublish.test.ts && bun test src/helpers/arweave.test.ts src/helpers/ensureManagedAccountReady.test.ts src/helpers/ensureEip7702ModularAccountReady.test.ts src/helpers/ensureManagedSignerSessionKey.test.ts src/helpers/publishDisplayHelpers.test.ts src/services/publish/actors/createAttestationsRouting.test.ts src/services/publish/actors/seedUidHelpers.test.ts src/config.autoDeployEip7702.test.ts src/config.chain.test.ts && bun test src/helpers/ensureSmartWalletThenPublish.test.ts && bun test src/helpers/ensureManagedAccountEasConfigured.test.ts && bun test src/services/domainOwnership/domainOwnership.test.ts src/services/domainOwnership/domainOwnership.scope.test.ts && bun test src/services/publishAuthorization/publishAuthorization.test.ts && bun test src/helpers/approvedTargetsForAutomationPublish.test.ts && bun test src/helpers/easDirect.multiRevoke.test.ts && bun test src/helpers/ensureAutomationSessionKey.test.ts && bun test src/helpers/enrollPublishAutomation.test.ts && bun test src/helpers/executorModuleReadiness.test.ts src/helpers/describeRevert.test.ts && bun test src/helpers/contracts/encodeMultiPublish.test.ts && bun test src/helpers/assertStorageBoundToIdentity.test.ts && bun test src/payment.test.ts && bun test src/authorization.test.ts && bun test src/services/publish/authorizing.test.ts && bun test src/helpers/turbo.test.ts && bun test src/services/publish/helpers/uploadToTurbo.test.ts && bun test src/services/publishCost/estimatePublishCost.test.ts && bun test src/services/publishCost/watchPublishCost.test.ts && bun test src/services/publishedBy/publishedBy.test.ts && bun test src/helpers/publishThirdwebClient.test.ts src/helpers/chainClient.secretKey.test.ts src/helpers/chainClient.receipt.test.ts && bun test src/helpers/adapters/thirdwebAccount.test.ts && bun test src/services/publishManager/publishManager.node.test.ts && bun test src/services/publishManager/publishLocks.node.test.ts && bun test src/services/publishManager/actors/savePublish.test.ts src/services/publishManager/actions/requestSavePublish.test.ts && bun test src/services/publish/helpers/ensureEasSchemas.test.ts && bun test src/services/publish/actors/checking.unpublishedRelated.test.ts && bun test src/services/publish/actors/checking.directEas.test.ts && bun test src/services/publish/actors/recordMultiPublishReceipt.test.ts && bun test src/services/publish/actors/createAttestations.batch.test.ts && bun test src/services/publish/actors/createAttestationsDirectToEas.batch.test.ts && bun test src/services/publish/actors/createAttestationsDirectToEas.lists.test.ts && bun test src/helpers/verifyPublishChain.test.ts && bun test src/helpers/thirdwebWallets.test.ts && bun test src/helpers/seedPaymaster.test.ts && bun test src/helpers/ensureExecutorModule.test.ts && bun test src/services/revoke/revokeAttestations.test.ts && bun test src/helpers/ensureModularPublishBootstrap.test.ts && bun test src/helpers/blockchain.test.ts src/helpers/retryNonceTooLow.test.ts src/helpers/seedTwin.test.ts && bun test src/helpers/runModularExecutorPublishPrep.test.ts && bun test src/helpers/adapters/permissionlessTxSender.test.ts && bun test src/helpers/publishItem.test.ts && bun test src/helpers/publishWalletRegistry.test.ts && bun test src/services/publish/actors/pollForConfirmation.test.ts src/config.uploadApiBaseUrl.test.ts src/react/PublishProvider.initOrder.test.tsx && bun test src/services/publish/actors/uploadViaBundler.resume.test.ts && bun test src/services/publishManager/actors/restorableSnapshot.test.ts && bun test src/helpers/defaultDataItemSigner.test.ts && bun test src/services/publish/htmlPhase2.flow.test.ts src/helpers/accountCodeKind.test.ts"
49
+ "test": "bun test src/helpers/defaultApprovedTargetsForModularPublish.test.ts && bun test src/helpers/arweave.test.ts src/helpers/ensureManagedAccountReady.test.ts src/helpers/ensureEip7702ModularAccountReady.test.ts src/helpers/ensureManagedSignerSessionKey.test.ts src/helpers/publishDisplayHelpers.test.ts src/services/publish/actors/createAttestationsRouting.test.ts src/services/publish/actors/seedUidHelpers.test.ts src/config.autoDeployEip7702.test.ts src/config.chain.test.ts && bun test src/helpers/ensureSmartWalletThenPublish.test.ts && bun test src/helpers/ensureManagedAccountEasConfigured.test.ts && bun test src/services/domainOwnership/domainOwnership.test.ts src/services/domainOwnership/domainOwnership.scope.test.ts && bun test src/services/publishAuthorization/publishAuthorization.test.ts && bun test src/helpers/approvedTargetsForAutomationPublish.test.ts && bun test src/helpers/easDirect.multiRevoke.test.ts && bun test src/helpers/ensureAutomationSessionKey.test.ts && bun test src/helpers/enrollPublishAutomation.test.ts && bun test src/helpers/executorModuleReadiness.test.ts src/helpers/describeRevert.test.ts && bun test src/helpers/contracts/encodeMultiPublish.test.ts && bun test src/helpers/assertStorageBoundToIdentity.test.ts && bun test src/payment.test.ts && bun test src/authorization.test.ts && bun test src/services/publish/authorizing.test.ts && bun test src/helpers/turbo.test.ts && bun test src/services/publish/helpers/uploadToTurbo.test.ts && bun test src/services/publishCost/estimatePublishCost.test.ts && bun test src/services/publishCost/watchPublishCost.test.ts && bun test src/services/publishedBy/publishedBy.test.ts && bun test src/helpers/publishThirdwebClient.test.ts src/helpers/chainClient.secretKey.test.ts src/helpers/chainClient.receipt.test.ts && bun test src/helpers/adapters/thirdwebAccount.test.ts && bun test src/services/publishManager/publishManager.node.test.ts && bun test src/services/publishManager/publishLocks.node.test.ts && bun test src/services/publishManager/actors/savePublish.test.ts src/services/publishManager/actions/requestSavePublish.test.ts && bun test src/services/publish/helpers/ensureEasSchemas.test.ts && bun test src/services/publish/helpers/verifyAttestations.test.ts && bun test src/services/publish/actors/checking.unpublishedRelated.test.ts && bun test src/services/publish/actors/checking.directEas.test.ts && bun test src/services/publish/actors/recordMultiPublishReceipt.test.ts && bun test src/services/publish/actors/createAttestations.batch.test.ts && bun test src/services/publish/actors/createAttestationsDirectToEas.batch.test.ts && bun test src/services/publish/actors/createAttestationsDirectToEas.lists.test.ts && bun test src/helpers/verifyPublishChain.test.ts && bun test src/helpers/thirdwebWallets.test.ts && bun test src/helpers/seedPaymaster.test.ts && bun test src/helpers/ensureExecutorModule.test.ts && bun test src/services/revoke/revokeAttestations.test.ts && bun test src/helpers/ensureModularPublishBootstrap.test.ts && bun test src/helpers/blockchain.test.ts src/helpers/retryNonceTooLow.test.ts src/helpers/seedTwin.test.ts && bun test src/helpers/runModularExecutorPublishPrep.test.ts && bun test src/helpers/adapters/permissionlessTxSender.test.ts && bun test src/helpers/publishItem.test.ts && bun test src/helpers/publishWalletRegistry.test.ts && bun test src/services/publish/actors/pollForConfirmation.test.ts src/config.uploadApiBaseUrl.test.ts src/react/PublishProvider.initOrder.test.tsx && bun test src/services/publish/actors/uploadViaBundler.resume.test.ts && bun test src/services/publishManager/actors/restorableSnapshot.test.ts && bun test src/helpers/defaultDataItemSigner.test.ts && bun test src/services/publish/htmlPhase2.flow.test.ts src/helpers/accountCodeKind.test.ts"
50
50
  },
51
51
  "dependencies": {
52
52
  "@ethereum-attestation-service/eas-sdk": "^2.9.0",
53
- "@seedprotocol/arweave": "0.7.5",
54
- "@seedprotocol/eas": "0.7.5",
53
+ "@seedprotocol/arweave": "0.7.6",
54
+ "@seedprotocol/eas": "0.7.6",
55
55
  "@xstate/react": "^6.1.0",
56
56
  "arweave": "^1.15.7",
57
57
  "debug": "^4.4.1",
@@ -64,8 +64,8 @@
64
64
  "xstate": "^5.28.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@seedprotocol/react": "0.7.5",
68
- "@seedprotocol/sdk": "0.7.5",
67
+ "@seedprotocol/react": "0.7.6",
68
+ "@seedprotocol/sdk": "0.7.6",
69
69
  "@types/bun": "latest",
70
70
  "@types/react": "^19.2.14",
71
71
  "@types/react-dom": "^19.2.3",
@@ -77,8 +77,8 @@
77
77
  "vite": "^8.0.0"
78
78
  },
79
79
  "peerDependencies": {
80
- "@seedprotocol/sdk": "0.7.5",
81
- "@seedprotocol/react": "0.7.5",
80
+ "@seedprotocol/sdk": "0.7.6",
81
+ "@seedprotocol/react": "0.7.6",
82
82
  "react": "^18 || ^19",
83
83
  "react-dom": "^18 || ^19",
84
84
  "thirdweb": "^5",