@seedprotocol/publish 0.7.11-next.1384.g8b47246 → 0.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -1
- package/dist/{chainConfig-DK_5pgXF.js → chainConfig-nYXoVL1s.js} +9 -9
- package/dist/{chainConfig-DK_5pgXF.js.map → chainConfig-nYXoVL1s.js.map} +1 -1
- package/dist/{ensureAutomationSessionKey-BwCXLjcX.js → ensureAutomationSessionKey-BaaHU2Wb.js} +3 -3
- package/dist/{ensureAutomationSessionKey-BwCXLjcX.js.map → ensureAutomationSessionKey-BaaHU2Wb.js.map} +1 -1
- package/dist/{ensureModularPublishBootstrap-DZcceVDq.js → ensureModularPublishBootstrap-NzYQ1MfY.js} +3 -3
- package/dist/{ensureModularPublishBootstrap-DZcceVDq.js.map → ensureModularPublishBootstrap-NzYQ1MfY.js.map} +1 -1
- package/dist/{ensureSmartWalletThenPublish-BW1_dW3n.js → ensureSmartWalletThenPublish-CpuDoo5O.js} +2 -2
- package/dist/{ensureSmartWalletThenPublish-BW1_dW3n.js.map → ensureSmartWalletThenPublish-CpuDoo5O.js.map} +1 -1
- package/dist/helpers/assertStorageBoundToIdentity.d.ts.map +1 -1
- package/dist/helpers/enrollPublishAutomation.d.ts +5 -1
- package/dist/helpers/enrollPublishAutomation.d.ts.map +1 -1
- package/dist/index.js +50 -50
- package/dist/index.js.map +1 -1
- package/dist/{managedAccountAdmin-Cb1ut9V4.js → managedAccountAdmin-BeSXTCeH.js} +2 -2
- package/dist/{managedAccountAdmin-Cb1ut9V4.js.map → managedAccountAdmin-BeSXTCeH.js.map} +1 -1
- package/dist/{publishAuthorization-C_VidnTq.js → publishAuthorization-CVl5ZK5B.js} +24 -21
- package/dist/publishAuthorization-CVl5ZK5B.js.map +1 -0
- package/dist/{resolveRevokeAccount-CCJ_7quC.js → resolveRevokeAccount-DRrUY9FR.js} +2 -2
- package/dist/{resolveRevokeAccount-CCJ_7quC.js.map → resolveRevokeAccount-DRrUY9FR.js.map} +1 -1
- package/dist/services/domainOwnership/index.d.ts.map +1 -1
- package/dist/services/publishAuthorization/index.d.ts +1 -1
- package/dist/services/publishAuthorization/index.d.ts.map +1 -1
- package/dist/services/publishedBy/index.d.ts.map +1 -1
- package/dist/thirdweb.js +39 -38
- package/dist/thirdweb.js.map +1 -1
- package/dist/{worker-C7XeFMWh.js → worker-D1czx7Yg.js} +2 -2
- package/dist/{worker-C7XeFMWh.js.map → worker-D1czx7Yg.js.map} +1 -1
- package/package.json +7 -7
- package/dist/publishAuthorization-C_VidnTq.js.map +0 -1
package/dist/{ensureAutomationSessionKey-BwCXLjcX.js → ensureAutomationSessionKey-BaaHU2Wb.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { Bt as t, Ht as n, Kt as r, Lt as i, U as a, Ut as o, gt as s, rt as c, t as l } from "./chainConfig-
|
|
3
|
-
import { d as u, p as d } from "./publishAuthorization-
|
|
2
|
+
import { Bt as t, Ht as n, Kt as r, Lt as i, U as a, Ut as o, gt as s, rt as c, t as l } from "./chainConfig-nYXoVL1s.js";
|
|
3
|
+
import { d as u, p as d } from "./publishAuthorization-CVl5ZK5B.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-
|
|
83
|
+
//# sourceMappingURL=ensureAutomationSessionKey-BaaHU2Wb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureAutomationSessionKey-
|
|
1
|
+
{"version":3,"file":"ensureAutomationSessionKey-BaaHU2Wb.js","names":["__exportAll","isContractDeployed","readUntil","ManagedAccountPublishError","readIsActiveSigner","getManagedAccountWallet","waitForPublishReceipt","getPublishThirdwebChain","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,IAAgBf,EAAwB;CAC9C,MAAMe,EAAc,YAAY;EAAE,QAAQZ,EAAU;EAAG,OAAOD,EAAwB;CAAE,CAAC;CACzF,IAAMc,IAAiBD,EAAc,WAAW;CAChD,IAAI,CAACC,GACH,MAAM,IAAIlB,EACRa,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,QAAQjB,EAAU;EAClB,OAAOD,EAAwB;EAC/B,SAASe;CACX,CAAC,GACKI,IAAcf,EAClBD,EAAqC,EAAE,aAAU,CAAC,CACpD,GAEIiB,IAAe;CACnB,IAAI;EACF,IAAe,MAAMC,EAAuB;GAC1C;GACA;GACA,gBAAgBF;EAClB,CAAC;CACH,SAASG,GAAO;EACd,MAAM,IAAI1B,EACRc,EAAsB,GACtB,oCACAK,GACAO,CACF;CACF;CAEA,IAAIF,GACF,IAAI;EACF,IAAMG,IAAKC,EAAc;GACvB,UAAUP;GACV,SAASH;GACT;GACA;EACF,CAAC,GACKW,IAAS,MAAMC,EAAgB;GAAE,SAASZ;GAAgB,aAAaS;EAAG,CAAC;EACjF,MAAMxB,EAAsB0B,EAAO,eAAgC;CACrE,SAASH,GAAO;EACd,MAAM,IAAI1B,EACRc,EAAsB,GACtB,oCACAK,GACAO,CACF;CACF;CASF,IAAI,CAAC,MALgB3B,QACbY,EAA0BQ,GAAgBY,CAAiB,GACjE,SACA,EAAE,UAAUP,IAAe,IAAI,EAAE,CACnC,GAEE,MAAM,IAAIxB,EACRc,EAAsB,GACtB,oCACAK,CACF;AAEJ;AAKA,eAAsBP,EAA2B,GAG/B;CAChB,IAAM,EAAE,mBAAgB,yBAAsBQ,GACxCF,IAAiB,MAAMF,EAAoCG,CAAc,GAEzEE,IAAkBC,EAAY;EAClC,QAAQjB,EAAU;EAClB,OAAOD,EAAwB;EAC/B,SAASe;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,MAAMxB,EAAsB0B,EAAO,eAAgC;CACrE,SAASH,GAAO;EACd,MAAM,IAAI1B,EACRe,EAAmB,GACnB,oCACAI,GACAO,CACF;CACF;AACF;AAQA,eAAsBf,EACpB,GACA,GACkB;CAClB,IAAI;EAIF,OAHM,MAAMb,EAAmBqB,CAAc,IAGtC,MAAMlB,EACXkB,GACAY,CACF,IALS;CAMX,SAASL,GAAO;EACd,MAAM,IAAI1B,EACRc,EAAsB,GACtB,oCACAK,GACAO,CACF;CACF;AACF"}
|
package/dist/{ensureModularPublishBootstrap-DZcceVDq.js → ensureModularPublishBootstrap-NzYQ1MfY.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { Kt as t, T as n, U as r, Z as i, gt as a, ht as o, rt as s, t as c } from "./chainConfig-
|
|
3
|
-
import { t as l } from "./managedAccountAdmin-
|
|
2
|
+
import { Kt as t, T as n, U as r, Z as i, gt as a, ht as o, rt as s, t as c } from "./chainConfig-nYXoVL1s.js";
|
|
3
|
+
import { t as l } from "./managedAccountAdmin-BeSXTCeH.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-
|
|
21
|
+
//# sourceMappingURL=ensureModularPublishBootstrap-NzYQ1MfY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureModularPublishBootstrap-
|
|
1
|
+
{"version":3,"file":"ensureModularPublishBootstrap-NzYQ1MfY.js","names":["__exportAll","ManagedAccountPublishError","ensureManagedAccountEasConfigured","getManagedAccountWallet","syncPublishInAppAuthToken","getPublishThirdwebChain","fromThirdwebAccount","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,IAAgBT,EAAwB;CAC9C,MAAMS,EAAc,YAAY;EAAE,QAAQL,EAAU;EAAG,OAAOF,EAAwB;CAAE,CAAC;CACzF,IAAMQ,IAAiBD,EAAc,WAAW;CAChD,IAAI,CAACC,GACH,MAAM,IAAIZ,EACR,uDAAuDO,EAAoB,EAAE,0DAC7E,+BACAM,CACF;CAEF,IAAID,EAAe,QAAQ,YAAY,MAAMC,EAAe,YAAY,GACtE,MAAM,IAAIb,EACR,kCAAkCY,EAAe,QAAQ,kCAAkCC,EAAe,oDAC1G,+BACAA,CACF;CAMF,OAHA,MAAMZ,EAAkCY,GAAgB,YACtDR,EAAoB,MAAMG,EAAuBK,CAAc,CAAC,CAClE,GACOD;AACT"}
|
package/dist/{ensureSmartWalletThenPublish-BW1_dW3n.js → ensureSmartWalletThenPublish-CpuDoo5O.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { Ct as t, H as n, Kt as r, V as i, X as a, d as o, gt as s, ht as c, i as l, t as u, wt as d } from "./chainConfig-
|
|
2
|
+
import { Ct as t, H as n, Kt as r, V as i, X as a, d as o, gt as s, ht as c, i as l, t as u, wt as d } from "./chainConfig-nYXoVL1s.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, t, u, d) {
|
|
|
44
44
|
//#endregion
|
|
45
45
|
export { m as n, v as t };
|
|
46
46
|
|
|
47
|
-
//# sourceMappingURL=ensureSmartWalletThenPublish-
|
|
47
|
+
//# sourceMappingURL=ensureSmartWalletThenPublish-CpuDoo5O.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureSmartWalletThenPublish-
|
|
1
|
+
{"version":3,"file":"ensureSmartWalletThenPublish-CpuDoo5O.js","names":["__exportAll","isPublishWallet","getConnectedModularAccount","ManagedAccountPublishError","getConnectedManagedAccountAddress","resolveSmartWalletForPublish","startPublish","getPublishThirdwebChain","fromThirdwebAccount","getPublishConfig","getPublishChainName","isSeedSigner","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,IACxCjB,EAAgBiB,CAAM,IAAUA,EAAO,SACvCP,EAAaO,CAAM,IAAUA,IAC1BV,EAAoBU,CAAiB,CAAC,CAAC;AAChD;AAMA,eAAsBJ,EACpB,GACA,GACA,GACA,GACkC;CAClC,IAAMM,IAASX,EAAiB,GAC1BY,IAAU,MAAMC,EAAW;CACjC,IAAI,CAACD,KAAW,CAACA,EAAQ,KAAK,GAC5B,OAAO,EAAE,SAAS,aAAa;CAGjC,IAAID,EAAO,oBAAoB;EAC7B,IAAMG,IAAiB,MAAMrB,EAA2B;EACxD,IAAI,CAACqB,GACH,OAAO;GACL,SAAS;GACT,OAAO,IAAIpB,EAA2BY,GAAwB,6BAA6B;EAC7F;EAGF,IAAIS;EACJ,IAAI;GACF,IAAiB,MAAMpB,EAAkCG,EAAwB,CAAC;EACpF,SAASkB,GAAO;GACd,OAAO;IACL,SAAS;IACT,OAAO,IAAItB,EACTa,EAAwB,GACxB,+BACA,KAAA,GACAS,CACF;GACF;EACF;EAEA,IAAMC,IAASlB,EAAoBe,GAAgB,EAAE,MAAM,QAAQ,CAAC;EACpE,OAAOjB,EAAaqB,GAAMH,GAAgBE,GAAQ;GAChD,GAAGE;GACH,gBAAgBX,EAAqBW,GAAS,cAAc,KAAKF,EAAO;EAC1E,CAAC;CACH;CAEA,IAAMG,IAAW,MAAMxB,EAA6ByB,KAAiB,IAAI;CACzE,IAAI,aAAaD,GAAU;EACzB,IAAMH,IAASlB,EAAoBqB,EAAS,SAAS,EAAE,MAAM,QAAQ,CAAC;EACtE,OAAOvB,EAAaqB,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertStorageBoundToIdentity.d.ts","sourceRoot":"","sources":["../../src/helpers/assertStorageBoundToIdentity.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,kCAAkC,GAAG;IAC/C,cAAc,EAAE,MAAM,CAAA;IACtB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,kCAAkC,GAAG;IAC/C,KAAK,EAAE,OAAO,CAAA;IACd,GAAG,EAAE,oBAAoB,GAAG,uBAAuB,GAAG,IAAI,CAAA;IAC1D,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,kCAAkC,GACzC,OAAO,CAAC,kCAAkC,CAAC,
|
|
1
|
+
{"version":3,"file":"assertStorageBoundToIdentity.d.ts","sourceRoot":"","sources":["../../src/helpers/assertStorageBoundToIdentity.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,kCAAkC,GAAG;IAC/C,cAAc,EAAE,MAAM,CAAA;IACtB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,kCAAkC,GAAG;IAC/C,KAAK,EAAE,OAAO,CAAA;IACd,GAAG,EAAE,oBAAoB,GAAG,uBAAuB,GAAG,IAAI,CAAA;IAC1D,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,kCAAkC,GACzC,OAAO,CAAC,kCAAkC,CAAC,CAsE7C"}
|
|
@@ -5,7 +5,11 @@ export type EnrollPublishAutomationParams = {
|
|
|
5
5
|
sessionKeyAddress: string;
|
|
6
6
|
/** Optional app label stored in the sidecar (defaults to zero address). */
|
|
7
7
|
appAddress?: string;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Unix seconds when the session key and the grant end. Defaults to 365 days from now
|
|
10
|
+
* ({@link PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS}); the same value goes to both, so the
|
|
11
|
+
* on-chain key never outlives its PublishAuthorization.
|
|
12
|
+
*/
|
|
9
13
|
expiresAt?: number;
|
|
10
14
|
/**
|
|
11
15
|
* User-controlled ManagedAccount wallet used to add the session key and attest the sidecar.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrollPublishAutomation.d.ts","sourceRoot":"","sources":["../../src/helpers/enrollPublishAutomation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"enrollPublishAutomation.d.ts","sourceRoot":"","sources":["../../src/helpers/enrollPublishAutomation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAUjD,OAAO,EAGL,KAAK,gCAAgC,EACtC,MAAM,kCAAkC,CAAA;AAIzC,MAAM,MAAM,6BAA6B,GAAG;IAC1C,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,aAAa,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,aAAa,EAAE,gCAAgC,CAAA;CAChD,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,CAAC,EAAE,aAAa,CAAA;CAC3B,CAAA;AA0DD;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,6BAA6B,CAAC,CA4BxC;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,IAAI,CAAC,CAaf"}
|
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 b, Pt as x, Qt as ee, S, St as C, T as te, Tt as w, Ut as T, Wt as ne, Xt as re, Yt as ie, Zt as ae, _ as oe, _t as se, a as ce, an as le, at as ue, b as de, bt as fe, c as pe, ct as me, dt as he, en as ge, f as _e, ft as ve, g as ye, h as be, i as E, in as xe, it as Se, jt as Ce, k as we, kt as Te, l as Ee, lt as De, m as Oe, n as ke, nn as Ae, o as je, on as D, ot as Me, p as Ne, qt as Pe, r as Fe, rn as Ie, s as Le, st as Re, t as ze, tn as Be, u as Ve, ut as He, v as Ue, vt as We, w as Ge, wt as Ke, x as qe, xt as Je, y as Ye, yt as Xe, zt as Ze } from "./chainConfig-
|
|
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 b, Pt as x, Qt as ee, S, St as C, T as te, Tt as w, Ut as T, Wt as ne, Xt as re, Yt as ie, Zt as ae, _ as oe, _t as se, a as ce, an as le, at as ue, b as de, bt as fe, c as pe, ct as me, dt as he, en as ge, f as _e, ft as ve, g as ye, h as be, i as E, in as xe, it as Se, jt as Ce, k as we, kt as Te, l as Ee, lt as De, m as Oe, n as ke, nn as Ae, o as je, on as D, ot as Me, p as Ne, qt as Pe, r as Fe, rn as Ie, s as Le, st as Re, t as ze, tn as Be, u as Ve, ut as He, v as Ue, vt as We, w as Ge, wt as Ke, x as qe, xt as Je, y as Ye, yt as Xe, zt as Ze } from "./chainConfig-nYXoVL1s.js";
|
|
2
2
|
import { i as Qe, r as O, t as $e } from "./publishWalletRegistry-BaQe9rIR.js";
|
|
3
|
-
import { a as et, c as tt, g as nt, h as rt, i as it, l as at, n as ot, o as st, r as ct, s as lt, t as ut } from "./publishAuthorization-
|
|
3
|
+
import { a as et, c as tt, g as nt, h as rt, i as it, l as at, n as ot, o as st, r as ct, s as lt, t as ut } from "./publishAuthorization-CVl5ZK5B.js";
|
|
4
4
|
import { n as dt, r as ft } from "./collectBatchUids-qRc2q61Q.js";
|
|
5
5
|
import { BaseDb as k, arweaveL1FinalizeJobs as A, isItemOwned as pt, publishProcesses as j, uploadProcesses as mt } from "@seedprotocol/sdk";
|
|
6
6
|
import { createWalletClient as ht, custom as gt, defineChain as _t } from "viem";
|
|
@@ -781,33 +781,33 @@ function nr(e) {
|
|
|
781
781
|
return e.verifiedAt + Et;
|
|
782
782
|
}
|
|
783
783
|
async function rr(e) {
|
|
784
|
-
let t = Y(e.wallet), n = e.
|
|
785
|
-
if (!/^0x[0-9a-fA-F]{40}$/.test(
|
|
786
|
-
let
|
|
787
|
-
if (
|
|
788
|
-
let
|
|
789
|
-
domain:
|
|
784
|
+
let t = Y(e.wallet), n = e.scope ?? B, r = n === B ? q(e.domain) : Hn(e.domain), i = e.claimer.trim();
|
|
785
|
+
if (!/^0x[0-9a-fA-F]{40}$/.test(i)) throw Error("@seedprotocol/publish: attestDomainOwnership requires a valid claimer address");
|
|
786
|
+
let a = H(e.challengeHash);
|
|
787
|
+
if (a === M) throw Error("@seedprotocol/publish: attestDomainOwnership requires a non-zero challengeHash");
|
|
788
|
+
let s = e.verifiedAt ?? Math.floor(Date.now() / 1e3), c = Un({
|
|
789
|
+
domain: r,
|
|
790
790
|
creationDate: e.registrySnapshot.creationDate ?? "",
|
|
791
791
|
registrarIanaId: e.registrySnapshot.registrarIanaId ?? ""
|
|
792
|
-
}),
|
|
793
|
-
verifiedAt:
|
|
794
|
-
registryExpirationDate:
|
|
792
|
+
}), l = e.registrySnapshot.creationDate ?? "", u = e.registrySnapshot.expirationDate ?? "", d = e.method ?? Ot, f = nr({
|
|
793
|
+
verifiedAt: s,
|
|
794
|
+
registryExpirationDate: u,
|
|
795
795
|
override: e.expirationTime
|
|
796
|
-
}), m = tr({
|
|
797
|
-
domain:
|
|
798
|
-
claimer:
|
|
799
|
-
method:
|
|
800
|
-
challengeHash:
|
|
801
|
-
verifiedAt:
|
|
802
|
-
registryCreationDate:
|
|
803
|
-
registryExpirationDate:
|
|
804
|
-
registryFingerprint:
|
|
805
|
-
scope:
|
|
796
|
+
}), p = e.ensureSchema === !1 ? Z() : await er(e.wallet), m = tr({
|
|
797
|
+
domain: r,
|
|
798
|
+
claimer: i,
|
|
799
|
+
method: d,
|
|
800
|
+
challengeHash: a,
|
|
801
|
+
verifiedAt: s,
|
|
802
|
+
registryCreationDate: l,
|
|
803
|
+
registryExpirationDate: u,
|
|
804
|
+
registryFingerprint: c,
|
|
805
|
+
scope: n
|
|
806
806
|
}), h = await X(t, y({
|
|
807
|
-
schema:
|
|
807
|
+
schema: p,
|
|
808
808
|
data: {
|
|
809
|
-
recipient:
|
|
810
|
-
expirationTime: BigInt(
|
|
809
|
+
recipient: i,
|
|
810
|
+
expirationTime: BigInt(f),
|
|
811
811
|
revocable: !0,
|
|
812
812
|
refUID: M,
|
|
813
813
|
data: m,
|
|
@@ -819,11 +819,11 @@ async function rr(e) {
|
|
|
819
819
|
if (!_ || !V(_)) throw Error("@seedprotocol/publish: attestDomainOwnership failed — could not parse attestation UID");
|
|
820
820
|
return {
|
|
821
821
|
uid: _,
|
|
822
|
-
schemaUid:
|
|
823
|
-
challengeHash:
|
|
824
|
-
registryFingerprint:
|
|
825
|
-
verifiedAt:
|
|
826
|
-
expirationTime:
|
|
822
|
+
schemaUid: p,
|
|
823
|
+
challengeHash: a,
|
|
824
|
+
registryFingerprint: c,
|
|
825
|
+
verifiedAt: s,
|
|
826
|
+
expirationTime: f
|
|
827
827
|
};
|
|
828
828
|
}
|
|
829
829
|
async function ir(e) {
|
|
@@ -992,40 +992,40 @@ function fr(e) {
|
|
|
992
992
|
]);
|
|
993
993
|
}
|
|
994
994
|
async function pr(e) {
|
|
995
|
-
let t = ur(e.wallet), n =
|
|
996
|
-
if (e.mode === "uids")
|
|
995
|
+
let t = ur(e.wallet), n = [], r;
|
|
996
|
+
if (e.mode === "uids") n = e.attestationUids.map((e) => H(e)).filter((e) => V(e)), r = e.batchHash ? H(e.batchHash) : qt(n);
|
|
997
997
|
else {
|
|
998
998
|
if (!e.batchHash) throw Error("@seedprotocol/publish: attestPublishedBy hash mode requires batchHash");
|
|
999
|
-
if (
|
|
999
|
+
if (r = H(e.batchHash), r === M) throw Error("@seedprotocol/publish: attestPublishedBy hash mode requires a non-zero batchHash");
|
|
1000
1000
|
}
|
|
1001
|
-
let
|
|
1002
|
-
if (!V(
|
|
1003
|
-
let s = fr({
|
|
1004
|
-
seedUid:
|
|
1005
|
-
versionUid:
|
|
1006
|
-
attestationUids:
|
|
1007
|
-
batchHash:
|
|
1001
|
+
let i = H(e.seedUid);
|
|
1002
|
+
if (!V(i)) throw Error("@seedprotocol/publish: attestPublishedBy requires a valid seedUid");
|
|
1003
|
+
let a = H(e.versionUid ?? M), s = e.ensureSchema === !1 ? $() : await dr(e.wallet), l = fr({
|
|
1004
|
+
seedUid: i,
|
|
1005
|
+
versionUid: a,
|
|
1006
|
+
attestationUids: n,
|
|
1007
|
+
batchHash: r,
|
|
1008
1008
|
toolName: e.toolName,
|
|
1009
1009
|
toolVersion: e.toolVersion
|
|
1010
|
-
}),
|
|
1011
|
-
schema:
|
|
1010
|
+
}), u = await Q(t, y({
|
|
1011
|
+
schema: s,
|
|
1012
1012
|
data: {
|
|
1013
1013
|
recipient: c,
|
|
1014
1014
|
expirationTime: BigInt(vt),
|
|
1015
1015
|
revocable: !0,
|
|
1016
|
-
refUID:
|
|
1017
|
-
data:
|
|
1016
|
+
refUID: i,
|
|
1017
|
+
data: l,
|
|
1018
1018
|
value: 0n
|
|
1019
1019
|
}
|
|
1020
1020
|
}));
|
|
1021
|
-
if (!
|
|
1022
|
-
let { easContractAddress:
|
|
1023
|
-
if (!
|
|
1021
|
+
if (!u) throw Error("@seedprotocol/publish: attestPublishedBy failed — no receipt");
|
|
1022
|
+
let { easContractAddress: d } = E(), f = o(u, d);
|
|
1023
|
+
if (!f || !V(f)) throw Error("@seedprotocol/publish: attestPublishedBy failed — could not parse attestation UID");
|
|
1024
1024
|
return {
|
|
1025
|
-
uid:
|
|
1026
|
-
schemaUid:
|
|
1027
|
-
batchHash:
|
|
1028
|
-
attestationUids:
|
|
1025
|
+
uid: f,
|
|
1026
|
+
schemaUid: s,
|
|
1027
|
+
batchHash: r,
|
|
1028
|
+
attestationUids: n
|
|
1029
1029
|
};
|
|
1030
1030
|
}
|
|
1031
1031
|
async function mr(e) {
|