@seedprotocol/publish 0.6.8 → 0.6.9
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/README.md +0 -18
- package/dist/chainConfig-CA1Hrrjg.js +1387 -0
- package/dist/chainConfig-CA1Hrrjg.js.map +1 -0
- package/dist/chainConfig-CYy0XJ0M.js +1283 -0
- package/dist/chainConfig-CYy0XJ0M.js.map +1 -0
- package/dist/config.d.ts +0 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/ensureAutomationSessionKey-Bw74ZSGI.js +85 -0
- package/dist/ensureAutomationSessionKey-Bw74ZSGI.js.map +1 -0
- package/dist/ensureAutomationSessionKey-CeUbjcCl.js +85 -0
- package/dist/ensureAutomationSessionKey-CeUbjcCl.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-BhYNmLzT.js +24 -0
- package/dist/ensureModularPublishBootstrap-BhYNmLzT.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-Bsw1xSCt.js +24 -0
- package/dist/ensureModularPublishBootstrap-Bsw1xSCt.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-Bm58tc-b.js +48 -0
- package/dist/ensureSmartWalletThenPublish-Bm58tc-b.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-Dta2AOyJ.js +48 -0
- package/dist/ensureSmartWalletThenPublish-Dta2AOyJ.js.map +1 -0
- package/dist/helpers/abi/executor.d.ts +4 -7
- package/dist/helpers/abi/executor.d.ts.map +1 -1
- package/dist/helpers/abi/publisher.d.ts +7 -74
- package/dist/helpers/abi/publisher.d.ts.map +1 -1
- package/dist/helpers/contracts/index.d.ts +6 -18
- package/dist/helpers/contracts/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +352 -377
- package/dist/index.js.map +1 -1
- package/dist/managedAccountAdmin-DJMw6UH6.js +29 -0
- package/dist/managedAccountAdmin-DJMw6UH6.js.map +1 -0
- package/dist/managedAccountAdmin-NXD66lP5.js +29 -0
- package/dist/managedAccountAdmin-NXD66lP5.js.map +1 -0
- package/dist/publishAuthorization-BEqRnP2h.js +3925 -0
- package/dist/publishAuthorization-BEqRnP2h.js.map +1 -0
- package/dist/publishAuthorization-DjVrnMC0.js +3925 -0
- package/dist/publishAuthorization-DjVrnMC0.js.map +1 -0
- package/dist/publishThirdwebClient-CBD9sKJR.js +18 -0
- package/dist/publishThirdwebClient-CBD9sKJR.js.map +1 -0
- package/dist/publishThirdwebClient-Ce7iBIsj.js +18 -0
- package/dist/publishThirdwebClient-Ce7iBIsj.js.map +1 -0
- package/dist/resolveRevokeAccount-DJKfLlyK.js +38 -0
- package/dist/resolveRevokeAccount-DJKfLlyK.js.map +1 -0
- package/dist/resolveRevokeAccount-mzR11KJ4.js +38 -0
- package/dist/resolveRevokeAccount-mzR11KJ4.js.map +1 -0
- package/dist/thirdweb.js +56 -56
- package/dist/worker-CbtzcKG6.js +69 -0
- package/dist/worker-CbtzcKG6.js.map +1 -0
- package/dist/worker-DHUm-TeQ.js +69 -0
- package/dist/worker-DHUm-TeQ.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { o as t } from "./chainConfig-CA1Hrrjg.js";
|
|
3
|
+
import { createThirdwebClient as n } from "thirdweb";
|
|
4
|
+
//#region src/helpers/publishThirdwebClient.ts
|
|
5
|
+
var r = /* @__PURE__ */ e({ getClient: () => o }), i = null, a = null;
|
|
6
|
+
function o() {
|
|
7
|
+
let { thirdwebClientId: e, thirdwebSecretKey: r } = t();
|
|
8
|
+
if (!e && !r) throw Error("@seedprotocol/publish/thirdweb: thirdwebClientId or thirdwebSecretKey is required. Pass one in initPublish / PublishProvider config.");
|
|
9
|
+
let o = `${e ?? ""}\0${r ?? ""}`;
|
|
10
|
+
return (!i || a !== o) && (a = o, i = n(e ? {
|
|
11
|
+
clientId: e,
|
|
12
|
+
...r ? { secretKey: r } : {}
|
|
13
|
+
} : { secretKey: r })), i;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { r as n, o as t };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=publishThirdwebClient-CBD9sKJR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishThirdwebClient-CBD9sKJR.js","names":[],"sources":["../src/helpers/publishThirdwebClient.ts"],"sourcesContent":["import { createThirdwebClient, type ThirdwebClient } from 'thirdweb'\nimport { getPublishConfig } from '../config'\n\nlet _client: ThirdwebClient | null = null\nlet _clientKey: string | null = null\n\n/**\n * Thirdweb client for publish sends and contract calls.\n * Uses `thirdwebSecretKey` when set so server-side RPC is not limited to browser origins.\n * Recreates the client when the client id or secret key changes.\n */\nexport function getClient(): ThirdwebClient {\n const { thirdwebClientId, thirdwebSecretKey } = getPublishConfig()\n if (!thirdwebClientId && !thirdwebSecretKey) {\n throw new Error(\n '@seedprotocol/publish/thirdweb: thirdwebClientId or thirdwebSecretKey is required. Pass one in initPublish / PublishProvider config.',\n )\n }\n const key = `${thirdwebClientId ?? ''}\\0${thirdwebSecretKey ?? ''}`\n if (!_client || _clientKey !== key) {\n _clientKey = key\n _client = thirdwebClientId\n ? createThirdwebClient({\n clientId: thirdwebClientId,\n ...(thirdwebSecretKey ? { secretKey: thirdwebSecretKey } : {}),\n })\n : createThirdwebClient({ secretKey: thirdwebSecretKey! })\n }\n return _client\n}\n\n/** Drop the cached client (tests). */\nexport function resetPublishThirdwebClient(): void {\n _client = null\n _clientKey = null\n}\n"],"mappings":";;;;mDAGI,IAAiC,MACjC,IAA4B;AAOhC,SAAgB,IAA4B;CAC1C,IAAM,EAAE,qBAAkB,yBAAsB,EAAiB;CACjE,IAAI,CAAC,KAAoB,CAAC,GACxB,MAAU,MACR,sIACF;CAEF,IAAM,IAAM,GAAG,KAAoB,GAAG,IAAI,KAAqB;CAU/D,QATI,CAAC,KAAW,MAAe,OAC7B,IAAa,GACb,IACI,EADM,IACe;EACnB,UAAU;EACV,GAAI,IAAoB,EAAE,WAAW,EAAkB,IAAI,CAAC;CAC9D,IACqB,EAAE,WAAW,EAAmB,CAAC,IAErD;AACT"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { o as t } from "./chainConfig-CYy0XJ0M.js";
|
|
3
|
+
import { createThirdwebClient as n } from "thirdweb";
|
|
4
|
+
//#region src/helpers/publishThirdwebClient.ts
|
|
5
|
+
var r = /* @__PURE__ */ e({ getClient: () => o }), i = null, a = null;
|
|
6
|
+
function o() {
|
|
7
|
+
let { thirdwebClientId: e, thirdwebSecretKey: r } = t();
|
|
8
|
+
if (!e && !r) throw Error("@seedprotocol/publish/thirdweb: thirdwebClientId or thirdwebSecretKey is required. Pass one in initPublish / PublishProvider config.");
|
|
9
|
+
let o = `${e ?? ""}\0${r ?? ""}`;
|
|
10
|
+
return (!i || a !== o) && (a = o, i = n(e ? {
|
|
11
|
+
clientId: e,
|
|
12
|
+
...r ? { secretKey: r } : {}
|
|
13
|
+
} : { secretKey: r })), i;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { r as n, o as t };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=publishThirdwebClient-Ce7iBIsj.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishThirdwebClient-Ce7iBIsj.js","names":[],"sources":["../src/helpers/publishThirdwebClient.ts"],"sourcesContent":["import { createThirdwebClient, type ThirdwebClient } from 'thirdweb'\nimport { getPublishConfig } from '../config'\n\nlet _client: ThirdwebClient | null = null\nlet _clientKey: string | null = null\n\n/**\n * Thirdweb client for publish sends and contract calls.\n * Uses `thirdwebSecretKey` when set so server-side RPC is not limited to browser origins.\n * Recreates the client when the client id or secret key changes.\n */\nexport function getClient(): ThirdwebClient {\n const { thirdwebClientId, thirdwebSecretKey } = getPublishConfig()\n if (!thirdwebClientId && !thirdwebSecretKey) {\n throw new Error(\n '@seedprotocol/publish/thirdweb: thirdwebClientId or thirdwebSecretKey is required. Pass one in initPublish / PublishProvider config.',\n )\n }\n const key = `${thirdwebClientId ?? ''}\\0${thirdwebSecretKey ?? ''}`\n if (!_client || _clientKey !== key) {\n _clientKey = key\n _client = thirdwebClientId\n ? createThirdwebClient({\n clientId: thirdwebClientId,\n ...(thirdwebSecretKey ? { secretKey: thirdwebSecretKey } : {}),\n })\n : createThirdwebClient({ secretKey: thirdwebSecretKey! })\n }\n return _client\n}\n\n/** Drop the cached client (tests). */\nexport function resetPublishThirdwebClient(): void {\n _client = null\n _clientKey = null\n}\n"],"mappings":";;;;mDAGI,IAAiC,MACjC,IAA4B;AAOhC,SAAgB,IAA4B;CAC1C,IAAM,EAAE,qBAAkB,yBAAsB,EAAiB;CACjE,IAAI,CAAC,KAAoB,CAAC,GACxB,MAAU,MACR,sIACF;CAEF,IAAM,IAAM,GAAG,KAAoB,GAAG,IAAI,KAAqB;CAU/D,QATI,CAAC,KAAW,MAAe,OAC7B,IAAa,GACb,IACI,EADM,IACe;EACnB,UAAU;EACV,GAAI,IAAoB,EAAE,WAAW,EAAkB,IAAI,CAAC;CAC9D,IACqB,EAAE,WAAW,EAAmB,CAAC,IAErD;AACT"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { _ as e, o as t } from "./chainConfig-CA1Hrrjg.js";
|
|
2
|
+
import { A as n, F as r, L as i, M as a } from "./publishAuthorization-BEqRnP2h.js";
|
|
3
|
+
import { t as o } from "./publishThirdwebClient-CBD9sKJR.js";
|
|
4
|
+
import { getGetAdditionalSyncAddresses as s } from "@seedprotocol/sdk";
|
|
5
|
+
//#region src/helpers/resolveRevokeAccount.ts
|
|
6
|
+
async function c(c) {
|
|
7
|
+
let { account: l, attester: u } = c;
|
|
8
|
+
if (!u || l.address.toLowerCase() === u.toLowerCase()) return l;
|
|
9
|
+
let d = s(), f = !1;
|
|
10
|
+
if (d) {
|
|
11
|
+
let e = await d(), t = u.toLowerCase();
|
|
12
|
+
f = !!e?.some((e) => e?.toLowerCase() === t);
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
let t = await r(l.address);
|
|
16
|
+
if (u.toLowerCase() === t.toLowerCase() || f) {
|
|
17
|
+
let r = f ? await n(e()).catch(() => t) : t;
|
|
18
|
+
if (await i(r)) {
|
|
19
|
+
let t = a();
|
|
20
|
+
await t.autoConnect({
|
|
21
|
+
client: o(),
|
|
22
|
+
chain: e()
|
|
23
|
+
});
|
|
24
|
+
let n = t.getAccount();
|
|
25
|
+
if (n) return n;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} catch {}
|
|
29
|
+
if (f) {
|
|
30
|
+
let { modularAccountModuleContract: e } = t();
|
|
31
|
+
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
|
+
}
|
|
33
|
+
return l;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { c as resolveRevokeAccount };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=resolveRevokeAccount-DJKfLlyK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveRevokeAccount-DJKfLlyK.js","names":[],"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,eAAsB,EAAqB,GAGtB;CACnB,IAAM,EAAE,YAAS,gBAAa;CAE9B,IAAI,CAAC,KAAY,EAAQ,QAAQ,YAAY,MAAM,EAAS,YAAY,GACtE,OAAO;CAGT,IAAM,IAAmB,EAA8B,GACnD,IAA2B;CAC/B,IAAI,GAAkB;EACpB,IAAM,IAAa,MAAM,EAAiB,GACpC,IAAgB,EAAS,YAAY;EAC3C,IAA2B,CAAC,CAAC,GAAY,MACtC,MAA0B,GAAG,YAAY,MAAM,CAClD;CACF;CAEA,IAAI;EACF,IAAM,IAAwB,MAAM,EAA8B,EAAQ,OAAO;EAIjF,IAHsB,EAAS,YAG3B,MAFiB,EAAsB,YAErB,KAAgB,GAA0B;GAC9D,IAAM,IAAiB,IACnB,MAAM,EAAkC,EAAwB,CAAC,CAAC,CAAC,YAAY,CAAqB,IACpG;GAEJ,IAAI,MADmB,EAAsB,CAAc,GAC7C;IACZ,IAAM,IAAuB,EAAwB;IACrD,MAAM,EAAqB,YAAY;KACrC,QAAQ,EAAU;KAClB,OAAO,EAAwB;IACjC,CAAC;IACD,IAAM,IAAiB,EAAqB,WAAW;IACvD,IAAI,GACF,OAAO;GAEX;EACF;CACF,QAAQ,CAER;CAEA,IAAI,GAA0B;EAC5B,IAAM,EAAE,oCAAiC,EAAiB;EAO1D,MANK,GAA8B,KAAK,IAM9B,MACR,sIACF,IAPY,MACR,wEACF;CAMJ;CAEA,OAAO;AACT"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { _ as e, o as t } from "./chainConfig-CYy0XJ0M.js";
|
|
2
|
+
import { A as n, F as r, L as i, M as a } from "./publishAuthorization-DjVrnMC0.js";
|
|
3
|
+
import { t as o } from "./publishThirdwebClient-Ce7iBIsj.js";
|
|
4
|
+
import { getGetAdditionalSyncAddresses as s } from "@seedprotocol/sdk";
|
|
5
|
+
//#region src/helpers/resolveRevokeAccount.ts
|
|
6
|
+
async function c(c) {
|
|
7
|
+
let { account: l, attester: u } = c;
|
|
8
|
+
if (!u || l.address.toLowerCase() === u.toLowerCase()) return l;
|
|
9
|
+
let d = s(), f = !1;
|
|
10
|
+
if (d) {
|
|
11
|
+
let e = await d(), t = u.toLowerCase();
|
|
12
|
+
f = !!e?.some((e) => e?.toLowerCase() === t);
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
let t = await r(l.address);
|
|
16
|
+
if (u.toLowerCase() === t.toLowerCase() || f) {
|
|
17
|
+
let r = f ? await n(e()).catch(() => t) : t;
|
|
18
|
+
if (await i(r)) {
|
|
19
|
+
let t = a();
|
|
20
|
+
await t.autoConnect({
|
|
21
|
+
client: o(),
|
|
22
|
+
chain: e()
|
|
23
|
+
});
|
|
24
|
+
let n = t.getAccount();
|
|
25
|
+
if (n) return n;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} catch {}
|
|
29
|
+
if (f) {
|
|
30
|
+
let { modularAccountModuleContract: e } = t();
|
|
31
|
+
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
|
+
}
|
|
33
|
+
return l;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { c as resolveRevokeAccount };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=resolveRevokeAccount-mzR11KJ4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveRevokeAccount-mzR11KJ4.js","names":[],"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,eAAsB,EAAqB,GAGtB;CACnB,IAAM,EAAE,YAAS,gBAAa;CAE9B,IAAI,CAAC,KAAY,EAAQ,QAAQ,YAAY,MAAM,EAAS,YAAY,GACtE,OAAO;CAGT,IAAM,IAAmB,EAA8B,GACnD,IAA2B;CAC/B,IAAI,GAAkB;EACpB,IAAM,IAAa,MAAM,EAAiB,GACpC,IAAgB,EAAS,YAAY;EAC3C,IAA2B,CAAC,CAAC,GAAY,MACtC,MAA0B,GAAG,YAAY,MAAM,CAClD;CACF;CAEA,IAAI;EACF,IAAM,IAAwB,MAAM,EAA8B,EAAQ,OAAO;EAIjF,IAHsB,EAAS,YAG3B,MAFiB,EAAsB,YAErB,KAAgB,GAA0B;GAC9D,IAAM,IAAiB,IACnB,MAAM,EAAkC,EAAwB,CAAC,CAAC,CAAC,YAAY,CAAqB,IACpG;GAEJ,IAAI,MADmB,EAAsB,CAAc,GAC7C;IACZ,IAAM,IAAuB,EAAwB;IACrD,MAAM,EAAqB,YAAY;KACrC,QAAQ,EAAU;KAClB,OAAO,EAAwB;IACjC,CAAC;IACD,IAAM,IAAiB,EAAqB,WAAW;IACvD,IAAI,GACF,OAAO;GAEX;EACF;CACF,QAAQ,CAER;CAEA,IAAI,GAA0B;EAC5B,IAAM,EAAE,oCAAiC,EAAiB;EAO1D,MANK,GAA8B,KAAK,IAM9B,MACR,sIACF,IAPY,MACR,wEACF;CAMJ;CAEA,OAAO;AACT"}
|
package/dist/thirdweb.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as e, O as t, Q as n, _ as r, a as i, at as a, h as o, m as s, o as c, ot as l, p as u, s as d, st as f, t as p } from "./chainConfig-CYy0XJ0M.js";
|
|
2
2
|
import { n as m, r as h } from "./errors-Du3LNbJN.js";
|
|
3
|
-
import { $ as ee, A as g, B as _, C as v, D as y, E as b, F as x, H as te, I as S, L as C, M as w, N as T, O as E, P as ne, R as re, S as ie, T as ae, U as oe, W as se, a as ce, d as le, et as D, f as ue, h as O, j as de, k as fe, l as pe, m as k, p as A, u as j, w as M, x as N, y as P, z as F } from "./publishAuthorization-
|
|
4
|
-
import { t as I } from "./publishThirdwebClient-
|
|
5
|
-
import { t as L } from "./ensureSmartWalletThenPublish-
|
|
6
|
-
import { t as R } from "./ensureModularPublishBootstrap-
|
|
7
|
-
import { i as z, r as B, t as V } from "./ensureAutomationSessionKey-
|
|
3
|
+
import { $ as ee, A as g, B as _, C as v, D as y, E as b, F as x, H as te, I as S, L as C, M as w, N as T, O as E, P as ne, R as re, S as ie, T as ae, U as oe, W as se, a as ce, d as le, et as D, f as ue, h as O, j as de, k as fe, l as pe, m as k, p as A, u as j, w as M, x as N, y as P, z as F } from "./publishAuthorization-DjVrnMC0.js";
|
|
4
|
+
import { t as I } from "./publishThirdwebClient-Ce7iBIsj.js";
|
|
5
|
+
import { t as L } from "./ensureSmartWalletThenPublish-Dta2AOyJ.js";
|
|
6
|
+
import { t as R } from "./ensureModularPublishBootstrap-BhYNmLzT.js";
|
|
7
|
+
import { i as z, r as B, t as V } from "./ensureAutomationSessionKey-CeUbjcCl.js";
|
|
8
8
|
import { client as H } from "@seedprotocol/sdk";
|
|
9
9
|
import { deploySmartAccount as me, getContract as U, sendTransaction as he } from "thirdweb";
|
|
10
10
|
import { assessPublishAuthorization as ge, decodePublishAuthorizationData as _e, getPublishAuthorizationFromEas as ve } from "@seedprotocol/eas";
|
|
@@ -48,42 +48,42 @@ async function Me(e, t, n) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
var Ne = () => {
|
|
51
|
-
let
|
|
51
|
+
let n = D(), i = r(n), a = Te(), s = we(), c = Ee(), l = De(), u = G(null), d = G(!1), f = G(!1);
|
|
52
52
|
W(() => {
|
|
53
53
|
if (typeof window > "u") return;
|
|
54
|
-
let
|
|
54
|
+
let e = d.current;
|
|
55
55
|
d.current = l;
|
|
56
|
-
let
|
|
56
|
+
let t;
|
|
57
57
|
try {
|
|
58
|
-
|
|
58
|
+
t = performance.getEntriesByType("navigation")[0]?.type;
|
|
59
59
|
} catch {
|
|
60
|
-
|
|
60
|
+
t = void 0;
|
|
61
61
|
}
|
|
62
|
-
if (
|
|
62
|
+
if (t !== "reload") return;
|
|
63
63
|
let r = !1;
|
|
64
64
|
try {
|
|
65
65
|
r = sessionStorage.getItem(q) === "1";
|
|
66
66
|
} catch {
|
|
67
67
|
r = !1;
|
|
68
68
|
}
|
|
69
|
-
r ||
|
|
69
|
+
r || e && !l && c === "disconnected" && (f.current || (f.current = !0, (n.useModularExecutor ? T() : w()).autoConnect({
|
|
70
70
|
client: I(),
|
|
71
71
|
chain: i
|
|
72
72
|
}).catch(() => {})));
|
|
73
73
|
}, [
|
|
74
74
|
c,
|
|
75
75
|
l,
|
|
76
|
-
|
|
76
|
+
n.useModularExecutor,
|
|
77
77
|
i
|
|
78
78
|
]);
|
|
79
|
-
let p = ye(async (
|
|
80
|
-
let r =
|
|
79
|
+
let p = ye(async (t) => {
|
|
80
|
+
let r = t.getAccount();
|
|
81
81
|
if (!r) return;
|
|
82
82
|
await je(), O.stopAll();
|
|
83
83
|
let a = /* @__PURE__ */ new Set([r.address.toLowerCase()]), s;
|
|
84
|
-
if (
|
|
84
|
+
if (n.useModularExecutor) {
|
|
85
85
|
_();
|
|
86
|
-
let e =
|
|
86
|
+
let e = t.getAdminAccount?.()?.address ?? r.address, n = async () => {
|
|
87
87
|
try {
|
|
88
88
|
return await g(i);
|
|
89
89
|
} catch {
|
|
@@ -94,24 +94,24 @@ var Ne = () => {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
-
s = await
|
|
97
|
+
s = await n(), s ||= (await new Promise((e) => queueMicrotask(() => e())), await n()), s && a.add(s.toLowerCase());
|
|
98
98
|
}
|
|
99
99
|
let c = [...a].sort().join(",");
|
|
100
100
|
if (u.current !== c) {
|
|
101
101
|
u.current = c;
|
|
102
102
|
try {
|
|
103
|
-
let
|
|
104
|
-
await
|
|
105
|
-
...
|
|
103
|
+
let t = o(r);
|
|
104
|
+
await e({
|
|
105
|
+
...t,
|
|
106
106
|
ownedAddresses: [...a],
|
|
107
107
|
publisherAddress: s ?? r.address
|
|
108
108
|
});
|
|
109
109
|
} catch (e) {
|
|
110
110
|
throw u.current = null, console.warn("[ConnectButton] Failed to set seed client addresses:", e), e;
|
|
111
111
|
}
|
|
112
|
-
await Me(r, s,
|
|
112
|
+
await Me(r, s, n);
|
|
113
113
|
}
|
|
114
|
-
}, [
|
|
114
|
+
}, [n]);
|
|
115
115
|
return W(() => {
|
|
116
116
|
if (l) return;
|
|
117
117
|
if (c !== "connected") {
|
|
@@ -136,7 +136,7 @@ var Ne = () => {
|
|
|
136
136
|
p
|
|
137
137
|
]), /* @__PURE__ */ K(xe, {
|
|
138
138
|
client: I(),
|
|
139
|
-
wallets: S(
|
|
139
|
+
wallets: S(n),
|
|
140
140
|
autoConnect: !0,
|
|
141
141
|
chain: i,
|
|
142
142
|
chains: [i],
|
|
@@ -156,7 +156,7 @@ var Ne = () => {
|
|
|
156
156
|
try {
|
|
157
157
|
sessionStorage.setItem(q, "1");
|
|
158
158
|
} catch {}
|
|
159
|
-
|
|
159
|
+
t(), O.stopAll();
|
|
160
160
|
},
|
|
161
161
|
theme: Ce({ colors: {
|
|
162
162
|
primaryButtonBg: "#1D2939",
|
|
@@ -185,25 +185,25 @@ async function Y() {
|
|
|
185
185
|
});
|
|
186
186
|
let n = t.getAccount();
|
|
187
187
|
if (!n) throw new m(Fe, "EIP7702_MODULAR_ACCOUNT_UNAVAILABLE");
|
|
188
|
-
let i = I(),
|
|
188
|
+
let i = I(), o = U({
|
|
189
189
|
client: i,
|
|
190
190
|
chain: r(),
|
|
191
191
|
address: n.address
|
|
192
192
|
});
|
|
193
|
-
if (!await
|
|
193
|
+
if (!await a(n.address)) {
|
|
194
194
|
if (!e) throw new m(Ie(), "EIP7702_MODULAR_NOT_UPGRADED", n.address);
|
|
195
195
|
try {
|
|
196
196
|
await me({
|
|
197
197
|
smartAccount: n,
|
|
198
198
|
chain: r(),
|
|
199
199
|
client: i,
|
|
200
|
-
accountContract:
|
|
200
|
+
accountContract: o
|
|
201
201
|
});
|
|
202
202
|
} catch (e) {
|
|
203
|
-
if (await
|
|
203
|
+
if (await l(n.address, J)) return;
|
|
204
204
|
throw new m(Le(), "EIP7702_MODULAR_DEPLOY_FAILED", n.address, e);
|
|
205
205
|
}
|
|
206
|
-
if (!await
|
|
206
|
+
if (!await l(n.address, J)) throw new m(Re, "EIP7702_MODULAR_NOT_CONFIRMED", n.address);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
//#endregion
|
|
@@ -214,52 +214,52 @@ function X(e) {
|
|
|
214
214
|
//#endregion
|
|
215
215
|
//#region src/helpers/ensureManagedSignerSessionKey.ts
|
|
216
216
|
var ze = () => `Could not connect the managed publishing account to authorize the modular signer on ${p()}. Reconnect and try again.`, Z = () => `Could not authorize the modular wallet as a session signer on your publishing account on ${p()}.`;
|
|
217
|
-
async function Be(
|
|
218
|
-
let { managedAddress:
|
|
219
|
-
await
|
|
217
|
+
async function Be(e) {
|
|
218
|
+
let { managedAddress: t, signerAddress: i } = e, a = w();
|
|
219
|
+
await a.autoConnect({
|
|
220
220
|
client: I(),
|
|
221
221
|
chain: r()
|
|
222
222
|
});
|
|
223
|
-
let
|
|
224
|
-
if (!
|
|
225
|
-
let
|
|
223
|
+
let o = a.getAccount();
|
|
224
|
+
if (!o) throw new h(ze(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
|
|
225
|
+
let s = U({
|
|
226
226
|
client: I(),
|
|
227
227
|
chain: r(),
|
|
228
|
-
address:
|
|
229
|
-
}),
|
|
230
|
-
approvedTargets: X(
|
|
228
|
+
address: t
|
|
229
|
+
}), c = {
|
|
230
|
+
approvedTargets: X(t),
|
|
231
231
|
nativeTokenLimitPerTransaction: 0
|
|
232
|
-
},
|
|
232
|
+
}, l = !1;
|
|
233
233
|
try {
|
|
234
|
-
|
|
235
|
-
accountContract:
|
|
234
|
+
l = await ke({
|
|
235
|
+
accountContract: s,
|
|
236
236
|
sessionKeyAddress: i,
|
|
237
|
-
newPermissions:
|
|
237
|
+
newPermissions: c
|
|
238
238
|
});
|
|
239
239
|
} catch (e) {
|
|
240
|
-
throw new h(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED",
|
|
240
|
+
throw new h(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
|
|
241
241
|
}
|
|
242
|
-
if (
|
|
242
|
+
if (l) try {
|
|
243
243
|
let e = Oe({
|
|
244
|
-
contract:
|
|
245
|
-
account:
|
|
244
|
+
contract: s,
|
|
245
|
+
account: o,
|
|
246
246
|
sessionKeyAddress: i,
|
|
247
|
-
permissions:
|
|
247
|
+
permissions: c
|
|
248
248
|
}), t = await he({
|
|
249
|
-
account:
|
|
249
|
+
account: o,
|
|
250
250
|
transaction: e
|
|
251
251
|
});
|
|
252
|
-
await
|
|
252
|
+
await f(t.transactionHash);
|
|
253
253
|
} catch (e) {
|
|
254
|
-
throw new h(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED",
|
|
254
|
+
throw new h(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
|
|
255
255
|
}
|
|
256
|
-
let
|
|
256
|
+
let u = !1;
|
|
257
257
|
try {
|
|
258
|
-
|
|
258
|
+
u = await n(t, i);
|
|
259
259
|
} catch (e) {
|
|
260
|
-
throw new h(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED",
|
|
260
|
+
throw new h(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
|
|
261
261
|
}
|
|
262
|
-
if (!
|
|
262
|
+
if (!u) throw new h(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
|
|
263
263
|
}
|
|
264
264
|
//#endregion
|
|
265
265
|
//#region src/helpers/enrollPublishAutomation.ts
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { o as e } from "./chainConfig-CYy0XJ0M.js";
|
|
2
|
+
import { BaseDb as t, applyArweaveL1TransactionIdLocal as n, arweaveL1FinalizeJobs as r, getArweaveUploadStatus as i, isArweaveL1AnchoringComplete as a, queryArweaveGatewayTransactionWithFallback as o } from "@seedprotocol/sdk";
|
|
3
|
+
import s from "debug";
|
|
4
|
+
import { eq as c } from "drizzle-orm";
|
|
5
|
+
//#region src/services/arweaveL1Finalize/worker.ts
|
|
6
|
+
var l = s("seedProtocol:arweaveL1Finalize:worker"), u = 45e3, d = null;
|
|
7
|
+
function f() {
|
|
8
|
+
d ?? (d = setInterval(() => {
|
|
9
|
+
p();
|
|
10
|
+
}, u), p());
|
|
11
|
+
}
|
|
12
|
+
async function p() {
|
|
13
|
+
let s;
|
|
14
|
+
try {
|
|
15
|
+
s = e();
|
|
16
|
+
} catch {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!s.useArweaveBundler || !t.isAppDbReady()) return;
|
|
20
|
+
let u = t.getAppDb();
|
|
21
|
+
if (!u) return;
|
|
22
|
+
let d = await u.select().from(r).where(c(r.phase, "pending_l1")).limit(25);
|
|
23
|
+
if (d.length === 0) return;
|
|
24
|
+
let f = s.arweaveUploadVerificationBaseUrl, p = s.arweaveGraphqlUrl;
|
|
25
|
+
for (let e of d) {
|
|
26
|
+
let t = e.dataItemId;
|
|
27
|
+
try {
|
|
28
|
+
let s = e.l1TransactionId;
|
|
29
|
+
if (!s) {
|
|
30
|
+
let n = (await o(p, t))?.bundledInId ?? null;
|
|
31
|
+
n && (s = n, await u.update(r).set({
|
|
32
|
+
l1TransactionId: n,
|
|
33
|
+
bundleId: n,
|
|
34
|
+
updatedAt: Date.now()
|
|
35
|
+
}).where(c(r.id, e.id)));
|
|
36
|
+
}
|
|
37
|
+
let l = await i(f, t), d = l ? JSON.stringify(l) : null;
|
|
38
|
+
if (l && a(l)) {
|
|
39
|
+
let i = s ?? l.bundleId ?? l.turbo?.bundleId ?? e.l1TransactionId ?? null;
|
|
40
|
+
i && await n({
|
|
41
|
+
seedLocalId: e.seedLocalId,
|
|
42
|
+
versionLocalId: e.versionLocalId,
|
|
43
|
+
dataItemId: t,
|
|
44
|
+
l1TransactionId: i
|
|
45
|
+
}), await u.update(r).set({
|
|
46
|
+
phase: "confirmed",
|
|
47
|
+
statusJson: d,
|
|
48
|
+
l1TransactionId: i ?? e.l1TransactionId,
|
|
49
|
+
bundleId: l.bundleId ?? e.bundleId,
|
|
50
|
+
updatedAt: Date.now()
|
|
51
|
+
}).where(c(r.id, e.id));
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
await u.update(r).set({
|
|
55
|
+
statusJson: d,
|
|
56
|
+
updatedAt: Date.now()
|
|
57
|
+
}).where(c(r.id, e.id));
|
|
58
|
+
} catch (t) {
|
|
59
|
+
l("tick error for job", e.id, t), await u.update(r).set({
|
|
60
|
+
errorMessage: t instanceof Error ? t.message : String(t),
|
|
61
|
+
updatedAt: Date.now()
|
|
62
|
+
}).where(c(r.id, e.id));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { f as startArweaveL1FinalizeWorker };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=worker-CbtzcKG6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-CbtzcKG6.js","names":[],"sources":["../src/services/arweaveL1Finalize/worker.ts"],"sourcesContent":["import {\n applyArweaveL1TransactionIdLocal,\n arweaveL1FinalizeJobs,\n BaseDb,\n getArweaveUploadStatus,\n isArweaveL1AnchoringComplete,\n queryArweaveGatewayTransactionWithFallback,\n} from '@seedprotocol/sdk'\nimport { eq } from 'drizzle-orm'\nimport { getPublishConfig } from '~/config'\nimport debug from 'debug'\n\nconst logger = debug('seedProtocol:arweaveL1Finalize:worker')\n\nconst TICK_MS = 45_000\n\nlet intervalId: ReturnType<typeof setInterval> | null = null\n\nexport function startArweaveL1FinalizeWorker(): void {\n if (intervalId != null) return\n intervalId = setInterval(() => {\n void runArweaveL1FinalizeTick()\n }, TICK_MS)\n void runArweaveL1FinalizeTick()\n}\n\nexport function stopArweaveL1FinalizeWorker(): void {\n if (intervalId != null) {\n clearInterval(intervalId)\n intervalId = null\n }\n}\n\nasync function runArweaveL1FinalizeTick(): Promise<void> {\n let config: ReturnType<typeof getPublishConfig>\n try {\n config = getPublishConfig()\n } catch {\n return\n }\n if (!config.useArweaveBundler) return\n\n // initPublish may start this worker before Seed platformClassesInit configures BaseDb.\n if (!BaseDb.isAppDbReady()) return\n const db = BaseDb.getAppDb()\n if (!db) return\n\n const pending = await db\n .select()\n .from(arweaveL1FinalizeJobs)\n .where(eq(arweaveL1FinalizeJobs.phase, 'pending_l1'))\n .limit(25)\n\n if (pending.length === 0) return\n\n const uploadBase = config.arweaveUploadVerificationBaseUrl\n const graphqlUrl = config.arweaveGraphqlUrl\n\n for (const job of pending) {\n const dataItemId = job.dataItemId\n try {\n let l1TxId = job.l1TransactionId\n\n if (!l1TxId) {\n const gql = await queryArweaveGatewayTransactionWithFallback(graphqlUrl, dataItemId)\n const bundled = gql?.bundledInId ?? null\n if (bundled) {\n l1TxId = bundled\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n l1TransactionId: bundled,\n bundleId: bundled,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n }\n }\n\n const status = await getArweaveUploadStatus(uploadBase, dataItemId)\n const statusStr = status ? JSON.stringify(status) : null\n\n if (status && isArweaveL1AnchoringComplete(status)) {\n const resolvedL1 =\n l1TxId ??\n status.bundleId ??\n status.turbo?.bundleId ??\n job.l1TransactionId ??\n null\n\n if (resolvedL1) {\n await applyArweaveL1TransactionIdLocal({\n seedLocalId: job.seedLocalId,\n versionLocalId: job.versionLocalId,\n dataItemId,\n l1TransactionId: resolvedL1,\n })\n }\n\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n phase: 'confirmed',\n statusJson: statusStr,\n l1TransactionId: resolvedL1 ?? job.l1TransactionId,\n bundleId: status.bundleId ?? job.bundleId,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n continue\n }\n\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n statusJson: statusStr,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n } catch (err) {\n logger('tick error for job', job.id, err)\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n errorMessage: err instanceof Error ? err.message : String(err),\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n }\n }\n}\n"],"mappings":";;;;;AAYA,IAAM,IAAS,EAAM,uCAAuC,GAEtD,IAAU,MAEZ,IAAoD;AAExD,SAAgB,IAAqC;CAC/C,MACJ,IAAa,kBAAkB;EAC7B,EAA8B;CAChC,GAAG,CAAO,GACV,EAA8B;AAChC;AASA,eAAe,IAA0C;CACvD,IAAI;CACJ,IAAI;EACF,IAAS,EAAiB;CAC5B,QAAQ;EACN;CACF;CAIA,IAHI,CAAC,EAAO,qBAGR,CAAC,EAAO,aAAa,GAAG;CAC5B,IAAM,IAAK,EAAO,SAAS;CAC3B,IAAI,CAAC,GAAI;CAET,IAAM,IAAU,MAAM,EACnB,OAAO,CAAC,CACR,KAAK,CAAqB,CAAC,CAC3B,MAAM,EAAG,EAAsB,OAAO,YAAY,CAAC,CAAC,CACpD,MAAM,EAAE;CAEX,IAAI,EAAQ,WAAW,GAAG;CAE1B,IAAM,IAAa,EAAO,kCACpB,IAAa,EAAO;CAE1B,KAAK,IAAM,KAAO,GAAS;EACzB,IAAM,IAAa,EAAI;EACvB,IAAI;GACF,IAAI,IAAS,EAAI;GAEjB,IAAI,CAAC,GAAQ;IAEX,IAAM,KAAU,MADE,EAA2C,GAAY,CAAU,EAAA,EAC9D,eAAe;IACpC,AAAI,MACF,IAAS,GACT,MAAM,EACH,OAAO,CAAqB,CAAC,CAC7B,IAAI;KACH,iBAAiB;KACjB,UAAU;KACV,WAAW,KAAK,IAAI;IACtB,CAAC,CAAC,CACD,MAAM,EAAG,EAAsB,IAAI,EAAI,EAAG,CAAC;GAElD;GAEA,IAAM,IAAS,MAAM,EAAuB,GAAY,CAAU,GAC5D,IAAY,IAAS,KAAK,UAAU,CAAM,IAAI;GAEpD,IAAI,KAAU,EAA6B,CAAM,GAAG;IAClD,IAAM,IACJ,KACA,EAAO,YACP,EAAO,OAAO,YACd,EAAI,mBACJ;IAWF,AATI,KACF,MAAM,EAAiC;KACrC,aAAa,EAAI;KACjB,gBAAgB,EAAI;KACpB;KACA,iBAAiB;IACnB,CAAC,GAGH,MAAM,EACH,OAAO,CAAqB,CAAC,CAC7B,IAAI;KACH,OAAO;KACP,YAAY;KACZ,iBAAiB,KAAc,EAAI;KACnC,UAAU,EAAO,YAAY,EAAI;KACjC,WAAW,KAAK,IAAI;IACtB,CAAC,CAAC,CACD,MAAM,EAAG,EAAsB,IAAI,EAAI,EAAG,CAAC;IAC9C;GACF;GAEA,MAAM,EACH,OAAO,CAAqB,CAAC,CAC7B,IAAI;IACH,YAAY;IACZ,WAAW,KAAK,IAAI;GACtB,CAAC,CAAC,CACD,MAAM,EAAG,EAAsB,IAAI,EAAI,EAAG,CAAC;EAChD,SAAS,GAAK;GAEZ,AADA,EAAO,sBAAsB,EAAI,IAAI,CAAG,GACxC,MAAM,EACH,OAAO,CAAqB,CAAC,CAC7B,IAAI;IACH,cAAc,aAAe,QAAQ,EAAI,UAAU,OAAO,CAAG;IAC7D,WAAW,KAAK,IAAI;GACtB,CAAC,CAAC,CACD,MAAM,EAAG,EAAsB,IAAI,EAAI,EAAG,CAAC;EAChD;CACF;AACF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { o as e } from "./chainConfig-CA1Hrrjg.js";
|
|
2
|
+
import { BaseDb as t, applyArweaveL1TransactionIdLocal as n, arweaveL1FinalizeJobs as r, getArweaveUploadStatus as i, isArweaveL1AnchoringComplete as a, queryArweaveGatewayTransactionWithFallback as o } from "@seedprotocol/sdk";
|
|
3
|
+
import s from "debug";
|
|
4
|
+
import { eq as c } from "drizzle-orm";
|
|
5
|
+
//#region src/services/arweaveL1Finalize/worker.ts
|
|
6
|
+
var l = s("seedProtocol:arweaveL1Finalize:worker"), u = 45e3, d = null;
|
|
7
|
+
function f() {
|
|
8
|
+
d ?? (d = setInterval(() => {
|
|
9
|
+
p();
|
|
10
|
+
}, u), p());
|
|
11
|
+
}
|
|
12
|
+
async function p() {
|
|
13
|
+
let s;
|
|
14
|
+
try {
|
|
15
|
+
s = e();
|
|
16
|
+
} catch {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!s.useArweaveBundler || !t.isAppDbReady()) return;
|
|
20
|
+
let u = t.getAppDb();
|
|
21
|
+
if (!u) return;
|
|
22
|
+
let d = await u.select().from(r).where(c(r.phase, "pending_l1")).limit(25);
|
|
23
|
+
if (d.length === 0) return;
|
|
24
|
+
let f = s.arweaveUploadVerificationBaseUrl, p = s.arweaveGraphqlUrl;
|
|
25
|
+
for (let e of d) {
|
|
26
|
+
let t = e.dataItemId;
|
|
27
|
+
try {
|
|
28
|
+
let s = e.l1TransactionId;
|
|
29
|
+
if (!s) {
|
|
30
|
+
let n = (await o(p, t))?.bundledInId ?? null;
|
|
31
|
+
n && (s = n, await u.update(r).set({
|
|
32
|
+
l1TransactionId: n,
|
|
33
|
+
bundleId: n,
|
|
34
|
+
updatedAt: Date.now()
|
|
35
|
+
}).where(c(r.id, e.id)));
|
|
36
|
+
}
|
|
37
|
+
let l = await i(f, t), d = l ? JSON.stringify(l) : null;
|
|
38
|
+
if (l && a(l)) {
|
|
39
|
+
let i = s ?? l.bundleId ?? l.turbo?.bundleId ?? e.l1TransactionId ?? null;
|
|
40
|
+
i && await n({
|
|
41
|
+
seedLocalId: e.seedLocalId,
|
|
42
|
+
versionLocalId: e.versionLocalId,
|
|
43
|
+
dataItemId: t,
|
|
44
|
+
l1TransactionId: i
|
|
45
|
+
}), await u.update(r).set({
|
|
46
|
+
phase: "confirmed",
|
|
47
|
+
statusJson: d,
|
|
48
|
+
l1TransactionId: i ?? e.l1TransactionId,
|
|
49
|
+
bundleId: l.bundleId ?? e.bundleId,
|
|
50
|
+
updatedAt: Date.now()
|
|
51
|
+
}).where(c(r.id, e.id));
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
await u.update(r).set({
|
|
55
|
+
statusJson: d,
|
|
56
|
+
updatedAt: Date.now()
|
|
57
|
+
}).where(c(r.id, e.id));
|
|
58
|
+
} catch (t) {
|
|
59
|
+
l("tick error for job", e.id, t), await u.update(r).set({
|
|
60
|
+
errorMessage: t instanceof Error ? t.message : String(t),
|
|
61
|
+
updatedAt: Date.now()
|
|
62
|
+
}).where(c(r.id, e.id));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { f as startArweaveL1FinalizeWorker };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=worker-DHUm-TeQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-DHUm-TeQ.js","names":[],"sources":["../src/services/arweaveL1Finalize/worker.ts"],"sourcesContent":["import {\n applyArweaveL1TransactionIdLocal,\n arweaveL1FinalizeJobs,\n BaseDb,\n getArweaveUploadStatus,\n isArweaveL1AnchoringComplete,\n queryArweaveGatewayTransactionWithFallback,\n} from '@seedprotocol/sdk'\nimport { eq } from 'drizzle-orm'\nimport { getPublishConfig } from '~/config'\nimport debug from 'debug'\n\nconst logger = debug('seedProtocol:arweaveL1Finalize:worker')\n\nconst TICK_MS = 45_000\n\nlet intervalId: ReturnType<typeof setInterval> | null = null\n\nexport function startArweaveL1FinalizeWorker(): void {\n if (intervalId != null) return\n intervalId = setInterval(() => {\n void runArweaveL1FinalizeTick()\n }, TICK_MS)\n void runArweaveL1FinalizeTick()\n}\n\nexport function stopArweaveL1FinalizeWorker(): void {\n if (intervalId != null) {\n clearInterval(intervalId)\n intervalId = null\n }\n}\n\nasync function runArweaveL1FinalizeTick(): Promise<void> {\n let config: ReturnType<typeof getPublishConfig>\n try {\n config = getPublishConfig()\n } catch {\n return\n }\n if (!config.useArweaveBundler) return\n\n // initPublish may start this worker before Seed platformClassesInit configures BaseDb.\n if (!BaseDb.isAppDbReady()) return\n const db = BaseDb.getAppDb()\n if (!db) return\n\n const pending = await db\n .select()\n .from(arweaveL1FinalizeJobs)\n .where(eq(arweaveL1FinalizeJobs.phase, 'pending_l1'))\n .limit(25)\n\n if (pending.length === 0) return\n\n const uploadBase = config.arweaveUploadVerificationBaseUrl\n const graphqlUrl = config.arweaveGraphqlUrl\n\n for (const job of pending) {\n const dataItemId = job.dataItemId\n try {\n let l1TxId = job.l1TransactionId\n\n if (!l1TxId) {\n const gql = await queryArweaveGatewayTransactionWithFallback(graphqlUrl, dataItemId)\n const bundled = gql?.bundledInId ?? null\n if (bundled) {\n l1TxId = bundled\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n l1TransactionId: bundled,\n bundleId: bundled,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n }\n }\n\n const status = await getArweaveUploadStatus(uploadBase, dataItemId)\n const statusStr = status ? JSON.stringify(status) : null\n\n if (status && isArweaveL1AnchoringComplete(status)) {\n const resolvedL1 =\n l1TxId ??\n status.bundleId ??\n status.turbo?.bundleId ??\n job.l1TransactionId ??\n null\n\n if (resolvedL1) {\n await applyArweaveL1TransactionIdLocal({\n seedLocalId: job.seedLocalId,\n versionLocalId: job.versionLocalId,\n dataItemId,\n l1TransactionId: resolvedL1,\n })\n }\n\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n phase: 'confirmed',\n statusJson: statusStr,\n l1TransactionId: resolvedL1 ?? job.l1TransactionId,\n bundleId: status.bundleId ?? job.bundleId,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n continue\n }\n\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n statusJson: statusStr,\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n } catch (err) {\n logger('tick error for job', job.id, err)\n await db\n .update(arweaveL1FinalizeJobs)\n .set({\n errorMessage: err instanceof Error ? err.message : String(err),\n updatedAt: Date.now(),\n })\n .where(eq(arweaveL1FinalizeJobs.id, job.id!))\n }\n }\n}\n"],"mappings":";;;;;AAYA,IAAM,IAAS,EAAM,uCAAuC,GAEtD,IAAU,MAEZ,IAAoD;AAExD,SAAgB,IAAqC;CAC/C,MACJ,IAAa,kBAAkB;EAC7B,EAA8B;CAChC,GAAG,CAAO,GACV,EAA8B;AAChC;AASA,eAAe,IAA0C;CACvD,IAAI;CACJ,IAAI;EACF,IAAS,EAAiB;CAC5B,QAAQ;EACN;CACF;CAIA,IAHI,CAAC,EAAO,qBAGR,CAAC,EAAO,aAAa,GAAG;CAC5B,IAAM,IAAK,EAAO,SAAS;CAC3B,IAAI,CAAC,GAAI;CAET,IAAM,IAAU,MAAM,EACnB,OAAO,CAAC,CACR,KAAK,CAAqB,CAAC,CAC3B,MAAM,EAAG,EAAsB,OAAO,YAAY,CAAC,CAAC,CACpD,MAAM,EAAE;CAEX,IAAI,EAAQ,WAAW,GAAG;CAE1B,IAAM,IAAa,EAAO,kCACpB,IAAa,EAAO;CAE1B,KAAK,IAAM,KAAO,GAAS;EACzB,IAAM,IAAa,EAAI;EACvB,IAAI;GACF,IAAI,IAAS,EAAI;GAEjB,IAAI,CAAC,GAAQ;IAEX,IAAM,KAAU,MADE,EAA2C,GAAY,CAAU,EAAA,EAC9D,eAAe;IACpC,AAAI,MACF,IAAS,GACT,MAAM,EACH,OAAO,CAAqB,CAAC,CAC7B,IAAI;KACH,iBAAiB;KACjB,UAAU;KACV,WAAW,KAAK,IAAI;IACtB,CAAC,CAAC,CACD,MAAM,EAAG,EAAsB,IAAI,EAAI,EAAG,CAAC;GAElD;GAEA,IAAM,IAAS,MAAM,EAAuB,GAAY,CAAU,GAC5D,IAAY,IAAS,KAAK,UAAU,CAAM,IAAI;GAEpD,IAAI,KAAU,EAA6B,CAAM,GAAG;IAClD,IAAM,IACJ,KACA,EAAO,YACP,EAAO,OAAO,YACd,EAAI,mBACJ;IAWF,AATI,KACF,MAAM,EAAiC;KACrC,aAAa,EAAI;KACjB,gBAAgB,EAAI;KACpB;KACA,iBAAiB;IACnB,CAAC,GAGH,MAAM,EACH,OAAO,CAAqB,CAAC,CAC7B,IAAI;KACH,OAAO;KACP,YAAY;KACZ,iBAAiB,KAAc,EAAI;KACnC,UAAU,EAAO,YAAY,EAAI;KACjC,WAAW,KAAK,IAAI;IACtB,CAAC,CAAC,CACD,MAAM,EAAG,EAAsB,IAAI,EAAI,EAAG,CAAC;IAC9C;GACF;GAEA,MAAM,EACH,OAAO,CAAqB,CAAC,CAC7B,IAAI;IACH,YAAY;IACZ,WAAW,KAAK,IAAI;GACtB,CAAC,CAAC,CACD,MAAM,EAAG,EAAsB,IAAI,EAAI,EAAG,CAAC;EAChD,SAAS,GAAK;GAEZ,AADA,EAAO,sBAAsB,EAAI,IAAI,CAAG,GACxC,MAAM,EACH,OAAO,CAAqB,CAAC,CAC7B,IAAI;IACH,cAAc,aAAe,QAAQ,EAAI,UAAU,OAAO,CAAG;IAC7D,WAAW,KAAK,IAAI;GACtB,CAAC,CAAC,CACD,MAAM,EAAG,EAAsB,IAAI,EAAI,EAAG,CAAC;EAChD;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seedprotocol/publish",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "Publish UI components and helpers for Seed Protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsc -p tsconfig.build.json && vite build",
|
|
36
36
|
"prepublishOnly": "npm run build && node ../../scripts/sync-versions.js",
|
|
37
|
-
"test": "bun test src/helpers/arweave.test.ts src/helpers/defaultApprovedTargetsForModularPublish.test.ts src/helpers/ensureManagedAccountReady.test.ts src/helpers/ensureEip7702ModularAccountReady.test.ts src/helpers/ensureManagedSignerSessionKey.test.ts src/helpers/publishDisplayHelpers.test.ts src/services/publish/actors/createAttestationsRouting.test.ts src/services/publish/actors/seedUidHelpers.test.ts src/config.autoDeployEip7702.test.ts src/config.chain.test.ts && bun test src/helpers/ensureSmartWalletThenPublish.test.ts && bun test src/helpers/ensureManagedAccountEasConfigured.test.ts && bun test src/services/domainOwnership/domainOwnership.test.ts && bun test src/services/publishAuthorization/publishAuthorization.test.ts && bun test src/helpers/approvedTargetsForAutomationPublish.test.ts && bun test src/helpers/easDirect.multiRevoke.test.ts && bun test src/helpers/ensureAutomationSessionKey.test.ts && bun test src/helpers/enrollPublishAutomation.test.ts && bun test src/helpers/executorModuleReadiness.test.ts src/helpers/describeRevert.test.ts && bun test src/helpers/contracts/
|
|
37
|
+
"test": "bun test src/helpers/arweave.test.ts src/helpers/defaultApprovedTargetsForModularPublish.test.ts src/helpers/ensureManagedAccountReady.test.ts src/helpers/ensureEip7702ModularAccountReady.test.ts src/helpers/ensureManagedSignerSessionKey.test.ts src/helpers/publishDisplayHelpers.test.ts src/services/publish/actors/createAttestationsRouting.test.ts src/services/publish/actors/seedUidHelpers.test.ts src/config.autoDeployEip7702.test.ts src/config.chain.test.ts && bun test src/helpers/ensureSmartWalletThenPublish.test.ts && bun test src/helpers/ensureManagedAccountEasConfigured.test.ts && bun test src/services/domainOwnership/domainOwnership.test.ts && bun test src/services/publishAuthorization/publishAuthorization.test.ts && bun test src/helpers/approvedTargetsForAutomationPublish.test.ts && bun test src/helpers/easDirect.multiRevoke.test.ts && bun test src/helpers/ensureAutomationSessionKey.test.ts && bun test src/helpers/enrollPublishAutomation.test.ts && bun test src/helpers/executorModuleReadiness.test.ts src/helpers/describeRevert.test.ts && bun test src/helpers/contracts/encodeMultiPublish.test.ts && bun test src/helpers/assertStorageBoundToIdentity.test.ts && bun test src/services/publishCost/estimatePublishCost.test.ts && bun test src/services/publishCost/watchPublishCost.test.ts && bun test src/services/publishedBy/publishedBy.test.ts && bun test src/helpers/publishThirdwebClient.test.ts src/helpers/chainClient.secretKey.test.ts && bun test src/helpers/adapters/thirdwebAccount.test.ts && bun test src/services/publishManager/publishManager.node.test.ts && bun test src/services/publish/helpers/ensureEasSchemas.test.ts && bun test src/helpers/verifyPublishChain.test.ts && bun test src/helpers/thirdwebWallets.test.ts && bun test src/helpers/ensureExecutorModule.test.ts && bun test src/services/revoke/revokeAttestations.test.ts && bun test src/helpers/ensureModularPublishBootstrap.test.ts && bun test src/helpers/blockchain.test.ts src/helpers/retryNonceTooLow.test.ts src/helpers/seedTwin.test.ts && bun test src/helpers/runModularExecutorPublishPrep.test.ts && bun test src/helpers/adapters/permissionlessTxSender.test.ts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@ethereum-attestation-service/eas-sdk": "^2.9.0",
|
|
41
|
-
"@seedprotocol/arweave": "0.6.
|
|
42
|
-
"@seedprotocol/eas": "0.6.
|
|
43
|
-
"@seedprotocol/react": "0.6.
|
|
44
|
-
"@seedprotocol/sdk": "0.6.
|
|
41
|
+
"@seedprotocol/arweave": "0.6.9",
|
|
42
|
+
"@seedprotocol/eas": "0.6.9",
|
|
43
|
+
"@seedprotocol/react": "0.6.9",
|
|
44
|
+
"@seedprotocol/sdk": "0.6.9",
|
|
45
45
|
"@xstate/react": "^6.1.0",
|
|
46
46
|
"arweave": "^1.15.7",
|
|
47
47
|
"debug": "^4.4.1",
|