@seedprotocol/publish 0.7.10 → 0.7.11-next.1384.g8b47246
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 +5 -1
- package/README.md +1 -1
- package/dist/{chainConfig-B8U89YJb.js → chainConfig-DK_5pgXF.js} +1283 -1284
- package/dist/chainConfig-DK_5pgXF.js.map +1 -0
- package/dist/{collectBatchUids-CnIe9jUB.js → collectBatchUids-qRc2q61Q.js} +1 -2
- package/dist/collectBatchUids-qRc2q61Q.js.map +1 -0
- package/dist/config.d.ts +0 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/{ensureAutomationSessionKey-B19eVd1T.js → ensureAutomationSessionKey-BwCXLjcX.js} +27 -27
- package/dist/{ensureAutomationSessionKey-B19eVd1T.js.map → ensureAutomationSessionKey-BwCXLjcX.js.map} +1 -1
- package/dist/{ensureModularPublishBootstrap-COEV4BGz.js → ensureModularPublishBootstrap-DZcceVDq.js} +9 -9
- package/dist/{ensureModularPublishBootstrap-COEV4BGz.js.map → ensureModularPublishBootstrap-DZcceVDq.js.map} +1 -1
- package/dist/{ensureSmartWalletThenPublish-DhWyUjt0.js → ensureSmartWalletThenPublish-BW1_dW3n.js} +16 -16
- package/dist/{ensureSmartWalletThenPublish-DhWyUjt0.js.map → ensureSmartWalletThenPublish-BW1_dW3n.js.map} +1 -1
- package/dist/helpers/adapters/eip1193.d.ts +1 -3
- package/dist/helpers/adapters/eip1193.d.ts.map +1 -1
- package/dist/helpers/constants.d.ts +0 -13
- package/dist/helpers/constants.d.ts.map +1 -1
- package/dist/helpers/publishWalletRegistry.d.ts +1 -5
- package/dist/helpers/publishWalletRegistry.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +233 -233
- package/dist/index.js.map +1 -1
- package/dist/managedAccountAdmin-Cb1ut9V4.js +26 -0
- package/dist/{managedAccountAdmin-xZbC3bQ5.js.map → managedAccountAdmin-Cb1ut9V4.js.map} +1 -1
- package/dist/{publishAuthorization-CpmPRbpm.js → publishAuthorization-C_VidnTq.js} +25 -25
- package/dist/{publishAuthorization-CpmPRbpm.js.map → publishAuthorization-C_VidnTq.js.map} +1 -1
- package/dist/publishWalletRegistry-BaQe9rIR.js.map +1 -1
- package/dist/react/PublishProvider.thirdweb.d.ts +0 -1
- package/dist/react/PublishProvider.thirdweb.d.ts.map +1 -1
- package/dist/{resolveRevokeAccount-D08n9UTy.js → resolveRevokeAccount-CCJ_7quC.js} +12 -12
- package/dist/{resolveRevokeAccount-D08n9UTy.js.map → resolveRevokeAccount-CCJ_7quC.js.map} +1 -1
- package/dist/services/domainOwnership/public.d.ts +1 -1
- package/dist/services/domainOwnership/public.d.ts.map +1 -1
- package/dist/services/publish/actors/index.d.ts +1 -1
- package/dist/services/publish/actors/index.d.ts.map +1 -1
- package/dist/services/publish/actors/seedUidHelpers.d.ts +0 -39
- package/dist/services/publish/actors/seedUidHelpers.d.ts.map +1 -1
- package/dist/services/publish/actors/utils.d.ts +0 -1
- package/dist/services/publish/actors/utils.d.ts.map +1 -1
- package/dist/services/publish/index.d.ts +4 -6
- package/dist/services/publish/index.d.ts.map +1 -1
- package/dist/services/publishCost/index.d.ts +2 -2
- package/dist/services/publishCost/index.d.ts.map +1 -1
- package/dist/services/publishedBy/collectBatchUids.d.ts +0 -2
- package/dist/services/publishedBy/collectBatchUids.d.ts.map +1 -1
- package/dist/services/publishedBy/index.d.ts +1 -3
- package/dist/services/publishedBy/index.d.ts.map +1 -1
- package/dist/services/publishedBy/public.d.ts +1 -1
- package/dist/services/publishedBy/public.d.ts.map +1 -1
- package/dist/thirdweb.js +102 -102
- package/dist/thirdweb.js.map +1 -1
- package/dist/{worker-4DXDWw6E.js → worker-C7XeFMWh.js} +2 -2
- package/dist/{worker-4DXDWw6E.js.map → worker-C7XeFMWh.js.map} +1 -1
- package/package.json +6 -8
- package/dist/chainConfig-B8U89YJb.js.map +0 -1
- package/dist/collectBatchUids-CnIe9jUB.js.map +0 -1
- package/dist/managedAccountAdmin-xZbC3bQ5.js +0 -26
- package/dist/services/publish/seeds.d.ts +0 -2
- package/dist/services/publish/seeds.d.ts.map +0 -1
- package/dist/services/shared.d.ts +0 -7
- package/dist/services/shared.d.ts.map +0 -1
package/dist/thirdweb.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $ as e,
|
|
2
|
-
import { i as
|
|
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-
|
|
4
|
-
import { t as L } from "./ensureSmartWalletThenPublish-
|
|
5
|
-
import { t as R } from "./ensureModularPublishBootstrap-
|
|
6
|
-
import { i as z, r as B, t as V } from "./ensureAutomationSessionKey-
|
|
1
|
+
import { $ as e, A as t, B as n, Bt as r, G as i, Gt as a, H as o, I as s, J as c, K as l, Kt as u, L as ee, Lt as te, M as ne, N as d, P as re, Q as f, R as ie, U as p, Ut as ae, V as m, Vt as h, W as g, X as oe, Y as se, Z as _, a as v, et as ce, gt as y, ht as b, i as x, j as le, mt as ue, nt as de, p as S, pt as fe, q as C, r as pe, rt as w, t as T, tt as me, z as E } from "./chainConfig-DK_5pgXF.js";
|
|
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-C_VidnTq.js";
|
|
4
|
+
import { t as L } from "./ensureSmartWalletThenPublish-BW1_dW3n.js";
|
|
5
|
+
import { t as R } from "./ensureModularPublishBootstrap-DZcceVDq.js";
|
|
6
|
+
import { i as z, r as B, t as V } from "./ensureAutomationSessionKey-BwCXLjcX.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";
|
|
@@ -15,7 +15,7 @@ import { addSessionKey as Ae, shouldUpdateSessionKey as je } from "thirdweb/exte
|
|
|
15
15
|
//#region src/react/ConnectButton.tsx
|
|
16
16
|
var q = "seedProtocol:publish:userChoseWalletDisconnect";
|
|
17
17
|
function Me(e) {
|
|
18
|
-
console.warn("[ConnectButton] Wallet setup / module install skipped:", e),
|
|
18
|
+
console.warn("[ConnectButton] Wallet setup / module install skipped:", e), x().onWalletSetupWarning?.(e);
|
|
19
19
|
}
|
|
20
20
|
function Ne() {
|
|
21
21
|
return H.isInitialized() ? Promise.resolve() : new Promise((e) => {
|
|
@@ -27,121 +27,121 @@ async function Pe(e, t, n) {
|
|
|
27
27
|
if (n.useModularExecutor) {
|
|
28
28
|
if (!t) return;
|
|
29
29
|
try {
|
|
30
|
-
|
|
31
|
-
let e =
|
|
30
|
+
_();
|
|
31
|
+
let e = p();
|
|
32
32
|
await e.autoConnect({
|
|
33
|
-
client:
|
|
34
|
-
chain:
|
|
33
|
+
client: w(),
|
|
34
|
+
chain: y(n)
|
|
35
35
|
});
|
|
36
36
|
let r = e.getAccount();
|
|
37
37
|
if (!r) return;
|
|
38
|
-
await
|
|
38
|
+
await d(t, r, n);
|
|
39
39
|
} catch {}
|
|
40
40
|
} else try {
|
|
41
|
-
await
|
|
41
|
+
await d(e.address, e, n);
|
|
42
42
|
} catch (e) {
|
|
43
43
|
Me(e);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
var Fe = () => {
|
|
48
|
-
let e = j(),
|
|
48
|
+
let e = j(), t = y(e), n = Se(), r = xe(), i = Ce(), a = we(), o = G(null), s = G(!1), c = G(!1);
|
|
49
49
|
W(() => {
|
|
50
50
|
if (typeof window > "u") return;
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
let
|
|
51
|
+
let n = s.current;
|
|
52
|
+
s.current = a;
|
|
53
|
+
let r;
|
|
54
54
|
try {
|
|
55
|
-
|
|
55
|
+
r = performance.getEntriesByType("navigation")[0]?.type;
|
|
56
56
|
} catch {
|
|
57
|
-
|
|
57
|
+
r = void 0;
|
|
58
58
|
}
|
|
59
|
-
if (
|
|
60
|
-
let
|
|
59
|
+
if (r !== "reload") return;
|
|
60
|
+
let o = !1;
|
|
61
61
|
try {
|
|
62
|
-
|
|
62
|
+
o = sessionStorage.getItem(q) === "1";
|
|
63
63
|
} catch {
|
|
64
|
-
|
|
64
|
+
o = !1;
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
client:
|
|
68
|
-
chain:
|
|
66
|
+
o || n && !a && i === "disconnected" && (c.current || (c.current = !0, (e.useModularExecutor ? g() : p()).autoConnect({
|
|
67
|
+
client: w(),
|
|
68
|
+
chain: t
|
|
69
69
|
}).catch(() => {})));
|
|
70
70
|
}, [
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
i,
|
|
72
|
+
a,
|
|
73
73
|
e.useModularExecutor,
|
|
74
|
-
|
|
74
|
+
t
|
|
75
75
|
]);
|
|
76
|
-
let
|
|
77
|
-
let
|
|
78
|
-
if (!
|
|
76
|
+
let u = Te(async (n) => {
|
|
77
|
+
let r = n.getAccount();
|
|
78
|
+
if (!r) return;
|
|
79
79
|
await Ne();
|
|
80
|
-
let
|
|
80
|
+
let i = /* @__PURE__ */ new Set([r.address.toLowerCase()]), a;
|
|
81
81
|
if (e.useModularExecutor) {
|
|
82
|
-
|
|
83
|
-
let e =
|
|
82
|
+
_();
|
|
83
|
+
let e = n.getAdminAccount?.()?.address ?? r.address, o = async () => {
|
|
84
84
|
try {
|
|
85
|
-
return await
|
|
85
|
+
return await m(t);
|
|
86
86
|
} catch {
|
|
87
87
|
try {
|
|
88
|
-
return await
|
|
88
|
+
return await l(e);
|
|
89
89
|
} catch {
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
-
|
|
94
|
+
a = await o(), a ||= (await new Promise((e) => queueMicrotask(() => e())), await o()), a && i.add(a.toLowerCase());
|
|
95
95
|
}
|
|
96
|
-
let
|
|
97
|
-
if (
|
|
98
|
-
|
|
96
|
+
let s = [...i].sort().join(",");
|
|
97
|
+
if (o.current !== s) {
|
|
98
|
+
o.current !== null && S.stopAll(), o.current = s;
|
|
99
99
|
try {
|
|
100
|
-
let e =
|
|
101
|
-
await
|
|
102
|
-
...
|
|
103
|
-
ownedAddresses: [...
|
|
104
|
-
publisherAddress:
|
|
105
|
-
...
|
|
106
|
-
...
|
|
107
|
-
await
|
|
100
|
+
let e = n.getAdminAccount?.()?.address, t = !!a || !!e && e.toLowerCase() !== r.address.toLowerCase(), o = b(r, { kind: t ? "smart" : "eoa" }), s = n.getAdminAccount?.(), c = a ? o.signer : t && s && s.address.toLowerCase() !== r.address.toLowerCase() ? b(s, { kind: "eoa" }).signer : void 0;
|
|
101
|
+
await he({
|
|
102
|
+
...o,
|
|
103
|
+
ownedAddresses: [...i],
|
|
104
|
+
publisherAddress: a ?? r.address,
|
|
105
|
+
...c ? { dataItemSigner: c } : {},
|
|
106
|
+
...t && !a ? { deploy: async () => {
|
|
107
|
+
await E(r);
|
|
108
108
|
} } : {},
|
|
109
|
-
...e && e.toLowerCase() !==
|
|
109
|
+
...e && e.toLowerCase() !== r.address.toLowerCase() ? { adminAddress: e } : {}
|
|
110
110
|
});
|
|
111
111
|
} catch (e) {
|
|
112
|
-
throw
|
|
112
|
+
throw o.current = null, console.warn("[ConnectButton] Failed to set seed client addresses:", e), e;
|
|
113
113
|
}
|
|
114
|
-
await Pe(
|
|
114
|
+
await Pe(r, a, e);
|
|
115
115
|
}
|
|
116
116
|
}, [e]);
|
|
117
117
|
return W(() => {
|
|
118
|
-
if (
|
|
119
|
-
if (
|
|
120
|
-
|
|
118
|
+
if (a) return;
|
|
119
|
+
if (i !== "connected") {
|
|
120
|
+
o.current = null;
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
if (!
|
|
123
|
+
if (!n) return;
|
|
124
124
|
let e = !1;
|
|
125
125
|
return (async () => {
|
|
126
126
|
try {
|
|
127
127
|
if (e) return;
|
|
128
|
-
await
|
|
128
|
+
await u(n);
|
|
129
129
|
} catch {}
|
|
130
130
|
})(), () => {
|
|
131
131
|
e = !0;
|
|
132
132
|
};
|
|
133
133
|
}, [
|
|
134
|
+
n,
|
|
135
|
+
r?.address,
|
|
136
|
+
i,
|
|
134
137
|
a,
|
|
135
|
-
|
|
136
|
-
c,
|
|
137
|
-
l,
|
|
138
|
-
m
|
|
138
|
+
u
|
|
139
139
|
]), /* @__PURE__ */ K(ve, {
|
|
140
|
-
client:
|
|
141
|
-
wallets:
|
|
140
|
+
client: w(),
|
|
141
|
+
wallets: C(e),
|
|
142
142
|
autoConnect: !0,
|
|
143
|
-
chain:
|
|
144
|
-
chains: [
|
|
143
|
+
chain: t,
|
|
144
|
+
chains: [t],
|
|
145
145
|
onConnect: async (e, t) => {
|
|
146
146
|
let n = e.getAccount();
|
|
147
147
|
if (n) {
|
|
@@ -150,7 +150,7 @@ var Fe = () => {
|
|
|
150
150
|
} catch {}
|
|
151
151
|
console.log("[ConnectButton] Connected", n.address);
|
|
152
152
|
try {
|
|
153
|
-
await
|
|
153
|
+
await u(e);
|
|
154
154
|
} catch {}
|
|
155
155
|
}
|
|
156
156
|
},
|
|
@@ -171,8 +171,8 @@ var Fe = () => {
|
|
|
171
171
|
});
|
|
172
172
|
}, Ie = ({ children: e, config: t, queryClient: n, queryClientRef: r }) => {
|
|
173
173
|
let i = G(void 0);
|
|
174
|
-
return t && i.current !== t && (
|
|
175
|
-
value: t ??
|
|
174
|
+
return t && i.current !== t && (v(t), i.current = t), /* @__PURE__ */ K(M.Provider, {
|
|
175
|
+
value: t ?? pe(),
|
|
176
176
|
children: /* @__PURE__ */ K(ye, { children: /* @__PURE__ */ K(ke, {
|
|
177
177
|
queryClient: n,
|
|
178
178
|
queryClientRef: r,
|
|
@@ -181,32 +181,32 @@ var Fe = () => {
|
|
|
181
181
|
});
|
|
182
182
|
}, Le = "Modular (EIP-7702) wallet is not connected. Sign in with the same method and try again.", Re = () => `Your modular account is not upgraded to an EIP-7702 smart account on ${T()} yet. Enable autoDeployEip7702ModularAccount in publish config or complete wallet setup, then retry.`, ze = () => `Automatic EIP-7702 smart account setup failed on ${T()}. Retry or reconnect your wallet.`, J = "EIP-7702 upgrade was sent but on-chain bytecode was not detected yet. Wait a moment and retry.", Y = 5;
|
|
183
183
|
async function Be() {
|
|
184
|
-
let { autoDeployEip7702ModularAccount: e } =
|
|
184
|
+
let { autoDeployEip7702ModularAccount: e } = x(), t = g();
|
|
185
185
|
await t.autoConnect({
|
|
186
|
-
client:
|
|
187
|
-
chain:
|
|
186
|
+
client: w(),
|
|
187
|
+
chain: y()
|
|
188
188
|
});
|
|
189
189
|
let n = t.getAccount();
|
|
190
|
-
if (!n) throw new
|
|
191
|
-
let i =
|
|
190
|
+
if (!n) throw new a(Le, "EIP7702_MODULAR_ACCOUNT_UNAVAILABLE");
|
|
191
|
+
let i = w(), o = U({
|
|
192
192
|
client: i,
|
|
193
|
-
chain:
|
|
193
|
+
chain: y(),
|
|
194
194
|
address: n.address
|
|
195
195
|
});
|
|
196
|
-
if (!await
|
|
197
|
-
if (!e) throw new
|
|
196
|
+
if (!await r(n.address)) {
|
|
197
|
+
if (!e) throw new a(Re(), "EIP7702_MODULAR_NOT_UPGRADED", n.address);
|
|
198
198
|
try {
|
|
199
199
|
await ge({
|
|
200
200
|
smartAccount: n,
|
|
201
|
-
chain:
|
|
201
|
+
chain: y(),
|
|
202
202
|
client: i,
|
|
203
203
|
accountContract: o
|
|
204
204
|
});
|
|
205
205
|
} catch (e) {
|
|
206
|
-
if (await
|
|
207
|
-
throw new
|
|
206
|
+
if (await h(n.address, Y)) return;
|
|
207
|
+
throw new a(ze(), "EIP7702_MODULAR_DEPLOY_FAILED", n.address, e);
|
|
208
208
|
}
|
|
209
|
-
if (!await
|
|
209
|
+
if (!await h(n.address, Y)) throw new a(J, "EIP7702_MODULAR_NOT_CONFIRMED", n.address);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
//#endregion
|
|
@@ -218,16 +218,16 @@ function X(e) {
|
|
|
218
218
|
//#region src/helpers/ensureManagedSignerSessionKey.ts
|
|
219
219
|
var Ve = () => `Could not connect the managed publishing account to authorize the modular signer on ${T()}. Reconnect and try again.`, Z = () => `Could not authorize the modular wallet as a session signer on your publishing account on ${T()}.`;
|
|
220
220
|
async function He(e) {
|
|
221
|
-
let { managedAddress: t, signerAddress: n } = e, r =
|
|
221
|
+
let { managedAddress: t, signerAddress: n } = e, r = p();
|
|
222
222
|
await r.autoConnect({
|
|
223
|
-
client:
|
|
224
|
-
chain:
|
|
223
|
+
client: w(),
|
|
224
|
+
chain: y()
|
|
225
225
|
});
|
|
226
226
|
let i = r.getAccount();
|
|
227
|
-
if (!i) throw new
|
|
227
|
+
if (!i) throw new u(Ve(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
|
|
228
228
|
let a = U({
|
|
229
|
-
client:
|
|
230
|
-
chain:
|
|
229
|
+
client: w(),
|
|
230
|
+
chain: y(),
|
|
231
231
|
address: t
|
|
232
232
|
}), o = {
|
|
233
233
|
approvedTargets: X(t),
|
|
@@ -240,7 +240,7 @@ async function He(e) {
|
|
|
240
240
|
newPermissions: o
|
|
241
241
|
});
|
|
242
242
|
} catch (e) {
|
|
243
|
-
throw new
|
|
243
|
+
throw new u(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
|
|
244
244
|
}
|
|
245
245
|
if (s) try {
|
|
246
246
|
let e = Ae({
|
|
@@ -252,43 +252,43 @@ async function He(e) {
|
|
|
252
252
|
account: i,
|
|
253
253
|
transaction: e
|
|
254
254
|
});
|
|
255
|
-
await
|
|
255
|
+
await ae(t.transactionHash);
|
|
256
256
|
} catch (e) {
|
|
257
|
-
throw new
|
|
257
|
+
throw new u(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
|
|
258
258
|
}
|
|
259
259
|
let c = !1;
|
|
260
260
|
try {
|
|
261
|
-
c = await
|
|
261
|
+
c = await te(t, n);
|
|
262
262
|
} catch (e) {
|
|
263
|
-
throw new
|
|
263
|
+
throw new u(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
|
|
264
264
|
}
|
|
265
|
-
if (!c) throw new
|
|
265
|
+
if (!c) throw new u(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
|
|
266
266
|
}
|
|
267
267
|
//#endregion
|
|
268
268
|
//#region src/helpers/enrollPublishAutomation.ts
|
|
269
269
|
async function Q(e) {
|
|
270
|
-
let t =
|
|
270
|
+
let t = p();
|
|
271
271
|
await t.autoConnect({
|
|
272
|
-
client:
|
|
273
|
-
chain:
|
|
272
|
+
client: w(),
|
|
273
|
+
chain: y()
|
|
274
274
|
});
|
|
275
275
|
let n = t.getAccount();
|
|
276
|
-
if (!n) throw new
|
|
276
|
+
if (!n) throw new u("Could not connect the managed publishing account to enroll or revoke publish automation.", "MANAGED_ACCOUNT_UNAVAILABLE", e);
|
|
277
277
|
return n;
|
|
278
278
|
}
|
|
279
279
|
async function $(e, t) {
|
|
280
280
|
return t || b(await Q(e), { kind: "smart" });
|
|
281
281
|
}
|
|
282
282
|
async function Ue(e) {
|
|
283
|
-
let t =
|
|
283
|
+
let t = x();
|
|
284
284
|
if (!t.modularAccountModuleContract?.trim()) throw Error("@seedprotocol/publish: enrollPublishAutomation requires PublishConfig.modularAccountModuleContract");
|
|
285
|
-
let
|
|
285
|
+
let n = await Q(e), r;
|
|
286
286
|
try {
|
|
287
|
-
|
|
287
|
+
r = await d(e, n, t);
|
|
288
288
|
} catch (t) {
|
|
289
|
-
throw t instanceof
|
|
289
|
+
throw t instanceof u ? t : new u("Executor module setup failed for publish automation.", "EXECUTOR_MODULE_NOT_INSTALLED", e, t);
|
|
290
290
|
}
|
|
291
|
-
await
|
|
291
|
+
await re(e, r.status === "installed" ? { installedEas: r.eas } : { readAttempts: r.status === "already-installed" ? 5 : 1 });
|
|
292
292
|
}
|
|
293
293
|
async function We(e) {
|
|
294
294
|
let { managedAddress: t, sessionKeyAddress: n, appAddress: r, expiresAt: i } = e;
|
|
@@ -369,6 +369,6 @@ async function Ke(e) {
|
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
371
|
//#endregion
|
|
372
|
-
export {
|
|
372
|
+
export { me as CALL_GAS_HEADROOM_BPS, Fe as ConnectButton, s as ExternalWalletsForDeploy, I as PUBLISH_AUTOMATION_SCOPES, Ie as PublishProvider, ee as appMetadata, P as approvedTargetsForAutomationPublish, fe as asSeedSignerFromThirdweb, ue as asThirdwebPublishWallet, Ke as assertStorageBoundToIdentity, k as buildAutomationSessionKeyPermissions, X as defaultApprovedTargetsForModularPublish, ie as deployManagedAccountViaFactory, E as deploySmartWalletContract, We as enrollPublishAutomation, V as ensureAutomationSessionKey, Be as ensureEip7702ModularAccountReady, d as ensureExecutorModuleInstalled, t as ensureManagedAccountReady, He as ensureManagedSignerSessionKey, R as ensureModularPublishBootstrap, L as ensureSmartWalletThenPublish, b as fromThirdwebAccount, w as getClient, n as getConnectedAccount, m as getConnectedManagedAccountAddress, o as getConnectedModularAccount, p as getManagedAccountWallet, g as getModularAccountWallet, y as getPublishThirdwebChain, i as getSharedPublishInAppWalletStorage, l as getSmartWalletAddressForAdmin, C as getWalletsForConnectButton, A as hashAutomationSessionKeyPermissions, B as isAutomationSessionActive, c as isSmartWalletDeployed, se as pollSmartWalletDeployed, z as removeAutomationSessionKey, oe as resolveSmartWalletForPublish, Ge as revokePublishAutomation, le as runModularExecutorPublishPrep, de as seedPaymaster, F as toThirdwebSessionKeyPermissions, ne as tryDeployManagedAccount, f as useActiveSmartWalletContract, e as useLocalWalletAccount, j as usePublishConfig, ce as wallets };
|
|
373
373
|
|
|
374
374
|
//# sourceMappingURL=thirdweb.js.map
|
package/dist/thirdweb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thirdweb.js","names":["seedClient","ConnectButtonThirdweb","pollSmartWalletDeployed","useActiveSmartWalletContract","deploySmartWalletContract","assertExecutorModuleReadyForAccount","getModularAccountWallet","getConnectedManagedAccountAddress","pollSmartWalletDeployed$1","getWalletsForConnectButton","getSharedPublishInAppWalletStorage","Eip7702ModularAccountPublishError","ExternalWalletsForDeploy","runModularExecutorPublishPrep","tryDeployManagedAccount","ensureExecutorModuleInstalled","syncPublishInAppAuthToken","appMetadata","readIsActiveSigner","getConnectedModularAccount","getConnectedAccount","isContractDeployed","getManagedAccountWallet","waitForPublishReceipt","pollSmartWalletDeployed","isSmartWalletDeployed","resolveSmartWalletForPublish","getPublishThirdwebChain","getPublishConfig","useLocalWalletAccount","fromThirdwebAccount","asThirdwebPublishWallet","getConfigRef","getClient","ensureManagedAccountReady","PublishManager","asSeedSignerFromThirdweb","CALL_GAS_HEADROOM_BPS","initPublish","getSmartWalletAddressForAdmin","ManagedAccountPublishError","seedPaymaster","getPublishChainName","wallets","deployManagedAccountViaFactory","setPublishWallet","clearPublishWallet","attestPublishAuthorization","buildAutomationSessionKeyPermissions","hashAutomationSessionKeyPermissions","usePublishConfig","PublishConfigContext","revokePublishAuthorization","approvedTargetsForAutomationPublish","toThirdwebSessionKeyPermissions","PUBLISH_AUTOMATION_SCOPES","ensureSmartWalletThenPublish","ensureModularPublishBootstrap","removeAutomationSessionKey","isAutomationSessionActive","ensureAutomationSessionKey","ConnectButton$1","USER_DISCONNECTED_SESSION_KEY","reportWalletSetupWarning","err","waitUntilSeedInitialized","client","resolve","ensureExecutorModulesForConnect","config","managedAddress","mw","ma","modularAccount","ConnectButton","thirdwebChain","wallet","useActiveWallet","activeAccount","useActiveAccount","connectionStatus","useActiveWalletConnectionStatus","isAutoConnecting","useIsAutoConnecting","lastSyncedOwnedKey","useRef","prevIsAutoConnecting","reloadAutoConnectRetried","prev","navType","userChoseDisconnect","syncActiveWalletToSeed","useCallback","account","activeWallet","owned","adminAddress","tryManaged","r","ownedKey","isSmart","publishWallet","adminAccount","dataItemSigner","useEffect","cancelled","darkTheme","PublishProviderThirdweb","initializedConfig","ThirdwebProvider","SeedProvider","MSG_NO_ACCOUNT","MSG_NOT_UPGRADED","MSG_DEPLOY_FAILED","MSG_NOT_CONFIRMED","DEPLOY_POLL_ATTEMPTS","ensureEip7702ModularAccountReady","modularAccountWallet","accountContract","getContract","autoDeployEip7702ModularAccount","deploySmartAccount","cause","defaultApprovedTargetsForModularPublish","MSG_UNAVAILABLE","MSG_ACTIVATION_FAILED","ensureManagedSignerSessionKey","params","managedWallet","managedAccount","permissions","shouldUpdate","shouldUpdateSessionKey","signerAddress","tx","addSessionKey","result","sendTransaction","active","connectManagedAccount","resolveUserWallet","userWallet","assertExecutorModuleInstalled","twAccount","install","enrollPublishAutomation","sessionKeyAddress","appAddress","revokePublishAutomation","authorizationUid","assertStorageBoundToIdentity","warnings","owner","dataItemOwner","identity","allowActiveSessionKey","allowSidecar","rows","getPublishAuthorizationFromEas","nowMs","atTime","row","decoded","decodePublishAuthorizationData","expirationTime","assess","assessPublishAuthorization"],"sources":["../src/react/ConnectButton.tsx","../src/react/PublishProvider.thirdweb.tsx","../src/helpers/ensureEip7702ModularAccountReady.ts","../src/helpers/defaultApprovedTargetsForModularPublish.ts","../src/helpers/ensureManagedSignerSessionKey.ts","../src/helpers/enrollPublishAutomation.ts","../src/helpers/assertStorageBoundToIdentity.ts"],"sourcesContent":["import React, { FC, useCallback, useEffect, useRef } from \"react\"\nimport {\n ConnectButton as ConnectButtonThirdweb,\n darkTheme,\n useActiveAccount,\n useActiveWallet,\n useActiveWalletConnectionStatus,\n useIsAutoConnecting,\n} from \"thirdweb/react\"\nimport { client as seedClient } from \"@seedprotocol/sdk\"\nimport {\n deploySmartWalletContract,\n getClient,\n getConnectedManagedAccountAddress,\n getManagedAccountWallet,\n getModularAccountWallet,\n getSmartWalletAddressForAdmin,\n getWalletsForConnectButton,\n syncPublishInAppAuthToken,\n} from \"../helpers/thirdweb\"\nimport { fromThirdwebAccount } from \"../helpers/adapters/thirdwebAccount\"\nimport { setPublishWallet, clearPublishWallet } from \"../helpers/publishWalletRegistry\"\nimport { usePublishConfig } from \"./PublishConfigContext\"\nimport { getPublishConfig } from \"../config\"\nimport type { Account, Wallet } from \"thirdweb/wallets\"\nimport type { PublishConfig } from \"../config\"\nimport { ensureExecutorModuleInstalled } from \"../helpers/ensureExecutorModule\"\nimport { PublishManager } from \"../services/publishManager\"\nimport { getPublishThirdwebChain } from '../helpers/thirdwebChain'\n\n/** Session flag so we do not force autoConnect after an explicit UI disconnect (survives reload). */\nconst USER_DISCONNECTED_SESSION_KEY = \"seedProtocol:publish:userChoseWalletDisconnect\"\n\nfunction reportWalletSetupWarning(err: unknown) {\n // Expected when managed-wallet autoConnect is still catching up; publish prep retries.\n console.warn(\"[ConnectButton] Wallet setup / module install skipped:\", err)\n getPublishConfig().onWalletSetupWarning?.(err)\n}\n\n/** Resolves after `ClientManager.init()` has finished; `setAddresses` requires this. */\nfunction waitUntilSeedInitialized(): Promise<void> {\n if (seedClient.isInitialized()) return Promise.resolve()\n return new Promise((resolve) => {\n seedClient.onReady(() => resolve())\n })\n}\n\n/**\n * Installs the Seed executor on the **ManagedAccount** (EIP-4337 Router) contract via its\n * `SeedExecutorRouterExtension`. Other accounts, such as the EIP-7702 modular wallet, have no\n * extension, so `ensureExecutorModuleInstalled` skips them.\n */\nasync function ensureExecutorModulesForConnect(\n modularAccount: Account,\n managedAddress: string | undefined,\n config: PublishConfig,\n): Promise<void> {\n if (!config.modularAccountModuleContract) {\n return\n }\n\n if (config.useModularExecutor) {\n if (!managedAddress) {\n return\n }\n try {\n syncPublishInAppAuthToken()\n const mw = getManagedAccountWallet()\n await mw.autoConnect({ client: getClient(), chain: getPublishThirdwebChain(config) })\n const ma = mw.getAccount()\n if (!ma) {\n return\n }\n await ensureExecutorModuleInstalled(managedAddress, ma, config)\n } catch {\n /* managed wallet session may lag modular connect; publish prep retries module install */\n }\n return\n }\n\n try {\n await ensureExecutorModuleInstalled(modularAccount.address, modularAccount, config)\n } catch (err) {\n reportWalletSetupWarning(err)\n }\n}\n\nconst ConnectButton: FC = () => {\n const config = usePublishConfig()\n const thirdwebChain = getPublishThirdwebChain(config)\n const wallet = useActiveWallet()\n const activeAccount = useActiveAccount()\n const connectionStatus = useActiveWalletConnectionStatus()\n const isAutoConnecting = useIsAutoConnecting()\n /** Avoid duplicate setAddresses when onConnect and the reconcile effect both run. */\n const lastSyncedOwnedKey = useRef<string | null>(null)\n const prevIsAutoConnecting = useRef(false)\n const reloadAutoConnectRetried = useRef(false)\n\n /**\n * Thirdweb sometimes finishes autoConnect on full reload with `disconnected` and no wallet\n * (see debug: isAutoConnecting true→false then disconnected). One explicit in-app autoConnect\n * retry recovers without affecting users who chose Disconnect (sessionStorage gate).\n */\n useEffect(() => {\n if (typeof window === \"undefined\") return\n const prev = prevIsAutoConnecting.current\n prevIsAutoConnecting.current = isAutoConnecting\n\n let navType: string | undefined\n try {\n navType = (\n performance.getEntriesByType(\"navigation\")[0] as\n | PerformanceNavigationTiming\n | undefined\n )?.type\n } catch {\n navType = undefined\n }\n if (navType !== \"reload\") return\n\n let userChoseDisconnect = false\n try {\n userChoseDisconnect =\n sessionStorage.getItem(USER_DISCONNECTED_SESSION_KEY) === \"1\"\n } catch {\n userChoseDisconnect = false\n }\n if (userChoseDisconnect) return\n\n if (!prev || isAutoConnecting || connectionStatus !== \"disconnected\") return\n if (reloadAutoConnectRetried.current) return\n reloadAutoConnectRetried.current = true\n\n void (config.useModularExecutor ? getModularAccountWallet() : getManagedAccountWallet())\n .autoConnect({ client: getClient(), chain: thirdwebChain })\n .catch(() => {\n /* no session or iframe not ready; Connect UI can still sign in */\n })\n }, [connectionStatus, isAutoConnecting, config.useModularExecutor, thirdwebChain])\n\n const syncActiveWalletToSeed = useCallback(\n async (activeWallet: Wallet) => {\n const account = activeWallet.getAccount()\n if (!account) {\n return\n }\n await waitUntilSeedInitialized()\n const owned = new Set<string>([account.address.toLowerCase()])\n let managedAddress: string | undefined\n if (config.useModularExecutor) {\n syncPublishInAppAuthToken()\n const adminAddress =\n activeWallet.getAdminAccount?.()?.address ?? account.address\n const tryManaged = async () => {\n try {\n return await getConnectedManagedAccountAddress(thirdwebChain)\n } catch {\n try {\n return await getSmartWalletAddressForAdmin(adminAddress)\n } catch {\n return undefined\n }\n }\n }\n managedAddress = await tryManaged()\n if (!managedAddress) {\n await new Promise<void>((r) => queueMicrotask(() => r()))\n managedAddress = await tryManaged()\n }\n if (managedAddress) {\n owned.add(managedAddress.toLowerCase())\n }\n }\n const ownedKey = [...owned].sort().join(\",\")\n if (lastSyncedOwnedKey.current === ownedKey) {\n return\n }\n // Another wallet took over: publishes started for the previous one stop (their rows stay\n // for it to resume). Not on the first sync, where publishes restored from the DB need this\n // wallet, nor on a re-sync of the same wallet.\n if (lastSyncedOwnedKey.current !== null) {\n PublishManager.stopAll()\n }\n lastSyncedOwnedKey.current = ownedKey\n try {\n const adminAddress = activeWallet.getAdminAccount?.()?.address\n // A wallet with a separate admin account, or the modular executor's ManagedAccount, is a\n // smart account; otherwise the connected account is a plain key (in-app or injected).\n const isSmart =\n !!managedAddress ||\n (!!adminAddress && adminAddress.toLowerCase() !== account.address.toLowerCase())\n const publishWallet = fromThirdwebAccount(account, { kind: isSmart ? \"smart\" : \"eoa\" })\n // Data items need an ECDSA signer. With the modular executor the connected account is an\n // EOA (or EIP-7702 on one) acting for the ManagedAccount; otherwise a smart wallet's admin\n // EOA signs them.\n const adminAccount = activeWallet.getAdminAccount?.()\n const dataItemSigner = managedAddress\n ? publishWallet.signer\n : isSmart && adminAccount && adminAccount.address.toLowerCase() !== account.address.toLowerCase()\n ? fromThirdwebAccount(adminAccount, { kind: \"eoa\" }).signer\n : undefined\n await setPublishWallet({\n ...publishWallet,\n ownedAddresses: [...owned],\n publisherAddress: managedAddress ?? account.address,\n ...(dataItemSigner ? { dataItemSigner } : {}),\n // A new user's smart wallet has no code until its first transaction: publish deploys it.\n ...(isSmart && !managedAddress\n ? { deploy: async () => { await deploySmartWalletContract(account) } }\n : {}),\n ...(adminAddress && adminAddress.toLowerCase() !== account.address.toLowerCase()\n ? { adminAddress }\n : {}),\n })\n } catch (err) {\n lastSyncedOwnedKey.current = null\n console.warn(\"[ConnectButton] Failed to set seed client addresses:\", err)\n throw err\n }\n await ensureExecutorModulesForConnect(account, managedAddress, config)\n },\n [config],\n )\n\n /**\n * Thirdweb autoConnect restores the wallet without calling onConnect. Seed addresses live in\n * SQLite (OPFS); after a wipe there is no app_state row until setAddresses runs again.\n */\n useEffect(() => {\n if (isAutoConnecting) {\n return\n }\n if (connectionStatus !== \"connected\") {\n lastSyncedOwnedKey.current = null\n return\n }\n if (!wallet) {\n return\n }\n let cancelled = false\n void (async () => {\n try {\n if (cancelled) return\n await syncActiveWalletToSeed(wallet)\n } catch {\n /* logged in syncActiveWalletToSeed */\n }\n })()\n return () => {\n cancelled = true\n }\n }, [\n wallet,\n activeAccount?.address,\n connectionStatus,\n isAutoConnecting,\n syncActiveWalletToSeed,\n ])\n\n const handleDisconnect = () => {\n try {\n sessionStorage.setItem(USER_DISCONNECTED_SESSION_KEY, \"1\")\n } catch {\n /* private mode / SSR */\n }\n void clearPublishWallet()\n PublishManager.stopAll()\n }\n\n const handleConnect = async (activeWallet: Wallet, _allConnectedWallets: Wallet[]) => {\n const account = activeWallet.getAccount()\n if (!account) return\n try {\n sessionStorage.removeItem(USER_DISCONNECTED_SESSION_KEY)\n } catch {\n /* ignore */\n }\n console.log('[ConnectButton] Connected', account.address)\n try {\n await syncActiveWalletToSeed(activeWallet)\n } catch {\n /* syncActiveWalletToSeed logs */\n }\n }\n\n return (\n <ConnectButtonThirdweb\n client={getClient()}\n wallets={getWalletsForConnectButton(config)}\n autoConnect={true}\n chain={thirdwebChain}\n chains={[ thirdwebChain, ]}\n onConnect={handleConnect}\n onDisconnect={handleDisconnect}\n theme={darkTheme({\n colors: {\n primaryButtonBg: '#1D2939',\n primaryButtonText: '#FFFFFF',\n secondaryButtonHoverBg: '#1D2939',\n connectedButtonBg: '#101828',\n connectedButtonBgHover: '#1D2939',\n borderColor: '#344054',\n },\n })}\n />\n )\n}\n\nexport default ConnectButton\n","import React, { FC, useRef } from \"react\"\nimport { ThirdwebProvider } from \"thirdweb/react\"\nimport { SeedProvider } from '@seedprotocol/react'\nimport { initPublish, getConfigRef, type PublishConfig } from \"../config\"\nimport { PublishConfigContext, usePublishConfig } from \"./PublishConfigContext\"\nimport type { PublishProviderProps } from \"./PublishProvider\"\n\nexport { usePublishConfig }\nexport type { PublishProviderProps }\n\n/**\n * Thirdweb-backed PublishProvider (includes ThirdwebProvider).\n */\nconst PublishProviderThirdweb: FC<PublishProviderProps> = ({\n children,\n config,\n queryClient,\n queryClientRef,\n}) => {\n // During render, not in an effect: children such as ConnectButton read the config on their\n // first render, which runs before this provider's effects. Once per config object.\n const initializedConfig = useRef<PublishConfig | undefined>(undefined)\n if (config && initializedConfig.current !== config) {\n initPublish(config)\n initializedConfig.current = config\n }\n\n return (\n <PublishConfigContext.Provider value={config ?? getConfigRef()}>\n <ThirdwebProvider>\n <SeedProvider queryClient={queryClient} queryClientRef={queryClientRef}>\n {children}\n </SeedProvider>\n </ThirdwebProvider>\n </PublishConfigContext.Provider>\n )\n}\n\nexport default PublishProviderThirdweb\n","import { deploySmartAccount, getContract } from 'thirdweb'\nimport { getPublishConfig } from '../config'\nimport { Eip7702ModularAccountPublishError } from '../errors'\nimport { isContractDeployed, pollSmartWalletDeployed } from './chainClient'\nimport { getClient, getModularAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_NO_ACCOUNT =\n 'Modular (EIP-7702) wallet is not connected. Sign in with the same method and try again.'\nconst MSG_NOT_UPGRADED = () =>\n `Your modular account is not upgraded to an EIP-7702 smart account on ${getPublishChainName()} yet. Enable autoDeployEip7702ModularAccount in publish config or complete wallet setup, then retry.`\nconst MSG_DEPLOY_FAILED = () =>\n `Automatic EIP-7702 smart account setup failed on ${getPublishChainName()}. Retry or reconnect your wallet.`\nconst MSG_NOT_CONFIRMED =\n 'EIP-7702 upgrade was sent but on-chain bytecode was not detected yet. Wait a moment and retry.'\n\nconst DEPLOY_POLL_ATTEMPTS = 5\n\n/**\n * Ensures the Thirdweb in-app modular wallet (EIP-7702) has non-empty bytecode at its address\n * on the publish chain. deploySmartAccount remains Thirdweb; bytecode checks use viem.\n */\nexport async function ensureEip7702ModularAccountReady(): Promise<void> {\n const { autoDeployEip7702ModularAccount } = getPublishConfig()\n const modularAccountWallet = getModularAccountWallet()\n await modularAccountWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const modularAccount = modularAccountWallet.getAccount()\n if (!modularAccount) {\n throw new Eip7702ModularAccountPublishError(MSG_NO_ACCOUNT, 'EIP7702_MODULAR_ACCOUNT_UNAVAILABLE')\n }\n\n const client = getClient()\n const accountContract = getContract({\n client,\n chain: getPublishThirdwebChain(),\n address: modularAccount.address,\n })\n\n if (await isContractDeployed(modularAccount.address)) {\n return\n }\n\n if (!autoDeployEip7702ModularAccount) {\n throw new Eip7702ModularAccountPublishError(\n MSG_NOT_UPGRADED(),\n 'EIP7702_MODULAR_NOT_UPGRADED',\n modularAccount.address,\n )\n }\n\n try {\n await deploySmartAccount({\n smartAccount: modularAccount,\n chain: getPublishThirdwebChain(),\n client,\n accountContract,\n })\n } catch (cause) {\n if (await pollSmartWalletDeployed(modularAccount.address, DEPLOY_POLL_ATTEMPTS)) {\n return\n }\n throw new Eip7702ModularAccountPublishError(\n MSG_DEPLOY_FAILED(),\n 'EIP7702_MODULAR_DEPLOY_FAILED',\n modularAccount.address,\n cause,\n )\n }\n\n if (!(await pollSmartWalletDeployed(modularAccount.address, DEPLOY_POLL_ATTEMPTS))) {\n throw new Eip7702ModularAccountPublishError(\n MSG_NOT_CONFIRMED,\n 'EIP7702_MODULAR_NOT_CONFIRMED',\n modularAccount.address,\n )\n }\n}\n","import { approvedTargetsForAutomationPublish } from './approvedTargetsForAutomationPublish'\n\n/**\n * Allowlisted call targets for a modular session signer: only the Seed executor module.\n *\n * Never the ManagedAccount (a key could then make any self-call, which the account trusts) and\n * never EAS (a direct EAS target bypasses the Seed extension's forced revocability).\n *\n * @deprecated Interactive publishing is a UserOp from the ManagedAccount itself and needs no\n * session key; automation keys use {@link approvedTargetsForAutomationPublish}, which this now\n * returns. `managedAddress` is ignored.\n * @throws if `modularAccountModuleContract` is unset or invalid\n */\nexport function defaultApprovedTargetsForModularPublish(_managedAddress?: string): `0x${string}`[] {\n return approvedTargetsForAutomationPublish()\n}\n","import { getContract, sendTransaction } from 'thirdweb'\nimport { addSessionKey, shouldUpdateSessionKey } from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport { defaultApprovedTargetsForModularPublish } from './defaultApprovedTargetsForModularPublish'\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 the modular signer on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the modular wallet as a session signer on your publishing account on ${getPublishChainName()}.`\n\n/**\n * Ensures the modular (EIP-7702) wallet is an active session signer on the ManagedAccount.\n * If permissions are missing or stale, sends `addSessionKey` signed by the managed EIP-4337 wallet.\n * Session-key AA extensions remain on Thirdweb; verification uses viem.\n *\n * The key may call only the Seed executor module ({@link defaultApprovedTargetsForModularPublish}).\n *\n * @deprecated Interactive publishing is a UserOp from the ManagedAccount itself and needs no\n * session key. For server-held keys use `enrollPublishAutomation`.\n */\nexport async function ensureManagedSignerSessionKey(params: {\n managedAddress: string\n signerAddress: string\n}): Promise<void> {\n const { managedAddress, signerAddress } = params\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\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = {\n approvedTargets: defaultApprovedTargetsForModularPublish(managedAddress),\n nativeTokenLimitPerTransaction: 0,\n }\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress: signerAddress,\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: signerAddress,\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 let active = false\n try {\n active = await readIsActiveSigner(managedAddress as Address, signerAddress as Address)\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 (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n","import type { Account } from 'thirdweb/wallets'\nimport type { PublishWallet } from './seedSigner'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { getPublishConfig } from '../config'\nimport { ManagedAccountPublishError } from '../errors'\nimport { ensureExecutorModuleInstalled, type EnsureExecutorModuleResult } from './ensureExecutorModule'\nimport { assertExecutorModuleReadyForAccount } from './executorModuleReadiness'\nimport {\n ensureAutomationSessionKey,\n removeAutomationSessionKey,\n} from './ensureAutomationSessionKey'\nimport {\n attestPublishAuthorization,\n revokePublishAuthorization,\n type AttestPublishAuthorizationResult,\n} from '../services/publishAuthorization'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\nexport type EnrollPublishAutomationParams = {\n managedAddress: string\n sessionKeyAddress: string\n /** Optional app label stored in the sidecar (defaults to zero address). */\n appAddress?: string\n /** Unix seconds session / grant end (optional). */\n expiresAt?: number\n /**\n * User-controlled ManagedAccount wallet used to add the session key and attest the sidecar.\n * When omitted, uses the connected managed in-app wallet.\n */\n userWallet?: PublishWallet\n}\n\nexport type EnrollPublishAutomationResult = {\n managedAddress: string\n sessionKeyAddress: string\n authorization: AttestPublishAuthorizationResult\n}\n\nexport type RevokePublishAutomationParams = {\n managedAddress: string\n sessionKeyAddress: string\n authorizationUid: string\n userWallet?: PublishWallet\n}\n\nasync function connectManagedAccount(managedAddress: string): Promise<Account> {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const account = managedWallet.getAccount()\n if (!account) {\n throw new ManagedAccountPublishError(\n 'Could not connect the managed publishing account to enroll or revoke publish automation.',\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n return account\n}\n\nasync function resolveUserWallet(\n managedAddress: string,\n userWallet?: PublishWallet,\n): Promise<PublishWallet> {\n if (userWallet) return userWallet\n return fromThirdwebAccount(await connectManagedAccount(managedAddress), { kind: 'smart' })\n}\n\nasync function assertExecutorModuleInstalled(managedAddress: string): Promise<void> {\n const config = getPublishConfig()\n const moduleAddr = config.modularAccountModuleContract?.trim()\n if (!moduleAddr) {\n throw new Error(\n '@seedprotocol/publish: enrollPublishAutomation requires PublishConfig.modularAccountModuleContract',\n )\n }\n\n const twAccount = await connectManagedAccount(managedAddress)\n let install: EnsureExecutorModuleResult\n try {\n install = await ensureExecutorModuleInstalled(managedAddress, twAccount, config)\n } catch (cause) {\n if (cause instanceof ManagedAccountPublishError) throw cause\n throw new ManagedAccountPublishError(\n 'Executor module setup failed for publish automation.',\n 'EXECUTOR_MODULE_NOT_INSTALLED',\n managedAddress,\n cause,\n )\n }\n\n // The session key may only call the module, so refuse to enroll unless the module can act\n // for this account. Otherwise every automation publish would revert. A fresh install is\n // confirmed from its receipt; otherwise the read may still trail an install that just landed.\n await assertExecutorModuleReadyForAccount(\n managedAddress,\n install.status === 'installed'\n ? { installedEas: install.eas }\n : { readAttempts: install.status === 'already-installed' ? 5 : 1 },\n )\n}\n\n/**\n * Enroll an app automation key: install the Seed executor (`installSeedExecutor` on Router\n * accounts with the executor router extension), add an executor-only session key, then attest\n * the PublishAuthorization sidecar (ManagedAccount attester).\n *\n * @throws ManagedAccountPublishError `AUTOMATION_UNSUPPORTED_ACCOUNT` before adding the session\n * key when the executor cannot act for the account (e.g. Router accounts without the extension)\n */\nexport async function enrollPublishAutomation(\n params: EnrollPublishAutomationParams,\n): Promise<EnrollPublishAutomationResult> {\n const { managedAddress, sessionKeyAddress, appAddress, expiresAt } = params\n\n await assertExecutorModuleInstalled(managedAddress)\n await ensureAutomationSessionKey({\n managedAddress,\n sessionKeyAddress,\n expiresAt,\n })\n\n const userWallet = await resolveUserWallet(managedAddress, params.userWallet)\n const authorization = await attestPublishAuthorization({\n wallet: userWallet,\n identity: managedAddress,\n sessionKey: sessionKeyAddress,\n app: appAddress,\n expiresAt,\n })\n\n return {\n managedAddress,\n sessionKeyAddress,\n authorization,\n }\n}\n\n/**\n * Disconnect automation: remove session key, then revoke PublishAuthorization sidecar.\n */\nexport async function revokePublishAutomation(\n params: RevokePublishAutomationParams,\n): Promise<void> {\n const { managedAddress, sessionKeyAddress, authorizationUid } = params\n const userWallet = await resolveUserWallet(managedAddress, params.userWallet)\n\n await removeAutomationSessionKey({\n managedAddress,\n sessionKeyAddress,\n })\n\n await revokePublishAuthorization({\n wallet: userWallet,\n uid: authorizationUid,\n })\n}\n","import {\n assessPublishAuthorization,\n decodePublishAuthorizationData,\n getPublishAuthorizationFromEas,\n} from '@seedprotocol/eas'\nimport { isAutomationSessionActive } from './ensureAutomationSessionKey'\n\nexport type AssertStorageBoundToIdentityParams = {\n managedAddress: string\n /** Recovered ANS-104 DataItem owner (Ethereum address). */\n dataItemOwner: string\n /**\n * Unix seconds for historical binding checks against PublishAuthorization expiry.\n * Defaults to now. Session-key live check always uses current `isActiveSigner`.\n */\n atTime?: number\n /**\n * When true (default), accept a live active session key on the ManagedAccount.\n */\n allowActiveSessionKey?: boolean\n /**\n * When true (default), accept a non-revoked PublishAuthorization sidecar valid at `atTime`.\n */\n allowSidecar?: boolean\n}\n\nexport type AssertStorageBoundToIdentityResult = {\n bound: boolean\n via: 'active_session_key' | 'publish_authorization' | null\n warnings: string[]\n}\n\n/**\n * Whether an Arweave DataItem owner is bound to a ManagedAccount identity for authorship.\n * Prefer live `isActiveSigner` for current publishes; use the PublishAuthorization sidecar\n * for discoverability / historical grants (revoking the session key stops new binds via\n * active check; sidecar validity is assessed at `atTime`).\n */\nexport async function assertStorageBoundToIdentity(\n params: AssertStorageBoundToIdentityParams,\n): Promise<AssertStorageBoundToIdentityResult> {\n const {\n managedAddress,\n dataItemOwner,\n atTime,\n allowActiveSessionKey = true,\n allowSidecar = true,\n } = params\n const warnings: string[] = []\n const owner = dataItemOwner.trim().toLowerCase()\n const identity = managedAddress.trim().toLowerCase()\n\n if (!/^0x[0-9a-fA-F]{40}$/.test(owner) || !/^0x[0-9a-fA-F]{40}$/.test(identity)) {\n return { bound: false, via: null, warnings: ['Invalid managedAddress or dataItemOwner'] }\n }\n\n if (allowActiveSessionKey) {\n try {\n const active = await isAutomationSessionActive(managedAddress, dataItemOwner)\n if (active) {\n return { bound: true, via: 'active_session_key', warnings }\n }\n } catch (e) {\n warnings.push(\n e instanceof Error ? e.message : 'isActiveSigner check failed',\n )\n }\n }\n\n if (allowSidecar) {\n try {\n const rows = await getPublishAuthorizationFromEas({\n identities: [managedAddress],\n sessionKeys: [dataItemOwner],\n excludeRevoked: true,\n })\n const nowMs = atTime != null ? atTime * 1000 : Date.now()\n for (const row of rows) {\n try {\n const decoded = decodePublishAuthorizationData(row.decodedDataJson ?? '[]')\n if (decoded.identity.toLowerCase() !== identity) continue\n if (decoded.sessionKey.toLowerCase() !== owner) continue\n const expirationTime =\n typeof row.expirationTime === 'number' ? row.expirationTime : null\n const assess = assessPublishAuthorization({\n decoded,\n expirationTime,\n now: nowMs,\n })\n if (assess.status === 'valid') {\n return {\n bound: true,\n via: 'publish_authorization',\n warnings: [...warnings, ...assess.warnings],\n }\n }\n warnings.push(...assess.warnings)\n } catch {\n // skip undecodable row\n }\n }\n } catch (e) {\n warnings.push(\n e instanceof Error ? e.message : 'PublishAuthorization query failed',\n )\n }\n }\n\n return { bound: false, via: null, warnings }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+BA,IAAM8D,IAAgC;AAEtC,SAASC,GAAyB,GAAc;CAG9C,AADA,QAAQ,KAAK,0DAA0DC,CAAG,GAC1EpC,EAAiB,CAAC,CAAC,uBAAuBoC,CAAG;AAC/C;AAGA,SAASC,KAA0C;CAEjD,OADIjE,EAAW,cAAc,IAAU,QAAQ,QAAQ,IAChD,IAAI,SAAS,MAAY;EAC9B,EAAW,cAAcmE,EAAQ,CAAC;CACpC,CAAC;AACH;AAOA,eAAeC,GACb,GACA,GACA,GACe;CACf,IAAKC,EAAO,8BAIZ;MAAIA,EAAO,oBAAoB;GAC7B,IAAI,CAACC,GACH;GAEF,IAAI;IACF,EAA0B;IAC1B,IAAMC,IAAKjD,EAAwB;IACnC,MAAMiD,EAAG,YAAY;KAAE,QAAQtC,EAAU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ChD,YAAY,CAACxF,CAAc;GAC3B,aAAa,CAACmF,CAAa;GAC3B,gBAAgB;EAClB,CAAC,GACKM,IAAQC,KAAU,OAAuB,KAAK,IAAI,IAAzBA,IAAS;EACxC,KAAK,IAAMC,KAAOJ,GAChB,IAAI;GACF,IAAMK,IAAUC,GAA+BF,EAAI,mBAAmB,IAAI;GAE1E,IADIC,EAAQ,SAAS,YAAY,MAAMR,KACnCQ,EAAQ,WAAW,YAAY,MAAMV,GAAO;GAChD,IAAMY,IACJ,OAAOH,EAAI,kBAAmB,WAAWA,EAAI,iBAAiB,MAC1DI,IAASC,GAA2B;IACxC;IACA;IACA,KAAKP;GACP,CAAC;GACD,IAAIM,EAAO,WAAW,SACpB,OAAO;IACL,OAAO;IACP,KAAK;IACL,UAAU,CAAC,GAAGd,GAAU,GAAGc,EAAO,QAAQ;GAC5C;GAEF,EAAS,KAAK,GAAGA,EAAO,QAAQ;EAClC,QAAQ,CAER;CAEJ,SAAS,GAAG;EACV,EAAS,KACP,aAAa,QAAQ,EAAE,UAAU,mCACnC;CACF;CAGF,OAAO;EAAE,OAAO;EAAO,KAAK;EAAM;CAAS;AAC7C"}
|
|
1
|
+
{"version":3,"file":"thirdweb.js","names":["seedClient","ConnectButtonThirdweb","pollSmartWalletDeployed","useLocalWalletAccount","ensureManagedAccountReady","getConnectedAccount","isContractDeployed","getSharedPublishInAppWalletStorage","Eip7702ModularAccountPublishError","getConnectedModularAccount","ExternalWalletsForDeploy","isSmartWalletDeployed","getSmartWalletAddressForAdmin","ManagedAccountPublishError","appMetadata","readIsActiveSigner","tryDeployManagedAccount","ensureExecutorModuleInstalled","assertExecutorModuleReadyForAccount","useActiveSmartWalletContract","deployManagedAccountViaFactory","getManagedAccountWallet","waitForPublishReceipt","getConnectedManagedAccountAddress","pollSmartWalletDeployed$1","getModularAccountWallet","resolveSmartWalletForPublish","pollSmartWalletDeployed","syncPublishInAppAuthToken","initPublish","wallets","getPublishThirdwebChain","fromThirdwebAccount","getPublishConfig","runModularExecutorPublishPrep","asThirdwebPublishWallet","seedPaymaster","PublishManager","asSeedSignerFromThirdweb","getWalletsForConnectButton","getConfigRef","getClient","getPublishChainName","CALL_GAS_HEADROOM_BPS","deploySmartWalletContract","setPublishWallet","clearPublishWallet","attestPublishAuthorization","buildAutomationSessionKeyPermissions","hashAutomationSessionKeyPermissions","usePublishConfig","PublishConfigContext","revokePublishAuthorization","approvedTargetsForAutomationPublish","toThirdwebSessionKeyPermissions","PUBLISH_AUTOMATION_SCOPES","ensureSmartWalletThenPublish","ensureModularPublishBootstrap","removeAutomationSessionKey","isAutomationSessionActive","ensureAutomationSessionKey","ConnectButton$1","USER_DISCONNECTED_SESSION_KEY","reportWalletSetupWarning","err","waitUntilSeedInitialized","client","resolve","ensureExecutorModulesForConnect","config","managedAddress","mw","ma","modularAccount","ConnectButton","thirdwebChain","wallet","useActiveWallet","activeAccount","useActiveAccount","connectionStatus","useActiveWalletConnectionStatus","isAutoConnecting","useIsAutoConnecting","lastSyncedOwnedKey","useRef","prevIsAutoConnecting","reloadAutoConnectRetried","prev","navType","userChoseDisconnect","syncActiveWalletToSeed","useCallback","account","activeWallet","owned","adminAddress","tryManaged","r","ownedKey","isSmart","publishWallet","adminAccount","dataItemSigner","useEffect","cancelled","darkTheme","PublishProviderThirdweb","initializedConfig","ThirdwebProvider","SeedProvider","MSG_NO_ACCOUNT","MSG_NOT_UPGRADED","MSG_DEPLOY_FAILED","MSG_NOT_CONFIRMED","DEPLOY_POLL_ATTEMPTS","ensureEip7702ModularAccountReady","modularAccountWallet","accountContract","getContract","autoDeployEip7702ModularAccount","deploySmartAccount","cause","defaultApprovedTargetsForModularPublish","MSG_UNAVAILABLE","MSG_ACTIVATION_FAILED","ensureManagedSignerSessionKey","params","managedWallet","managedAccount","permissions","shouldUpdate","shouldUpdateSessionKey","signerAddress","tx","addSessionKey","result","sendTransaction","active","connectManagedAccount","resolveUserWallet","userWallet","assertExecutorModuleInstalled","twAccount","install","enrollPublishAutomation","sessionKeyAddress","appAddress","revokePublishAutomation","authorizationUid","assertStorageBoundToIdentity","warnings","owner","dataItemOwner","identity","allowActiveSessionKey","allowSidecar","rows","getPublishAuthorizationFromEas","nowMs","atTime","row","decoded","decodePublishAuthorizationData","expirationTime","assess","assessPublishAuthorization"],"sources":["../src/react/ConnectButton.tsx","../src/react/PublishProvider.thirdweb.tsx","../src/helpers/ensureEip7702ModularAccountReady.ts","../src/helpers/defaultApprovedTargetsForModularPublish.ts","../src/helpers/ensureManagedSignerSessionKey.ts","../src/helpers/enrollPublishAutomation.ts","../src/helpers/assertStorageBoundToIdentity.ts"],"sourcesContent":["import React, { FC, useCallback, useEffect, useRef } from \"react\"\nimport {\n ConnectButton as ConnectButtonThirdweb,\n darkTheme,\n useActiveAccount,\n useActiveWallet,\n useActiveWalletConnectionStatus,\n useIsAutoConnecting,\n} from \"thirdweb/react\"\nimport { client as seedClient } from \"@seedprotocol/sdk\"\nimport {\n deploySmartWalletContract,\n getClient,\n getConnectedManagedAccountAddress,\n getManagedAccountWallet,\n getModularAccountWallet,\n getSmartWalletAddressForAdmin,\n getWalletsForConnectButton,\n syncPublishInAppAuthToken,\n} from \"../helpers/thirdweb\"\nimport { fromThirdwebAccount } from \"../helpers/adapters/thirdwebAccount\"\nimport { setPublishWallet, clearPublishWallet } from \"../helpers/publishWalletRegistry\"\nimport { usePublishConfig } from \"./PublishConfigContext\"\nimport { getPublishConfig } from \"../config\"\nimport type { Account, Wallet } from \"thirdweb/wallets\"\nimport type { PublishConfig } from \"../config\"\nimport { ensureExecutorModuleInstalled } from \"../helpers/ensureExecutorModule\"\nimport { PublishManager } from \"../services/publishManager\"\nimport { getPublishThirdwebChain } from '../helpers/thirdwebChain'\n\n/** Session flag so we do not force autoConnect after an explicit UI disconnect (survives reload). */\nconst USER_DISCONNECTED_SESSION_KEY = \"seedProtocol:publish:userChoseWalletDisconnect\"\n\nfunction reportWalletSetupWarning(err: unknown) {\n // Expected when managed-wallet autoConnect is still catching up; publish prep retries.\n console.warn(\"[ConnectButton] Wallet setup / module install skipped:\", err)\n getPublishConfig().onWalletSetupWarning?.(err)\n}\n\n/** Resolves after `ClientManager.init()` has finished; `setAddresses` requires this. */\nfunction waitUntilSeedInitialized(): Promise<void> {\n if (seedClient.isInitialized()) return Promise.resolve()\n return new Promise((resolve) => {\n seedClient.onReady(() => resolve())\n })\n}\n\n/**\n * Installs the Seed executor on the **ManagedAccount** (EIP-4337 Router) contract via its\n * `SeedExecutorRouterExtension`. Other accounts, such as the EIP-7702 modular wallet, have no\n * extension, so `ensureExecutorModuleInstalled` skips them.\n */\nasync function ensureExecutorModulesForConnect(\n modularAccount: Account,\n managedAddress: string | undefined,\n config: PublishConfig,\n): Promise<void> {\n if (!config.modularAccountModuleContract) {\n return\n }\n\n if (config.useModularExecutor) {\n if (!managedAddress) {\n return\n }\n try {\n syncPublishInAppAuthToken()\n const mw = getManagedAccountWallet()\n await mw.autoConnect({ client: getClient(), chain: getPublishThirdwebChain(config) })\n const ma = mw.getAccount()\n if (!ma) {\n return\n }\n await ensureExecutorModuleInstalled(managedAddress, ma, config)\n } catch {\n /* managed wallet session may lag modular connect; publish prep retries module install */\n }\n return\n }\n\n try {\n await ensureExecutorModuleInstalled(modularAccount.address, modularAccount, config)\n } catch (err) {\n reportWalletSetupWarning(err)\n }\n}\n\nconst ConnectButton: FC = () => {\n const config = usePublishConfig()\n const thirdwebChain = getPublishThirdwebChain(config)\n const wallet = useActiveWallet()\n const activeAccount = useActiveAccount()\n const connectionStatus = useActiveWalletConnectionStatus()\n const isAutoConnecting = useIsAutoConnecting()\n /** Avoid duplicate setAddresses when onConnect and the reconcile effect both run. */\n const lastSyncedOwnedKey = useRef<string | null>(null)\n const prevIsAutoConnecting = useRef(false)\n const reloadAutoConnectRetried = useRef(false)\n\n /**\n * Thirdweb sometimes finishes autoConnect on full reload with `disconnected` and no wallet\n * (see debug: isAutoConnecting true→false then disconnected). One explicit in-app autoConnect\n * retry recovers without affecting users who chose Disconnect (sessionStorage gate).\n */\n useEffect(() => {\n if (typeof window === \"undefined\") return\n const prev = prevIsAutoConnecting.current\n prevIsAutoConnecting.current = isAutoConnecting\n\n let navType: string | undefined\n try {\n navType = (\n performance.getEntriesByType(\"navigation\")[0] as\n | PerformanceNavigationTiming\n | undefined\n )?.type\n } catch {\n navType = undefined\n }\n if (navType !== \"reload\") return\n\n let userChoseDisconnect = false\n try {\n userChoseDisconnect =\n sessionStorage.getItem(USER_DISCONNECTED_SESSION_KEY) === \"1\"\n } catch {\n userChoseDisconnect = false\n }\n if (userChoseDisconnect) return\n\n if (!prev || isAutoConnecting || connectionStatus !== \"disconnected\") return\n if (reloadAutoConnectRetried.current) return\n reloadAutoConnectRetried.current = true\n\n void (config.useModularExecutor ? getModularAccountWallet() : getManagedAccountWallet())\n .autoConnect({ client: getClient(), chain: thirdwebChain })\n .catch(() => {\n /* no session or iframe not ready; Connect UI can still sign in */\n })\n }, [connectionStatus, isAutoConnecting, config.useModularExecutor, thirdwebChain])\n\n const syncActiveWalletToSeed = useCallback(\n async (activeWallet: Wallet) => {\n const account = activeWallet.getAccount()\n if (!account) {\n return\n }\n await waitUntilSeedInitialized()\n const owned = new Set<string>([account.address.toLowerCase()])\n let managedAddress: string | undefined\n if (config.useModularExecutor) {\n syncPublishInAppAuthToken()\n const adminAddress =\n activeWallet.getAdminAccount?.()?.address ?? account.address\n const tryManaged = async () => {\n try {\n return await getConnectedManagedAccountAddress(thirdwebChain)\n } catch {\n try {\n return await getSmartWalletAddressForAdmin(adminAddress)\n } catch {\n return undefined\n }\n }\n }\n managedAddress = await tryManaged()\n if (!managedAddress) {\n await new Promise<void>((r) => queueMicrotask(() => r()))\n managedAddress = await tryManaged()\n }\n if (managedAddress) {\n owned.add(managedAddress.toLowerCase())\n }\n }\n const ownedKey = [...owned].sort().join(\",\")\n if (lastSyncedOwnedKey.current === ownedKey) {\n return\n }\n // Another wallet took over: publishes started for the previous one stop (their rows stay\n // for it to resume). Not on the first sync, where publishes restored from the DB need this\n // wallet, nor on a re-sync of the same wallet.\n if (lastSyncedOwnedKey.current !== null) {\n PublishManager.stopAll()\n }\n lastSyncedOwnedKey.current = ownedKey\n try {\n const adminAddress = activeWallet.getAdminAccount?.()?.address\n // A wallet with a separate admin account, or the modular executor's ManagedAccount, is a\n // smart account; otherwise the connected account is a plain key (in-app or injected).\n const isSmart =\n !!managedAddress ||\n (!!adminAddress && adminAddress.toLowerCase() !== account.address.toLowerCase())\n const publishWallet = fromThirdwebAccount(account, { kind: isSmart ? \"smart\" : \"eoa\" })\n // Data items need an ECDSA signer. With the modular executor the connected account is an\n // EOA (or EIP-7702 on one) acting for the ManagedAccount; otherwise a smart wallet's admin\n // EOA signs them.\n const adminAccount = activeWallet.getAdminAccount?.()\n const dataItemSigner = managedAddress\n ? publishWallet.signer\n : isSmart && adminAccount && adminAccount.address.toLowerCase() !== account.address.toLowerCase()\n ? fromThirdwebAccount(adminAccount, { kind: \"eoa\" }).signer\n : undefined\n await setPublishWallet({\n ...publishWallet,\n ownedAddresses: [...owned],\n publisherAddress: managedAddress ?? account.address,\n ...(dataItemSigner ? { dataItemSigner } : {}),\n // A new user's smart wallet has no code until its first transaction: publish deploys it.\n ...(isSmart && !managedAddress\n ? { deploy: async () => { await deploySmartWalletContract(account) } }\n : {}),\n ...(adminAddress && adminAddress.toLowerCase() !== account.address.toLowerCase()\n ? { adminAddress }\n : {}),\n })\n } catch (err) {\n lastSyncedOwnedKey.current = null\n console.warn(\"[ConnectButton] Failed to set seed client addresses:\", err)\n throw err\n }\n await ensureExecutorModulesForConnect(account, managedAddress, config)\n },\n [config],\n )\n\n /**\n * Thirdweb autoConnect restores the wallet without calling onConnect. Seed addresses live in\n * SQLite (OPFS); after a wipe there is no app_state row until setAddresses runs again.\n */\n useEffect(() => {\n if (isAutoConnecting) {\n return\n }\n if (connectionStatus !== \"connected\") {\n lastSyncedOwnedKey.current = null\n return\n }\n if (!wallet) {\n return\n }\n let cancelled = false\n void (async () => {\n try {\n if (cancelled) return\n await syncActiveWalletToSeed(wallet)\n } catch {\n /* logged in syncActiveWalletToSeed */\n }\n })()\n return () => {\n cancelled = true\n }\n }, [\n wallet,\n activeAccount?.address,\n connectionStatus,\n isAutoConnecting,\n syncActiveWalletToSeed,\n ])\n\n const handleDisconnect = () => {\n try {\n sessionStorage.setItem(USER_DISCONNECTED_SESSION_KEY, \"1\")\n } catch {\n /* private mode / SSR */\n }\n void clearPublishWallet()\n PublishManager.stopAll()\n }\n\n const handleConnect = async (activeWallet: Wallet, _allConnectedWallets: Wallet[]) => {\n const account = activeWallet.getAccount()\n if (!account) return\n try {\n sessionStorage.removeItem(USER_DISCONNECTED_SESSION_KEY)\n } catch {\n /* ignore */\n }\n console.log('[ConnectButton] Connected', account.address)\n try {\n await syncActiveWalletToSeed(activeWallet)\n } catch {\n /* syncActiveWalletToSeed logs */\n }\n }\n\n return (\n <ConnectButtonThirdweb\n client={getClient()}\n wallets={getWalletsForConnectButton(config)}\n autoConnect={true}\n chain={thirdwebChain}\n chains={[ thirdwebChain, ]}\n onConnect={handleConnect}\n onDisconnect={handleDisconnect}\n theme={darkTheme({\n colors: {\n primaryButtonBg: '#1D2939',\n primaryButtonText: '#FFFFFF',\n secondaryButtonHoverBg: '#1D2939',\n connectedButtonBg: '#101828',\n connectedButtonBgHover: '#1D2939',\n borderColor: '#344054',\n },\n })}\n />\n )\n}\n\nexport default ConnectButton\n","import React, { FC, useRef } from \"react\"\nimport { ThirdwebProvider } from \"thirdweb/react\"\nimport { SeedProvider } from '@seedprotocol/react'\nimport { initPublish, getConfigRef, type PublishConfig } from \"../config\"\nimport { PublishConfigContext, usePublishConfig } from \"./PublishConfigContext\"\nimport type { PublishProviderProps } from \"./PublishProvider\"\n\nexport { usePublishConfig }\n\n/**\n * Thirdweb-backed PublishProvider (includes ThirdwebProvider).\n */\nconst PublishProviderThirdweb: FC<PublishProviderProps> = ({\n children,\n config,\n queryClient,\n queryClientRef,\n}) => {\n // During render, not in an effect: children such as ConnectButton read the config on their\n // first render, which runs before this provider's effects. Once per config object.\n const initializedConfig = useRef<PublishConfig | undefined>(undefined)\n if (config && initializedConfig.current !== config) {\n initPublish(config)\n initializedConfig.current = config\n }\n\n return (\n <PublishConfigContext.Provider value={config ?? getConfigRef()}>\n <ThirdwebProvider>\n <SeedProvider queryClient={queryClient} queryClientRef={queryClientRef}>\n {children}\n </SeedProvider>\n </ThirdwebProvider>\n </PublishConfigContext.Provider>\n )\n}\n\nexport default PublishProviderThirdweb\n","import { deploySmartAccount, getContract } from 'thirdweb'\nimport { getPublishConfig } from '../config'\nimport { Eip7702ModularAccountPublishError } from '../errors'\nimport { isContractDeployed, pollSmartWalletDeployed } from './chainClient'\nimport { getClient, getModularAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_NO_ACCOUNT =\n 'Modular (EIP-7702) wallet is not connected. Sign in with the same method and try again.'\nconst MSG_NOT_UPGRADED = () =>\n `Your modular account is not upgraded to an EIP-7702 smart account on ${getPublishChainName()} yet. Enable autoDeployEip7702ModularAccount in publish config or complete wallet setup, then retry.`\nconst MSG_DEPLOY_FAILED = () =>\n `Automatic EIP-7702 smart account setup failed on ${getPublishChainName()}. Retry or reconnect your wallet.`\nconst MSG_NOT_CONFIRMED =\n 'EIP-7702 upgrade was sent but on-chain bytecode was not detected yet. Wait a moment and retry.'\n\nconst DEPLOY_POLL_ATTEMPTS = 5\n\n/**\n * Ensures the Thirdweb in-app modular wallet (EIP-7702) has non-empty bytecode at its address\n * on the publish chain. deploySmartAccount remains Thirdweb; bytecode checks use viem.\n */\nexport async function ensureEip7702ModularAccountReady(): Promise<void> {\n const { autoDeployEip7702ModularAccount } = getPublishConfig()\n const modularAccountWallet = getModularAccountWallet()\n await modularAccountWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const modularAccount = modularAccountWallet.getAccount()\n if (!modularAccount) {\n throw new Eip7702ModularAccountPublishError(MSG_NO_ACCOUNT, 'EIP7702_MODULAR_ACCOUNT_UNAVAILABLE')\n }\n\n const client = getClient()\n const accountContract = getContract({\n client,\n chain: getPublishThirdwebChain(),\n address: modularAccount.address,\n })\n\n if (await isContractDeployed(modularAccount.address)) {\n return\n }\n\n if (!autoDeployEip7702ModularAccount) {\n throw new Eip7702ModularAccountPublishError(\n MSG_NOT_UPGRADED(),\n 'EIP7702_MODULAR_NOT_UPGRADED',\n modularAccount.address,\n )\n }\n\n try {\n await deploySmartAccount({\n smartAccount: modularAccount,\n chain: getPublishThirdwebChain(),\n client,\n accountContract,\n })\n } catch (cause) {\n if (await pollSmartWalletDeployed(modularAccount.address, DEPLOY_POLL_ATTEMPTS)) {\n return\n }\n throw new Eip7702ModularAccountPublishError(\n MSG_DEPLOY_FAILED(),\n 'EIP7702_MODULAR_DEPLOY_FAILED',\n modularAccount.address,\n cause,\n )\n }\n\n if (!(await pollSmartWalletDeployed(modularAccount.address, DEPLOY_POLL_ATTEMPTS))) {\n throw new Eip7702ModularAccountPublishError(\n MSG_NOT_CONFIRMED,\n 'EIP7702_MODULAR_NOT_CONFIRMED',\n modularAccount.address,\n )\n }\n}\n","import { approvedTargetsForAutomationPublish } from './approvedTargetsForAutomationPublish'\n\n/**\n * Allowlisted call targets for a modular session signer: only the Seed executor module.\n *\n * Never the ManagedAccount (a key could then make any self-call, which the account trusts) and\n * never EAS (a direct EAS target bypasses the Seed extension's forced revocability).\n *\n * @deprecated Interactive publishing is a UserOp from the ManagedAccount itself and needs no\n * session key; automation keys use {@link approvedTargetsForAutomationPublish}, which this now\n * returns. `managedAddress` is ignored.\n * @throws if `modularAccountModuleContract` is unset or invalid\n */\nexport function defaultApprovedTargetsForModularPublish(_managedAddress?: string): `0x${string}`[] {\n return approvedTargetsForAutomationPublish()\n}\n","import { getContract, sendTransaction } from 'thirdweb'\nimport { addSessionKey, shouldUpdateSessionKey } from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport { defaultApprovedTargetsForModularPublish } from './defaultApprovedTargetsForModularPublish'\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 the modular signer on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the modular wallet as a session signer on your publishing account on ${getPublishChainName()}.`\n\n/**\n * Ensures the modular (EIP-7702) wallet is an active session signer on the ManagedAccount.\n * If permissions are missing or stale, sends `addSessionKey` signed by the managed EIP-4337 wallet.\n * Session-key AA extensions remain on Thirdweb; verification uses viem.\n *\n * The key may call only the Seed executor module ({@link defaultApprovedTargetsForModularPublish}).\n *\n * @deprecated Interactive publishing is a UserOp from the ManagedAccount itself and needs no\n * session key. For server-held keys use `enrollPublishAutomation`.\n */\nexport async function ensureManagedSignerSessionKey(params: {\n managedAddress: string\n signerAddress: string\n}): Promise<void> {\n const { managedAddress, signerAddress } = params\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\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = {\n approvedTargets: defaultApprovedTargetsForModularPublish(managedAddress),\n nativeTokenLimitPerTransaction: 0,\n }\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress: signerAddress,\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: signerAddress,\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 let active = false\n try {\n active = await readIsActiveSigner(managedAddress as Address, signerAddress as Address)\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 (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n","import type { Account } from 'thirdweb/wallets'\nimport type { PublishWallet } from './seedSigner'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { getPublishConfig } from '../config'\nimport { ManagedAccountPublishError } from '../errors'\nimport { ensureExecutorModuleInstalled, type EnsureExecutorModuleResult } from './ensureExecutorModule'\nimport { assertExecutorModuleReadyForAccount } from './executorModuleReadiness'\nimport {\n ensureAutomationSessionKey,\n removeAutomationSessionKey,\n} from './ensureAutomationSessionKey'\nimport {\n attestPublishAuthorization,\n revokePublishAuthorization,\n type AttestPublishAuthorizationResult,\n} from '../services/publishAuthorization'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\nexport type EnrollPublishAutomationParams = {\n managedAddress: string\n sessionKeyAddress: string\n /** Optional app label stored in the sidecar (defaults to zero address). */\n appAddress?: string\n /** Unix seconds session / grant end (optional). */\n expiresAt?: number\n /**\n * User-controlled ManagedAccount wallet used to add the session key and attest the sidecar.\n * When omitted, uses the connected managed in-app wallet.\n */\n userWallet?: PublishWallet\n}\n\nexport type EnrollPublishAutomationResult = {\n managedAddress: string\n sessionKeyAddress: string\n authorization: AttestPublishAuthorizationResult\n}\n\nexport type RevokePublishAutomationParams = {\n managedAddress: string\n sessionKeyAddress: string\n authorizationUid: string\n userWallet?: PublishWallet\n}\n\nasync function connectManagedAccount(managedAddress: string): Promise<Account> {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const account = managedWallet.getAccount()\n if (!account) {\n throw new ManagedAccountPublishError(\n 'Could not connect the managed publishing account to enroll or revoke publish automation.',\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n return account\n}\n\nasync function resolveUserWallet(\n managedAddress: string,\n userWallet?: PublishWallet,\n): Promise<PublishWallet> {\n if (userWallet) return userWallet\n return fromThirdwebAccount(await connectManagedAccount(managedAddress), { kind: 'smart' })\n}\n\nasync function assertExecutorModuleInstalled(managedAddress: string): Promise<void> {\n const config = getPublishConfig()\n const moduleAddr = config.modularAccountModuleContract?.trim()\n if (!moduleAddr) {\n throw new Error(\n '@seedprotocol/publish: enrollPublishAutomation requires PublishConfig.modularAccountModuleContract',\n )\n }\n\n const twAccount = await connectManagedAccount(managedAddress)\n let install: EnsureExecutorModuleResult\n try {\n install = await ensureExecutorModuleInstalled(managedAddress, twAccount, config)\n } catch (cause) {\n if (cause instanceof ManagedAccountPublishError) throw cause\n throw new ManagedAccountPublishError(\n 'Executor module setup failed for publish automation.',\n 'EXECUTOR_MODULE_NOT_INSTALLED',\n managedAddress,\n cause,\n )\n }\n\n // The session key may only call the module, so refuse to enroll unless the module can act\n // for this account. Otherwise every automation publish would revert. A fresh install is\n // confirmed from its receipt; otherwise the read may still trail an install that just landed.\n await assertExecutorModuleReadyForAccount(\n managedAddress,\n install.status === 'installed'\n ? { installedEas: install.eas }\n : { readAttempts: install.status === 'already-installed' ? 5 : 1 },\n )\n}\n\n/**\n * Enroll an app automation key: install the Seed executor (`installSeedExecutor` on Router\n * accounts with the executor router extension), add an executor-only session key, then attest\n * the PublishAuthorization sidecar (ManagedAccount attester).\n *\n * @throws ManagedAccountPublishError `AUTOMATION_UNSUPPORTED_ACCOUNT` before adding the session\n * key when the executor cannot act for the account (e.g. Router accounts without the extension)\n */\nexport async function enrollPublishAutomation(\n params: EnrollPublishAutomationParams,\n): Promise<EnrollPublishAutomationResult> {\n const { managedAddress, sessionKeyAddress, appAddress, expiresAt } = params\n\n await assertExecutorModuleInstalled(managedAddress)\n await ensureAutomationSessionKey({\n managedAddress,\n sessionKeyAddress,\n expiresAt,\n })\n\n const userWallet = await resolveUserWallet(managedAddress, params.userWallet)\n const authorization = await attestPublishAuthorization({\n wallet: userWallet,\n identity: managedAddress,\n sessionKey: sessionKeyAddress,\n app: appAddress,\n expiresAt,\n })\n\n return {\n managedAddress,\n sessionKeyAddress,\n authorization,\n }\n}\n\n/**\n * Disconnect automation: remove session key, then revoke PublishAuthorization sidecar.\n */\nexport async function revokePublishAutomation(\n params: RevokePublishAutomationParams,\n): Promise<void> {\n const { managedAddress, sessionKeyAddress, authorizationUid } = params\n const userWallet = await resolveUserWallet(managedAddress, params.userWallet)\n\n await removeAutomationSessionKey({\n managedAddress,\n sessionKeyAddress,\n })\n\n await revokePublishAuthorization({\n wallet: userWallet,\n uid: authorizationUid,\n })\n}\n","import {\n assessPublishAuthorization,\n decodePublishAuthorizationData,\n getPublishAuthorizationFromEas,\n} from '@seedprotocol/eas'\nimport { isAutomationSessionActive } from './ensureAutomationSessionKey'\n\nexport type AssertStorageBoundToIdentityParams = {\n managedAddress: string\n /** Recovered ANS-104 DataItem owner (Ethereum address). */\n dataItemOwner: string\n /**\n * Unix seconds for historical binding checks against PublishAuthorization expiry.\n * Defaults to now. Session-key live check always uses current `isActiveSigner`.\n */\n atTime?: number\n /**\n * When true (default), accept a live active session key on the ManagedAccount.\n */\n allowActiveSessionKey?: boolean\n /**\n * When true (default), accept a non-revoked PublishAuthorization sidecar valid at `atTime`.\n */\n allowSidecar?: boolean\n}\n\nexport type AssertStorageBoundToIdentityResult = {\n bound: boolean\n via: 'active_session_key' | 'publish_authorization' | null\n warnings: string[]\n}\n\n/**\n * Whether an Arweave DataItem owner is bound to a ManagedAccount identity for authorship.\n * Prefer live `isActiveSigner` for current publishes; use the PublishAuthorization sidecar\n * for discoverability / historical grants (revoking the session key stops new binds via\n * active check; sidecar validity is assessed at `atTime`).\n */\nexport async function assertStorageBoundToIdentity(\n params: AssertStorageBoundToIdentityParams,\n): Promise<AssertStorageBoundToIdentityResult> {\n const {\n managedAddress,\n dataItemOwner,\n atTime,\n allowActiveSessionKey = true,\n allowSidecar = true,\n } = params\n const warnings: string[] = []\n const owner = dataItemOwner.trim().toLowerCase()\n const identity = managedAddress.trim().toLowerCase()\n\n if (!/^0x[0-9a-fA-F]{40}$/.test(owner) || !/^0x[0-9a-fA-F]{40}$/.test(identity)) {\n return { bound: false, via: null, warnings: ['Invalid managedAddress or dataItemOwner'] }\n }\n\n if (allowActiveSessionKey) {\n try {\n const active = await isAutomationSessionActive(managedAddress, dataItemOwner)\n if (active) {\n return { bound: true, via: 'active_session_key', warnings }\n }\n } catch (e) {\n warnings.push(\n e instanceof Error ? e.message : 'isActiveSigner check failed',\n )\n }\n }\n\n if (allowSidecar) {\n try {\n const rows = await getPublishAuthorizationFromEas({\n identities: [managedAddress],\n sessionKeys: [dataItemOwner],\n excludeRevoked: true,\n })\n const nowMs = atTime != null ? atTime * 1000 : Date.now()\n for (const row of rows) {\n try {\n const decoded = decodePublishAuthorizationData(row.decodedDataJson ?? '[]')\n if (decoded.identity.toLowerCase() !== identity) continue\n if (decoded.sessionKey.toLowerCase() !== owner) continue\n const expirationTime =\n typeof row.expirationTime === 'number' ? row.expirationTime : null\n const assess = assessPublishAuthorization({\n decoded,\n expirationTime,\n now: nowMs,\n })\n if (assess.status === 'valid') {\n return {\n bound: true,\n via: 'publish_authorization',\n warnings: [...warnings, ...assess.warnings],\n }\n }\n warnings.push(...assess.warnings)\n } catch {\n // skip undecodable row\n }\n }\n } catch (e) {\n warnings.push(\n e instanceof Error ? e.message : 'PublishAuthorization query failed',\n )\n }\n }\n\n return { bound: false, via: null, warnings }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+BA,IAAM8D,IAAgC;AAEtC,SAASC,GAAyB,GAAc;CAG9C,AADA,QAAQ,KAAK,0DAA0DC,CAAG,GAC1E/B,EAAiB,CAAC,CAAC,uBAAuB+B,CAAG;AAC/C;AAGA,SAASC,KAA0C;CAEjD,OADIjE,EAAW,cAAc,IAAU,QAAQ,QAAQ,IAChD,IAAI,SAAS,MAAY;EAC9B,EAAW,cAAcmE,EAAQ,CAAC;CACpC,CAAC;AACH;AAOA,eAAeC,GACb,GACA,GACA,GACe;CACf,IAAKC,EAAO,8BAIZ;MAAIA,EAAO,oBAAoB;GAC7B,IAAI,CAACC,GACH;GAEF,IAAI;IACF,EAA0B;IAC1B,IAAMC,IAAKlD,EAAwB;IACnC,MAAMkD,EAAG,YAAY;KAAE,QAAQ9B,EAAU;KAAG,OAAOV,EAAwBsC,CAAM;IAAE,CAAC;IACpF,IAAMG,IAAKD,EAAG,WAAW;IACzB,IAAI,CAACC,GACH;IAEF,MAAMvD,EAA8BqD,GAAgBE,GAAIH,CAAM;GAChE,QAAQ,CAER;EAEF,OAEA,IAAI;GACF,MAAMpD,EAA8BwD,EAAe,SAASA,GAAgBJ,CAAM;EACpF,SAASL,GAAK;GACZ,GAAyBA,CAAG;EAC9B;CANA;AAOF;AAEA,IAAMU,WAA0B;CAC9B,IAAML,IAASnB,EAAiB,GAC1ByB,IAAgB5C,EAAwBsC,CAAM,GAC9CO,IAASC,GAAgB,GACzBC,IAAgBC,GAAiB,GACjCC,IAAmBC,GAAgC,GACnDC,IAAmBC,GAAoB,GAEvCC,IAAqBC,EAAsB,IAAI,GAC/CC,IAAuBD,EAAO,EAAK,GACnCE,IAA2BF,EAAO,EAAK;CAO7C,QAAgB;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EAAO,QAAQ;EAClC,QAAQ,CAER;CAEJ,SAAS,GAAG;EACV,EAAS,KACP,aAAa,QAAQ,EAAE,UAAU,mCACnC;CACF;CAGF,OAAO;EAAE,OAAO;EAAO,KAAK;EAAM;CAAS;AAC7C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as e, tn as t } from "./chainConfig-DK_5pgXF.js";
|
|
2
2
|
import { BaseDb as n, arweaveL1FinalizeJobs as r, getArweaveUploadStatus as i, isArweaveL1AnchoringComplete as a, queryArweaveGatewayTransactionWithFallback as o } from "@seedprotocol/sdk";
|
|
3
3
|
import s from "debug";
|
|
4
4
|
import { eq as c } from "drizzle-orm";
|
|
@@ -75,4 +75,4 @@ async function m() {
|
|
|
75
75
|
//#endregion
|
|
76
76
|
export { f as startArweaveL1FinalizeWorker, p as stopArweaveL1FinalizeWorker };
|
|
77
77
|
|
|
78
|
-
//# sourceMappingURL=worker-
|
|
78
|
+
//# sourceMappingURL=worker-C7XeFMWh.js.map
|