@seedprotocol/publish 0.7.3-next.654.g52217f6 → 0.7.3

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 (42) hide show
  1. package/README.md +4 -2
  2. package/dist/chainConfig-RhKIuGtN.js +5289 -0
  3. package/dist/chainConfig-RhKIuGtN.js.map +1 -0
  4. package/dist/config.d.ts +3 -1
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/{ensureAutomationSessionKey-D0bbWT8e.js → ensureAutomationSessionKey-CvUntLne.js} +25 -26
  7. package/dist/{ensureAutomationSessionKey-D0bbWT8e.js.map → ensureAutomationSessionKey-CvUntLne.js.map} +1 -1
  8. package/dist/{ensureModularPublishBootstrap-x1bmc__0.js → ensureModularPublishBootstrap-D9q246TT.js} +9 -11
  9. package/dist/{ensureModularPublishBootstrap-x1bmc__0.js.map → ensureModularPublishBootstrap-D9q246TT.js.map} +1 -1
  10. package/dist/ensureSmartWalletThenPublish-C_iS5Wb-.js +52 -0
  11. package/dist/ensureSmartWalletThenPublish-C_iS5Wb-.js.map +1 -0
  12. package/dist/helpers/ensureSmartWalletThenPublish.d.ts +1 -0
  13. package/dist/helpers/ensureSmartWalletThenPublish.d.ts.map +1 -1
  14. package/dist/helpers/ensureWalletThenPublish.d.ts +7 -0
  15. package/dist/helpers/ensureWalletThenPublish.d.ts.map +1 -1
  16. package/dist/helpers/publishItem.d.ts +21 -0
  17. package/dist/helpers/publishItem.d.ts.map +1 -0
  18. package/dist/index.d.ts +2 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +341 -476
  21. package/dist/index.js.map +1 -1
  22. package/dist/managedAccountAdmin-CLVRJEKI.js +26 -0
  23. package/dist/{managedAccountAdmin-CdS1SCA_.js.map → managedAccountAdmin-CLVRJEKI.js.map} +1 -1
  24. package/dist/publishAuthorization-DAarz1JK.js +176 -0
  25. package/dist/publishAuthorization-DAarz1JK.js.map +1 -0
  26. package/dist/{resolveRevokeAccount-D2RP6qcU.js → resolveRevokeAccount-TRcqJtIO.js} +13 -15
  27. package/dist/{resolveRevokeAccount-D2RP6qcU.js.map → resolveRevokeAccount-TRcqJtIO.js.map} +1 -1
  28. package/dist/services/upload/uploadMachine.d.ts +1 -1
  29. package/dist/thirdweb.js +144 -145
  30. package/dist/thirdweb.js.map +1 -1
  31. package/dist/{worker-BIQLQSjk.js → worker-CyuMiBB-.js} +2 -2
  32. package/dist/{worker-BIQLQSjk.js.map → worker-CyuMiBB-.js.map} +1 -1
  33. package/package.json +6 -6
  34. package/dist/chainConfig-bc_6IgAw.js +0 -1455
  35. package/dist/chainConfig-bc_6IgAw.js.map +0 -1
  36. package/dist/ensureSmartWalletThenPublish-DNkeFWvC.js +0 -47
  37. package/dist/ensureSmartWalletThenPublish-DNkeFWvC.js.map +0 -1
  38. package/dist/managedAccountAdmin-CdS1SCA_.js +0 -28
  39. package/dist/publishAuthorization-C5kXlbOT.js +0 -3833
  40. package/dist/publishAuthorization-C5kXlbOT.js.map +0 -1
  41. package/dist/publishThirdwebClient-VSG2MC38.js +0 -18
  42. package/dist/publishThirdwebClient-VSG2MC38.js.map +0 -1
@@ -0,0 +1,26 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { F as t, H as n, It as r, J as i, Ot as a, rt as o, t as s } from "./chainConfig-RhKIuGtN.js";
3
+ //#region src/helpers/managedAccountAdmin.ts
4
+ var c = /* @__PURE__ */ e({ getManagedAccountAdmin: () => l });
5
+ async function l(e) {
6
+ n();
7
+ let c = t();
8
+ await c.autoConnect({
9
+ client: i(),
10
+ chain: o()
11
+ });
12
+ let l = c.getAccount();
13
+ if (!l) throw new r(`Could not connect the in-app wallet that administers your publishing account on ${s()}. Reconnect with the same sign-in method and try again.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
14
+ let u;
15
+ try {
16
+ u = await a(e, l.address);
17
+ } catch (t) {
18
+ throw new r(`Could not check the admins of your publishing account on ${s()}.`, "MANAGED_ACCOUNT_UNAVAILABLE", e, t);
19
+ }
20
+ if (!u) throw new r(`The connected in-app wallet (${l.address}) is not an admin of publishing account ${e}.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
21
+ return l;
22
+ }
23
+ //#endregion
24
+ export { c as n, l as t };
25
+
26
+ //# sourceMappingURL=managedAccountAdmin-CLVRJEKI.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"managedAccountAdmin-CdS1SCA_.js","names":["__exportAll","ManagedAccountPublishError","readIsAdmin","getPublishChainName","getPublishThirdwebChain","syncPublishInAppAuthToken","getModularAccountWallet","getClient","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,IAASJ,EAAwB;CACvC,MAAMI,EAAO,YAAY;EAAE,QAAQH,EAAU;EAAG,OAAOH,EAAwB;CAAE,CAAC;CAClF,IAAMO,IAAQD,EAAO,WAAW;CAChC,IAAI,CAACC,GACH,MAAM,IAAIV,EACR,mFAAmFE,EAAoB,EAAE,0DACzG,+BACAS,CACF;CAEF,IAAIC;CACJ,IAAI;EACF,IAAU,MAAMX,EAAYU,GAA2BD,EAAM,OAAkB;CACjF,SAASG,GAAO;EACd,MAAM,IAAIb,EACR,4DAA4DE,EAAoB,EAAE,IAClF,+BACAS,GACAE,CACF;CACF;CACA,IAAI,CAACD,GACH,MAAM,IAAIZ,EACR,gCAAgCU,EAAM,QAAQ,0CAA0CC,EAAe,IACvG,+BACAA,CACF;CAEF,OAAOD;AACT"}
1
+ {"version":3,"file":"managedAccountAdmin-CLVRJEKI.js","names":["__exportAll","getModularAccountWallet","syncPublishInAppAuthToken","ManagedAccountPublishError","getClient","readIsAdmin","getPublishThirdwebChain","getPublishChainName","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,QAAQN,EAAU;EAAG,OAAOE,EAAwB;CAAE,CAAC;CAClF,IAAMK,IAAQD,EAAO,WAAW;CAChC,IAAI,CAACC,GACH,MAAM,IAAIR,EACR,mFAAmFI,EAAoB,EAAE,0DACzG,+BACAK,CACF;CAEF,IAAIC;CACJ,IAAI;EACF,IAAU,MAAMR,EAAYO,GAA2BD,EAAM,OAAkB;CACjF,SAASG,GAAO;EACd,MAAM,IAAIX,EACR,4DAA4DI,EAAoB,EAAE,IAClF,+BACAK,GACAE,CACF;CACF;CACA,IAAI,CAACD,GACH,MAAM,IAAIV,EACR,gCAAgCQ,EAAM,QAAQ,0CAA0CC,EAAe,IACvG,+BACAA,CACF;CAEF,OAAOD;AACT"}
@@ -0,0 +1,176 @@
1
+ import { Nt as e, _t as t, a as n, b as r, ft as i, ut as a, v as o, vt as s, y as c, yt as l } from "./chainConfig-RhKIuGtN.js";
2
+ import { keccak256 as u, toUtf8Bytes as d } from "ethers";
3
+ import { SchemaEncoder as f, SchemaRegistry as p, ZERO_BYTES32 as m } from "@ethereum-attestation-service/eas-sdk";
4
+ import { createContext as h, useContext as g } from "react";
5
+ import { PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS as _, PUBLISH_AUTHORIZATION_SCHEMA_DEF as v, PUBLISH_AUTHORIZATION_SCHEMA_DEF as y, PUBLISH_AUTHORIZATION_SCHEMA_NAME as b, PUBLISH_AUTHORIZATION_SCHEMA_NAME as x, PUBLISH_AUTHORIZATION_SCOPES as S, PUBLISH_AUTHORIZATION_SCOPES as C, assessPublishAuthorization as w, decodePublishAuthorizationData as T, getPublishAuthorizationFromEas as E, isValidEasAttestationUid as D, normalizeBytes32Hex as O } from "@seedprotocol/eas";
6
+ //#region src/react/PublishConfigContext.tsx
7
+ var k = h(null);
8
+ function A() {
9
+ let e = g(k);
10
+ if (!e) throw Error("usePublishConfig: PublishConfig is missing. Pass config to PublishProvider or call initPublish() before render.");
11
+ return e;
12
+ }
13
+ //#endregion
14
+ //#region src/helpers/approvedTargetsForAutomationPublish.ts
15
+ function j() {
16
+ let e = n().modularAccountModuleContract?.trim();
17
+ if (!e || !/^0x[0-9a-fA-F]{40}$/.test(e)) throw Error("@seedprotocol/publish: session keys require PublishConfig.modularAccountModuleContract (their only approved target is the Seed executor module).");
18
+ return [e.toLowerCase()];
19
+ }
20
+ //#endregion
21
+ //#region src/helpers/automationSessionKeyPermissions.ts
22
+ var M = "publish,revoke";
23
+ function N(e) {
24
+ let t = {
25
+ approvedTargets: j(),
26
+ nativeTokenLimitPerTransaction: 0
27
+ };
28
+ return typeof e?.expiresAt == "number" && e.expiresAt > 0 && (t.expiresAt = Math.trunc(e.expiresAt)), t;
29
+ }
30
+ function P(e, t = M) {
31
+ let n = `${[...e.approvedTargets].map((e) => e.toLowerCase()).sort().join(",")}|${e.nativeTokenLimitPerTransaction}|${e.expiresAt ?? 0}|${t.trim()}`;
32
+ return u(d(n));
33
+ }
34
+ function F(e) {
35
+ let t = {
36
+ approvedTargets: e.approvedTargets,
37
+ nativeTokenLimitPerTransaction: e.nativeTokenLimitPerTransaction
38
+ };
39
+ return e.expiresAt != null && e.expiresAt > 0 ? {
40
+ ...t,
41
+ permissionEndTimestamp: /* @__PURE__ */ new Date(e.expiresAt * 1e3)
42
+ } : t;
43
+ }
44
+ //#endregion
45
+ //#region src/services/publishAuthorization/index.ts
46
+ var I = "0x0000000000000000000000000000000000000000", L = !0, R = "0x0000000000000000000000000000000000000000";
47
+ function z(e) {
48
+ if (a(e)) return e.txSender;
49
+ if (i(e)) return e;
50
+ throw Error("@seedprotocol/publish: publish authorization write APIs require a PublishWallet or SeedTxSender");
51
+ }
52
+ async function B(t, n) {
53
+ let r = await t.sendTransaction(n);
54
+ return e(r.transactionHash);
55
+ }
56
+ function V(e, t) {
57
+ let n = t.trim();
58
+ if (!/^0x[0-9a-fA-F]{40}$/.test(n)) throw Error(`@seedprotocol/publish: ${e} must be a valid address`);
59
+ return n;
60
+ }
61
+ function H() {
62
+ return p.getSchemaUID(v, I, L);
63
+ }
64
+ async function U(e) {
65
+ let t = z(e), n = H();
66
+ return await c(n) || (await B(t, r({
67
+ schema: v,
68
+ resolverAddress: I,
69
+ revocable: L
70
+ })), await B(t, o({
71
+ schemaUid: n,
72
+ schemaName: b
73
+ }))), n;
74
+ }
75
+ function W(e) {
76
+ return new f(v).encodeData([
77
+ {
78
+ name: "identity",
79
+ value: e.identity,
80
+ type: "address"
81
+ },
82
+ {
83
+ name: "sessionKey",
84
+ value: e.sessionKey,
85
+ type: "address"
86
+ },
87
+ {
88
+ name: "app",
89
+ value: e.app,
90
+ type: "address"
91
+ },
92
+ {
93
+ name: "scopes",
94
+ value: e.scopes,
95
+ type: "string"
96
+ },
97
+ {
98
+ name: "grantedAt",
99
+ value: e.grantedAt,
100
+ type: "uint64"
101
+ },
102
+ {
103
+ name: "expiresAt",
104
+ value: e.expiresAt,
105
+ type: "uint64"
106
+ },
107
+ {
108
+ name: "permissionsHash",
109
+ value: O(e.permissionsHash),
110
+ type: "bytes32"
111
+ }
112
+ ]);
113
+ }
114
+ async function G(e) {
115
+ let r = z(e.wallet), i = e.ensureSchema === !1 ? H() : await U(e.wallet), a = V("identity", e.identity), o = V("sessionKey", e.sessionKey), c = e.app?.trim() ? V("app", e.app) : R, l = e.grantedAt ?? Math.floor(Date.now() / 1e3), u = typeof e.expiresAt == "number" && e.expiresAt > 0 ? Math.trunc(e.expiresAt) : 0, d = e.scopes ?? S, f = O(e.permissionsHash ?? P(N({ expiresAt: u > 0 ? u : void 0 }), d === S ? "publish,revoke" : d));
116
+ if (f === m) throw Error("@seedprotocol/publish: attestPublishAuthorization requires a non-zero permissionsHash");
117
+ let p = typeof e.expirationTime == "number" && e.expirationTime > 0 ? e.expirationTime : u > 0 ? u : l + _, h = W({
118
+ identity: a,
119
+ sessionKey: o,
120
+ app: c,
121
+ scopes: d,
122
+ grantedAt: l,
123
+ expiresAt: u,
124
+ permissionsHash: f
125
+ }), g = await B(r, s({
126
+ schema: i,
127
+ data: {
128
+ recipient: o,
129
+ expirationTime: BigInt(p),
130
+ revocable: !0,
131
+ refUID: m,
132
+ data: h,
133
+ value: 0n
134
+ }
135
+ }));
136
+ if (!g) throw Error("@seedprotocol/publish: attestPublishAuthorization failed — no receipt");
137
+ let { easContractAddress: v } = n(), y = t(g, v);
138
+ if (!y || !D(y)) throw Error("@seedprotocol/publish: attestPublishAuthorization failed — could not parse attestation UID");
139
+ return {
140
+ uid: y,
141
+ schemaUid: i,
142
+ permissionsHash: f,
143
+ grantedAt: l,
144
+ expiresAt: u,
145
+ expirationTime: p
146
+ };
147
+ }
148
+ async function K(e) {
149
+ let t = z(e.wallet), n = e.schemaUid ?? H(), r = O(e.uid);
150
+ if (!D(r)) throw Error("@seedprotocol/publish: revokePublishAuthorization requires a valid attestation uid");
151
+ if (!await B(t, l([{
152
+ schema: n,
153
+ data: [{ uid: r }]
154
+ }]))) throw Error("@seedprotocol/publish: revokePublishAuthorization failed — no receipt");
155
+ }
156
+ async function q(e) {
157
+ let t = (await E({
158
+ identities: e.identities,
159
+ excludeRevoked: !1
160
+ })).find((t) => t.id?.toLowerCase() === e.uid.toLowerCase());
161
+ if (!t) return null;
162
+ let n = T(t.decodedDataJson ?? "[]"), r = typeof t.expirationTime == "number" ? t.expirationTime : typeof t.expirationTime == "string" ? Number(t.expirationTime) : null;
163
+ return {
164
+ uid: t.id,
165
+ decoded: n,
166
+ assess: w({
167
+ decoded: n,
168
+ expirationTime: r
169
+ }),
170
+ expirationTime: r
171
+ };
172
+ }
173
+ //#endregion
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
+
176
+ //# sourceMappingURL=publishAuthorization-DAarz1JK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publishAuthorization-DAarz1JK.js","names":["ZERO_ADDRESS","waitForPublishReceipt","getAttestationUidFromReceipt","getPublishConfig","registerSchema","isSeedTxSender","isPublishWallet","prepareNameSchemaAttestation","prepareEasAttest","getSchemaRecord","prepareEasMultiRevoke","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,I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GAAG;CAC1C,IAAI,CAACgD,EAAyBF,CAAG,GAC/B,MAAU,MACR,oFACF;CAUF,IAAI,CAAC,MADiB/B,EAAYY,GANvBzC,EAAsB,CAC/B;EACE,QAAQ0C;EACR,MAAM,CAAC,EAAE,OAAI,CAAC;CAChB,CACF,CAC0C,CAAE,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,6 +1,4 @@
1
- import { o as e, y as t } from "./chainConfig-bc_6IgAw.js";
2
- import { A as n, F as r, L as i, M as a } from "./publishAuthorization-C5kXlbOT.js";
3
- import { t as o } from "./publishThirdwebClient-VSG2MC38.js";
1
+ import { J as e, L as t, M as n, P as r, a as i, rt as a, z as o } from "./chainConfig-RhKIuGtN.js";
4
2
  import { getGetAdditionalSyncAddresses as s } from "@seedprotocol/sdk";
5
3
  //#region src/helpers/resolveRevokeAccount.ts
6
4
  async function c(c) {
@@ -12,27 +10,27 @@ async function c(c) {
12
10
  f = !!e?.some((e) => e?.toLowerCase() === t);
13
11
  }
14
12
  try {
15
- let e = await r(l.address);
16
- if (u.toLowerCase() === e.toLowerCase() || f) {
17
- let r = f ? await n(t()).catch(() => e) : e;
18
- if (await i(r)) {
19
- let e = a();
20
- await e.autoConnect({
21
- client: o(),
22
- chain: t()
13
+ let i = await t(l.address);
14
+ if (u.toLowerCase() === i.toLowerCase() || f) {
15
+ let t = f ? await n(a()).catch(() => i) : i;
16
+ if (await o(t)) {
17
+ let t = r();
18
+ await t.autoConnect({
19
+ client: e(),
20
+ chain: a()
23
21
  });
24
- let n = e.getAccount();
22
+ let n = t.getAccount();
25
23
  if (n) return n;
26
24
  }
27
25
  }
28
26
  } catch {}
29
27
  if (f) {
30
- let { modularAccountModuleContract: t } = e();
31
- throw t?.trim() ? Error("Revocation not supported for items published via the modular executor. Connect the ManagedAccount that controls the executor module.") : Error("Revocation not supported for items published via the modular executor.");
28
+ let { modularAccountModuleContract: e } = i();
29
+ throw e?.trim() ? Error("Revocation not supported for items published via the modular executor. Connect the ManagedAccount that controls the executor module.") : Error("Revocation not supported for items published via the modular executor.");
32
30
  }
33
31
  return l;
34
32
  }
35
33
  //#endregion
36
34
  export { c as resolveRevokeAccount };
37
35
 
38
- //# sourceMappingURL=resolveRevokeAccount-D2RP6qcU.js.map
36
+ //# sourceMappingURL=resolveRevokeAccount-TRcqJtIO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveRevokeAccount-D2RP6qcU.js","names":["getPublishConfig","getPublishThirdwebChain","getConnectedManagedAccountAddress","getSmartWalletAddressForAdmin","isSmartWalletDeployed","getManagedAccountWallet","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} 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 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":";;;;;AAsBA,eAAsBO,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,MAAMd,EAA8BO,EAAQ,OAAO;EAIjF,IAHsBD,EAAS,YAG3B,MAFiBQ,EAAsB,YAErB,KAAgBJ,GAA0B;GAC9D,IAAMK,IAAiBL,IACnB,MAAMX,EAAkCD,EAAwB,CAAC,CAAC,CAAC,YAAYgB,CAAqB,IACpGA;GAEJ,IAAI,MADmBb,EAAsBc,CAAc,GAC7C;IACZ,IAAMC,IAAuBd,EAAwB;IACrD,MAAMc,EAAqB,YAAY;KACrC,QAAQb,EAAU;KAClB,OAAOL,EAAwB;IACjC,CAAC;IACD,IAAMmB,IAAiBD,EAAqB,WAAW;IACvD,IAAIC,GACF,OAAOA;GAEX;EACF;CACF,QAAQ,CAER;CAEA,IAAIP,GAA0B;EAC5B,IAAM,EAAE,oCAAiCb,EAAiB;EAO1D,MANKqB,GAA8B,KAAK,IAM9B,MACR,sIACF,IAPY,MACR,wEACF;CAMJ;CAEA,OAAOX;AACT"}
1
+ {"version":3,"file":"resolveRevokeAccount-TRcqJtIO.js","names":["getClient","getSmartWalletAddressForAdmin","getConnectedManagedAccountAddress","getManagedAccountWallet","getPublishConfig","getPublishThirdwebChain","isSmartWalletDeployed","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} 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 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":";;;AAsBA,eAAsBO,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,MAAMhB,EAA8BS,EAAQ,OAAO;EAIjF,IAHsBD,EAAS,YAG3B,MAFiBQ,EAAsB,YAErB,KAAgBJ,GAA0B;GAC9D,IAAMK,IAAiBL,IACnB,MAAMX,EAAkCG,EAAwB,CAAC,CAAC,CAAC,YAAYY,CAAqB,IACpGA;GAEJ,IAAI,MADmBX,EAAsBY,CAAc,GAC7C;IACZ,IAAMC,IAAuBhB,EAAwB;IACrD,MAAMgB,EAAqB,YAAY;KACrC,QAAQnB,EAAU;KAClB,OAAOK,EAAwB;IACjC,CAAC;IACD,IAAMe,IAAiBD,EAAqB,WAAW;IACvD,IAAIC,GACF,OAAOA;GAEX;EACF;CACF,QAAQ,CAER;CAEA,IAAIP,GAA0B;EAC5B,IAAM,EAAE,oCAAiCT,EAAiB;EAO1D,MANKiB,GAA8B,KAAK,IAM9B,MACR,sIACF,IAPY,MACR,wEACF;CAMJ;CAEA,OAAOX;AACT"}
@@ -34,7 +34,7 @@ export declare const uploadMachine: import("xstate").StateMachine<UploadMachineC
34
34
  }, {
35
35
  type: "handleError";
36
36
  params: unknown;
37
- }, never, never, "success" | "failure" | "reset" | "sendReimbursementRequest" | "pollForConfirmation" | "uploadData", string, import("xstate").NonReducibleUnknown, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
37
+ }, never, never, "success" | "failure" | "sendReimbursementRequest" | "pollForConfirmation" | "uploadData" | "reset", string, import("xstate").NonReducibleUnknown, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
38
38
  id: "upload";
39
39
  states: {
40
40
  readonly sendReimbursementRequest: {};