@seedprotocol/publish 0.7.9 → 0.7.10-next.1344.g3828e8a
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 +8 -0
- package/dist/{chainConfig-CD-RgKkA.js → chainConfig-B8U89YJb.js} +1011 -1008
- package/dist/chainConfig-B8U89YJb.js.map +1 -0
- package/dist/{ensureAutomationSessionKey-CHXAuk8Q.js → ensureAutomationSessionKey-B19eVd1T.js} +3 -3
- package/dist/{ensureAutomationSessionKey-CHXAuk8Q.js.map → ensureAutomationSessionKey-B19eVd1T.js.map} +1 -1
- package/dist/{ensureModularPublishBootstrap-Cit8PlNN.js → ensureModularPublishBootstrap-COEV4BGz.js} +3 -3
- package/dist/{ensureModularPublishBootstrap-Cit8PlNN.js.map → ensureModularPublishBootstrap-COEV4BGz.js.map} +1 -1
- package/dist/{ensureSmartWalletThenPublish-C2FS784-.js → ensureSmartWalletThenPublish-DhWyUjt0.js} +2 -2
- package/dist/{ensureSmartWalletThenPublish-C2FS784-.js.map → ensureSmartWalletThenPublish-DhWyUjt0.js.map} +1 -1
- package/dist/helpers/publishItem.d.ts +1 -1
- package/dist/helpers/publishItem.d.ts.map +1 -1
- package/dist/hooks/usePublishCostEstimate.d.ts.map +1 -1
- package/dist/hooks/usePublishCostEstimate.test.d.ts +2 -0
- package/dist/hooks/usePublishCostEstimate.test.d.ts.map +1 -0
- package/dist/index.js +325 -293
- package/dist/index.js.map +1 -1
- package/dist/{managedAccountAdmin-BmO4USir.js → managedAccountAdmin-xZbC3bQ5.js} +2 -2
- package/dist/{managedAccountAdmin-BmO4USir.js.map → managedAccountAdmin-xZbC3bQ5.js.map} +1 -1
- package/dist/{publishAuthorization-D1HYOu23.js → publishAuthorization-CpmPRbpm.js} +2 -2
- package/dist/{publishAuthorization-D1HYOu23.js.map → publishAuthorization-CpmPRbpm.js.map} +1 -1
- package/dist/{resolveRevokeAccount-CK8SbaVn.js → resolveRevokeAccount-D08n9UTy.js} +2 -2
- package/dist/{resolveRevokeAccount-CK8SbaVn.js.map → resolveRevokeAccount-D08n9UTy.js.map} +1 -1
- package/dist/services/publish/actors/createAttestations.d.ts +4 -3
- package/dist/services/publish/actors/createAttestations.d.ts.map +1 -1
- package/dist/services/publish/actors/createAttestationsDirectToEas.d.ts.map +1 -1
- package/dist/services/publish/actors/utils.d.ts +5 -0
- package/dist/services/publish/actors/utils.d.ts.map +1 -1
- package/dist/services/publishCost/watchPublishCost.d.ts +19 -2
- package/dist/services/publishCost/watchPublishCost.d.ts.map +1 -1
- package/dist/thirdweb.js +5 -5
- package/dist/{worker-BlNDHv1o.js → worker-4DXDWw6E.js} +2 -2
- package/dist/{worker-BlNDHv1o.js.map → worker-4DXDWw6E.js.map} +1 -1
- package/package.json +9 -9
- package/dist/chainConfig-CD-RgKkA.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
2
|
import { n as t, r as n } from "./publishWalletRegistry-BaQe9rIR.js";
|
|
3
3
|
import { optimismSepolia as r } from "viem/chains";
|
|
4
|
-
import { BaseArweaveClient as i, BaseDb as a, DEFAULT_ARWEAVE_GRAPHQL_URL as o, INTERNAL_DATA_TYPES as s, Item as c, ModelPropertyDataTypes as l, RelatedItemUnpublishedError as u, VERSION_SCHEMA_UID as d, applyPropertyAttestationUidsFromPublish as f, arweaveL1FinalizeJobs as p, assertLocalDbChain as m, easName as h, easPropertyNameForPublish as g, getAttesterForSeed as
|
|
4
|
+
import { BaseArweaveClient as i, BaseDb as a, DEFAULT_ARWEAVE_GRAPHQL_URL as o, INTERNAL_DATA_TYPES as s, Item as c, ModelPropertyDataTypes as l, RelatedItemUnpublishedError as u, VERSION_SCHEMA_UID as d, applyPropertyAttestationUidsFromPublish as f, arweaveL1FinalizeJobs as p, assertLocalDbChain as m, easName as h, easPropertyNameForPublish as g, getAttesterForSeed as ee, getEasSchemaUidForExactDefinition as _, getGetAdditionalSyncAddresses as v, getItemPropertiesFromEas as y, getMetadataAttestationUidsForSeedUid as te, getPublishGraph as ne, getPublishUploadData as re, getUnpublishedRelatedItems as b, getUploadPipelineTransactionStatus as ie, getVersionsForSeedUid as ae, isItemOwned as oe, isValidEasAttestationUid as se, itemHasPublishUploadCandidates as ce, listRelationEasPropertyName as le, markPropertyAttestationsRetracted as ue, normalizeDataType as de, prepareHtmlEmbeddedImagesForPublish as fe, publishProcesses as x, resolvePublishPayloadValues as pe, rewriteHtmlEmbeddedImagesOnDisk as me, setAdditionalSyncAddresses as he, setGetPublisherForNewSeeds as ge, setPublishExecutor as _e, setRevokeExecutor as ve, setSchemaUidForModel as ye, setSchemaUidForSchemaDefinition as be, updateSeedRevokedAt as xe, updateVersionUid as Se, validateItemForPublish as Ce, whenLeaderTab as we } from "@seedprotocol/sdk";
|
|
5
5
|
import { BaseError as Te, createPublicClient as Ee, decodeAbiParameters as De, decodeErrorResult as Oe, encodeAbiParameters as ke, encodeFunctionData as S, getAbiItem as Ae, http as je, isAddressEqual as Me, parseEther as Ne, parseEventLogs as Pe, toFunctionSelector as Fe, zeroAddress as Ie } from "viem";
|
|
6
6
|
import { createThirdwebClient as Le, deploySmartAccount as Re, getContract as ze, prepareTransaction as Be, sendTransaction as Ve } from "thirdweb";
|
|
7
7
|
import { computeAddress as He, ethers as C, hexlify as Ue } from "ethers";
|
|
@@ -24,21 +24,21 @@ import { configureEasReadChain as ht, expectEasReadChain as gt, resolveEasChainD
|
|
|
24
24
|
var vt = "0x44d562ac1d7cd77e232978687fea027ace48f719cf1d58c7888e509663bb87fc", yt = { 11155420: "0x76f47d88bfaf670f5208911181fcdc0e160cb16d" }, bt = "0xcd8c945872df8e664e55cf8885c85ea3ea8f2148", xt = bt, St = {
|
|
25
25
|
SUCCESS: "success",
|
|
26
26
|
FAILURE: "failure"
|
|
27
|
-
}, Ct = ["uploadingViaBundler", "uploadingViaBundlerPhase2"], wt = 3e4, O = r, Tt = "https://upload.ardrive.io", Et = "https://payment.ardrive.io",
|
|
27
|
+
}, Ct = ["uploadingViaBundler", "uploadingViaBundlerPhase2"], wt = 3e4, O = r, Tt = "https://upload.ardrive.io", Et = "https://payment.ardrive.io", Dt = class extends Error {
|
|
28
28
|
constructor(e) {
|
|
29
29
|
super(`@seedprotocol/publish: ${e}`), this.name = "PublishPaymentConfigError";
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
function
|
|
32
|
+
function Ot(e) {
|
|
33
33
|
return e.useModularExecutor ? "modular" : (e.accountMode ?? (e.bundlerUrl ? "eip7702" : "eoa")) === "eip7702" && e.bundlerUrl ? "eip7702" : "wallet";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function kt(e) {
|
|
36
36
|
let t = e.thirdweb?.sponsorGas;
|
|
37
37
|
return t === void 0 ? e.payment?.gas !== "user" : t;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
let t =
|
|
41
|
-
if (n = t === "modular" ?
|
|
39
|
+
function At(e) {
|
|
40
|
+
let t = Ot(e), n;
|
|
41
|
+
if (n = t === "modular" ? kt(e) ? {
|
|
42
42
|
payer: "sponsored",
|
|
43
43
|
sponsor: "thirdweb"
|
|
44
44
|
} : { payer: "user" } : t === "eip7702" ? e.payment?.gas === "user" ? { payer: "user" } : {
|
|
@@ -71,24 +71,24 @@ function kt(e) {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
if (e.useArweaveBundler === !1) throw new
|
|
74
|
+
function jt(e) {
|
|
75
|
+
if (e.useArweaveBundler === !1) throw new Dt("useArweaveBundler: false is no longer supported. Publish uploads signed data items through the upload API's bundler routes (or Turbo with payment.storage: 'user'); remove the option.");
|
|
76
76
|
let t = e.payment;
|
|
77
77
|
if (!t) return;
|
|
78
|
-
let n =
|
|
78
|
+
let n = Ot(e);
|
|
79
79
|
if (t.gas === "sponsored") {
|
|
80
|
-
if (n === "wallet") throw new
|
|
81
|
-
if (n === "modular" && e.thirdweb?.sponsorGas === !1) throw new
|
|
80
|
+
if (n === "wallet") throw new Dt("payment.gas is 'sponsored', but publishes are sent from the connected wallet, which pays its own gas. Set useModularExecutor (Thirdweb sponsorship) or bundlerUrl (EIP-7702 with a paymaster).");
|
|
81
|
+
if (n === "modular" && e.thirdweb?.sponsorGas === !1) throw new Dt("payment.gas is 'sponsored' but thirdweb.sponsorGas is false.");
|
|
82
82
|
}
|
|
83
83
|
if (t.gas === "user") {
|
|
84
|
-
if (n === "modular" && e.thirdweb?.sponsorGas === !0) throw new
|
|
85
|
-
if (n === "eip7702" && e.paymasterUrl) throw new
|
|
84
|
+
if (n === "modular" && e.thirdweb?.sponsorGas === !0) throw new Dt("payment.gas is 'user' but thirdweb.sponsorGas is true.");
|
|
85
|
+
if (n === "eip7702" && e.paymasterUrl) throw new Dt("payment.gas is 'user' but paymasterUrl is set; remove it so the EIP-7702 sender pays its own gas.");
|
|
86
86
|
}
|
|
87
|
-
if (t.userStorage && t.storage !== "user") throw new
|
|
87
|
+
if (t.userStorage && t.storage !== "user") throw new Dt("payment.userStorage is set but payment.storage is not 'user'.");
|
|
88
88
|
}
|
|
89
89
|
//#endregion
|
|
90
90
|
//#region src/helpers/abi/eas.ts
|
|
91
|
-
var
|
|
91
|
+
var Mt = [
|
|
92
92
|
{
|
|
93
93
|
type: "error",
|
|
94
94
|
name: "AccessDenied",
|
|
@@ -139,7 +139,7 @@ var jt = [
|
|
|
139
139
|
name: "InvalidLength",
|
|
140
140
|
inputs: []
|
|
141
141
|
}
|
|
142
|
-
],
|
|
142
|
+
], Nt = [
|
|
143
143
|
{
|
|
144
144
|
name: "recipient",
|
|
145
145
|
type: "address"
|
|
@@ -164,7 +164,7 @@ var jt = [
|
|
|
164
164
|
name: "value",
|
|
165
165
|
type: "uint256"
|
|
166
166
|
}
|
|
167
|
-
],
|
|
167
|
+
], Pt = [
|
|
168
168
|
{
|
|
169
169
|
type: "function",
|
|
170
170
|
name: "attest",
|
|
@@ -178,7 +178,7 @@ var jt = [
|
|
|
178
178
|
}, {
|
|
179
179
|
name: "data",
|
|
180
180
|
type: "tuple",
|
|
181
|
-
components:
|
|
181
|
+
components: Nt
|
|
182
182
|
}]
|
|
183
183
|
}],
|
|
184
184
|
outputs: [{ type: "bytes32" }]
|
|
@@ -196,7 +196,7 @@ var jt = [
|
|
|
196
196
|
}, {
|
|
197
197
|
name: "data",
|
|
198
198
|
type: "tuple[]",
|
|
199
|
-
components:
|
|
199
|
+
components: Nt
|
|
200
200
|
}]
|
|
201
201
|
}],
|
|
202
202
|
outputs: [{ type: "bytes32[]" }]
|
|
@@ -305,8 +305,8 @@ var jt = [
|
|
|
305
305
|
}
|
|
306
306
|
]
|
|
307
307
|
},
|
|
308
|
-
...
|
|
309
|
-
],
|
|
308
|
+
...Mt
|
|
309
|
+
], Ft = [{
|
|
310
310
|
type: "function",
|
|
311
311
|
name: "multiPublish",
|
|
312
312
|
stateMutability: "payable",
|
|
@@ -389,7 +389,7 @@ var jt = [
|
|
|
389
389
|
]
|
|
390
390
|
}],
|
|
391
391
|
outputs: [{ type: "bytes32[]" }]
|
|
392
|
-
}],
|
|
392
|
+
}], It = [
|
|
393
393
|
{
|
|
394
394
|
type: "function",
|
|
395
395
|
name: "getEas",
|
|
@@ -427,7 +427,7 @@ var jt = [
|
|
|
427
427
|
}],
|
|
428
428
|
outputs: [{ type: "bool" }]
|
|
429
429
|
}
|
|
430
|
-
],
|
|
430
|
+
], Lt = [{
|
|
431
431
|
type: "event",
|
|
432
432
|
name: "CreatedAttestation",
|
|
433
433
|
inputs: [{
|
|
@@ -450,7 +450,7 @@ var jt = [
|
|
|
450
450
|
type: "bytes",
|
|
451
451
|
indexed: !1
|
|
452
452
|
}]
|
|
453
|
-
}],
|
|
453
|
+
}], Rt = [
|
|
454
454
|
{
|
|
455
455
|
type: "function",
|
|
456
456
|
name: "getAddress",
|
|
@@ -487,7 +487,7 @@ var jt = [
|
|
|
487
487
|
}],
|
|
488
488
|
outputs: [{ type: "address" }]
|
|
489
489
|
}
|
|
490
|
-
],
|
|
490
|
+
], zt = [{
|
|
491
491
|
type: "event",
|
|
492
492
|
name: "CreatedAttestation",
|
|
493
493
|
inputs: [{
|
|
@@ -514,8 +514,8 @@ var jt = [
|
|
|
514
514
|
type: "bytes32",
|
|
515
515
|
indexed: !1
|
|
516
516
|
}]
|
|
517
|
-
}],
|
|
518
|
-
|
|
517
|
+
}], Bt = [
|
|
518
|
+
Ft[0],
|
|
519
519
|
{
|
|
520
520
|
type: "function",
|
|
521
521
|
name: "isInitialized",
|
|
@@ -586,7 +586,7 @@ var jt = [
|
|
|
586
586
|
name: "MultiAttestFailed",
|
|
587
587
|
inputs: []
|
|
588
588
|
}
|
|
589
|
-
],
|
|
589
|
+
], Vt = [
|
|
590
590
|
{
|
|
591
591
|
type: "function",
|
|
592
592
|
name: "installSeedExecutor",
|
|
@@ -657,7 +657,7 @@ var jt = [
|
|
|
657
657
|
name: "SeedExecutorNotInstalled",
|
|
658
658
|
inputs: []
|
|
659
659
|
}
|
|
660
|
-
],
|
|
660
|
+
], Ht = 2n, Ut = [{
|
|
661
661
|
type: "function",
|
|
662
662
|
name: "getSchema",
|
|
663
663
|
stateMutability: "view",
|
|
@@ -706,7 +706,7 @@ var jt = [
|
|
|
706
706
|
}
|
|
707
707
|
],
|
|
708
708
|
outputs: [{ type: "bytes32" }]
|
|
709
|
-
}],
|
|
709
|
+
}], Wt = class extends Error {
|
|
710
710
|
seedLocalId;
|
|
711
711
|
expectedSchemas;
|
|
712
712
|
foundSchemas;
|
|
@@ -715,7 +715,7 @@ var jt = [
|
|
|
715
715
|
super(e), this.seedLocalId = t, this.expectedSchemas = n, this.foundSchemas = r, this.code = i, this.name = "AttestationVerificationError";
|
|
716
716
|
}
|
|
717
717
|
};
|
|
718
|
-
function
|
|
718
|
+
function Gt(e, t = 700) {
|
|
719
719
|
if (e == null) return "";
|
|
720
720
|
if (e instanceof Error) {
|
|
721
721
|
let n = e.cause instanceof Error ? ` | cause: ${e.cause.message}` : "";
|
|
@@ -732,55 +732,55 @@ function Wt(e, t = 700) {
|
|
|
732
732
|
}
|
|
733
733
|
return String(e).slice(0, t);
|
|
734
734
|
}
|
|
735
|
-
var
|
|
735
|
+
var k = class extends Error {
|
|
736
736
|
code;
|
|
737
737
|
managedAddress;
|
|
738
738
|
underlyingCause;
|
|
739
739
|
constructor(e, t, n, r) {
|
|
740
|
-
let i = r != null && r !== "" ? ` (${
|
|
740
|
+
let i = r != null && r !== "" ? ` (${Gt(r)})` : "";
|
|
741
741
|
super(e + i), this.code = t, this.managedAddress = n, this.name = "ManagedAccountPublishError", this.underlyingCause = r;
|
|
742
742
|
}
|
|
743
|
-
},
|
|
743
|
+
}, Kt = class extends Error {
|
|
744
744
|
transactionHash;
|
|
745
745
|
receipt;
|
|
746
746
|
constructor(e, t) {
|
|
747
747
|
super(`Transaction ${e} reverted.`), this.transactionHash = e, this.receipt = t, this.name = "PublishTransactionRevertedError";
|
|
748
748
|
}
|
|
749
749
|
};
|
|
750
|
-
function
|
|
751
|
-
if (e instanceof
|
|
750
|
+
function qt(e) {
|
|
751
|
+
if (e instanceof k) return !0;
|
|
752
752
|
if (typeof e != "object" || !e) return !1;
|
|
753
753
|
let t = e;
|
|
754
754
|
return t.name === "ManagedAccountPublishError" && typeof t.code == "string";
|
|
755
755
|
}
|
|
756
|
-
var
|
|
756
|
+
var Jt = class extends Error {
|
|
757
757
|
code;
|
|
758
758
|
modularAddress;
|
|
759
759
|
underlyingCause;
|
|
760
760
|
constructor(e, t, n, r) {
|
|
761
|
-
let i = r != null && r !== "" ? ` (${
|
|
761
|
+
let i = r != null && r !== "" ? ` (${Gt(r)})` : "";
|
|
762
762
|
super(e + i), this.code = t, this.modularAddress = n, this.name = "Eip7702ModularAccountPublishError", this.underlyingCause = r;
|
|
763
763
|
}
|
|
764
|
-
},
|
|
764
|
+
}, Yt = [
|
|
765
765
|
"EIP7702_MODULAR_ACCOUNT_UNAVAILABLE",
|
|
766
766
|
"EIP7702_MODULAR_NOT_UPGRADED",
|
|
767
767
|
"EIP7702_MODULAR_DEPLOY_FAILED",
|
|
768
768
|
"EIP7702_MODULAR_NOT_CONFIRMED"
|
|
769
769
|
];
|
|
770
|
-
function
|
|
771
|
-
if (e instanceof
|
|
770
|
+
function Xt(e) {
|
|
771
|
+
if (e instanceof Jt) return !0;
|
|
772
772
|
if (typeof e != "object" || !e) return !1;
|
|
773
773
|
let t = e;
|
|
774
|
-
return t.name === "Eip7702ModularAccountPublishError" && typeof t.code == "string" &&
|
|
774
|
+
return t.name === "Eip7702ModularAccountPublishError" && typeof t.code == "string" && Yt.includes(t.code);
|
|
775
775
|
}
|
|
776
|
-
function
|
|
777
|
-
let t =
|
|
776
|
+
function Zt(e) {
|
|
777
|
+
let t = Gt(e);
|
|
778
778
|
return !!(/Router:\s*function does not exist/i.test(t) || /Cannot decode zero data\s*\(\s*["']0x["']\s*\)/i.test(t));
|
|
779
779
|
}
|
|
780
780
|
//#endregion
|
|
781
781
|
//#region src/helpers/chainClient.ts
|
|
782
|
-
var
|
|
783
|
-
function
|
|
782
|
+
var Qt = null, $t = null;
|
|
783
|
+
function en() {
|
|
784
784
|
try {
|
|
785
785
|
let e = Q().thirdwebSecretKey;
|
|
786
786
|
return e ? { headers: { "x-secret-key": e } } : void 0;
|
|
@@ -788,55 +788,55 @@ function $t() {
|
|
|
788
788
|
return;
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
|
-
function
|
|
792
|
-
let e =
|
|
791
|
+
function tn() {
|
|
792
|
+
let e = kl(), t = Al(), n = en();
|
|
793
793
|
return Ee({
|
|
794
794
|
chain: e,
|
|
795
795
|
transport: je(t, n ? { fetchOptions: n } : void 0)
|
|
796
796
|
});
|
|
797
797
|
}
|
|
798
|
-
function
|
|
799
|
-
let e =
|
|
798
|
+
function A() {
|
|
799
|
+
let e = kl(), t = Al(), n = "";
|
|
800
800
|
try {
|
|
801
801
|
n = Q().thirdwebSecretKey ?? "";
|
|
802
802
|
} catch {
|
|
803
803
|
n = "";
|
|
804
804
|
}
|
|
805
805
|
let r = `${e.id}:${t}:${n ? "1" : "0"}:${n}`;
|
|
806
|
-
return (!
|
|
806
|
+
return (!Qt || $t !== r) && ($t = r, Qt = tn()), Qt;
|
|
807
807
|
}
|
|
808
|
-
async function
|
|
809
|
-
let t = await
|
|
810
|
-
if (t.status === "reverted") throw new
|
|
808
|
+
async function j(e) {
|
|
809
|
+
let t = await A().waitForTransactionReceipt({ hash: e });
|
|
810
|
+
if (t.status === "reverted") throw new Kt(e, t);
|
|
811
811
|
return t;
|
|
812
812
|
}
|
|
813
|
-
async function
|
|
813
|
+
async function nn(e, t, { attempts: n = 5, intervalMs: r = 2e3 } = {}) {
|
|
814
814
|
let i = await e();
|
|
815
815
|
for (let a = 1; a < n && !t(i); a++) await new Promise((e) => setTimeout(e, r)), i = await e();
|
|
816
816
|
return i;
|
|
817
817
|
}
|
|
818
|
-
async function
|
|
819
|
-
let t = await
|
|
818
|
+
async function rn(e) {
|
|
819
|
+
let t = await A().getBytecode({ address: e });
|
|
820
820
|
return !!t && t !== "0x";
|
|
821
821
|
}
|
|
822
|
-
var
|
|
823
|
-
function
|
|
824
|
-
return !e || e === "0x" ? "none" : e.toLowerCase().startsWith(
|
|
825
|
-
}
|
|
826
|
-
async function on(e) {
|
|
827
|
-
return an(await j().getBytecode({ address: e }));
|
|
822
|
+
var an = "0xef0100";
|
|
823
|
+
function on(e) {
|
|
824
|
+
return !e || e === "0x" ? "none" : e.toLowerCase().startsWith(an) ? "eip7702-delegated" : "contract";
|
|
828
825
|
}
|
|
829
826
|
async function sn(e) {
|
|
827
|
+
return on(await A().getBytecode({ address: e }));
|
|
828
|
+
}
|
|
829
|
+
async function cn(e) {
|
|
830
830
|
try {
|
|
831
|
-
let t = await
|
|
831
|
+
let t = await A().getBlock({ blockNumber: e });
|
|
832
832
|
if (t?.timestamp != null) return Number(t.timestamp) * 1e3;
|
|
833
833
|
} catch {}
|
|
834
834
|
return null;
|
|
835
835
|
}
|
|
836
|
-
var
|
|
837
|
-
async function
|
|
836
|
+
var ln = 5, un = 6e3;
|
|
837
|
+
async function dn(e, t = ln, n = un) {
|
|
838
838
|
for (let r = 0; r < t; r++) {
|
|
839
|
-
if (await
|
|
839
|
+
if (await rn(e)) return !0;
|
|
840
840
|
r < t - 1 && await new Promise((e) => {
|
|
841
841
|
setTimeout(e, n);
|
|
842
842
|
});
|
|
@@ -845,7 +845,7 @@ async function un(e, t = cn, n = ln) {
|
|
|
845
845
|
}
|
|
846
846
|
//#endregion
|
|
847
847
|
//#region src/helpers/contracts/index.ts
|
|
848
|
-
function
|
|
848
|
+
function fn(e) {
|
|
849
849
|
let t = /* @__PURE__ */ new Map();
|
|
850
850
|
return e.forEach((e, n) => {
|
|
851
851
|
if (e.localId) {
|
|
@@ -862,12 +862,12 @@ function dn(e) {
|
|
|
862
862
|
};
|
|
863
863
|
});
|
|
864
864
|
}
|
|
865
|
-
function
|
|
866
|
-
let r =
|
|
865
|
+
function pn(e, t, n) {
|
|
866
|
+
let r = fn(t);
|
|
867
867
|
return {
|
|
868
868
|
to: e,
|
|
869
869
|
data: S({
|
|
870
|
-
abi:
|
|
870
|
+
abi: Ft,
|
|
871
871
|
functionName: "multiPublish",
|
|
872
872
|
args: [t.map((e) => ({
|
|
873
873
|
localId: e.localId,
|
|
@@ -883,30 +883,30 @@ function fn(e, t, n) {
|
|
|
883
883
|
gas: n
|
|
884
884
|
};
|
|
885
885
|
}
|
|
886
|
-
function
|
|
887
|
-
return
|
|
886
|
+
function mn(e, t, n) {
|
|
887
|
+
return pn(e, t, n);
|
|
888
888
|
}
|
|
889
|
-
async function
|
|
890
|
-
return
|
|
889
|
+
async function hn(e, t) {
|
|
890
|
+
return A().readContract({
|
|
891
891
|
address: e,
|
|
892
|
-
abi:
|
|
892
|
+
abi: Bt,
|
|
893
893
|
functionName: "isInitialized",
|
|
894
894
|
args: [t]
|
|
895
895
|
});
|
|
896
896
|
}
|
|
897
|
-
async function
|
|
898
|
-
return
|
|
897
|
+
async function gn(e, t) {
|
|
898
|
+
return A().readContract({
|
|
899
899
|
address: e,
|
|
900
|
-
abi:
|
|
900
|
+
abi: Bt,
|
|
901
901
|
functionName: "getEAS",
|
|
902
902
|
args: [t]
|
|
903
903
|
});
|
|
904
904
|
}
|
|
905
|
-
async function
|
|
905
|
+
async function _n(e) {
|
|
906
906
|
try {
|
|
907
|
-
let [t, n] = await
|
|
907
|
+
let [t, n] = await A().readContract({
|
|
908
908
|
address: e,
|
|
909
|
-
abi:
|
|
909
|
+
abi: Vt,
|
|
910
910
|
functionName: "getSeedExecutor"
|
|
911
911
|
});
|
|
912
912
|
return {
|
|
@@ -917,20 +917,20 @@ async function gn(e) {
|
|
|
917
917
|
return null;
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
|
-
async function
|
|
921
|
-
let t =
|
|
920
|
+
async function vn(e = Dl()) {
|
|
921
|
+
let t = A(), n = await t.readContract({
|
|
922
922
|
address: e,
|
|
923
|
-
abi:
|
|
923
|
+
abi: Rt,
|
|
924
924
|
functionName: "getImplementationForFunction",
|
|
925
925
|
args: [Fe(Ae({
|
|
926
|
-
abi:
|
|
926
|
+
abi: Vt,
|
|
927
927
|
name: "getSeedExecutor"
|
|
928
928
|
}))]
|
|
929
929
|
});
|
|
930
930
|
if (n === Ie) return null;
|
|
931
931
|
let [r, i] = await t.readContract({
|
|
932
932
|
address: n,
|
|
933
|
-
abi:
|
|
933
|
+
abi: Vt,
|
|
934
934
|
functionName: "getSeedExecutor"
|
|
935
935
|
});
|
|
936
936
|
return {
|
|
@@ -938,90 +938,90 @@ async function _n(e = El()) {
|
|
|
938
938
|
eas: i
|
|
939
939
|
};
|
|
940
940
|
}
|
|
941
|
-
async function
|
|
942
|
-
return
|
|
941
|
+
async function yn(e, t) {
|
|
942
|
+
return A().readContract({
|
|
943
943
|
address: e,
|
|
944
|
-
abi:
|
|
944
|
+
abi: Vt,
|
|
945
945
|
functionName: "isModuleInstalled",
|
|
946
946
|
args: [
|
|
947
|
-
|
|
947
|
+
Ht,
|
|
948
948
|
t,
|
|
949
949
|
"0x"
|
|
950
950
|
]
|
|
951
951
|
});
|
|
952
952
|
}
|
|
953
|
-
function
|
|
953
|
+
function bn(e) {
|
|
954
954
|
return {
|
|
955
955
|
to: e,
|
|
956
956
|
data: S({
|
|
957
|
-
abi:
|
|
957
|
+
abi: Vt,
|
|
958
958
|
functionName: "installSeedExecutor"
|
|
959
959
|
})
|
|
960
960
|
};
|
|
961
961
|
}
|
|
962
|
-
function
|
|
962
|
+
function xn(e, t) {
|
|
963
963
|
return {
|
|
964
964
|
to: e,
|
|
965
965
|
data: S({
|
|
966
|
-
abi:
|
|
966
|
+
abi: It,
|
|
967
967
|
functionName: "setEas",
|
|
968
968
|
args: [t]
|
|
969
969
|
})
|
|
970
970
|
};
|
|
971
971
|
}
|
|
972
|
-
async function
|
|
973
|
-
return
|
|
972
|
+
async function Sn(e) {
|
|
973
|
+
return A().readContract({
|
|
974
974
|
address: e,
|
|
975
|
-
abi:
|
|
975
|
+
abi: It,
|
|
976
976
|
functionName: "getEas"
|
|
977
977
|
});
|
|
978
978
|
}
|
|
979
|
-
async function
|
|
980
|
-
return
|
|
979
|
+
async function Cn(e, t) {
|
|
980
|
+
return A().readContract({
|
|
981
981
|
address: e,
|
|
982
|
-
abi:
|
|
982
|
+
abi: It,
|
|
983
983
|
functionName: "isActiveSigner",
|
|
984
984
|
args: [t]
|
|
985
985
|
});
|
|
986
986
|
}
|
|
987
|
-
async function
|
|
988
|
-
return
|
|
987
|
+
async function wn(e, t) {
|
|
988
|
+
return A().readContract({
|
|
989
989
|
address: e,
|
|
990
|
-
abi:
|
|
990
|
+
abi: It,
|
|
991
991
|
functionName: "isAdmin",
|
|
992
992
|
args: [t]
|
|
993
993
|
});
|
|
994
994
|
}
|
|
995
|
-
async function
|
|
996
|
-
return
|
|
997
|
-
address:
|
|
998
|
-
abi:
|
|
995
|
+
async function Tn(e, t = "0x") {
|
|
996
|
+
return A().readContract({
|
|
997
|
+
address: Dl(),
|
|
998
|
+
abi: Rt,
|
|
999
999
|
functionName: "getAddress",
|
|
1000
1000
|
args: [e, t]
|
|
1001
1001
|
});
|
|
1002
1002
|
}
|
|
1003
|
-
function
|
|
1003
|
+
function En(e, t = "0x") {
|
|
1004
1004
|
return {
|
|
1005
|
-
to:
|
|
1005
|
+
to: Dl(),
|
|
1006
1006
|
data: S({
|
|
1007
|
-
abi:
|
|
1007
|
+
abi: Rt,
|
|
1008
1008
|
functionName: "createAccount",
|
|
1009
1009
|
args: [e, t]
|
|
1010
1010
|
})
|
|
1011
1011
|
};
|
|
1012
1012
|
}
|
|
1013
|
-
var
|
|
1014
|
-
function
|
|
1013
|
+
var Dn = "0x0000000000000000000000000000000000000000";
|
|
1014
|
+
function On(e) {
|
|
1015
1015
|
let { easContractAddress: t } = Q();
|
|
1016
1016
|
return {
|
|
1017
1017
|
to: t,
|
|
1018
1018
|
data: S({
|
|
1019
|
-
abi:
|
|
1019
|
+
abi: Pt,
|
|
1020
1020
|
functionName: "attest",
|
|
1021
1021
|
args: [{
|
|
1022
1022
|
schema: e.schema,
|
|
1023
1023
|
data: {
|
|
1024
|
-
recipient: e.data.recipient ??
|
|
1024
|
+
recipient: e.data.recipient ?? Dn,
|
|
1025
1025
|
expirationTime: e.data.expirationTime ?? 0n,
|
|
1026
1026
|
revocable: e.data.revocable ?? !0,
|
|
1027
1027
|
refUID: e.data.refUID,
|
|
@@ -1032,23 +1032,23 @@ function Dn(e) {
|
|
|
1032
1032
|
})
|
|
1033
1033
|
};
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1035
|
+
function kn(e) {
|
|
1036
1036
|
let { easContractAddress: t } = Q();
|
|
1037
1037
|
return {
|
|
1038
1038
|
to: t,
|
|
1039
1039
|
data: S({
|
|
1040
|
-
abi:
|
|
1040
|
+
abi: Pt,
|
|
1041
1041
|
functionName: "multiAttest",
|
|
1042
1042
|
args: [e]
|
|
1043
1043
|
})
|
|
1044
1044
|
};
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1046
|
+
function An(e) {
|
|
1047
1047
|
let { easContractAddress: t } = Q();
|
|
1048
1048
|
return {
|
|
1049
1049
|
to: t,
|
|
1050
1050
|
data: S({
|
|
1051
|
-
abi:
|
|
1051
|
+
abi: Pt,
|
|
1052
1052
|
functionName: "multiRevoke",
|
|
1053
1053
|
args: [e.map((e) => ({
|
|
1054
1054
|
schema: e.schema,
|
|
@@ -1060,26 +1060,26 @@ function kn(e) {
|
|
|
1060
1060
|
})
|
|
1061
1061
|
};
|
|
1062
1062
|
}
|
|
1063
|
-
var
|
|
1064
|
-
async function
|
|
1065
|
-
let t = await
|
|
1063
|
+
var jn = "0x" + "0".repeat(64);
|
|
1064
|
+
async function Mn(e) {
|
|
1065
|
+
let t = await A().readContract({
|
|
1066
1066
|
address: Q().schemaRegistryAddress,
|
|
1067
|
-
abi:
|
|
1067
|
+
abi: Ut,
|
|
1068
1068
|
functionName: "getSchema",
|
|
1069
1069
|
args: [e]
|
|
1070
1070
|
});
|
|
1071
|
-
return !t || t.uid ===
|
|
1071
|
+
return !t || t.uid === jn ? null : {
|
|
1072
1072
|
uid: t.uid,
|
|
1073
1073
|
resolver: t.resolver,
|
|
1074
1074
|
revocable: t.revocable,
|
|
1075
1075
|
schema: t.schema
|
|
1076
1076
|
};
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Nn(e) {
|
|
1079
1079
|
return {
|
|
1080
1080
|
to: Q().schemaRegistryAddress,
|
|
1081
1081
|
data: S({
|
|
1082
|
-
abi:
|
|
1082
|
+
abi: Ut,
|
|
1083
1083
|
functionName: "register",
|
|
1084
1084
|
args: [
|
|
1085
1085
|
e.schema,
|
|
@@ -1091,33 +1091,33 @@ function Mn(e) {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
//#endregion
|
|
1093
1093
|
//#region src/helpers/easDirect.ts
|
|
1094
|
-
var
|
|
1095
|
-
function Pn(e) {
|
|
1096
|
-
return Dn(e);
|
|
1097
|
-
}
|
|
1094
|
+
var Pn = "0x0000000000000000000000000000000000000000", M = "0x" + "0".repeat(64);
|
|
1098
1095
|
function Fn(e) {
|
|
1099
1096
|
return On(e);
|
|
1100
1097
|
}
|
|
1101
1098
|
function In(e) {
|
|
1102
|
-
return
|
|
1099
|
+
return kn(e);
|
|
1103
1100
|
}
|
|
1104
|
-
function Ln(e
|
|
1105
|
-
return
|
|
1101
|
+
function Ln(e) {
|
|
1102
|
+
return ke([{ type: "bytes32" }], [e]);
|
|
1106
1103
|
}
|
|
1107
1104
|
function Rn(e, t) {
|
|
1105
|
+
return zn(e, t)[0]?.uid;
|
|
1106
|
+
}
|
|
1107
|
+
function zn(e, t) {
|
|
1108
1108
|
if (!e.logs?.length) return [];
|
|
1109
1109
|
let n = t.toLowerCase(), r = e.logs.filter((e) => e.address && e.address.toLowerCase() === n);
|
|
1110
1110
|
if (!r.length) return [];
|
|
1111
1111
|
try {
|
|
1112
1112
|
let e = Pe({
|
|
1113
|
-
abi:
|
|
1113
|
+
abi: Pt,
|
|
1114
1114
|
eventName: "Attested",
|
|
1115
1115
|
logs: r,
|
|
1116
1116
|
strict: !1
|
|
1117
1117
|
}), t = [];
|
|
1118
1118
|
for (let n of e) {
|
|
1119
1119
|
let e = n.args?.uid, r = n.args?.schemaUID;
|
|
1120
|
-
e && e !==
|
|
1120
|
+
e && e !== M && r && t.push({
|
|
1121
1121
|
schemaUid: r,
|
|
1122
1122
|
uid: e
|
|
1123
1123
|
});
|
|
@@ -1127,12 +1127,12 @@ function Rn(e, t) {
|
|
|
1127
1127
|
return [];
|
|
1128
1128
|
}
|
|
1129
1129
|
}
|
|
1130
|
-
function
|
|
1131
|
-
return
|
|
1130
|
+
function Bn(e) {
|
|
1131
|
+
return An(e);
|
|
1132
1132
|
}
|
|
1133
1133
|
//#endregion
|
|
1134
1134
|
//#region src/helpers/describeRevert.ts
|
|
1135
|
-
var
|
|
1135
|
+
var Vn = [
|
|
1136
1136
|
{
|
|
1137
1137
|
type: "error",
|
|
1138
1138
|
name: "PublishIndexOutOfBounds",
|
|
@@ -1288,26 +1288,26 @@ var Bn = [
|
|
|
1288
1288
|
type: "uint256"
|
|
1289
1289
|
}]
|
|
1290
1290
|
},
|
|
1291
|
-
...
|
|
1292
|
-
...
|
|
1291
|
+
...Bt,
|
|
1292
|
+
...Pt
|
|
1293
1293
|
];
|
|
1294
|
-
function
|
|
1294
|
+
function Hn(e) {
|
|
1295
1295
|
if (e instanceof Te) return e.walk((e) => {
|
|
1296
1296
|
let t = e.data;
|
|
1297
1297
|
return typeof t == "string" && t.startsWith("0x") && t.length > 2;
|
|
1298
1298
|
})?.data;
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1301
|
-
if (
|
|
1300
|
+
function Un(e) {
|
|
1301
|
+
if (Hn(e)) return !0;
|
|
1302
1302
|
let t = e instanceof Te ? `${e.shortMessage} ${e.details}` : String(e);
|
|
1303
1303
|
return /revert/i.test(t);
|
|
1304
1304
|
}
|
|
1305
|
-
var
|
|
1306
|
-
function
|
|
1305
|
+
var Wn = "reverted with no data. The target likely has no matching function or the account cannot run executor calls";
|
|
1306
|
+
function Gn(e, t = Wn) {
|
|
1307
1307
|
if (!e || e === "0x") return t;
|
|
1308
1308
|
try {
|
|
1309
1309
|
let t = Oe({
|
|
1310
|
-
abi:
|
|
1310
|
+
abi: Vn,
|
|
1311
1311
|
data: e
|
|
1312
1312
|
}), n = t.args?.length ? `(${t.args.map(String).join(", ")})` : "";
|
|
1313
1313
|
return `reverted with ${t.errorName}${n}`;
|
|
@@ -1315,41 +1315,41 @@ function Wn(e, t = Un) {
|
|
|
1315
1315
|
return `reverted with data ${e}`;
|
|
1316
1316
|
}
|
|
1317
1317
|
}
|
|
1318
|
-
function
|
|
1319
|
-
return t && t !== "0x" ? `The publish UserOp in transaction ${e} ${
|
|
1318
|
+
function Kn(e, t) {
|
|
1319
|
+
return t && t !== "0x" ? `The publish UserOp in transaction ${e} ${Gn(t)}.` : `The publish UserOp in transaction ${e} failed with no revert reason. That usually means it ran out of gas (the bundler's gas estimate was too low), not that the publish data is wrong. To confirm, run \`npx hardhat seed:explain-userop --network <network> --tx ${e}\` in seed-protocol.`;
|
|
1320
1320
|
}
|
|
1321
|
-
function
|
|
1321
|
+
function qn(e) {
|
|
1322
1322
|
let { txHash: t, revertData: n, sender: r, cause: i } = e, a = !!n && n !== "0x";
|
|
1323
|
-
return new
|
|
1323
|
+
return new k(Kn(t, n), a ? "USEROP_REVERTED" : "USEROP_FAILED_NO_REASON", r, i);
|
|
1324
1324
|
}
|
|
1325
|
-
function
|
|
1325
|
+
function Jn(e) {
|
|
1326
1326
|
let t = [];
|
|
1327
1327
|
for (let n = e; n && t.length < 6; n = n.cause) t.push(n);
|
|
1328
1328
|
return t;
|
|
1329
1329
|
}
|
|
1330
|
-
var
|
|
1331
|
-
function
|
|
1332
|
-
return
|
|
1330
|
+
var Yn;
|
|
1331
|
+
function Xn(e) {
|
|
1332
|
+
return Yn ??= new Map(Vn.filter((e) => e.type === "error").map((e) => [Fe(`${e.name}(${e.inputs.map((e) => e.type).join(",")})`), e.name])), Yn.get(e.toLowerCase());
|
|
1333
1333
|
}
|
|
1334
|
-
function
|
|
1335
|
-
for (let n of
|
|
1334
|
+
function Zn(e, t) {
|
|
1335
|
+
for (let n of Jn(e)) {
|
|
1336
1336
|
let r = String(n.message ?? "").match(/UserOp failed at txHash: (0x[0-9a-f]{64})/i);
|
|
1337
|
-
if (r) return
|
|
1337
|
+
if (r) return qn({
|
|
1338
1338
|
txHash: r[1],
|
|
1339
1339
|
sender: t,
|
|
1340
1340
|
cause: e
|
|
1341
1341
|
});
|
|
1342
1342
|
let i = n.signature;
|
|
1343
1343
|
if (n.name === "AbiErrorSignatureNotFoundError" && typeof i == "string") {
|
|
1344
|
-
let n =
|
|
1345
|
-
if (n) return new
|
|
1344
|
+
let n = Xn(i);
|
|
1345
|
+
if (n) return new k(`The publish transaction reverted with ${n} (its arguments were not decoded).`, "USEROP_REVERTED", t, e);
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
1348
|
return e;
|
|
1349
1349
|
}
|
|
1350
1350
|
//#endregion
|
|
1351
1351
|
//#region src/helpers/retryNonceTooLow.ts
|
|
1352
|
-
function
|
|
1352
|
+
function Qn(e) {
|
|
1353
1353
|
let t = [], n = e;
|
|
1354
1354
|
for (let e = 0; n && e < 5; e++) {
|
|
1355
1355
|
let e = n;
|
|
@@ -1357,36 +1357,36 @@ function Zn(e) {
|
|
|
1357
1357
|
}
|
|
1358
1358
|
return /nonce too low|nonce has already been used|NONCE_EXPIRED|nonce.*already.*(used|known)|lower than the current nonce/i.test(t.join(" "));
|
|
1359
1359
|
}
|
|
1360
|
-
async function
|
|
1360
|
+
async function $n(e, { attempts: t = 3, delayMs: n = 1e3 } = {}) {
|
|
1361
1361
|
for (let r = 1;; r++) try {
|
|
1362
1362
|
return await e();
|
|
1363
1363
|
} catch (e) {
|
|
1364
|
-
if (r >= t || !
|
|
1364
|
+
if (r >= t || !Qn(e)) throw e;
|
|
1365
1365
|
await new Promise((e) => setTimeout(e, n));
|
|
1366
1366
|
}
|
|
1367
1367
|
}
|
|
1368
1368
|
//#endregion
|
|
1369
1369
|
//#region src/helpers/seedSigner.ts
|
|
1370
|
-
var
|
|
1371
|
-
function tr(e) {
|
|
1372
|
-
return Object.assign(e, { [$n]: !0 });
|
|
1373
|
-
}
|
|
1370
|
+
var er = Symbol.for("seedprotocol.SeedSigner"), tr = Symbol.for("seedprotocol.SeedTxSender");
|
|
1374
1371
|
function nr(e) {
|
|
1375
1372
|
return Object.assign(e, { [er]: !0 });
|
|
1376
1373
|
}
|
|
1377
|
-
function P(e) {
|
|
1378
|
-
return !!e && typeof e == "object" && $n in e;
|
|
1379
|
-
}
|
|
1380
1374
|
function rr(e) {
|
|
1381
|
-
return
|
|
1375
|
+
return Object.assign(e, { [tr]: !0 });
|
|
1382
1376
|
}
|
|
1383
|
-
function
|
|
1384
|
-
return !!e && typeof e == "object" &&
|
|
1377
|
+
function N(e) {
|
|
1378
|
+
return !!e && typeof e == "object" && er in e;
|
|
1385
1379
|
}
|
|
1386
1380
|
function ir(e) {
|
|
1381
|
+
return !!e && typeof e == "object" && tr in e;
|
|
1382
|
+
}
|
|
1383
|
+
function P(e) {
|
|
1384
|
+
return !!e && typeof e == "object" && "signer" in e && "txSender" in e && N(e.signer) && ir(e.txSender);
|
|
1385
|
+
}
|
|
1386
|
+
function ar(e) {
|
|
1387
1387
|
let t = e.address;
|
|
1388
1388
|
return {
|
|
1389
|
-
signer:
|
|
1389
|
+
signer: nr({
|
|
1390
1390
|
address: t,
|
|
1391
1391
|
signMessage: async ({ message: t }) => {
|
|
1392
1392
|
if (typeof t == "string") return await e.signMessage(t);
|
|
@@ -1394,9 +1394,9 @@ function ir(e) {
|
|
|
1394
1394
|
return await e.signMessage(r);
|
|
1395
1395
|
}
|
|
1396
1396
|
}),
|
|
1397
|
-
txSender:
|
|
1397
|
+
txSender: rr({
|
|
1398
1398
|
address: t,
|
|
1399
|
-
sendTransaction: async (t) => ({ transactionHash: (await
|
|
1399
|
+
sendTransaction: async (t) => ({ transactionHash: (await $n(() => e.sendTransaction({
|
|
1400
1400
|
to: t.to,
|
|
1401
1401
|
data: t.data,
|
|
1402
1402
|
value: t.value,
|
|
@@ -1406,26 +1406,26 @@ function ir(e) {
|
|
|
1406
1406
|
kind: "eoa"
|
|
1407
1407
|
};
|
|
1408
1408
|
}
|
|
1409
|
-
function
|
|
1410
|
-
if (
|
|
1411
|
-
if (
|
|
1409
|
+
function or(e) {
|
|
1410
|
+
if (P(e)) return e.signer;
|
|
1411
|
+
if (N(e)) return e;
|
|
1412
1412
|
throw Error("@seedprotocol/publish: expected a SeedSigner or PublishWallet. Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
|
|
1413
1413
|
}
|
|
1414
|
-
function
|
|
1415
|
-
if (
|
|
1416
|
-
if (
|
|
1414
|
+
function sr(e) {
|
|
1415
|
+
if (P(e)) return e.txSender;
|
|
1416
|
+
if (ir(e)) return e;
|
|
1417
1417
|
throw Error("@seedprotocol/publish: expected a SeedTxSender or PublishWallet. Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
|
|
1418
1418
|
}
|
|
1419
|
-
function
|
|
1420
|
-
if (
|
|
1419
|
+
function cr(e) {
|
|
1420
|
+
if (P(e)) return e;
|
|
1421
1421
|
throw Error("@seedprotocol/publish: expected a PublishWallet (signer + txSender). Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
|
|
1422
1422
|
}
|
|
1423
1423
|
//#endregion
|
|
1424
1424
|
//#region src/helpers/thirdwebChain.ts
|
|
1425
|
-
var
|
|
1426
|
-
function
|
|
1427
|
-
let t = e ??
|
|
1428
|
-
if (
|
|
1425
|
+
var lr = null;
|
|
1426
|
+
function F(e) {
|
|
1427
|
+
let t = e ?? xl() ?? {}, n = t.chain ?? O, r = t.rpcUrl?.trim() || void 0, i = `${n.id}|${r ?? ""}`;
|
|
1428
|
+
if (lr?.key === i) return lr.chain;
|
|
1429
1429
|
let a;
|
|
1430
1430
|
return a = n.id === Ge.id && !r ? Ge : We({
|
|
1431
1431
|
id: n.id,
|
|
@@ -1438,14 +1438,14 @@ function I(e) {
|
|
|
1438
1438
|
apiUrl: n
|
|
1439
1439
|
})) : void 0,
|
|
1440
1440
|
...r ? { rpc: r } : {}
|
|
1441
|
-
}),
|
|
1441
|
+
}), lr = {
|
|
1442
1442
|
key: i,
|
|
1443
1443
|
chain: a
|
|
1444
1444
|
}, a;
|
|
1445
1445
|
}
|
|
1446
|
-
var
|
|
1447
|
-
function
|
|
1448
|
-
if (
|
|
1446
|
+
var ur = /* @__PURE__ */ new Set([31337, 1337]);
|
|
1447
|
+
function dr(e) {
|
|
1448
|
+
if (ur.has(e.id)) return !0;
|
|
1449
1449
|
try {
|
|
1450
1450
|
let t = new URL(e.rpc).hostname.replace(/^\[|\]$/g, "");
|
|
1451
1451
|
return t === "localhost" || t === "127.0.0.1" || t === "::1" || t.endsWith(".localhost");
|
|
@@ -1455,11 +1455,11 @@ function ur(e) {
|
|
|
1455
1455
|
}
|
|
1456
1456
|
//#endregion
|
|
1457
1457
|
//#region src/helpers/gasLog.ts
|
|
1458
|
-
function
|
|
1458
|
+
function I(e, t) {
|
|
1459
1459
|
let n = Object.fromEntries(Object.entries(t).map(([e, t]) => [e, typeof t == "bigint" ? t.toString() : t]));
|
|
1460
1460
|
console.info(`[seed:gas] ${e}`, n);
|
|
1461
1461
|
}
|
|
1462
|
-
function
|
|
1462
|
+
function L(e) {
|
|
1463
1463
|
let t = e.paymasterAndData;
|
|
1464
1464
|
return {
|
|
1465
1465
|
callGasLimit: e.callGasLimit,
|
|
@@ -1470,22 +1470,22 @@ function R(e) {
|
|
|
1470
1470
|
}
|
|
1471
1471
|
//#endregion
|
|
1472
1472
|
//#region src/helpers/adapters/thirdwebAccount.ts
|
|
1473
|
-
var
|
|
1474
|
-
asSeedSignerFromThirdweb: () =>
|
|
1475
|
-
asThirdwebPublishWallet: () =>
|
|
1476
|
-
fromThirdwebAccount: () =>
|
|
1473
|
+
var fr = /* @__PURE__ */ e({
|
|
1474
|
+
asSeedSignerFromThirdweb: () => hr,
|
|
1475
|
+
asThirdwebPublishWallet: () => mr,
|
|
1476
|
+
fromThirdwebAccount: () => pr
|
|
1477
1477
|
});
|
|
1478
|
-
function
|
|
1478
|
+
function pr(e, t) {
|
|
1479
1479
|
let n = t?.client, r = e.address;
|
|
1480
1480
|
return {
|
|
1481
|
-
signer:
|
|
1481
|
+
signer: nr({
|
|
1482
1482
|
address: r,
|
|
1483
1483
|
signMessage: async ({ message: t }) => await e.signMessage({ message: t })
|
|
1484
1484
|
}),
|
|
1485
|
-
txSender:
|
|
1485
|
+
txSender: rr({
|
|
1486
1486
|
address: r,
|
|
1487
1487
|
sendTransaction: async (t) => {
|
|
1488
|
-
let i = n ?? (await Promise.resolve().then(() =>
|
|
1488
|
+
let i = n ?? (await Promise.resolve().then(() => sa)).getClient(), a = F(), o = Be({
|
|
1489
1489
|
client: i,
|
|
1490
1490
|
chain: a,
|
|
1491
1491
|
to: t.to,
|
|
@@ -1493,7 +1493,7 @@ function fr(e, t) {
|
|
|
1493
1493
|
value: t.value,
|
|
1494
1494
|
gas: t.gas
|
|
1495
1495
|
});
|
|
1496
|
-
|
|
1496
|
+
I("sending transaction through thirdweb", {
|
|
1497
1497
|
account: r,
|
|
1498
1498
|
chainId: a.id,
|
|
1499
1499
|
to: t.to,
|
|
@@ -1502,17 +1502,17 @@ function fr(e, t) {
|
|
|
1502
1502
|
});
|
|
1503
1503
|
let s;
|
|
1504
1504
|
try {
|
|
1505
|
-
s = await
|
|
1505
|
+
s = await $n(() => Ve({
|
|
1506
1506
|
account: e,
|
|
1507
1507
|
transaction: o
|
|
1508
1508
|
}));
|
|
1509
1509
|
} catch (e) {
|
|
1510
|
-
throw
|
|
1510
|
+
throw I("thirdweb sendTransaction failed", {
|
|
1511
1511
|
account: r,
|
|
1512
1512
|
error: e instanceof Error ? e.message : String(e)
|
|
1513
1513
|
}), e;
|
|
1514
1514
|
}
|
|
1515
|
-
return
|
|
1515
|
+
return I("thirdweb sendTransaction returned", {
|
|
1516
1516
|
account: r,
|
|
1517
1517
|
transactionHash: s.transactionHash
|
|
1518
1518
|
}), { transactionHash: s.transactionHash };
|
|
@@ -1521,43 +1521,43 @@ function fr(e, t) {
|
|
|
1521
1521
|
...t?.kind && { kind: t.kind }
|
|
1522
1522
|
};
|
|
1523
1523
|
}
|
|
1524
|
-
function
|
|
1525
|
-
if (
|
|
1526
|
-
if (
|
|
1527
|
-
return
|
|
1524
|
+
function mr(e, t) {
|
|
1525
|
+
if (P(e)) return e;
|
|
1526
|
+
if (N(e)) throw Error("@seedprotocol/publish/thirdweb: SeedSigner alone cannot send sponsored txs. Pass fromThirdwebAccount(account) or a PublishWallet.");
|
|
1527
|
+
return pr(e, t);
|
|
1528
1528
|
}
|
|
1529
|
-
function
|
|
1530
|
-
return
|
|
1529
|
+
function hr(e) {
|
|
1530
|
+
return P(e) ? e.signer : N(e) ? e : pr(e).signer;
|
|
1531
1531
|
}
|
|
1532
1532
|
//#endregion
|
|
1533
1533
|
//#region src/helpers/verifyPublishChain.ts
|
|
1534
|
-
var
|
|
1534
|
+
var gr = class extends Error {
|
|
1535
1535
|
chainId;
|
|
1536
1536
|
problems;
|
|
1537
1537
|
name = "PublishChainConfigError";
|
|
1538
1538
|
constructor(e, t) {
|
|
1539
1539
|
super(`@seedprotocol/publish: chain ${e} is not set up for publishing:\n- ${t.join("\n- ")}`), this.chainId = e, this.problems = t;
|
|
1540
1540
|
}
|
|
1541
|
-
},
|
|
1542
|
-
function
|
|
1541
|
+
}, _r = null;
|
|
1542
|
+
function vr() {
|
|
1543
1543
|
let e = Q();
|
|
1544
1544
|
return [
|
|
1545
1545
|
e.chain.id,
|
|
1546
|
-
|
|
1546
|
+
Al(),
|
|
1547
1547
|
e.easContractAddress,
|
|
1548
1548
|
e.schemaRegistryAddress,
|
|
1549
1549
|
e.thirdwebAccountFactoryAddress ?? "",
|
|
1550
1550
|
e.modularAccountModuleContract ?? ""
|
|
1551
1551
|
].join("|").toLowerCase();
|
|
1552
1552
|
}
|
|
1553
|
-
async function
|
|
1553
|
+
async function yr() {
|
|
1554
1554
|
let e = Q(), { chain: t } = e, n = [], r;
|
|
1555
1555
|
try {
|
|
1556
|
-
r = await
|
|
1556
|
+
r = await A().getChainId();
|
|
1557
1557
|
} catch (e) {
|
|
1558
|
-
throw new
|
|
1558
|
+
throw new gr(t.id, [`could not reach the RPC (${br(Al())}): ${e instanceof Error ? e.message : String(e)}`]);
|
|
1559
1559
|
}
|
|
1560
|
-
if (r !== t.id) throw new
|
|
1560
|
+
if (r !== t.id) throw new gr(t.id, [`the RPC reports chain ${r}, but PublishConfig.chain is ${t.name} (${t.id}). Point rpcUrl at ${t.name}.`]);
|
|
1561
1561
|
let i = [
|
|
1562
1562
|
[
|
|
1563
1563
|
"EAS contract",
|
|
@@ -1579,11 +1579,11 @@ async function vr() {
|
|
|
1579
1579
|
e.modularAccountModuleContract?.trim() || void 0,
|
|
1580
1580
|
"deploy the module or fix modularAccountModuleContract"
|
|
1581
1581
|
]
|
|
1582
|
-
], a = await Promise.all(i.map(async ([e, n, r]) => n ? await
|
|
1582
|
+
], a = await Promise.all(i.map(async ([e, n, r]) => n ? await rn(n) ? null : `no ${e} at ${n} on ${t.name}; ${r}.` : null));
|
|
1583
1583
|
for (let e of a) e && n.push(e);
|
|
1584
|
-
if (n.length > 0) throw new
|
|
1584
|
+
if (n.length > 0) throw new gr(t.id, n);
|
|
1585
1585
|
}
|
|
1586
|
-
function
|
|
1586
|
+
function br(e) {
|
|
1587
1587
|
try {
|
|
1588
1588
|
let t = new URL(e);
|
|
1589
1589
|
return `${t.protocol}//${t.host}`;
|
|
@@ -1591,74 +1591,74 @@ function yr(e) {
|
|
|
1591
1591
|
return "configured rpcUrl";
|
|
1592
1592
|
}
|
|
1593
1593
|
}
|
|
1594
|
-
function
|
|
1595
|
-
let e =
|
|
1596
|
-
if (
|
|
1597
|
-
let t =
|
|
1598
|
-
return
|
|
1594
|
+
function xr() {
|
|
1595
|
+
let e = vr();
|
|
1596
|
+
if (_r?.key === e) return _r.result;
|
|
1597
|
+
let t = yr();
|
|
1598
|
+
return _r = {
|
|
1599
1599
|
key: e,
|
|
1600
1600
|
result: t
|
|
1601
1601
|
}, t.catch(() => {
|
|
1602
|
-
|
|
1602
|
+
_r?.result === t && (_r = null);
|
|
1603
1603
|
}), t;
|
|
1604
1604
|
}
|
|
1605
1605
|
//#endregion
|
|
1606
1606
|
//#region src/services/revoke/revokeAttestations.ts
|
|
1607
|
-
var
|
|
1608
|
-
assertCanRevokeSeedAttestations: () =>
|
|
1609
|
-
revokeAttestations: () =>
|
|
1610
|
-
revokePropertyAttestations: () =>
|
|
1607
|
+
var Sr = /* @__PURE__ */ e({
|
|
1608
|
+
assertCanRevokeSeedAttestations: () => Nr,
|
|
1609
|
+
revokeAttestations: () => Fr,
|
|
1610
|
+
revokePropertyAttestations: () => Pr
|
|
1611
1611
|
});
|
|
1612
|
-
async function
|
|
1612
|
+
async function Cr(e) {
|
|
1613
1613
|
if (!e) return !1;
|
|
1614
|
-
let t =
|
|
1614
|
+
let t = v();
|
|
1615
1615
|
if (!t) return !1;
|
|
1616
1616
|
let n = await t(), r = e.toLowerCase();
|
|
1617
1617
|
return !!n?.some((e) => e?.toLowerCase() === r);
|
|
1618
1618
|
}
|
|
1619
|
-
async function
|
|
1619
|
+
async function wr(e, t) {
|
|
1620
1620
|
if (!t || !Q().modularAccountModuleContract?.trim()) return !1;
|
|
1621
1621
|
let n = e.signer?.address;
|
|
1622
1622
|
if (!n || n.toLowerCase() === t.toLowerCase()) return !1;
|
|
1623
1623
|
try {
|
|
1624
|
-
let { isAutomationSessionActive: e } = await import("./ensureAutomationSessionKey-
|
|
1624
|
+
let { isAutomationSessionActive: e } = await import("./ensureAutomationSessionKey-B19eVd1T.js").then((e) => e.n);
|
|
1625
1625
|
return await e(t, n);
|
|
1626
1626
|
} catch {
|
|
1627
1627
|
return !1;
|
|
1628
1628
|
}
|
|
1629
1629
|
}
|
|
1630
|
-
var
|
|
1631
|
-
function
|
|
1630
|
+
var Tr = "0x905e7107", Er = "0x4ca88867";
|
|
1631
|
+
function Dr(e, t) {
|
|
1632
1632
|
return !!e && !!t && e.toLowerCase() === t.toLowerCase();
|
|
1633
1633
|
}
|
|
1634
|
-
function
|
|
1635
|
-
if (
|
|
1634
|
+
function Or(e, t, n) {
|
|
1635
|
+
if (Hn(e)?.toLowerCase().startsWith(n)) return !0;
|
|
1636
1636
|
let r = e instanceof Error ? e.message : String(e);
|
|
1637
1637
|
return r.includes(t) || r.toLowerCase().includes(n);
|
|
1638
1638
|
}
|
|
1639
|
-
async function
|
|
1639
|
+
async function kr(e) {
|
|
1640
1640
|
let t = n();
|
|
1641
|
-
if (t && (!e ||
|
|
1641
|
+
if (t && (!e || Dr(t.txSender.address, e))) return t;
|
|
1642
1642
|
try {
|
|
1643
|
-
let { getConnectedAccount: n } = await Promise.resolve().then(() =>
|
|
1643
|
+
let { getConnectedAccount: n } = await Promise.resolve().then(() => pa), { resolveRevokeAccount: r } = await import("./resolveRevokeAccount-D08n9UTy.js"), i = await n();
|
|
1644
1644
|
if (!i) throw Error("No wallet connected. Connect a wallet to revoke attestations.");
|
|
1645
1645
|
let a = await r({
|
|
1646
1646
|
account: i,
|
|
1647
1647
|
attester: e
|
|
1648
1648
|
});
|
|
1649
|
-
if (!t ||
|
|
1649
|
+
if (!t || Dr(a.address, e)) return pr(a);
|
|
1650
1650
|
} catch (e) {
|
|
1651
1651
|
if (t) return t;
|
|
1652
1652
|
throw e instanceof Error && e.message.includes("No wallet connected") || e instanceof Error && e.message.includes("Revocation not supported") ? e : Error("No wallet connected. Use useSeedWallet / setPublishWallet, or @seedprotocol/publish/thirdweb ConnectButton.", { cause: e });
|
|
1653
1653
|
}
|
|
1654
1654
|
return t;
|
|
1655
1655
|
}
|
|
1656
|
-
async function
|
|
1656
|
+
async function Ar(e) {
|
|
1657
1657
|
let t = /* @__PURE__ */ new Set(), { easContractAddress: n } = Q();
|
|
1658
1658
|
if (!n || e.length === 0) return t;
|
|
1659
1659
|
let r;
|
|
1660
1660
|
try {
|
|
1661
|
-
r =
|
|
1661
|
+
r = A();
|
|
1662
1662
|
} catch {
|
|
1663
1663
|
return t;
|
|
1664
1664
|
}
|
|
@@ -1666,47 +1666,47 @@ async function kr(e) {
|
|
|
1666
1666
|
try {
|
|
1667
1667
|
(await r.readContract({
|
|
1668
1668
|
address: n,
|
|
1669
|
-
abi:
|
|
1669
|
+
abi: Pt,
|
|
1670
1670
|
functionName: "getAttestation",
|
|
1671
1671
|
args: [e]
|
|
1672
1672
|
})).revocationTime > 0n && t.add(e.toLowerCase());
|
|
1673
1673
|
} catch {}
|
|
1674
1674
|
})), t;
|
|
1675
1675
|
}
|
|
1676
|
-
async function
|
|
1676
|
+
async function jr(e, t) {
|
|
1677
1677
|
let n = t.data;
|
|
1678
1678
|
for (let r = 0;; r++) {
|
|
1679
|
-
let i = await
|
|
1679
|
+
let i = await Ar(n.map((e) => e.uid));
|
|
1680
1680
|
if (n = n.filter((e) => !i.has(e.uid.toLowerCase())), n.length === 0) return;
|
|
1681
1681
|
try {
|
|
1682
|
-
await
|
|
1682
|
+
await j((await e.sendTransaction(Bn([{
|
|
1683
1683
|
schema: t.schema,
|
|
1684
1684
|
data: n
|
|
1685
1685
|
}]))).transactionHash);
|
|
1686
1686
|
return;
|
|
1687
1687
|
} catch (e) {
|
|
1688
|
-
if (
|
|
1689
|
-
if (!
|
|
1688
|
+
if (Or(e, "AccessDenied", Er)) throw Error("Only the original attester can revoke attestations. Connect the wallet that published this item.");
|
|
1689
|
+
if (!Or(e, "AlreadyRevoked", Tr)) throw e;
|
|
1690
1690
|
if (n.length === 1) return;
|
|
1691
1691
|
if (r > 0) throw Error(`multiRevoke for schema ${t.schema} reverted with AlreadyRevoked, and EAS could not be read to tell which of its ${n.length} attestations are already revoked. Retry the revoke.`, { cause: e });
|
|
1692
1692
|
}
|
|
1693
1693
|
}
|
|
1694
1694
|
}
|
|
1695
|
-
async function jr(e) {
|
|
1696
|
-
await m(), await br();
|
|
1697
|
-
let t = await _(e);
|
|
1698
|
-
if (await Sr(t)) throw Error("Revocation not supported for items attested by the Seed executor module: the executor has no revoke and is the only attester that could revoke them.");
|
|
1699
|
-
let n = await Or(t);
|
|
1700
|
-
if (await Cr(n, t)) throw Error("Automation session keys cannot revoke attestations. Revoking is owner-only: connect the account that published this item.");
|
|
1701
|
-
return n;
|
|
1702
|
-
}
|
|
1703
1695
|
async function Mr(e) {
|
|
1704
|
-
await
|
|
1696
|
+
await m(), await xr();
|
|
1697
|
+
let t = await ee(e);
|
|
1698
|
+
if (await Cr(t)) throw Error("Revocation not supported for items attested by the Seed executor module: the executor has no revoke and is the only attester that could revoke them.");
|
|
1699
|
+
let n = await kr(t);
|
|
1700
|
+
if (await wr(n, t)) throw Error("Automation session keys cannot revoke attestations. Revoking is owner-only: connect the account that published this item.");
|
|
1701
|
+
return n;
|
|
1705
1702
|
}
|
|
1706
1703
|
async function Nr(e) {
|
|
1704
|
+
await Mr(e);
|
|
1705
|
+
}
|
|
1706
|
+
async function Pr(e) {
|
|
1707
1707
|
let { seedLocalId: t, seedUid: n, attestations: r } = e, i = r.filter((e) => se(e.uid));
|
|
1708
1708
|
if (i.length === 0) return;
|
|
1709
|
-
let { txSender: a } = await
|
|
1709
|
+
let { txSender: a } = await Mr({
|
|
1710
1710
|
seedLocalId: t,
|
|
1711
1711
|
seedUid: n
|
|
1712
1712
|
}), o = /* @__PURE__ */ new Map();
|
|
@@ -1714,7 +1714,7 @@ async function Nr(e) {
|
|
|
1714
1714
|
let n = o.get(t) ?? [];
|
|
1715
1715
|
n.push(e), o.set(t, n);
|
|
1716
1716
|
}
|
|
1717
|
-
for (let [e, t] of o) await
|
|
1717
|
+
for (let [e, t] of o) await jr(a, {
|
|
1718
1718
|
schema: e,
|
|
1719
1719
|
data: t.map((e) => ({ uid: e }))
|
|
1720
1720
|
});
|
|
@@ -1723,11 +1723,11 @@ async function Nr(e) {
|
|
|
1723
1723
|
revokedAt: Math.floor(Date.now() / 1e3)
|
|
1724
1724
|
});
|
|
1725
1725
|
}
|
|
1726
|
-
async function
|
|
1727
|
-
let { seedLocalId: t, seedUid: n, seedSchemaUid: r } = e, { txSender: i } = await
|
|
1726
|
+
async function Fr(e) {
|
|
1727
|
+
let { seedLocalId: t, seedUid: n, seedSchemaUid: r } = e, { txSender: i } = await Mr({
|
|
1728
1728
|
seedLocalId: t,
|
|
1729
1729
|
seedUid: n
|
|
1730
|
-
}), [a, o] = await Promise.all([ae(n),
|
|
1730
|
+
}), [a, o] = await Promise.all([ae(n), te(n)]), s = a.map((e) => e.uid).filter((e) => se(e)), c = /* @__PURE__ */ new Map();
|
|
1731
1731
|
for (let { uid: e, schemaUid: t } of o) {
|
|
1732
1732
|
if (!se(e)) continue;
|
|
1733
1733
|
let n = c.get(t) ?? [];
|
|
@@ -1745,7 +1745,7 @@ async function Pr(e) {
|
|
|
1745
1745
|
schema: d,
|
|
1746
1746
|
data: s.map((e) => ({ uid: e }))
|
|
1747
1747
|
});
|
|
1748
|
-
for (let e of l) e.data.length !== 0 && await
|
|
1748
|
+
for (let e of l) e.data.length !== 0 && await jr(i, e);
|
|
1749
1749
|
let u = Math.floor(Date.now() / 1e3);
|
|
1750
1750
|
await xe({
|
|
1751
1751
|
seedLocalId: t,
|
|
@@ -1756,19 +1756,19 @@ async function Pr(e) {
|
|
|
1756
1756
|
}
|
|
1757
1757
|
//#endregion
|
|
1758
1758
|
//#region src/services/publishManager/actions/assignRestoreFromDb.ts
|
|
1759
|
-
var
|
|
1759
|
+
var Ir = w(({ event: e }) => {
|
|
1760
1760
|
let t = e, n = t.publishProcesses ?? /* @__PURE__ */ new Map(), r = t.subscriptions ?? /* @__PURE__ */ new Map();
|
|
1761
1761
|
return {
|
|
1762
1762
|
publishProcesses: new Map(n),
|
|
1763
1763
|
subscriptions: new Map(r)
|
|
1764
1764
|
};
|
|
1765
|
-
}),
|
|
1765
|
+
}), Lr = T(async ({ input: { context: e } }) => {
|
|
1766
1766
|
let t = e.htmlEmbeddedDataUriPolicy ?? "materialize";
|
|
1767
1767
|
return { deferredHtmlSeedLocalIds: (await fe(e.item, t)).deferredHtmlSeedLocalIds };
|
|
1768
1768
|
});
|
|
1769
1769
|
//#endregion
|
|
1770
1770
|
//#region src/services/publish/actors/rewritingHtmlEmbedded.ts
|
|
1771
|
-
function
|
|
1771
|
+
function Rr(e, t) {
|
|
1772
1772
|
let n = [], r = Math.min(e?.length ?? 0, t?.length ?? 0);
|
|
1773
1773
|
for (let i = 0; i < r; i++) {
|
|
1774
1774
|
let r = e[i], a = t[i], o = r.transaction?.id;
|
|
@@ -1780,11 +1780,11 @@ function Lr(e, t) {
|
|
|
1780
1780
|
}
|
|
1781
1781
|
return n;
|
|
1782
1782
|
}
|
|
1783
|
-
var
|
|
1784
|
-
let t =
|
|
1783
|
+
var zr = T(async ({ input: { context: e } }) => {
|
|
1784
|
+
let t = Rr(e.htmlEmbeddedPhase1ArweaveTransactions, e.htmlEmbeddedPhase1PublishUploads);
|
|
1785
1785
|
await me(e.item.seedLocalId, t, e.htmlEmbeddedDeferredHtmlSeedLocalIds);
|
|
1786
|
-
}),
|
|
1787
|
-
function
|
|
1786
|
+
}), Br = (...e) => re(...e), Vr = 3, Hr = new TextEncoder().encode("seed-recovery"), Ur = 32, Wr = 18446744073709551615n;
|
|
1787
|
+
function Gr(e, t, n) {
|
|
1788
1788
|
let r = C.solidityPackedKeccak256([
|
|
1789
1789
|
"uint256",
|
|
1790
1790
|
"address",
|
|
@@ -1792,20 +1792,20 @@ function Wr(e, t, n) {
|
|
|
1792
1792
|
], [
|
|
1793
1793
|
BigInt(t),
|
|
1794
1794
|
e,
|
|
1795
|
-
n &
|
|
1795
|
+
n & Wr
|
|
1796
1796
|
]);
|
|
1797
1797
|
return C.getBytes(r);
|
|
1798
1798
|
}
|
|
1799
|
-
function
|
|
1799
|
+
function Kr(e) {
|
|
1800
1800
|
if (e.length === 0) return new Uint8Array([0]);
|
|
1801
|
-
if (e.length !==
|
|
1801
|
+
if (e.length !== Ur) throw Error(`ANS-104 target/anchor must be empty or ${Ur} bytes, got ${e.length}`);
|
|
1802
1802
|
let t = /* @__PURE__ */ new Uint8Array(33);
|
|
1803
1803
|
return t[0] = 1, t.set(e, 1), t;
|
|
1804
1804
|
}
|
|
1805
|
-
function
|
|
1805
|
+
function qr(e) {
|
|
1806
1806
|
return typeof e == "object" && !!e && "privateKey" in e && typeof e.privateKey == "string";
|
|
1807
1807
|
}
|
|
1808
|
-
function
|
|
1808
|
+
function Jr(e, t, n) {
|
|
1809
1809
|
let r = e >= 0 ? e << 1 : ~e << 1 | 1, i = n;
|
|
1810
1810
|
do {
|
|
1811
1811
|
let e = r & 127;
|
|
@@ -1813,10 +1813,10 @@ function qr(e, t, n) {
|
|
|
1813
1813
|
} while (r);
|
|
1814
1814
|
return i - n;
|
|
1815
1815
|
}
|
|
1816
|
-
var
|
|
1816
|
+
var Yr = (e) => {
|
|
1817
1817
|
if (!e?.length) return /* @__PURE__ */ new Uint8Array();
|
|
1818
1818
|
let t = new TextEncoder(), n = /* @__PURE__ */ new Uint8Array(16), r = [], i = (e) => {
|
|
1819
|
-
let t =
|
|
1819
|
+
let t = Jr(e, n, 0);
|
|
1820
1820
|
r.push(n.slice(0, t));
|
|
1821
1821
|
};
|
|
1822
1822
|
i(e.length);
|
|
@@ -1828,35 +1828,35 @@ var Jr = (e) => {
|
|
|
1828
1828
|
let a = r.reduce((e, t) => e + t.length, 0), o = new Uint8Array(a), s = 0;
|
|
1829
1829
|
for (let e of r) o.set(e, s), s += e.length;
|
|
1830
1830
|
return o;
|
|
1831
|
-
},
|
|
1831
|
+
}, Xr = (e) => {
|
|
1832
1832
|
let t = /* @__PURE__ */ new Uint8Array(8), n = new DataView(t.buffer);
|
|
1833
1833
|
return n.setUint32(0, e | 0, !0), n.setUint32(4, Math.floor(e / 4294967296), !0), t;
|
|
1834
1834
|
};
|
|
1835
|
-
async function
|
|
1835
|
+
async function Zr(e) {
|
|
1836
1836
|
return new Uint8Array(await crypto.subtle.digest("SHA-384", e));
|
|
1837
1837
|
}
|
|
1838
|
-
function
|
|
1838
|
+
function Qr(e, t) {
|
|
1839
1839
|
let n = new Uint8Array(e.length + t.length);
|
|
1840
1840
|
return n.set(e, 0), n.set(t, e.length), n;
|
|
1841
1841
|
}
|
|
1842
|
-
async function
|
|
1842
|
+
async function $r(e) {
|
|
1843
1843
|
let t = new TextEncoder();
|
|
1844
1844
|
if (Array.isArray(e)) {
|
|
1845
|
-
let n = await
|
|
1845
|
+
let n = await Zr(Qr(t.encode("list"), t.encode(e.length.toString())));
|
|
1846
1846
|
for (let t of e) {
|
|
1847
|
-
let e = await
|
|
1848
|
-
n = await
|
|
1847
|
+
let e = await $r(t);
|
|
1848
|
+
n = await Zr(Qr(n, e));
|
|
1849
1849
|
}
|
|
1850
1850
|
return n;
|
|
1851
1851
|
}
|
|
1852
|
-
return
|
|
1852
|
+
return Zr(Qr(await Zr(Qr(t.encode("blob"), t.encode(e.byteLength.toString()))), await Zr(e)));
|
|
1853
1853
|
}
|
|
1854
|
-
async function
|
|
1854
|
+
async function ei(e, t, n, r, i) {
|
|
1855
1855
|
let a = new TextEncoder();
|
|
1856
|
-
return
|
|
1856
|
+
return $r([
|
|
1857
1857
|
a.encode("dataitem"),
|
|
1858
1858
|
a.encode("1"),
|
|
1859
|
-
a.encode(
|
|
1859
|
+
a.encode(Vr.toString()),
|
|
1860
1860
|
e,
|
|
1861
1861
|
t,
|
|
1862
1862
|
n,
|
|
@@ -1864,11 +1864,11 @@ async function $r(e, t, n, r, i) {
|
|
|
1864
1864
|
i
|
|
1865
1865
|
]);
|
|
1866
1866
|
}
|
|
1867
|
-
function
|
|
1868
|
-
let a =
|
|
1867
|
+
function ti(e, t, n, r, i) {
|
|
1868
|
+
let a = Yr(t), o = Xr(t.length), s = Xr(a.length), c = [
|
|
1869
1869
|
e,
|
|
1870
|
-
|
|
1871
|
-
|
|
1870
|
+
Kr(r),
|
|
1871
|
+
Kr(i),
|
|
1872
1872
|
o,
|
|
1873
1873
|
s,
|
|
1874
1874
|
a,
|
|
@@ -1877,32 +1877,32 @@ function ei(e, t, n, r, i) {
|
|
|
1877
1877
|
for (let e of c) u.set(e, d), d += e.length;
|
|
1878
1878
|
return u;
|
|
1879
1879
|
}
|
|
1880
|
-
async function
|
|
1880
|
+
async function ni(e, t) {
|
|
1881
1881
|
let n = /* @__PURE__ */ new Uint8Array(2);
|
|
1882
|
-
new DataView(n.buffer).setUint16(0,
|
|
1882
|
+
new DataView(n.buffer).setUint16(0, Vr, !0);
|
|
1883
1883
|
let r = 67 + t.length, i = new Uint8Array(r);
|
|
1884
1884
|
i.set(n, 0), i.set(e, 2), i.set(t, 67);
|
|
1885
1885
|
let a = await crypto.subtle.digest("SHA-256", new Uint8Array(e));
|
|
1886
1886
|
return {
|
|
1887
|
-
id:
|
|
1887
|
+
id: ci(new Uint8Array(a)),
|
|
1888
1888
|
raw: i
|
|
1889
1889
|
};
|
|
1890
1890
|
}
|
|
1891
|
-
var
|
|
1892
|
-
let i = C.SigningKey.computePublicKey(t.privateKey, !1), a = C.getBytes(i), o =
|
|
1893
|
-
return
|
|
1894
|
-
},
|
|
1895
|
-
let i = C.hexlify(
|
|
1891
|
+
var ri = async (e, t, n, r = /* @__PURE__ */ new Uint8Array()) => {
|
|
1892
|
+
let i = C.SigningKey.computePublicKey(t.privateKey, !1), a = C.getBytes(i), o = Yr(n), s = /* @__PURE__ */ new Uint8Array(), c = await ei(a, s, r, o, e);
|
|
1893
|
+
return ni(C.getBytes(await t.signMessage(c)), ti(a, n, e, s, r));
|
|
1894
|
+
}, ii = async (e, t, n, r = /* @__PURE__ */ new Uint8Array()) => {
|
|
1895
|
+
let i = C.hexlify(Hr), a = await t.signMessage({ message: { raw: i } }), o = C.hashMessage(Hr), s;
|
|
1896
1896
|
try {
|
|
1897
1897
|
s = C.SigningKey.recoverPublicKey(o, a);
|
|
1898
1898
|
} catch {
|
|
1899
1899
|
s = "";
|
|
1900
1900
|
}
|
|
1901
1901
|
if (!s || C.computeAddress(s).toLowerCase() !== t.address.toLowerCase()) throw Error(`@seedprotocol/publish: ${t.address} can't sign Arweave data items: its signatures don't recover to its address (a smart account?). Pass an EOA's signer as dataItemSigner, such as the smart account's admin.`);
|
|
1902
|
-
let c = C.getBytes(s), l =
|
|
1903
|
-
return
|
|
1902
|
+
let c = C.getBytes(s), l = Yr(n), u = /* @__PURE__ */ new Uint8Array(), d = await ei(c, u, r, l, e), f = C.hexlify(d), p = await t.signMessage({ message: { raw: f } });
|
|
1903
|
+
return ni(C.getBytes(p), ti(c, n, e, u, r));
|
|
1904
1904
|
};
|
|
1905
|
-
function
|
|
1905
|
+
function ai(e) {
|
|
1906
1906
|
if (e.length < 133) return null;
|
|
1907
1907
|
let t = e[132];
|
|
1908
1908
|
if (t !== 0 && t !== 1) return null;
|
|
@@ -1915,8 +1915,8 @@ function ii(e) {
|
|
|
1915
1915
|
let a = i === 1;
|
|
1916
1916
|
return a && e.length < r + 33 ? null : r + (a ? 33 : 1);
|
|
1917
1917
|
}
|
|
1918
|
-
function
|
|
1919
|
-
let t =
|
|
1918
|
+
function oi(e) {
|
|
1919
|
+
let t = ai(e);
|
|
1920
1920
|
if (t == null) return null;
|
|
1921
1921
|
let n = e[132] === 1, r = n ? e.slice(133, 165) : /* @__PURE__ */ new Uint8Array(), i = 132 + (n ? 33 : 1);
|
|
1922
1922
|
return {
|
|
@@ -1925,29 +1925,29 @@ function ai(e) {
|
|
|
1925
1925
|
tagsStart: t
|
|
1926
1926
|
};
|
|
1927
1927
|
}
|
|
1928
|
-
async function
|
|
1929
|
-
let t =
|
|
1928
|
+
async function si(e) {
|
|
1929
|
+
let t = oi(e);
|
|
1930
1930
|
if (t == null) return !1;
|
|
1931
1931
|
let { rawTarget: n, rawAnchor: r, tagsStart: i } = t, a = i + 16;
|
|
1932
1932
|
if (e.length < a) return !1;
|
|
1933
1933
|
let o = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
1934
|
-
if (o.getUint16(0, !0) !==
|
|
1934
|
+
if (o.getUint16(0, !0) !== Vr) return !1;
|
|
1935
1935
|
let s = e.slice(2, 67), c = e.slice(67, 132), l = Number(o.getUint32(i + 8, !0) + o.getUint32(i + 12, !0) * 4294967296), u = i + 16 + l;
|
|
1936
1936
|
if (e.length < u) return !1;
|
|
1937
1937
|
let d = e.slice(i + 16, u), f = e.slice(u);
|
|
1938
1938
|
try {
|
|
1939
|
-
let e = await
|
|
1939
|
+
let e = await ei(c, n, r, d, f), t = C.hashMessage(e), i = C.hexlify(s), a = C.SigningKey.recoverPublicKey(t, i), o = C.getBytes(a);
|
|
1940
1940
|
return o.length === c.length && o.every((e, t) => e === c[t]);
|
|
1941
1941
|
} catch {
|
|
1942
1942
|
return !1;
|
|
1943
1943
|
}
|
|
1944
1944
|
}
|
|
1945
|
-
var
|
|
1945
|
+
var ci = (e) => {
|
|
1946
1946
|
let t = "";
|
|
1947
1947
|
for (let n of e) t += String.fromCharCode(n);
|
|
1948
1948
|
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1949
|
-
},
|
|
1950
|
-
async function
|
|
1949
|
+
}, li = E("seedProtocol:createArweaveDataItems");
|
|
1950
|
+
async function ui(e, t, n) {
|
|
1951
1951
|
let r, i;
|
|
1952
1952
|
if (t) r = (await t(e)).map((e) => ({
|
|
1953
1953
|
transaction: { id: e.transaction.id },
|
|
@@ -1960,14 +1960,14 @@ async function li(e, t, n) {
|
|
|
1960
1960
|
let i = e[r], o = i.tags, s = /* @__PURE__ */ new Uint8Array(8);
|
|
1961
1961
|
crypto.getRandomValues(s);
|
|
1962
1962
|
let c = (new DataView(s.buffer).getBigUint64(0, !1) ^ BigInt(r)) & 18446744073709551615n, l;
|
|
1963
|
-
if (
|
|
1964
|
-
let e =
|
|
1965
|
-
l = await
|
|
1963
|
+
if (qr(n)) {
|
|
1964
|
+
let e = Gr(n.address, a, c);
|
|
1965
|
+
l = await ri(i.data, n, o, e);
|
|
1966
1966
|
} else {
|
|
1967
|
-
let e =
|
|
1968
|
-
l = await
|
|
1967
|
+
let e = P(n) ? n.signer : n, t = Gr(e.address, a, c);
|
|
1968
|
+
l = await ii(i.data, e, o, t);
|
|
1969
1969
|
}
|
|
1970
|
-
if (!await
|
|
1970
|
+
if (!await si(l.raw)) throw li("DataItem verification failed: id=%s modelName=%s", l.id, i.itemPropertyName), Error(`DataItem signature verification failed for ${i.itemPropertyName}. The signing key may not match the owner, or the payload may have been modified.`);
|
|
1971
1971
|
t.push(l);
|
|
1972
1972
|
}
|
|
1973
1973
|
i = t, r = t.map((t, n) => ({
|
|
@@ -1990,30 +1990,30 @@ async function li(e, t, n) {
|
|
|
1990
1990
|
bundlerUploadNotNeeded: !!t || e.length === 0
|
|
1991
1991
|
};
|
|
1992
1992
|
}
|
|
1993
|
-
var
|
|
1993
|
+
var di = T(async ({ input: { context: e } }) => {
|
|
1994
1994
|
let { item: t } = e, n = {};
|
|
1995
1995
|
e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
|
|
1996
1996
|
let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
|
|
1997
1997
|
r?.length && (n.deferHtmlStorageSeedLocalIds = r);
|
|
1998
|
-
let i = await
|
|
1999
|
-
return
|
|
1998
|
+
let i = await Br(t, Object.keys(n).length ? n : void 0), a = Q();
|
|
1999
|
+
return ui(i, e.signDataItems ?? a.signDataItems, e.dataItemSigner ?? a.dataItemSigner);
|
|
2000
2000
|
});
|
|
2001
2001
|
//#endregion
|
|
2002
2002
|
//#region src/services/publish/actors/createArweaveDataItemsPhase2.ts
|
|
2003
|
-
async function
|
|
2003
|
+
async function fi(e) {
|
|
2004
2004
|
let { item: t } = e, n = {};
|
|
2005
2005
|
e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
|
|
2006
2006
|
let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
|
|
2007
2007
|
r?.length && (n.onlyHtmlStorageSeedLocalIds = r);
|
|
2008
|
-
let i = await
|
|
2008
|
+
let i = await Br(t, Object.keys(n).length ? n : void 0), a = Q(), o = e.signDataItems ?? a.signDataItems, s = e.dataItemSigner ?? a.dataItemSigner;
|
|
2009
2009
|
return i.length === 0 ? {
|
|
2010
2010
|
arweaveTransactions: [],
|
|
2011
2011
|
publishUploads: [],
|
|
2012
2012
|
signedDataItems: void 0,
|
|
2013
2013
|
bundlerUploadNotNeeded: !0
|
|
2014
|
-
} :
|
|
2014
|
+
} : ui(i, o, s);
|
|
2015
2015
|
}
|
|
2016
|
-
var
|
|
2016
|
+
var pi = T(async ({ input: { context: e } }) => fi(e)), mi = class extends Error {
|
|
2017
2017
|
address;
|
|
2018
2018
|
requiredWinc;
|
|
2019
2019
|
balanceWinc;
|
|
@@ -2022,7 +2022,7 @@ var fi = T(async ({ input: { context: e } }) => di(e)), pi = class extends Error
|
|
|
2022
2022
|
super(`@seedprotocol/publish: ${e.address} does not have enough Turbo credits to store this publish${t}. Top up that address with Turbo credits (card or crypto through ArDrive Turbo), then publish again.` + (e.detail ? ` ${e.detail}` : "")), this.name = "InsufficientStorageCreditsError", this.address = e.address, this.requiredWinc = e.requiredWinc, this.balanceWinc = e.balanceWinc;
|
|
2023
2023
|
}
|
|
2024
2024
|
};
|
|
2025
|
-
async function
|
|
2025
|
+
async function hi(e) {
|
|
2026
2026
|
let t = await fetch(e), n = await t.text(), r = n;
|
|
2027
2027
|
try {
|
|
2028
2028
|
r = JSON.parse(n);
|
|
@@ -2032,26 +2032,26 @@ async function mi(e) {
|
|
|
2032
2032
|
body: r
|
|
2033
2033
|
};
|
|
2034
2034
|
}
|
|
2035
|
-
async function
|
|
2036
|
-
let { status: n, body: r } = await
|
|
2035
|
+
async function gi(e, t) {
|
|
2036
|
+
let { status: n, body: r } = await hi(`${e.paymentUrl}/v1/account/balance/ethereum?address=${encodeURIComponent(t)}`);
|
|
2037
2037
|
if (n === 404) return 0n;
|
|
2038
2038
|
if (n !== 200) throw Error(`Turbo balance lookup failed: HTTP ${n}`);
|
|
2039
2039
|
return BigInt(r?.effectiveBalance ?? r?.winc ?? "0");
|
|
2040
2040
|
}
|
|
2041
|
-
async function
|
|
2042
|
-
let { status: n, body: r } = await
|
|
2041
|
+
async function _i(e, t) {
|
|
2042
|
+
let { status: n, body: r } = await hi(`${e.paymentUrl}/v1/price/bytes/${t}`);
|
|
2043
2043
|
if (n !== 200) throw Error(`Turbo price lookup failed: HTTP ${n}`);
|
|
2044
2044
|
return BigInt(r?.winc ?? "0");
|
|
2045
2045
|
}
|
|
2046
|
-
async function
|
|
2046
|
+
async function vi(e) {
|
|
2047
2047
|
try {
|
|
2048
|
-
let { status: t, body: n } = await
|
|
2048
|
+
let { status: t, body: n } = await hi(`${e.uploadUrl}/v1/info`);
|
|
2049
2049
|
return t === 200 && Number(n?.freeUploadLimitBytes ?? n?.freeTier?.maxItemBytes ?? 0) || 0;
|
|
2050
2050
|
} catch {
|
|
2051
2051
|
return 0;
|
|
2052
2052
|
}
|
|
2053
2053
|
}
|
|
2054
|
-
async function
|
|
2054
|
+
async function yi(e, t, n) {
|
|
2055
2055
|
let r = { "Content-Type": "application/octet-stream" };
|
|
2056
2056
|
n.paidBy && n.paidBy.length > 0 && (r["x-paid-by"] = n.paidBy.join(","));
|
|
2057
2057
|
let i = await fetch(`${e.uploadUrl}/v1/tx/ethereum`, {
|
|
@@ -2059,110 +2059,110 @@ async function vi(e, t, n) {
|
|
|
2059
2059
|
headers: r,
|
|
2060
2060
|
body: t
|
|
2061
2061
|
}), a = await i.text();
|
|
2062
|
-
if (i.status === 402) throw new
|
|
2062
|
+
if (i.status === 402) throw new mi({
|
|
2063
2063
|
address: n.signerAddress,
|
|
2064
2064
|
detail: a.slice(0, 200)
|
|
2065
2065
|
});
|
|
2066
2066
|
if (i.status !== 200 && i.status !== 202) throw Error(`Turbo upload failed: HTTP ${i.status} ${a.slice(0, 200)}`);
|
|
2067
2067
|
return JSON.parse(a);
|
|
2068
2068
|
}
|
|
2069
|
-
async function
|
|
2069
|
+
async function bi(e, t) {
|
|
2070
2070
|
let n = await fetch(`${e.uploadUrl}/v1/tx/${encodeURIComponent(t)}/status`);
|
|
2071
2071
|
return await n.body?.cancel().catch(() => {}), n.status;
|
|
2072
2072
|
}
|
|
2073
|
-
async function
|
|
2074
|
-
let r = await
|
|
2073
|
+
async function xi(e, t, n) {
|
|
2074
|
+
let r = await vi(e), i = n.filter((e) => e > r);
|
|
2075
2075
|
if (i.length === 0) return;
|
|
2076
|
-
let a = (await Promise.all(i.map((t) =>
|
|
2077
|
-
if (o < a) throw new
|
|
2076
|
+
let a = (await Promise.all(i.map((t) => _i(e, t)))).reduce((e, t) => e + t, 0n), o = await gi(e, t);
|
|
2077
|
+
if (o < a) throw new mi({
|
|
2078
2078
|
address: t,
|
|
2079
2079
|
requiredWinc: a,
|
|
2080
2080
|
balanceWinc: o
|
|
2081
2081
|
});
|
|
2082
2082
|
}
|
|
2083
|
-
function
|
|
2083
|
+
function Si(e) {
|
|
2084
2084
|
if (e.length < 132 || (e[0] | e[1] << 8) != 3) return;
|
|
2085
2085
|
let t = e.subarray(67, 132);
|
|
2086
2086
|
return He(Ue(t));
|
|
2087
2087
|
}
|
|
2088
2088
|
//#endregion
|
|
2089
2089
|
//#region src/services/publish/helpers/uploadToTurbo.ts
|
|
2090
|
-
var
|
|
2091
|
-
async function
|
|
2090
|
+
var Ci = Function("s", "return import(s)");
|
|
2091
|
+
async function wi(e) {
|
|
2092
2092
|
if (typeof window < "u") throw Error("DataItem.filename requires Node.js fs access. In browser runtime, provide DataItem.raw or DataItem.getRaw().");
|
|
2093
|
-
let { readFile: t } = await
|
|
2093
|
+
let { readFile: t } = await Ci(`node:${["fs", "promises"].join("/")}`);
|
|
2094
2094
|
return t(e);
|
|
2095
2095
|
}
|
|
2096
|
-
async function
|
|
2096
|
+
async function Ti(e) {
|
|
2097
2097
|
let t = e;
|
|
2098
2098
|
if (t.raw instanceof Uint8Array) return t.raw;
|
|
2099
2099
|
if (typeof t.getRaw == "function") {
|
|
2100
2100
|
let e = await t.getRaw();
|
|
2101
2101
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
2102
2102
|
}
|
|
2103
|
-
if (t.filename != null) return
|
|
2103
|
+
if (t.filename != null) return wi(t.filename);
|
|
2104
2104
|
throw Error("Cannot get raw bytes from DataItem");
|
|
2105
2105
|
}
|
|
2106
|
-
async function
|
|
2107
|
-
let r = await Promise.all(e.map(
|
|
2106
|
+
async function Ei(e, t, n) {
|
|
2107
|
+
let r = await Promise.all(e.map(Ti)), i = n.dataItemSigner?.address ?? (r[0] ? Si(r[0]) : void 0);
|
|
2108
2108
|
if (!i) throw Error("User-paid storage needs Ethereum-signed data items (dataItemSigner).");
|
|
2109
|
-
t.paidBy.length === 0 && await
|
|
2110
|
-
for (let e of r) await
|
|
2109
|
+
t.paidBy.length === 0 && await xi(t, i, r.map((e) => e.byteLength));
|
|
2110
|
+
for (let e of r) await yi(t, e, {
|
|
2111
2111
|
signerAddress: i,
|
|
2112
2112
|
paidBy: t.paidBy
|
|
2113
2113
|
});
|
|
2114
2114
|
}
|
|
2115
2115
|
//#endregion
|
|
2116
2116
|
//#region src/authorization.ts
|
|
2117
|
-
var
|
|
2117
|
+
var Di = "X-Seed-Publish-Authorization", Oi = class extends Error {
|
|
2118
2118
|
constructor(e, t) {
|
|
2119
2119
|
let n = t instanceof Error ? `: ${t.message}` : "";
|
|
2120
2120
|
super(`@seedprotocol/publish: publish of ${e} was not authorized${n}`, { cause: t }), this.name = "PublishNotAuthorizedError";
|
|
2121
2121
|
}
|
|
2122
2122
|
};
|
|
2123
|
-
async function
|
|
2123
|
+
async function ki(e, t) {
|
|
2124
2124
|
if (!e) return {};
|
|
2125
2125
|
let n;
|
|
2126
2126
|
try {
|
|
2127
2127
|
n = await e(t);
|
|
2128
2128
|
} catch (e) {
|
|
2129
|
-
throw new
|
|
2129
|
+
throw new Oi(t.seedLocalId, e);
|
|
2130
2130
|
}
|
|
2131
|
-
if (n === !1) throw new
|
|
2131
|
+
if (n === !1) throw new Oi(t.seedLocalId);
|
|
2132
2132
|
return n && typeof n == "object" && typeof n.token == "string" && n.token.length > 0 ? { token: n.token } : {};
|
|
2133
2133
|
}
|
|
2134
|
-
function
|
|
2135
|
-
return e?.token ? { [
|
|
2134
|
+
function Ai(e) {
|
|
2135
|
+
return e?.token ? { [Di]: e.token } : {};
|
|
2136
2136
|
}
|
|
2137
2137
|
//#endregion
|
|
2138
2138
|
//#region src/services/publish/actors/uploadViaBundler.ts
|
|
2139
|
-
var
|
|
2140
|
-
if (
|
|
2139
|
+
var ji = 12e4, Mi = Function("s", "return import(s)"), Ni = null, Pi = async () => {
|
|
2140
|
+
if (Ni) return Ni;
|
|
2141
2141
|
if (typeof window < "u") return null;
|
|
2142
2142
|
try {
|
|
2143
|
-
return
|
|
2143
|
+
return Ni = { readFile: (await Mi(`node:${["fs", "promises"].join("/")}`)).readFile }, Ni;
|
|
2144
2144
|
} catch {
|
|
2145
2145
|
return null;
|
|
2146
2146
|
}
|
|
2147
|
-
},
|
|
2147
|
+
}, Fi = class extends Error {
|
|
2148
2148
|
code = "SIGNED_DATA_ITEMS_MISSING";
|
|
2149
2149
|
constructor() {
|
|
2150
2150
|
super("The signed data items to upload are missing (they are not saved with the publish, so a publish resumed after a reload has none). Publish again."), this.name = "MissingSignedDataItemsError";
|
|
2151
2151
|
}
|
|
2152
|
-
},
|
|
2153
|
-
let { signedDataItems: n } = t, r = Q(), { uploadApiBaseUrl: i } = r, { storage: a } =
|
|
2152
|
+
}, Ii = Je(({ sendBack: e, input: { context: t } }) => {
|
|
2153
|
+
let { signedDataItems: n } = t, r = Q(), { uploadApiBaseUrl: i } = r, { storage: a } = At(r);
|
|
2154
2154
|
if (!n || n.length === 0) {
|
|
2155
2155
|
t.bundlerUploadNotNeeded ? e({
|
|
2156
2156
|
type: "uploadComplete",
|
|
2157
2157
|
result: "done"
|
|
2158
2158
|
}) : e({
|
|
2159
2159
|
type: "uploadError",
|
|
2160
|
-
error: new
|
|
2160
|
+
error: new Fi()
|
|
2161
2161
|
});
|
|
2162
2162
|
return;
|
|
2163
2163
|
}
|
|
2164
2164
|
if (a.uploadTo === "turbo" && a.turbo) {
|
|
2165
|
-
|
|
2165
|
+
Ei(n, a.turbo, t).then(() => e({
|
|
2166
2166
|
type: "uploadComplete",
|
|
2167
2167
|
result: "done"
|
|
2168
2168
|
})).catch((t) => e({
|
|
@@ -2188,7 +2188,7 @@ var Ai = 12e4, ji = Function("s", "return import(s)"), Mi = null, Ni = async ()
|
|
|
2188
2188
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
2189
2189
|
}
|
|
2190
2190
|
if (t.filename != null) {
|
|
2191
|
-
let e = await
|
|
2191
|
+
let e = await Pi();
|
|
2192
2192
|
if (!e) throw Error("DataItem.filename requires Node.js fs access. In browser runtime, provide DataItem.raw or DataItem.getRaw().");
|
|
2193
2193
|
return e.readFile(t.filename);
|
|
2194
2194
|
}
|
|
@@ -2199,19 +2199,19 @@ var Ai = 12e4, ji = Function("s", "return import(s)"), Mi = null, Ni = async ()
|
|
|
2199
2199
|
c.setUint32(0, i.length);
|
|
2200
2200
|
let l = 4;
|
|
2201
2201
|
for (let e of i) c.setUint32(l, e.byteLength), l += 4, s.set(e, l), l += e.byteLength;
|
|
2202
|
-
let u = new AbortController(), d = setTimeout(() => u.abort(),
|
|
2202
|
+
let u = new AbortController(), d = setTimeout(() => u.abort(), ji), f;
|
|
2203
2203
|
try {
|
|
2204
2204
|
f = await fetch(o, {
|
|
2205
2205
|
method: "POST",
|
|
2206
2206
|
headers: {
|
|
2207
2207
|
"Content-Type": "application/octet-stream",
|
|
2208
|
-
...
|
|
2208
|
+
...Ai(t.publishAuthorization)
|
|
2209
2209
|
},
|
|
2210
2210
|
body: s,
|
|
2211
2211
|
signal: u.signal
|
|
2212
2212
|
});
|
|
2213
2213
|
} catch (e) {
|
|
2214
|
-
throw clearTimeout(d), e instanceof Error && e.name === "AbortError" ? Error(`Arweave batch upload timed out after ${
|
|
2214
|
+
throw clearTimeout(d), e instanceof Error && e.name === "AbortError" ? Error(`Arweave batch upload timed out after ${ji / 1e3}s (upload API did not respond). Check uploadApiBaseUrl and network.`) : e;
|
|
2215
2215
|
}
|
|
2216
2216
|
if (clearTimeout(d), !f.ok) throw Error(`Batch upload failed: ${f.status}`);
|
|
2217
2217
|
let p = await f.json().catch(() => ({})), m = typeof p.failed == "number" ? p.failed : 0;
|
|
@@ -2229,35 +2229,30 @@ var Ai = 12e4, ji = Function("s", "return import(s)"), Mi = null, Ni = async ()
|
|
|
2229
2229
|
});
|
|
2230
2230
|
//#endregion
|
|
2231
2231
|
//#region src/services/publish/helpers/receiptAttestationMs.ts
|
|
2232
|
-
async function
|
|
2232
|
+
async function Li(e) {
|
|
2233
2233
|
let t = e?.blockNumber;
|
|
2234
|
-
return t == null ? Date.now() : await
|
|
2234
|
+
return t == null ? Date.now() : await cn(t) ?? Date.now();
|
|
2235
2235
|
}
|
|
2236
2236
|
//#endregion
|
|
2237
2237
|
//#region src/services/publish/actors/utils.ts
|
|
2238
|
-
var
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
e && (clearInterval(n), t(e));
|
|
2248
|
-
});
|
|
2249
|
-
} catch {}
|
|
2250
|
-
}, 200);
|
|
2251
|
-
});
|
|
2238
|
+
var R = "0x" + "0".repeat(64), Ri = async (e) => {
|
|
2239
|
+
for (;;) {
|
|
2240
|
+
let t = await c.find({
|
|
2241
|
+
seedLocalId: e,
|
|
2242
|
+
hold: !0
|
|
2243
|
+
}).catch(() => void 0);
|
|
2244
|
+
if (t) return t;
|
|
2245
|
+
await new Promise((e) => setTimeout(e, 200));
|
|
2246
|
+
}
|
|
2252
2247
|
};
|
|
2253
2248
|
//#endregion
|
|
2254
2249
|
//#region src/services/publish/actors/seedUidHelpers.ts
|
|
2255
|
-
function
|
|
2256
|
-
return e == null || e === "" ?
|
|
2250
|
+
function z(e) {
|
|
2251
|
+
return e == null || e === "" ? R : ("0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(64, "0").slice(-64)).toLowerCase();
|
|
2257
2252
|
}
|
|
2258
|
-
function
|
|
2253
|
+
function zi(e, t) {
|
|
2259
2254
|
if (!e.logs?.length) return [];
|
|
2260
|
-
let n = t ?
|
|
2255
|
+
let n = t ? zt : Lt;
|
|
2261
2256
|
try {
|
|
2262
2257
|
let t = Pe({
|
|
2263
2258
|
abi: n,
|
|
@@ -2269,7 +2264,7 @@ function Ri(e, t) {
|
|
|
2269
2264
|
let t = e.args?.result;
|
|
2270
2265
|
if (!t?.attestationUid) continue;
|
|
2271
2266
|
let n = t.attestationUid;
|
|
2272
|
-
if (!n ||
|
|
2267
|
+
if (!n || z(n) === R) continue;
|
|
2273
2268
|
let i = t.schemaUid;
|
|
2274
2269
|
i && r.push({
|
|
2275
2270
|
schemaUid: i,
|
|
@@ -2283,8 +2278,8 @@ function Ri(e, t) {
|
|
|
2283
2278
|
}
|
|
2284
2279
|
//#endregion
|
|
2285
2280
|
//#region src/services/publish/actors/multiPublishReceipt.ts
|
|
2286
|
-
var
|
|
2287
|
-
function
|
|
2281
|
+
var B = (e) => !e || z(e) === R, Bi = (e, t) => !!e && !!t && z(e) === z(t);
|
|
2282
|
+
function Vi(e) {
|
|
2288
2283
|
let t = [];
|
|
2289
2284
|
for (let n of e.listOfAttestations ?? []) {
|
|
2290
2285
|
let e = Array.isArray(n?.data) ? n.data.length : 1, r = typeof n?._propertyName == "string" && n._propertyName !== "" ? n._propertyName : void 0, i = typeof n?._metadataLocalId == "string" && n._metadataLocalId !== "" ? n._metadataLocalId : void 0, a = typeof n?._attestedValue == "string" ? n._attestedValue : void 0;
|
|
@@ -2297,23 +2292,23 @@ function Bi(e) {
|
|
|
2297
2292
|
}
|
|
2298
2293
|
return t;
|
|
2299
2294
|
}
|
|
2300
|
-
function
|
|
2295
|
+
function Hi(e, t, n) {
|
|
2301
2296
|
let r = t.toLowerCase(), i = e.logs?.filter((e) => e.address && e.address.toLowerCase() === r);
|
|
2302
2297
|
if (!i?.length) return [];
|
|
2303
2298
|
try {
|
|
2304
2299
|
return n ? Pe({
|
|
2305
|
-
abi:
|
|
2300
|
+
abi: zt,
|
|
2306
2301
|
eventName: "SeedPublished",
|
|
2307
2302
|
logs: i,
|
|
2308
2303
|
strict: !1
|
|
2309
2304
|
}).map((e) => {
|
|
2310
2305
|
let t = e.args;
|
|
2311
2306
|
return {
|
|
2312
|
-
seedUid:
|
|
2313
|
-
versionUid:
|
|
2307
|
+
seedUid: B(t?.seedUid) ? void 0 : t.seedUid,
|
|
2308
|
+
versionUid: B(t?.versionUid) ? void 0 : t.versionUid
|
|
2314
2309
|
};
|
|
2315
2310
|
}) : Pe({
|
|
2316
|
-
abi:
|
|
2311
|
+
abi: Lt,
|
|
2317
2312
|
eventName: "SeedPublished",
|
|
2318
2313
|
logs: i,
|
|
2319
2314
|
strict: !1
|
|
@@ -2330,33 +2325,33 @@ function Vi(e, t, n) {
|
|
|
2330
2325
|
return [];
|
|
2331
2326
|
}
|
|
2332
2327
|
}
|
|
2333
|
-
function
|
|
2334
|
-
let { receipt: t, requests: n, useModularExecutor: r, easContractAddress: i, contractAddressForEvents: a } = e, o =
|
|
2335
|
-
for (let e of n)
|
|
2336
|
-
let l =
|
|
2328
|
+
function Ui(e) {
|
|
2329
|
+
let { receipt: t, requests: n, useModularExecutor: r, easContractAddress: i, contractAddressForEvents: a } = e, o = zi(t, r), s = new Set(o.map((e) => z(e.attestationUid))), c = /* @__PURE__ */ new Set();
|
|
2330
|
+
for (let e of n) B(e.seedUid) && e.seedSchemaUid && c.add(z(e.seedSchemaUid)), B(e.versionUid) && e.versionSchemaUid && c.add(z(e.versionSchemaUid));
|
|
2331
|
+
let l = zn(t, i).filter((e) => !s.has(z(e.uid)) && !c.has(z(e.schemaUid))).map((e) => ({
|
|
2337
2332
|
schemaUid: e.schemaUid,
|
|
2338
2333
|
attestationUid: e.uid
|
|
2339
|
-
})), u =
|
|
2334
|
+
})), u = Hi(t, a, r), d = n.map(Vi), f = n.reduce((e, t) => e + +!!B(t.seedUid) + +!!B(t.versionUid), 0), p = d.reduce((e, t) => e + t.length, 0), m = p > 0 && o.length >= f + p, h = 0, g = 0, ee = 0, _ = (e) => {
|
|
2340
2335
|
let t = o[h];
|
|
2341
|
-
if (t) return h += 1,
|
|
2336
|
+
if (t) return h += 1, Bi(t.schemaUid, e) ? t.attestationUid : void 0;
|
|
2342
2337
|
};
|
|
2343
2338
|
return n.map((e, t) => {
|
|
2344
2339
|
let n = d[t], i = { propertyPairs: [] };
|
|
2345
|
-
|
|
2340
|
+
B(e.seedUid) && (i.seedUid = _(e.seedSchemaUid)), B(e.versionUid) && (i.versionUid = _(e.versionSchemaUid));
|
|
2346
2341
|
let a = [];
|
|
2347
2342
|
m ? (a = o.slice(h, h + n.length), h += n.length) : l.length && (a = l.slice(g, g + n.length), g += n.length);
|
|
2348
|
-
let s = !r || n.length > 0 ? u[
|
|
2343
|
+
let s = !r || n.length > 0 ? u[ee++] : void 0;
|
|
2349
2344
|
if (s) {
|
|
2350
|
-
if (r)
|
|
2345
|
+
if (r) B(e.seedUid) && !i.seedUid && (i.seedUid = s.seedUid), B(e.versionUid) && !i.versionUid && (i.versionUid = s.versionUid);
|
|
2351
2346
|
else if (s.uids?.length) {
|
|
2352
2347
|
!a.length && s.uids.length >= n.length && (a = s.uids.slice(0, n.length).map((e) => ({ attestationUid: e })));
|
|
2353
2348
|
let t = s.uids[n.length], r = s.uids[n.length + 1];
|
|
2354
|
-
|
|
2349
|
+
B(e.seedUid) && !i.seedUid && !B(t) && (i.seedUid = t), B(e.versionUid) && !i.versionUid && !B(r) && (i.versionUid = r);
|
|
2355
2350
|
}
|
|
2356
2351
|
}
|
|
2357
2352
|
return n.forEach((e, t) => {
|
|
2358
2353
|
let n = a[t];
|
|
2359
|
-
if (!n ||
|
|
2354
|
+
if (!n || B(n.attestationUid) || n.schemaUid && !Bi(n.schemaUid, e.schema)) return;
|
|
2360
2355
|
let r = n.schemaUid ?? e.schema;
|
|
2361
2356
|
r && i.propertyPairs.push({
|
|
2362
2357
|
schemaUid: r,
|
|
@@ -2370,32 +2365,32 @@ function Hi(e) {
|
|
|
2370
2365
|
}
|
|
2371
2366
|
//#endregion
|
|
2372
2367
|
//#region src/services/publish/actors/persistSeedUid.ts
|
|
2373
|
-
var
|
|
2374
|
-
function
|
|
2368
|
+
var Wi = E("seedProtocol:services:publish:actors:persistSeedUid"), Gi = "0x" + "0".repeat(64), Ki = 15e3;
|
|
2369
|
+
function qi(e, t) {
|
|
2375
2370
|
let n = e.seedLocalId, r = n ? t.find((e) => e?.localId === n) : void 0, i = r ? r.seedUid : t[0]?.seedUid;
|
|
2376
|
-
i && i !==
|
|
2371
|
+
i && i !== Gi && (e.seedUid = i);
|
|
2377
2372
|
}
|
|
2378
|
-
async function
|
|
2373
|
+
async function Ji(e, t, n) {
|
|
2379
2374
|
let r = e.persistSeedUid;
|
|
2380
2375
|
if (typeof r != "function") return;
|
|
2381
|
-
let i = new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("persistSeedUid timed out")),
|
|
2376
|
+
let i = new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("persistSeedUid timed out")), Ki));
|
|
2382
2377
|
try {
|
|
2383
2378
|
await Promise.race([r.call(e, t, n), i]);
|
|
2384
2379
|
} catch (e) {
|
|
2385
|
-
|
|
2380
|
+
Wi("persistSeedUid failed (attestations already on-chain):", e);
|
|
2386
2381
|
}
|
|
2387
2382
|
}
|
|
2388
2383
|
//#endregion
|
|
2389
2384
|
//#region src/services/publish/actors/publishRequestNormalize.ts
|
|
2390
|
-
var
|
|
2391
|
-
if (e == null) return "0x" + "0".repeat(
|
|
2392
|
-
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(
|
|
2385
|
+
var Yi = 64, V = (e) => {
|
|
2386
|
+
if (e == null) return "0x" + "0".repeat(Yi);
|
|
2387
|
+
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(Yi, "0").slice(-64);
|
|
2393
2388
|
if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
|
|
2394
2389
|
let t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
2395
|
-
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(
|
|
2390
|
+
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(Yi, "0").slice(-64);
|
|
2396
2391
|
}
|
|
2397
|
-
return "0x" + "0".repeat(
|
|
2398
|
-
},
|
|
2392
|
+
return "0x" + "0".repeat(Yi);
|
|
2393
|
+
}, Xi = (e) => {
|
|
2399
2394
|
if (e == null || typeof e == "string" && (e === "" || e === "0x")) return "0x";
|
|
2400
2395
|
if (typeof e == "string") {
|
|
2401
2396
|
let t = (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0");
|
|
@@ -2407,14 +2402,14 @@ var Ji = 64, H = (e) => {
|
|
|
2407
2402
|
}
|
|
2408
2403
|
return "0x";
|
|
2409
2404
|
};
|
|
2410
|
-
function
|
|
2405
|
+
function Zi(e) {
|
|
2411
2406
|
let t = new Set(e.map((e) => e?.localId).filter((e) => !!e));
|
|
2412
2407
|
return e.some((e) => (e?.listOfAttestations ?? []).some((e) => {
|
|
2413
2408
|
let n = e;
|
|
2414
2409
|
return n._unresolvedValue && t.has(n._unresolvedValue) ? !0 : Array.isArray(n._rawListIdsForResolve) ? n._rawListIdsForResolve.some((e) => e && t.has(String(e).trim())) : !1;
|
|
2415
2410
|
}));
|
|
2416
2411
|
}
|
|
2417
|
-
function
|
|
2412
|
+
function Qi(e) {
|
|
2418
2413
|
let t = /* @__PURE__ */ new Map();
|
|
2419
2414
|
e.forEach((e, n) => {
|
|
2420
2415
|
e?.localId && !t.has(e.localId) && t.set(e.localId, n);
|
|
@@ -2433,26 +2428,26 @@ function Zi(e) {
|
|
|
2433
2428
|
}
|
|
2434
2429
|
}
|
|
2435
2430
|
}
|
|
2436
|
-
function
|
|
2431
|
+
function $i(e, t) {
|
|
2437
2432
|
return (e ?? []).filter((e) => e.publishLocalId && t.has(e.publishLocalId));
|
|
2438
2433
|
}
|
|
2439
|
-
var
|
|
2434
|
+
var ea = {
|
|
2440
2435
|
recipient: $e,
|
|
2441
2436
|
expirationTime: BigInt(0),
|
|
2442
2437
|
revocable: !0,
|
|
2443
|
-
refUID:
|
|
2444
|
-
data:
|
|
2438
|
+
refUID: R,
|
|
2439
|
+
data: R,
|
|
2445
2440
|
value: BigInt(0)
|
|
2446
2441
|
};
|
|
2447
|
-
function
|
|
2442
|
+
function ta(e) {
|
|
2448
2443
|
let t = (e?.listOfAttestations ?? []).map((e) => {
|
|
2449
2444
|
let t = Array.isArray(e?.data) ? e.data : [];
|
|
2450
2445
|
return {
|
|
2451
|
-
schema:
|
|
2446
|
+
schema: V(e?.schema),
|
|
2452
2447
|
data: t.map((e) => ({
|
|
2453
2448
|
...e,
|
|
2454
|
-
refUID:
|
|
2455
|
-
data:
|
|
2449
|
+
refUID: V(e?.refUID),
|
|
2450
|
+
data: Xi(e?.data),
|
|
2456
2451
|
expirationTime: e?.expirationTime == null ? BigInt(0) : BigInt(e.expirationTime),
|
|
2457
2452
|
value: e?.value == null ? BigInt(0) : BigInt(e.value)
|
|
2458
2453
|
})),
|
|
@@ -2463,47 +2458,47 @@ function ea(e) {
|
|
|
2463
2458
|
};
|
|
2464
2459
|
}), n = (e?.propertiesToUpdate ?? []).map((e) => ({
|
|
2465
2460
|
...e,
|
|
2466
|
-
propertySchemaUid:
|
|
2461
|
+
propertySchemaUid: V(e?.propertySchemaUid)
|
|
2467
2462
|
}));
|
|
2468
2463
|
return {
|
|
2469
2464
|
...e,
|
|
2470
|
-
seedUid:
|
|
2471
|
-
seedSchemaUid:
|
|
2472
|
-
versionUid:
|
|
2473
|
-
versionSchemaUid:
|
|
2465
|
+
seedUid: V(e?.seedUid),
|
|
2466
|
+
seedSchemaUid: V(e?.seedSchemaUid),
|
|
2467
|
+
versionUid: V(e?.versionUid),
|
|
2468
|
+
versionSchemaUid: V(e?.versionSchemaUid),
|
|
2474
2469
|
listOfAttestations: t,
|
|
2475
2470
|
propertiesToUpdate: n
|
|
2476
2471
|
};
|
|
2477
2472
|
}
|
|
2478
|
-
function
|
|
2473
|
+
function na(e, t) {
|
|
2479
2474
|
for (let n of e) for (let e of n?.propertiesToUpdate ?? []) {
|
|
2480
|
-
let n = e?.publishLocalId, r =
|
|
2475
|
+
let n = e?.publishLocalId, r = V(e?.propertySchemaUid);
|
|
2481
2476
|
if (!n || !r) continue;
|
|
2482
2477
|
let i = t.get(n);
|
|
2483
2478
|
if (!i?.listOfAttestations) continue;
|
|
2484
|
-
let a = i.listOfAttestations.find((e) =>
|
|
2479
|
+
let a = i.listOfAttestations.find((e) => V(e?.schema)?.toLowerCase() === r?.toLowerCase());
|
|
2485
2480
|
a && (!Array.isArray(a.data) || a.data.length === 0) && (a.data = [{
|
|
2486
|
-
|
|
2487
|
-
refUID:
|
|
2481
|
+
...ea,
|
|
2482
|
+
refUID: R
|
|
2488
2483
|
}]);
|
|
2489
2484
|
}
|
|
2490
2485
|
}
|
|
2491
2486
|
//#endregion
|
|
2492
2487
|
//#region src/services/publish/actors/recordMultiPublishReceipt.ts
|
|
2493
|
-
var
|
|
2494
|
-
async function
|
|
2495
|
-
let { receipt: t, requests: n, rootSeedLocalId: r, useModularExecutor: i, contractAddressForEvents: a, publisherAddress: o } = e, { easContractAddress: s } = Q(), c =
|
|
2488
|
+
var ra = E("seedProtocol:services:publish:actors:recordMultiPublishReceipt"), H = (e) => !e || V(e) === R, ia = (e) => H(e) ? void 0 : V(e);
|
|
2489
|
+
async function aa(e) {
|
|
2490
|
+
let { receipt: t, requests: n, rootSeedLocalId: r, useModularExecutor: i, contractAddressForEvents: a, publisherAddress: o } = e, { easContractAddress: s } = Q(), c = Ui({
|
|
2496
2491
|
receipt: t,
|
|
2497
2492
|
requests: n,
|
|
2498
2493
|
useModularExecutor: i,
|
|
2499
2494
|
easContractAddress: s,
|
|
2500
2495
|
contractAddressForEvents: a
|
|
2501
|
-
}), l = await
|
|
2496
|
+
}), l = await Li(t);
|
|
2502
2497
|
for (let e = 0; e < n.length; e++) {
|
|
2503
2498
|
let t = n[e], r = c[e].versionUid;
|
|
2504
|
-
t.localId &&
|
|
2499
|
+
t.localId && H(t.versionUid) && !H(r) && await Se({
|
|
2505
2500
|
seedLocalId: t.localId,
|
|
2506
|
-
versionUid:
|
|
2501
|
+
versionUid: V(r),
|
|
2507
2502
|
...t.versionLocalId ? { versionLocalId: t.versionLocalId } : {},
|
|
2508
2503
|
publisher: o,
|
|
2509
2504
|
attestationCreatedAt: l
|
|
@@ -2511,7 +2506,7 @@ async function ia(e) {
|
|
|
2511
2506
|
}
|
|
2512
2507
|
let u = { ...e.resolvedSeedUids ?? {} };
|
|
2513
2508
|
for (let e = 0; e < n.length; e++) {
|
|
2514
|
-
let t = n[e], r =
|
|
2509
|
+
let t = n[e], r = ia(t.seedUid) ?? ia(c[e].seedUid);
|
|
2515
2510
|
t.localId && r && (u[t.localId] = r);
|
|
2516
2511
|
}
|
|
2517
2512
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -2519,14 +2514,14 @@ async function ia(e) {
|
|
|
2519
2514
|
t.localId && r.length && await f({
|
|
2520
2515
|
seedLocalId: t.localId,
|
|
2521
2516
|
attestationCreatedAtMs: l ?? null,
|
|
2522
|
-
versionUid:
|
|
2517
|
+
versionUid: ia(t.versionUid) ?? ia(i) ?? null,
|
|
2523
2518
|
pairs: r,
|
|
2524
2519
|
resolvedSeedUids: u
|
|
2525
2520
|
});
|
|
2526
2521
|
}
|
|
2527
2522
|
for (let e = 0; e < n.length; e++) {
|
|
2528
2523
|
let t = n[e], i = c[e].seedUid;
|
|
2529
|
-
t.localId && t.localId !== r &&
|
|
2524
|
+
t.localId && t.localId !== r && H(t.seedUid) && !H(i) && await oa({
|
|
2530
2525
|
seedLocalId: t.localId,
|
|
2531
2526
|
seedUid: i,
|
|
2532
2527
|
publisherAddress: o,
|
|
@@ -2539,65 +2534,68 @@ async function ia(e) {
|
|
|
2539
2534
|
let { seedUid: n, versionUid: r } = c[t];
|
|
2540
2535
|
return {
|
|
2541
2536
|
...e,
|
|
2542
|
-
...
|
|
2543
|
-
...
|
|
2537
|
+
...H(e.seedUid) && !H(n) ? { seedUid: n } : {},
|
|
2538
|
+
...H(e.versionUid) && !H(r) ? { versionUid: r } : {}
|
|
2544
2539
|
};
|
|
2545
2540
|
})
|
|
2546
2541
|
};
|
|
2547
2542
|
}
|
|
2548
|
-
async function
|
|
2543
|
+
async function oa(e) {
|
|
2549
2544
|
let { seedLocalId: t, seedUid: n, publisherAddress: r, attestationCreatedAtMs: i } = e;
|
|
2550
2545
|
try {
|
|
2551
|
-
let e = await c.find({
|
|
2546
|
+
let e = await c.find({
|
|
2547
|
+
seedLocalId: t,
|
|
2548
|
+
hold: !0
|
|
2549
|
+
});
|
|
2552
2550
|
if (!e) {
|
|
2553
|
-
|
|
2551
|
+
ra("related item %s not found; its seed uid is not recorded", t);
|
|
2554
2552
|
return;
|
|
2555
2553
|
}
|
|
2556
2554
|
try {
|
|
2557
|
-
e.seedUid = n, await
|
|
2555
|
+
e.seedUid = n, await Ji(e, r, i);
|
|
2558
2556
|
} finally {
|
|
2559
2557
|
e.unload();
|
|
2560
2558
|
}
|
|
2561
2559
|
} catch (e) {
|
|
2562
|
-
|
|
2560
|
+
ra("recording seed uid of related item %s failed: %O", t, e);
|
|
2563
2561
|
}
|
|
2564
2562
|
}
|
|
2565
2563
|
//#endregion
|
|
2566
2564
|
//#region src/helpers/publishThirdwebClient.ts
|
|
2567
|
-
var
|
|
2568
|
-
function
|
|
2565
|
+
var sa = /* @__PURE__ */ e({ getClient: () => U }), ca = null, la = null;
|
|
2566
|
+
function U() {
|
|
2569
2567
|
let { thirdwebClientId: e, thirdwebSecretKey: t } = Q();
|
|
2570
2568
|
if (!e && !t) throw Error("@seedprotocol/publish/thirdweb: thirdwebClientId or thirdwebSecretKey is required. Pass one in initPublish / PublishProvider config.");
|
|
2571
2569
|
let n = `${e ?? ""}\0${t ?? ""}`;
|
|
2572
|
-
return (!
|
|
2570
|
+
return (!ca || la !== n) && (la = n, ca = Le(e ? {
|
|
2573
2571
|
clientId: e,
|
|
2574
2572
|
...t ? { secretKey: t } : {}
|
|
2575
|
-
} : { secretKey: t })),
|
|
2573
|
+
} : { secretKey: t })), ca;
|
|
2576
2574
|
}
|
|
2577
2575
|
//#endregion
|
|
2578
2576
|
//#region src/helpers/seedPaymaster.ts
|
|
2579
|
-
var
|
|
2580
|
-
function
|
|
2577
|
+
var ua = 12000n;
|
|
2578
|
+
function da(e) {
|
|
2581
2579
|
return "paymasterAndData" in e && e.paymasterAndData ? e.paymasterAndData : "0x";
|
|
2582
2580
|
}
|
|
2583
|
-
function
|
|
2581
|
+
function fa(e, t, n) {
|
|
2584
2582
|
return async (r) => {
|
|
2585
|
-
if (
|
|
2583
|
+
if (I("paymaster hook called (userOp from thirdweb; callGasLimit is tx.gas or 0)", {
|
|
2586
2584
|
sender: r.sender,
|
|
2587
2585
|
chainId: t.id,
|
|
2588
2586
|
bundlerUrl: n ?? "(thirdweb default)",
|
|
2589
2587
|
entryPoint: "initCode" in r ? "v0.6" : "v0.7",
|
|
2590
|
-
...
|
|
2588
|
+
...L(r)
|
|
2591
2589
|
}), !("initCode" in r)) throw Error("@seedprotocol/publish: the managed account sent an EntryPoint v0.7 UserOp; its sponsored gas handling only supports EntryPoint v0.6.");
|
|
2592
2590
|
let i = typeof e == "function" ? e() : e, a = await st({
|
|
2593
2591
|
userOp: r,
|
|
2594
2592
|
client: i,
|
|
2595
2593
|
chain: t
|
|
2596
2594
|
});
|
|
2597
|
-
|
|
2595
|
+
I("1/3 paymaster sponsored (limits here are ignored)", L(a));
|
|
2598
2596
|
let o = {
|
|
2599
2597
|
...r,
|
|
2600
|
-
paymasterAndData:
|
|
2598
|
+
paymasterAndData: da(a)
|
|
2601
2599
|
}, s = await ot({
|
|
2602
2600
|
userOp: o,
|
|
2603
2601
|
options: {
|
|
@@ -2606,11 +2604,11 @@ function da(e, t, n) {
|
|
|
2606
2604
|
bundlerUrl: n
|
|
2607
2605
|
}
|
|
2608
2606
|
});
|
|
2609
|
-
|
|
2610
|
-
let c = s.callGasLimit *
|
|
2611
|
-
o.callGasLimit = r.callGasLimit > c ? r.callGasLimit : c, o.verificationGasLimit = s.verificationGasLimit, o.preVerificationGas = s.preVerificationGas,
|
|
2612
|
-
...
|
|
2613
|
-
headroomBps:
|
|
2607
|
+
I("2/3 bundler estimate (callGasLimit includes thirdweb's +50k)", L(s));
|
|
2608
|
+
let c = s.callGasLimit * ua / 10000n;
|
|
2609
|
+
o.callGasLimit = r.callGasLimit > c ? r.callGasLimit : c, o.verificationGasLimit = s.verificationGasLimit, o.preVerificationGas = s.preVerificationGas, I("raised limits sent to the paymaster for signing", {
|
|
2610
|
+
...L(o),
|
|
2611
|
+
headroomBps: ua,
|
|
2614
2612
|
raisedEstimate: c,
|
|
2615
2613
|
txGas: r.callGasLimit
|
|
2616
2614
|
});
|
|
@@ -2619,54 +2617,54 @@ function da(e, t, n) {
|
|
|
2619
2617
|
client: i,
|
|
2620
2618
|
chain: t
|
|
2621
2619
|
});
|
|
2622
|
-
if (
|
|
2623
|
-
...
|
|
2620
|
+
if (I("3/3 paymaster signed", L(l)), l.callGasLimit && l.verificationGasLimit && l.preVerificationGas) return I("returning to thirdweb: the PAYMASTER's own limits (its signature covers them)", {
|
|
2621
|
+
...L(l),
|
|
2624
2622
|
requestedCallGasLimit: o.callGasLimit
|
|
2625
2623
|
}), l;
|
|
2626
2624
|
let u = {
|
|
2627
|
-
paymasterAndData:
|
|
2625
|
+
paymasterAndData: da(l),
|
|
2628
2626
|
callGasLimit: o.callGasLimit,
|
|
2629
2627
|
verificationGasLimit: o.verificationGasLimit,
|
|
2630
2628
|
preVerificationGas: o.preVerificationGas
|
|
2631
2629
|
};
|
|
2632
|
-
return
|
|
2630
|
+
return I("returning to thirdweb: our raised limits (thirdweb should send exactly these)", L(u)), u;
|
|
2633
2631
|
};
|
|
2634
2632
|
}
|
|
2635
2633
|
//#endregion
|
|
2636
2634
|
//#region src/helpers/thirdweb.ts
|
|
2637
|
-
var
|
|
2638
|
-
ExternalWalletsForDeploy: () =>
|
|
2639
|
-
appMetadata: () =>
|
|
2640
|
-
deployManagedAccountViaFactory: () =>
|
|
2641
|
-
deploySmartWalletContract: () =>
|
|
2642
|
-
getConnectedAccount: () =>
|
|
2643
|
-
getConnectedManagedAccountAddress: () =>
|
|
2644
|
-
getConnectedModularAccount: () =>
|
|
2645
|
-
getManagedAccountWallet: () =>
|
|
2646
|
-
getModularAccountWallet: () =>
|
|
2647
|
-
getSharedPublishInAppWalletStorage: () =>
|
|
2648
|
-
getSmartWalletAddressForAdmin: () =>
|
|
2649
|
-
getWalletsForConnectButton: () =>
|
|
2650
|
-
isSmartWalletDeployed: () =>
|
|
2651
|
-
pollSmartWalletDeployed: () =>
|
|
2652
|
-
resolveSmartWalletForPublish: () =>
|
|
2653
|
-
syncPublishInAppAuthToken: () =>
|
|
2654
|
-
useActiveSmartWalletContract: () =>
|
|
2655
|
-
useLocalWalletAccount: () =>
|
|
2656
|
-
wallets: () =>
|
|
2657
|
-
}),
|
|
2658
|
-
function
|
|
2659
|
-
return
|
|
2660
|
-
getItem: async (e) => typeof window > "u" ? null : localStorage.getItem(
|
|
2635
|
+
var pa = /* @__PURE__ */ e({
|
|
2636
|
+
ExternalWalletsForDeploy: () => Da,
|
|
2637
|
+
appMetadata: () => Aa,
|
|
2638
|
+
deployManagedAccountViaFactory: () => ka,
|
|
2639
|
+
deploySmartWalletContract: () => Oa,
|
|
2640
|
+
getConnectedAccount: () => Ma,
|
|
2641
|
+
getConnectedManagedAccountAddress: () => ja,
|
|
2642
|
+
getConnectedModularAccount: () => Na,
|
|
2643
|
+
getManagedAccountWallet: () => La,
|
|
2644
|
+
getModularAccountWallet: () => za,
|
|
2645
|
+
getSharedPublishInAppWalletStorage: () => _a,
|
|
2646
|
+
getSmartWalletAddressForAdmin: () => Ca,
|
|
2647
|
+
getWalletsForConnectButton: () => Ba,
|
|
2648
|
+
isSmartWalletDeployed: () => wa,
|
|
2649
|
+
pollSmartWalletDeployed: () => Ta,
|
|
2650
|
+
resolveSmartWalletForPublish: () => Ea,
|
|
2651
|
+
syncPublishInAppAuthToken: () => va,
|
|
2652
|
+
useActiveSmartWalletContract: () => Sa,
|
|
2653
|
+
useLocalWalletAccount: () => xa,
|
|
2654
|
+
wallets: () => ba
|
|
2655
|
+
}), ma = E("permaPress:helpers:thirdweb"), ha = "seedProtocol:inAppPublish:", ga = null;
|
|
2656
|
+
function _a() {
|
|
2657
|
+
return ga ||= {
|
|
2658
|
+
getItem: async (e) => typeof window > "u" ? null : localStorage.getItem(ha + e),
|
|
2661
2659
|
setItem: async (e, t) => {
|
|
2662
|
-
typeof window < "u" && localStorage.setItem(
|
|
2660
|
+
typeof window < "u" && localStorage.setItem(ha + e, t);
|
|
2663
2661
|
},
|
|
2664
2662
|
removeItem: async (e) => {
|
|
2665
|
-
typeof window < "u" && localStorage.removeItem(
|
|
2663
|
+
typeof window < "u" && localStorage.removeItem(ha + e);
|
|
2666
2664
|
}
|
|
2667
|
-
},
|
|
2665
|
+
}, ga;
|
|
2668
2666
|
}
|
|
2669
|
-
function
|
|
2667
|
+
function va() {
|
|
2670
2668
|
if (typeof window > "u") return {
|
|
2671
2669
|
syncedBareToPrefixed: !1,
|
|
2672
2670
|
syncedPrefixedToBare: !1
|
|
@@ -2677,7 +2675,7 @@ function _a() {
|
|
|
2677
2675
|
syncedPrefixedToBare: !1
|
|
2678
2676
|
};
|
|
2679
2677
|
try {
|
|
2680
|
-
let t = `walletToken-${e}`, n = `${
|
|
2678
|
+
let t = `walletToken-${e}`, n = `${ha}${t}`, r = localStorage.getItem(t), i = localStorage.getItem(n), a = !1, o = !1;
|
|
2681
2679
|
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), {
|
|
2682
2680
|
syncedBareToPrefixed: a,
|
|
2683
2681
|
syncedPrefixedToBare: o
|
|
@@ -2689,99 +2687,99 @@ function _a() {
|
|
|
2689
2687
|
};
|
|
2690
2688
|
}
|
|
2691
2689
|
}
|
|
2692
|
-
async function
|
|
2693
|
-
|
|
2694
|
-
let t =
|
|
2690
|
+
async function ya(e = F()) {
|
|
2691
|
+
va();
|
|
2692
|
+
let t = La();
|
|
2695
2693
|
return await t.autoConnect({
|
|
2696
|
-
client:
|
|
2694
|
+
client: U(),
|
|
2697
2695
|
chain: e
|
|
2698
2696
|
}), t;
|
|
2699
2697
|
}
|
|
2700
|
-
var
|
|
2698
|
+
var ba = [tt("io.metamask")], xa = () => null, Sa = () => {
|
|
2701
2699
|
let e = rt(), [t, n] = at(null);
|
|
2702
2700
|
return it(() => {
|
|
2703
2701
|
e && e.address && n(ze({
|
|
2704
|
-
client:
|
|
2705
|
-
chain:
|
|
2702
|
+
client: U(),
|
|
2703
|
+
chain: F(),
|
|
2706
2704
|
address: e.address
|
|
2707
2705
|
}));
|
|
2708
2706
|
}, [e]), t;
|
|
2709
2707
|
};
|
|
2710
|
-
async function
|
|
2711
|
-
return
|
|
2708
|
+
async function Ca(e, t = "0x") {
|
|
2709
|
+
return Tn(e, t);
|
|
2712
2710
|
}
|
|
2713
|
-
async function
|
|
2714
|
-
return
|
|
2711
|
+
async function wa(e) {
|
|
2712
|
+
return rn(e);
|
|
2715
2713
|
}
|
|
2716
|
-
async function
|
|
2717
|
-
return
|
|
2714
|
+
async function Ta(e, t, n) {
|
|
2715
|
+
return dn(e, t, n);
|
|
2718
2716
|
}
|
|
2719
|
-
async function
|
|
2717
|
+
async function Ea(e) {
|
|
2720
2718
|
if (!e) return { needsDeploy: !0 };
|
|
2721
|
-
if (await
|
|
2719
|
+
if (await wa(e.address)) return {
|
|
2722
2720
|
address: e.address,
|
|
2723
2721
|
account: e
|
|
2724
2722
|
};
|
|
2725
|
-
let t = await
|
|
2726
|
-
return await
|
|
2723
|
+
let t = await Ca(e.address);
|
|
2724
|
+
return await wa(t) ? {
|
|
2727
2725
|
address: t,
|
|
2728
2726
|
account: e
|
|
2729
2727
|
} : { needsDeploy: !0 };
|
|
2730
2728
|
}
|
|
2731
|
-
var
|
|
2729
|
+
var Da = [tt("io.metamask"), tt("me.rainbow")], Oa = async (e) => {
|
|
2732
2730
|
let t = ze({
|
|
2733
|
-
client:
|
|
2734
|
-
chain:
|
|
2731
|
+
client: U(),
|
|
2732
|
+
chain: F(),
|
|
2735
2733
|
address: e.address
|
|
2736
2734
|
}), n = await Re({
|
|
2737
2735
|
smartAccount: e,
|
|
2738
|
-
chain:
|
|
2739
|
-
client:
|
|
2736
|
+
chain: F(),
|
|
2737
|
+
client: U(),
|
|
2740
2738
|
accountContract: t
|
|
2741
2739
|
});
|
|
2742
|
-
return
|
|
2740
|
+
return ma("deploySmartAccount result:", n), n;
|
|
2743
2741
|
};
|
|
2744
|
-
async function
|
|
2745
|
-
let { asThirdwebPublishWallet: t } = await Promise.resolve().then(() =>
|
|
2742
|
+
async function ka(e) {
|
|
2743
|
+
let { asThirdwebPublishWallet: t } = await Promise.resolve().then(() => fr), n = t(e.signingAccount), r = En(e.adminAddress, e.data ?? "0x");
|
|
2746
2744
|
await n.txSender.sendTransaction(r);
|
|
2747
2745
|
}
|
|
2748
|
-
var
|
|
2746
|
+
var Aa = {
|
|
2749
2747
|
name: "Seed Protocol",
|
|
2750
2748
|
description: "Seed Protocol",
|
|
2751
2749
|
url: "https://seedprotocol.io"
|
|
2752
2750
|
};
|
|
2753
|
-
async function
|
|
2754
|
-
let t = (await
|
|
2751
|
+
async function ja(e = F()) {
|
|
2752
|
+
let t = (await ya(e)).getAccount();
|
|
2755
2753
|
if (!t) throw Error("Failed to get managed account");
|
|
2756
2754
|
return t.address;
|
|
2757
2755
|
}
|
|
2758
|
-
async function
|
|
2756
|
+
async function Ma() {
|
|
2759
2757
|
try {
|
|
2760
|
-
let e =
|
|
2758
|
+
let e = za();
|
|
2761
2759
|
return await e.autoConnect({
|
|
2762
|
-
client:
|
|
2763
|
-
chain:
|
|
2760
|
+
client: U(),
|
|
2761
|
+
chain: F()
|
|
2764
2762
|
}), e.getAccount() ?? null;
|
|
2765
2763
|
} catch {
|
|
2766
2764
|
return null;
|
|
2767
2765
|
}
|
|
2768
2766
|
}
|
|
2769
|
-
async function
|
|
2770
|
-
return
|
|
2767
|
+
async function Na() {
|
|
2768
|
+
return Ma();
|
|
2771
2769
|
}
|
|
2772
|
-
function
|
|
2773
|
-
let t =
|
|
2770
|
+
function Pa(e) {
|
|
2771
|
+
let t = F(e).id, n = e.managedAccountFactoryAddress ?? yt[t];
|
|
2774
2772
|
if (!n) throw Error(`@seedprotocol/publish: no ManagedAccount factory is known for chain ${t}. Pass managedAccountFactoryAddress in publish config, or use the EOA / direct EAS path.`);
|
|
2775
2773
|
return n;
|
|
2776
2774
|
}
|
|
2777
|
-
var
|
|
2775
|
+
var Fa = [
|
|
2778
2776
|
"farcaster",
|
|
2779
2777
|
"email",
|
|
2780
2778
|
"passkey",
|
|
2781
2779
|
"phone"
|
|
2782
|
-
],
|
|
2783
|
-
let t = e ??
|
|
2784
|
-
if (!i &&
|
|
2780
|
+
], Ia = null, La = (e) => {
|
|
2781
|
+
let t = e ?? xl(), n = F(t ?? void 0), r = t ? Pa(t) : Dl(), { bundlerUrl: i, sponsorGas: a } = Tl(t);
|
|
2782
|
+
if (!i && dr(n)) throw Error(`@seedprotocol/publish: chain ${n.id} is local, so Thirdweb's hosted bundler cannot reach it. Set PublishConfig.thirdweb.bundlerUrl to the chain's bundler (seedTwinConfig does this for the twin).`);
|
|
2785
2783
|
let o = [
|
|
2786
2784
|
n.id,
|
|
2787
2785
|
n.rpc,
|
|
@@ -2789,16 +2787,16 @@ var Pa = [
|
|
|
2789
2787
|
i ?? "",
|
|
2790
2788
|
a
|
|
2791
2789
|
].join("|").toLowerCase();
|
|
2792
|
-
return
|
|
2790
|
+
return Ia?.key !== o && (I("managed wallet built", {
|
|
2793
2791
|
chainId: n.id,
|
|
2794
2792
|
sponsorGas: a,
|
|
2795
2793
|
bundlerUrl: i ?? "(thirdweb default)",
|
|
2796
2794
|
paymasterHook: a ? "installed" : "none (thirdweb estimates callGasLimit itself)"
|
|
2797
|
-
}),
|
|
2795
|
+
}), Ia = {
|
|
2798
2796
|
key: o,
|
|
2799
2797
|
wallet: nt({
|
|
2800
|
-
storage:
|
|
2801
|
-
auth: { options: [...
|
|
2798
|
+
storage: _a(),
|
|
2799
|
+
auth: { options: [...Fa] },
|
|
2802
2800
|
executionMode: {
|
|
2803
2801
|
mode: "EIP4337",
|
|
2804
2802
|
smartAccount: {
|
|
@@ -2807,60 +2805,60 @@ var Pa = [
|
|
|
2807
2805
|
sponsorGas: a,
|
|
2808
2806
|
...i || a ? { overrides: {
|
|
2809
2807
|
...i ? { bundlerUrl: i } : {},
|
|
2810
|
-
...a ? { paymaster:
|
|
2808
|
+
...a ? { paymaster: fa(U, n, i) } : {}
|
|
2811
2809
|
} } : {}
|
|
2812
2810
|
}
|
|
2813
2811
|
}
|
|
2814
2812
|
})
|
|
2815
|
-
}),
|
|
2816
|
-
},
|
|
2817
|
-
let t = e ??
|
|
2813
|
+
}), Ia.wallet;
|
|
2814
|
+
}, Ra = null, za = (e) => {
|
|
2815
|
+
let t = e ?? xl(), { modularWalletMode: n, sponsorGas: r } = Tl(t);
|
|
2818
2816
|
if (n === "EIP7702") {
|
|
2819
|
-
let e =
|
|
2820
|
-
if (
|
|
2817
|
+
let e = F(t ?? void 0);
|
|
2818
|
+
if (dr(e)) throw Error(`@seedprotocol/publish: chain ${e.id} is local, and Thirdweb's EIP-7702 mode needs its hosted bundler, which cannot reach it. Set PublishConfig.thirdweb.modularWalletMode to 'EOA' and fund the in-app EOA (seedTwinConfig does this for the twin).`);
|
|
2821
2819
|
}
|
|
2822
2820
|
let i = `${n}|${r}`;
|
|
2823
|
-
return
|
|
2821
|
+
return Ra?.key !== i && (Ra = {
|
|
2824
2822
|
key: i,
|
|
2825
2823
|
wallet: nt({
|
|
2826
|
-
storage:
|
|
2827
|
-
auth: { options: [...
|
|
2824
|
+
storage: _a(),
|
|
2825
|
+
auth: { options: [...Fa] },
|
|
2828
2826
|
executionMode: n === "EOA" ? { mode: "EOA" } : {
|
|
2829
2827
|
mode: "EIP7702",
|
|
2830
2828
|
sponsorGas: r
|
|
2831
2829
|
}
|
|
2832
2830
|
})
|
|
2833
|
-
}),
|
|
2834
|
-
},
|
|
2835
|
-
let t = e ??
|
|
2836
|
-
return t?.useModularExecutor ? [
|
|
2837
|
-
},
|
|
2838
|
-
function
|
|
2831
|
+
}), Ra.wallet;
|
|
2832
|
+
}, Ba = (e) => {
|
|
2833
|
+
let t = e ?? xl() ?? void 0;
|
|
2834
|
+
return t?.useModularExecutor ? [za(t)] : [La(t)];
|
|
2835
|
+
}, Va = "This ManagedAccount predates the Seed executor router extension, so the Seed executor cannot act for it and publish automation is not available for this account.", Ha = "The Seed executor is not installed for this ManagedAccount, so automation session keys cannot publish through it. The account admin installs it (installSeedExecutor), which enrollPublishAutomation does.", Ua = "The Seed executor module is configured with a different EAS contract for this ManagedAccount than publish config. Automation session keys cannot change it.", Wa = "Could not read the Seed executor module state for this ManagedAccount.";
|
|
2836
|
+
function Ga() {
|
|
2839
2837
|
let e = Q().modularAccountModuleContract?.trim();
|
|
2840
2838
|
if (!e || !/^0x[0-9a-fA-F]{40}$/.test(e)) throw Error("@seedprotocol/publish: publish automation requires PublishConfig.modularAccountModuleContract (executor module).");
|
|
2841
2839
|
return e;
|
|
2842
2840
|
}
|
|
2843
|
-
async function
|
|
2844
|
-
return await
|
|
2841
|
+
async function Ka(e) {
|
|
2842
|
+
return await _n(e) === null;
|
|
2845
2843
|
}
|
|
2846
|
-
async function
|
|
2847
|
-
let n =
|
|
2844
|
+
async function qa(e, t = {}) {
|
|
2845
|
+
let n = Ga(), r = e, i, a;
|
|
2848
2846
|
if (t.installedEas) i = !0, a = t.installedEas;
|
|
2849
2847
|
else try {
|
|
2850
|
-
i = await
|
|
2848
|
+
i = await nn(() => hn(n, r), Boolean, { attempts: t.readAttempts ?? 1 }), a = i ? await gn(n, r) : Ie;
|
|
2851
2849
|
} catch (t) {
|
|
2852
|
-
throw new
|
|
2850
|
+
throw new k(Wa, "AUTOMATION_UNSUPPORTED_ACCOUNT", e, t);
|
|
2853
2851
|
}
|
|
2854
|
-
if (!i) throw new
|
|
2852
|
+
if (!i) throw new k(await Ka(r) ? Va : Ha, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
|
|
2855
2853
|
let o = Q().easContractAddress?.toLowerCase();
|
|
2856
|
-
if (o && a.toLowerCase() !== o) throw new
|
|
2854
|
+
if (o && a.toLowerCase() !== o) throw new k(Ua, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
|
|
2857
2855
|
}
|
|
2858
|
-
function
|
|
2856
|
+
function Ja(e) {
|
|
2859
2857
|
let t = e instanceof Te ? `${e.shortMessage} ${e.details} ${e.message}` : String(e);
|
|
2860
2858
|
return /insufficient funds|insufficient balance/i.test(t);
|
|
2861
2859
|
}
|
|
2862
|
-
async function
|
|
2863
|
-
let { managedAddress: t, tx: n, action: r, code: i = "AUTOMATION_PREFLIGHT_FAILED", requireSimulation: a = !0 } = e, o = (e) =>
|
|
2860
|
+
async function Ya(e) {
|
|
2861
|
+
let { managedAddress: t, tx: n, action: r, code: i = "AUTOMATION_PREFLIGHT_FAILED", requireSimulation: a = !0 } = e, o = (e) => A().call({
|
|
2864
2862
|
account: t,
|
|
2865
2863
|
to: n.to,
|
|
2866
2864
|
data: n.data,
|
|
@@ -2874,94 +2872,94 @@ async function Ja(e) {
|
|
|
2874
2872
|
try {
|
|
2875
2873
|
await o(!1);
|
|
2876
2874
|
} catch (e) {
|
|
2877
|
-
if (!
|
|
2875
|
+
if (!Ja(e)) throw e;
|
|
2878
2876
|
await o(!0);
|
|
2879
2877
|
}
|
|
2880
2878
|
} catch (e) {
|
|
2881
|
-
let n =
|
|
2879
|
+
let n = Un(e);
|
|
2882
2880
|
if (!n && !a) return;
|
|
2883
|
-
throw new
|
|
2881
|
+
throw new k(`Simulated ${r} from ${t} ${n ? Gn(Hn(e)) : "could not be simulated"}; nothing was sent.`, i, t, e);
|
|
2884
2882
|
}
|
|
2885
2883
|
}
|
|
2886
2884
|
//#endregion
|
|
2887
2885
|
//#region src/helpers/ensureExecutorModule.ts
|
|
2888
|
-
var
|
|
2889
|
-
async function
|
|
2886
|
+
var Xa = () => `The executor module could not be installed on your publishing account on ${$()}. Reconnect and try again, or contact support if this persists.`;
|
|
2887
|
+
async function Za(e, t, n) {
|
|
2890
2888
|
let { modularAccountModuleContract: r } = n;
|
|
2891
|
-
if (!r || !await
|
|
2892
|
-
let i = await
|
|
2893
|
-
return i ?
|
|
2889
|
+
if (!r || !await rn(e)) return { status: "skipped" };
|
|
2890
|
+
let i = await _n(e);
|
|
2891
|
+
return i ? Qa(e, i.executor, r) : { status: "skipped" };
|
|
2894
2892
|
}
|
|
2895
|
-
async function
|
|
2896
|
-
if (t.toLowerCase() !== n.trim().toLowerCase()) throw new
|
|
2893
|
+
async function Qa(e, t, n) {
|
|
2894
|
+
if (t.toLowerCase() !== n.trim().toLowerCase()) throw new k(`Your publishing account's Seed executor is ${t}, but publish config sets modularAccountModuleContract to ${n}. Point modularAccountModuleContract at the account's executor.`, "EXECUTOR_MODULE_NOT_INSTALLED", e);
|
|
2897
2895
|
let r = e, i, a, o;
|
|
2898
2896
|
try {
|
|
2899
|
-
if (await
|
|
2900
|
-
let { getManagedAccountAdmin: n } = await import("./managedAccountAdmin-
|
|
2897
|
+
if (await yn(r, t)) return { status: "already-installed" };
|
|
2898
|
+
let { getManagedAccountAdmin: n } = await import("./managedAccountAdmin-xZbC3bQ5.js").then((e) => e.n), s = pr(await n(e));
|
|
2901
2899
|
i = s.txSender.address;
|
|
2902
|
-
let c = await s.txSender.sendTransaction(
|
|
2900
|
+
let c = await s.txSender.sendTransaction(bn(r));
|
|
2903
2901
|
o = c.transactionHash;
|
|
2904
2902
|
try {
|
|
2905
|
-
a = await
|
|
2903
|
+
a = await j(c.transactionHash);
|
|
2906
2904
|
} catch (e) {
|
|
2907
|
-
if (!(e instanceof
|
|
2905
|
+
if (!(e instanceof Kt)) throw e;
|
|
2908
2906
|
}
|
|
2909
2907
|
} catch (t) {
|
|
2910
|
-
throw t instanceof
|
|
2908
|
+
throw t instanceof k ? t : new k(Xa(), "EXECUTOR_MODULE_NOT_INSTALLED", e, t);
|
|
2911
2909
|
}
|
|
2912
|
-
let s = a &&
|
|
2910
|
+
let s = a && $a(a, r, t);
|
|
2913
2911
|
if (s) return {
|
|
2914
2912
|
status: "installed",
|
|
2915
2913
|
eas: s,
|
|
2916
2914
|
transactionHash: o
|
|
2917
2915
|
};
|
|
2918
|
-
let c = await
|
|
2916
|
+
let c = await eo(r, i);
|
|
2919
2917
|
if (c === "already-installed") return { status: "already-installed" };
|
|
2920
|
-
throw new
|
|
2918
|
+
throw new k(`installSeedExecutor in transaction ${o} did not install the Seed executor on ${e}${c ? `: ${c}` : ""}.`, "EXECUTOR_MODULE_NOT_INSTALLED", e);
|
|
2921
2919
|
}
|
|
2922
|
-
function
|
|
2920
|
+
function $a(e, t, n) {
|
|
2923
2921
|
if (Pe({
|
|
2924
|
-
abi:
|
|
2922
|
+
abi: Vt,
|
|
2925
2923
|
eventName: "SeedExecutorInstalled",
|
|
2926
2924
|
logs: e.logs,
|
|
2927
2925
|
strict: !1
|
|
2928
2926
|
}).some((e) => Me(e.address, t) && e.args.executor && Me(e.args.executor, n))) return Pe({
|
|
2929
|
-
abi:
|
|
2927
|
+
abi: Bt,
|
|
2930
2928
|
eventName: "ModuleInitialized",
|
|
2931
2929
|
logs: e.logs,
|
|
2932
2930
|
strict: !1
|
|
2933
2931
|
}).find((e) => Me(e.address, n) && e.args.account && Me(e.args.account, t))?.args.eas;
|
|
2934
2932
|
}
|
|
2935
|
-
async function
|
|
2933
|
+
async function eo(e, t) {
|
|
2936
2934
|
try {
|
|
2937
|
-
await
|
|
2935
|
+
await Ya({
|
|
2938
2936
|
managedAddress: t,
|
|
2939
|
-
tx:
|
|
2937
|
+
tx: bn(e),
|
|
2940
2938
|
action: "installSeedExecutor",
|
|
2941
2939
|
requireSimulation: !1
|
|
2942
2940
|
});
|
|
2943
2941
|
return;
|
|
2944
2942
|
} catch (e) {
|
|
2945
|
-
let t =
|
|
2943
|
+
let t = Gn(Hn(e instanceof k ? e.underlyingCause : e));
|
|
2946
2944
|
return t === "reverted with SeedExecutorAlreadyInstalled" ? "already-installed" : t;
|
|
2947
2945
|
}
|
|
2948
2946
|
}
|
|
2949
2947
|
//#endregion
|
|
2950
2948
|
//#region src/helpers/ensureManagedAccountReady.ts
|
|
2951
|
-
var
|
|
2952
|
-
async function
|
|
2949
|
+
var to = () => `Could not connect the managed publishing account on ${$()}. Reconnect with the same sign-in method and try again.`, no = () => `Your publishing smart account is not deployed on ${$()} yet. Complete wallet setup, enable autoDeployManagedAccount in config if appropriate, then try again.`, ro = () => `The managed account could not be confirmed on ${$()} after deployment. Wait a moment and retry, or check your network connection.`, io = () => `Automatic deployment of the managed publishing account failed on ${$()}. Retry or deploy the account through your wallet provider.`;
|
|
2950
|
+
async function ao() {
|
|
2953
2951
|
let { useModularExecutor: e } = Q();
|
|
2954
2952
|
if (!e) return { kind: "skip" };
|
|
2955
2953
|
let t;
|
|
2956
2954
|
try {
|
|
2957
|
-
t = await
|
|
2955
|
+
t = await ja(F());
|
|
2958
2956
|
} catch (e) {
|
|
2959
2957
|
return {
|
|
2960
2958
|
kind: "unavailable",
|
|
2961
2959
|
cause: e
|
|
2962
2960
|
};
|
|
2963
2961
|
}
|
|
2964
|
-
return await
|
|
2962
|
+
return await wa(t) ? {
|
|
2965
2963
|
kind: "ready",
|
|
2966
2964
|
managedAddress: t
|
|
2967
2965
|
} : {
|
|
@@ -2969,85 +2967,85 @@ async function io() {
|
|
|
2969
2967
|
managedAddress: t
|
|
2970
2968
|
};
|
|
2971
2969
|
}
|
|
2972
|
-
async function
|
|
2973
|
-
|
|
2974
|
-
let e =
|
|
2970
|
+
async function oo() {
|
|
2971
|
+
va();
|
|
2972
|
+
let e = La();
|
|
2975
2973
|
await e.autoConnect({
|
|
2976
|
-
client:
|
|
2977
|
-
chain:
|
|
2974
|
+
client: U(),
|
|
2975
|
+
chain: F()
|
|
2978
2976
|
});
|
|
2979
2977
|
let t = e.getAccount();
|
|
2980
|
-
if (!t) throw new
|
|
2978
|
+
if (!t) throw new k(to(), "MANAGED_ACCOUNT_UNAVAILABLE");
|
|
2981
2979
|
return t;
|
|
2982
2980
|
}
|
|
2983
|
-
var
|
|
2984
|
-
async function
|
|
2981
|
+
var so = 9e4;
|
|
2982
|
+
async function co(e) {
|
|
2985
2983
|
let t;
|
|
2986
2984
|
try {
|
|
2987
|
-
await Promise.race([
|
|
2988
|
-
t = setTimeout(() => n(/* @__PURE__ */ Error(`Managed account deploy timed out after ${
|
|
2985
|
+
await Promise.race([Oa(e), new Promise((e, n) => {
|
|
2986
|
+
t = setTimeout(() => n(/* @__PURE__ */ Error(`Managed account deploy timed out after ${so / 1e3}s`)), so);
|
|
2989
2987
|
})]);
|
|
2990
2988
|
} finally {
|
|
2991
2989
|
t != null && clearTimeout(t);
|
|
2992
2990
|
}
|
|
2993
2991
|
}
|
|
2994
|
-
async function
|
|
2995
|
-
let t = Q(), n = await
|
|
2992
|
+
async function lo(e) {
|
|
2993
|
+
let t = Q(), n = await oo(), { fromThirdwebAccount: r } = await Promise.resolve().then(() => fr), i = {
|
|
2996
2994
|
managedAddress: e,
|
|
2997
2995
|
managedSigningAccount: r(n)
|
|
2998
2996
|
};
|
|
2999
2997
|
try {
|
|
3000
2998
|
if (t.deployManagedAccount) await t.deployManagedAccount(i);
|
|
3001
2999
|
else {
|
|
3002
|
-
let e = await
|
|
3000
|
+
let e = await Na();
|
|
3003
3001
|
if (e) {
|
|
3004
|
-
let t =
|
|
3002
|
+
let t = za();
|
|
3005
3003
|
await t.autoConnect({
|
|
3006
|
-
client:
|
|
3007
|
-
chain:
|
|
3008
|
-
}), await
|
|
3004
|
+
client: U(),
|
|
3005
|
+
chain: F()
|
|
3006
|
+
}), await ka({
|
|
3009
3007
|
adminAddress: t.getAdminAccount?.()?.address ?? e.address,
|
|
3010
3008
|
signingAccount: e
|
|
3011
3009
|
});
|
|
3012
|
-
} else await
|
|
3010
|
+
} else await co(n);
|
|
3013
3011
|
}
|
|
3014
3012
|
} catch (t) {
|
|
3015
|
-
if (await
|
|
3016
|
-
throw new
|
|
3013
|
+
if (await Ta(e, /UserOp|user operation/i.test(Gt(t)) ? 15 : 5)) return;
|
|
3014
|
+
throw new k(io(), "MANAGED_ACCOUNT_NOT_DEPLOYED", e, t);
|
|
3017
3015
|
}
|
|
3018
|
-
if (!await
|
|
3016
|
+
if (!await Ta(e)) throw new k(ro(), "MANAGED_ACCOUNT_NOT_DEPLOYED", e);
|
|
3019
3017
|
}
|
|
3020
|
-
async function
|
|
3018
|
+
async function uo() {
|
|
3021
3019
|
let e = Q();
|
|
3022
3020
|
if (!e.useModularExecutor) throw Error("runModularExecutorPublishPrep: useModularExecutor is false");
|
|
3023
|
-
let t = await
|
|
3021
|
+
let t = await ao();
|
|
3024
3022
|
if (t.kind === "unavailable") return {
|
|
3025
3023
|
ok: !1,
|
|
3026
|
-
error: new
|
|
3024
|
+
error: new k(to(), "MANAGED_ACCOUNT_UNAVAILABLE", void 0, t.cause)
|
|
3027
3025
|
};
|
|
3028
3026
|
if (t.kind === "not_deployed") {
|
|
3029
3027
|
if (e.autoDeployManagedAccount) {
|
|
3030
3028
|
try {
|
|
3031
|
-
await
|
|
3029
|
+
await lo(t.managedAddress);
|
|
3032
3030
|
} catch (e) {
|
|
3033
3031
|
return {
|
|
3034
3032
|
ok: !1,
|
|
3035
|
-
error:
|
|
3033
|
+
error: qt(e) ? e : new k(io(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress, e)
|
|
3036
3034
|
};
|
|
3037
3035
|
}
|
|
3038
|
-
if (t = await
|
|
3036
|
+
if (t = await ao(), t.kind !== "ready") return {
|
|
3039
3037
|
ok: !1,
|
|
3040
|
-
error: new
|
|
3038
|
+
error: new k(ro(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.kind === "not_deployed" ? t.managedAddress : void 0)
|
|
3041
3039
|
};
|
|
3042
3040
|
} else return {
|
|
3043
3041
|
ok: !1,
|
|
3044
|
-
error: new
|
|
3042
|
+
error: new k(no(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress)
|
|
3045
3043
|
};
|
|
3046
3044
|
}
|
|
3047
3045
|
if (t.kind === "ready") {
|
|
3048
3046
|
if (e.modularAccountModuleContract) try {
|
|
3049
|
-
let n = await
|
|
3050
|
-
await
|
|
3047
|
+
let n = await oo();
|
|
3048
|
+
await Za(t.managedAddress, n, e);
|
|
3051
3049
|
} catch (e) {
|
|
3052
3050
|
console.warn(`[@seedprotocol/publish] Executor module setup failed on ${$()}; publishing continues, but publish automation needs it.`, e);
|
|
3053
3051
|
}
|
|
@@ -3060,25 +3058,25 @@ async function lo() {
|
|
|
3060
3058
|
}
|
|
3061
3059
|
//#endregion
|
|
3062
3060
|
//#region src/helpers/resolvePublishWallet.ts
|
|
3063
|
-
function
|
|
3064
|
-
if (
|
|
3065
|
-
if (
|
|
3061
|
+
function fo(e) {
|
|
3062
|
+
if (P(e.wallet)) return e.wallet;
|
|
3063
|
+
if (P(e.account)) return e.account;
|
|
3066
3064
|
let t = n();
|
|
3067
3065
|
if (t) return t;
|
|
3068
3066
|
throw Error("@seedprotocol/publish: no PublishWallet available. Pass fromEthersWallet / fromEip1193Provider / fromThirdwebAccount, or call setPublishWallet / useSeedWallet.");
|
|
3069
3067
|
}
|
|
3070
3068
|
//#endregion
|
|
3071
3069
|
//#region src/helpers/schemaRegistry.ts
|
|
3072
|
-
async function
|
|
3073
|
-
return jn(e);
|
|
3074
|
-
}
|
|
3075
|
-
function po(e) {
|
|
3070
|
+
async function po(e) {
|
|
3076
3071
|
return Mn(e);
|
|
3077
3072
|
}
|
|
3073
|
+
function mo(e) {
|
|
3074
|
+
return Nn(e);
|
|
3075
|
+
}
|
|
3078
3076
|
//#endregion
|
|
3079
3077
|
//#region src/helpers/nameSchemaAttestation.ts
|
|
3080
|
-
var
|
|
3081
|
-
function
|
|
3078
|
+
var ho = "0x0000000000000000000000000000000000000000";
|
|
3079
|
+
function go(e) {
|
|
3082
3080
|
let t = new Ze("bytes32 schemaId,string name").encodeData([{
|
|
3083
3081
|
name: "schemaId",
|
|
3084
3082
|
value: e.schemaUid,
|
|
@@ -3088,10 +3086,10 @@ function ho(e) {
|
|
|
3088
3086
|
value: e.schemaName,
|
|
3089
3087
|
type: "string"
|
|
3090
3088
|
}]);
|
|
3091
|
-
return
|
|
3089
|
+
return On({
|
|
3092
3090
|
schema: vt,
|
|
3093
3091
|
data: {
|
|
3094
|
-
recipient:
|
|
3092
|
+
recipient: ho,
|
|
3095
3093
|
expirationTime: BigInt(Xe),
|
|
3096
3094
|
revocable: !0,
|
|
3097
3095
|
refUID: et,
|
|
@@ -3102,8 +3100,8 @@ function ho(e) {
|
|
|
3102
3100
|
}
|
|
3103
3101
|
//#endregion
|
|
3104
3102
|
//#region src/services/publish/helpers/ensureEasSchemas.ts
|
|
3105
|
-
var
|
|
3106
|
-
function
|
|
3103
|
+
var W = "0x0000000000000000000000000000000000000000", G = !0, _o = "bytes32 schemaId,string name", vo = "bytes32 version", yo = /* @__PURE__ */ new Set();
|
|
3104
|
+
function bo(e) {
|
|
3107
3105
|
let t = /* @__PURE__ */ new Set([e.modelName]);
|
|
3108
3106
|
for (let { kind: n, definition: r } of e.properties) {
|
|
3109
3107
|
let e = de(r.dataType);
|
|
@@ -3111,46 +3109,46 @@ function yo(e) {
|
|
|
3111
3109
|
}
|
|
3112
3110
|
return t;
|
|
3113
3111
|
}
|
|
3114
|
-
async function
|
|
3115
|
-
await
|
|
3112
|
+
async function xo(e, t) {
|
|
3113
|
+
await j((await e.sendTransaction(t)).transactionHash);
|
|
3116
3114
|
}
|
|
3117
|
-
function
|
|
3115
|
+
function So(e) {
|
|
3118
3116
|
let t = de(e);
|
|
3119
3117
|
return s[t]?.eas ?? "string";
|
|
3120
3118
|
}
|
|
3121
|
-
function
|
|
3119
|
+
function Co(e, t) {
|
|
3122
3120
|
if (e) throw Error(`schema "${t}" is not registered; automation keys can't register schemas. Call ensureEasSchemasForItem with the owner wallet first.`);
|
|
3123
3121
|
}
|
|
3124
|
-
async function
|
|
3125
|
-
let e =
|
|
3126
|
-
if (
|
|
3127
|
-
let t = Qe.getSchemaUID(
|
|
3128
|
-
for (let [e, t] of n) await
|
|
3122
|
+
async function wo() {
|
|
3123
|
+
let e = kl().id;
|
|
3124
|
+
if (yo.has(e)) return;
|
|
3125
|
+
let t = Qe.getSchemaUID(vo, W, G), n = [[_o, vt], [vo, t]], r = [];
|
|
3126
|
+
for (let [e, t] of n) await po(t) || r.push(`"${e}" (${t})`);
|
|
3129
3127
|
if (r.length > 0) throw Error(`Seed base schema${r.length > 1 ? "s" : ""} ${r.join(" and ")} not registered on chain ${e}. The protocol registers base schemas for each supported chain (seed-protocol: bun run seed:ensure-schemas).`);
|
|
3130
|
-
|
|
3128
|
+
yo.add(e);
|
|
3131
3129
|
}
|
|
3132
|
-
async function
|
|
3130
|
+
async function To(e, t) {
|
|
3133
3131
|
let n = t?.managedAddress?.trim();
|
|
3134
|
-
if (!n || !
|
|
3135
|
-
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-
|
|
3132
|
+
if (!n || !P(e)) return !1;
|
|
3133
|
+
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-B19eVd1T.js").then((e) => e.n);
|
|
3136
3134
|
return r(n, e.signer.address);
|
|
3137
3135
|
}
|
|
3138
|
-
async function
|
|
3139
|
-
let r = await
|
|
3136
|
+
async function Eo(e, t, n) {
|
|
3137
|
+
let r = await To(t, n), i = P(t) ? t.txSender : ir(t) ? t : (() => {
|
|
3140
3138
|
throw Error("@seedprotocol/publish: ensureEasSchemasForItem requires a PublishWallet or SeedTxSender");
|
|
3141
3139
|
})();
|
|
3142
|
-
await
|
|
3140
|
+
await wo();
|
|
3143
3141
|
let a = {
|
|
3144
3142
|
schemaUids: /* @__PURE__ */ new Set(),
|
|
3145
3143
|
modelSchemaUids: /* @__PURE__ */ new Set()
|
|
3146
|
-
}, o = await
|
|
3147
|
-
for (let e of o.nodes) await
|
|
3144
|
+
}, o = await ne(e);
|
|
3145
|
+
for (let e of o.nodes) await Do(e, i, r, a);
|
|
3148
3146
|
}
|
|
3149
|
-
async function
|
|
3150
|
-
let i = e.properties.filter((e) => e.kind !== "storageTransaction" && e.kind !== "itemStorage"), a = r.schemaUids, o =
|
|
3147
|
+
async function Do(e, t, n, r) {
|
|
3148
|
+
let i = e.properties.filter((e) => e.kind !== "storageTransaction" && e.kind !== "itemStorage"), a = r.schemaUids, o = bo(e), s = r.modelSchemaUids;
|
|
3151
3149
|
for (let e of o) {
|
|
3152
|
-
let r = `bytes32 ${h(e)}`, i = Qe.getSchemaUID(r,
|
|
3153
|
-
if (await
|
|
3150
|
+
let r = `bytes32 ${h(e)}`, i = Qe.getSchemaUID(r, W, G);
|
|
3151
|
+
if (await po(i)) ye({
|
|
3154
3152
|
modelName: e,
|
|
3155
3153
|
schemaUid: i
|
|
3156
3154
|
});
|
|
@@ -3159,18 +3157,18 @@ async function Eo(e, t, n, r) {
|
|
|
3159
3157
|
schemaUid: i
|
|
3160
3158
|
});
|
|
3161
3159
|
else {
|
|
3162
|
-
|
|
3160
|
+
Co(n, r);
|
|
3163
3161
|
try {
|
|
3164
|
-
await
|
|
3162
|
+
await xo(t, mo({
|
|
3165
3163
|
schema: r,
|
|
3166
|
-
resolverAddress:
|
|
3167
|
-
revocable:
|
|
3164
|
+
resolverAddress: W,
|
|
3165
|
+
revocable: G
|
|
3168
3166
|
}));
|
|
3169
3167
|
} catch (t) {
|
|
3170
3168
|
throw Error(`Failed to register EAS schema for model ${e}: ${t instanceof Error ? t.message : String(t)}`);
|
|
3171
3169
|
}
|
|
3172
3170
|
try {
|
|
3173
|
-
await
|
|
3171
|
+
await xo(t, go({
|
|
3174
3172
|
schemaUid: i,
|
|
3175
3173
|
schemaName: h(e)
|
|
3176
3174
|
}));
|
|
@@ -3183,19 +3181,19 @@ async function Eo(e, t, n, r) {
|
|
|
3183
3181
|
});
|
|
3184
3182
|
}
|
|
3185
3183
|
}
|
|
3186
|
-
let c = "string storage_transaction_id", l = Qe.getSchemaUID(c,
|
|
3187
|
-
if (await
|
|
3184
|
+
let c = "string storage_transaction_id", l = Qe.getSchemaUID(c, W, G);
|
|
3185
|
+
if (await po(l)) be({
|
|
3188
3186
|
text: c,
|
|
3189
3187
|
schemaUid: l
|
|
3190
3188
|
});
|
|
3191
3189
|
else if (!a.has(l) && (o.has("Image") || o.has("File") || o.has("Html"))) {
|
|
3192
|
-
|
|
3190
|
+
Co(n, c);
|
|
3193
3191
|
try {
|
|
3194
|
-
await
|
|
3192
|
+
await xo(t, mo({
|
|
3195
3193
|
schema: c,
|
|
3196
|
-
resolverAddress:
|
|
3197
|
-
revocable:
|
|
3198
|
-
})), await
|
|
3194
|
+
resolverAddress: W,
|
|
3195
|
+
revocable: G
|
|
3196
|
+
})), await xo(t, go({
|
|
3199
3197
|
schemaUid: l,
|
|
3200
3198
|
schemaName: "storage_transaction_id"
|
|
3201
3199
|
}));
|
|
@@ -3208,11 +3206,11 @@ async function Eo(e, t, n, r) {
|
|
|
3208
3206
|
});
|
|
3209
3207
|
}
|
|
3210
3208
|
for (let { key: e, definition: r } of i) {
|
|
3211
|
-
let i =
|
|
3209
|
+
let i = So(r.dataType), o = le(e, r), s = g(e, r), c = `${i} ${s}`;
|
|
3212
3210
|
if (o && !s.endsWith("_ids")) throw Error(`Refusing to register "${c}" for list-relation property ${e}: list relations attest as <singular>_<ref>_ids.`);
|
|
3213
|
-
let l = await
|
|
3211
|
+
let l = await _(c).catch(() => void 0);
|
|
3214
3212
|
if (l) {
|
|
3215
|
-
let e = await
|
|
3213
|
+
let e = await po(l);
|
|
3216
3214
|
if (e && e.schema === c) {
|
|
3217
3215
|
be({
|
|
3218
3216
|
text: c,
|
|
@@ -3221,8 +3219,8 @@ async function Eo(e, t, n, r) {
|
|
|
3221
3219
|
continue;
|
|
3222
3220
|
}
|
|
3223
3221
|
}
|
|
3224
|
-
let u = Qe.getSchemaUID(c,
|
|
3225
|
-
if (await
|
|
3222
|
+
let u = Qe.getSchemaUID(c, W, G);
|
|
3223
|
+
if (await po(u)) be({
|
|
3226
3224
|
text: c,
|
|
3227
3225
|
schemaUid: u
|
|
3228
3226
|
});
|
|
@@ -3231,18 +3229,18 @@ async function Eo(e, t, n, r) {
|
|
|
3231
3229
|
schemaUid: u
|
|
3232
3230
|
});
|
|
3233
3231
|
else {
|
|
3234
|
-
|
|
3232
|
+
Co(n, c);
|
|
3235
3233
|
try {
|
|
3236
|
-
await
|
|
3234
|
+
await xo(t, mo({
|
|
3237
3235
|
schema: c,
|
|
3238
|
-
resolverAddress:
|
|
3239
|
-
revocable:
|
|
3236
|
+
resolverAddress: W,
|
|
3237
|
+
revocable: G
|
|
3240
3238
|
}));
|
|
3241
3239
|
} catch (t) {
|
|
3242
3240
|
throw Error(`Failed to register EAS schema for property ${e}: ${t instanceof Error ? t.message : String(t)}`);
|
|
3243
3241
|
}
|
|
3244
3242
|
try {
|
|
3245
|
-
await
|
|
3243
|
+
await xo(t, go({
|
|
3246
3244
|
schemaUid: u,
|
|
3247
3245
|
schemaName: s
|
|
3248
3246
|
}));
|
|
@@ -3258,12 +3256,12 @@ async function Eo(e, t, n, r) {
|
|
|
3258
3256
|
}
|
|
3259
3257
|
//#endregion
|
|
3260
3258
|
//#region src/services/publish/helpers/verifyArweaveTransactionsExist.ts
|
|
3261
|
-
async function
|
|
3259
|
+
async function Oo(e) {
|
|
3262
3260
|
if (e.length === 0) return;
|
|
3263
|
-
let t = Q(), { storage: n } =
|
|
3261
|
+
let t = Q(), { storage: n } = At(t);
|
|
3264
3262
|
if (n.uploadTo === "turbo" && n.turbo) {
|
|
3265
3263
|
let t = n.turbo;
|
|
3266
|
-
(await Promise.all(e.map((e) =>
|
|
3264
|
+
(await Promise.all(e.map((e) => bi(t, e)))).forEach((t, n) => {
|
|
3267
3265
|
if (t === 404) throw Error(`Arweave data item ${e[n]} not found on Turbo. Upload may have failed. Delete this publish record and try again.`);
|
|
3268
3266
|
if (t !== 200) throw Error(`Arweave data item ${e[n]} is not yet available from Turbo (status: ${t}). Wait and retry.`);
|
|
3269
3267
|
});
|
|
@@ -3283,8 +3281,8 @@ async function Do(e) {
|
|
|
3283
3281
|
}
|
|
3284
3282
|
//#endregion
|
|
3285
3283
|
//#region src/services/arweaveL1Finalize/enqueue.ts
|
|
3286
|
-
var
|
|
3287
|
-
async function
|
|
3284
|
+
var ko = "pending_l1";
|
|
3285
|
+
async function Ao(e) {
|
|
3288
3286
|
let t = e.arweaveTransactions ?? [], n = e.publishUploads ?? [];
|
|
3289
3287
|
if (t.length === 0 || t.length !== n.length) return;
|
|
3290
3288
|
let r = a.getAppDb();
|
|
@@ -3300,7 +3298,7 @@ async function ko(e) {
|
|
|
3300
3298
|
dataItemId: s,
|
|
3301
3299
|
versionLocalId: o.versionLocalId ?? null,
|
|
3302
3300
|
itemPropertyName: o.itemPropertyName ?? null,
|
|
3303
|
-
phase:
|
|
3301
|
+
phase: ko,
|
|
3304
3302
|
createdAt: i,
|
|
3305
3303
|
updatedAt: i
|
|
3306
3304
|
}).onConflictDoNothing();
|
|
@@ -3309,54 +3307,54 @@ async function ko(e) {
|
|
|
3309
3307
|
}
|
|
3310
3308
|
//#endregion
|
|
3311
3309
|
//#region src/helpers/ensureManagedAccountEasConfigured.ts
|
|
3312
|
-
var
|
|
3313
|
-
function
|
|
3310
|
+
var jo = () => `Could not verify or set the EAS contract address on your publishing account on ${$()}.`, Mo = "ManagedAccount EAS pointer does not match publish config. Configure EAS with the user’s ManagedAccount wallet before automation publish (session keys cannot call setEas).", No = (e) => `Your publishing account's Seed extension uses EAS ${e}, but publish config sets easContractAddress to a different contract. The extension's EAS is fixed at deployment; fix easContractAddress.`;
|
|
3311
|
+
function Po(e) {
|
|
3314
3312
|
return e.toLowerCase();
|
|
3315
3313
|
}
|
|
3316
|
-
function
|
|
3317
|
-
let { easContractAddress: t } = Q(), n =
|
|
3318
|
-
if (!n || n ===
|
|
3314
|
+
function Fo(e) {
|
|
3315
|
+
let { easContractAddress: t } = Q(), n = Po(t);
|
|
3316
|
+
if (!n || n === Po(Ie)) throw new k("Publish config is missing a valid easContractAddress.", "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
|
|
3319
3317
|
return n;
|
|
3320
3318
|
}
|
|
3321
|
-
async function
|
|
3319
|
+
async function Io(e) {
|
|
3322
3320
|
try {
|
|
3323
|
-
let t = await
|
|
3324
|
-
return
|
|
3321
|
+
let t = await Sn(e);
|
|
3322
|
+
return Po(typeof t == "string" ? t : String(t));
|
|
3325
3323
|
} catch (t) {
|
|
3326
|
-
throw new
|
|
3324
|
+
throw new k(jo(), "MANAGED_ACCOUNT_SET_EAS_FAILED", e, t);
|
|
3327
3325
|
}
|
|
3328
3326
|
}
|
|
3329
|
-
async function
|
|
3330
|
-
let t =
|
|
3331
|
-
if (await
|
|
3327
|
+
async function Lo(e) {
|
|
3328
|
+
let t = Fo(e);
|
|
3329
|
+
if (await Io(e) !== t) throw new k(Mo, "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
|
|
3332
3330
|
}
|
|
3333
|
-
async function
|
|
3334
|
-
let n =
|
|
3331
|
+
async function Ro(e, t) {
|
|
3332
|
+
let n = Fo(e), r = await Io(e);
|
|
3335
3333
|
if (r !== n) {
|
|
3336
|
-
if (r !==
|
|
3334
|
+
if (r !== Po(Ie)) throw new k(No(r), "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
|
|
3337
3335
|
try {
|
|
3338
|
-
let n = typeof t == "function" ? await t() : t, r =
|
|
3336
|
+
let n = typeof t == "function" ? await t() : t, r = P(n) ? n.txSender : ir(n) ? n : (() => {
|
|
3339
3337
|
throw Error("@seedprotocol/publish: ensureManagedAccountEasConfigured requires PublishWallet or SeedTxSender");
|
|
3340
|
-
})(), { easContractAddress: i } = Q(), a =
|
|
3341
|
-
await
|
|
3338
|
+
})(), { easContractAddress: i } = Q(), a = xn(e, i);
|
|
3339
|
+
await j((await r.sendTransaction(a)).transactionHash);
|
|
3342
3340
|
} catch (t) {
|
|
3343
|
-
throw new
|
|
3341
|
+
throw new k(jo(), "MANAGED_ACCOUNT_SET_EAS_FAILED", e, t);
|
|
3344
3342
|
}
|
|
3345
3343
|
}
|
|
3346
3344
|
}
|
|
3347
3345
|
//#endregion
|
|
3348
3346
|
//#region src/services/publish/actors/createAttestations.ts
|
|
3349
|
-
var
|
|
3350
|
-
function
|
|
3347
|
+
var zo = E("seedProtocol:services:publish:actors");
|
|
3348
|
+
function Bo(e) {
|
|
3351
3349
|
return !!e && /^0x[0-9a-fA-F]{40}$/.test(e.trim());
|
|
3352
3350
|
}
|
|
3353
|
-
function
|
|
3351
|
+
function Vo(e) {
|
|
3354
3352
|
let { useModularExecutor: t, publisherAddress: n, modularAccountModuleContract: r, managedAddress: i, routeToExecutorModule: a } = e;
|
|
3355
3353
|
if (t) {
|
|
3356
3354
|
if (!i) throw Error("resolvePublishRouting: managedAddress is required when useModularExecutor is true");
|
|
3357
3355
|
let e = r?.trim();
|
|
3358
3356
|
if (a) {
|
|
3359
|
-
if (!
|
|
3357
|
+
if (!Bo(e)) throw Error("resolvePublishRouting: modularAccountModuleContract is required when routeToExecutorModule is true");
|
|
3360
3358
|
return {
|
|
3361
3359
|
txTargetAddress: e,
|
|
3362
3360
|
contractAddressForEvents: e
|
|
@@ -3372,183 +3370,194 @@ function Bo(e) {
|
|
|
3372
3370
|
contractAddressForEvents: n
|
|
3373
3371
|
};
|
|
3374
3372
|
}
|
|
3375
|
-
var
|
|
3376
|
-
let
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3373
|
+
var Ho = T(async ({ input: { context: e } }) => {
|
|
3374
|
+
let t = [];
|
|
3375
|
+
try {
|
|
3376
|
+
return await Uo(e, t);
|
|
3377
|
+
} finally {
|
|
3378
|
+
for (let e of t) e.unload();
|
|
3379
|
+
}
|
|
3380
|
+
});
|
|
3381
|
+
async function Uo(e, t) {
|
|
3382
|
+
let { address: n, account: r, wallet: i } = e, a = e.arweaveTransactions ?? [], o = e.publishUploads ?? [], { item: s } = e, { modularAccountModuleContract: c, useModularExecutor: l } = Q();
|
|
3383
|
+
if (!n || typeof n != "string" || !n.trim()) throw Error("No wallet address for publish. Connect a wallet and try again.");
|
|
3384
|
+
if (!i && !r) throw Error("Wallet session is missing. Reconnect your wallet and retry the publish.");
|
|
3385
|
+
if (!l && !await rn(n)) throw Error("EOA publishing must use the direct EAS path (multiPublish requires a deployed publisher contract). If you see this, attestation routing is misconfigured.");
|
|
3386
|
+
if (!s?.seedLocalId) throw Error("Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning.");
|
|
3387
|
+
if (typeof s.getPublishUploads != "function" && (s = await Ri(s.seedLocalId), t.push(s)), a.length !== o.length) throw Error("Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning.");
|
|
3388
|
+
let u = Vo({
|
|
3383
3389
|
useModularExecutor: !1,
|
|
3384
|
-
publisherAddress:
|
|
3385
|
-
}),
|
|
3386
|
-
await
|
|
3387
|
-
let
|
|
3390
|
+
publisherAddress: n
|
|
3391
|
+
}), d = fo(e), f = !1;
|
|
3392
|
+
await Eo(s, d, { managedAddress: n });
|
|
3393
|
+
let p = a.map((e, t) => {
|
|
3388
3394
|
let n = e.transaction?.id;
|
|
3389
3395
|
if (!n || typeof n != "string") throw Error("Attestation recovery failed: Arweave transaction data did not survive restore. Delete this publish record and try a full publish from the beginning.");
|
|
3390
|
-
let r =
|
|
3396
|
+
let r = o[t];
|
|
3391
3397
|
if (!r) throw Error("Publish upload index mismatch");
|
|
3392
3398
|
return {
|
|
3393
3399
|
...r,
|
|
3394
3400
|
txId: n
|
|
3395
3401
|
};
|
|
3396
3402
|
});
|
|
3397
|
-
await
|
|
3398
|
-
let
|
|
3399
|
-
if (
|
|
3400
|
-
let e =
|
|
3401
|
-
if (
|
|
3402
|
-
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-
|
|
3403
|
-
|
|
3403
|
+
await Oo(p.map((e) => e.txId));
|
|
3404
|
+
let m = await s.getPublishPayload(p, { publishMode: e.publishMode ?? "patch" }), h = Array.isArray(m) ? m : [m];
|
|
3405
|
+
if (l) {
|
|
3406
|
+
let e = d?.signer?.address, t = !1;
|
|
3407
|
+
if (n && e) {
|
|
3408
|
+
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-B19eVd1T.js").then((e) => e.n);
|
|
3409
|
+
t = await r(n, e);
|
|
3404
3410
|
}
|
|
3405
|
-
if (
|
|
3406
|
-
let e =
|
|
3407
|
-
if (!
|
|
3408
|
-
|
|
3409
|
-
useModularExecutor:
|
|
3410
|
-
publisherAddress:
|
|
3411
|
+
if (t) {
|
|
3412
|
+
let e = c?.trim();
|
|
3413
|
+
if (!Bo(e)) throw Error("@seedprotocol/publish: automation publish requires PublishConfig.modularAccountModuleContract (executor module). Session keys are module-only and cannot call the ManagedAccount directly.");
|
|
3414
|
+
u = Vo({
|
|
3415
|
+
useModularExecutor: l,
|
|
3416
|
+
publisherAddress: n,
|
|
3411
3417
|
modularAccountModuleContract: e,
|
|
3412
|
-
managedAddress:
|
|
3418
|
+
managedAddress: n,
|
|
3413
3419
|
routeToExecutorModule: !0
|
|
3414
|
-
}),
|
|
3420
|
+
}), f = !0, await qa(n);
|
|
3415
3421
|
} else {
|
|
3416
|
-
let e = await
|
|
3422
|
+
let e = await uo();
|
|
3417
3423
|
if (!e.ok) throw e.error;
|
|
3418
|
-
|
|
3419
|
-
useModularExecutor:
|
|
3420
|
-
publisherAddress:
|
|
3421
|
-
modularAccountModuleContract:
|
|
3424
|
+
u = Vo({
|
|
3425
|
+
useModularExecutor: l,
|
|
3426
|
+
publisherAddress: n,
|
|
3427
|
+
modularAccountModuleContract: c,
|
|
3422
3428
|
managedAddress: e.managedAddress
|
|
3423
3429
|
});
|
|
3424
|
-
let { ensureModularPublishBootstrap:
|
|
3425
|
-
|
|
3430
|
+
let { ensureModularPublishBootstrap: t } = await import("./ensureModularPublishBootstrap-COEV4BGz.js").then((e) => e.n), { fromThirdwebAccount: r } = await Promise.resolve().then(() => fr);
|
|
3431
|
+
d = r(await t(e.managedAddress));
|
|
3426
3432
|
}
|
|
3427
|
-
} else await
|
|
3428
|
-
let
|
|
3429
|
-
let
|
|
3430
|
-
await
|
|
3431
|
-
managedAddress:
|
|
3433
|
+
} else await Ro(n, d);
|
|
3434
|
+
let g = async (e) => {
|
|
3435
|
+
let t = u.txTargetAddress, r = f ? mn(t, e, 5000000n) : pn(t, e, 5000000n);
|
|
3436
|
+
await Ya(f ? {
|
|
3437
|
+
managedAddress: n,
|
|
3432
3438
|
tx: r,
|
|
3433
3439
|
action: "multiPublish via the executor module"
|
|
3434
3440
|
} : {
|
|
3435
|
-
managedAddress:
|
|
3441
|
+
managedAddress: d.txSender.address,
|
|
3436
3442
|
tx: r,
|
|
3437
3443
|
action: "multiPublish",
|
|
3438
3444
|
code: "PUBLISH_PREFLIGHT_FAILED",
|
|
3439
3445
|
requireSimulation: !1
|
|
3440
3446
|
});
|
|
3441
3447
|
try {
|
|
3442
|
-
return await
|
|
3448
|
+
return await d.txSender.sendTransaction(r);
|
|
3443
3449
|
} catch (e) {
|
|
3444
|
-
throw
|
|
3450
|
+
throw Zn(e, d.txSender.address);
|
|
3445
3451
|
}
|
|
3446
|
-
},
|
|
3447
|
-
if (
|
|
3448
|
-
let e = structuredClone(
|
|
3452
|
+
}, ee = h.length > 1 && Zi(h), _, v = null, y = [];
|
|
3453
|
+
if (ee) {
|
|
3454
|
+
let e = structuredClone(h), t = {}, r = {};
|
|
3449
3455
|
for (let i = 0; i < e.length; i++) {
|
|
3450
|
-
e = await pe(e,
|
|
3451
|
-
let a = e[i],
|
|
3456
|
+
e = await pe(e, t);
|
|
3457
|
+
let a = e[i], o = /* @__PURE__ */ new Set([a.localId]), c = ta({
|
|
3452
3458
|
...a,
|
|
3453
|
-
propertiesToUpdate:
|
|
3454
|
-
}), d = /* @__PURE__ */ new Map([[
|
|
3455
|
-
|
|
3456
|
-
let f = await
|
|
3459
|
+
propertiesToUpdate: $i(a.propertiesToUpdate, o)
|
|
3460
|
+
}), d = /* @__PURE__ */ new Map([[c.localId, c]]);
|
|
3461
|
+
na([c], d);
|
|
3462
|
+
let f = await j((await g([c])).transactionHash);
|
|
3457
3463
|
if (!f) throw Error("Failed to send transaction");
|
|
3458
3464
|
v = f;
|
|
3459
|
-
for (let e of
|
|
3460
|
-
let { requests: [p] } = await
|
|
3465
|
+
for (let e of zi(f, l)) e.attestationUid && y.push(e.attestationUid);
|
|
3466
|
+
let { requests: [p] } = await aa({
|
|
3461
3467
|
receipt: f,
|
|
3462
|
-
requests: [
|
|
3463
|
-
rootSeedLocalId:
|
|
3464
|
-
useModularExecutor:
|
|
3465
|
-
contractAddressForEvents:
|
|
3466
|
-
publisherAddress:
|
|
3467
|
-
resolvedSeedUids:
|
|
3468
|
+
requests: [c],
|
|
3469
|
+
rootSeedLocalId: s.seedLocalId,
|
|
3470
|
+
useModularExecutor: l,
|
|
3471
|
+
contractAddressForEvents: u.contractAddressForEvents,
|
|
3472
|
+
publisherAddress: n,
|
|
3473
|
+
resolvedSeedUids: t
|
|
3468
3474
|
});
|
|
3469
|
-
p?.versionUid &&
|
|
3470
|
-
let m = !
|
|
3471
|
-
m &&
|
|
3475
|
+
p?.versionUid && V(p.versionUid) !== R && (r[a.localId] = p.versionUid);
|
|
3476
|
+
let m = !c.seedUid || V(c.seedUid) === R ? p?.seedUid : void 0;
|
|
3477
|
+
m && V(m) !== R && (t[a.localId] = m, e[i] = {
|
|
3472
3478
|
...e[i],
|
|
3473
3479
|
seedUid: m
|
|
3474
3480
|
}, y.push(m));
|
|
3475
3481
|
}
|
|
3476
|
-
for (let
|
|
3477
|
-
let e =
|
|
3478
|
-
e && r &&
|
|
3482
|
+
for (let n of e) {
|
|
3483
|
+
let e = n?.localId, r = n?.seedUid;
|
|
3484
|
+
e && r && V(r) !== R && (t[e] = V(r));
|
|
3479
3485
|
}
|
|
3480
|
-
_ = (await pe(structuredClone(
|
|
3486
|
+
_ = (await pe(structuredClone(h), t)).map((e) => ta({
|
|
3481
3487
|
...e,
|
|
3482
|
-
seedUid:
|
|
3488
|
+
seedUid: t[e.localId] ?? e.seedUid,
|
|
3483
3489
|
versionUid: r[e.localId] ?? e.versionUid
|
|
3484
3490
|
}));
|
|
3485
3491
|
} else {
|
|
3486
|
-
let e =
|
|
3487
|
-
|
|
3488
|
-
let
|
|
3492
|
+
let e = h.map((e) => ta(e));
|
|
3493
|
+
na(e, new Map(e.map((e) => [e?.localId, e])));
|
|
3494
|
+
let t = Array.isArray(m) ? e : [e[0]], r = await j((await g(t)).transactionHash);
|
|
3489
3495
|
if (!r) throw Error("Failed to send transaction");
|
|
3490
3496
|
v = r;
|
|
3491
|
-
for (let e of
|
|
3492
|
-
_ = (await
|
|
3497
|
+
for (let e of zi(r, l)) e.attestationUid && y.push(e.attestationUid);
|
|
3498
|
+
_ = (await aa({
|
|
3493
3499
|
receipt: r,
|
|
3494
|
-
requests:
|
|
3495
|
-
rootSeedLocalId:
|
|
3496
|
-
useModularExecutor:
|
|
3497
|
-
contractAddressForEvents:
|
|
3498
|
-
publisherAddress:
|
|
3500
|
+
requests: t,
|
|
3501
|
+
rootSeedLocalId: s.seedLocalId,
|
|
3502
|
+
useModularExecutor: l,
|
|
3503
|
+
contractAddressForEvents: u.contractAddressForEvents,
|
|
3504
|
+
publisherAddress: n
|
|
3499
3505
|
})).requests;
|
|
3500
3506
|
}
|
|
3501
|
-
|
|
3502
|
-
let
|
|
3503
|
-
|
|
3507
|
+
qi(s, _);
|
|
3508
|
+
let te = s, ne = _.find((e) => e?.localId === s.seedLocalId)?.seedUid;
|
|
3509
|
+
ne && ne !== R && await Ji(te, n, v ? await Li(v) : void 0), zo("requestData", m), Ao(e);
|
|
3504
3510
|
try {
|
|
3505
|
-
let { clearHtmlEmbeddedImageCoPublishRows: e } = await import("@seedprotocol/sdk"), t = /* @__PURE__ */ new Set([
|
|
3511
|
+
let { clearHtmlEmbeddedImageCoPublishRows: e } = await import("@seedprotocol/sdk"), t = /* @__PURE__ */ new Set([s.seedLocalId]);
|
|
3506
3512
|
for (let e of _) e?.localId && t.add(e.localId);
|
|
3507
3513
|
for (let n of t) await e(n);
|
|
3508
3514
|
} catch {}
|
|
3509
|
-
let { collectPublishedBatch:
|
|
3515
|
+
let { collectPublishedBatch: re } = await import("./collectBatchUids-CnIe9jUB.js").then((e) => e.t), b = _.find((e) => e?.localId === s.seedLocalId) ?? _[0];
|
|
3510
3516
|
for (let e of _) e?.seedUid && y.push(String(e.seedUid)), e?.versionUid && y.push(String(e.versionUid));
|
|
3511
3517
|
return {
|
|
3512
|
-
easPayload:
|
|
3513
|
-
publishedBatch:
|
|
3514
|
-
seedUid: String(
|
|
3515
|
-
versionUid:
|
|
3518
|
+
easPayload: m,
|
|
3519
|
+
publishedBatch: b?.seedUid ? re({
|
|
3520
|
+
seedUid: String(b.seedUid),
|
|
3521
|
+
versionUid: b.versionUid ? String(b.versionUid) : void 0,
|
|
3516
3522
|
extraUids: y
|
|
3517
3523
|
}) : null
|
|
3518
3524
|
};
|
|
3519
|
-
}
|
|
3520
|
-
|
|
3525
|
+
}
|
|
3526
|
+
//#endregion
|
|
3527
|
+
//#region src/services/publish/helpers/verifyAttestations.ts
|
|
3528
|
+
var Wo = E("seedProtocol:services:publish:verifyAttestations"), Go = "0x" + "0".repeat(64), Ko = 64, qo = (e) => e == null ? "0x" + "0".repeat(Ko) : typeof e == "string" ? "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(Ko, "0").slice(-64) : "0x" + "0".repeat(Ko), Jo = 5e3, Yo = 6;
|
|
3529
|
+
async function Xo({ normalizedRequests: e, item: t }, { getProperties: n = y, delayMs: r = Jo, maxAttempts: i = Yo } = {}) {
|
|
3521
3530
|
let a = t.seedLocalId;
|
|
3522
3531
|
for (let t of e) {
|
|
3523
|
-
if (t.listOfAttestations.length === 0 || t.versionUid ===
|
|
3524
|
-
let e = t.listOfAttestations.map((e) =>
|
|
3532
|
+
if (t.listOfAttestations.length === 0 || t.versionUid === Go) continue;
|
|
3533
|
+
let e = t.listOfAttestations.map((e) => qo(e.schema).toLowerCase()), o = [], s = e, c = !1, l;
|
|
3525
3534
|
for (let a = 1; a <= i; a++) {
|
|
3526
3535
|
a > 1 && await new Promise((e) => setTimeout(e, r));
|
|
3527
3536
|
try {
|
|
3528
3537
|
let r = await n({ versionUids: [t.versionUid] });
|
|
3529
|
-
c = !0, o = r.map((e) => e.schemaId ?
|
|
3538
|
+
c = !0, o = r.map((e) => e.schemaId ? qo(e.schemaId).toLowerCase() : "").filter(Boolean);
|
|
3530
3539
|
let i = new Set(o);
|
|
3531
3540
|
if (s = e.filter((e) => !i.has(e)), s.length === 0) break;
|
|
3532
|
-
|
|
3541
|
+
Wo("verifyAttestations attempt %d: %d of %d schemas not indexed yet", a, s.length, e.length);
|
|
3533
3542
|
} catch (e) {
|
|
3534
|
-
l = e,
|
|
3543
|
+
l = e, Wo("verifyAttestations attempt %d failed:", a, e);
|
|
3535
3544
|
}
|
|
3536
3545
|
}
|
|
3537
|
-
if (!c) throw
|
|
3538
|
-
if (s.length > 0) throw new
|
|
3546
|
+
if (!c) throw Wo("verifyAttestations: giving up after %d attempts", i), l;
|
|
3547
|
+
if (s.length > 0) throw new Wt(`Publish verification failed: Seed and Version attestations were created, but property/metadata attestations are missing or incomplete. Expected ${e.length} property attestations for schema(s) ${e.join(", ")}; found ${o.length}. Use PublishManager.retryAttestations('${a}') to retry.`, a, e, o, "METADATA_PROPERTIES_MISSING");
|
|
3539
3548
|
}
|
|
3540
3549
|
}
|
|
3541
3550
|
//#endregion
|
|
3542
3551
|
//#region src/services/publish/actors/createAttestationsDirectToEas.ts
|
|
3543
|
-
var
|
|
3544
|
-
if (e == null) return "0x" + "0".repeat(
|
|
3545
|
-
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(
|
|
3552
|
+
var Zo = E("seedProtocol:services:publish:createAttestationsDirectToEas"), Qo = 64, K = (e) => {
|
|
3553
|
+
if (e == null) return "0x" + "0".repeat(Qo);
|
|
3554
|
+
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(Qo, "0").slice(-64);
|
|
3546
3555
|
if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
|
|
3547
3556
|
let t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
3548
|
-
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(
|
|
3557
|
+
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(Qo, "0").slice(-64);
|
|
3549
3558
|
}
|
|
3550
|
-
return "0x" + "0".repeat(
|
|
3551
|
-
},
|
|
3559
|
+
return "0x" + "0".repeat(Qo);
|
|
3560
|
+
}, $o = (e) => {
|
|
3552
3561
|
if (e == null || typeof e == "string" && (e === "" || e === "0x")) return "0x";
|
|
3553
3562
|
if (typeof e == "string") {
|
|
3554
3563
|
let t = (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0");
|
|
@@ -3559,48 +3568,34 @@ var Yo = E("seedProtocol:services:publish:createAttestationsDirectToEas"), Xo =
|
|
|
3559
3568
|
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
3560
3569
|
}
|
|
3561
3570
|
return "0x";
|
|
3562
|
-
},
|
|
3563
|
-
|
|
3564
|
-
try {
|
|
3565
|
-
t = await c.find({ seedLocalId: e });
|
|
3566
|
-
} catch {}
|
|
3567
|
-
return t || new Promise((t) => {
|
|
3568
|
-
let n = setInterval(() => {
|
|
3569
|
-
try {
|
|
3570
|
-
c.find({ seedLocalId: e }).then((e) => {
|
|
3571
|
-
e && (clearInterval(n), t(e));
|
|
3572
|
-
});
|
|
3573
|
-
} catch {}
|
|
3574
|
-
}, 200);
|
|
3575
|
-
});
|
|
3576
|
-
}, $o = (e) => Array.isArray(e?._rawListIdsForResolve) || e?._easDataType === "bytes32[]" || typeof e?._schemaDef == "string" && e._schemaDef.startsWith("bytes32[]"), es = (e) => Array.isArray(e?._rawListIdsForResolve) && e._rawListIdsForResolve.length > 0 || !!e?._unresolvedValue;
|
|
3577
|
-
async function ts(e, t, n) {
|
|
3571
|
+
}, es = (e) => Array.isArray(e?._rawListIdsForResolve) || e?._easDataType === "bytes32[]" || typeof e?._schemaDef == "string" && e._schemaDef.startsWith("bytes32[]"), ts = (e) => Array.isArray(e?._rawListIdsForResolve) && e._rawListIdsForResolve.length > 0 || !!e?._unresolvedValue;
|
|
3572
|
+
async function ns(e, t, n) {
|
|
3578
3573
|
let r = e?.listOfAttestations ?? [];
|
|
3579
|
-
if (!r.some(
|
|
3574
|
+
if (!r.some(ts)) return;
|
|
3580
3575
|
let [i] = await pe([e], n);
|
|
3581
3576
|
r.forEach((e, n) => {
|
|
3582
3577
|
let r = i?.listOfAttestations?.[n];
|
|
3583
|
-
if (!
|
|
3578
|
+
if (!ts(e) || !r || ts(r)) return;
|
|
3584
3579
|
let a = Array.isArray(r.data) ? r.data[0]?.data : r.data?.data, o = t.listOfAttestations[n]?.data?.[0];
|
|
3585
|
-
o && a != null && (o.data =
|
|
3580
|
+
o && a != null && (o.data = $o(a));
|
|
3586
3581
|
});
|
|
3587
3582
|
}
|
|
3588
|
-
var
|
|
3583
|
+
var rs = T(async ({ input: { context: e } }) => {
|
|
3589
3584
|
let t = [];
|
|
3590
3585
|
try {
|
|
3591
|
-
return await
|
|
3586
|
+
return await is(e, t);
|
|
3592
3587
|
} finally {
|
|
3593
3588
|
for (let e of t) e.unload();
|
|
3594
3589
|
}
|
|
3595
3590
|
});
|
|
3596
|
-
async function
|
|
3591
|
+
async function is(e, t) {
|
|
3597
3592
|
let { address: n, account: r, wallet: i } = e, a = e.arweaveTransactions ?? [], o = e.publishUploads ?? [], { item: s } = e;
|
|
3598
3593
|
if (!n || typeof n != "string" || !n.trim()) throw Error("No wallet address for publish. Connect a wallet and try again.");
|
|
3599
3594
|
if (!i && !r) throw Error("Wallet session is missing. Reconnect your wallet and retry the publish.");
|
|
3600
3595
|
if (!s?.seedLocalId) throw Error("Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning.");
|
|
3601
|
-
if (typeof s.getPublishUploads != "function" && (s = await
|
|
3602
|
-
let c =
|
|
3603
|
-
await
|
|
3596
|
+
if (typeof s.getPublishUploads != "function" && (s = await Ri(s.seedLocalId), t.push(s)), a.length !== o.length) throw Error("Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning.");
|
|
3597
|
+
let c = fo(e), l = c.txSender;
|
|
3598
|
+
await Eo(s, c, { managedAddress: n });
|
|
3604
3599
|
let u = a.map((e, t) => {
|
|
3605
3600
|
let n = e.transaction?.id;
|
|
3606
3601
|
if (!n || typeof n != "string") throw Error("Attestation recovery failed: Arweave transaction data did not survive restore. Delete this publish record and try a full publish from the beginning.");
|
|
@@ -3611,64 +3606,64 @@ async function rs(e, t) {
|
|
|
3611
3606
|
txId: n
|
|
3612
3607
|
};
|
|
3613
3608
|
});
|
|
3614
|
-
await
|
|
3609
|
+
await Oo(u.map((e) => e.txId));
|
|
3615
3610
|
let d = await s.getPublishPayload(u, { publishMode: e.publishMode ?? "patch" }), p = Array.isArray(d) ? d : [d], m = p.map((e) => {
|
|
3616
3611
|
let t = (e?.listOfAttestations ?? []).map((e) => {
|
|
3617
3612
|
let t = Array.isArray(e?.data) ? e.data : [];
|
|
3618
3613
|
return {
|
|
3619
|
-
schema:
|
|
3614
|
+
schema: K(e?.schema),
|
|
3620
3615
|
data: t.map((e) => ({
|
|
3621
3616
|
...e,
|
|
3622
|
-
refUID:
|
|
3623
|
-
data:
|
|
3617
|
+
refUID: K(e?.refUID),
|
|
3618
|
+
data: $o(e?.data)
|
|
3624
3619
|
})),
|
|
3625
3620
|
...typeof e?._propertyName == "string" && e._propertyName !== "" ? { _propertyName: e._propertyName } : {},
|
|
3626
3621
|
...typeof e?._metadataLocalId == "string" && e._metadataLocalId !== "" ? { _metadataLocalId: e._metadataLocalId } : {},
|
|
3627
3622
|
...typeof e?._attestedValue == "string" ? { _attestedValue: e._attestedValue } : {},
|
|
3628
3623
|
...typeof e?._propertyNameForSchema == "string" && e._propertyNameForSchema !== "" ? { _propertyNameForSchema: e._propertyNameForSchema } : {},
|
|
3629
|
-
|
|
3624
|
+
...es(e) ? { _isList: !0 } : {}
|
|
3630
3625
|
};
|
|
3631
3626
|
}), n = (e?.propertiesToUpdate ?? []).map((e) => ({
|
|
3632
3627
|
...e,
|
|
3633
|
-
propertySchemaUid:
|
|
3628
|
+
propertySchemaUid: K(e?.propertySchemaUid)
|
|
3634
3629
|
}));
|
|
3635
3630
|
return {
|
|
3636
3631
|
...e,
|
|
3637
|
-
seedUid:
|
|
3638
|
-
seedSchemaUid:
|
|
3639
|
-
versionUid:
|
|
3640
|
-
versionSchemaUid:
|
|
3632
|
+
seedUid: K(e?.seedUid),
|
|
3633
|
+
seedSchemaUid: K(e?.seedSchemaUid),
|
|
3634
|
+
versionUid: K(e?.versionUid),
|
|
3635
|
+
versionSchemaUid: K(e?.versionSchemaUid),
|
|
3641
3636
|
listOfAttestations: t,
|
|
3642
3637
|
propertiesToUpdate: n
|
|
3643
3638
|
};
|
|
3644
|
-
}), h =
|
|
3639
|
+
}), h = Qi(m);
|
|
3645
3640
|
if (h) {
|
|
3646
3641
|
let { requestIndex: e, targetIndex: t, requestLocalId: r, targetLocalId: i, propertySchemaUid: a } = h;
|
|
3647
|
-
throw new
|
|
3642
|
+
throw new k(`Direct EAS publish from ${n} reverted with PublishTargetAlreadyAttested(${e}, ${t}): request ${e} (${r}) updates property ${a} of request ${t} (${i}), which is attested before it; nothing was sent.`, "PUBLISH_PREFLIGHT_FAILED", n);
|
|
3648
3643
|
}
|
|
3649
|
-
let g = new Map(m.map((e) => [e.localId, e])),
|
|
3644
|
+
let g = new Map(m.map((e) => [e.localId, e])), ee = {
|
|
3650
3645
|
recipient: $e,
|
|
3651
3646
|
expirationTime: BigInt(0),
|
|
3652
3647
|
revocable: !0,
|
|
3653
|
-
refUID:
|
|
3654
|
-
data:
|
|
3648
|
+
refUID: M,
|
|
3649
|
+
data: M,
|
|
3655
3650
|
value: BigInt(0)
|
|
3656
3651
|
};
|
|
3657
3652
|
for (let e of m) for (let t of e.propertiesToUpdate ?? []) {
|
|
3658
|
-
let e = t.publishLocalId, n =
|
|
3653
|
+
let e = t.publishLocalId, n = K(t.propertySchemaUid);
|
|
3659
3654
|
if (!e || !n) continue;
|
|
3660
3655
|
let r = g.get(e);
|
|
3661
3656
|
if (!r?.listOfAttestations) continue;
|
|
3662
|
-
let i = r.listOfAttestations.find((e) =>
|
|
3657
|
+
let i = r.listOfAttestations.find((e) => K(e?.schema)?.toLowerCase() === n?.toLowerCase());
|
|
3663
3658
|
i && !i._isList && (!Array.isArray(i.data) || i.data.length === 0) && (i.data = [{
|
|
3664
|
-
...
|
|
3665
|
-
refUID:
|
|
3659
|
+
...ee,
|
|
3660
|
+
refUID: M
|
|
3666
3661
|
}]);
|
|
3667
3662
|
}
|
|
3668
|
-
let
|
|
3669
|
-
for (let e of m) e.localId && e.seedUid !==
|
|
3670
|
-
let
|
|
3671
|
-
e === s.seedLocalId ? (
|
|
3663
|
+
let _ = Date.now(), v = [], y = /* @__PURE__ */ new Map(), te = {};
|
|
3664
|
+
for (let e of m) e.localId && e.seedUid !== M && (te[e.localId] = e.seedUid);
|
|
3665
|
+
let ne = s, re = async (e, t, r) => {
|
|
3666
|
+
e === s.seedLocalId ? (ne.seedUid = t, await Ji(ne, n, r)) : await oa({
|
|
3672
3667
|
seedLocalId: e,
|
|
3673
3668
|
seedUid: t,
|
|
3674
3669
|
publisherAddress: n,
|
|
@@ -3677,52 +3672,52 @@ async function rs(e, t) {
|
|
|
3677
3672
|
};
|
|
3678
3673
|
for (let e = 0; e < m.length; e++) {
|
|
3679
3674
|
let t = m[e], r = t.seedUid, i = t.versionUid;
|
|
3680
|
-
if (r ===
|
|
3681
|
-
let e =
|
|
3675
|
+
if (r === M) {
|
|
3676
|
+
let e = Fn({
|
|
3682
3677
|
schema: t.seedSchemaUid,
|
|
3683
3678
|
data: {
|
|
3684
|
-
refUID:
|
|
3685
|
-
data:
|
|
3679
|
+
refUID: M,
|
|
3680
|
+
data: Ln(t.seedSchemaUid),
|
|
3686
3681
|
revocable: t.seedIsRevocable
|
|
3687
3682
|
}
|
|
3688
|
-
}), n = await
|
|
3683
|
+
}), n = await j((await l.sendTransaction(e)).transactionHash);
|
|
3689
3684
|
if (!n) throw Error("Failed to create Seed attestation");
|
|
3690
|
-
|
|
3691
|
-
let { easContractAddress: i } = Q(), a =
|
|
3692
|
-
if (!a || a ===
|
|
3693
|
-
r = a, t.seedUid = a, t.localId && (
|
|
3685
|
+
_ = await Li(n);
|
|
3686
|
+
let { easContractAddress: i } = Q(), a = Rn(n, i);
|
|
3687
|
+
if (!a || a === M) throw Error("Failed to get Seed UID from attestation receipt");
|
|
3688
|
+
r = a, t.seedUid = a, t.localId && (y.set(t.localId, {
|
|
3694
3689
|
seedUid: a,
|
|
3695
|
-
attestationMs:
|
|
3696
|
-
}),
|
|
3697
|
-
} else r !==
|
|
3698
|
-
if (r !==
|
|
3699
|
-
let e =
|
|
3690
|
+
attestationMs: _
|
|
3691
|
+
}), te[t.localId] = a, await re(t.localId, a, _)), v.push(a), Zo("created Seed attestation", r);
|
|
3692
|
+
} else r !== M && v.push(r);
|
|
3693
|
+
if (r !== M && i === M) {
|
|
3694
|
+
let e = Fn({
|
|
3700
3695
|
schema: t.versionSchemaUid,
|
|
3701
3696
|
data: {
|
|
3702
3697
|
refUID: r,
|
|
3703
|
-
data:
|
|
3698
|
+
data: Ln(t.versionSchemaUid),
|
|
3704
3699
|
revocable: !0
|
|
3705
3700
|
}
|
|
3706
|
-
}), a = await
|
|
3701
|
+
}), a = await j((await l.sendTransaction(e)).transactionHash);
|
|
3707
3702
|
if (!a) throw Error("Failed to create Version attestation");
|
|
3708
|
-
|
|
3709
|
-
let { easContractAddress: o } = Q(), s =
|
|
3710
|
-
if (!s || s ===
|
|
3711
|
-
i = s, t.versionUid = s,
|
|
3703
|
+
_ = await Li(a);
|
|
3704
|
+
let { easContractAddress: o } = Q(), s = Rn(a, o);
|
|
3705
|
+
if (!s || s === M) throw Error("Failed to get Version UID from attestation receipt");
|
|
3706
|
+
i = s, t.versionUid = s, v.push(s), await Se({
|
|
3712
3707
|
seedLocalId: t.localId,
|
|
3713
3708
|
versionUid: s,
|
|
3714
3709
|
...t.versionLocalId ? { versionLocalId: t.versionLocalId } : {},
|
|
3715
3710
|
publisher: n,
|
|
3716
|
-
attestationCreatedAt:
|
|
3717
|
-
}),
|
|
3718
|
-
} else i !==
|
|
3711
|
+
attestationCreatedAt: _
|
|
3712
|
+
}), Zo("created Version attestation", i);
|
|
3713
|
+
} else i !== M && v.push(i);
|
|
3719
3714
|
for (let e of t.listOfAttestations) for (let t of e.data) t.refUID = i;
|
|
3720
|
-
await
|
|
3715
|
+
await ns(p[e], t, te);
|
|
3721
3716
|
for (let e of t.propertiesToUpdate ?? []) {
|
|
3722
3717
|
let t = g.get(e.publishLocalId);
|
|
3723
3718
|
if (!t?.listOfAttestations) continue;
|
|
3724
|
-
let n =
|
|
3725
|
-
i?.data?.[0] && !i._isList && (i.data[0].data =
|
|
3719
|
+
let n = K(e.propertySchemaUid), i = t.listOfAttestations.find((e) => K(e?.schema)?.toLowerCase() === n?.toLowerCase());
|
|
3720
|
+
i?.data?.[0] && !i._isList && (i.data[0].data = Ln(r));
|
|
3726
3721
|
}
|
|
3727
3722
|
let a = t.listOfAttestations.map((e) => ({
|
|
3728
3723
|
schema: e.schema,
|
|
@@ -3730,23 +3725,23 @@ async function rs(e, t) {
|
|
|
3730
3725
|
recipient: e.recipient ?? $e,
|
|
3731
3726
|
expirationTime: e.expirationTime ?? 0n,
|
|
3732
3727
|
revocable: e.revocable ?? !0,
|
|
3733
|
-
refUID: e.refUID ??
|
|
3728
|
+
refUID: e.refUID ?? M,
|
|
3734
3729
|
data: e.data ?? "0x",
|
|
3735
3730
|
value: e.value ?? 0n
|
|
3736
3731
|
}))
|
|
3737
3732
|
}));
|
|
3738
3733
|
if (a.length > 0) {
|
|
3739
|
-
let n =
|
|
3734
|
+
let n = In(a), r = await j((await l.sendTransaction(n)).transactionHash);
|
|
3740
3735
|
if (!r) throw Error("Failed to create property attestations");
|
|
3741
|
-
|
|
3742
|
-
let { easContractAddress: o } = Q(), s =
|
|
3743
|
-
for (let e of s) e.uid &&
|
|
3736
|
+
_ = await Li(r), Zo("created property attestations for request", e);
|
|
3737
|
+
let { easContractAddress: o } = Q(), s = zn(r, o);
|
|
3738
|
+
for (let e of s) e.uid && v.push(e.uid);
|
|
3744
3739
|
let c = t.listOfAttestations, u = s.length === c.length;
|
|
3745
3740
|
await f({
|
|
3746
3741
|
seedLocalId: t.localId,
|
|
3747
|
-
attestationCreatedAtMs:
|
|
3748
|
-
versionUid: i ===
|
|
3749
|
-
resolvedSeedUids: { ...
|
|
3742
|
+
attestationCreatedAtMs: _ ?? null,
|
|
3743
|
+
versionUid: i === M ? null : i,
|
|
3744
|
+
resolvedSeedUids: { ...te },
|
|
3750
3745
|
pairs: s.map((e, t) => ({
|
|
3751
3746
|
schemaUid: e.schemaUid,
|
|
3752
3747
|
attestationUid: e.uid,
|
|
@@ -3757,81 +3752,81 @@ async function rs(e, t) {
|
|
|
3757
3752
|
});
|
|
3758
3753
|
}
|
|
3759
3754
|
}
|
|
3760
|
-
|
|
3761
|
-
let
|
|
3762
|
-
|
|
3755
|
+
qi(ne, m);
|
|
3756
|
+
let b = m.find((e) => e.localId === s.seedLocalId) ?? m[0];
|
|
3757
|
+
b?.seedUid && b.seedUid !== M && !(s.seedLocalId && y.has(s.seedLocalId)) && await Ji(ne, n, y.get(b.localId)?.attestationMs ?? _);
|
|
3763
3758
|
try {
|
|
3764
|
-
await
|
|
3759
|
+
await Xo({
|
|
3765
3760
|
normalizedRequests: m,
|
|
3766
3761
|
item: s
|
|
3767
3762
|
});
|
|
3768
3763
|
} catch (e) {
|
|
3769
|
-
throw e instanceof
|
|
3764
|
+
throw e instanceof Wt || Zo("verifyAttestations failed (non-verification error):", e), e;
|
|
3770
3765
|
}
|
|
3771
|
-
|
|
3766
|
+
Zo("direct EAS publish complete"), Ao(e);
|
|
3772
3767
|
try {
|
|
3773
3768
|
let { clearHtmlEmbeddedImageCoPublishRows: e } = await import("@seedprotocol/sdk"), t = /* @__PURE__ */ new Set([s.seedLocalId]);
|
|
3774
3769
|
for (let e of m) e?.localId && t.add(e.localId);
|
|
3775
3770
|
for (let n of t) await e(n);
|
|
3776
3771
|
} catch {}
|
|
3777
|
-
let { collectPublishedBatch: ie } = await import("./collectBatchUids-CnIe9jUB.js").then((e) => e.t), ae =
|
|
3772
|
+
let { collectPublishedBatch: ie } = await import("./collectBatchUids-CnIe9jUB.js").then((e) => e.t), ae = b;
|
|
3778
3773
|
return {
|
|
3779
3774
|
easPayload: d,
|
|
3780
3775
|
publishedBatch: ae?.seedUid ? ie({
|
|
3781
3776
|
seedUid: String(ae.seedUid),
|
|
3782
3777
|
versionUid: ae.versionUid ? String(ae.versionUid) : void 0,
|
|
3783
|
-
extraUids:
|
|
3778
|
+
extraUids: v
|
|
3784
3779
|
}) : null
|
|
3785
3780
|
};
|
|
3786
3781
|
}
|
|
3787
3782
|
//#endregion
|
|
3788
3783
|
//#region src/services/publish/helpers/itemNeedsArweave.ts
|
|
3789
|
-
async function
|
|
3784
|
+
async function as(e) {
|
|
3790
3785
|
return ce(e);
|
|
3791
3786
|
}
|
|
3792
3787
|
//#endregion
|
|
3793
3788
|
//#region src/services/publish/actors/checking.ts
|
|
3794
|
-
var
|
|
3795
|
-
async function
|
|
3789
|
+
var q = /* @__PURE__ */ new Set();
|
|
3790
|
+
async function os(e) {
|
|
3796
3791
|
let t = Q();
|
|
3797
|
-
return t.useDirectEas ? "directEas" : t.useModularExecutor || await
|
|
3792
|
+
return t.useDirectEas ? "directEas" : t.useModularExecutor || await sn(e) === "contract" ? "multiPublish" : "directEas";
|
|
3798
3793
|
}
|
|
3799
|
-
function
|
|
3794
|
+
function ss(e, t, n) {
|
|
3800
3795
|
let r = $();
|
|
3801
3796
|
switch (e) {
|
|
3802
3797
|
case null: return null;
|
|
3803
|
-
case "smart_account": return new
|
|
3798
|
+
case "smart_account": return new k(`The publishing smart account ${t} is not deployed on ${r} yet. Deploy it first (your wallet's setup flow, or deploySmartWalletContract from @seedprotocol/publish/thirdweb), then publish again.`, "MANAGED_ACCOUNT_NOT_DEPLOYED", t);
|
|
3804
3799
|
case "sender_is_not_publisher": return /* @__PURE__ */ Error(`The publish wallet sends as ${n?.txSender?.address}, not as the publisher ${t}, which has no contract deployed on ${r}. Attesting directly to EAS would record the wrong attester. Connect the publisher's wallet, or deploy the publisher's smart account first.`);
|
|
3805
3800
|
case "signer_is_not_publisher": return /* @__PURE__ */ Error(`The publish wallet signs as ${n?.signer?.address}, not as the publisher ${t}. Attesting directly to EAS would record the wrong attester.`);
|
|
3806
3801
|
case "unknown_wallet_kind": return /* @__PURE__ */ Error(`The publisher ${t} has no contract on ${r}, and the publish wallet doesn't say whether it is an EOA or an undeployed smart account. Build it with fromEip1193Provider or fromEthersWallet, set kind: 'eoa' on the PublishWallet, or set useDirectEas to attest directly anyway.`);
|
|
3807
3802
|
}
|
|
3808
3803
|
}
|
|
3809
|
-
function
|
|
3804
|
+
function cs(e) {
|
|
3810
3805
|
let t = n(), r = t?.publisherAddress ?? t?.txSender.address;
|
|
3811
3806
|
if (t?.deploy && r) return r.toLowerCase() === e.toLowerCase() ? t.deploy : void 0;
|
|
3812
3807
|
}
|
|
3813
|
-
var
|
|
3808
|
+
var ls = Je(({ sendBack: e, input: { context: t } }) => {
|
|
3814
3809
|
let { item: n, account: r, wallet: i, publishMode: a, address: o } = t;
|
|
3815
3810
|
return (async () => {
|
|
3816
3811
|
if (!await oe(n)) e({ type: "notOwner" });
|
|
3817
|
-
else if (
|
|
3812
|
+
else if (q.has(n.seedLocalId)) e({ type: "redundantPublishProcess" });
|
|
3818
3813
|
else {
|
|
3819
|
-
|
|
3814
|
+
q.add(n.seedLocalId);
|
|
3820
3815
|
try {
|
|
3821
|
-
await m(), await
|
|
3822
|
-
let t = await
|
|
3816
|
+
await m(), await xr();
|
|
3817
|
+
let t = await b(n, { publishMode: a ?? "patch" });
|
|
3823
3818
|
if (t.length > 0) {
|
|
3824
|
-
|
|
3819
|
+
q.delete(n.seedLocalId), e({
|
|
3825
3820
|
type: "validationFailed",
|
|
3826
3821
|
errors: new u(t).validationErrors
|
|
3827
3822
|
});
|
|
3828
3823
|
return;
|
|
3829
3824
|
}
|
|
3830
3825
|
let s = i ?? r;
|
|
3831
|
-
s && await
|
|
3826
|
+
s && await Eo(n, s, { managedAddress: typeof o == "string" ? o : void 0 });
|
|
3832
3827
|
let c = await Ce(n, [], { publishMode: a ?? "patch" });
|
|
3833
3828
|
if (!c.isValid) {
|
|
3834
|
-
|
|
3829
|
+
q.delete(n.seedLocalId), e({
|
|
3835
3830
|
type: "validationFailed",
|
|
3836
3831
|
errors: c.errors
|
|
3837
3832
|
});
|
|
@@ -3843,7 +3838,7 @@ var cs = Je(({ sendBack: e, input: { context: t } }) => {
|
|
|
3843
3838
|
seedLocalId: n.seedLocalId,
|
|
3844
3839
|
seedUid: n.seedUid
|
|
3845
3840
|
})).length > 0) {
|
|
3846
|
-
let { assertCanRevokeSeedAttestations: e } = await Promise.resolve().then(() =>
|
|
3841
|
+
let { assertCanRevokeSeedAttestations: e } = await Promise.resolve().then(() => Sr);
|
|
3847
3842
|
await e({
|
|
3848
3843
|
seedLocalId: n.seedLocalId,
|
|
3849
3844
|
seedUid: n.seedUid
|
|
@@ -3851,7 +3846,7 @@ var cs = Je(({ sendBack: e, input: { context: t } }) => {
|
|
|
3851
3846
|
}
|
|
3852
3847
|
}
|
|
3853
3848
|
if (!o || typeof o != "string" || !o.trim()) {
|
|
3854
|
-
|
|
3849
|
+
q.delete(n.seedLocalId), e({
|
|
3855
3850
|
type: "validationFailed",
|
|
3856
3851
|
errors: [{ message: "No publisher address for publish. Connect a wallet and try again." }]
|
|
3857
3852
|
});
|
|
@@ -3859,9 +3854,9 @@ var cs = Je(({ sendBack: e, input: { context: t } }) => {
|
|
|
3859
3854
|
}
|
|
3860
3855
|
let l;
|
|
3861
3856
|
try {
|
|
3862
|
-
l = await
|
|
3857
|
+
l = await os(o.trim());
|
|
3863
3858
|
} catch (t) {
|
|
3864
|
-
|
|
3859
|
+
q.delete(n.seedLocalId), e({
|
|
3865
3860
|
type: "checkingFailed",
|
|
3866
3861
|
error: Error(`Could not verify whether the publisher is a deployed contract on ${$()}. Check your RPC connection and retry.`, { cause: t })
|
|
3867
3862
|
});
|
|
@@ -3870,19 +3865,19 @@ var cs = Je(({ sendBack: e, input: { context: t } }) => {
|
|
|
3870
3865
|
if (l === "directEas" && !Q().useDirectEas) {
|
|
3871
3866
|
let t = i ?? r, { directEasProblem: a } = await import("./undeployedSmartAccount-pbMpi4PV.js"), s = a(o.trim(), t);
|
|
3872
3867
|
if (s === "smart_account") {
|
|
3873
|
-
let e =
|
|
3874
|
-
e && (await e(), await
|
|
3868
|
+
let e = cs(o.trim());
|
|
3869
|
+
e && (await e(), await nn(() => sn(o.trim()), (e) => e === "contract") === "contract" && (l = "multiPublish", s = null));
|
|
3875
3870
|
}
|
|
3876
|
-
let c = l === "directEas" ?
|
|
3871
|
+
let c = l === "directEas" ? ss(s, o.trim(), t) : null;
|
|
3877
3872
|
if (c) {
|
|
3878
|
-
|
|
3873
|
+
q.delete(n.seedLocalId), e({
|
|
3879
3874
|
type: "checkingFailed",
|
|
3880
3875
|
error: c
|
|
3881
3876
|
});
|
|
3882
3877
|
return;
|
|
3883
3878
|
}
|
|
3884
3879
|
}
|
|
3885
|
-
let d = await
|
|
3880
|
+
let d = await as(n), f = { attestationStrategy: l };
|
|
3886
3881
|
e(d ? {
|
|
3887
3882
|
type: "validPublishProcess",
|
|
3888
3883
|
...f
|
|
@@ -3891,35 +3886,35 @@ var cs = Je(({ sendBack: e, input: { context: t } }) => {
|
|
|
3891
3886
|
...f
|
|
3892
3887
|
});
|
|
3893
3888
|
} catch (t) {
|
|
3894
|
-
|
|
3889
|
+
q.delete(n.seedLocalId), console.error("[checking] failed", t), e({
|
|
3895
3890
|
type: "checkingFailed",
|
|
3896
3891
|
error: t instanceof Error ? t : Error(String(t))
|
|
3897
3892
|
});
|
|
3898
3893
|
}
|
|
3899
3894
|
}
|
|
3900
3895
|
})().catch((t) => {
|
|
3901
|
-
|
|
3896
|
+
q.delete(n.seedLocalId), console.error("[checking] unhandled rejection", t), e({
|
|
3902
3897
|
type: "checkingFailed",
|
|
3903
3898
|
error: t instanceof Error ? t : Error(String(t))
|
|
3904
3899
|
});
|
|
3905
3900
|
}), () => {
|
|
3906
|
-
|
|
3901
|
+
q.delete(n.seedLocalId);
|
|
3907
3902
|
};
|
|
3908
|
-
}),
|
|
3903
|
+
}), us = {
|
|
3909
3904
|
BASE: 80000n,
|
|
3910
3905
|
NEW_SEED: 120000n,
|
|
3911
3906
|
NEW_VERSION: 80000n,
|
|
3912
3907
|
ATTESTATION: 55000n
|
|
3913
3908
|
};
|
|
3914
|
-
function
|
|
3915
|
-
return
|
|
3909
|
+
function ds(e) {
|
|
3910
|
+
return us.BASE + us.NEW_SEED * BigInt(e.newSeedCount) + us.NEW_VERSION * BigInt(e.newVersionCount) + us.ATTESTATION * BigInt(e.attestationCount);
|
|
3916
3911
|
}
|
|
3917
3912
|
//#endregion
|
|
3918
3913
|
//#region src/helpers/blockchain.ts
|
|
3919
|
-
var
|
|
3914
|
+
var fs = () => {
|
|
3920
3915
|
let e = i.getArweaveJsApiConfig(), t = ct;
|
|
3921
3916
|
return Object.keys(t).includes("default") && t.default ? t.default.init(e) : t.init(e);
|
|
3922
|
-
},
|
|
3917
|
+
}, ps = 6e4, J = null, ms = null;
|
|
3923
3918
|
function hs() {
|
|
3924
3919
|
try {
|
|
3925
3920
|
return Q().getTokenPrices;
|
|
@@ -3943,16 +3938,16 @@ async function _s() {
|
|
|
3943
3938
|
}
|
|
3944
3939
|
async function vs(e) {
|
|
3945
3940
|
let t = Date.now();
|
|
3946
|
-
return !e?.forceRefresh &&
|
|
3941
|
+
return !e?.forceRefresh && J && t - J.fetchedAt < ps ? J : (ms && !e?.forceRefresh || (ms = (async () => {
|
|
3947
3942
|
try {
|
|
3948
3943
|
let e = hs(), t = e ? await e() : await _s(), n = {
|
|
3949
3944
|
ethUsd: t.ethUsd,
|
|
3950
3945
|
arUsd: t.arUsd,
|
|
3951
3946
|
fetchedAt: Date.now()
|
|
3952
3947
|
};
|
|
3953
|
-
return
|
|
3948
|
+
return J = n, n;
|
|
3954
3949
|
} catch (e) {
|
|
3955
|
-
if (
|
|
3950
|
+
if (J) return J;
|
|
3956
3951
|
throw e;
|
|
3957
3952
|
} finally {
|
|
3958
3953
|
ms = null;
|
|
@@ -3960,16 +3955,16 @@ async function vs(e) {
|
|
|
3960
3955
|
})()), ms);
|
|
3961
3956
|
}
|
|
3962
3957
|
function ys() {
|
|
3963
|
-
|
|
3958
|
+
J = null, ms = null;
|
|
3964
3959
|
}
|
|
3965
3960
|
//#endregion
|
|
3966
3961
|
//#region src/services/publishCost/marketRates.ts
|
|
3967
3962
|
var bs = 6e4, xs = 1e6, Ss = null, Cs = null;
|
|
3968
3963
|
async function ws() {
|
|
3969
|
-
return
|
|
3964
|
+
return A().getGasPrice();
|
|
3970
3965
|
}
|
|
3971
3966
|
async function Ts() {
|
|
3972
|
-
let e = BigInt(await
|
|
3967
|
+
let e = BigInt(await fs().transactions.getPrice(xs));
|
|
3973
3968
|
return Number(e) / xs;
|
|
3974
3969
|
}
|
|
3975
3970
|
async function Es(e) {
|
|
@@ -4004,12 +3999,12 @@ var Os = 0xe8d4a51000, ks = 0xde0b6b3a7640000, As = 262144, js = 102400;
|
|
|
4004
3999
|
function Ms() {
|
|
4005
4000
|
let e = !1;
|
|
4006
4001
|
try {
|
|
4007
|
-
e =
|
|
4002
|
+
e = kl().testnet === !0;
|
|
4008
4003
|
} catch {
|
|
4009
4004
|
e = !1;
|
|
4010
4005
|
}
|
|
4011
4006
|
try {
|
|
4012
|
-
let t =
|
|
4007
|
+
let t = At(Q());
|
|
4013
4008
|
return {
|
|
4014
4009
|
evmUserPays: t.gas.payer === "user",
|
|
4015
4010
|
arweaveUserPays: t.storage.payer === "user",
|
|
@@ -4033,7 +4028,7 @@ function Ps(e) {
|
|
|
4033
4028
|
return Math.round(e * 100) / 100;
|
|
4034
4029
|
}
|
|
4035
4030
|
function Fs(e, t, n) {
|
|
4036
|
-
let r = n?.evmUserPays ?? !0, i = n?.arweaveUserPays ?? !1, a = n?.testnet ?? !1, o =
|
|
4031
|
+
let r = n?.evmUserPays ?? !0, i = n?.arweaveUserPays ?? !1, a = n?.testnet ?? !1, o = ds(e), s = o * t.gasPriceWei, c = Number(s) / ks, l = a ? 0 : c * t.ethUsd, u = Ns(e, n?.uploadTo), d = Math.max(0, Math.round(u * t.winstonPerByte)) / Os, f = d * t.arUsd;
|
|
4037
4032
|
return {
|
|
4038
4033
|
totalUsd: Ps(l + f),
|
|
4039
4034
|
evm: {
|
|
@@ -4083,11 +4078,11 @@ var Rs = T(async ({ input: { context: e } }) => {
|
|
|
4083
4078
|
let { item: t } = e, n = e.authorizePublish ?? Ls();
|
|
4084
4079
|
if (!n) return {};
|
|
4085
4080
|
let r = e.publishMode ?? "patch";
|
|
4086
|
-
return
|
|
4081
|
+
return ki(n, {
|
|
4087
4082
|
item: t,
|
|
4088
4083
|
seedLocalId: t.seedLocalId,
|
|
4089
4084
|
publishMode: r,
|
|
4090
|
-
payment:
|
|
4085
|
+
payment: At(Q()),
|
|
4091
4086
|
getEstimate: () => Is(t, { publishMode: r })
|
|
4092
4087
|
});
|
|
4093
4088
|
}), zs = T(async ({ input: { context: e } }) => {
|
|
@@ -4098,7 +4093,7 @@ var Rs = T(async ({ input: { context: e } }) => {
|
|
|
4098
4093
|
seedUid: r
|
|
4099
4094
|
});
|
|
4100
4095
|
if (a.length === 0) return;
|
|
4101
|
-
let { revokePropertyAttestations: o } = await Promise.resolve().then(() =>
|
|
4096
|
+
let { revokePropertyAttestations: o } = await Promise.resolve().then(() => Sr);
|
|
4102
4097
|
await o({
|
|
4103
4098
|
seedLocalId: n,
|
|
4104
4099
|
seedUid: r,
|
|
@@ -4123,15 +4118,15 @@ var Us = Ye({
|
|
|
4123
4118
|
input: {}
|
|
4124
4119
|
},
|
|
4125
4120
|
actors: {
|
|
4126
|
-
createArweaveDataItems:
|
|
4127
|
-
createArweaveDataItemsPhase2:
|
|
4128
|
-
uploadViaBundler:
|
|
4129
|
-
createAttestations:
|
|
4130
|
-
createAttestationsDirectToEas:
|
|
4131
|
-
checking:
|
|
4121
|
+
createArweaveDataItems: di,
|
|
4122
|
+
createArweaveDataItemsPhase2: pi,
|
|
4123
|
+
uploadViaBundler: Ii,
|
|
4124
|
+
createAttestations: Ho,
|
|
4125
|
+
createAttestationsDirectToEas: rs,
|
|
4126
|
+
checking: ls,
|
|
4132
4127
|
authorizing: Rs,
|
|
4133
|
-
preparingHtmlEmbedded:
|
|
4134
|
-
rewritingHtmlEmbedded:
|
|
4128
|
+
preparingHtmlEmbedded: Lr,
|
|
4129
|
+
rewritingHtmlEmbedded: zr,
|
|
4135
4130
|
revokeRetractedProperties: zs
|
|
4136
4131
|
},
|
|
4137
4132
|
actions: {
|
|
@@ -4543,8 +4538,8 @@ function ec(e, t) {
|
|
|
4543
4538
|
//#region src/services/publishManager/actions/createPublish.ts
|
|
4544
4539
|
function tc(e) {
|
|
4545
4540
|
if (e) {
|
|
4546
|
-
if (
|
|
4547
|
-
if (
|
|
4541
|
+
if (P(e)) return e;
|
|
4542
|
+
if (N(e)) {
|
|
4548
4543
|
let t = n();
|
|
4549
4544
|
if (t && t.signer.address.toLowerCase() === e.address.toLowerCase()) return t;
|
|
4550
4545
|
throw Error("@seedprotocol/publish: createPublish requires a PublishWallet (signer + txSender). Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
|
|
@@ -4555,8 +4550,8 @@ function tc(e) {
|
|
|
4555
4550
|
function nc(e) {
|
|
4556
4551
|
if (e) {
|
|
4557
4552
|
if (e instanceof C.Wallet) return e;
|
|
4558
|
-
if (
|
|
4559
|
-
if (
|
|
4553
|
+
if (P(e)) return e.signer;
|
|
4554
|
+
if (N(e)) return e;
|
|
4560
4555
|
}
|
|
4561
4556
|
}
|
|
4562
4557
|
var rc = qe(({ event: e, enqueue: t }) => {
|
|
@@ -4606,7 +4601,7 @@ var rc = qe(({ event: e, enqueue: t }) => {
|
|
|
4606
4601
|
console.warn(`Publish process with seedLocalId "${r}" does not exist.`);
|
|
4607
4602
|
return;
|
|
4608
4603
|
}
|
|
4609
|
-
let o = i == null ? n() ?? void 0 :
|
|
4604
|
+
let o = i == null ? n() ?? void 0 : P(i) ? i : void 0;
|
|
4610
4605
|
i != null && !o && console.warn("[retryAttestations] account must be a PublishWallet. Use fromThirdwebAccount / fromEip1193Provider / fromEthersWallet."), a.send({
|
|
4611
4606
|
type: "retry",
|
|
4612
4607
|
account: o,
|
|
@@ -5024,7 +5019,7 @@ var Qc = Je(({ sendBack: e }) => {
|
|
|
5024
5019
|
},
|
|
5025
5020
|
actors: { restoreFromDb: Qc },
|
|
5026
5021
|
actions: {
|
|
5027
|
-
assignRestoreFromDb:
|
|
5022
|
+
assignRestoreFromDb: Ir,
|
|
5028
5023
|
createPublish: rc,
|
|
5029
5024
|
queueCreatePublish: $c,
|
|
5030
5025
|
drainPendingCreates: el,
|
|
@@ -5221,7 +5216,7 @@ async function cl(e) {
|
|
|
5221
5216
|
async function ll(e) {
|
|
5222
5217
|
let { signer: t, bundlerUrl: n, paymasterUrl: r, sponsored: i = !0 } = e;
|
|
5223
5218
|
await cl(n);
|
|
5224
|
-
let a =
|
|
5219
|
+
let a = kl(), o = Al(), s = t.address, c = Ee({
|
|
5225
5220
|
chain: a,
|
|
5226
5221
|
transport: je(o)
|
|
5227
5222
|
}), l = sl(t), u = await pt({
|
|
@@ -5244,7 +5239,7 @@ async function ll(e) {
|
|
|
5244
5239
|
...i ? { paymaster: d } : {},
|
|
5245
5240
|
userOperation: { estimateFeesPerGas: async () => (await d.getUserOperationGasPrice()).fast }
|
|
5246
5241
|
});
|
|
5247
|
-
return
|
|
5242
|
+
return rr({
|
|
5248
5243
|
address: u.address ?? s,
|
|
5249
5244
|
sendTransaction: async (e) => {
|
|
5250
5245
|
let t;
|
|
@@ -5267,7 +5262,7 @@ function ul(e, t) {
|
|
|
5267
5262
|
let n = e.receipt.transactionHash;
|
|
5268
5263
|
if (e.success) return n;
|
|
5269
5264
|
let r = e.reason;
|
|
5270
|
-
throw r && !/^0x[0-9a-f]*$/i.test(r) ? new
|
|
5265
|
+
throw r && !/^0x[0-9a-f]*$/i.test(r) ? new k(`The publish UserOp in transaction ${n} failed: ${r}`, "USEROP_REVERTED", t) : qn({
|
|
5271
5266
|
txHash: n,
|
|
5272
5267
|
revertData: r,
|
|
5273
5268
|
sender: t
|
|
@@ -5286,14 +5281,14 @@ async function dl(...e) {
|
|
|
5286
5281
|
function fl(e) {
|
|
5287
5282
|
if (e) {
|
|
5288
5283
|
if (e instanceof C.Wallet) return e;
|
|
5289
|
-
if (
|
|
5290
|
-
if (
|
|
5284
|
+
if (P(e)) return e.signer;
|
|
5285
|
+
if (N(e)) return e;
|
|
5291
5286
|
}
|
|
5292
5287
|
}
|
|
5293
5288
|
async function pl(e, r) {
|
|
5294
|
-
let i = Q(), a =
|
|
5289
|
+
let i = Q(), a = At(i);
|
|
5295
5290
|
if (a.sender === "modular") {
|
|
5296
|
-
let { ensureSmartWalletThenPublish: t } = await import("./ensureSmartWalletThenPublish-
|
|
5291
|
+
let { ensureSmartWalletThenPublish: t } = await import("./ensureSmartWalletThenPublish-DhWyUjt0.js").then((e) => e.n);
|
|
5297
5292
|
return t(e, null, async () => {
|
|
5298
5293
|
let e = n();
|
|
5299
5294
|
return e?.publisherAddress ?? e?.signer.address ?? null;
|
|
@@ -5350,6 +5345,14 @@ function gl(e, t) {
|
|
|
5350
5345
|
});
|
|
5351
5346
|
}
|
|
5352
5347
|
async function _l(e, t) {
|
|
5348
|
+
let n = c.retain(e);
|
|
5349
|
+
try {
|
|
5350
|
+
await vl(e, t);
|
|
5351
|
+
} finally {
|
|
5352
|
+
n && e.unload();
|
|
5353
|
+
}
|
|
5354
|
+
}
|
|
5355
|
+
async function vl(e, t) {
|
|
5353
5356
|
await ol.ready();
|
|
5354
5357
|
let n = await pl(e, t);
|
|
5355
5358
|
switch (n.outcome) {
|
|
@@ -5365,14 +5368,14 @@ async function _l(e, t) {
|
|
|
5365
5368
|
//#endregion
|
|
5366
5369
|
//#region src/config.ts
|
|
5367
5370
|
gt("publish");
|
|
5368
|
-
var
|
|
5369
|
-
function
|
|
5370
|
-
|
|
5371
|
+
var yl = null;
|
|
5372
|
+
function bl(e) {
|
|
5373
|
+
yl = e;
|
|
5371
5374
|
}
|
|
5372
|
-
function
|
|
5373
|
-
return
|
|
5375
|
+
function xl() {
|
|
5376
|
+
return yl;
|
|
5374
5377
|
}
|
|
5375
|
-
function
|
|
5378
|
+
function Sl(e) {
|
|
5376
5379
|
let t = typeof e.uploadApiBaseUrl == "string" ? e.uploadApiBaseUrl.trim() : "";
|
|
5377
5380
|
if (!t) {
|
|
5378
5381
|
if ((e.payment?.storage ?? "operator") === "operator") throw Error("initPublish: uploadApiBaseUrl is required (the upload API that stores files on Arweave), unless payment.storage is \"user\".");
|
|
@@ -5387,33 +5390,33 @@ function xl(e) {
|
|
|
5387
5390
|
}
|
|
5388
5391
|
if (!n || n.protocol !== "http:" && n.protocol !== "https:") throw Error(`initPublish: uploadApiBaseUrl must be an absolute http(s) URL or a path from the page's origin, got "${e.uploadApiBaseUrl}".`);
|
|
5389
5392
|
}
|
|
5390
|
-
function
|
|
5391
|
-
|
|
5392
|
-
let t =
|
|
5393
|
+
function Cl(e) {
|
|
5394
|
+
jt(e), Sl(e);
|
|
5395
|
+
let t = El(e);
|
|
5393
5396
|
ht("publish", {
|
|
5394
5397
|
chainId: t.chainId,
|
|
5395
5398
|
indexerUrl: t.indexerUrl
|
|
5396
|
-
}),
|
|
5399
|
+
}), bl(e), ge(async () => {
|
|
5397
5400
|
let e = n();
|
|
5398
5401
|
if (e?.publisherAddress) return e.publisherAddress;
|
|
5399
5402
|
if (e?.signer?.address) return e.signer.address;
|
|
5400
|
-
}), _e(_l), ve(
|
|
5403
|
+
}), _e(_l), ve(Fr), we().then(() => import("./worker-4DXDWw6E.js")).then((e) => {
|
|
5401
5404
|
e.startArweaveL1FinalizeWorker();
|
|
5402
5405
|
}), he(async () => e.useModularExecutor && e.modularAccountModuleContract ? [e.modularAccountModuleContract] : []);
|
|
5403
5406
|
}
|
|
5404
|
-
var
|
|
5405
|
-
function
|
|
5407
|
+
var wl = Cl;
|
|
5408
|
+
function Tl(e) {
|
|
5406
5409
|
let t = e?.thirdweb ?? {};
|
|
5407
5410
|
return {
|
|
5408
5411
|
bundlerUrl: t.bundlerUrl?.trim() || void 0,
|
|
5409
|
-
sponsorGas:
|
|
5412
|
+
sponsorGas: kt(e ?? {}),
|
|
5410
5413
|
modularWalletMode: t.modularWalletMode ?? "EIP7702"
|
|
5411
5414
|
};
|
|
5412
5415
|
}
|
|
5413
5416
|
function Q() {
|
|
5414
|
-
let e =
|
|
5417
|
+
let e = yl;
|
|
5415
5418
|
if (!e) throw Error("@seedprotocol/publish: Call initPublish() or ensure PublishProvider is mounted with config before using the publish package");
|
|
5416
|
-
let t = e.arweaveUploadVerificationBaseUrl ?? e.uploadApiBaseUrl, n = e.arweaveGraphqlUrl ?? o, r = e.useModularExecutor ?? !1, i = e.chain ?? O, a =
|
|
5419
|
+
let t = e.arweaveUploadVerificationBaseUrl ?? e.uploadApiBaseUrl, n = e.arweaveGraphqlUrl ?? o, r = e.useModularExecutor ?? !1, i = e.chain ?? O, a = El(e), s = e.accountMode ?? (e.bundlerUrl ? "eip7702" : "eoa");
|
|
5417
5420
|
return {
|
|
5418
5421
|
...e,
|
|
5419
5422
|
thirdwebAccountFactoryAddress: e.managedAccountFactoryAddress ?? yt[i.id],
|
|
@@ -5425,13 +5428,13 @@ function Q() {
|
|
|
5425
5428
|
arweaveUploadVerificationBaseUrl: t,
|
|
5426
5429
|
arweaveGraphqlUrl: n,
|
|
5427
5430
|
autoDeployManagedAccount: e.autoDeployManagedAccount ?? !1,
|
|
5428
|
-
autoDeployEip7702ModularAccount:
|
|
5431
|
+
autoDeployEip7702ModularAccount: Ol(e, r),
|
|
5429
5432
|
chain: i,
|
|
5430
5433
|
accountMode: s,
|
|
5431
|
-
thirdweb:
|
|
5434
|
+
thirdweb: Tl(e)
|
|
5432
5435
|
};
|
|
5433
5436
|
}
|
|
5434
|
-
function
|
|
5437
|
+
function El(e) {
|
|
5435
5438
|
let t = e.chain ?? O;
|
|
5436
5439
|
try {
|
|
5437
5440
|
return _t(t.id, {
|
|
@@ -5443,33 +5446,33 @@ function Tl(e) {
|
|
|
5443
5446
|
throw Error(`@seedprotocol/publish: ${t.name} (chain ${t.id}) has no known EAS deployment. Pass easContractAddress and schemaRegistryAddress in initPublish / PublishProvider config.`, { cause: e });
|
|
5444
5447
|
}
|
|
5445
5448
|
}
|
|
5446
|
-
function
|
|
5449
|
+
function Dl() {
|
|
5447
5450
|
let { thirdwebAccountFactoryAddress: e, chain: t } = Q();
|
|
5448
5451
|
if (!e) throw Error(`@seedprotocol/publish: no ManagedAccount factory is known for ${t.name} (chain ${t.id}). Pass managedAccountFactoryAddress in publish config, or use the EOA / direct EAS path.`);
|
|
5449
5452
|
return e;
|
|
5450
5453
|
}
|
|
5451
|
-
function
|
|
5454
|
+
function Ol(e, t) {
|
|
5452
5455
|
return e.autoDeployEip7702ModularAccount === !0 || e.autoDeployEip7702ModularAccount !== !1 && t;
|
|
5453
5456
|
}
|
|
5454
5457
|
//#endregion
|
|
5455
5458
|
//#region src/helpers/chainConfig.ts
|
|
5456
|
-
function
|
|
5459
|
+
function kl() {
|
|
5457
5460
|
try {
|
|
5458
5461
|
return Q().chain ?? O;
|
|
5459
5462
|
} catch {
|
|
5460
5463
|
return O;
|
|
5461
5464
|
}
|
|
5462
5465
|
}
|
|
5463
|
-
function
|
|
5466
|
+
function Al() {
|
|
5464
5467
|
let e = Q();
|
|
5465
5468
|
if (e.rpcUrl) return e.rpcUrl;
|
|
5466
5469
|
if (e.thirdwebClientId) return `https://${(e.chain ?? O).id}.rpc.thirdweb.com/${e.thirdwebClientId}`;
|
|
5467
5470
|
throw Error("@seedprotocol/publish: rpcUrl is required when thirdwebClientId is not set. A thirdwebSecretKey authenticates Thirdweb RPC but does not build this URL. Pass rpcUrl or thirdwebClientId in initPublish / PublishProvider config.");
|
|
5468
5471
|
}
|
|
5469
5472
|
function $() {
|
|
5470
|
-
return
|
|
5473
|
+
return kl().name;
|
|
5471
5474
|
}
|
|
5472
5475
|
//#endregion
|
|
5473
|
-
export {
|
|
5476
|
+
export { Sa as $, Et as $t, mo as A, Bn as At, Oa as B, A as Bt, us as C, ar as Ct, Eo as D, Pn as Dt, Ro as E, ir as Et, qa as F, xn as Ft, za as G, Wt as Gt, ja as H, dn as Ht, Ya as I, vn as It, Ba as J, Kt as Jt, _a as K, Jt as Kt, Da as L, Sn as Lt, uo as M, kn as Mt, lo as N, An as Nt, go as O, Rn as Ot, Za as P, pn as Pt, va as Q, Gt as Qt, Aa as R, Cn as Rt, fs as S, rr as St, Lo as T, N as Tt, Na as U, nn as Ut, Ma as V, rn as Vt, La as W, j as Wt, Ta as X, qt as Xt, wa as Y, Xt as Yt, Ea as Z, Zt, Is as _, F as _t, Q as a, yt as an, Di as at, vs as b, sr as bt, El as c, xt as cn, gi as ct, pl as d, si as dt, Tt as en, xa as et, dl as f, gr as ft, Fs as g, pr as gt, Us as h, mr as ht, xl as i, O as in, U as it, ao as j, On as jt, po as k, Fn as kt, _l as l, _i as lt, ol as m, hr as mt, kl as n, At as nn, ua as nt, Cl as o, bt as on, Oi as ot, ll as p, xr as pt, Ca as q, k as qt, wl as r, Ot as rn, fa as rt, Dl as s, St as sn, mi as st, $ as t, Dt as tn, ba as tt, gl as u, Gr as ut, Es as v, cr as vt, ds as w, P as wt, ys as x, nr as xt, Ds as y, or as yt, ka as z, wn as zt };
|
|
5474
5477
|
|
|
5475
|
-
//# sourceMappingURL=chainConfig-
|
|
5478
|
+
//# sourceMappingURL=chainConfig-B8U89YJb.js.map
|