@seedprotocol/publish 0.6.8 → 0.6.10
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 +11 -0
- package/README.md +1 -19
- package/dist/{chainConfig-3sSqEVQh.js → chainConfig-DWzoOtkS.js} +439 -419
- package/dist/chainConfig-DWzoOtkS.js.map +1 -0
- package/dist/config.d.ts +5 -11
- package/dist/config.d.ts.map +1 -1
- package/dist/ensureAutomationSessionKey-h3zOmDr5.js +84 -0
- package/dist/ensureAutomationSessionKey-h3zOmDr5.js.map +1 -0
- package/dist/{ensureModularPublishBootstrap-DGBKVGg5.js → ensureModularPublishBootstrap-BImiIFJe.js} +9 -10
- package/dist/{ensureModularPublishBootstrap-5HJDqJJM.js.map → ensureModularPublishBootstrap-BImiIFJe.js.map} +1 -1
- package/dist/{ensureSmartWalletThenPublish-D5GSZRyZ.js → ensureSmartWalletThenPublish-DuOYPJFd.js} +9 -10
- package/dist/{ensureSmartWalletThenPublish-D5GSZRyZ.js.map → ensureSmartWalletThenPublish-DuOYPJFd.js.map} +1 -1
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/helpers/abi/executor.d.ts +16 -7
- package/dist/helpers/abi/executor.d.ts.map +1 -1
- package/dist/helpers/abi/factory.d.ts +11 -0
- package/dist/helpers/abi/factory.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/abi/seedExecutorRouter.d.ts +9 -1
- package/dist/helpers/abi/seedExecutorRouter.d.ts.map +1 -1
- package/dist/helpers/adapters/thirdwebAccount.d.ts.map +1 -1
- package/dist/helpers/chainClient.d.ts +18 -2
- package/dist/helpers/chainClient.d.ts.map +1 -1
- package/dist/helpers/contracts/index.d.ts +15 -18
- package/dist/helpers/contracts/index.d.ts.map +1 -1
- package/dist/helpers/describeRevert.d.ts +3 -2
- package/dist/helpers/describeRevert.d.ts.map +1 -1
- package/dist/helpers/enrollPublishAutomation.d.ts +2 -2
- package/dist/helpers/enrollPublishAutomation.d.ts.map +1 -1
- package/dist/helpers/ensureAutomationSessionKey.d.ts.map +1 -1
- package/dist/helpers/ensureExecutorModule.d.ts +28 -5
- package/dist/helpers/ensureExecutorModule.d.ts.map +1 -1
- package/dist/helpers/executorModuleReadiness.d.ts +15 -1
- package/dist/helpers/executorModuleReadiness.d.ts.map +1 -1
- package/dist/helpers/gasLog.d.ts +8 -0
- package/dist/helpers/gasLog.d.ts.map +1 -0
- package/dist/helpers/seedPaymaster.d.ts +27 -0
- package/dist/helpers/seedPaymaster.d.ts.map +1 -0
- package/dist/helpers/thirdweb.d.ts.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +316 -342
- package/dist/index.js.map +1 -1
- package/dist/{managedAccountAdmin-B64V1rlU.js → managedAccountAdmin-B4HkLWWE.js} +9 -10
- package/dist/{managedAccountAdmin-B64V1rlU.js.map → managedAccountAdmin-B4HkLWWE.js.map} +1 -1
- package/dist/{publishAuthorization-CxBkijU6.js → publishAuthorization-DgDI4zor.js} +1104 -1018
- package/dist/publishAuthorization-DgDI4zor.js.map +1 -0
- package/dist/{publishThirdwebClient-CQ29pzG2.js → publishThirdwebClient-CO18ST7C.js} +2 -2
- package/dist/{publishThirdwebClient-CQ29pzG2.js.map → publishThirdwebClient-CO18ST7C.js.map} +1 -1
- package/dist/{resolveRevokeAccount-CehU81k6.js → resolveRevokeAccount-DsNod8ti.js} +11 -11
- package/dist/{resolveRevokeAccount-B5iXpuRT.js.map → resolveRevokeAccount-DsNod8ti.js.map} +1 -1
- package/dist/thirdweb.d.ts +2 -1
- package/dist/thirdweb.d.ts.map +1 -1
- package/dist/thirdweb.js +155 -156
- package/dist/thirdweb.js.map +1 -1
- package/dist/{worker-2dUZSapK.js → worker-CN7zg73B.js} +2 -2
- package/dist/{worker-2dUZSapK.js.map → worker-CN7zg73B.js.map} +1 -1
- package/package.json +6 -6
- package/dist/chainConfig-3sSqEVQh.js.map +0 -1
- package/dist/chainConfig-3wlYarAG.js +0 -1433
- package/dist/chainConfig-3wlYarAG.js.map +0 -1
- package/dist/chainConfig-BRcsMopd.js +0 -1442
- package/dist/chainConfig-BRcsMopd.js.map +0 -1
- package/dist/chainConfig-BYm5OXpk.js +0 -1433
- package/dist/chainConfig-BYm5OXpk.js.map +0 -1
- package/dist/chainConfig-CfVGYAsY.js +0 -1311
- package/dist/chainConfig-CfVGYAsY.js.map +0 -1
- package/dist/chainConfig-DDA4YmAB.js +0 -1424
- package/dist/chainConfig-DDA4YmAB.js.map +0 -1
- package/dist/config-BA9la8B6.js +0 -941
- package/dist/config-BA9la8B6.js.map +0 -1
- package/dist/config-BqguD2Tt.js +0 -806
- package/dist/config-BqguD2Tt.js.map +0 -1
- package/dist/config-CPBd5C_b.js +0 -1201
- package/dist/config-CPBd5C_b.js.map +0 -1
- package/dist/config-DkIapO94.js +0 -955
- package/dist/config-DkIapO94.js.map +0 -1
- package/dist/config-EQZZNH9H.js +0 -955
- package/dist/config-EQZZNH9H.js.map +0 -1
- package/dist/config-qjpaJcBA.js +0 -947
- package/dist/config-qjpaJcBA.js.map +0 -1
- package/dist/deploy-BJYwLfz-.js +0 -15
- package/dist/deploy-BJYwLfz-.js.map +0 -1
- package/dist/enrollPublishAutomation-DYQMoylY.js +0 -3422
- package/dist/enrollPublishAutomation-DYQMoylY.js.map +0 -1
- package/dist/ensureAutomationSessionKey-BMHLKfjj.js +0 -85
- package/dist/ensureAutomationSessionKey-BMHLKfjj.js.map +0 -1
- package/dist/ensureAutomationSessionKey-BZ9_3FMW.js +0 -86
- package/dist/ensureAutomationSessionKey-BZ9_3FMW.js.map +0 -1
- package/dist/ensureAutomationSessionKey-Bq0PaTYE.js +0 -84
- package/dist/ensureAutomationSessionKey-Bq0PaTYE.js.map +0 -1
- package/dist/ensureAutomationSessionKey-C8D7BFjU.js +0 -85
- package/dist/ensureAutomationSessionKey-C8D7BFjU.js.map +0 -1
- package/dist/ensureAutomationSessionKey-CClLVX2w.js +0 -85
- package/dist/ensureAutomationSessionKey-CClLVX2w.js.map +0 -1
- package/dist/ensureAutomationSessionKey-CNNN1jBQ.js +0 -85
- package/dist/ensureAutomationSessionKey-CNNN1jBQ.js.map +0 -1
- package/dist/ensureAutomationSessionKey-D8Gki6U6.js +0 -85
- package/dist/ensureAutomationSessionKey-D8Gki6U6.js.map +0 -1
- package/dist/ensureAutomationSessionKey-DEH7nwUc.js +0 -86
- package/dist/ensureAutomationSessionKey-DEH7nwUc.js.map +0 -1
- package/dist/ensureAutomationSessionKey-DKriW4Hr.js +0 -85
- package/dist/ensureAutomationSessionKey-DKriW4Hr.js.map +0 -1
- package/dist/ensureAutomationSessionKey-Dhvbii2M.js +0 -86
- package/dist/ensureAutomationSessionKey-Dhvbii2M.js.map +0 -1
- package/dist/ensureAutomationSessionKey-Dyfk8qVp.js +0 -85
- package/dist/ensureAutomationSessionKey-Dyfk8qVp.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-5HJDqJJM.js +0 -24
- package/dist/ensureModularPublishBootstrap-BW8jKN_A.js +0 -24
- package/dist/ensureModularPublishBootstrap-BW8jKN_A.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-Btih5xbB.js +0 -129
- package/dist/ensureModularPublishBootstrap-Btih5xbB.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-C8wdnH1P.js +0 -128
- package/dist/ensureModularPublishBootstrap-C8wdnH1P.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-CI4U08Gc.js +0 -129
- package/dist/ensureModularPublishBootstrap-CI4U08Gc.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-CcU-hXll.js +0 -128
- package/dist/ensureModularPublishBootstrap-CcU-hXll.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-CdrykHAi.js +0 -24
- package/dist/ensureModularPublishBootstrap-CdrykHAi.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-DGBKVGg5.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-DaREOqSc.js +0 -129
- package/dist/ensureModularPublishBootstrap-DaREOqSc.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-DxIG-LUP.js +0 -24
- package/dist/ensureModularPublishBootstrap-DxIG-LUP.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-Jm1AAqBo.js +0 -127
- package/dist/ensureModularPublishBootstrap-Jm1AAqBo.js.map +0 -1
- package/dist/ensureSessionKey-D2Lq-56x.js +0 -363
- package/dist/ensureSessionKey-D2Lq-56x.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-BFPugsKJ.js +0 -48
- package/dist/ensureSmartWalletThenPublish-BFPugsKJ.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-BSYzckyS.js +0 -49
- package/dist/ensureSmartWalletThenPublish-BSYzckyS.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-Bf8FN1un.js +0 -49
- package/dist/ensureSmartWalletThenPublish-Bf8FN1un.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-Bl415Ss6.js +0 -48
- package/dist/ensureSmartWalletThenPublish-Bl415Ss6.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-Bmm5Fpat.js +0 -49
- package/dist/ensureSmartWalletThenPublish-Bmm5Fpat.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-CE7acryB.js +0 -49
- package/dist/ensureSmartWalletThenPublish-CE7acryB.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-DAomriGc.js +0 -48
- package/dist/ensureSmartWalletThenPublish-DAomriGc.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-DaZf3q5S.js +0 -48
- package/dist/ensureSmartWalletThenPublish-DaZf3q5S.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-ekb0xJRn.js +0 -48
- package/dist/ensureSmartWalletThenPublish-ekb0xJRn.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-v5fhvKxZ.js +0 -48
- package/dist/ensureSmartWalletThenPublish-v5fhvKxZ.js.map +0 -1
- package/dist/errors-Du3LNbJN.js +0 -70
- package/dist/errors-Du3LNbJN.js.map +0 -1
- package/dist/errors-PZAaDlkq.js +0 -79
- package/dist/errors-PZAaDlkq.js.map +0 -1
- package/dist/helpers/adapters/managedAccountTxSender.d.ts +0 -21
- package/dist/helpers/adapters/managedAccountTxSender.d.ts.map +0 -1
- package/dist/helpers/modularAccount/abi.d.ts +0 -173
- package/dist/helpers/modularAccount/abi.d.ts.map +0 -1
- package/dist/helpers/modularAccount/deploy.d.ts +0 -13
- package/dist/helpers/modularAccount/deploy.d.ts.map +0 -1
- package/dist/helpers/modularAccount/eip712.d.ts +0 -30
- package/dist/helpers/modularAccount/eip712.d.ts.map +0 -1
- package/dist/helpers/modularAccount/encode.d.ts +0 -16
- package/dist/helpers/modularAccount/encode.d.ts.map +0 -1
- package/dist/helpers/modularAccount/ensureModule.d.ts +0 -10
- package/dist/helpers/modularAccount/ensureModule.d.ts.map +0 -1
- package/dist/helpers/modularAccount/ensureSessionKey.d.ts +0 -25
- package/dist/helpers/modularAccount/ensureSessionKey.d.ts.map +0 -1
- package/dist/helpers/modularAccount/index.d.ts +0 -9
- package/dist/helpers/modularAccount/index.d.ts.map +0 -1
- package/dist/helpers/modularAccount/permissions.d.ts +0 -32
- package/dist/helpers/modularAccount/permissions.d.ts.map +0 -1
- package/dist/helpers/modularAccount/reads.d.ts +0 -28
- package/dist/helpers/modularAccount/reads.d.ts.map +0 -1
- package/dist/helpers/thirdwebEnrollPublishAutomation.d.ts +0 -31
- package/dist/helpers/thirdwebEnrollPublishAutomation.d.ts.map +0 -1
- package/dist/helpers/thirdwebModularBootstrap.d.ts +0 -8
- package/dist/helpers/thirdwebModularBootstrap.d.ts.map +0 -1
- package/dist/helpers/transformPayloadToIntegerIds.d.ts +0 -34
- package/dist/helpers/transformPayloadToIntegerIds.d.ts.map +0 -1
- package/dist/managedAccountAdmin-BVLGWpEb.js +0 -29
- package/dist/managedAccountAdmin-BVLGWpEb.js.map +0 -1
- package/dist/managedAccountAdmin-Bje6X8Ds.js +0 -29
- package/dist/managedAccountAdmin-Bje6X8Ds.js.map +0 -1
- package/dist/managedAccountAdmin-C84-IlQ9.js +0 -29
- package/dist/managedAccountAdmin-C84-IlQ9.js.map +0 -1
- package/dist/managedAccountAdmin-DhCRBoPX.js +0 -29
- package/dist/managedAccountAdmin-DhCRBoPX.js.map +0 -1
- package/dist/publishAuthorization-B0G1em4a.js +0 -3695
- package/dist/publishAuthorization-B0G1em4a.js.map +0 -1
- package/dist/publishAuthorization-B1BVVfp0.js +0 -3604
- package/dist/publishAuthorization-B1BVVfp0.js.map +0 -1
- package/dist/publishAuthorization-Bltn3y_K.js +0 -3599
- package/dist/publishAuthorization-Bltn3y_K.js.map +0 -1
- package/dist/publishAuthorization-By2Tt9kW.js +0 -3912
- package/dist/publishAuthorization-By2Tt9kW.js.map +0 -1
- package/dist/publishAuthorization-CSN2FsQk.js +0 -3479
- package/dist/publishAuthorization-CSN2FsQk.js.map +0 -1
- package/dist/publishAuthorization-CxBkijU6.js.map +0 -1
- package/dist/publishAuthorization-CxWY7lAQ.js +0 -3706
- package/dist/publishAuthorization-CxWY7lAQ.js.map +0 -1
- package/dist/publishAuthorization-DEriY_jm.js +0 -3687
- package/dist/publishAuthorization-DEriY_jm.js.map +0 -1
- package/dist/publishAuthorization-DfAQs1sN.js +0 -3707
- package/dist/publishAuthorization-DfAQs1sN.js.map +0 -1
- package/dist/publishAuthorization-DgdmgLTa.js +0 -3520
- package/dist/publishAuthorization-DgdmgLTa.js.map +0 -1
- package/dist/publishAuthorization-DqhhCAhd.js +0 -3652
- package/dist/publishAuthorization-DqhhCAhd.js.map +0 -1
- package/dist/publishThirdwebClient-BdgkcqM7.js +0 -18
- package/dist/publishThirdwebClient-BdgkcqM7.js.map +0 -1
- package/dist/publishThirdwebClient-BkmDN480.js +0 -18
- package/dist/publishThirdwebClient-BkmDN480.js.map +0 -1
- package/dist/publishThirdwebClient-BnDhP3N-.js +0 -18
- package/dist/publishThirdwebClient-BnDhP3N-.js.map +0 -1
- package/dist/publishThirdwebClient-CZIVmr9Z.js +0 -18
- package/dist/publishThirdwebClient-CZIVmr9Z.js.map +0 -1
- package/dist/publishThirdwebClient-DroRrOFQ.js +0 -18
- package/dist/publishThirdwebClient-DroRrOFQ.js.map +0 -1
- package/dist/publishThirdwebClient-DzXFjQ7L.js +0 -18
- package/dist/publishThirdwebClient-DzXFjQ7L.js.map +0 -1
- package/dist/publishThirdwebClient-Dzb2vcEs.js +0 -18
- package/dist/publishThirdwebClient-Dzb2vcEs.js.map +0 -1
- package/dist/publishThirdwebClient-i8P7fivi.js +0 -18
- package/dist/publishThirdwebClient-i8P7fivi.js.map +0 -1
- package/dist/publishWalletRegistry-Cugh691z.js +0 -37
- package/dist/publishWalletRegistry-Cugh691z.js.map +0 -1
- package/dist/resolveRevokeAccount-B5iXpuRT.js +0 -38
- package/dist/resolveRevokeAccount-B7ImSb4Y.js +0 -38
- package/dist/resolveRevokeAccount-B7ImSb4Y.js.map +0 -1
- package/dist/resolveRevokeAccount-BEhKQBTm.js +0 -38
- package/dist/resolveRevokeAccount-BEhKQBTm.js.map +0 -1
- package/dist/resolveRevokeAccount-BM1j2l5Q.js +0 -38
- package/dist/resolveRevokeAccount-BM1j2l5Q.js.map +0 -1
- package/dist/resolveRevokeAccount-BtVG0xxc.js +0 -38
- package/dist/resolveRevokeAccount-BtVG0xxc.js.map +0 -1
- package/dist/resolveRevokeAccount-CJZZdBcQ.js +0 -39
- package/dist/resolveRevokeAccount-CJZZdBcQ.js.map +0 -1
- package/dist/resolveRevokeAccount-CaIMuCee.js +0 -39
- package/dist/resolveRevokeAccount-CaIMuCee.js.map +0 -1
- package/dist/resolveRevokeAccount-CehU81k6.js.map +0 -1
- package/dist/resolveRevokeAccount-Cg4TQgnd.js +0 -38
- package/dist/resolveRevokeAccount-Cg4TQgnd.js.map +0 -1
- package/dist/resolveRevokeAccount-DHnxtEIj.js +0 -39
- package/dist/resolveRevokeAccount-DHnxtEIj.js.map +0 -1
- package/dist/resolveRevokeAccount-S-2WXkNh.js +0 -38
- package/dist/resolveRevokeAccount-S-2WXkNh.js.map +0 -1
- package/dist/resolveRevokeAccount-yWARIv9i.js +0 -38
- package/dist/resolveRevokeAccount-yWARIv9i.js.map +0 -1
- package/dist/seedSigner-CFzMD7Rb.js +0 -66
- package/dist/seedSigner-CFzMD7Rb.js.map +0 -1
- package/dist/thirdweb-BoksPRz3.js +0 -194
- package/dist/thirdweb-BoksPRz3.js.map +0 -1
- package/dist/thirdwebAccount-C2iOcp4_.js +0 -59
- package/dist/thirdwebAccount-C2iOcp4_.js.map +0 -1
- package/dist/worker-B1PcFPLi.js +0 -69
- package/dist/worker-B1PcFPLi.js.map +0 -1
- package/dist/worker-B8gN5WTx.js +0 -69
- package/dist/worker-B8gN5WTx.js.map +0 -1
- package/dist/worker-BCG1r0AS.js +0 -69
- package/dist/worker-BCG1r0AS.js.map +0 -1
- package/dist/worker-BgErCNTb.js +0 -69
- package/dist/worker-BgErCNTb.js.map +0 -1
- package/dist/worker-C07rPV2G.js +0 -69
- package/dist/worker-C07rPV2G.js.map +0 -1
- package/dist/worker-C9Za_dlQ.js +0 -69
- package/dist/worker-C9Za_dlQ.js.map +0 -1
- package/dist/worker-CEgulQnm.js +0 -69
- package/dist/worker-CEgulQnm.js.map +0 -1
- package/dist/worker-C_TL94He.js +0 -69
- package/dist/worker-C_TL94He.js.map +0 -1
- package/dist/worker-DBC_g-3I.js +0 -69
- package/dist/worker-DBC_g-3I.js.map +0 -1
- package/dist/worker-DypHzXgH.js +0 -69
- package/dist/worker-DypHzXgH.js.map +0 -1
- package/dist/worker-ZL4Wg19t.js +0 -69
- package/dist/worker-ZL4Wg19t.js.map +0 -1
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { _ as e, o as t } from "./chainConfig-3wlYarAG.js";
|
|
2
|
-
import { A as n, F as r, L as i, M as a } from "./publishAuthorization-DfAQs1sN.js";
|
|
3
|
-
import { t as o } from "./publishThirdwebClient-i8P7fivi.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-Cg4TQgnd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveRevokeAccount-Cg4TQgnd.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"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { r as e } from "./config-DkIapO94.js";
|
|
2
|
-
import { A as t, F as n, N as r, O as i } from "./publishAuthorization-B1BVVfp0.js";
|
|
3
|
-
import { t as a } from "./publishThirdwebClient-BkmDN480.js";
|
|
4
|
-
import { getGetAdditionalSyncAddresses as o } from "@seedprotocol/sdk";
|
|
5
|
-
import { optimismSepolia as s } from "thirdweb/chains";
|
|
6
|
-
//#region src/helpers/resolveRevokeAccount.ts
|
|
7
|
-
async function c(c) {
|
|
8
|
-
let { account: l, attester: u } = c;
|
|
9
|
-
if (!u || l.address.toLowerCase() === u.toLowerCase()) return l;
|
|
10
|
-
let d = o(), f = !1;
|
|
11
|
-
if (d) {
|
|
12
|
-
let e = await d(), t = u.toLowerCase();
|
|
13
|
-
f = !!e?.some((e) => e?.toLowerCase() === t);
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
let e = await r(l.address);
|
|
17
|
-
if (u.toLowerCase() === e.toLowerCase() || f) {
|
|
18
|
-
let r = f ? await i(s).catch(() => e) : e;
|
|
19
|
-
if (await n(r)) {
|
|
20
|
-
let e = t();
|
|
21
|
-
await e.autoConnect({
|
|
22
|
-
client: a(),
|
|
23
|
-
chain: s
|
|
24
|
-
});
|
|
25
|
-
let n = e.getAccount();
|
|
26
|
-
if (n) return n;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
} catch {}
|
|
30
|
-
if (f) {
|
|
31
|
-
let { modularAccountModuleContract: t } = e();
|
|
32
|
-
throw t?.trim() ? Error("Revocation not supported for items published via the modular executor. Connect the ManagedAccount that controls the executor module.") : Error("Revocation not supported for items published via the modular executor.");
|
|
33
|
-
}
|
|
34
|
-
return l;
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
export { c as resolveRevokeAccount };
|
|
38
|
-
|
|
39
|
-
//# sourceMappingURL=resolveRevokeAccount-DHnxtEIj.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveRevokeAccount-DHnxtEIj.js","names":[],"sources":["../src/helpers/resolveRevokeAccount.ts"],"sourcesContent":["import type { Account } from 'thirdweb/wallets'\nimport { optimismSepolia } from 'thirdweb/chains'\nimport { getGetAdditionalSyncAddresses } from '@seedprotocol/sdk'\nimport { getPublishConfig } from '~/config'\nimport {\n getClient,\n getSmartWalletAddressForAdmin,\n isSmartWalletDeployed,\n getManagedAccountWallet,\n getConnectedManagedAccountAddress,\n} from '~/helpers/thirdweb'\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(optimismSepolia).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: optimismSepolia,\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,CAAe,CAAC,CAAC,YAAY,CAAqB,IAC1F;GAEJ,IAAI,MADmB,EAAsB,CAAc,GAC7C;IACZ,IAAM,IAAuB,EAAwB;IACrD,MAAM,EAAqB,YAAY;KACrC,QAAQ,EAAU;KAClB,OAAO;IACT,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"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { _ as e, o as t } from "./chainConfig-BYm5OXpk.js";
|
|
2
|
-
import { A as n, F as r, L as i, M as a } from "./publishAuthorization-CxBkijU6.js";
|
|
3
|
-
import { t as o } from "./publishThirdwebClient-BnDhP3N-.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-S-2WXkNh.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveRevokeAccount-S-2WXkNh.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"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { r as e } from "./config-BqguD2Tt.js";
|
|
2
|
-
import { a as t, f as n, l as r, m as i, s as a } from "./thirdweb-BoksPRz3.js";
|
|
3
|
-
import { getGetAdditionalSyncAddresses as o } from "@seedprotocol/sdk";
|
|
4
|
-
import { optimismSepolia as s } from "thirdweb/chains";
|
|
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 = o(), 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 e = await n(l.address);
|
|
16
|
-
if (u.toLowerCase() === e.toLowerCase() || f) {
|
|
17
|
-
let n = f ? await a(s).catch(() => e) : e;
|
|
18
|
-
if (await i(n)) {
|
|
19
|
-
let e = r();
|
|
20
|
-
await e.autoConnect({
|
|
21
|
-
client: t(),
|
|
22
|
-
chain: s
|
|
23
|
-
});
|
|
24
|
-
let n = e.getAccount();
|
|
25
|
-
if (n) return n;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
} catch {}
|
|
29
|
-
if (f) {
|
|
30
|
-
let { modularAccountModuleContract: t } = e();
|
|
31
|
-
throw t?.trim() ? Error("Revocation not supported for items published via the modular executor. Connect the ManagedAccount that controls the executor module.") : Error("Revocation not supported for items published via the modular executor.");
|
|
32
|
-
}
|
|
33
|
-
return l;
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
export { c as resolveRevokeAccount };
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=resolveRevokeAccount-yWARIv9i.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveRevokeAccount-yWARIv9i.js","names":[],"sources":["../src/helpers/resolveRevokeAccount.ts"],"sourcesContent":["import type { Account } from 'thirdweb/wallets'\nimport { optimismSepolia } from 'thirdweb/chains'\nimport { getGetAdditionalSyncAddresses } from '@seedprotocol/sdk'\nimport { getPublishConfig } from '~/config'\nimport {\n getClient,\n getSmartWalletAddressForAdmin,\n isSmartWalletDeployed,\n getManagedAccountWallet,\n getConnectedManagedAccountAddress,\n} from '~/helpers/thirdweb'\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(optimismSepolia).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: optimismSepolia,\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,CAAe,CAAC,CAAC,YAAY,CAAqB,IAC1F;GAEJ,IAAI,MADmB,EAAsB,CAAc,GAC7C;IACZ,IAAM,IAAuB,EAAwB;IACrD,MAAM,EAAqB,YAAY;KACrC,QAAQ,EAAU;KAClB,OAAO;IACT,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"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { ethers as e } from "ethers";
|
|
2
|
-
//#region src/helpers/seedSigner.ts
|
|
3
|
-
function t(e) {
|
|
4
|
-
if (typeof e.signTypedData != "function") throw Error("@seedprotocol/publish: SeedSigner.signTypedData is required for ManagedAccount session keys / AA. Use fromEthersWallet, fromEip1193Provider, fromThirdwebAccount, or implement signTypedData on your signer.");
|
|
5
|
-
return e.signTypedData.bind(e);
|
|
6
|
-
}
|
|
7
|
-
var n = Symbol.for("seedprotocol.SeedSigner"), r = Symbol.for("seedprotocol.SeedTxSender");
|
|
8
|
-
function i(e) {
|
|
9
|
-
return Object.assign(e, { [n]: !0 });
|
|
10
|
-
}
|
|
11
|
-
function a(e) {
|
|
12
|
-
return Object.assign(e, { [r]: !0 });
|
|
13
|
-
}
|
|
14
|
-
function o(e) {
|
|
15
|
-
return !!e && typeof e == "object" && n in e;
|
|
16
|
-
}
|
|
17
|
-
function s(e) {
|
|
18
|
-
return !!e && typeof e == "object" && r in e;
|
|
19
|
-
}
|
|
20
|
-
function c(e) {
|
|
21
|
-
return !!e && typeof e == "object" && "signer" in e && "txSender" in e && o(e.signer) && s(e.txSender);
|
|
22
|
-
}
|
|
23
|
-
function l(t) {
|
|
24
|
-
let n = t.address;
|
|
25
|
-
return {
|
|
26
|
-
signer: i({
|
|
27
|
-
address: n,
|
|
28
|
-
signMessage: async ({ message: n }) => {
|
|
29
|
-
if (typeof n == "string") return await t.signMessage(n);
|
|
30
|
-
let r = n.raw, i = typeof r == "string" ? e.getBytes(r) : r instanceof Uint8Array ? r : new Uint8Array(r);
|
|
31
|
-
return await t.signMessage(i);
|
|
32
|
-
},
|
|
33
|
-
signTypedData: async (e) => {
|
|
34
|
-
let { domain: n, types: r, message: i } = e, { EIP712Domain: a, ...o } = r;
|
|
35
|
-
return await t.signTypedData(n, o, i);
|
|
36
|
-
}
|
|
37
|
-
}),
|
|
38
|
-
txSender: a({
|
|
39
|
-
address: n,
|
|
40
|
-
sendTransaction: async (e) => ({ transactionHash: (await t.sendTransaction({
|
|
41
|
-
to: e.to,
|
|
42
|
-
data: e.data,
|
|
43
|
-
value: e.value,
|
|
44
|
-
gasLimit: e.gas
|
|
45
|
-
})).hash })
|
|
46
|
-
})
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function u(e) {
|
|
50
|
-
if (c(e)) return e.signer;
|
|
51
|
-
if (o(e)) return e;
|
|
52
|
-
throw Error("@seedprotocol/publish: expected a SeedSigner or PublishWallet. Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
|
|
53
|
-
}
|
|
54
|
-
function d(e) {
|
|
55
|
-
if (c(e)) return e.txSender;
|
|
56
|
-
if (s(e)) return e;
|
|
57
|
-
throw Error("@seedprotocol/publish: expected a SeedTxSender or PublishWallet. Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
|
|
58
|
-
}
|
|
59
|
-
function f(e) {
|
|
60
|
-
if (c(e)) return e;
|
|
61
|
-
throw Error("@seedprotocol/publish: expected a PublishWallet (signer + txSender). Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
|
|
62
|
-
}
|
|
63
|
-
//#endregion
|
|
64
|
-
export { a, o as c, i, s as l, u as n, l as o, d as r, c as s, f as t, t as u };
|
|
65
|
-
|
|
66
|
-
//# sourceMappingURL=seedSigner-CFzMD7Rb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"seedSigner-CFzMD7Rb.js","names":[],"sources":["../src/helpers/seedSigner.ts"],"sourcesContent":["import type { Address, Hex, SignableMessage, TypedDataDefinition } from 'viem'\nimport { ethers } from 'ethers'\n\n/** Encoded calldata ready for submission (viem path). */\nexport type SeedTxRequest = {\n to: Address\n data: Hex\n value?: bigint\n gas?: bigint\n}\n\n/**\n * Vendor-neutral key custody for Arweave DataItems and message signing.\n * Does not submit on-chain transactions.\n */\nexport interface SeedSigner {\n readonly address: Address\n\n /**\n * personal_sign. For Arweave/ANS-104 use `message: { raw: Hex | Uint8Array }`.\n * Plain string is UTF-8 prefixed hash.\n */\n signMessage(args: { message: SignableMessage }): Promise<Hex>\n\n /**\n * EIP-712 typed data (optional). Required for ManagedAccount session-key grants\n * and AA UserOp paths that need `signTypedData`.\n */\n signTypedData?(args: TypedDataDefinition): Promise<Hex>\n}\n\n/** Throw when modular / AA helpers need EIP-712 and the signer lacks it. */\nexport function requireSignTypedData(\n signer: SeedSigner,\n): (args: TypedDataDefinition) => Promise<Hex> {\n if (typeof signer.signTypedData !== 'function') {\n throw new Error(\n '@seedprotocol/publish: SeedSigner.signTypedData is required for ManagedAccount session keys / AA. Use fromEthersWallet, fromEip1193Provider, fromThirdwebAccount, or implement signTypedData on your signer.',\n )\n }\n return signer.signTypedData.bind(signer)\n}\n\n/**\n * Vendor-neutral transaction submission (EOA, AA, sponsored, etc.).\n */\nexport interface SeedTxSender {\n readonly address: Address\n\n /** Submit already-encoded calldata. */\n sendTransaction(tx: SeedTxRequest): Promise<{ transactionHash: Hex }>\n\n waitForReceipt?(transactionHash: Hex): Promise<{ status: 'success' | 'reverted' }>\n}\n\n/** Bundle used by publish / revoke flows that need both signing and sending. */\nexport type PublishWallet = {\n signer: SeedSigner\n txSender: SeedTxSender\n}\n\nconst SEED_SIGNER_BRAND = Symbol.for('seedprotocol.SeedSigner')\nconst SEED_TX_SENDER_BRAND = Symbol.for('seedprotocol.SeedTxSender')\n\ntype BrandedSeedSigner = SeedSigner & { readonly [SEED_SIGNER_BRAND]: true }\ntype BrandedSeedTxSender = SeedTxSender & { readonly [SEED_TX_SENDER_BRAND]: true }\n\nfunction brandSigner(signer: SeedSigner): SeedSigner {\n return Object.assign(signer, { [SEED_SIGNER_BRAND]: true as const }) as BrandedSeedSigner\n}\n\nfunction brandTxSender(sender: SeedTxSender): SeedTxSender {\n return Object.assign(sender, { [SEED_TX_SENDER_BRAND]: true as const }) as BrandedSeedTxSender\n}\n\nexport function isSeedSigner(value: unknown): value is SeedSigner {\n return !!value && typeof value === 'object' && SEED_SIGNER_BRAND in value\n}\n\nexport function isSeedTxSender(value: unknown): value is SeedTxSender {\n return !!value && typeof value === 'object' && SEED_TX_SENDER_BRAND in value\n}\n\nexport function isPublishWallet(value: unknown): value is PublishWallet {\n return (\n !!value &&\n typeof value === 'object' &&\n 'signer' in value &&\n 'txSender' in value &&\n isSeedSigner((value as PublishWallet).signer) &&\n isSeedTxSender((value as PublishWallet).txSender)\n )\n}\n\n/**\n * Wrap an ethers Wallet for tests / EOA scripts (signs + sends; no AA sponsorship).\n * Suitable for ANS-104 DataItem signing. Not a ManagedAccount session-key UserOp sender —\n * for automation on-chain publish, use a PublishWallet whose txSender submits UserOps\n * through the ManagedAccount (see docs/PUBLISH_AUTOMATION.md).\n */\nexport function fromEthersWallet(wallet: ethers.Wallet): PublishWallet {\n const address = wallet.address as Address\n const signer = brandSigner({\n address,\n signMessage: async ({ message }) => {\n if (typeof message === 'string') {\n return (await wallet.signMessage(message)) as Hex\n }\n const raw = message.raw\n const bytes =\n typeof raw === 'string'\n ? ethers.getBytes(raw)\n : raw instanceof Uint8Array\n ? raw\n : new Uint8Array(raw)\n return (await wallet.signMessage(bytes)) as Hex\n },\n signTypedData: async (args) => {\n const { domain, types, message } = args\n const typesRecord = types as unknown as Record<\n string,\n Array<{ name: string; type: string }>\n >\n const { EIP712Domain: _eip712Domain, ...typesWithoutDomain } = typesRecord\n return (await wallet.signTypedData(\n domain as ethers.TypedDataDomain,\n typesWithoutDomain,\n message as Record<string, unknown>,\n )) as Hex\n },\n })\n const txSender = brandTxSender({\n address,\n sendTransaction: async (tx) => {\n const result = await wallet.sendTransaction({\n to: tx.to,\n data: tx.data,\n value: tx.value,\n gasLimit: tx.gas,\n })\n return { transactionHash: result.hash as Hex }\n },\n })\n return { signer, txSender }\n}\n\n/**\n * Coerce a branded SeedSigner, PublishWallet.signer, or pass-through unknown branded value.\n * Does not wrap Thirdweb Accounts — use `fromThirdwebAccount` from `@seedprotocol/publish/thirdweb`.\n */\nexport function asSeedSigner(value: SeedSigner | PublishWallet): SeedSigner {\n if (isPublishWallet(value)) return value.signer\n if (isSeedSigner(value)) return value\n throw new Error(\n '@seedprotocol/publish: expected a SeedSigner or PublishWallet. Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.',\n )\n}\n\n/** Resolve tx sender from a PublishWallet or branded SeedTxSender. */\nexport function asSeedTxSender(value: SeedTxSender | PublishWallet): SeedTxSender {\n if (isPublishWallet(value)) return value.txSender\n if (isSeedTxSender(value)) return value\n throw new Error(\n '@seedprotocol/publish: expected a SeedTxSender or PublishWallet. Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.',\n )\n}\n\n/** Prefer PublishWallet; if only a branded SeedSigner is passed, throw (tx path needs a sender). */\nexport function asPublishWallet(value: PublishWallet | SeedSigner): PublishWallet {\n if (isPublishWallet(value)) return value\n throw new Error(\n '@seedprotocol/publish: expected a PublishWallet (signer + txSender). Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.',\n )\n}\n\n/** @internal used by optional Thirdweb adapter */\nexport { brandSigner, brandTxSender }\n"],"mappings":";;AAgCA,SAAgB,EACd,GAC6C;CAC7C,IAAI,OAAO,EAAO,iBAAkB,YAClC,MAAU,MACR,8MACF;CAEF,OAAO,EAAO,cAAc,KAAK,CAAM;AACzC;AAoBA,IAAM,IAAoB,OAAO,IAAI,yBAAyB,GACxD,IAAuB,OAAO,IAAI,2BAA2B;AAKnE,SAAS,EAAY,GAAgC;CACnD,OAAO,OAAO,OAAO,GAAQ,GAAG,IAAoB,GAAc,CAAC;AACrE;AAEA,SAAS,EAAc,GAAoC;CACzD,OAAO,OAAO,OAAO,GAAQ,GAAG,IAAuB,GAAc,CAAC;AACxE;AAEA,SAAgB,EAAa,GAAqC;CAChE,OAAO,CAAC,CAAC,KAAS,OAAO,KAAU,YAAY,KAAqB;AACtE;AAEA,SAAgB,EAAe,GAAuC;CACpE,OAAO,CAAC,CAAC,KAAS,OAAO,KAAU,YAAY,KAAwB;AACzE;AAEA,SAAgB,EAAgB,GAAwC;CACtE,OACE,CAAC,CAAC,KACF,OAAO,KAAU,YACjB,YAAY,KACZ,cAAc,KACd,EAAc,EAAwB,MAAM,KAC5C,EAAgB,EAAwB,QAAQ;AAEpD;AAQA,SAAgB,EAAiB,GAAsC;CACrE,IAAM,IAAU,EAAO;CA0CvB,OAAO;EAAE,QAzCM,EAAY;GACzB;GACA,aAAa,OAAO,EAAE,iBAAc;IAClC,IAAI,OAAO,KAAY,UACrB,OAAQ,MAAM,EAAO,YAAY,CAAO;IAE1C,IAAM,IAAM,EAAQ,KACd,IACJ,OAAO,KAAQ,WACX,EAAO,SAAS,CAAG,IACnB,aAAe,aACb,IACA,IAAI,WAAW,CAAG;IAC1B,OAAQ,MAAM,EAAO,YAAY,CAAK;GACxC;GACA,eAAe,OAAO,MAAS;IAC7B,IAAM,EAAE,WAAQ,UAAO,eAAY,GAK7B,EAAE,cAAc,GAAe,GAAG,MAAuB;IAC/D,OAAQ,MAAM,EAAO,cACnB,GACA,GACA,CACF;GACF;EACF,CAaS;EAAQ,UAZA,EAAc;GAC7B;GACA,iBAAiB,OAAO,OAOf,EAAE,kBAAiB,MANL,EAAO,gBAAgB;IAC1C,IAAI,EAAG;IACP,MAAM,EAAG;IACT,OAAO,EAAG;IACV,UAAU,EAAG;GACf,CAAC,EAAA,CACgC,KAAY;EAEjD,CACiB;CAAS;AAC5B;AAMA,SAAgB,EAAa,GAA+C;CAC1E,IAAI,EAAgB,CAAK,GAAG,OAAO,EAAM;CACzC,IAAI,EAAa,CAAK,GAAG,OAAO;CAChC,MAAU,MACR,mIACF;AACF;AAGA,SAAgB,EAAe,GAAmD;CAChF,IAAI,EAAgB,CAAK,GAAG,OAAO,EAAM;CACzC,IAAI,EAAe,CAAK,GAAG,OAAO;CAClC,MAAU,MACR,qIACF;AACF;AAGA,SAAgB,EAAgB,GAAkD;CAChF,IAAI,EAAgB,CAAK,GAAG,OAAO;CACnC,MAAU,MACR,yIACF;AACF"}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { D as t, E as n, b as r, r as i, z as a } from "./config-BqguD2Tt.js";
|
|
3
|
-
import { useEffect as o, useRef as s, useState as c } from "react";
|
|
4
|
-
import l from "debug";
|
|
5
|
-
import { createThirdwebClient as u, deploySmartAccount as d, getContract as f } from "thirdweb";
|
|
6
|
-
import { optimismSepolia as p } from "thirdweb/chains";
|
|
7
|
-
import { createWallet as m, inAppWallet as h } from "thirdweb/wallets";
|
|
8
|
-
import { useActiveAccount as g } from "thirdweb/react";
|
|
9
|
-
//#region src/helpers/thirdweb.ts
|
|
10
|
-
var _ = /* @__PURE__ */ e({
|
|
11
|
-
ExternalWalletsForDeploy: () => N,
|
|
12
|
-
appMetadata: () => I,
|
|
13
|
-
deployManagedAccountViaFactory: () => F,
|
|
14
|
-
deploySmartWalletContract: () => P,
|
|
15
|
-
getClient: () => T,
|
|
16
|
-
getConnectedAccount: () => R,
|
|
17
|
-
getConnectedManagedAccountAddress: () => L,
|
|
18
|
-
getConnectedModularAccount: () => z,
|
|
19
|
-
getManagedAccountWallet: () => V,
|
|
20
|
-
getModularAccountWallet: () => U,
|
|
21
|
-
getSharedPublishInAppWalletStorage: () => x,
|
|
22
|
-
getSmartWalletAddressForAdmin: () => k,
|
|
23
|
-
getWalletsForConnectButton: () => G,
|
|
24
|
-
isSmartWalletDeployed: () => A,
|
|
25
|
-
pollSmartWalletDeployed: () => j,
|
|
26
|
-
resolveSmartWalletForPublish: () => M,
|
|
27
|
-
syncPublishInAppAuthToken: () => S,
|
|
28
|
-
useActiveSmartWalletContract: () => O,
|
|
29
|
-
useLocalWalletAccount: () => D,
|
|
30
|
-
wallets: () => E
|
|
31
|
-
}), v = l("permaPress:helpers:thirdweb"), y = "seedProtocol:inAppPublish:", b = null;
|
|
32
|
-
function x() {
|
|
33
|
-
return b ||= {
|
|
34
|
-
getItem: async (e) => typeof window > "u" ? null : localStorage.getItem(y + e),
|
|
35
|
-
setItem: async (e, t) => {
|
|
36
|
-
typeof window > "u" || localStorage.setItem(y + e, t);
|
|
37
|
-
},
|
|
38
|
-
removeItem: async (e) => {
|
|
39
|
-
typeof window > "u" || localStorage.removeItem(y + e);
|
|
40
|
-
}
|
|
41
|
-
}, b;
|
|
42
|
-
}
|
|
43
|
-
function S() {
|
|
44
|
-
if (typeof window > "u") return {
|
|
45
|
-
syncedBareToPrefixed: !1,
|
|
46
|
-
syncedPrefixedToBare: !1
|
|
47
|
-
};
|
|
48
|
-
let { thirdwebClientId: e } = i();
|
|
49
|
-
if (!e) return {
|
|
50
|
-
syncedBareToPrefixed: !1,
|
|
51
|
-
syncedPrefixedToBare: !1
|
|
52
|
-
};
|
|
53
|
-
try {
|
|
54
|
-
let t = `walletToken-${e}`, n = `${y}${t}`, r = localStorage.getItem(t), i = localStorage.getItem(n), a = !1, o = !1;
|
|
55
|
-
return r && !i && (localStorage.setItem(n, r), a = !0), i && !r && (localStorage.setItem(t, i), o = !0), i && r && r !== i && (localStorage.setItem(t, i), o = !0), {
|
|
56
|
-
syncedBareToPrefixed: a,
|
|
57
|
-
syncedPrefixedToBare: o
|
|
58
|
-
};
|
|
59
|
-
} catch {
|
|
60
|
-
return {
|
|
61
|
-
syncedBareToPrefixed: !1,
|
|
62
|
-
syncedPrefixedToBare: !1
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async function C(e = p) {
|
|
67
|
-
S();
|
|
68
|
-
let t = V();
|
|
69
|
-
return await t.autoConnect({
|
|
70
|
-
client: T(),
|
|
71
|
-
chain: e
|
|
72
|
-
}), t;
|
|
73
|
-
}
|
|
74
|
-
var w = null;
|
|
75
|
-
function T() {
|
|
76
|
-
if (!w) {
|
|
77
|
-
let { thirdwebClientId: e } = i();
|
|
78
|
-
if (!e) throw Error("@seedprotocol/publish/thirdweb: thirdwebClientId is required. Pass it in initPublish / PublishProvider config.");
|
|
79
|
-
w = u({ clientId: e });
|
|
80
|
-
}
|
|
81
|
-
return w;
|
|
82
|
-
}
|
|
83
|
-
var E = [m("io.metamask")], D = () => {
|
|
84
|
-
let [e, t] = c(null);
|
|
85
|
-
return m("io.metamask"), s(!1), o(() => {}, []), e;
|
|
86
|
-
}, O = () => {
|
|
87
|
-
let e = g(), [t, n] = c(null);
|
|
88
|
-
return o(() => {
|
|
89
|
-
e && e.address && n(f({
|
|
90
|
-
client: T(),
|
|
91
|
-
chain: p,
|
|
92
|
-
address: e.address
|
|
93
|
-
}));
|
|
94
|
-
}, [e]), t;
|
|
95
|
-
};
|
|
96
|
-
async function k(e, t = "0x") {
|
|
97
|
-
return r(e, t);
|
|
98
|
-
}
|
|
99
|
-
async function A(e) {
|
|
100
|
-
return n(e);
|
|
101
|
-
}
|
|
102
|
-
async function j(e, n, r) {
|
|
103
|
-
return t(e, n, r);
|
|
104
|
-
}
|
|
105
|
-
async function M(e) {
|
|
106
|
-
if (!e) return { needsDeploy: !0 };
|
|
107
|
-
if (await A(e.address)) return {
|
|
108
|
-
address: e.address,
|
|
109
|
-
account: e
|
|
110
|
-
};
|
|
111
|
-
let t = await k(e.address);
|
|
112
|
-
return await A(t) ? {
|
|
113
|
-
address: t,
|
|
114
|
-
account: e
|
|
115
|
-
} : { needsDeploy: !0 };
|
|
116
|
-
}
|
|
117
|
-
var N = [m("io.metamask"), m("me.rainbow")], P = async (e) => {
|
|
118
|
-
let t = f({
|
|
119
|
-
client: T(),
|
|
120
|
-
chain: p,
|
|
121
|
-
address: e.address
|
|
122
|
-
}), n = await d({
|
|
123
|
-
smartAccount: e,
|
|
124
|
-
chain: p,
|
|
125
|
-
client: T(),
|
|
126
|
-
accountContract: t
|
|
127
|
-
});
|
|
128
|
-
return v("deploySmartAccount result:", n), n;
|
|
129
|
-
};
|
|
130
|
-
async function F(e) {
|
|
131
|
-
let { asThirdwebPublishWallet: t } = await import("./thirdwebAccount-C2iOcp4_.js").then((e) => e.i), { deployManagedAccountViaFactory: n } = await import("./deploy-BJYwLfz-.js").then((e) => e.n), r = t(e.signingAccount);
|
|
132
|
-
await n({
|
|
133
|
-
adminAddress: e.adminAddress,
|
|
134
|
-
signingWallet: r,
|
|
135
|
-
data: e.data ?? "0x"
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
var I = {
|
|
139
|
-
name: "Seed Protocol",
|
|
140
|
-
description: "Seed Protocol",
|
|
141
|
-
url: "https://seedprotocol.io"
|
|
142
|
-
};
|
|
143
|
-
async function L(e = p) {
|
|
144
|
-
let t = (await C(e)).getAccount();
|
|
145
|
-
if (!t) throw Error("Failed to get managed account");
|
|
146
|
-
return t.address;
|
|
147
|
-
}
|
|
148
|
-
async function R() {
|
|
149
|
-
try {
|
|
150
|
-
let e = U();
|
|
151
|
-
return await e.autoConnect({
|
|
152
|
-
client: T(),
|
|
153
|
-
chain: p
|
|
154
|
-
}), e.getAccount() ?? null;
|
|
155
|
-
} catch {
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
async function z() {
|
|
160
|
-
return R();
|
|
161
|
-
}
|
|
162
|
-
var B = null, V = () => (B ||= h({
|
|
163
|
-
storage: x(),
|
|
164
|
-
auth: { options: [
|
|
165
|
-
"farcaster",
|
|
166
|
-
"email",
|
|
167
|
-
"passkey",
|
|
168
|
-
"phone"
|
|
169
|
-
] },
|
|
170
|
-
executionMode: {
|
|
171
|
-
mode: "EIP4337",
|
|
172
|
-
smartAccount: {
|
|
173
|
-
chain: p,
|
|
174
|
-
factoryAddress: a,
|
|
175
|
-
gasless: !0
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}), B), H = null, U = () => (H ||= h({
|
|
179
|
-
storage: x(),
|
|
180
|
-
auth: { options: [
|
|
181
|
-
"farcaster",
|
|
182
|
-
"email",
|
|
183
|
-
"passkey",
|
|
184
|
-
"phone"
|
|
185
|
-
] },
|
|
186
|
-
executionMode: {
|
|
187
|
-
mode: "EIP7702",
|
|
188
|
-
sponsorGas: !0
|
|
189
|
-
}
|
|
190
|
-
}), H), W = null, G = () => (W ||= i().useModularExecutor ? [U()] : [V()], W);
|
|
191
|
-
//#endregion
|
|
192
|
-
export { S as _, T as a, D as b, z as c, x as d, k as f, M as g, j as h, P as i, V as l, A as m, I as n, R as o, G as p, F as r, L as s, N as t, U as u, _ as v, E as x, O as y };
|
|
193
|
-
|
|
194
|
-
//# sourceMappingURL=thirdweb-BoksPRz3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"thirdweb-BoksPRz3.js","names":[],"sources":["../src/helpers/thirdweb.ts"],"sourcesContent":["import { createThirdwebClient, deploySmartAccount, getContract, } from 'thirdweb'\nimport { createWallet, Account, inAppWallet, type Wallet, } from 'thirdweb/wallets'\nimport { useActiveAccount } from 'thirdweb/react'\nimport { ThirdwebContract, } from 'thirdweb/contract'\nimport { useEffect, useRef, useState, } from 'react'\nimport type { Chain } from 'thirdweb/chains'\nimport { optimismSepolia, } from 'thirdweb/chains'\nimport type { Address, Hex } from 'viem'\nimport debug from 'debug'\nimport { getPublishConfig } from '../config'\nimport {\n isContractDeployed,\n pollSmartWalletDeployed as pollDeployed,\n} from './chainClient'\nimport { readFactoryGetAddress } from './contracts'\nimport type { PublishWallet } from './seedSigner'\nimport { THIRDWEB_ACCOUNT_FACTORY_ADDRESS } from './constants'\n\nconst logger = debug('permaPress:helpers:thirdweb')\n\n/**\n * Custom storage for publish in-app wallets: same prefix for modular (EIP-7702) and managed (EIP-4337).\n * Uses `localStorage` so embedded-wallet session material survives app/tab restarts.\n */\nconst SEED_IN_APP_SESSION_PREFIX = 'seedProtocol:inAppPublish:'\n\nlet _publishInAppWalletStorage: {\n getItem: (key: string) => Promise<string | null>\n setItem: (key: string, value: string) => Promise<void>\n removeItem: (key: string) => Promise<void>\n} | null = null\n\nexport function getSharedPublishInAppWalletStorage() {\n if (!_publishInAppWalletStorage) {\n _publishInAppWalletStorage = {\n getItem: async (key) => {\n if (typeof window === 'undefined') return null\n return localStorage.getItem(SEED_IN_APP_SESSION_PREFIX + key)\n },\n setItem: async (key, value) => {\n if (typeof window === 'undefined') return\n localStorage.setItem(SEED_IN_APP_SESSION_PREFIX + key, value)\n },\n removeItem: async (key) => {\n if (typeof window === 'undefined') return\n localStorage.removeItem(SEED_IN_APP_SESSION_PREFIX + key)\n },\n }\n }\n return _publishInAppWalletStorage\n}\n\n/**\n * Copies Thirdweb in-app auth tokens between default localStorage keys and the\n * prefixed keys used by publish in-app wallets (`seedProtocol:inAppPublish:`).\n *\n * Modular ConnectButton writes the fresh session to prefixed storage; bare may be\n * stale. Prefer prefixed when both exist so managed-wallet autoConnect does not\n * overwrite a valid JWT with an old bare token.\n */\nexport function syncPublishInAppAuthToken(): {\n syncedBareToPrefixed: boolean\n syncedPrefixedToBare: boolean\n} {\n if (typeof window === 'undefined') {\n return { syncedBareToPrefixed: false, syncedPrefixedToBare: false }\n }\n const { thirdwebClientId } = getPublishConfig()\n if (!thirdwebClientId) {\n return { syncedBareToPrefixed: false, syncedPrefixedToBare: false }\n }\n try {\n const bareKey = `walletToken-${thirdwebClientId}`\n const prefixedKey = `${SEED_IN_APP_SESSION_PREFIX}${bareKey}`\n const bare = localStorage.getItem(bareKey)\n const prefixed = localStorage.getItem(prefixedKey)\n\n let syncedBareToPrefixed = false\n let syncedPrefixedToBare = false\n\n // Only copy bare → prefixed when prefixed is missing (cold-start / refresh recovery).\n if (bare && !prefixed) {\n localStorage.setItem(prefixedKey, bare)\n syncedBareToPrefixed = true\n }\n if (prefixed && !bare) {\n localStorage.setItem(bareKey, prefixed)\n syncedPrefixedToBare = true\n }\n if (prefixed && bare && bare !== prefixed) {\n localStorage.setItem(bareKey, prefixed)\n syncedPrefixedToBare = true\n }\n\n return { syncedBareToPrefixed, syncedPrefixedToBare }\n } catch {\n return { syncedBareToPrefixed: false, syncedPrefixedToBare: false }\n }\n}\n\nasync function connectManagedAccountWallet(chain: Chain = optimismSepolia) {\n syncPublishInAppAuthToken()\n const managedAccountWallet = getManagedAccountWallet()\n await managedAccountWallet.autoConnect({ client: getClient(), chain })\n return managedAccountWallet\n}\n\nlet _client: ReturnType<typeof createThirdwebClient> | null = null\n\nexport function getClient() {\n if (!_client) {\n const { thirdwebClientId } = getPublishConfig()\n if (!thirdwebClientId) {\n throw new Error(\n '@seedprotocol/publish/thirdweb: thirdwebClientId is required. Pass it in initPublish / PublishProvider config.',\n )\n }\n _client = createThirdwebClient({ clientId: thirdwebClientId })\n }\n return _client\n}\n\nexport const wallets = [\n // embeddedWallet(),\n createWallet('io.metamask',),\n // createWallet(\"com.coinbase.wallet\"),\n // createWallet(\"me.rainbow\"),\n]\n\nexport const useLocalWalletAccount = () => {\n\n const [ localWalletAccount, setLocalWalletAccount, ] = useState<Account | null>(null,)\n const personalWallet = createWallet('io.metamask',)\n\n const isConnecting = useRef(false)\n\n useEffect(() => {\n const _getAccount = async (): Promise<void> => {\n // if ( isConnecting.current ) {\n // return\n // }\n // isConnecting.current = true\n\n // const personalAccount = await personalWallet.connect({ client, },)\n // if ( !personalAccount ) {\n // throw new Error('Failed to connect to personal account',)\n // }\n\n // setLocalWalletAccount(personalAccount,)\n // isConnecting.current = false\n }\n\n _getAccount()\n\n }, [],)\n\n return localWalletAccount\n\n}\n\nexport const useActiveSmartWalletContract = () => {\n const account = useActiveAccount()\n\n const [ contract, setContract, ] = useState<ThirdwebContract | null>(null,)\n\n useEffect(() => {\n if ( !account || !account.address ) {\n return\n }\n\n setContract(getContract({\n client: getClient(),\n chain : optimismSepolia,\n address : account.address,\n },),)\n\n }, [ account, ],)\n\n return contract\n}\n\n/**\n * Returns the deterministic smart wallet address for an admin signer and optional data.\n */\nexport async function getSmartWalletAddressForAdmin (\n adminAddress: string,\n data: string = '0x',\n): Promise<string> {\n return readFactoryGetAddress(adminAddress as Address, data as Hex)\n}\n\n/**\n * Returns true if the given address has contract bytecode deployed (e.g. a ManagedAccount).\n */\nexport async function isSmartWalletDeployed ( smartWalletAddress: string, ): Promise<boolean> {\n return isContractDeployed(smartWalletAddress)\n}\n\n/** Polls chain bytecode until the smart account is deployed or attempts are exhausted. */\nexport async function pollSmartWalletDeployed(\n smartWalletAddress: string,\n attempts?: number,\n intervalMs?: number,\n): Promise<boolean> {\n return pollDeployed(smartWalletAddress, attempts, intervalMs)\n}\n\n/**\n * Resolves the smart wallet address and account to use for publish.\n * If the user has no connected account or no deployed ManagedAccount, returns needsDeploy.\n *\n * When using EIP4337 (in-app wallet with account abstraction), account.address is already\n * the smart wallet address. We detect that case and use it directly instead of deriving\n * via getSmartWalletAddressForAdmin (which assumes account.address is the EOA admin).\n */\nexport async function resolveSmartWalletForPublish (\n account: Account | null,\n): Promise<{ address: string; account: Account } | { needsDeploy: true }> {\n if ( !account ) {\n return { needsDeploy: true }\n }\n // If account.address is already a deployed smart wallet (e.g. from EIP4337), use it directly\n const accountIsDeployedSmartWallet = await isSmartWalletDeployed(account.address,)\n if ( accountIsDeployedSmartWallet ) {\n return { address: account.address, account }\n }\n // Otherwise derive smart wallet from EOA admin (e.g. MetaMask)\n const smartWalletAddress = await getSmartWalletAddressForAdmin(account.address,)\n const deployed = await isSmartWalletDeployed(smartWalletAddress,)\n if ( deployed ) {\n return { address: smartWalletAddress, account }\n }\n return { needsDeploy: true }\n}\n\n/** External wallets (MetaMask, Rainbow) for the deploy flow only; no account abstraction. */\nexport const ExternalWalletsForDeploy = [\n createWallet('io.metamask',),\n createWallet('me.rainbow',),\n]\n\nexport const deploySmartWalletContract = async ( localAccount: Account, ) => {\n const accountContract = getContract({\n client: getClient(),\n chain : optimismSepolia,\n address : localAccount.address,\n },)\n const result = await deploySmartAccount({\n smartAccount : localAccount,\n chain : optimismSepolia,\n client : getClient(),\n accountContract,\n },)\n logger('deploySmartAccount result:', result,)\n return result\n}\n\n/**\n * Deploys a ManagedAccount by calling the Thirdweb factory `createAccount`.\n * Prefer the modular EIP-7702 in-app wallet as `signingAccount` (sponsorGas); it is more reliable\n * than `deploySmartAccount` on the counterfactual EIP-4337 managed wallet (UserOp factory deploy).\n */\nexport async function deployManagedAccountViaFactory(params: {\n adminAddress: string\n signingAccount: Account | PublishWallet\n data?: `0x${string}`\n}): Promise<void> {\n const { asThirdwebPublishWallet } = await import('./adapters/thirdwebAccount')\n const { deployManagedAccountViaFactory: deployCore } = await import(\n './modularAccount/deploy'\n )\n const wallet = asThirdwebPublishWallet(params.signingAccount as Account | PublishWallet)\n await deployCore({\n adminAddress: params.adminAddress,\n signingWallet: wallet,\n data: (params.data ?? '0x') as Hex,\n })\n}\n\nexport const appMetadata = {\n name: \"Seed Protocol\",\n description: \"Seed Protocol\",\n url: \"https://seedprotocol.io\",\n}\n\n/**\n * Connects the managed account wallet (EIP4337 in-app wallet) and returns its address.\n * Use this when you need the connected managed account address for publish flows.\n *\n * @param chain - The chain to connect to (defaults to optimismSepolia)\n * @returns The connected managed account's address\n * @throws Error if the managed account cannot be connected or retrieved\n */\nexport async function getConnectedManagedAccountAddress(\n chain: Chain = optimismSepolia\n): Promise<string> {\n const managedAccountWallet = await connectManagedAccountWallet(chain)\n const managedAccount = managedAccountWallet.getAccount()\n if (!managedAccount) {\n throw new Error('Failed to get managed account')\n }\n return managedAccount.address\n}\n\n/**\n * Returns the connected account for transaction signing (e.g. revoke).\n * Uses the modular account wallet. Returns null if not connected.\n */\nexport async function getConnectedAccount(): Promise<Account | null> {\n try {\n const wallet = getModularAccountWallet()\n await wallet.autoConnect({ client: getClient(), chain: optimismSepolia })\n const account = wallet.getAccount()\n return account ?? null\n } catch {\n return null\n }\n}\n\n/**\n * Same as {@link getConnectedAccount}: the in-app modular wallet (EIP-7702) on Optimism Sepolia.\n * Prefer this name at modular publish entry points for clarity.\n */\nexport async function getConnectedModularAccount(): Promise<Account | null> {\n return getConnectedAccount()\n}\n\n/** Single instance so Thirdweb session, Connect UI, and `autoConnect` share one wallet object. */\nlet _managedInAppWallet: Wallet | null = null\n\nexport const getManagedAccountWallet = () => {\n if (!_managedInAppWallet) {\n _managedInAppWallet = inAppWallet({\n storage: getSharedPublishInAppWalletStorage(),\n auth: {\n options: [\n \"farcaster\",\n \"email\",\n \"passkey\",\n \"phone\",\n ],\n },\n executionMode: {\n mode: 'EIP4337',\n smartAccount: {\n chain: optimismSepolia,\n factoryAddress: THIRDWEB_ACCOUNT_FACTORY_ADDRESS,\n gasless: true,\n },\n },\n // executionMode: {\n // mode: 'EIP4337',\n // smartAccount: {\n // chain: optimismSepolia,\n // factoryAddress: thirdwebAccountFactoryAddress,\n // gasless: true,\n // overrides: {\n // // Custom paymaster that passes through but lets you modify the UserOp\n // paymaster: async (userOp) => {\n\n // const hexifyBigInts: any = (obj: any) => {\n // if (typeof obj === \"bigint\") return `0x${obj.toString(16)}`;\n // if (Array.isArray(obj)) return obj.map(hexifyBigInts);\n // if (obj && typeof obj === \"object\") {\n // return Object.fromEntries(\n // Object.entries(obj).map(([k, v]) => [k, hexifyBigInts(v)])\n // );\n // }\n // return obj;\n // };\n\n // const chainIdHex = `0x${optimismSepolia.id.toString(16)}`;\n\n // // Increase callGasLimit before sending to paymaster\n // const modifiedUserOp = hexifyBigInts({\n // ...userOp,\n // callGasLimit: BigInt(8000000), // Double it, or set a fixed value\n // });\n\n // console.log(\"[SmartWallet Paymaster]\", getPublishConfig().thirdwebClientId);\n \n // // Call thirdweb's default paymaster endpoint\n // const response = await fetch(\n // `https://${optimismSepolia.id}.bundler.thirdweb.com/v2`,\n // {\n // method: \"POST\",\n // headers: { \n // \"Content-Type\": \"application/json\",\n // \"X-Client-Id\": getPublishConfig().thirdwebClientId,\n // },\n // body: JSON.stringify({\n // id: 1,\n // jsonrpc: \"2.0\",\n // method: \"pm_sponsorUserOperation\",\n // params: [modifiedUserOp, '0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789', chainIdHex],\n // }),\n // }\n // );\n \n // const data = await response.json();\n // console.log(\"[SmartWallet Paymaster Response]\", data);\n // return {\n // paymasterAndData: data.result.paymasterAndData,\n // preVerificationGas: data.result.preVerificationGas,\n // verificationGasLimit: data.result.verificationGasLimit,\n // callGasLimit: data.result.callGasLimit,\n // };\n // },\n // execute: (accountContract, transaction) => {\n // // Log the gas that was set on the transaction\n // console.log(\"[SmartWallet Execute]\", {\n // gas: transaction.gas,\n // to: transaction.to,\n // dataLength: transaction.data?.length,\n // });\n \n // // Return the default execute call — don't change behavior,\n // // just observe what's being passed through\n // return prepareContractCall({\n // contract: accountContract,\n // method: \"function execute(address, uint256, bytes)\",\n // params: [\n // transaction.to ?? \"\",\n // transaction.value ?? 0n,\n // transaction.data ?? \"0x\",\n // ],\n // gas: transaction.gas, // Pass through whatever was set\n // });\n // },\n // },\n // }\n // }\n })\n }\n return _managedInAppWallet\n}\n\n/** Single instance (pairs with {@link getManagedAccountWallet} for two execution modes, same Thirdweb client). */\nlet _modularInAppWallet: Wallet | null = null\n\nexport const getModularAccountWallet = () => {\n if (!_modularInAppWallet) {\n _modularInAppWallet = inAppWallet({\n storage: getSharedPublishInAppWalletStorage(),\n auth: {\n options: [\n \"farcaster\",\n \"email\",\n \"passkey\",\n \"phone\",\n ],\n },\n executionMode: {\n mode: 'EIP7702',\n sponsorGas: true,\n \n },\n })\n }\n return _modularInAppWallet\n}\n\nlet _walletsForConnectButton: Wallet[] | null = null\n\nexport const getWalletsForConnectButton = () => {\n if (!_walletsForConnectButton) {\n _walletsForConnectButton = getPublishConfig().useModularExecutor\n ? [getModularAccountWallet()]\n : [getManagedAccountWallet()]\n }\n return _walletsForConnectButton\n}"],"mappings":"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"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { A as t } from "./config-BqguD2Tt.js";
|
|
3
|
-
import { a as n, c as r, i, s as a } from "./seedSigner-CFzMD7Rb.js";
|
|
4
|
-
import { defineChain as o, prepareTransaction as s, sendTransaction as c } from "thirdweb";
|
|
5
|
-
import { optimismSepolia as l } from "thirdweb/chains";
|
|
6
|
-
//#region src/helpers/adapters/thirdwebAccount.ts
|
|
7
|
-
var u = /* @__PURE__ */ e({
|
|
8
|
-
asSeedSignerFromThirdweb: () => m,
|
|
9
|
-
asThirdwebPublishWallet: () => p,
|
|
10
|
-
fromThirdwebAccount: () => f
|
|
11
|
-
});
|
|
12
|
-
function d() {
|
|
13
|
-
let e = t();
|
|
14
|
-
return e.id === l.id ? l : o({
|
|
15
|
-
id: e.id,
|
|
16
|
-
name: e.name,
|
|
17
|
-
nativeCurrency: e.nativeCurrency,
|
|
18
|
-
rpc: e.rpcUrls.default.http[0] ?? ""
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
function f(e) {
|
|
22
|
-
let t = e.address;
|
|
23
|
-
return {
|
|
24
|
-
signer: i({
|
|
25
|
-
address: t,
|
|
26
|
-
signMessage: async ({ message: t }) => await e.signMessage({ message: t }),
|
|
27
|
-
signTypedData: async (t) => await e.signTypedData(t)
|
|
28
|
-
}),
|
|
29
|
-
txSender: n({
|
|
30
|
-
address: t,
|
|
31
|
-
sendTransaction: async (t) => {
|
|
32
|
-
let { getClient: n } = await import("./thirdweb-BoksPRz3.js").then((e) => e.v), r = d(), i = s({
|
|
33
|
-
client: n(),
|
|
34
|
-
chain: r,
|
|
35
|
-
to: t.to,
|
|
36
|
-
data: t.data,
|
|
37
|
-
value: t.value,
|
|
38
|
-
gas: t.gas
|
|
39
|
-
});
|
|
40
|
-
return { transactionHash: (await c({
|
|
41
|
-
account: e,
|
|
42
|
-
transaction: i
|
|
43
|
-
})).transactionHash };
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function p(e) {
|
|
49
|
-
if (a(e)) return e;
|
|
50
|
-
if (r(e)) throw Error("@seedprotocol/publish/thirdweb: SeedSigner alone cannot send sponsored txs. Pass fromThirdwebAccount(account) or a PublishWallet.");
|
|
51
|
-
return f(e);
|
|
52
|
-
}
|
|
53
|
-
function m(e) {
|
|
54
|
-
return a(e) ? e.signer : r(e) ? e : f(e).signer;
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
|
-
export { u as i, p as n, f as r, m as t };
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=thirdwebAccount-C2iOcp4_.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"thirdwebAccount-C2iOcp4_.js","names":[],"sources":["../src/helpers/adapters/thirdwebAccount.ts"],"sourcesContent":["import { prepareTransaction, sendTransaction, defineChain } from 'thirdweb'\nimport type { Account } from 'thirdweb/wallets'\nimport { optimismSepolia as thirdwebOptimismSepolia } from 'thirdweb/chains'\nimport type { Address, Hex } from 'viem'\nimport {\n brandSigner,\n brandTxSender,\n isPublishWallet,\n isSeedSigner,\n type PublishWallet,\n type SeedSigner,\n} from '../seedSigner'\nimport { getPublishViemChain } from '../chainConfig'\n\nfunction resolveThirdwebChain() {\n const viemChain = getPublishViemChain()\n if (viemChain.id === thirdwebOptimismSepolia.id) {\n return thirdwebOptimismSepolia\n }\n return defineChain({\n id: viemChain.id,\n name: viemChain.name,\n nativeCurrency: viemChain.nativeCurrency,\n rpc: viemChain.rpcUrls.default.http[0] ?? '',\n })\n}\n\n/**\n * Wrap a Thirdweb Account so AA gas sponsorship still flows through thirdweb `sendTransaction`.\n */\nexport function fromThirdwebAccount(account: Account): PublishWallet {\n const address = account.address as Address\n const signer = brandSigner({\n address,\n signMessage: async ({ message }) => {\n const sig = await account.signMessage({ message })\n return sig as Hex\n },\n signTypedData: async (args) => {\n const sig = await account.signTypedData(args as Parameters<Account['signTypedData']>[0])\n return sig as Hex\n },\n })\n const txSender = brandTxSender({\n address,\n sendTransaction: async (tx) => {\n const { getClient } = await import('../thirdweb')\n const chain = resolveThirdwebChain()\n const transaction = prepareTransaction({\n client: getClient(),\n chain,\n to: tx.to,\n data: tx.data,\n value: tx.value,\n gas: tx.gas,\n })\n const result = await sendTransaction({ account, transaction })\n return { transactionHash: result.transactionHash as Hex }\n },\n })\n return { signer, txSender }\n}\n\n/**\n * Coerce Thirdweb Account, SeedSigner, or PublishWallet to PublishWallet.\n */\nexport function asThirdwebPublishWallet(\n accountOrWallet: Account | SeedSigner | PublishWallet,\n): PublishWallet {\n if (isPublishWallet(accountOrWallet)) return accountOrWallet\n if (isSeedSigner(accountOrWallet)) {\n throw new Error(\n '@seedprotocol/publish/thirdweb: SeedSigner alone cannot send sponsored txs. Pass fromThirdwebAccount(account) or a PublishWallet.',\n )\n }\n return fromThirdwebAccount(accountOrWallet)\n}\n\n/** @deprecated Prefer {@link asThirdwebPublishWallet}; kept for call-site migration. */\nexport function asSeedSignerFromThirdweb(\n accountOrWallet: Account | SeedSigner | PublishWallet,\n): SeedSigner {\n if (isPublishWallet(accountOrWallet)) return accountOrWallet.signer\n if (isSeedSigner(accountOrWallet)) return accountOrWallet\n return fromThirdwebAccount(accountOrWallet).signer\n}\n"],"mappings":";;;;;;;;;;;AAcA,SAAS,IAAuB;CAC9B,IAAM,IAAY,EAAoB;CAItC,OAHI,EAAU,OAAO,EAAwB,KACpC,IAEF,EAAY;EACjB,IAAI,EAAU;EACd,MAAM,EAAU;EAChB,gBAAgB,EAAU;EAC1B,KAAK,EAAU,QAAQ,QAAQ,KAAK,MAAM;CAC5C,CAAC;AACH;AAKA,SAAgB,EAAoB,GAAiC;CACnE,IAAM,IAAU,EAAQ;CA6BxB,OAAO;EAAE,QA5BM,EAAY;GACzB;GACA,aAAa,OAAO,EAAE,iBAEb,MADW,EAAQ,YAAY,EAAE,WAAQ,CAAC;GAGnD,eAAe,OAAO,MAEb,MADW,EAAQ,cAAc,CAA+C;EAG3F,CAkBS;EAAQ,UAjBA,EAAc;GAC7B;GACA,iBAAiB,OAAO,MAAO;IAC7B,IAAM,EAAE,iBAAc,MAAM,OAAO,yBAAA,CAAA,MAAA,MAAA,EAAA,CAAA,GAC7B,IAAQ,EAAqB,GAC7B,IAAc,EAAmB;KACrC,QAAQ,EAAU;KAClB;KACA,IAAI,EAAG;KACP,MAAM,EAAG;KACT,OAAO,EAAG;KACV,KAAK,EAAG;IACV,CAAC;IAED,OAAO,EAAE,kBAAiB,MADL,EAAgB;KAAE;KAAS;IAAY,CAAC,EAAA,CAC5B,gBAAuB;GAC1D;EACF,CACiB;CAAS;AAC5B;AAKA,SAAgB,EACd,GACe;CACf,IAAI,EAAgB,CAAe,GAAG,OAAO;CAC7C,IAAI,EAAa,CAAe,GAC9B,MAAU,MACR,mIACF;CAEF,OAAO,EAAoB,CAAe;AAC5C;AAGA,SAAgB,EACd,GACY;CAGZ,OAFI,EAAgB,CAAe,IAAU,EAAgB,SACzD,EAAa,CAAe,IAAU,IACnC,EAAoB,CAAe,CAAC,CAAC;AAC9C"}
|