@seedprotocol/publish 0.4.18 → 0.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/config.d.ts +24 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/helpers/arweave.d.ts +3 -2
- package/dist/helpers/arweave.d.ts.map +1 -1
- package/dist/helpers/arweave.test.d.ts +2 -0
- package/dist/helpers/arweave.test.d.ts.map +1 -0
- package/dist/helpers/ensureManagedAccountReady.test.d.ts +2 -0
- package/dist/helpers/ensureManagedAccountReady.test.d.ts.map +1 -0
- package/dist/hooks/useArweaveL1Finalize.d.ts +23 -0
- package/dist/hooks/useArweaveL1Finalize.d.ts.map +1 -0
- package/dist/hooks/useItemPublishStatus.d.ts +8 -0
- package/dist/hooks/useItemPublishStatus.d.ts.map +1 -1
- package/dist/index-BfABV7U1.js +4840 -0
- package/dist/index-BfABV7U1.js.map +1 -0
- package/dist/index-DhVUuOO3.js +4824 -0
- package/dist/index-DhVUuOO3.js.map +1 -0
- package/dist/index-P7oBN4Yu.js +4785 -0
- package/dist/index-P7oBN4Yu.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +110 -4734
- package/dist/index.js.map +1 -1
- package/dist/services/PublishManager/actions/createPublish.d.ts.map +1 -1
- package/dist/services/arweaveL1Finalize/enqueue.d.ts +7 -0
- package/dist/services/arweaveL1Finalize/enqueue.d.ts.map +1 -0
- package/dist/services/arweaveL1Finalize/worker.d.ts +3 -0
- package/dist/services/arweaveL1Finalize/worker.d.ts.map +1 -0
- package/dist/services/publish/actors/createArweaveDataItems.d.ts.map +1 -1
- package/dist/services/publish/actors/createArweaveTransactions.d.ts.map +1 -1
- 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/helpers/getPublishUploadData.d.ts +8 -2
- package/dist/services/publish/helpers/getPublishUploadData.d.ts.map +1 -1
- package/dist/services/upload/uploadMachine.d.ts +1 -1
- package/dist/types.d.ts +10 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/worker-BxY09Tmw.js +73 -0
- package/dist/worker-BxY09Tmw.js.map +1 -0
- package/dist/worker-Ce8qDQKc.js +73 -0
- package/dist/worker-Ce8qDQKc.js.map +1 -0
- package/dist/worker-F-UKvyIU.js +73 -0
- package/dist/worker-F-UKvyIU.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,4785 @@
|
|
|
1
|
+
import { getGetAdditionalSyncAddresses as yn, getAttesterForSeed as gn, getVersionsForSeedUid as wn, getMetadataAttestationUidsForSeedUid as bn, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA as An, updateSeedRevokedAt as vn, setGetPublisherForNewSeeds as Sn, setRevokeExecutor as En, setAdditionalSyncAddresses as In, DEFAULT_ARWEAVE_GRAPHQL_URL as Pn, client as pt, getSegmentedItemProperties as at, setSchemaUidForModel as He, setSchemaUidForSchemaDefinition as oe, INTERNAL_DATA_TYPES as Un, getEasSchemaForItemProperty as Tn, getRelatedItemsForPublish as Dn, BaseArweaveClient as xn, Item as ae, getCorrectId as Mt, BaseFileManager as G, getUploadPipelineTransactionStatus as Cn, BaseDb as B, arweaveL1FinalizeJobs as De, resolvePublishPayloadValues as mt, getItemPropertiesFromEas as Rn, updateVersionUid as _n, itemHasPublishUploadCandidates as Ln, isItemOwned as Ot, validateItemForPublish as Mn, publishProcesses as P, uploadProcesses as On } from "@seedprotocol/sdk";
|
|
2
|
+
import { prepareContractCall as x, readContract as _, createThirdwebClient as Bn, getContract as V, sendTransaction as N, waitForReceipt as k, parseEventLogs as st, prepareEvent as Y } from "thirdweb";
|
|
3
|
+
import { createWallet as Ce, inAppWallet as Bt } from "thirdweb/wallets";
|
|
4
|
+
import { useActiveAccount as Fn, ThirdwebProvider as Nn, ConnectButton as kn, darkTheme as Hn } from "thirdweb/react";
|
|
5
|
+
import { isContractDeployed as $n } from "thirdweb/utils";
|
|
6
|
+
import { useState as Ae, useRef as Ft, useEffect as te, createContext as Vn, useContext as Wn, useMemo as Nt } from "react";
|
|
7
|
+
import { optimismSepolia as v } from "thirdweb/chains";
|
|
8
|
+
import K from "debug";
|
|
9
|
+
import { encodeAbiParameters as kt, decodeAbiParameters as qn } from "viem";
|
|
10
|
+
import { jsx as me, jsxs as jn } from "react/jsx-runtime";
|
|
11
|
+
import { SeedProvider as Gn, useLiveQuery as ve } from "@seedprotocol/react";
|
|
12
|
+
import { getInstalledModules as Yn, installModule as Jn } from "thirdweb/modules";
|
|
13
|
+
import { SchemaEncoder as zn, ZERO_BYTES32 as Zn, NO_EXPIRATION as Kn, SchemaRegistry as $e, ZERO_ADDRESS as Qe } from "@ethereum-attestation-service/eas-sdk";
|
|
14
|
+
import { fromPromise as he, fromCallback as ye, setup as Ht, assign as T, enqueueActions as Le, createActor as Xe } from "xstate";
|
|
15
|
+
import Qn from "arweave";
|
|
16
|
+
import { ethers as H } from "ethers";
|
|
17
|
+
import { readFile as Xn } from "node:fs/promises";
|
|
18
|
+
import { and as ea, eq as Z, desc as fe, notInArray as ta, inArray as na } from "drizzle-orm";
|
|
19
|
+
import { useSelector as aa } from "@xstate/react";
|
|
20
|
+
async function sa(e) {
|
|
21
|
+
return _({
|
|
22
|
+
contract: e.contract,
|
|
23
|
+
method: [
|
|
24
|
+
"0x8878ed33",
|
|
25
|
+
[
|
|
26
|
+
{
|
|
27
|
+
type: "address",
|
|
28
|
+
name: "_adminSigner"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "bytes",
|
|
32
|
+
name: "_data"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
{
|
|
37
|
+
type: "address"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
],
|
|
41
|
+
params: [e.adminSigner, e.data]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function ra(e) {
|
|
45
|
+
return x({
|
|
46
|
+
contract: e.contract,
|
|
47
|
+
method: [
|
|
48
|
+
"0xd8fd8f44",
|
|
49
|
+
[
|
|
50
|
+
{
|
|
51
|
+
type: "address",
|
|
52
|
+
name: "_admin"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: "bytes",
|
|
56
|
+
name: "_data"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
{
|
|
61
|
+
type: "address"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
],
|
|
65
|
+
params: [e.admin, e.data]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const $t = "0x4200000000000000000000000000000000000020", oa = "0x44d562ac1d7cd77e232978687fea027ace48f719cf1d58c7888e509663bb87fc", Vt = "0x76f47d88bfaf670f5208911181fcdc0e160cb16d", Wt = "0x4200000000000000000000000000000000000021", ft = "0xcd8c945872df8e664e55cf8885c85ea3ea8f2148", L = {
|
|
69
|
+
SUCCESS: "success",
|
|
70
|
+
FAILURE: "failure"
|
|
71
|
+
}, ia = [
|
|
72
|
+
"pollingForConfirmation",
|
|
73
|
+
"uploadingData",
|
|
74
|
+
"uploadingViaBundler"
|
|
75
|
+
], ca = 3e4, da = K("permaPress:helpers:thirdweb");
|
|
76
|
+
let Ve = null;
|
|
77
|
+
function R() {
|
|
78
|
+
if (!Ve) {
|
|
79
|
+
const { thirdwebClientId: e } = C();
|
|
80
|
+
Ve = Bn({ clientId: e });
|
|
81
|
+
}
|
|
82
|
+
return Ve;
|
|
83
|
+
}
|
|
84
|
+
const xr = [
|
|
85
|
+
// embeddedWallet(),
|
|
86
|
+
Ce("io.metamask")
|
|
87
|
+
// createWallet("com.coinbase.wallet"),
|
|
88
|
+
// createWallet("me.rainbow"),
|
|
89
|
+
], Cr = () => {
|
|
90
|
+
const [e, t] = Ae(null);
|
|
91
|
+
return Ce("io.metamask"), Ft(!1), te(() => {
|
|
92
|
+
(async () => {
|
|
93
|
+
})();
|
|
94
|
+
}, []), e;
|
|
95
|
+
}, Rr = () => {
|
|
96
|
+
const e = Fn(), [t, n] = Ae(null);
|
|
97
|
+
return te(() => {
|
|
98
|
+
!e || !e.address || n(V({
|
|
99
|
+
client: R(),
|
|
100
|
+
chain: v,
|
|
101
|
+
address: e.address
|
|
102
|
+
}));
|
|
103
|
+
}, [e]), t;
|
|
104
|
+
}, qt = () => {
|
|
105
|
+
const { thirdwebAccountFactoryAddress: e } = C();
|
|
106
|
+
return V({
|
|
107
|
+
client: R(),
|
|
108
|
+
chain: v,
|
|
109
|
+
address: e
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
async function jt(e, t = "0x") {
|
|
113
|
+
const n = qt();
|
|
114
|
+
return sa({
|
|
115
|
+
contract: n,
|
|
116
|
+
adminSigner: e,
|
|
117
|
+
data: t
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async function Re(e) {
|
|
121
|
+
const t = V({
|
|
122
|
+
client: R(),
|
|
123
|
+
chain: v,
|
|
124
|
+
address: e
|
|
125
|
+
});
|
|
126
|
+
return $n(t);
|
|
127
|
+
}
|
|
128
|
+
async function ht(e) {
|
|
129
|
+
if (!e)
|
|
130
|
+
return { needsDeploy: !0 };
|
|
131
|
+
if (await Re(e.address))
|
|
132
|
+
return { address: e.address, account: e };
|
|
133
|
+
const n = await jt(e.address);
|
|
134
|
+
return await Re(n) ? { address: n, account: e } : { needsDeploy: !0 };
|
|
135
|
+
}
|
|
136
|
+
const _r = [
|
|
137
|
+
Ce("io.metamask"),
|
|
138
|
+
Ce("me.rainbow")
|
|
139
|
+
], la = async (e) => {
|
|
140
|
+
const t = qt(), n = ra({
|
|
141
|
+
contract: t,
|
|
142
|
+
admin: e.address,
|
|
143
|
+
data: "0x"
|
|
144
|
+
}), a = await N({
|
|
145
|
+
account: e,
|
|
146
|
+
transaction: n
|
|
147
|
+
});
|
|
148
|
+
da("createAccountTx result:", a);
|
|
149
|
+
const s = await k({
|
|
150
|
+
client: R(),
|
|
151
|
+
transactionHash: a.transactionHash,
|
|
152
|
+
chain: v
|
|
153
|
+
});
|
|
154
|
+
if (!s)
|
|
155
|
+
throw new Error("Failed to deploy smart wallet");
|
|
156
|
+
return s;
|
|
157
|
+
}, Lr = {
|
|
158
|
+
name: "Seed Protocol",
|
|
159
|
+
description: "Seed Protocol",
|
|
160
|
+
url: "https://seedprotocol.io"
|
|
161
|
+
};
|
|
162
|
+
async function rt(e = v) {
|
|
163
|
+
const t = Me();
|
|
164
|
+
await t.autoConnect({ client: R(), chain: e });
|
|
165
|
+
const n = t.getAccount();
|
|
166
|
+
if (!n)
|
|
167
|
+
throw new Error("Failed to get managed account");
|
|
168
|
+
return n.address;
|
|
169
|
+
}
|
|
170
|
+
async function ua() {
|
|
171
|
+
try {
|
|
172
|
+
const e = ot();
|
|
173
|
+
return await e.autoConnect({ client: R(), chain: v }), e.getAccount() ?? null;
|
|
174
|
+
} catch {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const Me = () => Bt({
|
|
179
|
+
auth: {
|
|
180
|
+
options: [
|
|
181
|
+
"farcaster",
|
|
182
|
+
"email",
|
|
183
|
+
"passkey",
|
|
184
|
+
"phone"
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
executionMode: {
|
|
188
|
+
mode: "EIP4337",
|
|
189
|
+
smartAccount: {
|
|
190
|
+
chain: v,
|
|
191
|
+
factoryAddress: Vt,
|
|
192
|
+
gasless: !0
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// executionMode: {
|
|
196
|
+
// mode: 'EIP4337',
|
|
197
|
+
// smartAccount: {
|
|
198
|
+
// chain: optimismSepolia,
|
|
199
|
+
// factoryAddress: thirdwebAccountFactoryAddress,
|
|
200
|
+
// gasless: true,
|
|
201
|
+
// overrides: {
|
|
202
|
+
// // Custom paymaster that passes through but lets you modify the UserOp
|
|
203
|
+
// paymaster: async (userOp) => {
|
|
204
|
+
// const hexifyBigInts: any = (obj: any) => {
|
|
205
|
+
// if (typeof obj === "bigint") return `0x${obj.toString(16)}`;
|
|
206
|
+
// if (Array.isArray(obj)) return obj.map(hexifyBigInts);
|
|
207
|
+
// if (obj && typeof obj === "object") {
|
|
208
|
+
// return Object.fromEntries(
|
|
209
|
+
// Object.entries(obj).map(([k, v]) => [k, hexifyBigInts(v)])
|
|
210
|
+
// );
|
|
211
|
+
// }
|
|
212
|
+
// return obj;
|
|
213
|
+
// };
|
|
214
|
+
// const chainIdHex = `0x${optimismSepolia.id.toString(16)}`;
|
|
215
|
+
// // Increase callGasLimit before sending to paymaster
|
|
216
|
+
// const modifiedUserOp = hexifyBigInts({
|
|
217
|
+
// ...userOp,
|
|
218
|
+
// callGasLimit: BigInt(8000000), // Double it, or set a fixed value
|
|
219
|
+
// });
|
|
220
|
+
// console.log("[SmartWallet Paymaster]", getPublishConfig().thirdwebClientId);
|
|
221
|
+
// // Call thirdweb's default paymaster endpoint
|
|
222
|
+
// const response = await fetch(
|
|
223
|
+
// `https://${optimismSepolia.id}.bundler.thirdweb.com/v2`,
|
|
224
|
+
// {
|
|
225
|
+
// method: "POST",
|
|
226
|
+
// headers: {
|
|
227
|
+
// "Content-Type": "application/json",
|
|
228
|
+
// "X-Client-Id": getPublishConfig().thirdwebClientId,
|
|
229
|
+
// },
|
|
230
|
+
// body: JSON.stringify({
|
|
231
|
+
// id: 1,
|
|
232
|
+
// jsonrpc: "2.0",
|
|
233
|
+
// method: "pm_sponsorUserOperation",
|
|
234
|
+
// params: [modifiedUserOp, '0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789', chainIdHex],
|
|
235
|
+
// }),
|
|
236
|
+
// }
|
|
237
|
+
// );
|
|
238
|
+
// const data = await response.json();
|
|
239
|
+
// console.log("[SmartWallet Paymaster Response]", data);
|
|
240
|
+
// return {
|
|
241
|
+
// paymasterAndData: data.result.paymasterAndData,
|
|
242
|
+
// preVerificationGas: data.result.preVerificationGas,
|
|
243
|
+
// verificationGasLimit: data.result.verificationGasLimit,
|
|
244
|
+
// callGasLimit: data.result.callGasLimit,
|
|
245
|
+
// };
|
|
246
|
+
// },
|
|
247
|
+
// execute: (accountContract, transaction) => {
|
|
248
|
+
// // Log the gas that was set on the transaction
|
|
249
|
+
// console.log("[SmartWallet Execute]", {
|
|
250
|
+
// gas: transaction.gas,
|
|
251
|
+
// to: transaction.to,
|
|
252
|
+
// dataLength: transaction.data?.length,
|
|
253
|
+
// });
|
|
254
|
+
// // Return the default execute call — don't change behavior,
|
|
255
|
+
// // just observe what's being passed through
|
|
256
|
+
// return prepareContractCall({
|
|
257
|
+
// contract: accountContract,
|
|
258
|
+
// method: "function execute(address, uint256, bytes)",
|
|
259
|
+
// params: [
|
|
260
|
+
// transaction.to ?? "",
|
|
261
|
+
// transaction.value ?? 0n,
|
|
262
|
+
// transaction.data ?? "0x",
|
|
263
|
+
// ],
|
|
264
|
+
// gas: transaction.gas, // Pass through whatever was set
|
|
265
|
+
// });
|
|
266
|
+
// },
|
|
267
|
+
// },
|
|
268
|
+
// }
|
|
269
|
+
// }
|
|
270
|
+
}), ot = () => Bt({
|
|
271
|
+
auth: {
|
|
272
|
+
options: [
|
|
273
|
+
"farcaster",
|
|
274
|
+
"email",
|
|
275
|
+
"passkey",
|
|
276
|
+
"phone"
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
executionMode: {
|
|
280
|
+
mode: "EIP7702",
|
|
281
|
+
sponsorGas: !0
|
|
282
|
+
}
|
|
283
|
+
}), pa = () => [
|
|
284
|
+
ot()
|
|
285
|
+
], ma = [
|
|
286
|
+
{ type: "error", name: "AccessDenied", inputs: [] },
|
|
287
|
+
{ type: "error", name: "AlreadyRevoked", inputs: [] },
|
|
288
|
+
{ type: "error", name: "InvalidRevocation", inputs: [] },
|
|
289
|
+
{ type: "error", name: "InvalidRevocations", inputs: [] },
|
|
290
|
+
{ type: "error", name: "InvalidSchema", inputs: [] },
|
|
291
|
+
{ type: "error", name: "Irrevocable", inputs: [] },
|
|
292
|
+
{ type: "error", name: "NotFound", inputs: [] },
|
|
293
|
+
{ type: "error", name: "NotPayable", inputs: [] },
|
|
294
|
+
{ type: "error", name: "InsufficientValue", inputs: [] },
|
|
295
|
+
{ type: "error", name: "InvalidLength", inputs: [] }
|
|
296
|
+
], fa = () => Y({
|
|
297
|
+
signature: "event Attested(address indexed recipient, address indexed attester, bytes32 uid, bytes32 indexed schemaUID)"
|
|
298
|
+
}), ha = "0x0000000000000000000000000000000000000000", q = "0x" + "0".repeat(64);
|
|
299
|
+
function yt(e, t, n) {
|
|
300
|
+
const { easContractAddress: a } = C(), s = V({
|
|
301
|
+
client: e,
|
|
302
|
+
chain: t,
|
|
303
|
+
address: a
|
|
304
|
+
});
|
|
305
|
+
return x({
|
|
306
|
+
contract: s,
|
|
307
|
+
method: "function attest((bytes32 schema,(address recipient,uint64 expirationTime,bool revocable,bytes32 refUID,bytes data,uint256 value) data) request) payable returns (bytes32)",
|
|
308
|
+
params: [
|
|
309
|
+
{
|
|
310
|
+
schema: n.schema,
|
|
311
|
+
data: {
|
|
312
|
+
recipient: n.data.recipient ?? ha,
|
|
313
|
+
expirationTime: n.data.expirationTime ?? 0n,
|
|
314
|
+
revocable: n.data.revocable ?? !0,
|
|
315
|
+
refUID: n.data.refUID,
|
|
316
|
+
data: n.data.data,
|
|
317
|
+
value: n.data.value ?? 0n
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
]
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function ya(e, t, n) {
|
|
324
|
+
const { easContractAddress: a } = C(), s = V({
|
|
325
|
+
client: e,
|
|
326
|
+
chain: t,
|
|
327
|
+
address: a
|
|
328
|
+
});
|
|
329
|
+
return x({
|
|
330
|
+
contract: s,
|
|
331
|
+
method: "function multiAttest((bytes32 schema,(address recipient,uint64 expirationTime,bool revocable,bytes32 refUID,bytes data,uint256 value)[] data)[] requests) payable returns (bytes32[])",
|
|
332
|
+
params: [n]
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
function We(e) {
|
|
336
|
+
return kt([{ type: "bytes32" }], [e]);
|
|
337
|
+
}
|
|
338
|
+
function gt(e, t) {
|
|
339
|
+
if (!e.logs?.length) return;
|
|
340
|
+
const n = t.toLowerCase(), a = e.logs.filter((s) => s.address && s.address.toLowerCase() === n);
|
|
341
|
+
if (a.length)
|
|
342
|
+
try {
|
|
343
|
+
const o = st({
|
|
344
|
+
logs: a,
|
|
345
|
+
events: [fa()],
|
|
346
|
+
strict: !1
|
|
347
|
+
})[0]?.args?.uid;
|
|
348
|
+
if (o && o !== q) return o;
|
|
349
|
+
} catch {
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function ga(e, t, n) {
|
|
353
|
+
const { easContractAddress: a } = C(), s = V({
|
|
354
|
+
client: e,
|
|
355
|
+
chain: t,
|
|
356
|
+
address: a,
|
|
357
|
+
abi: [...ma]
|
|
358
|
+
});
|
|
359
|
+
return x({
|
|
360
|
+
contract: s,
|
|
361
|
+
method: "function multiRevoke((bytes32 schema,(bytes32 uid,uint256 value)[] data)[] multiRequests) payable",
|
|
362
|
+
params: [
|
|
363
|
+
n.map((r) => ({
|
|
364
|
+
schema: r.schema,
|
|
365
|
+
data: r.data.map((o) => ({
|
|
366
|
+
uid: o.uid,
|
|
367
|
+
value: o.value ?? 0n
|
|
368
|
+
}))
|
|
369
|
+
}))
|
|
370
|
+
]
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
async function wa(e) {
|
|
374
|
+
const { account: t, attester: n } = e;
|
|
375
|
+
if (!n || t.address.toLowerCase() === n.toLowerCase())
|
|
376
|
+
return t;
|
|
377
|
+
const a = yn();
|
|
378
|
+
if (a) {
|
|
379
|
+
const s = await a(), r = n.toLowerCase();
|
|
380
|
+
if (s?.some((o) => o?.toLowerCase() === r))
|
|
381
|
+
throw new Error(
|
|
382
|
+
"Revocation not supported for items published via the modular executor."
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
try {
|
|
386
|
+
const s = await jt(t.address), r = n.toLowerCase(), o = s.toLowerCase();
|
|
387
|
+
if (r === o && await Re(s)) {
|
|
388
|
+
const c = Me();
|
|
389
|
+
await c.autoConnect({
|
|
390
|
+
client: R(),
|
|
391
|
+
chain: v
|
|
392
|
+
});
|
|
393
|
+
const u = c.getAccount();
|
|
394
|
+
if (u)
|
|
395
|
+
return u;
|
|
396
|
+
}
|
|
397
|
+
} catch {
|
|
398
|
+
}
|
|
399
|
+
return t;
|
|
400
|
+
}
|
|
401
|
+
async function ba(e) {
|
|
402
|
+
const { seedLocalId: t, seedUid: n, seedSchemaUid: a } = e, s = await ua();
|
|
403
|
+
if (!s)
|
|
404
|
+
throw new Error("No wallet connected. Connect a wallet to revoke attestations.");
|
|
405
|
+
const r = await gn({ seedLocalId: t, seedUid: n }), o = await wa({ account: s, attester: r }), i = R(), [c, u] = await Promise.all([
|
|
406
|
+
wn(n),
|
|
407
|
+
bn(n)
|
|
408
|
+
]), d = c.map((h) => h.uid), p = /* @__PURE__ */ new Map();
|
|
409
|
+
for (const { uid: h, schemaUid: y } of u) {
|
|
410
|
+
const f = p.get(y) ?? [];
|
|
411
|
+
f.push(h), p.set(y, f);
|
|
412
|
+
}
|
|
413
|
+
const l = [];
|
|
414
|
+
for (const [h, y] of p)
|
|
415
|
+
y.length > 0 && l.push({
|
|
416
|
+
schema: h,
|
|
417
|
+
data: y.map((f) => ({ uid: f }))
|
|
418
|
+
});
|
|
419
|
+
d.length > 0 && l.push({
|
|
420
|
+
schema: An,
|
|
421
|
+
data: d.map((h) => ({ uid: h }))
|
|
422
|
+
}), l.push({
|
|
423
|
+
schema: a,
|
|
424
|
+
data: [{ uid: n }]
|
|
425
|
+
});
|
|
426
|
+
for (const h of l) {
|
|
427
|
+
if (h.data.length === 0) continue;
|
|
428
|
+
const y = ga(i, v, [h]);
|
|
429
|
+
try {
|
|
430
|
+
const f = await N({ account: o, transaction: y });
|
|
431
|
+
await k({
|
|
432
|
+
client: i,
|
|
433
|
+
chain: v,
|
|
434
|
+
transactionHash: f.transactionHash
|
|
435
|
+
});
|
|
436
|
+
} catch (f) {
|
|
437
|
+
const A = f instanceof Error ? f.message : String(f);
|
|
438
|
+
if (A.includes("AccessDenied") || A.includes("0x4ca88867"))
|
|
439
|
+
throw new Error(
|
|
440
|
+
"Only the original attester can revoke attestations. Connect the wallet that published this item."
|
|
441
|
+
);
|
|
442
|
+
if (A.includes("AlreadyRevoked"))
|
|
443
|
+
continue;
|
|
444
|
+
throw f;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
const m = Math.floor(Date.now() / 1e3);
|
|
448
|
+
await vn({ seedLocalId: t, revokedAt: m });
|
|
449
|
+
}
|
|
450
|
+
let it = null;
|
|
451
|
+
function Aa(e) {
|
|
452
|
+
it = e;
|
|
453
|
+
}
|
|
454
|
+
function va() {
|
|
455
|
+
return it;
|
|
456
|
+
}
|
|
457
|
+
function Gt(e) {
|
|
458
|
+
Aa(e), Sn(async () => {
|
|
459
|
+
try {
|
|
460
|
+
return await rt(v);
|
|
461
|
+
} catch {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
}), En(ba), import("./worker-BxY09Tmw.js").then((t) => {
|
|
465
|
+
t.startArweaveL1FinalizeWorker();
|
|
466
|
+
}), In(async () => e.useModularExecutor && e.modularAccountModuleContract ? [e.modularAccountModuleContract] : []);
|
|
467
|
+
}
|
|
468
|
+
const Mr = Gt;
|
|
469
|
+
function C() {
|
|
470
|
+
const e = it;
|
|
471
|
+
if (!e)
|
|
472
|
+
throw new Error(
|
|
473
|
+
"@seedprotocol/publish: Call initPublish() or ensure PublishProvider is mounted with config before using the publish package"
|
|
474
|
+
);
|
|
475
|
+
const t = e.useArweaveBundler ?? !1, n = e.arweaveUploadVerificationBaseUrl ?? e.uploadApiBaseUrl, a = e.arweaveGraphqlUrl ?? Pn;
|
|
476
|
+
return {
|
|
477
|
+
...e,
|
|
478
|
+
thirdwebAccountFactoryAddress: Vt,
|
|
479
|
+
easContractAddress: Wt,
|
|
480
|
+
useIntegerLocalIds: e.useIntegerLocalIds ?? !1,
|
|
481
|
+
useDirectEas: e.useDirectEas ?? !1,
|
|
482
|
+
modularAccountModuleData: e.modularAccountModuleData ?? "0x",
|
|
483
|
+
useModularExecutor: e.useModularExecutor ?? !1,
|
|
484
|
+
useArweaveBundler: t,
|
|
485
|
+
arweaveUploadVerificationBaseUrl: n,
|
|
486
|
+
arweaveGraphqlUrl: a,
|
|
487
|
+
autoDeployManagedAccount: e.autoDeployManagedAccount ?? !1
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
class Yt extends Error {
|
|
491
|
+
constructor(t, n, a, s, r = "METADATA_PROPERTIES_MISSING") {
|
|
492
|
+
super(t), this.seedLocalId = n, this.expectedSchemas = a, this.foundSchemas = s, this.code = r, this.name = "AttestationVerificationError";
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
class Q extends Error {
|
|
496
|
+
constructor(t, n, a, s) {
|
|
497
|
+
super(t), this.code = n, this.managedAddress = a, this.name = "ManagedAccountPublishError", this.underlyingCause = s;
|
|
498
|
+
}
|
|
499
|
+
/** Original error when connection or deployment failed (avoids shadowing `Error.cause`). */
|
|
500
|
+
underlyingCause;
|
|
501
|
+
}
|
|
502
|
+
function wt(e) {
|
|
503
|
+
if (e instanceof Q) return !0;
|
|
504
|
+
if (typeof e != "object" || e === null) return !1;
|
|
505
|
+
const t = e;
|
|
506
|
+
return t.name === "ManagedAccountPublishError" && typeof t.code == "string";
|
|
507
|
+
}
|
|
508
|
+
function Sa(e, t = 700) {
|
|
509
|
+
if (e == null) return "";
|
|
510
|
+
if (e instanceof Error) {
|
|
511
|
+
const n = e.cause instanceof Error ? ` | cause: ${e.cause.message}` : "";
|
|
512
|
+
return (e.message + n).slice(0, t);
|
|
513
|
+
}
|
|
514
|
+
if (typeof e == "object") {
|
|
515
|
+
const n = e, a = [];
|
|
516
|
+
if (typeof n.message == "string" && a.push(n.message), typeof n.shortMessage == "string" && a.push(n.shortMessage), typeof n.details == "string" && a.push(n.details), typeof n.reason == "string" && a.push(n.reason), a.length) return a.join(" | ").slice(0, t);
|
|
517
|
+
try {
|
|
518
|
+
return JSON.stringify(e).slice(0, t);
|
|
519
|
+
} catch {
|
|
520
|
+
return String(e).slice(0, t);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return String(e).slice(0, t);
|
|
524
|
+
}
|
|
525
|
+
function Ea(e) {
|
|
526
|
+
return /Router:\s*function does not exist/i.test(Sa(e));
|
|
527
|
+
}
|
|
528
|
+
const Jt = Vn(null);
|
|
529
|
+
function Ia() {
|
|
530
|
+
const e = Wn(Jt);
|
|
531
|
+
if (!e)
|
|
532
|
+
throw new Error("usePublishConfig must be used within PublishProvider");
|
|
533
|
+
return e;
|
|
534
|
+
}
|
|
535
|
+
const Or = ({
|
|
536
|
+
children: e,
|
|
537
|
+
config: t,
|
|
538
|
+
queryClient: n,
|
|
539
|
+
queryClientRef: a
|
|
540
|
+
}) => (te(() => {
|
|
541
|
+
t && Gt(t);
|
|
542
|
+
}, [t]), /* @__PURE__ */ me(Jt.Provider, { value: t ?? va(), children: /* @__PURE__ */ me(Nn, { children: /* @__PURE__ */ me(Gn, { queryClient: n, queryClientRef: a, children: e }) }) })), Pa = "The executor module could not be installed on your publishing account on Optimism Sepolia. Reconnect and try again, or contact support if this persists.";
|
|
543
|
+
async function et(e, t, n) {
|
|
544
|
+
const { modularAccountModuleContract: a } = n;
|
|
545
|
+
if (!a) return;
|
|
546
|
+
const s = V({
|
|
547
|
+
client: R(),
|
|
548
|
+
chain: v,
|
|
549
|
+
address: e
|
|
550
|
+
});
|
|
551
|
+
try {
|
|
552
|
+
const r = await Yn({ contract: s }), o = a.toLowerCase();
|
|
553
|
+
if (r.some(
|
|
554
|
+
(d) => d.implementation?.toLowerCase() === o
|
|
555
|
+
)) return;
|
|
556
|
+
const c = Jn({
|
|
557
|
+
contract: s,
|
|
558
|
+
moduleContract: a,
|
|
559
|
+
data: kt([{ type: "address" }], [Wt])
|
|
560
|
+
}), u = await N({ transaction: c, account: t });
|
|
561
|
+
await k({
|
|
562
|
+
client: R(),
|
|
563
|
+
transactionHash: u.transactionHash,
|
|
564
|
+
chain: v
|
|
565
|
+
});
|
|
566
|
+
} catch (r) {
|
|
567
|
+
if (Ea(r))
|
|
568
|
+
return;
|
|
569
|
+
throw new Q(
|
|
570
|
+
Pa,
|
|
571
|
+
"EXECUTOR_MODULE_NOT_INSTALLED",
|
|
572
|
+
e,
|
|
573
|
+
r
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
function Se(e) {
|
|
578
|
+
console.error("[ConnectButton] Wallet setup / module install failed:", e), C().onWalletSetupWarning?.(e);
|
|
579
|
+
}
|
|
580
|
+
async function Ua(e, t, n) {
|
|
581
|
+
if (n.modularAccountModuleContract) {
|
|
582
|
+
if (n.useModularExecutor) {
|
|
583
|
+
if (!t) {
|
|
584
|
+
Se(
|
|
585
|
+
new Error(
|
|
586
|
+
"Executor module: managed account address not available yet (managed wallet may still be syncing)."
|
|
587
|
+
)
|
|
588
|
+
);
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
try {
|
|
592
|
+
const a = Me();
|
|
593
|
+
await a.autoConnect({ client: R(), chain: v });
|
|
594
|
+
const s = a.getAccount();
|
|
595
|
+
if (!s) {
|
|
596
|
+
Se(new Error("Executor module: managed wallet has no account"));
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
await et(t, s, n);
|
|
600
|
+
} catch (a) {
|
|
601
|
+
Se(a);
|
|
602
|
+
}
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
try {
|
|
606
|
+
await et(e.address, e, n);
|
|
607
|
+
} catch (a) {
|
|
608
|
+
Se(a);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
const Br = () => {
|
|
613
|
+
const e = Ia(), t = async () => {
|
|
614
|
+
console.log("[ConnectButton] Disconnected");
|
|
615
|
+
try {
|
|
616
|
+
await pt.setAddresses([]);
|
|
617
|
+
} catch (a) {
|
|
618
|
+
console.warn("[ConnectButton] Failed to clear seed client addresses:", a);
|
|
619
|
+
}
|
|
620
|
+
}, n = async (a, s) => {
|
|
621
|
+
const r = a.getAccount();
|
|
622
|
+
if (!r) return;
|
|
623
|
+
console.log("[ConnectButton] Connected", r.address);
|
|
624
|
+
const o = /* @__PURE__ */ new Set([r.address.toLowerCase()]);
|
|
625
|
+
let i;
|
|
626
|
+
if (e.useModularExecutor)
|
|
627
|
+
try {
|
|
628
|
+
i = await rt(v), o.add(i.toLowerCase());
|
|
629
|
+
} catch {
|
|
630
|
+
}
|
|
631
|
+
try {
|
|
632
|
+
await pt.setAddresses({ owned: [...o] });
|
|
633
|
+
} catch (c) {
|
|
634
|
+
console.warn("[ConnectButton] Failed to set seed client addresses:", c);
|
|
635
|
+
}
|
|
636
|
+
await Ua(r, i, e);
|
|
637
|
+
};
|
|
638
|
+
return /* @__PURE__ */ me(
|
|
639
|
+
kn,
|
|
640
|
+
{
|
|
641
|
+
client: R(),
|
|
642
|
+
wallets: pa(),
|
|
643
|
+
autoConnect: !0,
|
|
644
|
+
chain: v,
|
|
645
|
+
chains: [v],
|
|
646
|
+
onConnect: n,
|
|
647
|
+
onDisconnect: t,
|
|
648
|
+
theme: Hn({
|
|
649
|
+
colors: {
|
|
650
|
+
primaryButtonBg: "#1D2939",
|
|
651
|
+
primaryButtonText: "#FFFFFF",
|
|
652
|
+
secondaryButtonHoverBg: "#1D2939",
|
|
653
|
+
connectedButtonBg: "#101828",
|
|
654
|
+
connectedButtonBgHover: "#1D2939",
|
|
655
|
+
borderColor: "#344054"
|
|
656
|
+
}
|
|
657
|
+
})
|
|
658
|
+
}
|
|
659
|
+
);
|
|
660
|
+
}, Fr = ({
|
|
661
|
+
value: e,
|
|
662
|
+
onChange: t,
|
|
663
|
+
disabled: n = !1,
|
|
664
|
+
"aria-label": a = "Publish mode"
|
|
665
|
+
}) => {
|
|
666
|
+
const s = {
|
|
667
|
+
display: "inline-flex",
|
|
668
|
+
gap: 8,
|
|
669
|
+
flexWrap: "wrap"
|
|
670
|
+
}, r = (o) => ({
|
|
671
|
+
padding: "8px 14px",
|
|
672
|
+
fontSize: 13,
|
|
673
|
+
borderRadius: 8,
|
|
674
|
+
border: `1px solid ${o ? "#344054" : "#D0D5DD"}`,
|
|
675
|
+
background: o ? "#101828" : "#fff",
|
|
676
|
+
color: o ? "#fff" : "#344054",
|
|
677
|
+
cursor: n ? "not-allowed" : "pointer",
|
|
678
|
+
opacity: n ? 0.6 : 1
|
|
679
|
+
});
|
|
680
|
+
return /* @__PURE__ */ jn("div", { role: "group", "aria-label": a, style: s, children: [
|
|
681
|
+
/* @__PURE__ */ me(
|
|
682
|
+
"button",
|
|
683
|
+
{
|
|
684
|
+
type: "button",
|
|
685
|
+
disabled: n,
|
|
686
|
+
style: r(e === "patch"),
|
|
687
|
+
onClick: () => t("patch"),
|
|
688
|
+
children: "Publish updates"
|
|
689
|
+
}
|
|
690
|
+
),
|
|
691
|
+
/* @__PURE__ */ me(
|
|
692
|
+
"button",
|
|
693
|
+
{
|
|
694
|
+
type: "button",
|
|
695
|
+
disabled: n,
|
|
696
|
+
style: r(e === "new_version"),
|
|
697
|
+
onClick: () => t("new_version"),
|
|
698
|
+
children: "New version"
|
|
699
|
+
}
|
|
700
|
+
)
|
|
701
|
+
] });
|
|
702
|
+
}, Ta = [
|
|
703
|
+
{
|
|
704
|
+
inputs: [{ internalType: "bytes32", name: "uid", type: "bytes32" }],
|
|
705
|
+
name: "getSchema",
|
|
706
|
+
outputs: [
|
|
707
|
+
{
|
|
708
|
+
components: [
|
|
709
|
+
{ internalType: "bytes32", name: "uid", type: "bytes32" },
|
|
710
|
+
{ internalType: "contract ISchemaResolver", name: "resolver", type: "address" },
|
|
711
|
+
{ internalType: "bool", name: "revocable", type: "bool" },
|
|
712
|
+
{ internalType: "string", name: "schema", type: "string" }
|
|
713
|
+
],
|
|
714
|
+
internalType: "struct SchemaRecord",
|
|
715
|
+
name: "",
|
|
716
|
+
type: "tuple"
|
|
717
|
+
}
|
|
718
|
+
],
|
|
719
|
+
stateMutability: "view",
|
|
720
|
+
type: "function"
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
inputs: [
|
|
724
|
+
{ internalType: "string", name: "schema", type: "string" },
|
|
725
|
+
{ internalType: "contract ISchemaResolver", name: "resolver", type: "address" },
|
|
726
|
+
{ internalType: "bool", name: "revocable", type: "bool" }
|
|
727
|
+
],
|
|
728
|
+
name: "register",
|
|
729
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
730
|
+
stateMutability: "nonpayable",
|
|
731
|
+
type: "function"
|
|
732
|
+
}
|
|
733
|
+
], Da = "0x" + "0".repeat(64);
|
|
734
|
+
function xa(e, t) {
|
|
735
|
+
return V({
|
|
736
|
+
client: e,
|
|
737
|
+
chain: t,
|
|
738
|
+
address: $t,
|
|
739
|
+
abi: Ta
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
const Ca = "function getSchema(bytes32 uid) view returns ((bytes32 uid, address resolver, bool revocable, string schema))";
|
|
743
|
+
async function Ee(e, t, n) {
|
|
744
|
+
const a = V({
|
|
745
|
+
client: e,
|
|
746
|
+
chain: t,
|
|
747
|
+
address: $t
|
|
748
|
+
// No ABI - use string method so thirdweb parses the exact signature and produces correct selector
|
|
749
|
+
}), s = await _({
|
|
750
|
+
contract: a,
|
|
751
|
+
method: Ca,
|
|
752
|
+
params: [n]
|
|
753
|
+
});
|
|
754
|
+
return !s || s.uid === Da ? null : s;
|
|
755
|
+
}
|
|
756
|
+
function qe(e, t, n) {
|
|
757
|
+
const a = xa(e, t);
|
|
758
|
+
return x({
|
|
759
|
+
contract: a,
|
|
760
|
+
method: "register",
|
|
761
|
+
params: [n.schema, n.resolverAddress, n.revocable]
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
const Ra = "0x0000000000000000000000000000000000000000";
|
|
765
|
+
function je(e, t, n) {
|
|
766
|
+
const s = new zn("bytes32 schemaId,string name").encodeData([
|
|
767
|
+
{ name: "schemaId", value: n.schemaUid, type: "bytes32" },
|
|
768
|
+
{ name: "name", value: n.schemaName, type: "string" }
|
|
769
|
+
]), { easContractAddress: r } = C(), o = V({
|
|
770
|
+
client: e,
|
|
771
|
+
chain: t,
|
|
772
|
+
address: r
|
|
773
|
+
// No ABI - use string method so thirdweb parses the exact signature
|
|
774
|
+
});
|
|
775
|
+
return x({
|
|
776
|
+
contract: o,
|
|
777
|
+
method: "function attest((bytes32 schema,(address recipient,uint64 expirationTime,bool revocable,bytes32 refUID,bytes data,uint256 value) data) request) payable returns (bytes32)",
|
|
778
|
+
params: [
|
|
779
|
+
{
|
|
780
|
+
schema: oa,
|
|
781
|
+
data: {
|
|
782
|
+
recipient: Ra,
|
|
783
|
+
expirationTime: BigInt(Kn),
|
|
784
|
+
revocable: !0,
|
|
785
|
+
refUID: Zn,
|
|
786
|
+
data: s,
|
|
787
|
+
value: 0n
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
]
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
const ie = "0x0000000000000000000000000000000000000000", ce = !0;
|
|
794
|
+
function Ge(e) {
|
|
795
|
+
return e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
796
|
+
}
|
|
797
|
+
async function _a(e) {
|
|
798
|
+
const { itemRelationProperties: t, itemImageProperties: n, itemListProperties: a } = await at(e), s = /* @__PURE__ */ new Set();
|
|
799
|
+
e.modelName && s.add(e.modelName);
|
|
800
|
+
for (const r of t) {
|
|
801
|
+
const o = r.propertyDef?.ref;
|
|
802
|
+
o && s.add(o);
|
|
803
|
+
}
|
|
804
|
+
for (const r of n) {
|
|
805
|
+
const o = r.propertyDef?.dataType;
|
|
806
|
+
o === "File" ? s.add("File") : o === "Html" ? s.add("Html") : s.add("Image");
|
|
807
|
+
}
|
|
808
|
+
for (const r of a) {
|
|
809
|
+
const o = r.propertyDef?.ref;
|
|
810
|
+
o && s.add(o);
|
|
811
|
+
}
|
|
812
|
+
return s;
|
|
813
|
+
}
|
|
814
|
+
async function Oe(e, t, n, a) {
|
|
815
|
+
const { itemBasicProperties: s, itemRelationProperties: r, itemImageProperties: o, itemListProperties: i } = await at(e), c = [
|
|
816
|
+
...s,
|
|
817
|
+
...r,
|
|
818
|
+
...o,
|
|
819
|
+
...i
|
|
820
|
+
], u = /* @__PURE__ */ new Set(), d = await _a(e), p = /* @__PURE__ */ new Set();
|
|
821
|
+
for (const f of d) {
|
|
822
|
+
const A = `bytes32 ${Ge(f)}`, g = $e.getSchemaUID(
|
|
823
|
+
A,
|
|
824
|
+
ie,
|
|
825
|
+
ce
|
|
826
|
+
);
|
|
827
|
+
if (await Ee(n, a, g)) {
|
|
828
|
+
He({ modelName: f, schemaUid: g });
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
831
|
+
if (p.has(g)) {
|
|
832
|
+
He({ modelName: f, schemaUid: g });
|
|
833
|
+
continue;
|
|
834
|
+
}
|
|
835
|
+
try {
|
|
836
|
+
const S = qe(n, a, {
|
|
837
|
+
schema: A,
|
|
838
|
+
resolverAddress: ie,
|
|
839
|
+
revocable: ce
|
|
840
|
+
}), E = await N({
|
|
841
|
+
account: t,
|
|
842
|
+
transaction: S
|
|
843
|
+
});
|
|
844
|
+
await k({
|
|
845
|
+
client: n,
|
|
846
|
+
chain: a,
|
|
847
|
+
transactionHash: E.transactionHash
|
|
848
|
+
});
|
|
849
|
+
} catch (S) {
|
|
850
|
+
throw new Error(
|
|
851
|
+
`Failed to register EAS schema for model ${f}: ${S instanceof Error ? S.message : String(S)}`
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
try {
|
|
855
|
+
const S = je(n, a, {
|
|
856
|
+
schemaUid: g,
|
|
857
|
+
schemaName: Ge(f)
|
|
858
|
+
}), E = await N({
|
|
859
|
+
account: t,
|
|
860
|
+
transaction: S
|
|
861
|
+
});
|
|
862
|
+
await k({
|
|
863
|
+
client: n,
|
|
864
|
+
chain: a,
|
|
865
|
+
transactionHash: E.transactionHash
|
|
866
|
+
});
|
|
867
|
+
} catch (S) {
|
|
868
|
+
throw new Error(
|
|
869
|
+
`Failed to name EAS schema for model ${f}: ${S instanceof Error ? S.message : String(S)}`
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
p.add(g), He({ modelName: f, schemaUid: g });
|
|
873
|
+
}
|
|
874
|
+
const l = "string storage_transaction_id", m = $e.getSchemaUID(
|
|
875
|
+
l,
|
|
876
|
+
ie,
|
|
877
|
+
ce
|
|
878
|
+
);
|
|
879
|
+
if (await Ee(n, a, m))
|
|
880
|
+
oe({ text: l, schemaUid: m });
|
|
881
|
+
else if (!u.has(m) && (d.has("Image") || d.has("File") || d.has("Html"))) {
|
|
882
|
+
try {
|
|
883
|
+
const f = qe(n, a, {
|
|
884
|
+
schema: l,
|
|
885
|
+
resolverAddress: ie,
|
|
886
|
+
revocable: ce
|
|
887
|
+
}), A = await N({ account: t, transaction: f });
|
|
888
|
+
await k({ client: n, chain: a, transactionHash: A.transactionHash });
|
|
889
|
+
const g = je(n, a, {
|
|
890
|
+
schemaUid: m,
|
|
891
|
+
schemaName: "storage_transaction_id"
|
|
892
|
+
}), I = await N({ account: t, transaction: g });
|
|
893
|
+
await k({ client: n, chain: a, transactionHash: I.transactionHash });
|
|
894
|
+
} catch (f) {
|
|
895
|
+
throw new Error(
|
|
896
|
+
`Failed to register EAS schema for storageTransactionId: ${f instanceof Error ? f.message : String(f)}`
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
u.add(m), oe({ text: l, schemaUid: m });
|
|
900
|
+
}
|
|
901
|
+
for (const f of c) {
|
|
902
|
+
if (!f.propertyDef) continue;
|
|
903
|
+
const A = Un[f.propertyDef.dataType]?.eas ?? "string", g = f, I = g.storagePropertyName && g.storagePropertyName.length > 0 ? g.storagePropertyName : f.propertyName, S = Ge(I), E = `${A} ${S}`, D = [
|
|
904
|
+
"string",
|
|
905
|
+
"address",
|
|
906
|
+
"bool",
|
|
907
|
+
"bytes",
|
|
908
|
+
"bytes32",
|
|
909
|
+
"uint8",
|
|
910
|
+
"uint16",
|
|
911
|
+
"uint32",
|
|
912
|
+
"uint64",
|
|
913
|
+
"uint128",
|
|
914
|
+
"uint256"
|
|
915
|
+
].includes(A) ? A : void 0;
|
|
916
|
+
let w = await Tn({
|
|
917
|
+
schemaUid: f.schemaUid,
|
|
918
|
+
propertyName: I,
|
|
919
|
+
easDataType: D
|
|
920
|
+
});
|
|
921
|
+
if (w) {
|
|
922
|
+
const b = await Ee(n, a, w.id);
|
|
923
|
+
if (b && b.schema === E) {
|
|
924
|
+
oe({ text: E, schemaUid: w.id });
|
|
925
|
+
continue;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
const U = $e.getSchemaUID(E, ie, ce);
|
|
929
|
+
if (await Ee(n, a, U)) {
|
|
930
|
+
oe({ text: E, schemaUid: U });
|
|
931
|
+
continue;
|
|
932
|
+
}
|
|
933
|
+
if (u.has(U)) {
|
|
934
|
+
oe({ text: E, schemaUid: U });
|
|
935
|
+
continue;
|
|
936
|
+
}
|
|
937
|
+
try {
|
|
938
|
+
const b = qe(n, a, {
|
|
939
|
+
schema: E,
|
|
940
|
+
resolverAddress: ie,
|
|
941
|
+
revocable: ce
|
|
942
|
+
}), M = await N({
|
|
943
|
+
account: t,
|
|
944
|
+
transaction: b
|
|
945
|
+
});
|
|
946
|
+
await k({
|
|
947
|
+
client: n,
|
|
948
|
+
chain: a,
|
|
949
|
+
transactionHash: M.transactionHash
|
|
950
|
+
});
|
|
951
|
+
} catch (b) {
|
|
952
|
+
throw new Error(
|
|
953
|
+
`Failed to register EAS schema for property ${f.propertyName}: ${b instanceof Error ? b.message : String(b)}`
|
|
954
|
+
);
|
|
955
|
+
}
|
|
956
|
+
try {
|
|
957
|
+
const b = je(n, a, {
|
|
958
|
+
schemaUid: U,
|
|
959
|
+
schemaName: S
|
|
960
|
+
}), M = await N({
|
|
961
|
+
account: t,
|
|
962
|
+
transaction: b
|
|
963
|
+
});
|
|
964
|
+
await k({
|
|
965
|
+
client: n,
|
|
966
|
+
chain: a,
|
|
967
|
+
transactionHash: M.transactionHash
|
|
968
|
+
});
|
|
969
|
+
} catch (b) {
|
|
970
|
+
throw new Error(
|
|
971
|
+
`Failed to name EAS schema for property ${f.propertyName}: ${b instanceof Error ? b.message : String(b)}`
|
|
972
|
+
);
|
|
973
|
+
}
|
|
974
|
+
u.add(U), oe({ text: E, schemaUid: U });
|
|
975
|
+
}
|
|
976
|
+
const y = await Dn(e);
|
|
977
|
+
for (const f of y)
|
|
978
|
+
await Oe(f, t, n, a);
|
|
979
|
+
}
|
|
980
|
+
function Nr(e = {}) {
|
|
981
|
+
return Y({
|
|
982
|
+
signature: "event AdminUpdated(address indexed signer, bool isAdmin)",
|
|
983
|
+
filters: e
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
function kr() {
|
|
987
|
+
return Y({
|
|
988
|
+
signature: "event Initialized(uint8 version)"
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
function Hr(e = {}) {
|
|
992
|
+
return Y({
|
|
993
|
+
signature: "event SignerPermissionsUpdated(address indexed authorizingSigner, address indexed targetSigner, (address signer, uint8 isAdmin, address[] approvedTargets, uint256 nativeTokenLimitPerTransaction, uint128 permissionStartTimestamp, uint128 permissionEndTimestamp, uint128 reqValidityStartTimestamp, uint128 reqValidityEndTimestamp, bytes32 uid) permissions)",
|
|
994
|
+
filters: e
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
function $r() {
|
|
998
|
+
return Y({
|
|
999
|
+
signature: "event ContractURIUpdated(string prevURI, string newURI)"
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
function La() {
|
|
1003
|
+
return Y({
|
|
1004
|
+
signature: "event CreatedAttestation((bytes32 schemaUid, bytes32 attestationUid) result)"
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
function Vr() {
|
|
1008
|
+
return Y({
|
|
1009
|
+
signature: "event EIP712DomainChanged()"
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
function Wr() {
|
|
1013
|
+
return Y({
|
|
1014
|
+
signature: "event Log(string message)"
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
function qr(e = {}) {
|
|
1018
|
+
return Y({
|
|
1019
|
+
signature: "event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)",
|
|
1020
|
+
filters: e
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
function Ma() {
|
|
1024
|
+
return Y({
|
|
1025
|
+
signature: "event SeedPublished(bytes returnedDataFromEAS)"
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
async function jr(e) {
|
|
1029
|
+
return _({
|
|
1030
|
+
contract: e.contract,
|
|
1031
|
+
method: [
|
|
1032
|
+
"0xb0d691fe",
|
|
1033
|
+
[],
|
|
1034
|
+
[
|
|
1035
|
+
{
|
|
1036
|
+
type: "address"
|
|
1037
|
+
}
|
|
1038
|
+
]
|
|
1039
|
+
],
|
|
1040
|
+
params: []
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
async function Gr(e) {
|
|
1044
|
+
return _({
|
|
1045
|
+
contract: e.contract,
|
|
1046
|
+
method: [
|
|
1047
|
+
"0xc45a0155",
|
|
1048
|
+
[],
|
|
1049
|
+
[
|
|
1050
|
+
{
|
|
1051
|
+
type: "address"
|
|
1052
|
+
}
|
|
1053
|
+
]
|
|
1054
|
+
],
|
|
1055
|
+
params: []
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
async function Yr(e) {
|
|
1059
|
+
return _({
|
|
1060
|
+
contract: e.contract,
|
|
1061
|
+
method: [
|
|
1062
|
+
"0x8b52d723",
|
|
1063
|
+
[],
|
|
1064
|
+
[
|
|
1065
|
+
{
|
|
1066
|
+
type: "tuple[]",
|
|
1067
|
+
name: "signers",
|
|
1068
|
+
components: [
|
|
1069
|
+
{
|
|
1070
|
+
type: "address",
|
|
1071
|
+
name: "signer"
|
|
1072
|
+
},
|
|
1073
|
+
{
|
|
1074
|
+
type: "address[]",
|
|
1075
|
+
name: "approvedTargets"
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
type: "uint256",
|
|
1079
|
+
name: "nativeTokenLimitPerTransaction"
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
type: "uint128",
|
|
1083
|
+
name: "startTimestamp"
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
type: "uint128",
|
|
1087
|
+
name: "endTimestamp"
|
|
1088
|
+
}
|
|
1089
|
+
]
|
|
1090
|
+
}
|
|
1091
|
+
]
|
|
1092
|
+
],
|
|
1093
|
+
params: []
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
async function Jr(e) {
|
|
1097
|
+
return _({
|
|
1098
|
+
contract: e.contract,
|
|
1099
|
+
method: [
|
|
1100
|
+
"0xe9523c97",
|
|
1101
|
+
[],
|
|
1102
|
+
[
|
|
1103
|
+
{
|
|
1104
|
+
type: "address[]"
|
|
1105
|
+
}
|
|
1106
|
+
]
|
|
1107
|
+
],
|
|
1108
|
+
params: []
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
async function zr(e) {
|
|
1112
|
+
return _({
|
|
1113
|
+
contract: e.contract,
|
|
1114
|
+
method: [
|
|
1115
|
+
"0x4a00cc48",
|
|
1116
|
+
[],
|
|
1117
|
+
[
|
|
1118
|
+
{
|
|
1119
|
+
type: "tuple[]",
|
|
1120
|
+
components: [
|
|
1121
|
+
{
|
|
1122
|
+
type: "tuple",
|
|
1123
|
+
name: "metadata",
|
|
1124
|
+
components: [
|
|
1125
|
+
{
|
|
1126
|
+
type: "string",
|
|
1127
|
+
name: "name"
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
type: "string",
|
|
1131
|
+
name: "metadataURI"
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
type: "address",
|
|
1135
|
+
name: "implementation"
|
|
1136
|
+
}
|
|
1137
|
+
]
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
type: "tuple[]",
|
|
1141
|
+
name: "functions",
|
|
1142
|
+
components: [
|
|
1143
|
+
{
|
|
1144
|
+
type: "bytes4",
|
|
1145
|
+
name: "functionSelector"
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
type: "string",
|
|
1149
|
+
name: "functionSignature"
|
|
1150
|
+
}
|
|
1151
|
+
]
|
|
1152
|
+
}
|
|
1153
|
+
]
|
|
1154
|
+
}
|
|
1155
|
+
]
|
|
1156
|
+
],
|
|
1157
|
+
params: []
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
async function Zr(e) {
|
|
1161
|
+
return _({
|
|
1162
|
+
contract: e.contract,
|
|
1163
|
+
method: [
|
|
1164
|
+
"0xd42f2f35",
|
|
1165
|
+
[],
|
|
1166
|
+
[
|
|
1167
|
+
{
|
|
1168
|
+
type: "tuple[]",
|
|
1169
|
+
name: "signers",
|
|
1170
|
+
components: [
|
|
1171
|
+
{
|
|
1172
|
+
type: "address",
|
|
1173
|
+
name: "signer"
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
type: "address[]",
|
|
1177
|
+
name: "approvedTargets"
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
type: "uint256",
|
|
1181
|
+
name: "nativeTokenLimitPerTransaction"
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
type: "uint128",
|
|
1185
|
+
name: "startTimestamp"
|
|
1186
|
+
},
|
|
1187
|
+
{
|
|
1188
|
+
type: "uint128",
|
|
1189
|
+
name: "endTimestamp"
|
|
1190
|
+
}
|
|
1191
|
+
]
|
|
1192
|
+
}
|
|
1193
|
+
]
|
|
1194
|
+
],
|
|
1195
|
+
params: []
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
async function Kr(e) {
|
|
1199
|
+
return _({
|
|
1200
|
+
contract: e.contract,
|
|
1201
|
+
method: [
|
|
1202
|
+
"0xce0b6013",
|
|
1203
|
+
[
|
|
1204
|
+
{
|
|
1205
|
+
type: "bytes4",
|
|
1206
|
+
name: "_functionSelector"
|
|
1207
|
+
}
|
|
1208
|
+
],
|
|
1209
|
+
[
|
|
1210
|
+
{
|
|
1211
|
+
type: "address"
|
|
1212
|
+
}
|
|
1213
|
+
]
|
|
1214
|
+
],
|
|
1215
|
+
params: [e.functionSelector]
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
async function Qr(e) {
|
|
1219
|
+
return _({
|
|
1220
|
+
contract: e.contract,
|
|
1221
|
+
method: [
|
|
1222
|
+
"0xd087d288",
|
|
1223
|
+
[],
|
|
1224
|
+
[
|
|
1225
|
+
{
|
|
1226
|
+
type: "uint256"
|
|
1227
|
+
}
|
|
1228
|
+
]
|
|
1229
|
+
],
|
|
1230
|
+
params: []
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
async function Xr(e) {
|
|
1234
|
+
return _({
|
|
1235
|
+
contract: e.contract,
|
|
1236
|
+
method: [
|
|
1237
|
+
"0xf15d424e",
|
|
1238
|
+
[
|
|
1239
|
+
{
|
|
1240
|
+
type: "address",
|
|
1241
|
+
name: "signer"
|
|
1242
|
+
}
|
|
1243
|
+
],
|
|
1244
|
+
[
|
|
1245
|
+
{
|
|
1246
|
+
type: "tuple",
|
|
1247
|
+
components: [
|
|
1248
|
+
{
|
|
1249
|
+
type: "address",
|
|
1250
|
+
name: "signer"
|
|
1251
|
+
},
|
|
1252
|
+
{
|
|
1253
|
+
type: "address[]",
|
|
1254
|
+
name: "approvedTargets"
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
type: "uint256",
|
|
1258
|
+
name: "nativeTokenLimitPerTransaction"
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
type: "uint128",
|
|
1262
|
+
name: "startTimestamp"
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
type: "uint128",
|
|
1266
|
+
name: "endTimestamp"
|
|
1267
|
+
}
|
|
1268
|
+
]
|
|
1269
|
+
}
|
|
1270
|
+
]
|
|
1271
|
+
],
|
|
1272
|
+
params: [e.signer]
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
async function eo(e) {
|
|
1276
|
+
return _({
|
|
1277
|
+
contract: e.contract,
|
|
1278
|
+
method: [
|
|
1279
|
+
"0x7dff5a79",
|
|
1280
|
+
[
|
|
1281
|
+
{
|
|
1282
|
+
type: "address",
|
|
1283
|
+
name: "signer"
|
|
1284
|
+
}
|
|
1285
|
+
],
|
|
1286
|
+
[
|
|
1287
|
+
{
|
|
1288
|
+
type: "bool"
|
|
1289
|
+
}
|
|
1290
|
+
]
|
|
1291
|
+
],
|
|
1292
|
+
params: [e.signer]
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
async function to(e) {
|
|
1296
|
+
return _({
|
|
1297
|
+
contract: e.contract,
|
|
1298
|
+
method: [
|
|
1299
|
+
"0x24d7806c",
|
|
1300
|
+
[
|
|
1301
|
+
{
|
|
1302
|
+
type: "address",
|
|
1303
|
+
name: "_account"
|
|
1304
|
+
}
|
|
1305
|
+
],
|
|
1306
|
+
[
|
|
1307
|
+
{
|
|
1308
|
+
type: "bool"
|
|
1309
|
+
}
|
|
1310
|
+
]
|
|
1311
|
+
],
|
|
1312
|
+
params: [e.account]
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
async function no(e) {
|
|
1316
|
+
return _({
|
|
1317
|
+
contract: e.contract,
|
|
1318
|
+
method: [
|
|
1319
|
+
"0x1dd756c5",
|
|
1320
|
+
[
|
|
1321
|
+
{
|
|
1322
|
+
type: "address",
|
|
1323
|
+
name: "_signer"
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
type: "tuple",
|
|
1327
|
+
name: "_userOp",
|
|
1328
|
+
components: [
|
|
1329
|
+
{
|
|
1330
|
+
type: "address",
|
|
1331
|
+
name: "sender"
|
|
1332
|
+
},
|
|
1333
|
+
{
|
|
1334
|
+
type: "uint256",
|
|
1335
|
+
name: "nonce"
|
|
1336
|
+
},
|
|
1337
|
+
{
|
|
1338
|
+
type: "bytes",
|
|
1339
|
+
name: "initCode"
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
type: "bytes",
|
|
1343
|
+
name: "callData"
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
type: "uint256",
|
|
1347
|
+
name: "callGasLimit"
|
|
1348
|
+
},
|
|
1349
|
+
{
|
|
1350
|
+
type: "uint256",
|
|
1351
|
+
name: "verificationGasLimit"
|
|
1352
|
+
},
|
|
1353
|
+
{
|
|
1354
|
+
type: "uint256",
|
|
1355
|
+
name: "preVerificationGas"
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
type: "uint256",
|
|
1359
|
+
name: "maxFeePerGas"
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
type: "uint256",
|
|
1363
|
+
name: "maxPriorityFeePerGas"
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
type: "bytes",
|
|
1367
|
+
name: "paymasterAndData"
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
type: "bytes",
|
|
1371
|
+
name: "signature"
|
|
1372
|
+
}
|
|
1373
|
+
]
|
|
1374
|
+
}
|
|
1375
|
+
],
|
|
1376
|
+
[
|
|
1377
|
+
{
|
|
1378
|
+
type: "bool"
|
|
1379
|
+
}
|
|
1380
|
+
]
|
|
1381
|
+
],
|
|
1382
|
+
params: [e.signer, e.userOp]
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
async function ao(e) {
|
|
1386
|
+
return _({
|
|
1387
|
+
contract: e.contract,
|
|
1388
|
+
method: [
|
|
1389
|
+
"0xa9082d84",
|
|
1390
|
+
[
|
|
1391
|
+
{
|
|
1392
|
+
type: "tuple",
|
|
1393
|
+
name: "req",
|
|
1394
|
+
components: [
|
|
1395
|
+
{
|
|
1396
|
+
type: "address",
|
|
1397
|
+
name: "signer"
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
type: "uint8",
|
|
1401
|
+
name: "isAdmin"
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
type: "address[]",
|
|
1405
|
+
name: "approvedTargets"
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
type: "uint256",
|
|
1409
|
+
name: "nativeTokenLimitPerTransaction"
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
type: "uint128",
|
|
1413
|
+
name: "permissionStartTimestamp"
|
|
1414
|
+
},
|
|
1415
|
+
{
|
|
1416
|
+
type: "uint128",
|
|
1417
|
+
name: "permissionEndTimestamp"
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
type: "uint128",
|
|
1421
|
+
name: "reqValidityStartTimestamp"
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
type: "uint128",
|
|
1425
|
+
name: "reqValidityEndTimestamp"
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
type: "bytes32",
|
|
1429
|
+
name: "uid"
|
|
1430
|
+
}
|
|
1431
|
+
]
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
type: "bytes",
|
|
1435
|
+
name: "signature"
|
|
1436
|
+
}
|
|
1437
|
+
],
|
|
1438
|
+
[
|
|
1439
|
+
{
|
|
1440
|
+
type: "bool",
|
|
1441
|
+
name: "success"
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
type: "address",
|
|
1445
|
+
name: "signer"
|
|
1446
|
+
}
|
|
1447
|
+
]
|
|
1448
|
+
],
|
|
1449
|
+
params: [e.req, e.signature]
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
async function so(e) {
|
|
1453
|
+
return _({
|
|
1454
|
+
contract: e.contract,
|
|
1455
|
+
method: [
|
|
1456
|
+
"0xe8a3d485",
|
|
1457
|
+
[],
|
|
1458
|
+
[
|
|
1459
|
+
{
|
|
1460
|
+
type: "string"
|
|
1461
|
+
}
|
|
1462
|
+
]
|
|
1463
|
+
],
|
|
1464
|
+
params: []
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
async function ro(e) {
|
|
1468
|
+
return _({
|
|
1469
|
+
contract: e.contract,
|
|
1470
|
+
method: [
|
|
1471
|
+
"0x399b77da",
|
|
1472
|
+
[
|
|
1473
|
+
{
|
|
1474
|
+
type: "bytes32",
|
|
1475
|
+
name: "_hash"
|
|
1476
|
+
}
|
|
1477
|
+
],
|
|
1478
|
+
[
|
|
1479
|
+
{
|
|
1480
|
+
type: "bytes32"
|
|
1481
|
+
}
|
|
1482
|
+
]
|
|
1483
|
+
],
|
|
1484
|
+
params: [e.hash]
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
async function oo(e) {
|
|
1488
|
+
return _({
|
|
1489
|
+
contract: e.contract,
|
|
1490
|
+
method: [
|
|
1491
|
+
"0x1626ba7e",
|
|
1492
|
+
[
|
|
1493
|
+
{
|
|
1494
|
+
type: "bytes32",
|
|
1495
|
+
name: "_hash"
|
|
1496
|
+
},
|
|
1497
|
+
{
|
|
1498
|
+
type: "bytes",
|
|
1499
|
+
name: "_signature"
|
|
1500
|
+
}
|
|
1501
|
+
],
|
|
1502
|
+
[
|
|
1503
|
+
{
|
|
1504
|
+
type: "bytes4",
|
|
1505
|
+
name: "magicValue"
|
|
1506
|
+
}
|
|
1507
|
+
]
|
|
1508
|
+
],
|
|
1509
|
+
params: [e.hash, e.signature]
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
async function io(e) {
|
|
1513
|
+
return _({
|
|
1514
|
+
contract: e.contract,
|
|
1515
|
+
method: [
|
|
1516
|
+
"0x01ffc9a7",
|
|
1517
|
+
[
|
|
1518
|
+
{
|
|
1519
|
+
type: "bytes4",
|
|
1520
|
+
name: "interfaceId"
|
|
1521
|
+
}
|
|
1522
|
+
],
|
|
1523
|
+
[
|
|
1524
|
+
{
|
|
1525
|
+
type: "bool"
|
|
1526
|
+
}
|
|
1527
|
+
]
|
|
1528
|
+
],
|
|
1529
|
+
params: [e.interfaceId]
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
async function co(e) {
|
|
1533
|
+
return _({
|
|
1534
|
+
contract: e.contract,
|
|
1535
|
+
method: [
|
|
1536
|
+
"0x84b0196e",
|
|
1537
|
+
[],
|
|
1538
|
+
[
|
|
1539
|
+
{
|
|
1540
|
+
type: "bytes1",
|
|
1541
|
+
name: "fields"
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
type: "string",
|
|
1545
|
+
name: "name"
|
|
1546
|
+
},
|
|
1547
|
+
{
|
|
1548
|
+
type: "string",
|
|
1549
|
+
name: "version"
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
type: "uint256",
|
|
1553
|
+
name: "chainId"
|
|
1554
|
+
},
|
|
1555
|
+
{
|
|
1556
|
+
type: "address",
|
|
1557
|
+
name: "verifyingContract"
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
type: "bytes32",
|
|
1561
|
+
name: "salt"
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
type: "uint256[]",
|
|
1565
|
+
name: "extensions"
|
|
1566
|
+
}
|
|
1567
|
+
]
|
|
1568
|
+
],
|
|
1569
|
+
params: []
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
async function lo(e) {
|
|
1573
|
+
return _({
|
|
1574
|
+
contract: e.contract,
|
|
1575
|
+
method: [
|
|
1576
|
+
"0xd5f5127d",
|
|
1577
|
+
[],
|
|
1578
|
+
[
|
|
1579
|
+
{
|
|
1580
|
+
type: "address"
|
|
1581
|
+
}
|
|
1582
|
+
]
|
|
1583
|
+
],
|
|
1584
|
+
params: []
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
async function uo(e) {
|
|
1588
|
+
return _({
|
|
1589
|
+
contract: e.contract,
|
|
1590
|
+
method: [
|
|
1591
|
+
"0x8da5cb5b",
|
|
1592
|
+
[],
|
|
1593
|
+
[
|
|
1594
|
+
{
|
|
1595
|
+
type: "address"
|
|
1596
|
+
}
|
|
1597
|
+
]
|
|
1598
|
+
],
|
|
1599
|
+
params: []
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1602
|
+
function po(e) {
|
|
1603
|
+
return x({
|
|
1604
|
+
contract: e.contract,
|
|
1605
|
+
method: [
|
|
1606
|
+
"0xd1f57894",
|
|
1607
|
+
[
|
|
1608
|
+
{
|
|
1609
|
+
type: "address",
|
|
1610
|
+
name: "_defaultAdmin"
|
|
1611
|
+
},
|
|
1612
|
+
{
|
|
1613
|
+
type: "bytes",
|
|
1614
|
+
name: "_data"
|
|
1615
|
+
}
|
|
1616
|
+
],
|
|
1617
|
+
[]
|
|
1618
|
+
],
|
|
1619
|
+
params: [e.defaultAdmin, e.data]
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
function mo(e) {
|
|
1623
|
+
return x({
|
|
1624
|
+
contract: e.contract,
|
|
1625
|
+
method: [
|
|
1626
|
+
"0xac9650d8",
|
|
1627
|
+
[
|
|
1628
|
+
{
|
|
1629
|
+
type: "bytes[]",
|
|
1630
|
+
name: "data"
|
|
1631
|
+
}
|
|
1632
|
+
],
|
|
1633
|
+
[
|
|
1634
|
+
{
|
|
1635
|
+
type: "bytes[]",
|
|
1636
|
+
name: "results"
|
|
1637
|
+
}
|
|
1638
|
+
]
|
|
1639
|
+
],
|
|
1640
|
+
params: [e.data]
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
function fo(e) {
|
|
1644
|
+
return x({
|
|
1645
|
+
contract: e.contract,
|
|
1646
|
+
method: [
|
|
1647
|
+
"0xb76464d5",
|
|
1648
|
+
[
|
|
1649
|
+
{
|
|
1650
|
+
type: "address",
|
|
1651
|
+
name: "_entrypointOverride"
|
|
1652
|
+
}
|
|
1653
|
+
],
|
|
1654
|
+
[]
|
|
1655
|
+
],
|
|
1656
|
+
params: [e.entrypointOverride]
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
function ho(e) {
|
|
1660
|
+
return x({
|
|
1661
|
+
contract: e.contract,
|
|
1662
|
+
method: [
|
|
1663
|
+
"0x5892e236",
|
|
1664
|
+
[
|
|
1665
|
+
{
|
|
1666
|
+
type: "tuple",
|
|
1667
|
+
name: "_req",
|
|
1668
|
+
components: [
|
|
1669
|
+
{
|
|
1670
|
+
type: "address",
|
|
1671
|
+
name: "signer"
|
|
1672
|
+
},
|
|
1673
|
+
{
|
|
1674
|
+
type: "uint8",
|
|
1675
|
+
name: "isAdmin"
|
|
1676
|
+
},
|
|
1677
|
+
{
|
|
1678
|
+
type: "address[]",
|
|
1679
|
+
name: "approvedTargets"
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
type: "uint256",
|
|
1683
|
+
name: "nativeTokenLimitPerTransaction"
|
|
1684
|
+
},
|
|
1685
|
+
{
|
|
1686
|
+
type: "uint128",
|
|
1687
|
+
name: "permissionStartTimestamp"
|
|
1688
|
+
},
|
|
1689
|
+
{
|
|
1690
|
+
type: "uint128",
|
|
1691
|
+
name: "permissionEndTimestamp"
|
|
1692
|
+
},
|
|
1693
|
+
{
|
|
1694
|
+
type: "uint128",
|
|
1695
|
+
name: "reqValidityStartTimestamp"
|
|
1696
|
+
},
|
|
1697
|
+
{
|
|
1698
|
+
type: "uint128",
|
|
1699
|
+
name: "reqValidityEndTimestamp"
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
type: "bytes32",
|
|
1703
|
+
name: "uid"
|
|
1704
|
+
}
|
|
1705
|
+
]
|
|
1706
|
+
},
|
|
1707
|
+
{
|
|
1708
|
+
type: "bytes",
|
|
1709
|
+
name: "_signature"
|
|
1710
|
+
}
|
|
1711
|
+
],
|
|
1712
|
+
[]
|
|
1713
|
+
],
|
|
1714
|
+
params: [e.req, e.signature]
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
function yo(e) {
|
|
1718
|
+
return x({
|
|
1719
|
+
contract: e.contract,
|
|
1720
|
+
method: [
|
|
1721
|
+
"0x3a871cdd",
|
|
1722
|
+
[
|
|
1723
|
+
{
|
|
1724
|
+
type: "tuple",
|
|
1725
|
+
name: "userOp",
|
|
1726
|
+
components: [
|
|
1727
|
+
{
|
|
1728
|
+
type: "address",
|
|
1729
|
+
name: "sender"
|
|
1730
|
+
},
|
|
1731
|
+
{
|
|
1732
|
+
type: "uint256",
|
|
1733
|
+
name: "nonce"
|
|
1734
|
+
},
|
|
1735
|
+
{
|
|
1736
|
+
type: "bytes",
|
|
1737
|
+
name: "initCode"
|
|
1738
|
+
},
|
|
1739
|
+
{
|
|
1740
|
+
type: "bytes",
|
|
1741
|
+
name: "callData"
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
type: "uint256",
|
|
1745
|
+
name: "callGasLimit"
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
type: "uint256",
|
|
1749
|
+
name: "verificationGasLimit"
|
|
1750
|
+
},
|
|
1751
|
+
{
|
|
1752
|
+
type: "uint256",
|
|
1753
|
+
name: "preVerificationGas"
|
|
1754
|
+
},
|
|
1755
|
+
{
|
|
1756
|
+
type: "uint256",
|
|
1757
|
+
name: "maxFeePerGas"
|
|
1758
|
+
},
|
|
1759
|
+
{
|
|
1760
|
+
type: "uint256",
|
|
1761
|
+
name: "maxPriorityFeePerGas"
|
|
1762
|
+
},
|
|
1763
|
+
{
|
|
1764
|
+
type: "bytes",
|
|
1765
|
+
name: "paymasterAndData"
|
|
1766
|
+
},
|
|
1767
|
+
{
|
|
1768
|
+
type: "bytes",
|
|
1769
|
+
name: "signature"
|
|
1770
|
+
}
|
|
1771
|
+
]
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
type: "bytes32",
|
|
1775
|
+
name: "userOpHash"
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
type: "uint256",
|
|
1779
|
+
name: "missingAccountFunds"
|
|
1780
|
+
}
|
|
1781
|
+
],
|
|
1782
|
+
[
|
|
1783
|
+
{
|
|
1784
|
+
type: "uint256",
|
|
1785
|
+
name: "validationData"
|
|
1786
|
+
}
|
|
1787
|
+
]
|
|
1788
|
+
],
|
|
1789
|
+
params: [e.userOp, e.userOpHash, e.missingAccountFunds]
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
function go(e) {
|
|
1793
|
+
return x({
|
|
1794
|
+
contract: e.contract,
|
|
1795
|
+
method: [
|
|
1796
|
+
"0x4a58db19",
|
|
1797
|
+
[],
|
|
1798
|
+
[]
|
|
1799
|
+
],
|
|
1800
|
+
params: []
|
|
1801
|
+
});
|
|
1802
|
+
}
|
|
1803
|
+
function wo(e) {
|
|
1804
|
+
return x({
|
|
1805
|
+
contract: e.contract,
|
|
1806
|
+
method: [
|
|
1807
|
+
"0xb61d27f6",
|
|
1808
|
+
[
|
|
1809
|
+
{
|
|
1810
|
+
type: "address",
|
|
1811
|
+
name: "_target"
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
type: "uint256",
|
|
1815
|
+
name: "_value"
|
|
1816
|
+
},
|
|
1817
|
+
{
|
|
1818
|
+
type: "bytes",
|
|
1819
|
+
name: "_calldata"
|
|
1820
|
+
}
|
|
1821
|
+
],
|
|
1822
|
+
[]
|
|
1823
|
+
],
|
|
1824
|
+
params: [e.target, e.value, e.calldata]
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1827
|
+
function bo(e) {
|
|
1828
|
+
return x({
|
|
1829
|
+
contract: e.contract,
|
|
1830
|
+
method: [
|
|
1831
|
+
"0x47e1da2a",
|
|
1832
|
+
[
|
|
1833
|
+
{
|
|
1834
|
+
type: "address[]",
|
|
1835
|
+
name: "_target"
|
|
1836
|
+
},
|
|
1837
|
+
{
|
|
1838
|
+
type: "uint256[]",
|
|
1839
|
+
name: "_value"
|
|
1840
|
+
},
|
|
1841
|
+
{
|
|
1842
|
+
type: "bytes[]",
|
|
1843
|
+
name: "_calldata"
|
|
1844
|
+
}
|
|
1845
|
+
],
|
|
1846
|
+
[]
|
|
1847
|
+
],
|
|
1848
|
+
params: [e.target, e.value, e.calldata]
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
function Ao(e) {
|
|
1852
|
+
return x({
|
|
1853
|
+
contract: e.contract,
|
|
1854
|
+
method: [
|
|
1855
|
+
"0xbc197c81",
|
|
1856
|
+
[
|
|
1857
|
+
{
|
|
1858
|
+
type: "address"
|
|
1859
|
+
},
|
|
1860
|
+
{
|
|
1861
|
+
type: "address"
|
|
1862
|
+
},
|
|
1863
|
+
{
|
|
1864
|
+
type: "uint256[]"
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
type: "uint256[]"
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
type: "bytes"
|
|
1871
|
+
}
|
|
1872
|
+
],
|
|
1873
|
+
[
|
|
1874
|
+
{
|
|
1875
|
+
type: "bytes4"
|
|
1876
|
+
}
|
|
1877
|
+
]
|
|
1878
|
+
],
|
|
1879
|
+
params: [e.arg_0, e.arg_1, e.arg_2, e.arg_3, e.arg_4]
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1882
|
+
function vo(e) {
|
|
1883
|
+
return x({
|
|
1884
|
+
contract: e.contract,
|
|
1885
|
+
method: [
|
|
1886
|
+
"0xf23a6e61",
|
|
1887
|
+
[
|
|
1888
|
+
{
|
|
1889
|
+
type: "address"
|
|
1890
|
+
},
|
|
1891
|
+
{
|
|
1892
|
+
type: "address"
|
|
1893
|
+
},
|
|
1894
|
+
{
|
|
1895
|
+
type: "uint256"
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
type: "uint256"
|
|
1899
|
+
},
|
|
1900
|
+
{
|
|
1901
|
+
type: "bytes"
|
|
1902
|
+
}
|
|
1903
|
+
],
|
|
1904
|
+
[
|
|
1905
|
+
{
|
|
1906
|
+
type: "bytes4"
|
|
1907
|
+
}
|
|
1908
|
+
]
|
|
1909
|
+
],
|
|
1910
|
+
params: [e.arg_0, e.arg_1, e.arg_2, e.arg_3, e.arg_4]
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
function So(e) {
|
|
1914
|
+
return x({
|
|
1915
|
+
contract: e.contract,
|
|
1916
|
+
method: [
|
|
1917
|
+
"0x150b7a02",
|
|
1918
|
+
[
|
|
1919
|
+
{
|
|
1920
|
+
type: "address"
|
|
1921
|
+
},
|
|
1922
|
+
{
|
|
1923
|
+
type: "address"
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
type: "uint256"
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
type: "bytes"
|
|
1930
|
+
}
|
|
1931
|
+
],
|
|
1932
|
+
[
|
|
1933
|
+
{
|
|
1934
|
+
type: "bytes4"
|
|
1935
|
+
}
|
|
1936
|
+
]
|
|
1937
|
+
],
|
|
1938
|
+
params: [e.arg_0, e.arg_1, e.arg_2, e.arg_3]
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
function Eo(e) {
|
|
1942
|
+
return x({
|
|
1943
|
+
contract: e.contract,
|
|
1944
|
+
method: [
|
|
1945
|
+
"0x938e3d7b",
|
|
1946
|
+
[
|
|
1947
|
+
{
|
|
1948
|
+
type: "string",
|
|
1949
|
+
name: "_uri"
|
|
1950
|
+
}
|
|
1951
|
+
],
|
|
1952
|
+
[]
|
|
1953
|
+
],
|
|
1954
|
+
params: [e.uri]
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
function Io(e) {
|
|
1958
|
+
return x({
|
|
1959
|
+
contract: e.contract,
|
|
1960
|
+
method: [
|
|
1961
|
+
"0x4d44560d",
|
|
1962
|
+
[
|
|
1963
|
+
{
|
|
1964
|
+
type: "address",
|
|
1965
|
+
name: "withdrawAddress"
|
|
1966
|
+
},
|
|
1967
|
+
{
|
|
1968
|
+
type: "uint256",
|
|
1969
|
+
name: "amount"
|
|
1970
|
+
}
|
|
1971
|
+
],
|
|
1972
|
+
[]
|
|
1973
|
+
],
|
|
1974
|
+
params: [e.withdrawAddress, e.amount]
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1977
|
+
function Po(e) {
|
|
1978
|
+
return x({
|
|
1979
|
+
contract: e.contract,
|
|
1980
|
+
method: [
|
|
1981
|
+
"0x6240d6d9",
|
|
1982
|
+
[
|
|
1983
|
+
{
|
|
1984
|
+
type: "bytes32",
|
|
1985
|
+
name: "schemaUid"
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
type: "bool",
|
|
1989
|
+
name: "revocable"
|
|
1990
|
+
}
|
|
1991
|
+
],
|
|
1992
|
+
[
|
|
1993
|
+
{
|
|
1994
|
+
type: "bytes32"
|
|
1995
|
+
}
|
|
1996
|
+
]
|
|
1997
|
+
],
|
|
1998
|
+
params: [e.schemaUid, e.revocable]
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
2001
|
+
function Uo(e) {
|
|
2002
|
+
return x({
|
|
2003
|
+
contract: e.contract,
|
|
2004
|
+
method: [
|
|
2005
|
+
"0x13e0c263",
|
|
2006
|
+
[
|
|
2007
|
+
{
|
|
2008
|
+
type: "bytes32",
|
|
2009
|
+
name: "seedUid"
|
|
2010
|
+
},
|
|
2011
|
+
{
|
|
2012
|
+
type: "bytes32",
|
|
2013
|
+
name: "versionSchemaUid"
|
|
2014
|
+
}
|
|
2015
|
+
],
|
|
2016
|
+
[
|
|
2017
|
+
{
|
|
2018
|
+
type: "bytes32"
|
|
2019
|
+
}
|
|
2020
|
+
]
|
|
2021
|
+
],
|
|
2022
|
+
params: [e.seedUid, e.versionSchemaUid]
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
function bt(e) {
|
|
2026
|
+
return x({
|
|
2027
|
+
contract: e.contract,
|
|
2028
|
+
method: [
|
|
2029
|
+
"0x31e19cb8",
|
|
2030
|
+
[
|
|
2031
|
+
{
|
|
2032
|
+
type: "tuple[]",
|
|
2033
|
+
name: "requests",
|
|
2034
|
+
components: [
|
|
2035
|
+
{
|
|
2036
|
+
type: "string",
|
|
2037
|
+
name: "localId"
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
type: "bytes32",
|
|
2041
|
+
name: "seedUid"
|
|
2042
|
+
},
|
|
2043
|
+
{
|
|
2044
|
+
type: "bytes32",
|
|
2045
|
+
name: "seedSchemaUid"
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
type: "bytes32",
|
|
2049
|
+
name: "versionUid"
|
|
2050
|
+
},
|
|
2051
|
+
{
|
|
2052
|
+
type: "bytes32",
|
|
2053
|
+
name: "versionSchemaUid"
|
|
2054
|
+
},
|
|
2055
|
+
{
|
|
2056
|
+
type: "bool",
|
|
2057
|
+
name: "seedIsRevocable"
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
type: "tuple[]",
|
|
2061
|
+
name: "listOfAttestations",
|
|
2062
|
+
components: [
|
|
2063
|
+
{
|
|
2064
|
+
type: "bytes32",
|
|
2065
|
+
name: "schema"
|
|
2066
|
+
},
|
|
2067
|
+
{
|
|
2068
|
+
type: "tuple[]",
|
|
2069
|
+
name: "data",
|
|
2070
|
+
components: [
|
|
2071
|
+
{
|
|
2072
|
+
type: "address",
|
|
2073
|
+
name: "recipient"
|
|
2074
|
+
},
|
|
2075
|
+
{
|
|
2076
|
+
type: "uint64",
|
|
2077
|
+
name: "expirationTime"
|
|
2078
|
+
},
|
|
2079
|
+
{
|
|
2080
|
+
type: "bool",
|
|
2081
|
+
name: "revocable"
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
type: "bytes32",
|
|
2085
|
+
name: "refUID"
|
|
2086
|
+
},
|
|
2087
|
+
{
|
|
2088
|
+
type: "bytes",
|
|
2089
|
+
name: "data"
|
|
2090
|
+
},
|
|
2091
|
+
{
|
|
2092
|
+
type: "uint256",
|
|
2093
|
+
name: "value"
|
|
2094
|
+
}
|
|
2095
|
+
]
|
|
2096
|
+
}
|
|
2097
|
+
]
|
|
2098
|
+
},
|
|
2099
|
+
{
|
|
2100
|
+
type: "tuple[]",
|
|
2101
|
+
name: "propertiesToUpdate",
|
|
2102
|
+
components: [
|
|
2103
|
+
{
|
|
2104
|
+
type: "string",
|
|
2105
|
+
name: "publishLocalId"
|
|
2106
|
+
},
|
|
2107
|
+
{
|
|
2108
|
+
type: "bytes32",
|
|
2109
|
+
name: "propertySchemaUid"
|
|
2110
|
+
}
|
|
2111
|
+
]
|
|
2112
|
+
}
|
|
2113
|
+
]
|
|
2114
|
+
}
|
|
2115
|
+
],
|
|
2116
|
+
[
|
|
2117
|
+
{
|
|
2118
|
+
type: "bytes32[]"
|
|
2119
|
+
}
|
|
2120
|
+
]
|
|
2121
|
+
],
|
|
2122
|
+
params: [e.requests]
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
function To(e) {
|
|
2126
|
+
return x({
|
|
2127
|
+
contract: e.contract,
|
|
2128
|
+
method: [
|
|
2129
|
+
"0xd688e801",
|
|
2130
|
+
[
|
|
2131
|
+
{
|
|
2132
|
+
type: "tuple[]",
|
|
2133
|
+
name: "requests",
|
|
2134
|
+
components: [
|
|
2135
|
+
{ type: "uint256", name: "localIdIndex" },
|
|
2136
|
+
{ type: "bytes32", name: "seedUid" },
|
|
2137
|
+
{ type: "bytes32", name: "seedSchemaUid" },
|
|
2138
|
+
{ type: "bytes32", name: "versionUid" },
|
|
2139
|
+
{ type: "bytes32", name: "versionSchemaUid" },
|
|
2140
|
+
{ type: "bool", name: "seedIsRevocable" },
|
|
2141
|
+
{
|
|
2142
|
+
type: "tuple[]",
|
|
2143
|
+
name: "listOfAttestations",
|
|
2144
|
+
components: [
|
|
2145
|
+
{ type: "bytes32", name: "schema" },
|
|
2146
|
+
{
|
|
2147
|
+
type: "tuple[]",
|
|
2148
|
+
name: "data",
|
|
2149
|
+
components: [
|
|
2150
|
+
{ type: "address", name: "recipient" },
|
|
2151
|
+
{ type: "uint64", name: "expirationTime" },
|
|
2152
|
+
{ type: "bool", name: "revocable" },
|
|
2153
|
+
{ type: "bytes32", name: "refUID" },
|
|
2154
|
+
{ type: "bytes", name: "data" },
|
|
2155
|
+
{ type: "uint256", name: "value" }
|
|
2156
|
+
]
|
|
2157
|
+
}
|
|
2158
|
+
]
|
|
2159
|
+
},
|
|
2160
|
+
{
|
|
2161
|
+
type: "tuple[]",
|
|
2162
|
+
name: "propertiesToUpdate",
|
|
2163
|
+
components: [
|
|
2164
|
+
{ type: "uint256", name: "publishLocalIdIndex" },
|
|
2165
|
+
{ type: "bytes32", name: "propertySchemaUid" }
|
|
2166
|
+
]
|
|
2167
|
+
}
|
|
2168
|
+
]
|
|
2169
|
+
}
|
|
2170
|
+
],
|
|
2171
|
+
[{ type: "bytes32[]" }]
|
|
2172
|
+
],
|
|
2173
|
+
params: [e.requests]
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
function Do(e) {
|
|
2177
|
+
return x({
|
|
2178
|
+
contract: e.contract,
|
|
2179
|
+
method: [
|
|
2180
|
+
"0xb71308c5",
|
|
2181
|
+
[
|
|
2182
|
+
{
|
|
2183
|
+
type: "tuple",
|
|
2184
|
+
name: "request",
|
|
2185
|
+
components: [
|
|
2186
|
+
{
|
|
2187
|
+
type: "string",
|
|
2188
|
+
name: "localId"
|
|
2189
|
+
},
|
|
2190
|
+
{
|
|
2191
|
+
type: "bytes32",
|
|
2192
|
+
name: "seedUid"
|
|
2193
|
+
},
|
|
2194
|
+
{
|
|
2195
|
+
type: "bytes32",
|
|
2196
|
+
name: "seedSchemaUid"
|
|
2197
|
+
},
|
|
2198
|
+
{
|
|
2199
|
+
type: "bytes32",
|
|
2200
|
+
name: "versionUid"
|
|
2201
|
+
},
|
|
2202
|
+
{
|
|
2203
|
+
type: "bytes32",
|
|
2204
|
+
name: "versionSchemaUid"
|
|
2205
|
+
},
|
|
2206
|
+
{
|
|
2207
|
+
type: "bool",
|
|
2208
|
+
name: "seedIsRevocable"
|
|
2209
|
+
},
|
|
2210
|
+
{
|
|
2211
|
+
type: "tuple[]",
|
|
2212
|
+
name: "listOfAttestations",
|
|
2213
|
+
components: [
|
|
2214
|
+
{
|
|
2215
|
+
type: "bytes32",
|
|
2216
|
+
name: "schema"
|
|
2217
|
+
},
|
|
2218
|
+
{
|
|
2219
|
+
type: "tuple[]",
|
|
2220
|
+
name: "data",
|
|
2221
|
+
components: [
|
|
2222
|
+
{
|
|
2223
|
+
type: "address",
|
|
2224
|
+
name: "recipient"
|
|
2225
|
+
},
|
|
2226
|
+
{
|
|
2227
|
+
type: "uint64",
|
|
2228
|
+
name: "expirationTime"
|
|
2229
|
+
},
|
|
2230
|
+
{
|
|
2231
|
+
type: "bool",
|
|
2232
|
+
name: "revocable"
|
|
2233
|
+
},
|
|
2234
|
+
{
|
|
2235
|
+
type: "bytes32",
|
|
2236
|
+
name: "refUID"
|
|
2237
|
+
},
|
|
2238
|
+
{
|
|
2239
|
+
type: "bytes",
|
|
2240
|
+
name: "data"
|
|
2241
|
+
},
|
|
2242
|
+
{
|
|
2243
|
+
type: "uint256",
|
|
2244
|
+
name: "value"
|
|
2245
|
+
}
|
|
2246
|
+
]
|
|
2247
|
+
}
|
|
2248
|
+
]
|
|
2249
|
+
},
|
|
2250
|
+
{
|
|
2251
|
+
type: "tuple[]",
|
|
2252
|
+
name: "propertiesToUpdate",
|
|
2253
|
+
components: [
|
|
2254
|
+
{
|
|
2255
|
+
type: "string",
|
|
2256
|
+
name: "publishLocalId"
|
|
2257
|
+
},
|
|
2258
|
+
{
|
|
2259
|
+
type: "bytes32",
|
|
2260
|
+
name: "propertySchemaUid"
|
|
2261
|
+
}
|
|
2262
|
+
]
|
|
2263
|
+
}
|
|
2264
|
+
]
|
|
2265
|
+
}
|
|
2266
|
+
],
|
|
2267
|
+
[
|
|
2268
|
+
{
|
|
2269
|
+
type: "bytes32"
|
|
2270
|
+
},
|
|
2271
|
+
{
|
|
2272
|
+
type: "bytes32"
|
|
2273
|
+
}
|
|
2274
|
+
]
|
|
2275
|
+
],
|
|
2276
|
+
params: [e.request]
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
2279
|
+
function xo(e) {
|
|
2280
|
+
return x({
|
|
2281
|
+
contract: e.contract,
|
|
2282
|
+
method: [
|
|
2283
|
+
"0x715018a6",
|
|
2284
|
+
[],
|
|
2285
|
+
[]
|
|
2286
|
+
],
|
|
2287
|
+
params: []
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
function Co(e) {
|
|
2291
|
+
return x({
|
|
2292
|
+
contract: e.contract,
|
|
2293
|
+
method: [
|
|
2294
|
+
"0xb90b6e0d",
|
|
2295
|
+
[
|
|
2296
|
+
{
|
|
2297
|
+
type: "address",
|
|
2298
|
+
name: "_eas"
|
|
2299
|
+
}
|
|
2300
|
+
],
|
|
2301
|
+
[
|
|
2302
|
+
{
|
|
2303
|
+
type: "string"
|
|
2304
|
+
}
|
|
2305
|
+
]
|
|
2306
|
+
],
|
|
2307
|
+
params: [e.eas]
|
|
2308
|
+
});
|
|
2309
|
+
}
|
|
2310
|
+
function Ro(e) {
|
|
2311
|
+
return x({
|
|
2312
|
+
contract: e.contract,
|
|
2313
|
+
method: [
|
|
2314
|
+
"0xf2fde38b",
|
|
2315
|
+
[
|
|
2316
|
+
{
|
|
2317
|
+
type: "address",
|
|
2318
|
+
name: "newOwner"
|
|
2319
|
+
}
|
|
2320
|
+
],
|
|
2321
|
+
[]
|
|
2322
|
+
],
|
|
2323
|
+
params: [e.newOwner]
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
const _e = () => {
|
|
2327
|
+
const e = xn.getHost(), t = Qn;
|
|
2328
|
+
return Object.keys(t).includes("default") && t.default ? t.default.init({
|
|
2329
|
+
host: e,
|
|
2330
|
+
protocol: "https"
|
|
2331
|
+
}) : t.init({
|
|
2332
|
+
host: e,
|
|
2333
|
+
protocol: "https"
|
|
2334
|
+
});
|
|
2335
|
+
}, $ = "0x" + "0".repeat(64), ct = async (e) => {
|
|
2336
|
+
let t;
|
|
2337
|
+
try {
|
|
2338
|
+
t = await ae.find({ seedLocalId: e });
|
|
2339
|
+
} catch {
|
|
2340
|
+
}
|
|
2341
|
+
return t || new Promise((n) => {
|
|
2342
|
+
const a = setInterval(() => {
|
|
2343
|
+
try {
|
|
2344
|
+
ae.find({ seedLocalId: e }).then((s) => {
|
|
2345
|
+
s && (clearInterval(a), n(s));
|
|
2346
|
+
});
|
|
2347
|
+
} catch {
|
|
2348
|
+
}
|
|
2349
|
+
}, 200);
|
|
2350
|
+
});
|
|
2351
|
+
};
|
|
2352
|
+
function Oa(e) {
|
|
2353
|
+
if (!e || typeof e != "object") return;
|
|
2354
|
+
const t = e;
|
|
2355
|
+
if (Array.isArray(t.data_root))
|
|
2356
|
+
return {
|
|
2357
|
+
data_root: new Uint8Array(t.data_root),
|
|
2358
|
+
chunks: (t.chunks ?? []).map((n) => ({ ...n, dataHash: new Uint8Array(n.dataHash ?? []) })),
|
|
2359
|
+
proofs: (t.proofs ?? []).map((n) => ({ ...n, proof: new Uint8Array(n.proof ?? []) }))
|
|
2360
|
+
};
|
|
2361
|
+
}
|
|
2362
|
+
function Ba(e) {
|
|
2363
|
+
return {
|
|
2364
|
+
data_root: Array.from(e.data_root),
|
|
2365
|
+
chunks: e.chunks.map((t) => ({ ...t, dataHash: Array.from(t.dataHash) })),
|
|
2366
|
+
proofs: e.proofs.map((t) => ({ ...t, proof: Array.from(t.proof) }))
|
|
2367
|
+
};
|
|
2368
|
+
}
|
|
2369
|
+
const Fa = he(
|
|
2370
|
+
async ({ input: { context: e } }) => {
|
|
2371
|
+
let { item: t } = e;
|
|
2372
|
+
t.getPublishUploads || (t = await ct(t.seedLocalId));
|
|
2373
|
+
const n = await t.getPublishUploads(), a = C(), s = e.signArweaveTransactions ?? a.signArweaveTransactions, r = e.arweaveJwk ?? a.arweaveJwk, o = n.map((d) => ({
|
|
2374
|
+
versionLocalId: d.versionLocalId,
|
|
2375
|
+
itemPropertyName: d.itemPropertyName,
|
|
2376
|
+
transactionJson: d.transactionToSign.toJSON()
|
|
2377
|
+
}));
|
|
2378
|
+
let i;
|
|
2379
|
+
if (s)
|
|
2380
|
+
i = await s(o);
|
|
2381
|
+
else if (r) {
|
|
2382
|
+
const d = _e(), p = r;
|
|
2383
|
+
i = [];
|
|
2384
|
+
for (const l of o) {
|
|
2385
|
+
const m = d.transactions.fromRaw(l.transactionJson);
|
|
2386
|
+
m.data && m.data.byteLength > 0 && !m.chunks && await m.prepareChunks(m.data), await d.transactions.sign(m, p);
|
|
2387
|
+
const h = m.toJSON();
|
|
2388
|
+
i.push({
|
|
2389
|
+
transaction: {
|
|
2390
|
+
...h,
|
|
2391
|
+
chunks: m.chunks ? Ba(m.chunks) : void 0
|
|
2392
|
+
},
|
|
2393
|
+
versionId: l.versionLocalId,
|
|
2394
|
+
modelName: l.itemPropertyName
|
|
2395
|
+
});
|
|
2396
|
+
}
|
|
2397
|
+
} else
|
|
2398
|
+
throw new Error(
|
|
2399
|
+
"Arweave signing not configured. Provide signArweaveTransactions or arweaveJwk at createPublish or in PublishProvider config."
|
|
2400
|
+
);
|
|
2401
|
+
const c = _e();
|
|
2402
|
+
return {
|
|
2403
|
+
arweaveTransactions: i.map((d) => {
|
|
2404
|
+
const { chunks: p, ...l } = d.transaction, m = { ...l }, h = Oa(p);
|
|
2405
|
+
return h && (m.chunks = h), {
|
|
2406
|
+
transaction: c.transactions.fromRaw(m),
|
|
2407
|
+
versionId: d.versionId,
|
|
2408
|
+
modelName: d.modelName
|
|
2409
|
+
};
|
|
2410
|
+
}),
|
|
2411
|
+
publishUploads: n
|
|
2412
|
+
};
|
|
2413
|
+
}
|
|
2414
|
+
), zt = async (e) => {
|
|
2415
|
+
const t = e instanceof Uint8Array ? new Uint8Array(e) : new Uint8Array(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
2416
|
+
return Array.from(new Uint8Array(n)).map((a) => a.toString(16).padStart(2, "0")).join("");
|
|
2417
|
+
}, Na = {
|
|
2418
|
+
png: "image/png",
|
|
2419
|
+
jpg: "image/jpeg",
|
|
2420
|
+
jpeg: "image/jpeg",
|
|
2421
|
+
gif: "image/gif",
|
|
2422
|
+
webp: "image/webp",
|
|
2423
|
+
svg: "image/svg+xml",
|
|
2424
|
+
html: "text/html",
|
|
2425
|
+
htm: "text/html",
|
|
2426
|
+
json: "application/json",
|
|
2427
|
+
txt: "text/plain"
|
|
2428
|
+
}, Zt = (e) => {
|
|
2429
|
+
const t = e.split(".").pop()?.toLowerCase();
|
|
2430
|
+
return t ? Na[t] : void 0;
|
|
2431
|
+
}, tt = async (e) => typeof Blob < "u" && e instanceof Blob ? new Uint8Array(await e.arrayBuffer()) : new Uint8Array(e), ka = (e) => {
|
|
2432
|
+
switch (e) {
|
|
2433
|
+
case "Image":
|
|
2434
|
+
return G.getFilesPath("images");
|
|
2435
|
+
case "File":
|
|
2436
|
+
return G.getFilesPath("files");
|
|
2437
|
+
case "Html":
|
|
2438
|
+
return G.getFilesPath("html");
|
|
2439
|
+
case "Json":
|
|
2440
|
+
return G.getFilesPath("json");
|
|
2441
|
+
default:
|
|
2442
|
+
return G.getFilesPath("images");
|
|
2443
|
+
}
|
|
2444
|
+
}, Ha = async (e, t, n) => {
|
|
2445
|
+
const a = e.itemProperty, s = [];
|
|
2446
|
+
for (const p of e.childProperties) {
|
|
2447
|
+
const l = p.localStoragePath;
|
|
2448
|
+
!l || l.endsWith("undefined") || !await G.pathExists(l) || s.push({
|
|
2449
|
+
propertyName: p.propertyName,
|
|
2450
|
+
localStoragePath: l
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
let r;
|
|
2454
|
+
if ((!s || s.length === 0) && n?.localStoragePath) {
|
|
2455
|
+
const p = n.localStoragePath;
|
|
2456
|
+
if (p && !p.endsWith("undefined") && await G.pathExists(p))
|
|
2457
|
+
try {
|
|
2458
|
+
const m = await G.readFileAsBuffer(p);
|
|
2459
|
+
r = await tt(m);
|
|
2460
|
+
} catch {
|
|
2461
|
+
const m = await G.getFs();
|
|
2462
|
+
r = await tt(m.readFileSync(p));
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
if (s.length > 0) {
|
|
2466
|
+
const p = "===FILE_SEPARATOR===";
|
|
2467
|
+
let l = "";
|
|
2468
|
+
const m = await G.getFs();
|
|
2469
|
+
for (const h of s) {
|
|
2470
|
+
let y;
|
|
2471
|
+
try {
|
|
2472
|
+
y = await m.promises.readFile(h.localStoragePath);
|
|
2473
|
+
} catch {
|
|
2474
|
+
y = m.readFileSync(h.localStoragePath);
|
|
2475
|
+
}
|
|
2476
|
+
l += `${p}${h.propertyName}${p}${y}`;
|
|
2477
|
+
}
|
|
2478
|
+
r = typeof document < "u" ? new TextEncoder().encode(l) : new Uint8Array(Buffer.from(l));
|
|
2479
|
+
}
|
|
2480
|
+
if (!r) return t;
|
|
2481
|
+
const o = new Uint8Array(r), i = await zt(o);
|
|
2482
|
+
let c;
|
|
2483
|
+
s.length === 0 && n?.localStoragePath ? c = Zt(n.localStoragePath) : s.length > 0 && (c = "application/octet-stream");
|
|
2484
|
+
const u = n ? n.localId : a.localId, d = n ? n.propertyName : a.propertyName;
|
|
2485
|
+
return t.push({
|
|
2486
|
+
data: o,
|
|
2487
|
+
contentHash: i,
|
|
2488
|
+
contentType: c,
|
|
2489
|
+
itemPropertyName: d,
|
|
2490
|
+
itemPropertyLocalId: u,
|
|
2491
|
+
seedLocalId: a.seedLocalId,
|
|
2492
|
+
versionLocalId: a.versionLocalId
|
|
2493
|
+
}), t;
|
|
2494
|
+
}, $a = async (e) => {
|
|
2495
|
+
const t = [];
|
|
2496
|
+
for (const n of e) {
|
|
2497
|
+
const a = n.getService().getSnapshot(), s = "context" in a ? a.context : null;
|
|
2498
|
+
if (!s) continue;
|
|
2499
|
+
const r = s.propertyValue, o = s.refResolvedValue;
|
|
2500
|
+
if (!o) continue;
|
|
2501
|
+
const { localId: i } = Mt(r ?? "");
|
|
2502
|
+
if (!i) continue;
|
|
2503
|
+
const c = n.propertyDef?.refValueType ?? n.propertyDef?.dataType ?? "Image", d = `${ka(c)}/${o}`;
|
|
2504
|
+
if (!await G.pathExists(d)) continue;
|
|
2505
|
+
const l = await G.readFileAsBuffer(d), m = await tt(l), h = await zt(m), y = Zt(o);
|
|
2506
|
+
t.push({
|
|
2507
|
+
data: m,
|
|
2508
|
+
contentHash: h,
|
|
2509
|
+
contentType: y,
|
|
2510
|
+
itemPropertyName: n.propertyName,
|
|
2511
|
+
itemPropertyLocalId: n.localId,
|
|
2512
|
+
seedLocalId: i,
|
|
2513
|
+
versionLocalId: n.versionLocalId
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2516
|
+
return t;
|
|
2517
|
+
}, Kt = async (e, t = [], n) => {
|
|
2518
|
+
const { itemUploadProperties: a, itemRelationProperties: s, itemImageProperties: r } = await at(e);
|
|
2519
|
+
for (const i of a)
|
|
2520
|
+
t = await Ha(i, t, n);
|
|
2521
|
+
const o = await $a(r);
|
|
2522
|
+
t.push(...o);
|
|
2523
|
+
for (const i of s) {
|
|
2524
|
+
const c = i.getService().getSnapshot(), u = "context" in c ? c.context : null;
|
|
2525
|
+
if (!u) continue;
|
|
2526
|
+
const d = u.propertyValue;
|
|
2527
|
+
if (!d || i.uid) continue;
|
|
2528
|
+
const { localId: p, uid: l } = Mt(d), m = await ae.find({ seedLocalId: p, seedUid: l });
|
|
2529
|
+
if (!m)
|
|
2530
|
+
throw new Error(`No relatedItem found for ${i.propertyName}`);
|
|
2531
|
+
t = await Kt(m, t, i);
|
|
2532
|
+
}
|
|
2533
|
+
return t;
|
|
2534
|
+
}, dt = 3, pe = 65, At = new TextEncoder().encode("seed-recovery");
|
|
2535
|
+
function Va(e) {
|
|
2536
|
+
return e != null && typeof e == "object" && "privateKey" in e && typeof e.privateKey == "string";
|
|
2537
|
+
}
|
|
2538
|
+
function Wa(e, t, n) {
|
|
2539
|
+
let s = e >= 0 ? e << 1 : ~e << 1 | 1, r = n;
|
|
2540
|
+
do {
|
|
2541
|
+
const o = s & 127;
|
|
2542
|
+
s >>>= 7, t[r++] = s ? o | 128 : o;
|
|
2543
|
+
} while (s);
|
|
2544
|
+
return r - n;
|
|
2545
|
+
}
|
|
2546
|
+
const lt = (e) => {
|
|
2547
|
+
if (!e?.length) return new Uint8Array(0);
|
|
2548
|
+
const t = new TextEncoder(), n = new Uint8Array(16), a = [], s = (c) => {
|
|
2549
|
+
const u = Wa(c, n, 0);
|
|
2550
|
+
a.push(n.slice(0, u));
|
|
2551
|
+
};
|
|
2552
|
+
s(e.length);
|
|
2553
|
+
for (const c of e) {
|
|
2554
|
+
const u = t.encode(c.name), d = t.encode(c.value);
|
|
2555
|
+
s(u.length), a.push(u), s(d.length), a.push(d);
|
|
2556
|
+
}
|
|
2557
|
+
s(0);
|
|
2558
|
+
const r = a.reduce((c, u) => c + u.length, 0), o = new Uint8Array(r);
|
|
2559
|
+
let i = 0;
|
|
2560
|
+
for (const c of a)
|
|
2561
|
+
o.set(c, i), i += c.length;
|
|
2562
|
+
return o;
|
|
2563
|
+
}, vt = (e) => {
|
|
2564
|
+
const t = new Uint8Array(8), n = new DataView(t.buffer);
|
|
2565
|
+
return n.setUint32(0, e & 4294967295, !0), n.setUint32(4, Math.floor(e / 4294967296), !0), t;
|
|
2566
|
+
};
|
|
2567
|
+
async function we(e) {
|
|
2568
|
+
return new Uint8Array(
|
|
2569
|
+
await crypto.subtle.digest("SHA-384", e)
|
|
2570
|
+
);
|
|
2571
|
+
}
|
|
2572
|
+
function Ie(e, t) {
|
|
2573
|
+
const n = new Uint8Array(e.length + t.length);
|
|
2574
|
+
return n.set(e, 0), n.set(t, e.length), n;
|
|
2575
|
+
}
|
|
2576
|
+
async function Qt(e) {
|
|
2577
|
+
const t = new TextEncoder();
|
|
2578
|
+
if (Array.isArray(e)) {
|
|
2579
|
+
const r = Ie(t.encode("list"), t.encode(e.length.toString()));
|
|
2580
|
+
let o = await we(r);
|
|
2581
|
+
for (const i of e) {
|
|
2582
|
+
const c = await Qt(i);
|
|
2583
|
+
o = await we(Ie(o, c));
|
|
2584
|
+
}
|
|
2585
|
+
return o;
|
|
2586
|
+
}
|
|
2587
|
+
const n = Ie(t.encode("blob"), t.encode(e.byteLength.toString())), a = await we(n), s = await we(e);
|
|
2588
|
+
return we(Ie(a, s));
|
|
2589
|
+
}
|
|
2590
|
+
async function ut(e, t, n, a, s) {
|
|
2591
|
+
const r = new TextEncoder();
|
|
2592
|
+
return Qt([
|
|
2593
|
+
r.encode("dataitem"),
|
|
2594
|
+
r.encode("1"),
|
|
2595
|
+
r.encode(dt.toString()),
|
|
2596
|
+
e,
|
|
2597
|
+
t,
|
|
2598
|
+
n,
|
|
2599
|
+
a,
|
|
2600
|
+
s
|
|
2601
|
+
]);
|
|
2602
|
+
}
|
|
2603
|
+
function Xt(e, t, n) {
|
|
2604
|
+
const a = lt(t), s = vt(t.length), r = vt(a.length), o = new Uint8Array([0]), i = new Uint8Array([0]), c = [
|
|
2605
|
+
e,
|
|
2606
|
+
o,
|
|
2607
|
+
i,
|
|
2608
|
+
s,
|
|
2609
|
+
r,
|
|
2610
|
+
a,
|
|
2611
|
+
n
|
|
2612
|
+
], u = c.reduce((l, m) => l + m.length, 0), d = new Uint8Array(u);
|
|
2613
|
+
let p = 0;
|
|
2614
|
+
for (const l of c)
|
|
2615
|
+
d.set(l, p), p += l.length;
|
|
2616
|
+
return d;
|
|
2617
|
+
}
|
|
2618
|
+
async function en(e, t) {
|
|
2619
|
+
const n = new Uint8Array(2);
|
|
2620
|
+
new DataView(n.buffer).setUint16(0, dt, !0);
|
|
2621
|
+
const a = 2 + pe + t.length, s = new Uint8Array(a);
|
|
2622
|
+
s.set(n, 0), s.set(e, 2), s.set(t, 2 + pe);
|
|
2623
|
+
const r = await crypto.subtle.digest("SHA-256", new Uint8Array(e));
|
|
2624
|
+
return { id: Ya(new Uint8Array(r)), raw: s };
|
|
2625
|
+
}
|
|
2626
|
+
const qa = async (e, t, n) => {
|
|
2627
|
+
const a = H.SigningKey.computePublicKey(t.privateKey, !1), s = H.getBytes(a), r = lt(n), o = new Uint8Array(0), i = new Uint8Array(0), c = await ut(
|
|
2628
|
+
s,
|
|
2629
|
+
o,
|
|
2630
|
+
i,
|
|
2631
|
+
r,
|
|
2632
|
+
e
|
|
2633
|
+
), u = H.getBytes(await t.signMessage(c)), d = Xt(s, n, e);
|
|
2634
|
+
return en(u, d);
|
|
2635
|
+
}, ja = async (e, t, n) => {
|
|
2636
|
+
const a = H.hexlify(At), s = await t.signMessage({
|
|
2637
|
+
message: { raw: a }
|
|
2638
|
+
}), r = H.hashMessage(At), o = H.SigningKey.recoverPublicKey(r, s), i = H.getBytes(o), c = lt(n), u = new Uint8Array(0), d = new Uint8Array(0), p = await ut(
|
|
2639
|
+
i,
|
|
2640
|
+
u,
|
|
2641
|
+
d,
|
|
2642
|
+
c,
|
|
2643
|
+
e
|
|
2644
|
+
), l = H.hexlify(p), m = await t.signMessage({
|
|
2645
|
+
message: { raw: l }
|
|
2646
|
+
}), h = H.getBytes(m), y = Xt(i, n, e);
|
|
2647
|
+
return en(h, y);
|
|
2648
|
+
};
|
|
2649
|
+
async function Ga(e) {
|
|
2650
|
+
const t = 2 + pe + 65 + 1 + 1, n = t + 16;
|
|
2651
|
+
if (e.length < n) return !1;
|
|
2652
|
+
const a = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
2653
|
+
if (a.getUint16(0, !0) !== dt) return !1;
|
|
2654
|
+
const r = e.slice(2, 2 + pe), o = e.slice(2 + pe, 2 + pe + 65), i = new Uint8Array(0), c = new Uint8Array(0), u = Number(
|
|
2655
|
+
a.getUint32(t + 8, !0) + a.getUint32(t + 12, !0) * 4294967296
|
|
2656
|
+
), d = t + 16 + u;
|
|
2657
|
+
if (e.length < d) return !1;
|
|
2658
|
+
const p = e.slice(t + 16, d), l = e.slice(d);
|
|
2659
|
+
try {
|
|
2660
|
+
const m = await ut(
|
|
2661
|
+
o,
|
|
2662
|
+
i,
|
|
2663
|
+
c,
|
|
2664
|
+
p,
|
|
2665
|
+
l
|
|
2666
|
+
), h = H.hashMessage(m), y = H.hexlify(r), f = H.SigningKey.recoverPublicKey(h, y), A = H.getBytes(f);
|
|
2667
|
+
return A.length === o.length && A.every((g, I) => g === o[I]);
|
|
2668
|
+
} catch {
|
|
2669
|
+
return !1;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
const Ya = (e) => {
|
|
2673
|
+
let t = "";
|
|
2674
|
+
for (const n of e)
|
|
2675
|
+
t += String.fromCharCode(n);
|
|
2676
|
+
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
2677
|
+
}, Ja = K("seedProtocol:createArweaveDataItems"), za = he(
|
|
2678
|
+
async ({ input: { context: e } }) => {
|
|
2679
|
+
let { item: t } = e;
|
|
2680
|
+
t.getPublishUploads || (t = await ct(t.seedLocalId));
|
|
2681
|
+
const n = await Kt(t), a = C(), s = e.signDataItems ?? a.signDataItems, r = e.dataItemSigner ?? a.dataItemSigner;
|
|
2682
|
+
let o, i;
|
|
2683
|
+
if (s)
|
|
2684
|
+
o = (await s(n)).map((d) => ({
|
|
2685
|
+
transaction: { id: d.transaction.id },
|
|
2686
|
+
versionId: d.versionId,
|
|
2687
|
+
modelName: d.modelName
|
|
2688
|
+
}));
|
|
2689
|
+
else if (r) {
|
|
2690
|
+
const u = r, d = [];
|
|
2691
|
+
for (const p of n) {
|
|
2692
|
+
const l = [];
|
|
2693
|
+
p.contentHash && l.push({ name: "Content-SHA-256", value: p.contentHash }), p.contentType && l.push({ name: "Content-Type", value: p.contentType });
|
|
2694
|
+
const m = Va(u) ? await qa(p.data, u, l) : await ja(p.data, u, l);
|
|
2695
|
+
if (!await Ga(m.raw))
|
|
2696
|
+
throw Ja("DataItem verification failed: id=%s modelName=%s", m.id, p.itemPropertyName), new Error(
|
|
2697
|
+
`DataItem signature verification failed for ${p.itemPropertyName}. The signing key may not match the owner, or the payload may have been modified.`
|
|
2698
|
+
);
|
|
2699
|
+
d.push(m);
|
|
2700
|
+
}
|
|
2701
|
+
i = d, o = d.map((p, l) => ({
|
|
2702
|
+
transaction: { id: p.id },
|
|
2703
|
+
versionId: n[l]?.versionLocalId,
|
|
2704
|
+
modelName: n[l]?.itemPropertyName
|
|
2705
|
+
}));
|
|
2706
|
+
} else
|
|
2707
|
+
throw new Error(
|
|
2708
|
+
"@seedprotocol/publish: useArweaveBundler requires signDataItems or dataItemSigner (pass at createPublish or in PublishProvider config)"
|
|
2709
|
+
);
|
|
2710
|
+
const c = n.map((u) => ({
|
|
2711
|
+
itemPropertyName: u.itemPropertyName,
|
|
2712
|
+
itemPropertyLocalId: u.itemPropertyLocalId,
|
|
2713
|
+
seedLocalId: u.seedLocalId,
|
|
2714
|
+
versionLocalId: u.versionLocalId,
|
|
2715
|
+
transactionToSign: null
|
|
2716
|
+
}));
|
|
2717
|
+
return {
|
|
2718
|
+
arweaveTransactions: o,
|
|
2719
|
+
publishUploads: c,
|
|
2720
|
+
arweaveUploadData: n,
|
|
2721
|
+
signedDataItems: i
|
|
2722
|
+
};
|
|
2723
|
+
}
|
|
2724
|
+
), St = 8192;
|
|
2725
|
+
function Za(e) {
|
|
2726
|
+
const t = new Uint8Array(e);
|
|
2727
|
+
let n = "";
|
|
2728
|
+
for (let a = 0; a < t.length; a += St) {
|
|
2729
|
+
const s = t.subarray(a, Math.min(a + St, t.length));
|
|
2730
|
+
n += String.fromCharCode.apply(null, s);
|
|
2731
|
+
}
|
|
2732
|
+
return btoa(n);
|
|
2733
|
+
}
|
|
2734
|
+
async function Ka(e) {
|
|
2735
|
+
const t = [];
|
|
2736
|
+
for (const [n, a] of e.entries()) {
|
|
2737
|
+
const s = a;
|
|
2738
|
+
if (typeof s == "object" && s !== null && "arrayBuffer" in s) {
|
|
2739
|
+
const r = await s.arrayBuffer(), o = Za(r), i = s;
|
|
2740
|
+
t.push({
|
|
2741
|
+
name: n,
|
|
2742
|
+
value: o,
|
|
2743
|
+
encoding: "base64",
|
|
2744
|
+
filename: i.name || void 0
|
|
2745
|
+
});
|
|
2746
|
+
} else
|
|
2747
|
+
t.push({ name: n, value: String(a) });
|
|
2748
|
+
}
|
|
2749
|
+
return t;
|
|
2750
|
+
}
|
|
2751
|
+
function Qa(e, t, n) {
|
|
2752
|
+
const a = ["Upload server returned ", String(e)], s = t && typeof t == "object" && "message" in t ? String(t.message) : t && typeof t == "object" && "error" in t ? String(t.error) : null;
|
|
2753
|
+
return s ? a.push(`: ${s}`) : n && a.push(` (${n})`), a.join("");
|
|
2754
|
+
}
|
|
2755
|
+
function Xa(e) {
|
|
2756
|
+
if (!e)
|
|
2757
|
+
return "Upload server unavailable. Please try again or check your connection.";
|
|
2758
|
+
const t = e.toLowerCase();
|
|
2759
|
+
return /other side closed|econnreset|socket hang up|connection closed/i.test(t) ? "Upload server closed the connection. It may be busy or the request may be too large—try again." : /etimedout|timeout/i.test(t) ? "Upload request timed out. Please try again." : /enotfound|getaddrinfo|dns/i.test(t) ? "Upload server could not be reached. Check the upload URL and your network." : "Upload failed. Please try again or check the upload server.";
|
|
2760
|
+
}
|
|
2761
|
+
async function es(e, t, n) {
|
|
2762
|
+
const a = typeof window < "u" ? window.Main : void 0;
|
|
2763
|
+
if (a?.uploadArweaveStart) {
|
|
2764
|
+
const o = await Ka(t);
|
|
2765
|
+
return a.uploadArweaveStart(e, o);
|
|
2766
|
+
}
|
|
2767
|
+
const s = await fetch(e, {
|
|
2768
|
+
method: "POST",
|
|
2769
|
+
body: t
|
|
2770
|
+
}), r = await s.json().catch(() => ({}));
|
|
2771
|
+
return { status: s.status, body: r };
|
|
2772
|
+
}
|
|
2773
|
+
const ts = he(
|
|
2774
|
+
async ({ input: { context: e, event: t } }) => {
|
|
2775
|
+
const { arweaveTransactions: n = [], transactionKeys: a, reimbursementTransactionId: s } = e;
|
|
2776
|
+
if (s)
|
|
2777
|
+
return {
|
|
2778
|
+
transactionId: s
|
|
2779
|
+
};
|
|
2780
|
+
const r = n.map(({ transaction: l }) => l), o = new FormData();
|
|
2781
|
+
for (const l of r) {
|
|
2782
|
+
let { data: m, chunks: h, ...y } = l;
|
|
2783
|
+
const f = m instanceof Blob ? m : new Blob([m]);
|
|
2784
|
+
o.append(`${l.id}-data`, f, `${l.id}-data`);
|
|
2785
|
+
const A = new Blob([JSON.stringify(h)], { type: "application/json" });
|
|
2786
|
+
o.append(`${l.id}-chunks`, A, `${l.id}-chunks`);
|
|
2787
|
+
const g = new Blob([JSON.stringify(y)], { type: "application/json" });
|
|
2788
|
+
o.append(`${l.id}-json`, g, `${l.id}-json`);
|
|
2789
|
+
}
|
|
2790
|
+
const { uploadApiBaseUrl: i } = C(), c = `${i}/api/upload/arweave/start`, { status: u, body: d, message: p } = await es(
|
|
2791
|
+
c,
|
|
2792
|
+
o
|
|
2793
|
+
);
|
|
2794
|
+
if (u >= 300 || u < 200) {
|
|
2795
|
+
const l = u === 0 ? p : null;
|
|
2796
|
+
l && console.error("[upload]", l);
|
|
2797
|
+
const m = u === 0 ? Xa(l) : Qa(u, d, a);
|
|
2798
|
+
throw new Error(m);
|
|
2799
|
+
}
|
|
2800
|
+
return d;
|
|
2801
|
+
}
|
|
2802
|
+
), ns = he(async ({ input: { context: e, event: t } }) => {
|
|
2803
|
+
const { requestResponse: n, reimbursementTransactionId: a } = e;
|
|
2804
|
+
if (!n)
|
|
2805
|
+
throw new Error("No request response");
|
|
2806
|
+
if (!a)
|
|
2807
|
+
throw new Error("No reimbursement transaction id");
|
|
2808
|
+
const s = _e();
|
|
2809
|
+
await new Promise((o, i) => {
|
|
2810
|
+
const c = setInterval(async () => {
|
|
2811
|
+
let u;
|
|
2812
|
+
try {
|
|
2813
|
+
u = await s.transactions.getStatus(a);
|
|
2814
|
+
} catch {
|
|
2815
|
+
return;
|
|
2816
|
+
}
|
|
2817
|
+
u && u.confirmed && (clearInterval(c), o());
|
|
2818
|
+
}, 5e3);
|
|
2819
|
+
});
|
|
2820
|
+
}), ne = K("seedProtocol:services:publish:actors");
|
|
2821
|
+
function as(e) {
|
|
2822
|
+
if (e instanceof Uint8Array) return e;
|
|
2823
|
+
if (e instanceof ArrayBuffer) return new Uint8Array(e);
|
|
2824
|
+
throw new Error("Transaction data must be Uint8Array or ArrayBuffer for upload resume");
|
|
2825
|
+
}
|
|
2826
|
+
const ss = ye(
|
|
2827
|
+
({ sendBack: e, input: t }) => {
|
|
2828
|
+
const n = t.context, s = (n.arweaveTransactions ?? []).map(({ transaction: u }) => u), r = _e(), o = n.uploaderState && typeof n.currentTransactionIndex == "number", i = o ? n.currentTransactionIndex : 0;
|
|
2829
|
+
(async () => {
|
|
2830
|
+
const u = s.length;
|
|
2831
|
+
for (let d = i; d < u; d++) {
|
|
2832
|
+
const p = s[d];
|
|
2833
|
+
if (!p) continue;
|
|
2834
|
+
const l = r.transactions.fromRaw(p);
|
|
2835
|
+
if (!await r.transactions.verify(l))
|
|
2836
|
+
throw new Error("Transaction verification failed");
|
|
2837
|
+
let h;
|
|
2838
|
+
const y = n.uploaderState;
|
|
2839
|
+
if (o && d === i && y) {
|
|
2840
|
+
const f = l.data, A = f instanceof Uint8Array ? f : as(f);
|
|
2841
|
+
h = await r.transactions.getUploader(y, A);
|
|
2842
|
+
} else
|
|
2843
|
+
h = await r.transactions.getUploader(l, l.data);
|
|
2844
|
+
for (; !h.isComplete; ) {
|
|
2845
|
+
ne("uploading chunk"), ne(`uploader.pctComplete: ${h.pctComplete}`), ne(`uploader.uploadedChunks: ${h.uploadedChunks}`), ne(`uploader.totalChunks: ${h.totalChunks}`), ne(h.lastResponseError), ne(h.lastResponseStatus);
|
|
2846
|
+
try {
|
|
2847
|
+
await h.uploadChunk();
|
|
2848
|
+
const f = Math.trunc((d + h.pctComplete / 100) / u * 100);
|
|
2849
|
+
e({
|
|
2850
|
+
type: "updatePercentage",
|
|
2851
|
+
completionPercentage: f,
|
|
2852
|
+
uploaderState: h.toJSON(),
|
|
2853
|
+
currentTransactionIndex: d
|
|
2854
|
+
}), ne(`${h.pctComplete}% complete, ${h.uploadedChunks}/${h.totalChunks}`);
|
|
2855
|
+
} catch (f) {
|
|
2856
|
+
ne(f);
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
return "done";
|
|
2861
|
+
})().then((u) => {
|
|
2862
|
+
e({ type: "uploadComplete", result: u });
|
|
2863
|
+
}).catch((u) => {
|
|
2864
|
+
e({ type: "uploadError", error: u });
|
|
2865
|
+
});
|
|
2866
|
+
}
|
|
2867
|
+
), rs = ye(
|
|
2868
|
+
({ sendBack: e, input: { context: t } }) => {
|
|
2869
|
+
const { signedDataItems: n } = t, { uploadApiBaseUrl: a, useArweaveBundler: s } = C();
|
|
2870
|
+
if (!s || !a) {
|
|
2871
|
+
e({
|
|
2872
|
+
type: "uploadError",
|
|
2873
|
+
error: new Error(
|
|
2874
|
+
"Arweave bundler not configured. Set useArweaveBundler and uploadApiBaseUrl."
|
|
2875
|
+
)
|
|
2876
|
+
});
|
|
2877
|
+
return;
|
|
2878
|
+
}
|
|
2879
|
+
const r = `${a.replace(/\/$/, "")}/api/upload/arweave/batch`;
|
|
2880
|
+
if (!n || n.length === 0) {
|
|
2881
|
+
e({ type: "uploadComplete", result: "done" });
|
|
2882
|
+
return;
|
|
2883
|
+
}
|
|
2884
|
+
(async () => {
|
|
2885
|
+
const i = async (f) => {
|
|
2886
|
+
const A = f;
|
|
2887
|
+
if (A.raw != null && (A.raw instanceof Uint8Array || Buffer.isBuffer(A.raw)))
|
|
2888
|
+
return Buffer.from(A.raw);
|
|
2889
|
+
if (typeof A.getRaw == "function") {
|
|
2890
|
+
const g = A.getRaw();
|
|
2891
|
+
return g instanceof Promise ? g : Buffer.from(g);
|
|
2892
|
+
}
|
|
2893
|
+
if (A.filename != null)
|
|
2894
|
+
return Xn(A.filename);
|
|
2895
|
+
throw new Error("Cannot get raw bytes from DataItem");
|
|
2896
|
+
}, c = await Promise.all(
|
|
2897
|
+
n.map((f) => i(f))
|
|
2898
|
+
), u = c.length;
|
|
2899
|
+
let d = 4;
|
|
2900
|
+
for (const f of c)
|
|
2901
|
+
d += 4 + f.length;
|
|
2902
|
+
const p = Buffer.alloc(d);
|
|
2903
|
+
let l = 0;
|
|
2904
|
+
p.writeUInt32BE(u, l), l += 4;
|
|
2905
|
+
for (const f of c)
|
|
2906
|
+
p.writeUInt32BE(f.length, l), l += 4, f.copy(p, l), l += f.length;
|
|
2907
|
+
const m = await fetch(r, {
|
|
2908
|
+
method: "POST",
|
|
2909
|
+
headers: { "Content-Type": "application/octet-stream" },
|
|
2910
|
+
body: p
|
|
2911
|
+
});
|
|
2912
|
+
if (!m.ok)
|
|
2913
|
+
throw new Error(`Batch upload failed: ${m.status}`);
|
|
2914
|
+
const h = await m.json().catch(() => ({})), y = typeof h.failed == "number" ? h.failed : 0;
|
|
2915
|
+
if (y > 0) {
|
|
2916
|
+
const f = h.total ?? "?", A = h.succeeded ?? 0;
|
|
2917
|
+
throw new Error(
|
|
2918
|
+
`Arweave batch upload failed: ${y} of ${f} item(s) failed (${A} succeeded)`
|
|
2919
|
+
);
|
|
2920
|
+
}
|
|
2921
|
+
})().then(() => e({ type: "uploadComplete", result: "done" })).catch((i) => e({ type: "uploadError", error: i }));
|
|
2922
|
+
}
|
|
2923
|
+
), tn = "Could not connect the managed publishing account on Optimism Sepolia. Reconnect with the same sign-in method and try again.", os = "Your publishing smart account is not deployed on Optimism Sepolia yet. Complete wallet setup, enable autoDeployManagedAccount in config if appropriate, then try again.", is = "The managed account could not be confirmed on Optimism Sepolia after deployment. Wait a moment and retry, or check your network connection.", nn = "Automatic deployment of the managed publishing account failed on Optimism Sepolia. Retry or deploy the account through your wallet provider.";
|
|
2924
|
+
async function Et() {
|
|
2925
|
+
const { useModularExecutor: e } = C();
|
|
2926
|
+
if (!e)
|
|
2927
|
+
return { kind: "skip" };
|
|
2928
|
+
let t;
|
|
2929
|
+
try {
|
|
2930
|
+
t = await rt(v);
|
|
2931
|
+
} catch (a) {
|
|
2932
|
+
return { kind: "unavailable", cause: a };
|
|
2933
|
+
}
|
|
2934
|
+
return await Re(t) ? { kind: "ready", managedAddress: t } : { kind: "not_deployed", managedAddress: t };
|
|
2935
|
+
}
|
|
2936
|
+
async function an() {
|
|
2937
|
+
const e = Me();
|
|
2938
|
+
await e.autoConnect({ client: R(), chain: v });
|
|
2939
|
+
const t = e.getAccount();
|
|
2940
|
+
if (!t)
|
|
2941
|
+
throw new Q(tn, "MANAGED_ACCOUNT_UNAVAILABLE");
|
|
2942
|
+
return t;
|
|
2943
|
+
}
|
|
2944
|
+
async function cs() {
|
|
2945
|
+
const e = await an();
|
|
2946
|
+
try {
|
|
2947
|
+
await la(e);
|
|
2948
|
+
} catch (t) {
|
|
2949
|
+
throw new Q(nn, "MANAGED_ACCOUNT_NOT_DEPLOYED", e.address, t);
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
async function sn() {
|
|
2953
|
+
const e = C();
|
|
2954
|
+
if (!e.useModularExecutor)
|
|
2955
|
+
throw new Error("runModularExecutorPublishPrep: useModularExecutor is false");
|
|
2956
|
+
let t = await Et();
|
|
2957
|
+
if (t.kind === "unavailable")
|
|
2958
|
+
return {
|
|
2959
|
+
ok: !1,
|
|
2960
|
+
error: new Q(tn, "MANAGED_ACCOUNT_UNAVAILABLE", void 0, t.cause)
|
|
2961
|
+
};
|
|
2962
|
+
if (t.kind === "not_deployed")
|
|
2963
|
+
if (e.autoDeployManagedAccount) {
|
|
2964
|
+
try {
|
|
2965
|
+
await cs();
|
|
2966
|
+
} catch (n) {
|
|
2967
|
+
return { ok: !1, error: wt(n) ? n : new Q(nn, "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress, n) };
|
|
2968
|
+
}
|
|
2969
|
+
if (t = await Et(), t.kind !== "ready")
|
|
2970
|
+
return {
|
|
2971
|
+
ok: !1,
|
|
2972
|
+
error: new Q(
|
|
2973
|
+
is,
|
|
2974
|
+
"MANAGED_ACCOUNT_NOT_DEPLOYED",
|
|
2975
|
+
t.kind === "not_deployed" ? t.managedAddress : void 0
|
|
2976
|
+
)
|
|
2977
|
+
};
|
|
2978
|
+
} else
|
|
2979
|
+
return {
|
|
2980
|
+
ok: !1,
|
|
2981
|
+
error: new Q(os, "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress)
|
|
2982
|
+
};
|
|
2983
|
+
if (t.kind === "ready") {
|
|
2984
|
+
if (e.modularAccountModuleContract)
|
|
2985
|
+
try {
|
|
2986
|
+
const n = await an();
|
|
2987
|
+
await et(t.managedAddress, n, e);
|
|
2988
|
+
} catch (n) {
|
|
2989
|
+
return wt(n) ? { ok: !1, error: n } : {
|
|
2990
|
+
ok: !1,
|
|
2991
|
+
error: new Q(
|
|
2992
|
+
"Executor module setup failed on Optimism Sepolia.",
|
|
2993
|
+
"EXECUTOR_MODULE_NOT_INSTALLED",
|
|
2994
|
+
t.managedAddress,
|
|
2995
|
+
n
|
|
2996
|
+
)
|
|
2997
|
+
};
|
|
2998
|
+
}
|
|
2999
|
+
return { ok: !0, managedAddress: t.managedAddress };
|
|
3000
|
+
}
|
|
3001
|
+
throw new Error("runModularExecutorPublishPrep: unexpected readiness state");
|
|
3002
|
+
}
|
|
3003
|
+
const ds = K("seedProtocol:services:publish:actors:persistSeedUid"), It = "0x" + "0".repeat(64), ls = 15e3;
|
|
3004
|
+
function rn(e, t) {
|
|
3005
|
+
const n = e.seedLocalId, a = n ? t.find((r) => r?.localId === n) : void 0, s = a?.seedUid && a.seedUid !== It ? a.seedUid : t[0]?.seedUid;
|
|
3006
|
+
s && s !== It && (e.seedUid = s);
|
|
3007
|
+
}
|
|
3008
|
+
async function on(e, t) {
|
|
3009
|
+
const n = e.persistSeedUid;
|
|
3010
|
+
if (typeof n != "function") return;
|
|
3011
|
+
const a = new Promise(
|
|
3012
|
+
(s, r) => setTimeout(() => r(new Error("persistSeedUid timed out")), ls)
|
|
3013
|
+
);
|
|
3014
|
+
try {
|
|
3015
|
+
await Promise.race([n.call(e, t), a]);
|
|
3016
|
+
} catch (s) {
|
|
3017
|
+
ds("persistSeedUid failed (attestations already on-chain):", s);
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
async function cn(e) {
|
|
3021
|
+
if (e.length === 0) return;
|
|
3022
|
+
const { arweaveUploadVerificationBaseUrl: t } = C(), n = await Promise.all(
|
|
3023
|
+
e.map(
|
|
3024
|
+
(a) => Cn(t, a)
|
|
3025
|
+
)
|
|
3026
|
+
);
|
|
3027
|
+
for (let a = 0; a < e.length; a++) {
|
|
3028
|
+
const s = e[a], r = n[a];
|
|
3029
|
+
if (r) {
|
|
3030
|
+
if (r.status === 404)
|
|
3031
|
+
throw new Error(
|
|
3032
|
+
`Arweave transaction ${s} not found. Upload may have failed. Delete this publish record and try again.`
|
|
3033
|
+
);
|
|
3034
|
+
if (r.status !== 200)
|
|
3035
|
+
throw new Error(
|
|
3036
|
+
`Arweave transaction ${s} is not yet available from the upload service (status: ${r.status}). Wait and retry.`
|
|
3037
|
+
);
|
|
3038
|
+
}
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
function us() {
|
|
3042
|
+
return Y({
|
|
3043
|
+
signature: "event CreatedAttestation((bytes32 schemaUid, bytes32 attestationUid) result)"
|
|
3044
|
+
});
|
|
3045
|
+
}
|
|
3046
|
+
function ps() {
|
|
3047
|
+
return Y({
|
|
3048
|
+
signature: "event SeedPublished(bytes32 seedUid, bytes32 versionUid)"
|
|
3049
|
+
});
|
|
3050
|
+
}
|
|
3051
|
+
function xe(e) {
|
|
3052
|
+
return e == null || e === "" ? $ : ("0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(64, "0").slice(-64)).toLowerCase();
|
|
3053
|
+
}
|
|
3054
|
+
function Pt(e, t, n) {
|
|
3055
|
+
if (!t || !e.logs?.length) return;
|
|
3056
|
+
const a = xe(t);
|
|
3057
|
+
if (a === $) return;
|
|
3058
|
+
const s = n ? us : La;
|
|
3059
|
+
try {
|
|
3060
|
+
const r = st({
|
|
3061
|
+
logs: e.logs,
|
|
3062
|
+
events: [s()],
|
|
3063
|
+
strict: !1
|
|
3064
|
+
});
|
|
3065
|
+
for (const o of r) {
|
|
3066
|
+
const i = o?.args?.result;
|
|
3067
|
+
if (i?.attestationUid && xe(i.schemaUid) === a) {
|
|
3068
|
+
const c = i.attestationUid;
|
|
3069
|
+
return c && xe(c) !== $ ? c : void 0;
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
} catch {
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
function Ut(e, t, n, a) {
|
|
3076
|
+
const s = t.toLowerCase(), r = e.logs?.filter((o) => o.address && o.address.toLowerCase() === s);
|
|
3077
|
+
if (r?.length)
|
|
3078
|
+
try {
|
|
3079
|
+
const c = st({
|
|
3080
|
+
logs: r,
|
|
3081
|
+
events: [(a ? ps : Ma)()],
|
|
3082
|
+
strict: !1
|
|
3083
|
+
})[0];
|
|
3084
|
+
if (!c) return;
|
|
3085
|
+
if (a) {
|
|
3086
|
+
const f = c.args?.seedUid;
|
|
3087
|
+
return f && xe(f) !== $ ? f : void 0;
|
|
3088
|
+
}
|
|
3089
|
+
const d = c.args?.returnedDataFromEAS;
|
|
3090
|
+
if (!d || d === "0x") return;
|
|
3091
|
+
const l = qn([{ type: "bytes32[]" }], d)[0];
|
|
3092
|
+
if (!l?.length) return;
|
|
3093
|
+
const h = l[n];
|
|
3094
|
+
return h && h !== $ ? h : l.length === 1 && l[0] && l[0] !== $ ? l[0] : void 0;
|
|
3095
|
+
} catch {
|
|
3096
|
+
return;
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
const de = 64, j = (e) => {
|
|
3100
|
+
if (e == null) return "0x" + "0".repeat(de);
|
|
3101
|
+
if (typeof e == "string")
|
|
3102
|
+
return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(de, "0").slice(-de);
|
|
3103
|
+
if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
|
|
3104
|
+
const t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
3105
|
+
return "0x" + Array.from(t).map((a) => a.toString(16).padStart(2, "0")).join("").padStart(de, "0").slice(-de);
|
|
3106
|
+
}
|
|
3107
|
+
return "0x" + "0".repeat(de);
|
|
3108
|
+
}, ms = (e) => {
|
|
3109
|
+
if (e == null || typeof e == "string" && (e === "" || e === "0x")) return "0x";
|
|
3110
|
+
if (typeof e == "string") {
|
|
3111
|
+
const n = (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0");
|
|
3112
|
+
return "0x" + (n.length % 2 === 1 ? "0" + n : n);
|
|
3113
|
+
}
|
|
3114
|
+
if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
|
|
3115
|
+
const t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
3116
|
+
return "0x" + Array.from(t).map((n) => n.toString(16).padStart(2, "0")).join("");
|
|
3117
|
+
}
|
|
3118
|
+
return "0x";
|
|
3119
|
+
};
|
|
3120
|
+
function fs(e) {
|
|
3121
|
+
const t = new Set(
|
|
3122
|
+
e.map((n) => n?.localId).filter((n) => !!n)
|
|
3123
|
+
);
|
|
3124
|
+
return e.some(
|
|
3125
|
+
(n) => (n?.listOfAttestations ?? []).some((a) => {
|
|
3126
|
+
const s = a;
|
|
3127
|
+
return s._unresolvedValue && t.has(s._unresolvedValue) ? !0 : Array.isArray(s._rawListIdsForResolve) ? s._rawListIdsForResolve.some((r) => r && t.has(String(r).trim())) : !1;
|
|
3128
|
+
})
|
|
3129
|
+
);
|
|
3130
|
+
}
|
|
3131
|
+
function hs(e, t) {
|
|
3132
|
+
return (e ?? []).filter(
|
|
3133
|
+
(n) => n.publishLocalId && t.has(n.publishLocalId)
|
|
3134
|
+
);
|
|
3135
|
+
}
|
|
3136
|
+
const ys = {
|
|
3137
|
+
recipient: Qe,
|
|
3138
|
+
expirationTime: BigInt(0),
|
|
3139
|
+
revocable: !0,
|
|
3140
|
+
refUID: $,
|
|
3141
|
+
data: $,
|
|
3142
|
+
value: BigInt(0)
|
|
3143
|
+
};
|
|
3144
|
+
function Ye(e) {
|
|
3145
|
+
const t = (e?.listOfAttestations ?? []).map((a) => {
|
|
3146
|
+
const s = Array.isArray(a?.data) ? a.data : [];
|
|
3147
|
+
return {
|
|
3148
|
+
schema: j(a?.schema),
|
|
3149
|
+
data: s.map((r) => ({
|
|
3150
|
+
...r,
|
|
3151
|
+
refUID: j(r?.refUID),
|
|
3152
|
+
data: ms(r?.data),
|
|
3153
|
+
expirationTime: r?.expirationTime != null ? BigInt(r.expirationTime) : BigInt(0),
|
|
3154
|
+
value: r?.value != null ? BigInt(r.value) : BigInt(0)
|
|
3155
|
+
}))
|
|
3156
|
+
};
|
|
3157
|
+
}), n = (e?.propertiesToUpdate ?? []).map((a) => ({
|
|
3158
|
+
...a,
|
|
3159
|
+
propertySchemaUid: j(a?.propertySchemaUid)
|
|
3160
|
+
}));
|
|
3161
|
+
return {
|
|
3162
|
+
...e,
|
|
3163
|
+
seedUid: j(e?.seedUid),
|
|
3164
|
+
seedSchemaUid: j(e?.seedSchemaUid),
|
|
3165
|
+
versionUid: j(e?.versionUid),
|
|
3166
|
+
versionSchemaUid: j(e?.versionSchemaUid),
|
|
3167
|
+
listOfAttestations: t,
|
|
3168
|
+
propertiesToUpdate: n
|
|
3169
|
+
};
|
|
3170
|
+
}
|
|
3171
|
+
function Tt(e, t) {
|
|
3172
|
+
for (const n of e)
|
|
3173
|
+
for (const a of n?.propertiesToUpdate ?? []) {
|
|
3174
|
+
const s = a?.publishLocalId, r = j(a?.propertySchemaUid);
|
|
3175
|
+
if (!s || !r) continue;
|
|
3176
|
+
const o = t.get(s);
|
|
3177
|
+
if (!o?.listOfAttestations) continue;
|
|
3178
|
+
const i = o.listOfAttestations.find(
|
|
3179
|
+
(c) => j(c?.schema)?.toLowerCase() === r?.toLowerCase()
|
|
3180
|
+
);
|
|
3181
|
+
i && (!Array.isArray(i.data) || i.data.length === 0) && (i.data = [{ ...ys, refUID: $ }]);
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
const gs = "pending_l1";
|
|
3185
|
+
async function dn(e) {
|
|
3186
|
+
const { useArweaveBundler: t } = C();
|
|
3187
|
+
if (!t) return;
|
|
3188
|
+
const n = e.arweaveTransactions ?? [], a = e.publishUploads ?? [];
|
|
3189
|
+
if (n.length === 0 || n.length !== a.length) return;
|
|
3190
|
+
const s = B.getAppDb();
|
|
3191
|
+
if (!s) return;
|
|
3192
|
+
const r = Date.now();
|
|
3193
|
+
for (let o = 0; o < n.length; o++) {
|
|
3194
|
+
const i = n[o], c = a[o];
|
|
3195
|
+
if (!c) continue;
|
|
3196
|
+
const u = i.transaction?.id;
|
|
3197
|
+
if (!(!u || typeof u != "string"))
|
|
3198
|
+
try {
|
|
3199
|
+
await s.insert(De).values({
|
|
3200
|
+
seedLocalId: c.seedLocalId,
|
|
3201
|
+
dataItemId: u,
|
|
3202
|
+
versionLocalId: c.versionLocalId ?? null,
|
|
3203
|
+
itemPropertyName: c.itemPropertyName ?? null,
|
|
3204
|
+
phase: gs,
|
|
3205
|
+
createdAt: r,
|
|
3206
|
+
updatedAt: r
|
|
3207
|
+
}).onConflictDoNothing();
|
|
3208
|
+
} catch {
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
const ws = K("seedProtocol:services:publish:actors"), bs = he(
|
|
3213
|
+
async ({ input: { context: e, event: t } }) => {
|
|
3214
|
+
const { address: n, account: a } = e, s = e.arweaveTransactions ?? [], r = e.publishUploads ?? [];
|
|
3215
|
+
let { item: o } = e;
|
|
3216
|
+
const { modularAccountModuleContract: i, useModularExecutor: c } = C();
|
|
3217
|
+
if (!n || typeof n != "string" || !n.trim())
|
|
3218
|
+
throw new Error("No wallet address for publish. Connect a wallet and try again.");
|
|
3219
|
+
if (!a)
|
|
3220
|
+
throw new Error("Wallet session is missing. Reconnect your wallet and retry the publish.");
|
|
3221
|
+
if (!o?.seedLocalId)
|
|
3222
|
+
throw new Error(
|
|
3223
|
+
"Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning."
|
|
3224
|
+
);
|
|
3225
|
+
typeof o.getPublishUploads != "function" && (o = await ct(o.seedLocalId));
|
|
3226
|
+
const d = s.length, p = r.length;
|
|
3227
|
+
if (d !== p)
|
|
3228
|
+
throw new Error(
|
|
3229
|
+
"Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning."
|
|
3230
|
+
);
|
|
3231
|
+
const l = V({
|
|
3232
|
+
client: R(),
|
|
3233
|
+
chain: v,
|
|
3234
|
+
address: n
|
|
3235
|
+
});
|
|
3236
|
+
let m = c && i ? V({
|
|
3237
|
+
client: R(),
|
|
3238
|
+
chain: v,
|
|
3239
|
+
address: i
|
|
3240
|
+
}) : l;
|
|
3241
|
+
await Oe(o, a, R(), v);
|
|
3242
|
+
const h = s.map(
|
|
3243
|
+
(w, U) => {
|
|
3244
|
+
const b = w.transaction?.id;
|
|
3245
|
+
if (!b || typeof b != "string")
|
|
3246
|
+
throw new Error(
|
|
3247
|
+
"Attestation recovery failed: Arweave transaction data did not survive restore. Delete this publish record and try a full publish from the beginning."
|
|
3248
|
+
);
|
|
3249
|
+
const M = r[U];
|
|
3250
|
+
if (!M) throw new Error("Publish upload index mismatch");
|
|
3251
|
+
return { ...M, txId: b };
|
|
3252
|
+
}
|
|
3253
|
+
);
|
|
3254
|
+
await cn(h.map((w) => w.txId));
|
|
3255
|
+
let y;
|
|
3256
|
+
try {
|
|
3257
|
+
y = await o.getPublishPayload(h, { publishMode: e.publishMode ?? "patch" });
|
|
3258
|
+
} catch (w) {
|
|
3259
|
+
throw w;
|
|
3260
|
+
}
|
|
3261
|
+
const f = Array.isArray(y) ? y : [y];
|
|
3262
|
+
let A = a;
|
|
3263
|
+
if (c) {
|
|
3264
|
+
const w = await sn();
|
|
3265
|
+
if (!w.ok)
|
|
3266
|
+
throw w.error;
|
|
3267
|
+
m = V({
|
|
3268
|
+
client: R(),
|
|
3269
|
+
chain: v,
|
|
3270
|
+
address: ft
|
|
3271
|
+
});
|
|
3272
|
+
const U = ot();
|
|
3273
|
+
await U.autoConnect({ client: R(), chain: v });
|
|
3274
|
+
const F = U.getAccount();
|
|
3275
|
+
if (!F)
|
|
3276
|
+
throw new Error("Failed to get modular account");
|
|
3277
|
+
A = F;
|
|
3278
|
+
}
|
|
3279
|
+
const g = c ? ft : n, I = f.length > 1 && fs(f);
|
|
3280
|
+
let S;
|
|
3281
|
+
if (I) {
|
|
3282
|
+
let w = structuredClone(f);
|
|
3283
|
+
const U = {};
|
|
3284
|
+
for (let b = 0; b < w.length; b++) {
|
|
3285
|
+
w = await mt(w, U);
|
|
3286
|
+
const M = w[b], X = /* @__PURE__ */ new Set([M.localId]), ge = {
|
|
3287
|
+
...M,
|
|
3288
|
+
propertiesToUpdate: hs(M.propertiesToUpdate, X)
|
|
3289
|
+
}, J = Ye(ge), Be = /* @__PURE__ */ new Map([[J.localId, J]]);
|
|
3290
|
+
Tt([J], Be);
|
|
3291
|
+
const Fe = {
|
|
3292
|
+
...bt({
|
|
3293
|
+
contract: m,
|
|
3294
|
+
requests: [J]
|
|
3295
|
+
}),
|
|
3296
|
+
gas: 5000000n
|
|
3297
|
+
}, Ne = await N({
|
|
3298
|
+
account: A,
|
|
3299
|
+
transaction: await Promise.resolve(Fe)
|
|
3300
|
+
}), se = await k({
|
|
3301
|
+
client: R(),
|
|
3302
|
+
chain: v,
|
|
3303
|
+
transactionHash: Ne.transactionHash
|
|
3304
|
+
});
|
|
3305
|
+
if (!se)
|
|
3306
|
+
throw new Error("Failed to send transaction");
|
|
3307
|
+
const re = !J.seedUid || j(J.seedUid) === $, fn = J?.listOfAttestations?.length ?? 0, hn = J?.seedSchemaUid;
|
|
3308
|
+
if (re) {
|
|
3309
|
+
const ke = Pt(se, hn, c) ?? Ut(
|
|
3310
|
+
se,
|
|
3311
|
+
g,
|
|
3312
|
+
fn,
|
|
3313
|
+
c
|
|
3314
|
+
);
|
|
3315
|
+
ke && (U[M.localId] = ke, w[b] = { ...w[b], seedUid: ke });
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
for (const b of w) {
|
|
3319
|
+
const M = b?.localId, X = b?.seedUid;
|
|
3320
|
+
M && X && j(X) !== $ && (U[M] = j(X));
|
|
3321
|
+
}
|
|
3322
|
+
S = (await mt(structuredClone(f), U)).map(
|
|
3323
|
+
(b) => Ye({
|
|
3324
|
+
...b,
|
|
3325
|
+
seedUid: U[b.localId] ?? b.seedUid
|
|
3326
|
+
})
|
|
3327
|
+
);
|
|
3328
|
+
} else {
|
|
3329
|
+
const w = f.map((re) => Ye(re)), U = new Map(w.map((re) => [re?.localId, re]));
|
|
3330
|
+
Tt(w, U);
|
|
3331
|
+
const F = Array.isArray(y) ? w : [w[0]], b = {
|
|
3332
|
+
...bt({
|
|
3333
|
+
contract: m,
|
|
3334
|
+
requests: F
|
|
3335
|
+
}),
|
|
3336
|
+
gas: 5000000n
|
|
3337
|
+
}, M = await N({
|
|
3338
|
+
account: A,
|
|
3339
|
+
transaction: await Promise.resolve(b)
|
|
3340
|
+
}), X = await k({
|
|
3341
|
+
client: R(),
|
|
3342
|
+
chain: v,
|
|
3343
|
+
transactionHash: M.transactionHash
|
|
3344
|
+
});
|
|
3345
|
+
if (!X)
|
|
3346
|
+
throw new Error("Failed to send transaction");
|
|
3347
|
+
const ge = w[0], J = ge?.seedUid, Be = J === $ || !J, Fe = ge?.listOfAttestations?.length ?? 0, Ne = ge?.seedSchemaUid, se = Be ? Pt(X, Ne, c) ?? Ut(
|
|
3348
|
+
X,
|
|
3349
|
+
g,
|
|
3350
|
+
Fe,
|
|
3351
|
+
c
|
|
3352
|
+
) : void 0;
|
|
3353
|
+
S = se && w.length > 0 ? [{ ...w[0], seedUid: se }, ...w.slice(1)] : w;
|
|
3354
|
+
}
|
|
3355
|
+
rn(o, S);
|
|
3356
|
+
const E = o, D = S.find((w) => w?.localId === o.seedLocalId)?.seedUid;
|
|
3357
|
+
return D && D !== $ && await on(E, n), ws("requestData", y), dn(e), { easPayload: y };
|
|
3358
|
+
}
|
|
3359
|
+
), Dt = K("seedProtocol:services:publish:verifyAttestations"), As = "0x" + "0".repeat(64), Pe = 64, xt = (e) => e == null ? "0x" + "0".repeat(Pe) : typeof e == "string" ? "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(Pe, "0").slice(-Pe) : "0x" + "0".repeat(Pe), vs = 5e3, Je = 6;
|
|
3360
|
+
async function Ss({
|
|
3361
|
+
normalizedRequests: e,
|
|
3362
|
+
item: t
|
|
3363
|
+
}) {
|
|
3364
|
+
const n = t.seedLocalId;
|
|
3365
|
+
for (const a of e) {
|
|
3366
|
+
if (a.listOfAttestations.length === 0 || a.versionUid === As) continue;
|
|
3367
|
+
const s = a.listOfAttestations.map(
|
|
3368
|
+
(d) => xt(d.schema).toLowerCase()
|
|
3369
|
+
);
|
|
3370
|
+
let r = [], o;
|
|
3371
|
+
for (let d = 1; d <= Je; d++)
|
|
3372
|
+
try {
|
|
3373
|
+
d > 1 && await new Promise((p) => setTimeout(p, vs)), r = await Rn({
|
|
3374
|
+
versionUids: [a.versionUid]
|
|
3375
|
+
});
|
|
3376
|
+
break;
|
|
3377
|
+
} catch (p) {
|
|
3378
|
+
if (o = p, Dt("verifyAttestations attempt %d failed:", d, p), d === Je)
|
|
3379
|
+
throw Dt("verifyAttestations: giving up after %d attempts", Je), o;
|
|
3380
|
+
}
|
|
3381
|
+
const i = r.map((d) => d.schemaId ? xt(d.schemaId).toLowerCase() : "").filter(Boolean), c = new Set(i);
|
|
3382
|
+
if (s.filter((d) => !c.has(d)).length > 0)
|
|
3383
|
+
throw new Yt(
|
|
3384
|
+
`Publish verification failed: Seed and Version attestations were created, but property/metadata attestations are missing or incomplete. Expected ${s.length} property attestations for schema(s) ${s.join(", ")}; found ${i.length}. Use PublishManager.retryAttestations('${n}') to retry.`,
|
|
3385
|
+
n,
|
|
3386
|
+
s,
|
|
3387
|
+
i,
|
|
3388
|
+
"METADATA_PROPERTIES_MISSING"
|
|
3389
|
+
);
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
const be = K("seedProtocol:services:publish:createAttestationsDirectToEas"), le = 64, z = (e) => {
|
|
3393
|
+
if (e == null) return "0x" + "0".repeat(le);
|
|
3394
|
+
if (typeof e == "string")
|
|
3395
|
+
return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(le, "0").slice(-le);
|
|
3396
|
+
if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
|
|
3397
|
+
const t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
3398
|
+
return "0x" + Array.from(t).map((a) => a.toString(16).padStart(2, "0")).join("").padStart(le, "0").slice(-le);
|
|
3399
|
+
}
|
|
3400
|
+
return "0x" + "0".repeat(le);
|
|
3401
|
+
}, Es = (e) => {
|
|
3402
|
+
if (e == null || typeof e == "string" && (e === "" || e === "0x")) return "0x";
|
|
3403
|
+
if (typeof e == "string") {
|
|
3404
|
+
const n = (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0");
|
|
3405
|
+
return "0x" + (n.length % 2 === 1 ? "0" + n : n);
|
|
3406
|
+
}
|
|
3407
|
+
if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
|
|
3408
|
+
const t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
3409
|
+
return "0x" + Array.from(t).map((n) => n.toString(16).padStart(2, "0")).join("");
|
|
3410
|
+
}
|
|
3411
|
+
return "0x";
|
|
3412
|
+
}, Is = async (e) => {
|
|
3413
|
+
let t;
|
|
3414
|
+
try {
|
|
3415
|
+
t = await ae.find({ seedLocalId: e });
|
|
3416
|
+
} catch {
|
|
3417
|
+
}
|
|
3418
|
+
return t || new Promise((n) => {
|
|
3419
|
+
const a = setInterval(() => {
|
|
3420
|
+
try {
|
|
3421
|
+
ae.find({ seedLocalId: e }).then((s) => {
|
|
3422
|
+
s && (clearInterval(a), n(s));
|
|
3423
|
+
});
|
|
3424
|
+
} catch {
|
|
3425
|
+
}
|
|
3426
|
+
}, 200);
|
|
3427
|
+
});
|
|
3428
|
+
}, Ps = he(
|
|
3429
|
+
async ({ input: { context: e, event: t } }) => {
|
|
3430
|
+
const { address: n, account: a } = e, s = e.arweaveTransactions ?? [], r = e.publishUploads ?? [];
|
|
3431
|
+
let { item: o } = e;
|
|
3432
|
+
if (!n || typeof n != "string" || !n.trim())
|
|
3433
|
+
throw new Error("No wallet address for publish. Connect a wallet and try again.");
|
|
3434
|
+
if (!a)
|
|
3435
|
+
throw new Error("Wallet session is missing. Reconnect your wallet and retry the publish.");
|
|
3436
|
+
if (!o?.seedLocalId)
|
|
3437
|
+
throw new Error(
|
|
3438
|
+
"Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning."
|
|
3439
|
+
);
|
|
3440
|
+
typeof o.getPublishUploads != "function" && (o = await Is(o.seedLocalId));
|
|
3441
|
+
const c = s.length, u = r.length;
|
|
3442
|
+
if (c !== u)
|
|
3443
|
+
throw new Error(
|
|
3444
|
+
"Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning."
|
|
3445
|
+
);
|
|
3446
|
+
await Oe(o, a, R(), v);
|
|
3447
|
+
const d = s.map(
|
|
3448
|
+
(g, I) => {
|
|
3449
|
+
const E = g.transaction?.id;
|
|
3450
|
+
if (!E || typeof E != "string")
|
|
3451
|
+
throw new Error(
|
|
3452
|
+
"Attestation recovery failed: Arweave transaction data did not survive restore. Delete this publish record and try a full publish from the beginning."
|
|
3453
|
+
);
|
|
3454
|
+
const W = r[I];
|
|
3455
|
+
if (!W) throw new Error("Publish upload index mismatch");
|
|
3456
|
+
return { ...W, txId: E };
|
|
3457
|
+
}
|
|
3458
|
+
);
|
|
3459
|
+
await cn(d.map((g) => g.txId));
|
|
3460
|
+
const p = await o.getPublishPayload(d, { publishMode: e.publishMode ?? "patch" }), m = (Array.isArray(p) ? p : [p]).map((g) => {
|
|
3461
|
+
const I = (g?.listOfAttestations ?? []).map((E) => {
|
|
3462
|
+
const W = Array.isArray(E?.data) ? E.data : [];
|
|
3463
|
+
return {
|
|
3464
|
+
schema: z(E?.schema),
|
|
3465
|
+
data: W.map((D) => ({
|
|
3466
|
+
...D,
|
|
3467
|
+
refUID: z(D?.refUID),
|
|
3468
|
+
data: Es(D?.data)
|
|
3469
|
+
}))
|
|
3470
|
+
};
|
|
3471
|
+
}), S = (g?.propertiesToUpdate ?? []).map((E) => ({
|
|
3472
|
+
...E,
|
|
3473
|
+
propertySchemaUid: z(E?.propertySchemaUid)
|
|
3474
|
+
}));
|
|
3475
|
+
return {
|
|
3476
|
+
...g,
|
|
3477
|
+
seedUid: z(g?.seedUid),
|
|
3478
|
+
seedSchemaUid: z(g?.seedSchemaUid),
|
|
3479
|
+
versionUid: z(g?.versionUid),
|
|
3480
|
+
versionSchemaUid: z(g?.versionSchemaUid),
|
|
3481
|
+
listOfAttestations: I,
|
|
3482
|
+
propertiesToUpdate: S
|
|
3483
|
+
};
|
|
3484
|
+
}), h = new Map(m.map((g) => [g.localId, g])), y = {
|
|
3485
|
+
recipient: Qe,
|
|
3486
|
+
expirationTime: BigInt(0),
|
|
3487
|
+
revocable: !0,
|
|
3488
|
+
refUID: q,
|
|
3489
|
+
data: q,
|
|
3490
|
+
value: BigInt(0)
|
|
3491
|
+
};
|
|
3492
|
+
for (const g of m)
|
|
3493
|
+
for (const I of g.propertiesToUpdate ?? []) {
|
|
3494
|
+
const S = I.publishLocalId, E = z(I.propertySchemaUid);
|
|
3495
|
+
if (!S || !E) continue;
|
|
3496
|
+
const W = h.get(S);
|
|
3497
|
+
if (!W?.listOfAttestations) continue;
|
|
3498
|
+
const D = W.listOfAttestations.find(
|
|
3499
|
+
(w) => z(w?.schema)?.toLowerCase() === E?.toLowerCase()
|
|
3500
|
+
);
|
|
3501
|
+
D && (!Array.isArray(D.data) || D.data.length === 0) && (D.data = [{ ...y, refUID: q }]);
|
|
3502
|
+
}
|
|
3503
|
+
const f = R();
|
|
3504
|
+
for (let g = 0; g < m.length; g++) {
|
|
3505
|
+
const I = m[g];
|
|
3506
|
+
let S = I.seedUid, E = I.versionUid;
|
|
3507
|
+
if (S === q) {
|
|
3508
|
+
const D = yt(f, v, {
|
|
3509
|
+
schema: I.seedSchemaUid,
|
|
3510
|
+
data: {
|
|
3511
|
+
refUID: q,
|
|
3512
|
+
data: We(I.seedSchemaUid),
|
|
3513
|
+
revocable: I.seedIsRevocable
|
|
3514
|
+
}
|
|
3515
|
+
}), w = await N({ account: a, transaction: D }), U = await k({
|
|
3516
|
+
client: f,
|
|
3517
|
+
chain: v,
|
|
3518
|
+
transactionHash: w.transactionHash
|
|
3519
|
+
});
|
|
3520
|
+
if (!U) throw new Error("Failed to create Seed attestation");
|
|
3521
|
+
const { easContractAddress: F } = C(), b = gt(U, F);
|
|
3522
|
+
if (!b || b === q)
|
|
3523
|
+
throw new Error("Failed to get Seed UID from attestation receipt");
|
|
3524
|
+
S = b, I.seedUid = b, be("created Seed attestation", S);
|
|
3525
|
+
}
|
|
3526
|
+
if (S !== q && E === q) {
|
|
3527
|
+
const D = yt(f, v, {
|
|
3528
|
+
schema: I.versionSchemaUid,
|
|
3529
|
+
data: {
|
|
3530
|
+
refUID: S,
|
|
3531
|
+
data: We(I.versionSchemaUid),
|
|
3532
|
+
revocable: !0
|
|
3533
|
+
}
|
|
3534
|
+
}), w = await N({ account: a, transaction: D }), U = await k({
|
|
3535
|
+
client: f,
|
|
3536
|
+
chain: v,
|
|
3537
|
+
transactionHash: w.transactionHash
|
|
3538
|
+
});
|
|
3539
|
+
if (!U) throw new Error("Failed to create Version attestation");
|
|
3540
|
+
const { easContractAddress: F } = C(), b = gt(U, F);
|
|
3541
|
+
if (!b || b === q)
|
|
3542
|
+
throw new Error("Failed to get Version UID from attestation receipt");
|
|
3543
|
+
E = b, I.versionUid = b, await _n({
|
|
3544
|
+
seedLocalId: I.localId,
|
|
3545
|
+
versionUid: b,
|
|
3546
|
+
publisher: n
|
|
3547
|
+
}), be("created Version attestation", E);
|
|
3548
|
+
}
|
|
3549
|
+
for (const D of I.listOfAttestations)
|
|
3550
|
+
for (const w of D.data)
|
|
3551
|
+
w.refUID = E;
|
|
3552
|
+
for (const D of I.propertiesToUpdate ?? []) {
|
|
3553
|
+
const w = h.get(D.publishLocalId);
|
|
3554
|
+
if (!w?.listOfAttestations) continue;
|
|
3555
|
+
const U = z(D.propertySchemaUid), F = w.listOfAttestations.find(
|
|
3556
|
+
(b) => z(b?.schema)?.toLowerCase() === U?.toLowerCase()
|
|
3557
|
+
);
|
|
3558
|
+
F?.data?.[0] && (F.data[0].data = We(S));
|
|
3559
|
+
}
|
|
3560
|
+
const W = I.listOfAttestations.map((D) => ({
|
|
3561
|
+
schema: D.schema,
|
|
3562
|
+
data: D.data.map((w) => ({
|
|
3563
|
+
recipient: w.recipient ?? Qe,
|
|
3564
|
+
expirationTime: w.expirationTime ?? 0n,
|
|
3565
|
+
revocable: w.revocable ?? !0,
|
|
3566
|
+
refUID: w.refUID ?? q,
|
|
3567
|
+
data: w.data ?? "0x",
|
|
3568
|
+
value: w.value ?? 0n
|
|
3569
|
+
}))
|
|
3570
|
+
}));
|
|
3571
|
+
if (W.length > 0) {
|
|
3572
|
+
const D = ya(f, v, W), w = await N({ account: a, transaction: D });
|
|
3573
|
+
if (!await k({
|
|
3574
|
+
client: f,
|
|
3575
|
+
chain: v,
|
|
3576
|
+
transactionHash: w.transactionHash
|
|
3577
|
+
})) throw new Error("Failed to create property attestations");
|
|
3578
|
+
be("created property attestations for request", g);
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
rn(o, m);
|
|
3582
|
+
const A = o;
|
|
3583
|
+
m[0]?.seedUid && m[0].seedUid !== q && await on(A, n);
|
|
3584
|
+
try {
|
|
3585
|
+
await Ss({ normalizedRequests: m, item: o });
|
|
3586
|
+
} catch (g) {
|
|
3587
|
+
throw g instanceof Yt || be("verifyAttestations failed (non-verification error):", g), g;
|
|
3588
|
+
}
|
|
3589
|
+
return be("direct EAS publish complete"), dn(e), { easPayload: p };
|
|
3590
|
+
}
|
|
3591
|
+
), Us = async (e) => {
|
|
3592
|
+
let t;
|
|
3593
|
+
try {
|
|
3594
|
+
t = await ae.find({ seedLocalId: e });
|
|
3595
|
+
} catch {
|
|
3596
|
+
}
|
|
3597
|
+
return t || new Promise((n) => {
|
|
3598
|
+
const a = setInterval(() => {
|
|
3599
|
+
ae.find({ seedLocalId: e }).then((s) => {
|
|
3600
|
+
s && (clearInterval(a), n(s));
|
|
3601
|
+
}).catch(() => {
|
|
3602
|
+
});
|
|
3603
|
+
}, 200);
|
|
3604
|
+
});
|
|
3605
|
+
};
|
|
3606
|
+
async function Ts(e) {
|
|
3607
|
+
const n = typeof e.getPublishUploads == "function" ? e : await Us(e.seedLocalId);
|
|
3608
|
+
return await Ln(n);
|
|
3609
|
+
}
|
|
3610
|
+
const ue = /* @__PURE__ */ new Set(), Ds = ye(({ sendBack: e, input: { context: t } }) => {
|
|
3611
|
+
const { item: n, account: a, publishMode: s } = t;
|
|
3612
|
+
return (async () => {
|
|
3613
|
+
if (!await Ot(n)) {
|
|
3614
|
+
e({ type: "notOwner" });
|
|
3615
|
+
return;
|
|
3616
|
+
}
|
|
3617
|
+
if (ue.has(n.seedLocalId)) {
|
|
3618
|
+
e({
|
|
3619
|
+
type: "redundantPublishProcess"
|
|
3620
|
+
});
|
|
3621
|
+
return;
|
|
3622
|
+
}
|
|
3623
|
+
ue.add(n.seedLocalId);
|
|
3624
|
+
try {
|
|
3625
|
+
a && await Oe(n, a, R(), v);
|
|
3626
|
+
const i = await Mn(n, [], {
|
|
3627
|
+
publishMode: s ?? "patch"
|
|
3628
|
+
});
|
|
3629
|
+
if (!i.isValid) {
|
|
3630
|
+
ue.delete(n.seedLocalId), e({ type: "validationFailed", errors: i.errors });
|
|
3631
|
+
return;
|
|
3632
|
+
}
|
|
3633
|
+
if (await Ts(n)) {
|
|
3634
|
+
const u = C().useArweaveBundler;
|
|
3635
|
+
e({ type: u ? "validPublishProcessBundler" : "validPublishProcess" });
|
|
3636
|
+
} else
|
|
3637
|
+
e({ type: "skipArweave" });
|
|
3638
|
+
} catch (i) {
|
|
3639
|
+
ue.delete(n.seedLocalId), console.error("[checking] itemNeedsArweaveUpload failed", i), e({ type: "skipArweave" });
|
|
3640
|
+
}
|
|
3641
|
+
})().catch(() => {
|
|
3642
|
+
ue.delete(n.seedLocalId), e({ type: "validPublishProcess" });
|
|
3643
|
+
}), () => {
|
|
3644
|
+
ue.delete(n.seedLocalId);
|
|
3645
|
+
};
|
|
3646
|
+
}), {
|
|
3647
|
+
SUCCESS: ze,
|
|
3648
|
+
FAILURE: Ze
|
|
3649
|
+
} = L;
|
|
3650
|
+
function ee(e) {
|
|
3651
|
+
const t = e;
|
|
3652
|
+
return t.error ?? t.data;
|
|
3653
|
+
}
|
|
3654
|
+
const ln = Ht({
|
|
3655
|
+
types: {
|
|
3656
|
+
context: {},
|
|
3657
|
+
input: {}
|
|
3658
|
+
},
|
|
3659
|
+
actors: {
|
|
3660
|
+
createArweaveTransactions: Fa,
|
|
3661
|
+
createArweaveDataItems: za,
|
|
3662
|
+
sendReimbursementRequest: ts,
|
|
3663
|
+
pollForConfirmation: ns,
|
|
3664
|
+
uploadData: ss,
|
|
3665
|
+
uploadViaBundler: rs,
|
|
3666
|
+
createAttestations: bs,
|
|
3667
|
+
createAttestationsDirectToEas: Ps,
|
|
3668
|
+
checking: Ds
|
|
3669
|
+
},
|
|
3670
|
+
actions: {
|
|
3671
|
+
/** Log error; error/errorStep are assigned per transition. Supports both event.error (custom events) and event.data (XState fromPromise invoke errors). */
|
|
3672
|
+
handleError: ({ event: e }) => {
|
|
3673
|
+
const t = ee(e);
|
|
3674
|
+
t != null ? console.error(t) : console.error("Unknown error (full event):", e);
|
|
3675
|
+
},
|
|
3676
|
+
assignErrorCreatingArweaveTransactions: T({
|
|
3677
|
+
error: ({ event: e }) => ee(e),
|
|
3678
|
+
errorStep: () => "creatingArweaveTransactions"
|
|
3679
|
+
}),
|
|
3680
|
+
assignErrorCreatingArweaveDataItems: T({
|
|
3681
|
+
error: ({ event: e }) => ee(e),
|
|
3682
|
+
errorStep: () => "creatingArweaveDataItems"
|
|
3683
|
+
}),
|
|
3684
|
+
assignErrorSendingReimbursementRequest: T({
|
|
3685
|
+
error: ({ event: e }) => ee(e),
|
|
3686
|
+
errorStep: () => "sendingReimbursementRequest"
|
|
3687
|
+
}),
|
|
3688
|
+
assignErrorPollingForConfirmation: T({
|
|
3689
|
+
error: ({ event: e }) => ee(e),
|
|
3690
|
+
errorStep: () => "pollingForConfirmation"
|
|
3691
|
+
}),
|
|
3692
|
+
assignErrorUploadingData: T({
|
|
3693
|
+
error: ({ event: e }) => ee(e),
|
|
3694
|
+
errorStep: () => "uploadingData"
|
|
3695
|
+
}),
|
|
3696
|
+
assignErrorUploadingViaBundler: T({
|
|
3697
|
+
error: ({ event: e }) => ee(e),
|
|
3698
|
+
errorStep: () => "uploadingViaBundler"
|
|
3699
|
+
}),
|
|
3700
|
+
assignErrorCreatingAttestations: T({
|
|
3701
|
+
error: ({ event: e }) => ee(e),
|
|
3702
|
+
errorStep: () => "creatingAttestations"
|
|
3703
|
+
}),
|
|
3704
|
+
assignErrorCreatingAttestationsDirectToEas: T({
|
|
3705
|
+
error: ({ event: e }) => ee(e),
|
|
3706
|
+
errorStep: () => "creatingAttestationsDirectToEas"
|
|
3707
|
+
}),
|
|
3708
|
+
assignAccountFromRetry: T({
|
|
3709
|
+
account: ({ event: e }) => e.account
|
|
3710
|
+
}),
|
|
3711
|
+
assignErrorNotOwner: T({
|
|
3712
|
+
error: () => new Error("Item is read-only: you do not own this item. Only the publisher can publish."),
|
|
3713
|
+
errorStep: () => "checking"
|
|
3714
|
+
}),
|
|
3715
|
+
assignErrorValidationFailed: T({
|
|
3716
|
+
error: ({ event: e }) => {
|
|
3717
|
+
const n = e.errors ?? [], a = n.length > 0 ? `Validation failed (${n.length} error${n.length === 1 ? "" : "s"}):
|
|
3718
|
+
${n.map((r) => r.message).join(`
|
|
3719
|
+
`)}` : "Validation failed", s = new Error(a);
|
|
3720
|
+
return s.validationErrors = n, s;
|
|
3721
|
+
},
|
|
3722
|
+
errorStep: () => "checking"
|
|
3723
|
+
})
|
|
3724
|
+
}
|
|
3725
|
+
}).createMachine({
|
|
3726
|
+
id: "publish",
|
|
3727
|
+
initial: "checking",
|
|
3728
|
+
context: ({ input: e }) => e,
|
|
3729
|
+
states: {
|
|
3730
|
+
checking: {
|
|
3731
|
+
on: {
|
|
3732
|
+
notOwner: {
|
|
3733
|
+
target: Ze,
|
|
3734
|
+
actions: ["assignErrorNotOwner", "handleError"]
|
|
3735
|
+
},
|
|
3736
|
+
validationFailed: {
|
|
3737
|
+
target: Ze,
|
|
3738
|
+
actions: ["assignErrorValidationFailed", "handleError"]
|
|
3739
|
+
},
|
|
3740
|
+
redundantPublishProcess: {
|
|
3741
|
+
target: "stopping"
|
|
3742
|
+
},
|
|
3743
|
+
validPublishProcess: {
|
|
3744
|
+
target: "creatingArweaveTransactions"
|
|
3745
|
+
},
|
|
3746
|
+
validPublishProcessBundler: {
|
|
3747
|
+
target: "creatingArweaveDataItems"
|
|
3748
|
+
},
|
|
3749
|
+
skipArweave: [
|
|
3750
|
+
{
|
|
3751
|
+
guard: () => C().useDirectEas,
|
|
3752
|
+
target: "creatingAttestationsDirectToEas",
|
|
3753
|
+
actions: T({
|
|
3754
|
+
arweaveTransactions: () => [],
|
|
3755
|
+
publishUploads: () => []
|
|
3756
|
+
})
|
|
3757
|
+
},
|
|
3758
|
+
{
|
|
3759
|
+
guard: () => !C().useDirectEas,
|
|
3760
|
+
target: "creatingAttestations",
|
|
3761
|
+
actions: T({
|
|
3762
|
+
arweaveTransactions: () => [],
|
|
3763
|
+
publishUploads: () => []
|
|
3764
|
+
})
|
|
3765
|
+
}
|
|
3766
|
+
]
|
|
3767
|
+
},
|
|
3768
|
+
invoke: {
|
|
3769
|
+
src: "checking",
|
|
3770
|
+
input: ({ context: e }) => ({ context: e })
|
|
3771
|
+
}
|
|
3772
|
+
},
|
|
3773
|
+
creatingArweaveTransactions: {
|
|
3774
|
+
invoke: {
|
|
3775
|
+
src: "createArweaveTransactions",
|
|
3776
|
+
input: ({ context: e, event: t }) => ({ context: e, event: t }),
|
|
3777
|
+
onDone: {
|
|
3778
|
+
target: "sendingReimbursementRequest",
|
|
3779
|
+
actions: T({
|
|
3780
|
+
arweaveTransactions: ({ event: e }) => e.output.arweaveTransactions,
|
|
3781
|
+
publishUploads: ({ event: e }) => e.output.publishUploads
|
|
3782
|
+
})
|
|
3783
|
+
},
|
|
3784
|
+
onError: {
|
|
3785
|
+
target: "failure",
|
|
3786
|
+
actions: ["assignErrorCreatingArweaveTransactions", "handleError"]
|
|
3787
|
+
}
|
|
3788
|
+
}
|
|
3789
|
+
},
|
|
3790
|
+
creatingArweaveDataItems: {
|
|
3791
|
+
invoke: {
|
|
3792
|
+
src: "createArweaveDataItems",
|
|
3793
|
+
input: ({ context: e, event: t }) => ({ context: e, event: t }),
|
|
3794
|
+
onDone: {
|
|
3795
|
+
target: "uploadingViaBundler",
|
|
3796
|
+
actions: T({
|
|
3797
|
+
arweaveTransactions: ({ event: e }) => e.output.arweaveTransactions,
|
|
3798
|
+
publishUploads: ({ event: e }) => e.output.publishUploads,
|
|
3799
|
+
arweaveUploadData: ({ event: e }) => e.output.arweaveUploadData,
|
|
3800
|
+
signedDataItems: ({ event: e }) => e.output.signedDataItems
|
|
3801
|
+
})
|
|
3802
|
+
},
|
|
3803
|
+
onError: {
|
|
3804
|
+
target: "failure",
|
|
3805
|
+
actions: ["assignErrorCreatingArweaveDataItems", "handleError"]
|
|
3806
|
+
}
|
|
3807
|
+
}
|
|
3808
|
+
},
|
|
3809
|
+
sendingReimbursementRequest: {
|
|
3810
|
+
invoke: {
|
|
3811
|
+
src: "sendReimbursementRequest",
|
|
3812
|
+
input: ({ context: e, event: t }) => ({ context: e, event: t }),
|
|
3813
|
+
onDone: {
|
|
3814
|
+
target: "pollingForConfirmation",
|
|
3815
|
+
actions: T({
|
|
3816
|
+
requestResponse: ({ event: e }) => e.output,
|
|
3817
|
+
reimbursementTransactionId: ({ event: e }) => e.output.transactionId
|
|
3818
|
+
})
|
|
3819
|
+
},
|
|
3820
|
+
onError: {
|
|
3821
|
+
target: "failure",
|
|
3822
|
+
actions: ["assignErrorSendingReimbursementRequest", "handleError"]
|
|
3823
|
+
}
|
|
3824
|
+
}
|
|
3825
|
+
},
|
|
3826
|
+
pollingForConfirmation: {
|
|
3827
|
+
invoke: {
|
|
3828
|
+
src: "pollForConfirmation",
|
|
3829
|
+
input: ({ context: e, event: t }) => ({ context: e, event: t }),
|
|
3830
|
+
onDone: {
|
|
3831
|
+
target: "uploadingData",
|
|
3832
|
+
actions: T({
|
|
3833
|
+
reimbursementConfirmed: !0
|
|
3834
|
+
})
|
|
3835
|
+
},
|
|
3836
|
+
onError: {
|
|
3837
|
+
target: "failure",
|
|
3838
|
+
actions: ["assignErrorPollingForConfirmation", "handleError"]
|
|
3839
|
+
}
|
|
3840
|
+
}
|
|
3841
|
+
},
|
|
3842
|
+
uploadingViaBundler: {
|
|
3843
|
+
on: {
|
|
3844
|
+
uploadComplete: [
|
|
3845
|
+
{
|
|
3846
|
+
guard: () => C().useDirectEas,
|
|
3847
|
+
target: "creatingAttestationsDirectToEas",
|
|
3848
|
+
actions: T({
|
|
3849
|
+
completionPercentage: 100
|
|
3850
|
+
})
|
|
3851
|
+
},
|
|
3852
|
+
{
|
|
3853
|
+
guard: () => !C().useDirectEas,
|
|
3854
|
+
target: "creatingAttestations",
|
|
3855
|
+
actions: T({
|
|
3856
|
+
completionPercentage: 100
|
|
3857
|
+
})
|
|
3858
|
+
}
|
|
3859
|
+
],
|
|
3860
|
+
uploadError: {
|
|
3861
|
+
target: "failure",
|
|
3862
|
+
actions: ["assignErrorUploadingViaBundler", "handleError"]
|
|
3863
|
+
}
|
|
3864
|
+
},
|
|
3865
|
+
invoke: {
|
|
3866
|
+
src: "uploadViaBundler",
|
|
3867
|
+
input: ({ context: e }) => ({ context: e })
|
|
3868
|
+
}
|
|
3869
|
+
},
|
|
3870
|
+
uploadingData: {
|
|
3871
|
+
on: {
|
|
3872
|
+
updatePercentage: {
|
|
3873
|
+
actions: T({
|
|
3874
|
+
completionPercentage: ({ event: e }) => e.completionPercentage,
|
|
3875
|
+
uploaderState: ({ event: e }) => e.uploaderState,
|
|
3876
|
+
currentTransactionIndex: ({ event: e }) => e.currentTransactionIndex
|
|
3877
|
+
})
|
|
3878
|
+
},
|
|
3879
|
+
uploadComplete: [
|
|
3880
|
+
{
|
|
3881
|
+
guard: () => C().useDirectEas,
|
|
3882
|
+
target: "creatingAttestationsDirectToEas",
|
|
3883
|
+
actions: T({
|
|
3884
|
+
completionPercentage: 100
|
|
3885
|
+
})
|
|
3886
|
+
},
|
|
3887
|
+
{
|
|
3888
|
+
guard: () => !C().useDirectEas,
|
|
3889
|
+
target: "creatingAttestations",
|
|
3890
|
+
actions: T({
|
|
3891
|
+
completionPercentage: 100
|
|
3892
|
+
})
|
|
3893
|
+
}
|
|
3894
|
+
],
|
|
3895
|
+
uploadError: {
|
|
3896
|
+
target: "failure",
|
|
3897
|
+
actions: ["assignErrorUploadingData", "handleError"]
|
|
3898
|
+
}
|
|
3899
|
+
},
|
|
3900
|
+
invoke: {
|
|
3901
|
+
src: "uploadData",
|
|
3902
|
+
input: ({ context: e }) => ({ context: e })
|
|
3903
|
+
}
|
|
3904
|
+
},
|
|
3905
|
+
creatingAttestations: {
|
|
3906
|
+
invoke: {
|
|
3907
|
+
src: "createAttestations",
|
|
3908
|
+
input: ({ context: e, event: t }) => ({ context: e, event: t }),
|
|
3909
|
+
onDone: {
|
|
3910
|
+
target: ze,
|
|
3911
|
+
actions: T({
|
|
3912
|
+
easPayload: ({ event: e }) => e.output?.easPayload
|
|
3913
|
+
})
|
|
3914
|
+
},
|
|
3915
|
+
onError: {
|
|
3916
|
+
target: "attestationFailureRecoverable",
|
|
3917
|
+
actions: ["assignErrorCreatingAttestations", "handleError"]
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
},
|
|
3921
|
+
attestationFailureRecoverable: {
|
|
3922
|
+
on: {
|
|
3923
|
+
retry: {
|
|
3924
|
+
target: "creatingAttestations",
|
|
3925
|
+
actions: ["assignAccountFromRetry"]
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
},
|
|
3929
|
+
creatingAttestationsDirectToEas: {
|
|
3930
|
+
invoke: {
|
|
3931
|
+
src: "createAttestationsDirectToEas",
|
|
3932
|
+
input: ({ context: e, event: t }) => ({ context: e, event: t }),
|
|
3933
|
+
onDone: {
|
|
3934
|
+
target: ze,
|
|
3935
|
+
actions: T({
|
|
3936
|
+
easPayload: ({ event: e }) => e.output?.easPayload
|
|
3937
|
+
})
|
|
3938
|
+
},
|
|
3939
|
+
onError: {
|
|
3940
|
+
target: "attestationFailureRecoverableDirectToEas",
|
|
3941
|
+
actions: ["assignErrorCreatingAttestationsDirectToEas", "handleError"]
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
},
|
|
3945
|
+
attestationFailureRecoverableDirectToEas: {
|
|
3946
|
+
on: {
|
|
3947
|
+
retry: {
|
|
3948
|
+
target: "creatingAttestationsDirectToEas",
|
|
3949
|
+
actions: ["assignAccountFromRetry"]
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
},
|
|
3953
|
+
stopping: {
|
|
3954
|
+
entry: ({ context: e }) => {
|
|
3955
|
+
console.log(`Actor for ${e.item?.seedLocalId} stopped`);
|
|
3956
|
+
},
|
|
3957
|
+
type: "final"
|
|
3958
|
+
},
|
|
3959
|
+
[ze]: {
|
|
3960
|
+
type: "final"
|
|
3961
|
+
},
|
|
3962
|
+
[Ze]: {
|
|
3963
|
+
type: "final"
|
|
3964
|
+
}
|
|
3965
|
+
}
|
|
3966
|
+
}), xs = T(({ context: e, event: t }) => {
|
|
3967
|
+
const n = t, a = n.publishProcesses ?? /* @__PURE__ */ new Map(), s = n.subscriptions ?? /* @__PURE__ */ new Map();
|
|
3968
|
+
return {
|
|
3969
|
+
publishProcesses: new Map(a),
|
|
3970
|
+
subscriptions: new Map(
|
|
3971
|
+
s
|
|
3972
|
+
)
|
|
3973
|
+
};
|
|
3974
|
+
});
|
|
3975
|
+
let un = null;
|
|
3976
|
+
function Cs(e) {
|
|
3977
|
+
un = e;
|
|
3978
|
+
}
|
|
3979
|
+
function Rs() {
|
|
3980
|
+
return un;
|
|
3981
|
+
}
|
|
3982
|
+
const Ct = K("seedProtocol:services:PublishManager:actors:subscribe");
|
|
3983
|
+
function Rt(e) {
|
|
3984
|
+
const t = e.value;
|
|
3985
|
+
return typeof t == "string" ? t : t && typeof t == "object" ? Object.keys(t)[0] ?? "" : "";
|
|
3986
|
+
}
|
|
3987
|
+
function Ke(e) {
|
|
3988
|
+
return ia.includes(e);
|
|
3989
|
+
}
|
|
3990
|
+
const pn = ye(
|
|
3991
|
+
({ receive: e, input: { publishProcess: t, seedLocalId: n } }) => {
|
|
3992
|
+
const a = Rs();
|
|
3993
|
+
let s = null;
|
|
3994
|
+
const r = () => {
|
|
3995
|
+
s != null && (clearInterval(s), s = null);
|
|
3996
|
+
}, o = (c) => {
|
|
3997
|
+
const u = Rt(c);
|
|
3998
|
+
Ke(u) && s == null && a ? s = setInterval(() => {
|
|
3999
|
+
try {
|
|
4000
|
+
const d = t.getSnapshot();
|
|
4001
|
+
if (d.status === "done") {
|
|
4002
|
+
r();
|
|
4003
|
+
return;
|
|
4004
|
+
}
|
|
4005
|
+
const p = Rt(d);
|
|
4006
|
+
if (!Ke(p)) {
|
|
4007
|
+
r();
|
|
4008
|
+
return;
|
|
4009
|
+
}
|
|
4010
|
+
} catch {
|
|
4011
|
+
return;
|
|
4012
|
+
}
|
|
4013
|
+
a?.savePublish(n, t);
|
|
4014
|
+
}, ca) : Ke(u) || r();
|
|
4015
|
+
}, i = t.subscribe(async (c) => {
|
|
4016
|
+
Ct("Publish state:", c.value), a && (c.status === "done" ? (r(), a.savePublish(n, t, { triggerPublishDone: !0 })) : (a.savePublish(n, t), o(c)));
|
|
4017
|
+
});
|
|
4018
|
+
e(({ type: c }) => {
|
|
4019
|
+
c === "UNSUBSCRIBE" && (Ct("Received UNSUBSCRIBE event"), r(), i.unsubscribe(), a?.removeSubscription(n));
|
|
4020
|
+
});
|
|
4021
|
+
}
|
|
4022
|
+
), _s = Le(({ event: e, enqueue: t }) => {
|
|
4023
|
+
const n = e, { item: a, address: s, account: r, options: o } = n;
|
|
4024
|
+
if (!(s != null && typeof s == "string" && s.trim().length > 0)) {
|
|
4025
|
+
console.warn("[createPublish] No valid wallet address; skipping spawn.");
|
|
4026
|
+
return;
|
|
4027
|
+
}
|
|
4028
|
+
t.assign(({ context: c, spawn: u }) => {
|
|
4029
|
+
const { publishProcesses: d } = c;
|
|
4030
|
+
if (d && d.has(a.seedLocalId))
|
|
4031
|
+
return console.warn(`Publish process with seedLocalId "${a.seedLocalId}" already exists.`), c;
|
|
4032
|
+
const p = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `run_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`, l = u(ln, {
|
|
4033
|
+
input: {
|
|
4034
|
+
item: a,
|
|
4035
|
+
address: s,
|
|
4036
|
+
account: r,
|
|
4037
|
+
modelName: a.modelName,
|
|
4038
|
+
schemaId: a.schemaUid,
|
|
4039
|
+
signDataItems: o?.signDataItems,
|
|
4040
|
+
dataItemSigner: o?.dataItemSigner,
|
|
4041
|
+
signArweaveTransactions: o?.signArweaveTransactions,
|
|
4042
|
+
arweaveJwk: o?.arweaveJwk,
|
|
4043
|
+
publishMode: o?.publishMode ?? "patch",
|
|
4044
|
+
publishRunId: p
|
|
4045
|
+
}
|
|
4046
|
+
});
|
|
4047
|
+
return d.set(a.seedLocalId, l), {
|
|
4048
|
+
publishProcesses: new Map(d)
|
|
4049
|
+
};
|
|
4050
|
+
}), t.assign(({ context: c, spawn: u }) => {
|
|
4051
|
+
const { subscriptions: d, publishProcesses: p } = c, l = p.get(a.seedLocalId);
|
|
4052
|
+
if (!l)
|
|
4053
|
+
return console.warn(`Publish process with seedLocalId "${a.seedLocalId}" does not exist.`), c;
|
|
4054
|
+
if (d && d.has(a.seedLocalId))
|
|
4055
|
+
return console.warn(`Subscription with seedLocalId "${a.seedLocalId}" already exists.`), c;
|
|
4056
|
+
const m = u(pn, {
|
|
4057
|
+
input: { publishProcess: l, seedLocalId: a.seedLocalId }
|
|
4058
|
+
});
|
|
4059
|
+
return d.set(a.seedLocalId, m), {
|
|
4060
|
+
subscriptions: new Map(d)
|
|
4061
|
+
};
|
|
4062
|
+
});
|
|
4063
|
+
}), Ls = ({
|
|
4064
|
+
context: e,
|
|
4065
|
+
event: t
|
|
4066
|
+
}) => {
|
|
4067
|
+
const n = t, { seedLocalId: a, account: s } = n, r = e.publishProcesses.get(a);
|
|
4068
|
+
if (!r) {
|
|
4069
|
+
console.warn(`Publish process with seedLocalId "${a}" does not exist.`);
|
|
4070
|
+
return;
|
|
4071
|
+
}
|
|
4072
|
+
r.send({ type: "retry", account: s });
|
|
4073
|
+
}, Ms = Le(({ context: e, event: t, enqueue: n }) => {
|
|
4074
|
+
const { publishProcesses: a, subscriptions: s } = e, { seedLocalId: r } = t, o = a.get(r);
|
|
4075
|
+
if (!o) {
|
|
4076
|
+
console.warn(`Publish process with seedLocalId "${r}" does not exist.`);
|
|
4077
|
+
return;
|
|
4078
|
+
}
|
|
4079
|
+
n.stopChild(o);
|
|
4080
|
+
const i = s.get(r);
|
|
4081
|
+
i && n.stopChild(i);
|
|
4082
|
+
const c = new Map(a);
|
|
4083
|
+
c.delete(r);
|
|
4084
|
+
const u = new Map(s);
|
|
4085
|
+
u.delete(r), n.assign({
|
|
4086
|
+
publishProcesses: c,
|
|
4087
|
+
subscriptions: u
|
|
4088
|
+
});
|
|
4089
|
+
}), Os = K("seedProtocol:PublishManager:index"), Bs = Le(({ context: e, enqueue: t }) => {
|
|
4090
|
+
Os("Stopping all actors..."), e.publishProcesses.forEach((n) => {
|
|
4091
|
+
t.stopChild(n);
|
|
4092
|
+
}), e.subscriptions.forEach((n) => {
|
|
4093
|
+
t.stopChild(n);
|
|
4094
|
+
}), t.assign({
|
|
4095
|
+
publishProcesses: /* @__PURE__ */ new Map(),
|
|
4096
|
+
subscriptions: /* @__PURE__ */ new Map()
|
|
4097
|
+
});
|
|
4098
|
+
}), Fs = Le(({ context: e, event: t, enqueue: n }) => {
|
|
4099
|
+
const { seedLocalId: a } = t, s = e.publishProcesses.get(a);
|
|
4100
|
+
if (!s) {
|
|
4101
|
+
console.warn(`Publish process with seedLocalId "${a}" does not exist.`);
|
|
4102
|
+
return;
|
|
4103
|
+
}
|
|
4104
|
+
n.stopChild(s);
|
|
4105
|
+
const r = e.subscriptions.get(a);
|
|
4106
|
+
r && n.stopChild(r);
|
|
4107
|
+
const o = new Map(e.publishProcesses);
|
|
4108
|
+
o.delete(a);
|
|
4109
|
+
const i = new Map(e.subscriptions);
|
|
4110
|
+
i.delete(a), n.assign({
|
|
4111
|
+
publishProcesses: o,
|
|
4112
|
+
subscriptions: i
|
|
4113
|
+
});
|
|
4114
|
+
}), Ns = T(({ context: e, event: t }) => {
|
|
4115
|
+
const { subscriptions: n } = e, { seedLocalId: a, newSubscription: s } = t;
|
|
4116
|
+
return s && n.set(a, s), {
|
|
4117
|
+
subscriptions: new Map(n)
|
|
4118
|
+
};
|
|
4119
|
+
}), Ue = K("seedProtocol:services:PublishManager:actors:savePublish"), _t = /* @__PURE__ */ new Map();
|
|
4120
|
+
function ks(e, t) {
|
|
4121
|
+
const a = (_t.get(e) ?? Promise.resolve()).then(t);
|
|
4122
|
+
return _t.set(e, a.catch(() => {
|
|
4123
|
+
})), a;
|
|
4124
|
+
}
|
|
4125
|
+
function Hs(e) {
|
|
4126
|
+
return e.status === "done" ? e.value === "success" ? "completed" : e.value === "failure" ? "failed" : "completed" : "in_progress";
|
|
4127
|
+
}
|
|
4128
|
+
const $s = 500, Te = 2e3;
|
|
4129
|
+
function Vs(e) {
|
|
4130
|
+
return JSON.stringify(e, (t, n) => typeof n == "bigint" ? n.toString() : n);
|
|
4131
|
+
}
|
|
4132
|
+
function Lt(e) {
|
|
4133
|
+
if (e == null || typeof e != "object") return;
|
|
4134
|
+
const t = e, n = t.snapshot, s = (t.context ?? n?.context)?.publishRunId;
|
|
4135
|
+
return typeof s == "string" && s.length > 0 ? s : void 0;
|
|
4136
|
+
}
|
|
4137
|
+
function Ws(e, t) {
|
|
4138
|
+
if (!e?.error) return {};
|
|
4139
|
+
if (t !== "failed" && t !== "in_progress") return {};
|
|
4140
|
+
const n = e.error, a = n != null ? (n instanceof Error ? n.message : String(n)).slice(0, $s) : void 0, s = e.errorStep;
|
|
4141
|
+
let r;
|
|
4142
|
+
if (n instanceof Error && n.stack)
|
|
4143
|
+
r = n.stack.slice(0, Te);
|
|
4144
|
+
else if (n != null && typeof n == "object")
|
|
4145
|
+
try {
|
|
4146
|
+
r = JSON.stringify(n).slice(0, Te);
|
|
4147
|
+
} catch {
|
|
4148
|
+
r = String(n).slice(0, Te);
|
|
4149
|
+
}
|
|
4150
|
+
else n != null && (r = String(n).slice(0, Te));
|
|
4151
|
+
return { errorMessage: a ?? void 0, errorStep: s, errorDetails: r };
|
|
4152
|
+
}
|
|
4153
|
+
const qs = ye(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, triggerPublishDone: a } }) => {
|
|
4154
|
+
Ue("savePublish seedLocalId", n);
|
|
4155
|
+
const s = t;
|
|
4156
|
+
ks(n, async () => {
|
|
4157
|
+
const o = B.getAppDb();
|
|
4158
|
+
if (!o) {
|
|
4159
|
+
Ue("savePublish: DB not ready, skipping"), e({ type: "SAVE_PUBLISH_DONE", seedLocalId: n, triggerPublishDone: a });
|
|
4160
|
+
return;
|
|
4161
|
+
}
|
|
4162
|
+
const i = await o.select().from(P).where(ea(Z(P.seedLocalId, n), Z(P.status, "in_progress"))).orderBy(fe(P.updatedAt)).limit(1), c = typeof t == "string" ? t : Vs(t), u = Hs(s), d = Date.now(), p = Ws(s.context, u);
|
|
4163
|
+
if (i.length > 0) {
|
|
4164
|
+
const l = i[0];
|
|
4165
|
+
await o.update(P).set({
|
|
4166
|
+
persistedSnapshot: c,
|
|
4167
|
+
status: u,
|
|
4168
|
+
updatedAt: d,
|
|
4169
|
+
...s.status === "done" && u !== "in_progress" ? { completedAt: d } : {},
|
|
4170
|
+
...p
|
|
4171
|
+
}).where(Z(P.id, l.id));
|
|
4172
|
+
} else {
|
|
4173
|
+
const l = Lt(s);
|
|
4174
|
+
if (l != null && u === "in_progress" && s.status !== "done") {
|
|
4175
|
+
const A = (await o.select().from(P).where(Z(P.seedLocalId, n)).orderBy(fe(P.startedAt)).limit(1))[0];
|
|
4176
|
+
if (A && (A.status === "completed" || A.status === "failed"))
|
|
4177
|
+
try {
|
|
4178
|
+
const g = JSON.parse(A.persistedSnapshot);
|
|
4179
|
+
if (Lt(g) === l) {
|
|
4180
|
+
Ue(
|
|
4181
|
+
"savePublish: skip stale insert — same publishRunId as latest terminal row",
|
|
4182
|
+
n,
|
|
4183
|
+
l
|
|
4184
|
+
);
|
|
4185
|
+
return;
|
|
4186
|
+
}
|
|
4187
|
+
} catch {
|
|
4188
|
+
}
|
|
4189
|
+
}
|
|
4190
|
+
const m = s.context?.item, h = s.context?.modelName ?? m?.modelName ?? "", y = s.context?.schemaId ?? m?.schemaId;
|
|
4191
|
+
await o.insert(P).values({
|
|
4192
|
+
seedLocalId: n,
|
|
4193
|
+
modelName: h,
|
|
4194
|
+
schemaId: y ?? null,
|
|
4195
|
+
status: u,
|
|
4196
|
+
startedAt: d,
|
|
4197
|
+
persistedSnapshot: c,
|
|
4198
|
+
createdAt: d,
|
|
4199
|
+
updatedAt: d,
|
|
4200
|
+
...p
|
|
4201
|
+
});
|
|
4202
|
+
}
|
|
4203
|
+
}).then(() => {
|
|
4204
|
+
e({ type: "SAVE_PUBLISH_DONE", seedLocalId: n, triggerPublishDone: a });
|
|
4205
|
+
}).catch((o) => {
|
|
4206
|
+
Ue("savePublish error", o), e({ type: "SAVE_PUBLISH_DONE", seedLocalId: n, triggerPublishDone: a });
|
|
4207
|
+
});
|
|
4208
|
+
});
|
|
4209
|
+
function js(e) {
|
|
4210
|
+
try {
|
|
4211
|
+
return e.getPersistedSnapshot?.() ?? e.getSnapshot();
|
|
4212
|
+
} catch {
|
|
4213
|
+
const t = e.getSnapshot(), n = t.context;
|
|
4214
|
+
if (!n?.item) return t;
|
|
4215
|
+
const a = n.item;
|
|
4216
|
+
return {
|
|
4217
|
+
...t,
|
|
4218
|
+
context: {
|
|
4219
|
+
...n,
|
|
4220
|
+
item: {
|
|
4221
|
+
seedLocalId: a.seedLocalId,
|
|
4222
|
+
modelName: a.modelName,
|
|
4223
|
+
schemaId: a.schemaId
|
|
4224
|
+
}
|
|
4225
|
+
}
|
|
4226
|
+
};
|
|
4227
|
+
}
|
|
4228
|
+
}
|
|
4229
|
+
const Gs = T(({ context: e, event: t, spawn: n }) => {
|
|
4230
|
+
const { publishProcesses: a } = e, { seedLocalId: s, publishProcess: r, triggerPublishDone: o } = t;
|
|
4231
|
+
if (!r)
|
|
4232
|
+
return e;
|
|
4233
|
+
const i = new Map(a);
|
|
4234
|
+
i.set(s, r);
|
|
4235
|
+
const c = js(r);
|
|
4236
|
+
return n(qs, {
|
|
4237
|
+
id: `savePublish_${s}_${Date.now()}`,
|
|
4238
|
+
input: { persistedSnapshot: c, seedLocalId: s, triggerPublishDone: o }
|
|
4239
|
+
}), { publishProcesses: i };
|
|
4240
|
+
}), Ys = T(({ context: e, event: t }) => {
|
|
4241
|
+
const { publishProcesses: n, subscriptions: a } = e, s = t.seedLocalId, r = a.get(s);
|
|
4242
|
+
r && r.send({ type: "UNSUBSCRIBE" });
|
|
4243
|
+
const o = new Map(n);
|
|
4244
|
+
o.delete(s);
|
|
4245
|
+
const i = new Map(a);
|
|
4246
|
+
return i.delete(s), {
|
|
4247
|
+
publishProcesses: o,
|
|
4248
|
+
subscriptions: i
|
|
4249
|
+
};
|
|
4250
|
+
}), Js = T(({ context: e, event: t }) => {
|
|
4251
|
+
const { subscriptions: n } = e, a = t.seedLocalId, s = new Map(n);
|
|
4252
|
+
return s.delete(a), {
|
|
4253
|
+
subscriptions: s
|
|
4254
|
+
};
|
|
4255
|
+
}), zs = 6e4, Zs = 2e3;
|
|
4256
|
+
async function Ks(e) {
|
|
4257
|
+
const t = Date.now() + e;
|
|
4258
|
+
for (; Date.now() < t; ) {
|
|
4259
|
+
if (B.PlatformClass && B.getAppDb()) return !0;
|
|
4260
|
+
await new Promise((n) => setTimeout(n, Zs));
|
|
4261
|
+
}
|
|
4262
|
+
return !1;
|
|
4263
|
+
}
|
|
4264
|
+
function Qs(e) {
|
|
4265
|
+
const t = e.value;
|
|
4266
|
+
return typeof t == "string" ? t : t && typeof t == "object" ? Object.keys(t)[0] ?? "" : "";
|
|
4267
|
+
}
|
|
4268
|
+
function Xs(e) {
|
|
4269
|
+
const t = Qs(e);
|
|
4270
|
+
if (t === "pollingForConfirmation" && (!e.context?.reimbursementTransactionId || !e.context?.requestResponse))
|
|
4271
|
+
return !1;
|
|
4272
|
+
if (t === "uploadingData") {
|
|
4273
|
+
const n = e.context?.arweaveTransactions, a = e.context?.publishUploads;
|
|
4274
|
+
if (!Array.isArray(n) || n.length === 0 || !Array.isArray(a)) return !1;
|
|
4275
|
+
}
|
|
4276
|
+
return !0;
|
|
4277
|
+
}
|
|
4278
|
+
const er = ye(
|
|
4279
|
+
({ sendBack: e, input: { context: t } }) => {
|
|
4280
|
+
(async () => {
|
|
4281
|
+
const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
4282
|
+
if (!await Ks(zs))
|
|
4283
|
+
return e({ type: "RESTORE_FROM_DB_DONE", publishProcesses: a, subscriptions: s }), { newPublishProcesses: a, newSubscriptions: s };
|
|
4284
|
+
const o = B.getAppDb();
|
|
4285
|
+
if (!o)
|
|
4286
|
+
return e({ type: "RESTORE_FROM_DB_DONE", publishProcesses: a, subscriptions: s }), { newPublishProcesses: a, newSubscriptions: s };
|
|
4287
|
+
const i = await o.select().from(P).where(Z(P.status, "in_progress")), c = /* @__PURE__ */ new Map(), u = [...i].sort(
|
|
4288
|
+
(p, l) => (l.updatedAt ?? l.createdAt ?? 0) - (p.updatedAt ?? p.createdAt ?? 0)
|
|
4289
|
+
);
|
|
4290
|
+
for (const p of u)
|
|
4291
|
+
c.has(p.seedLocalId) || c.set(p.seedLocalId, p);
|
|
4292
|
+
const d = Array.from(c.values());
|
|
4293
|
+
for (const p of d) {
|
|
4294
|
+
let l;
|
|
4295
|
+
try {
|
|
4296
|
+
l = JSON.parse(p.persistedSnapshot);
|
|
4297
|
+
} catch {
|
|
4298
|
+
continue;
|
|
4299
|
+
}
|
|
4300
|
+
if (l.status === "done") continue;
|
|
4301
|
+
const m = l.context?.item?.seedLocalId ?? p.seedLocalId;
|
|
4302
|
+
if (!m || !Xs(l)) continue;
|
|
4303
|
+
l.context = l.context ?? {}, l.context.item = {
|
|
4304
|
+
...l.context.item,
|
|
4305
|
+
seedLocalId: m,
|
|
4306
|
+
modelName: l.context.item?.modelName ?? l.context.modelName ?? p.modelName ?? "",
|
|
4307
|
+
schemaId: l.context.item?.schemaId ?? l.context.schemaId ?? p.schemaId ?? void 0
|
|
4308
|
+
};
|
|
4309
|
+
const h = Xe(ln, {
|
|
4310
|
+
snapshot: l,
|
|
4311
|
+
input: void 0
|
|
4312
|
+
}), y = Xe(pn, {
|
|
4313
|
+
input: {
|
|
4314
|
+
publishProcess: h,
|
|
4315
|
+
seedLocalId: m
|
|
4316
|
+
}
|
|
4317
|
+
});
|
|
4318
|
+
a.set(m, h), s.set(m, y), h.start(), y.start();
|
|
4319
|
+
}
|
|
4320
|
+
return { newPublishProcesses: a, newSubscriptions: s };
|
|
4321
|
+
})().then((a) => {
|
|
4322
|
+
if (!a) return;
|
|
4323
|
+
const { newPublishProcesses: s, newSubscriptions: r } = a;
|
|
4324
|
+
e({
|
|
4325
|
+
type: "RESTORE_FROM_DB_DONE",
|
|
4326
|
+
publishProcesses: s,
|
|
4327
|
+
subscriptions: r
|
|
4328
|
+
});
|
|
4329
|
+
});
|
|
4330
|
+
}
|
|
4331
|
+
), mn = K("seedProtocol:PublishManager:index"), tr = Ht({
|
|
4332
|
+
types: {
|
|
4333
|
+
context: {},
|
|
4334
|
+
input: {},
|
|
4335
|
+
events: {}
|
|
4336
|
+
},
|
|
4337
|
+
actors: {
|
|
4338
|
+
restoreFromDb: er
|
|
4339
|
+
},
|
|
4340
|
+
actions: {
|
|
4341
|
+
assignRestoreFromDb: xs,
|
|
4342
|
+
createPublish: _s,
|
|
4343
|
+
addSubscription: Ns,
|
|
4344
|
+
requestSavePublish: Gs,
|
|
4345
|
+
publishDone: Ys,
|
|
4346
|
+
removeSubscription: Js,
|
|
4347
|
+
retryAttestations: Ls,
|
|
4348
|
+
stopPublish: Ms,
|
|
4349
|
+
stopAll: Bs,
|
|
4350
|
+
query: Fs
|
|
4351
|
+
}
|
|
4352
|
+
}).createMachine({
|
|
4353
|
+
id: "publishManager",
|
|
4354
|
+
initial: "restoreFromDb",
|
|
4355
|
+
context: {
|
|
4356
|
+
publishProcesses: /* @__PURE__ */ new Map(),
|
|
4357
|
+
subscriptions: /* @__PURE__ */ new Map()
|
|
4358
|
+
},
|
|
4359
|
+
states: {
|
|
4360
|
+
restoreFromDb: {
|
|
4361
|
+
on: {
|
|
4362
|
+
RESTORE_FROM_DB_DONE: {
|
|
4363
|
+
target: "active",
|
|
4364
|
+
actions: ["assignRestoreFromDb"]
|
|
4365
|
+
}
|
|
4366
|
+
},
|
|
4367
|
+
invoke: {
|
|
4368
|
+
src: "restoreFromDb",
|
|
4369
|
+
input: ({ context: e }) => ({ context: e })
|
|
4370
|
+
}
|
|
4371
|
+
},
|
|
4372
|
+
active: {
|
|
4373
|
+
on: {
|
|
4374
|
+
CREATE_PUBLISH: {
|
|
4375
|
+
actions: ["createPublish"]
|
|
4376
|
+
},
|
|
4377
|
+
ADD_SUBSCRIPTION: {
|
|
4378
|
+
actions: ["addSubscription"]
|
|
4379
|
+
},
|
|
4380
|
+
REQUEST_SAVE_PUBLISH: {
|
|
4381
|
+
actions: ["requestSavePublish"]
|
|
4382
|
+
},
|
|
4383
|
+
SAVE_PUBLISH_DONE: [
|
|
4384
|
+
{
|
|
4385
|
+
guard: ({ event: e }) => e.triggerPublishDone === !0,
|
|
4386
|
+
actions: ["publishDone"]
|
|
4387
|
+
}
|
|
4388
|
+
],
|
|
4389
|
+
PUBLISH_DONE: {
|
|
4390
|
+
actions: ["publishDone"]
|
|
4391
|
+
},
|
|
4392
|
+
REMOVE_SUBSCRIPTION: {
|
|
4393
|
+
actions: ["removeSubscription"]
|
|
4394
|
+
},
|
|
4395
|
+
RETRY_ATTESTATIONS: {
|
|
4396
|
+
actions: ["retryAttestations"]
|
|
4397
|
+
},
|
|
4398
|
+
STOP_PUBLISH: {
|
|
4399
|
+
actions: ["stopPublish"]
|
|
4400
|
+
},
|
|
4401
|
+
QUERY: {
|
|
4402
|
+
actions: ["query"]
|
|
4403
|
+
},
|
|
4404
|
+
STOP_ALL: {
|
|
4405
|
+
actions: ["stopAll"]
|
|
4406
|
+
}
|
|
4407
|
+
}
|
|
4408
|
+
}
|
|
4409
|
+
}
|
|
4410
|
+
}), O = Xe(tr, {
|
|
4411
|
+
input: {
|
|
4412
|
+
publishProcesses: /* @__PURE__ */ new Map(),
|
|
4413
|
+
subscriptions: /* @__PURE__ */ new Map()
|
|
4414
|
+
}
|
|
4415
|
+
});
|
|
4416
|
+
Cs({
|
|
4417
|
+
savePublish: (e, t, n) => {
|
|
4418
|
+
O.send({
|
|
4419
|
+
type: "REQUEST_SAVE_PUBLISH",
|
|
4420
|
+
seedLocalId: e,
|
|
4421
|
+
publishProcess: t,
|
|
4422
|
+
triggerPublishDone: n?.triggerPublishDone
|
|
4423
|
+
});
|
|
4424
|
+
},
|
|
4425
|
+
onPublishDone: (e) => {
|
|
4426
|
+
O.send({ type: "PUBLISH_DONE", seedLocalId: e });
|
|
4427
|
+
},
|
|
4428
|
+
removeSubscription: (e) => {
|
|
4429
|
+
O.send({ type: "REMOVE_SUBSCRIPTION", seedLocalId: e });
|
|
4430
|
+
}
|
|
4431
|
+
});
|
|
4432
|
+
const nr = O.subscribe((e) => {
|
|
4433
|
+
mn("PublishManager snapshot:", e);
|
|
4434
|
+
});
|
|
4435
|
+
typeof document < "u" && (O.start(), window.addEventListener("load", () => {
|
|
4436
|
+
mn("PublishManager started");
|
|
4437
|
+
}), window.addEventListener("beforeunload", () => {
|
|
4438
|
+
nr.unsubscribe(), O.stop();
|
|
4439
|
+
}));
|
|
4440
|
+
const nt = {
|
|
4441
|
+
getService: () => O,
|
|
4442
|
+
createPublish: (e, t, n, a) => O.send({ type: "CREATE_PUBLISH", item: e, address: t, account: n, options: a }),
|
|
4443
|
+
retryAttestations: (e, t) => O.send({ type: "RETRY_ATTESTATIONS", seedLocalId: e, account: t }),
|
|
4444
|
+
stopPublish: (e) => O.send({ type: "STOP_PUBLISH", seedLocalId: e }),
|
|
4445
|
+
query: (e) => O.send({ type: "QUERY", seedLocalId: e }),
|
|
4446
|
+
stopAll: () => O.send({ type: "STOP_ALL" }),
|
|
4447
|
+
getPublish: (e) => O.getSnapshot().context.publishProcesses.get(e),
|
|
4448
|
+
savePublish: (e, t) => O.send({ type: "REQUEST_SAVE_PUBLISH", seedLocalId: e, publishProcess: t }),
|
|
4449
|
+
addSubscription: (e, t) => O.send({ type: "ADD_SUBSCRIPTION", seedLocalId: e, newSubscription: t }),
|
|
4450
|
+
removeSubscription: (e) => O.send({ type: "REMOVE_SUBSCRIPTION", seedLocalId: e })
|
|
4451
|
+
};
|
|
4452
|
+
function _o(e) {
|
|
4453
|
+
return e === "creatingAttestationsDirectToEas" ? "creatingAttestations" : e;
|
|
4454
|
+
}
|
|
4455
|
+
function ar(e, t, n) {
|
|
4456
|
+
return e != null ? n : t?.status === "completed" ? L.SUCCESS : t?.status === "failed" ? L.FAILURE : n;
|
|
4457
|
+
}
|
|
4458
|
+
function sr(e) {
|
|
4459
|
+
if (e) {
|
|
4460
|
+
if (e.status === "failed") return L.FAILURE;
|
|
4461
|
+
if (e.status === "completed") return L.SUCCESS;
|
|
4462
|
+
if (e.completedAt != null) {
|
|
4463
|
+
try {
|
|
4464
|
+
const t = JSON.parse(e.persistedSnapshot);
|
|
4465
|
+
if (t.status === "done" && t.value === L.FAILURE)
|
|
4466
|
+
return L.FAILURE;
|
|
4467
|
+
} catch {
|
|
4468
|
+
}
|
|
4469
|
+
return L.SUCCESS;
|
|
4470
|
+
}
|
|
4471
|
+
try {
|
|
4472
|
+
const t = JSON.parse(e.persistedSnapshot);
|
|
4473
|
+
if (t.status === "done") {
|
|
4474
|
+
if (t.value === L.SUCCESS) return L.SUCCESS;
|
|
4475
|
+
if (t.value === L.FAILURE) return L.FAILURE;
|
|
4476
|
+
}
|
|
4477
|
+
if (typeof t.value == "string") return t.value;
|
|
4478
|
+
} catch {
|
|
4479
|
+
return;
|
|
4480
|
+
}
|
|
4481
|
+
}
|
|
4482
|
+
}
|
|
4483
|
+
function rr(e) {
|
|
4484
|
+
return !e || e.status !== "done" ? !1 : e.value === L.SUCCESS || e.value === L.FAILURE;
|
|
4485
|
+
}
|
|
4486
|
+
function or(e) {
|
|
4487
|
+
const t = nt.getService(), n = aa(t, (m) => m?.context?.publishProcesses?.get(e) ?? null), a = Ft(null);
|
|
4488
|
+
te(() => {
|
|
4489
|
+
a.current = null;
|
|
4490
|
+
}, [e]);
|
|
4491
|
+
const [s, r] = Ae(void 0), [o, i] = Ae(null), c = B.getAppDb(), d = ve(
|
|
4492
|
+
e && c ? c.select().from(P).where(Z(P.seedLocalId, e)).orderBy(fe(P.startedAt)).limit(1) : null
|
|
4493
|
+
)?.[0], p = d?.status, l = Nt(() => {
|
|
4494
|
+
if (n != null)
|
|
4495
|
+
return s;
|
|
4496
|
+
if (o === "success" || o === "failure")
|
|
4497
|
+
return o;
|
|
4498
|
+
const m = sr(d);
|
|
4499
|
+
return m === L.SUCCESS || m === L.FAILURE ? m : ar(
|
|
4500
|
+
n,
|
|
4501
|
+
p != null ? { status: p } : void 0,
|
|
4502
|
+
s
|
|
4503
|
+
);
|
|
4504
|
+
}, [n, p, s, o, d]);
|
|
4505
|
+
return te(() => {
|
|
4506
|
+
i(null);
|
|
4507
|
+
}, [e]), te(() => {
|
|
4508
|
+
n == null && (p === "completed" ? i("success") : p === "failed" && i("failure"));
|
|
4509
|
+
}, [p, n]), te(() => {
|
|
4510
|
+
n != null && i(null);
|
|
4511
|
+
}, [n]), te(() => {
|
|
4512
|
+
if (!n) {
|
|
4513
|
+
const y = a.current;
|
|
4514
|
+
rr(y) ? (r(y.value), y.value === L.SUCCESS ? i("success") : y.value === L.FAILURE && i("failure")) : r(void 0);
|
|
4515
|
+
return;
|
|
4516
|
+
}
|
|
4517
|
+
const m = n.getSnapshot();
|
|
4518
|
+
a.current = { value: m?.value, status: m.status }, r(m?.value);
|
|
4519
|
+
const h = n.subscribe((y) => {
|
|
4520
|
+
a.current = { value: y?.value, status: y?.status }, r(y?.value);
|
|
4521
|
+
});
|
|
4522
|
+
return () => {
|
|
4523
|
+
h.unsubscribe();
|
|
4524
|
+
};
|
|
4525
|
+
}, [n, e]), {
|
|
4526
|
+
publishProcess: n ?? null,
|
|
4527
|
+
value: l
|
|
4528
|
+
};
|
|
4529
|
+
}
|
|
4530
|
+
function Lo(e) {
|
|
4531
|
+
const [t, n] = Ae(!0);
|
|
4532
|
+
return te(() => {
|
|
4533
|
+
if (!e) {
|
|
4534
|
+
n(!1);
|
|
4535
|
+
return;
|
|
4536
|
+
}
|
|
4537
|
+
Ot(e).then(n).catch(() => n(!1));
|
|
4538
|
+
}, [e?.seedLocalId]), t;
|
|
4539
|
+
}
|
|
4540
|
+
function ir(e) {
|
|
4541
|
+
const t = B.getAppDb(), a = ve(
|
|
4542
|
+
e && t ? t.select().from(De).where(Z(De.seedLocalId, e)).orderBy(fe(De.updatedAt)) : null
|
|
4543
|
+
) ?? [];
|
|
4544
|
+
return Nt(() => {
|
|
4545
|
+
const r = a.filter((i) => i.phase === "pending_l1").length, o = a.filter((i) => i.phase === "confirmed").length;
|
|
4546
|
+
return {
|
|
4547
|
+
hasPendingL1: r > 0,
|
|
4548
|
+
pendingCount: r,
|
|
4549
|
+
confirmedCount: o,
|
|
4550
|
+
jobs: a
|
|
4551
|
+
};
|
|
4552
|
+
}, [a]);
|
|
4553
|
+
}
|
|
4554
|
+
function Mo(e) {
|
|
4555
|
+
const { publishProcess: t, value: n } = or(e ?? ""), a = ir(e), s = B.getAppDb(), o = ve(
|
|
4556
|
+
e && s ? s.select().from(P).where(Z(P.seedLocalId, e)).orderBy(fe(P.startedAt)).limit(1) : null
|
|
4557
|
+
)?.[0], i = !!t || o?.status === "in_progress";
|
|
4558
|
+
return {
|
|
4559
|
+
latestRecord: o,
|
|
4560
|
+
publishProcess: t,
|
|
4561
|
+
isActive: i,
|
|
4562
|
+
publishValue: n,
|
|
4563
|
+
arweaveL1Pending: a.hasPendingL1,
|
|
4564
|
+
arweaveL1Jobs: a.jobs,
|
|
4565
|
+
arweaveL1Summary: a
|
|
4566
|
+
};
|
|
4567
|
+
}
|
|
4568
|
+
function cr() {
|
|
4569
|
+
const e = B.getAppDb();
|
|
4570
|
+
return ve(
|
|
4571
|
+
e ? e.select().from(P).orderBy(fe(P.startedAt)) : null
|
|
4572
|
+
);
|
|
4573
|
+
}
|
|
4574
|
+
function Oo() {
|
|
4575
|
+
const e = cr();
|
|
4576
|
+
if (e !== void 0)
|
|
4577
|
+
return e.filter((t) => t.status !== "in_progress").length;
|
|
4578
|
+
}
|
|
4579
|
+
function Bo(e) {
|
|
4580
|
+
const t = B.getAppDb(), n = ve(
|
|
4581
|
+
e != null && t ? t.select().from(P).where(Z(P.id, e)).limit(1) : null
|
|
4582
|
+
), a = n === void 0;
|
|
4583
|
+
return { record: n && n.length > 0 ? n[0] : null, isLoading: a };
|
|
4584
|
+
}
|
|
4585
|
+
async function Fo() {
|
|
4586
|
+
const e = B.getAppDb();
|
|
4587
|
+
e && await e.delete(P).where(ta(P.status, ["in_progress"]));
|
|
4588
|
+
}
|
|
4589
|
+
async function No() {
|
|
4590
|
+
const e = B.getAppDb();
|
|
4591
|
+
e && await e.delete(P);
|
|
4592
|
+
}
|
|
4593
|
+
async function ko() {
|
|
4594
|
+
const e = B.getAppDb();
|
|
4595
|
+
e && await e.delete(On);
|
|
4596
|
+
}
|
|
4597
|
+
async function Ho(e) {
|
|
4598
|
+
const t = B.getAppDb();
|
|
4599
|
+
t && await t.delete(P).where(Z(P.seedLocalId, e));
|
|
4600
|
+
}
|
|
4601
|
+
async function $o(e) {
|
|
4602
|
+
const t = B.getAppDb();
|
|
4603
|
+
t && await t.delete(P).where(Z(P.id, e));
|
|
4604
|
+
}
|
|
4605
|
+
async function Vo(e) {
|
|
4606
|
+
if (e.length === 0) return;
|
|
4607
|
+
const t = B.getAppDb();
|
|
4608
|
+
t && await t.delete(P).where(na(P.id, e));
|
|
4609
|
+
}
|
|
4610
|
+
function Wo(e) {
|
|
4611
|
+
try {
|
|
4612
|
+
return (JSON.parse(e.persistedSnapshot).context?.arweaveTransactions ?? []).map((a) => a.transaction?.id).filter((a) => typeof a == "string");
|
|
4613
|
+
} catch {
|
|
4614
|
+
return [];
|
|
4615
|
+
}
|
|
4616
|
+
}
|
|
4617
|
+
function qo(e) {
|
|
4618
|
+
try {
|
|
4619
|
+
return JSON.parse(e.persistedSnapshot).context?.easPayload ?? void 0;
|
|
4620
|
+
} catch {
|
|
4621
|
+
return;
|
|
4622
|
+
}
|
|
4623
|
+
}
|
|
4624
|
+
function jo(e) {
|
|
4625
|
+
const t = /* @__PURE__ */ new Map();
|
|
4626
|
+
for (let n = 0; n < e.length; n++) {
|
|
4627
|
+
const a = e[n]?.localId;
|
|
4628
|
+
a != null && t.set(a, BigInt(n));
|
|
4629
|
+
}
|
|
4630
|
+
return e.map((n, a) => {
|
|
4631
|
+
const s = (n.propertiesToUpdate ?? []).map((i) => {
|
|
4632
|
+
const c = i.publishLocalId, u = c != null ? t.get(c) : void 0;
|
|
4633
|
+
if (c != null && c !== "" && u === void 0)
|
|
4634
|
+
throw new Error(
|
|
4635
|
+
`publishLocalId "${c}" not found in payload (valid localIds: ${Array.from(t.keys()).join(", ")})`
|
|
4636
|
+
);
|
|
4637
|
+
const { publishLocalId: d, ...p } = i;
|
|
4638
|
+
return {
|
|
4639
|
+
...p,
|
|
4640
|
+
publishLocalIdIndex: u ?? BigInt(0)
|
|
4641
|
+
};
|
|
4642
|
+
}), { localId: r, ...o } = n;
|
|
4643
|
+
return {
|
|
4644
|
+
...o,
|
|
4645
|
+
localIdIndex: BigInt(a),
|
|
4646
|
+
propertiesToUpdate: s
|
|
4647
|
+
};
|
|
4648
|
+
});
|
|
4649
|
+
}
|
|
4650
|
+
const dr = "A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.";
|
|
4651
|
+
async function Go(e, t, n, a) {
|
|
4652
|
+
const s = C(), r = await n();
|
|
4653
|
+
if (!r || !r.trim())
|
|
4654
|
+
return { outcome: "no_address" };
|
|
4655
|
+
if (s.useModularExecutor) {
|
|
4656
|
+
if (!t)
|
|
4657
|
+
return {
|
|
4658
|
+
outcome: "managed_not_ready",
|
|
4659
|
+
error: new Q(dr, "MANAGED_ACCOUNT_UNAVAILABLE")
|
|
4660
|
+
};
|
|
4661
|
+
const i = await sn();
|
|
4662
|
+
if (!i.ok)
|
|
4663
|
+
return { outcome: "managed_not_ready", error: i.error };
|
|
4664
|
+
const c = i.managedAddress, u = await ht(t ?? null);
|
|
4665
|
+
return "needsDeploy" in u ? { outcome: "needs_deploy" } : (nt.createPublish(e, c, u.account, {
|
|
4666
|
+
dataItemSigner: u.account,
|
|
4667
|
+
...a
|
|
4668
|
+
}), { outcome: "started" });
|
|
4669
|
+
}
|
|
4670
|
+
const o = await ht(t ?? null);
|
|
4671
|
+
return "address" in o ? (nt.createPublish(e, o.address, o.account, {
|
|
4672
|
+
dataItemSigner: o.account,
|
|
4673
|
+
...a
|
|
4674
|
+
}), { outcome: "started" }) : { outcome: "needs_deploy" };
|
|
4675
|
+
}
|
|
4676
|
+
export {
|
|
4677
|
+
ua as $,
|
|
4678
|
+
Yt as A,
|
|
4679
|
+
_e as B,
|
|
4680
|
+
Br as C,
|
|
4681
|
+
Ga as D,
|
|
4682
|
+
_o as E,
|
|
4683
|
+
sr as F,
|
|
4684
|
+
ar as G,
|
|
4685
|
+
jo as H,
|
|
4686
|
+
Go as I,
|
|
4687
|
+
et as J,
|
|
4688
|
+
Et as K,
|
|
4689
|
+
cs as L,
|
|
4690
|
+
Q as M,
|
|
4691
|
+
sn as N,
|
|
4692
|
+
R as O,
|
|
4693
|
+
Fr as P,
|
|
4694
|
+
xr as Q,
|
|
4695
|
+
Cr as R,
|
|
4696
|
+
Rr as S,
|
|
4697
|
+
qt as T,
|
|
4698
|
+
jt as U,
|
|
4699
|
+
Re as V,
|
|
4700
|
+
ht as W,
|
|
4701
|
+
_r as X,
|
|
4702
|
+
la as Y,
|
|
4703
|
+
Lr as Z,
|
|
4704
|
+
rt as _,
|
|
4705
|
+
wt as a,
|
|
4706
|
+
Me as a0,
|
|
4707
|
+
ot as a1,
|
|
4708
|
+
pa as a2,
|
|
4709
|
+
Nr as a3,
|
|
4710
|
+
kr as a4,
|
|
4711
|
+
Hr as a5,
|
|
4712
|
+
$r as a6,
|
|
4713
|
+
La as a7,
|
|
4714
|
+
Vr as a8,
|
|
4715
|
+
Wr as a9,
|
|
4716
|
+
yo as aA,
|
|
4717
|
+
go as aB,
|
|
4718
|
+
wo as aC,
|
|
4719
|
+
bo as aD,
|
|
4720
|
+
Ao as aE,
|
|
4721
|
+
vo as aF,
|
|
4722
|
+
So as aG,
|
|
4723
|
+
Eo as aH,
|
|
4724
|
+
Io as aI,
|
|
4725
|
+
Po as aJ,
|
|
4726
|
+
Uo as aK,
|
|
4727
|
+
bt as aL,
|
|
4728
|
+
To as aM,
|
|
4729
|
+
Do as aN,
|
|
4730
|
+
xo as aO,
|
|
4731
|
+
Co as aP,
|
|
4732
|
+
Ro as aQ,
|
|
4733
|
+
qr as aa,
|
|
4734
|
+
Ma as ab,
|
|
4735
|
+
jr as ac,
|
|
4736
|
+
Gr as ad,
|
|
4737
|
+
Yr as ae,
|
|
4738
|
+
Jr as af,
|
|
4739
|
+
zr as ag,
|
|
4740
|
+
Zr as ah,
|
|
4741
|
+
Kr as ai,
|
|
4742
|
+
Qr as aj,
|
|
4743
|
+
Xr as ak,
|
|
4744
|
+
eo as al,
|
|
4745
|
+
to as am,
|
|
4746
|
+
no as an,
|
|
4747
|
+
ao,
|
|
4748
|
+
so as ap,
|
|
4749
|
+
ro as aq,
|
|
4750
|
+
oo as ar,
|
|
4751
|
+
io as as,
|
|
4752
|
+
co as at,
|
|
4753
|
+
lo as au,
|
|
4754
|
+
uo as av,
|
|
4755
|
+
po as aw,
|
|
4756
|
+
mo as ax,
|
|
4757
|
+
fo as ay,
|
|
4758
|
+
ho as az,
|
|
4759
|
+
Ea as b,
|
|
4760
|
+
Mr as c,
|
|
4761
|
+
Or as d,
|
|
4762
|
+
Oe as e,
|
|
4763
|
+
nt as f,
|
|
4764
|
+
C as g,
|
|
4765
|
+
or as h,
|
|
4766
|
+
Gt as i,
|
|
4767
|
+
Lo as j,
|
|
4768
|
+
Mo as k,
|
|
4769
|
+
cr as l,
|
|
4770
|
+
Oo as m,
|
|
4771
|
+
Bo as n,
|
|
4772
|
+
Fo as o,
|
|
4773
|
+
ln as p,
|
|
4774
|
+
No as q,
|
|
4775
|
+
ko as r,
|
|
4776
|
+
Sa as s,
|
|
4777
|
+
Ho as t,
|
|
4778
|
+
Ia as u,
|
|
4779
|
+
$o as v,
|
|
4780
|
+
Vo as w,
|
|
4781
|
+
Wo as x,
|
|
4782
|
+
qo as y,
|
|
4783
|
+
ir as z
|
|
4784
|
+
};
|
|
4785
|
+
//# sourceMappingURL=index-P7oBN4Yu.js.map
|