@the_library/public 1.0.0 → 2.0.0
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 +201 -28
- package/assets/branding/pond-enterprise-logo.svg +1 -1
- package/dist/Book-K86JRm42.d.ts +600 -0
- package/dist/bookSearchService-BmFHrvsv.d.ts +300 -0
- package/dist/branding/index.js +1 -66
- package/dist/branding/index.js.map +1 -1
- package/dist/chunk-3XUKOVEF.js +2 -0
- package/dist/chunk-3XUKOVEF.js.map +1 -0
- package/dist/chunk-46FQHZNM.js +2 -0
- package/dist/chunk-46FQHZNM.js.map +1 -0
- package/dist/chunk-7G3BMGV2.js +2 -0
- package/dist/chunk-7G3BMGV2.js.map +1 -0
- package/dist/chunk-D4DXGA2W.js +2 -0
- package/dist/chunk-D4DXGA2W.js.map +1 -0
- package/dist/chunk-EMA2QJTW.js +2 -0
- package/dist/chunk-EMA2QJTW.js.map +1 -0
- package/dist/chunk-FN52YV7L.js +2 -0
- package/dist/chunk-FN52YV7L.js.map +1 -0
- package/dist/chunk-GWQNULP4.js +2 -0
- package/dist/chunk-GWQNULP4.js.map +1 -0
- package/dist/chunk-OELHBR4F.js +2 -0
- package/dist/chunk-OELHBR4F.js.map +1 -0
- package/dist/chunk-PV3X54EU.js +2 -0
- package/dist/chunk-PV3X54EU.js.map +1 -0
- package/dist/chunk-SD3INWZF.js +2 -0
- package/dist/chunk-SD3INWZF.js.map +1 -0
- package/dist/downloader/dl2-sw.js +1 -198
- package/dist/downloader/dl2-sw.js.map +1 -1
- package/dist/downloader/file-worker-v2.js +1 -257
- package/dist/downloader/file-worker-v2.js.map +1 -1
- package/dist/downloader/index.d.ts +18 -2
- package/dist/downloader/index.js +1 -537
- package/dist/downloader/index.js.map +1 -1
- package/dist/downloader/mu-worker-v2.js +1 -196
- package/dist/downloader/mu-worker-v2.js.map +1 -1
- package/dist/downloader/react.d.ts +1 -1
- package/dist/downloader/react.js +1 -31
- package/dist/downloader/react.js.map +1 -1
- package/dist/downloader/solid.d.ts +1 -1
- package/dist/downloader/solid.js +1 -18
- package/dist/downloader/solid.js.map +1 -1
- package/dist/downloader/sw.js +1 -118
- package/dist/downloader/sw.js.map +1 -1
- package/dist/downloader/vue.d.ts +1 -1
- package/dist/downloader/vue.js +1 -18
- package/dist/downloader/vue.js.map +1 -1
- package/dist/enriched-index-T0sDG7JR.d.ts +209 -0
- package/dist/global/public.global.js +68 -0
- package/dist/global/public.manifest.json +484 -0
- package/dist/level-state-DXqglpAX.d.ts +27 -0
- package/dist/models/astro.d.ts +4 -3
- package/dist/models/astro.js +1 -43
- package/dist/models/astro.js.map +1 -1
- package/dist/models/index.d.ts +449 -22
- package/dist/models/index.js +1 -339
- package/dist/models/index.js.map +1 -1
- package/dist/models/models.d.ts +196 -441
- package/dist/models/models.js +1 -45
- package/dist/models/patch-worker.js +1 -542
- package/dist/models/patch-worker.js.map +1 -1
- package/dist/models/react.d.ts +6 -5
- package/dist/models/react.js +1 -72
- package/dist/models/react.js.map +1 -1
- package/dist/models/solid.d.ts +16 -6
- package/dist/models/solid.js +1 -94
- package/dist/models/solid.js.map +1 -1
- package/dist/models/vue.d.ts +90 -7
- package/dist/models/vue.js +1 -97
- package/dist/models/vue.js.map +1 -1
- package/dist/orm-MJTHCG9E.d.ts +1003 -0
- package/dist/{session-vqOnyxga.d.ts → session-JudUKAV7.d.ts} +76 -74
- package/dist/{state-BTsp-E4v.d.ts → state-CkYavOSt.d.ts} +16 -0
- package/dist/{types-Dn0EFMO_.d.ts → types-B-IX3HBn.d.ts} +94 -21
- package/dist/{types-Xb8Ta9tZ.d.ts → types-Blyx2A7F.d.ts} +10 -36
- package/dist/web3/auth.d.ts +89 -0
- package/dist/web3/auth.js +13 -0
- package/dist/web3/auth.js.map +1 -0
- package/dist/web3/index.d.ts +1913 -126
- package/dist/web3/index.js +1 -1019
- package/dist/web3/index.js.map +1 -1
- package/dist/web3/network.d.ts +6 -0
- package/dist/web3/network.js +2 -0
- package/dist/web3/network.js.map +1 -0
- package/dist/web3/registry.d.ts +34 -9
- package/dist/web3/registry.js +1 -22
- package/dist/web3/vue.d.ts +31 -14
- package/dist/web3/vue.js +1 -390
- package/dist/web3/vue.js.map +1 -1
- package/package.json +23 -2
- package/dist/chunk-2HFOWE5R.js +0 -296
- package/dist/chunk-2HFOWE5R.js.map +0 -1
- package/dist/chunk-3L6LH2XK.js +0 -465
- package/dist/chunk-3L6LH2XK.js.map +0 -1
- package/dist/chunk-4CWVFPBN.js +0 -28
- package/dist/chunk-4CWVFPBN.js.map +0 -1
- package/dist/chunk-AGHPATVL.js +0 -65
- package/dist/chunk-AGHPATVL.js.map +0 -1
- package/dist/chunk-JDUYLUDJ.js +0 -4835
- package/dist/chunk-JDUYLUDJ.js.map +0 -1
- package/dist/chunk-OEZK7IX7.js +0 -77
- package/dist/chunk-OEZK7IX7.js.map +0 -1
- package/dist/chunk-PUYDAUCI.js +0 -2873
- package/dist/chunk-PUYDAUCI.js.map +0 -1
- package/dist/chunk-WHWMTS7D.js +0 -99
- package/dist/chunk-WHWMTS7D.js.map +0 -1
- package/dist/chunk-Y7RS6RTM.js +0 -342
- package/dist/chunk-Y7RS6RTM.js.map +0 -1
- package/dist/chunk-ZEZGI2TP.js +0 -197
- package/dist/chunk-ZEZGI2TP.js.map +0 -1
- package/dist/core-dao-core-logo-VDT2I5IW.svg +0 -33
- package/dist/level-state-J3pj64Tr.d.ts +0 -15
- package/dist/models/models_v2.global.js +0 -1
- package/dist/orm-BvkX0aBT.d.ts +0 -507
package/dist/web3/index.js
CHANGED
|
@@ -1,1020 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_CHAIN_ID,
|
|
3
|
-
EVM_CHAINS,
|
|
4
|
-
EventBus,
|
|
5
|
-
EventName,
|
|
6
|
-
EvmClient,
|
|
7
|
-
MetaMaskConnector,
|
|
8
|
-
PrivateKeyConnector,
|
|
9
|
-
SubscriptionClient,
|
|
10
|
-
WalletError,
|
|
11
|
-
WalletEvents,
|
|
12
|
-
WalletState,
|
|
13
|
-
WalletUxError,
|
|
14
|
-
addressFromPrivateKey,
|
|
15
|
-
addressRegistryAbi,
|
|
16
|
-
allRegisteredAccounts,
|
|
17
|
-
createEvmClient,
|
|
18
|
-
createMetaMaskConnector,
|
|
19
|
-
createPrivateKeyConnector,
|
|
20
|
-
createPrivateKeyWalletClient,
|
|
21
|
-
createSessionStore,
|
|
22
|
-
cursorStore,
|
|
23
|
-
deserializeCursor,
|
|
24
|
-
emptyCursor,
|
|
25
|
-
getCachedEmail,
|
|
26
|
-
getChain,
|
|
27
|
-
getConnector,
|
|
28
|
-
getDecryptedPrivateKey,
|
|
29
|
-
getEventBus,
|
|
30
|
-
getEvmClient,
|
|
31
|
-
getPrivateKey,
|
|
32
|
-
getReadClient,
|
|
33
|
-
getReadyEvmClient,
|
|
34
|
-
getRegisteredConnectors,
|
|
35
|
-
getSubscriptionClient,
|
|
36
|
-
hasAnyPrivateKey,
|
|
37
|
-
hasEncryptedPrivateKey,
|
|
38
|
-
hasPrivateKey,
|
|
39
|
-
hasUnsavedPatches,
|
|
40
|
-
loadNetworkInfos,
|
|
41
|
-
loadProject,
|
|
42
|
-
loadProjects,
|
|
43
|
-
normalizeError,
|
|
44
|
-
projectLocale,
|
|
45
|
-
pythAbi,
|
|
46
|
-
readOnlyClients,
|
|
47
|
-
readOnlyStagingClients,
|
|
48
|
-
registerConnector,
|
|
49
|
-
restoreAccountSave,
|
|
50
|
-
serializeCursor,
|
|
51
|
-
sessionStore,
|
|
52
|
-
setCachedEmail,
|
|
53
|
-
storeEncryptedPrivateKey,
|
|
54
|
-
storePrivateKey,
|
|
55
|
-
stringToBytes4,
|
|
56
|
-
syncAccount,
|
|
57
|
-
toViemChain
|
|
58
|
-
} from "../chunk-PUYDAUCI.js";
|
|
59
|
-
import {
|
|
60
|
-
CACHE_DURATION_MS,
|
|
61
|
-
NodeFileCacheStorage,
|
|
62
|
-
RegistryAddressLoader,
|
|
63
|
-
addressLoader,
|
|
64
|
-
createNodeFileCacheStorage,
|
|
65
|
-
getContractAbi,
|
|
66
|
-
getRegistryBaseUrl,
|
|
67
|
-
setRegistryBaseUrl,
|
|
68
|
-
sidecarUrlsFromManifest
|
|
69
|
-
} from "../chunk-3L6LH2XK.js";
|
|
70
|
-
import {
|
|
71
|
-
getNbPatches
|
|
72
|
-
} from "../chunk-ZEZGI2TP.js";
|
|
73
|
-
|
|
74
|
-
// src/web3/client/types.ts
|
|
75
|
-
var LibraryOwnership = /* @__PURE__ */ ((LibraryOwnership2) => {
|
|
76
|
-
LibraryOwnership2[LibraryOwnership2["Public"] = 0] = "Public";
|
|
77
|
-
LibraryOwnership2[LibraryOwnership2["Private"] = 1] = "Private";
|
|
78
|
-
return LibraryOwnership2;
|
|
79
|
-
})(LibraryOwnership || {});
|
|
80
|
-
var PreferredFormat = /* @__PURE__ */ ((PreferredFormat2) => {
|
|
81
|
-
PreferredFormat2[PreferredFormat2["MARC21"] = 0] = "MARC21";
|
|
82
|
-
PreferredFormat2[PreferredFormat2["UNIMARC"] = 1] = "UNIMARC";
|
|
83
|
-
PreferredFormat2[PreferredFormat2["MARCXML"] = 2] = "MARCXML";
|
|
84
|
-
PreferredFormat2[PreferredFormat2["DublinCore"] = 3] = "DublinCore";
|
|
85
|
-
PreferredFormat2[PreferredFormat2["MODS"] = 4] = "MODS";
|
|
86
|
-
PreferredFormat2[PreferredFormat2["BIBFRAME"] = 5] = "BIBFRAME";
|
|
87
|
-
PreferredFormat2[PreferredFormat2["ONIX"] = 6] = "ONIX";
|
|
88
|
-
PreferredFormat2[PreferredFormat2["OPDS"] = 7] = "OPDS";
|
|
89
|
-
PreferredFormat2[PreferredFormat2["InternetArchive"] = 8] = "InternetArchive";
|
|
90
|
-
PreferredFormat2[PreferredFormat2["HathiTrust"] = 9] = "HathiTrust";
|
|
91
|
-
PreferredFormat2[PreferredFormat2["EAD"] = 10] = "EAD";
|
|
92
|
-
PreferredFormat2[PreferredFormat2["Other"] = 11] = "Other";
|
|
93
|
-
return PreferredFormat2;
|
|
94
|
-
})(PreferredFormat || {});
|
|
95
|
-
|
|
96
|
-
// src/web3/client/EvmWriteClient.ts
|
|
97
|
-
import {
|
|
98
|
-
parseEther
|
|
99
|
-
} from "viem";
|
|
100
|
-
var EvmWriteClient = class {
|
|
101
|
-
constructor(wallet, readonlyApi, walletClient, account) {
|
|
102
|
-
this.wallet = wallet;
|
|
103
|
-
this.readonly = readonlyApi;
|
|
104
|
-
this.config = readonlyApi.config;
|
|
105
|
-
this.environment = readonlyApi.environment;
|
|
106
|
-
this.chain = readonlyApi.chain;
|
|
107
|
-
this.publicClient = readonlyApi.publicClient;
|
|
108
|
-
this._account = account;
|
|
109
|
-
this.writeOnly = {
|
|
110
|
-
factory: this.createFactoryWriteAPI(walletClient),
|
|
111
|
-
subscriptionManager: this.createSubscriptionManagerWriteAPI(walletClient),
|
|
112
|
-
addressRegistry: this.createAddressRegistryWriteAPI(walletClient),
|
|
113
|
-
libraryRegistryStorage: this.createLibraryRegistryStorageWriteAPI(walletClient),
|
|
114
|
-
publicLibraryStorage: this.createPublicLibraryStorageWriteAPI(walletClient)
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
get factory() {
|
|
118
|
-
return this.writeOnly.factory;
|
|
119
|
-
}
|
|
120
|
-
get subscriptionManager() {
|
|
121
|
-
return this.writeOnly.subscriptionManager;
|
|
122
|
-
}
|
|
123
|
-
get addressRegistry() {
|
|
124
|
-
return this.writeOnly.addressRegistry;
|
|
125
|
-
}
|
|
126
|
-
get libraryRegistryStorage() {
|
|
127
|
-
return this.writeOnly.libraryRegistryStorage;
|
|
128
|
-
}
|
|
129
|
-
get publicLibraryStorage() {
|
|
130
|
-
return this.writeOnly.publicLibraryStorage;
|
|
131
|
-
}
|
|
132
|
-
getChainId() {
|
|
133
|
-
return this.readonly.chainId;
|
|
134
|
-
}
|
|
135
|
-
account() {
|
|
136
|
-
return this._account;
|
|
137
|
-
}
|
|
138
|
-
getNormalizedAddress(address) {
|
|
139
|
-
return address.toLowerCase();
|
|
140
|
-
}
|
|
141
|
-
requireAbi(contractName) {
|
|
142
|
-
const abi = addressLoader.getAbi(this.readonly.chainId, contractName, this.environment);
|
|
143
|
-
if (!abi) {
|
|
144
|
-
throw new Error(
|
|
145
|
-
`[EvmWriteClient] Registry ABI for '${contractName}' on chain ${this.readonly.chainId} is not loaded. The AddressRegistry may be offline, incomplete, or the chain has not finished syncing. Write operations are blocked until the registry is ready.`
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
return abi;
|
|
149
|
-
}
|
|
150
|
-
// Was duplicated identically inside createFactoryWriteAPI and
|
|
151
|
-
// createSubscriptionManagerWriteAPI as a local closure each — hoisted here
|
|
152
|
-
// once consolidation made the duplication visible in one file.
|
|
153
|
-
getFactoryAddress() {
|
|
154
|
-
const dynamic = addressLoader.getAddress(this.readonly.chainId, "factory", this.environment);
|
|
155
|
-
if (!dynamic) {
|
|
156
|
-
throw new Error(
|
|
157
|
-
`Factory address not resolved for chain ${this.readonly.chainId} (${this.environment}) \u2014 await client.ready before writing.`
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
return dynamic;
|
|
161
|
-
}
|
|
162
|
-
// AddressRegistry's own ABI is static (see requireAbi's comment on EvmClient's
|
|
163
|
-
// bootstrap exception) and so is its address per environment — mirrors
|
|
164
|
-
// EvmClient's private activeRegistryAddress getter.
|
|
165
|
-
getRegistryAddress() {
|
|
166
|
-
const address = this.environment === "staging" && this.config.addresses?.stagingAddressRegistry ? this.config.addresses.stagingAddressRegistry : this.config.addresses?.addressRegistry;
|
|
167
|
-
if (!address) {
|
|
168
|
-
throw new Error(`AddressRegistry address not configured for chain ${this.readonly.chainId} (${this.environment})`);
|
|
169
|
-
}
|
|
170
|
-
return address;
|
|
171
|
-
}
|
|
172
|
-
createFactoryWriteAPI(walletClient) {
|
|
173
|
-
const pushPythPrice = async () => {
|
|
174
|
-
if (!this.config.main) return;
|
|
175
|
-
const { price } = this.config;
|
|
176
|
-
if (price.stable) return;
|
|
177
|
-
const { pythOracle, usdPriceId } = price;
|
|
178
|
-
if (!pythOracle || !usdPriceId) return;
|
|
179
|
-
const res = await fetch(
|
|
180
|
-
`https://hermes.pyth.network/v2/updates/price/latest?ids[]=${usdPriceId}&encoding=hex`
|
|
181
|
-
);
|
|
182
|
-
if (!res.ok) throw new Error(`Hermes price fetch failed: ${res.status}`);
|
|
183
|
-
const data = await res.json();
|
|
184
|
-
const hexItems = data.binary?.data ?? [];
|
|
185
|
-
if (hexItems.length === 0) throw new Error("No price update data from Hermes");
|
|
186
|
-
const updateData = hexItems.map((h) => `0x${h}`);
|
|
187
|
-
const fee = await this.publicClient.readContract({
|
|
188
|
-
address: pythOracle,
|
|
189
|
-
abi: pythAbi,
|
|
190
|
-
functionName: "getUpdateFee",
|
|
191
|
-
args: [updateData]
|
|
192
|
-
});
|
|
193
|
-
const account = walletClient.account;
|
|
194
|
-
const hash = await walletClient.writeContract({
|
|
195
|
-
address: pythOracle,
|
|
196
|
-
abi: pythAbi,
|
|
197
|
-
functionName: "updatePriceFeeds",
|
|
198
|
-
args: [updateData],
|
|
199
|
-
account,
|
|
200
|
-
chain: this.chain,
|
|
201
|
-
value: fee
|
|
202
|
-
});
|
|
203
|
-
await this.publicClient.waitForTransactionReceipt({ hash });
|
|
204
|
-
};
|
|
205
|
-
return {
|
|
206
|
-
donateToProject: async (projectId, lang, amount, options) => {
|
|
207
|
-
try {
|
|
208
|
-
const account = walletClient.account;
|
|
209
|
-
if (!account) {
|
|
210
|
-
throw new Error("No account connected to wallet");
|
|
211
|
-
}
|
|
212
|
-
const address = this.getFactoryAddress();
|
|
213
|
-
const votes = BigInt(Math.round(amount));
|
|
214
|
-
const hash = await walletClient.writeContract({
|
|
215
|
-
address,
|
|
216
|
-
abi: this.requireAbi("Factory"),
|
|
217
|
-
functionName: "voteForProject",
|
|
218
|
-
args: [projectId, stringToBytes4(lang), votes],
|
|
219
|
-
account,
|
|
220
|
-
chain: this.chain,
|
|
221
|
-
gas: options?.gasLimit
|
|
222
|
-
});
|
|
223
|
-
options?.onAccepted?.(hash);
|
|
224
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
225
|
-
if (typeof window !== "undefined") {
|
|
226
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
227
|
-
}
|
|
228
|
-
return receipt;
|
|
229
|
-
} catch (error) {
|
|
230
|
-
throw normalizeError(error);
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
register: async (country, language, paymentValue, options) => {
|
|
234
|
-
try {
|
|
235
|
-
const account = walletClient.account;
|
|
236
|
-
if (!account) {
|
|
237
|
-
throw new Error("No account connected to wallet");
|
|
238
|
-
}
|
|
239
|
-
await walletClient.getAddresses();
|
|
240
|
-
const address = this.getFactoryAddress();
|
|
241
|
-
const valueInWei = parseEther(String(paymentValue));
|
|
242
|
-
await pushPythPrice();
|
|
243
|
-
const hash = await walletClient.writeContract({
|
|
244
|
-
address,
|
|
245
|
-
abi: this.requireAbi("Factory"),
|
|
246
|
-
functionName: "register",
|
|
247
|
-
args: [country, language, 0n],
|
|
248
|
-
account,
|
|
249
|
-
chain: this.chain,
|
|
250
|
-
value: valueInWei,
|
|
251
|
-
gas: options?.gasLimit
|
|
252
|
-
});
|
|
253
|
-
options?.onAccepted?.(hash);
|
|
254
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
255
|
-
if (typeof window !== "undefined") {
|
|
256
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
257
|
-
}
|
|
258
|
-
return receipt;
|
|
259
|
-
} catch (error) {
|
|
260
|
-
throw normalizeError(error);
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
unregister: async (options) => {
|
|
264
|
-
try {
|
|
265
|
-
const account = walletClient.account;
|
|
266
|
-
if (!account) {
|
|
267
|
-
throw new Error("No account connected to wallet");
|
|
268
|
-
}
|
|
269
|
-
const address = this.getFactoryAddress();
|
|
270
|
-
const hash = await walletClient.writeContract({
|
|
271
|
-
address,
|
|
272
|
-
abi: this.requireAbi("Factory"),
|
|
273
|
-
functionName: "unregister",
|
|
274
|
-
args: [],
|
|
275
|
-
account,
|
|
276
|
-
chain: this.chain,
|
|
277
|
-
gas: options?.gasLimit
|
|
278
|
-
});
|
|
279
|
-
options?.onAccepted?.(hash);
|
|
280
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
281
|
-
if (typeof window !== "undefined") {
|
|
282
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
283
|
-
}
|
|
284
|
-
return receipt;
|
|
285
|
-
} catch (error) {
|
|
286
|
-
throw normalizeError(error);
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
save: async (patches, level, indexes, text, options) => {
|
|
290
|
-
try {
|
|
291
|
-
const account = walletClient.account;
|
|
292
|
-
if (!account) {
|
|
293
|
-
throw new Error("No account connected to wallet");
|
|
294
|
-
}
|
|
295
|
-
const address = this.getFactoryAddress();
|
|
296
|
-
const hash = await walletClient.writeContract({
|
|
297
|
-
address,
|
|
298
|
-
abi: this.requireAbi("Factory"),
|
|
299
|
-
functionName: "save",
|
|
300
|
-
args: [patches, level, indexes, text],
|
|
301
|
-
account,
|
|
302
|
-
chain: this.chain,
|
|
303
|
-
gas: options?.gasLimit
|
|
304
|
-
});
|
|
305
|
-
options?.onAccepted?.(hash);
|
|
306
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
307
|
-
if (typeof window !== "undefined") {
|
|
308
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
309
|
-
}
|
|
310
|
-
return receipt;
|
|
311
|
-
} catch (error) {
|
|
312
|
-
throw normalizeError(error);
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
createProject: async (lang, uri, publicationDate, name, headline, arweaveAddressLogo, arweaveAddressBanner, descriptionMarkdown, minimumFundingBeforeStartWork, maximumFunding, tags, complexity, options) => {
|
|
316
|
-
try {
|
|
317
|
-
const account = walletClient.account;
|
|
318
|
-
if (!account) {
|
|
319
|
-
throw new Error("No account connected to wallet");
|
|
320
|
-
}
|
|
321
|
-
const address = this.getFactoryAddress();
|
|
322
|
-
const hash = await walletClient.writeContract({
|
|
323
|
-
address,
|
|
324
|
-
abi: this.requireAbi("Factory"),
|
|
325
|
-
functionName: "createProject",
|
|
326
|
-
args: [
|
|
327
|
-
stringToBytes4(lang),
|
|
328
|
-
uri,
|
|
329
|
-
publicationDate,
|
|
330
|
-
name,
|
|
331
|
-
headline,
|
|
332
|
-
arweaveAddressLogo,
|
|
333
|
-
arweaveAddressBanner,
|
|
334
|
-
descriptionMarkdown,
|
|
335
|
-
minimumFundingBeforeStartWork,
|
|
336
|
-
maximumFunding,
|
|
337
|
-
tags,
|
|
338
|
-
complexity
|
|
339
|
-
],
|
|
340
|
-
account,
|
|
341
|
-
chain: this.chain,
|
|
342
|
-
gas: options?.gasLimit
|
|
343
|
-
});
|
|
344
|
-
options?.onAccepted?.(hash);
|
|
345
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
346
|
-
if (typeof window !== "undefined") {
|
|
347
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
348
|
-
}
|
|
349
|
-
return receipt;
|
|
350
|
-
} catch (error) {
|
|
351
|
-
throw normalizeError(error);
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
registerStripe: async (country, language, paymentIntentId, votes, signature, options) => {
|
|
355
|
-
try {
|
|
356
|
-
const account = walletClient.account;
|
|
357
|
-
if (!account) throw new Error("No account connected to wallet");
|
|
358
|
-
const address = this.getFactoryAddress();
|
|
359
|
-
const hash = await walletClient.writeContract({
|
|
360
|
-
address,
|
|
361
|
-
abi: this.requireAbi("Factory"),
|
|
362
|
-
functionName: "registerStripe",
|
|
363
|
-
args: [country, language, paymentIntentId, votes, 0, signature],
|
|
364
|
-
account,
|
|
365
|
-
chain: this.chain,
|
|
366
|
-
gas: options?.gasLimit
|
|
367
|
-
});
|
|
368
|
-
options?.onAccepted?.(hash);
|
|
369
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
370
|
-
if (typeof window !== "undefined") {
|
|
371
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
372
|
-
}
|
|
373
|
-
return receipt;
|
|
374
|
-
} catch (error) {
|
|
375
|
-
throw normalizeError(error);
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
fundStripe: async (paymentIntentId, votes, signature, options) => {
|
|
379
|
-
try {
|
|
380
|
-
const account = walletClient.account;
|
|
381
|
-
if (!account) throw new Error("No account connected to wallet");
|
|
382
|
-
const address = this.getFactoryAddress();
|
|
383
|
-
const hash = await walletClient.writeContract({
|
|
384
|
-
address,
|
|
385
|
-
abi: this.requireAbi("Factory"),
|
|
386
|
-
functionName: "fundStripe",
|
|
387
|
-
args: [paymentIntentId, votes, signature],
|
|
388
|
-
account,
|
|
389
|
-
chain: this.chain,
|
|
390
|
-
gas: options?.gasLimit
|
|
391
|
-
});
|
|
392
|
-
options?.onAccepted?.(hash);
|
|
393
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
394
|
-
if (typeof window !== "undefined") {
|
|
395
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
396
|
-
}
|
|
397
|
-
return receipt;
|
|
398
|
-
} catch (error) {
|
|
399
|
-
throw normalizeError(error);
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
addProjectVersion: async (projectId, lang, publicationDate, uri, name, headline, arweaveAddressLogo, arweaveAddressBanner, descriptionMarkdown, minimumFundingBeforeStartWork, maximumFunding, tags, status, complexity, options) => {
|
|
403
|
-
try {
|
|
404
|
-
const account = walletClient.account;
|
|
405
|
-
if (!account) {
|
|
406
|
-
throw new Error("No account connected to wallet");
|
|
407
|
-
}
|
|
408
|
-
const address = this.getFactoryAddress();
|
|
409
|
-
const hash = await walletClient.writeContract({
|
|
410
|
-
address,
|
|
411
|
-
abi: this.requireAbi("Factory"),
|
|
412
|
-
functionName: "addProjectVersion",
|
|
413
|
-
args: [
|
|
414
|
-
BigInt(projectId),
|
|
415
|
-
stringToBytes4(lang),
|
|
416
|
-
publicationDate,
|
|
417
|
-
uri,
|
|
418
|
-
name,
|
|
419
|
-
headline,
|
|
420
|
-
arweaveAddressLogo,
|
|
421
|
-
arweaveAddressBanner,
|
|
422
|
-
descriptionMarkdown,
|
|
423
|
-
minimumFundingBeforeStartWork,
|
|
424
|
-
maximumFunding,
|
|
425
|
-
tags,
|
|
426
|
-
status,
|
|
427
|
-
complexity
|
|
428
|
-
],
|
|
429
|
-
account,
|
|
430
|
-
chain: this.chain,
|
|
431
|
-
gas: options?.gasLimit
|
|
432
|
-
});
|
|
433
|
-
options?.onAccepted?.(hash);
|
|
434
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
435
|
-
if (typeof window !== "undefined") {
|
|
436
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
437
|
-
}
|
|
438
|
-
return receipt;
|
|
439
|
-
} catch (error) {
|
|
440
|
-
throw normalizeError(error);
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
|
-
deleteProject: async (projectId, lang, options) => {
|
|
444
|
-
try {
|
|
445
|
-
const account = walletClient.account;
|
|
446
|
-
if (!account) {
|
|
447
|
-
throw new Error("No account connected to wallet");
|
|
448
|
-
}
|
|
449
|
-
const address = this.getFactoryAddress();
|
|
450
|
-
const hash = await walletClient.writeContract({
|
|
451
|
-
address,
|
|
452
|
-
abi: this.requireAbi("Factory"),
|
|
453
|
-
functionName: "deleteProject",
|
|
454
|
-
args: [projectId, stringToBytes4(lang)],
|
|
455
|
-
account,
|
|
456
|
-
chain: this.chain,
|
|
457
|
-
gas: options?.gasLimit
|
|
458
|
-
});
|
|
459
|
-
options?.onAccepted?.(hash);
|
|
460
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
461
|
-
if (typeof window !== "undefined") {
|
|
462
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
463
|
-
}
|
|
464
|
-
return receipt;
|
|
465
|
-
} catch (error) {
|
|
466
|
-
throw normalizeError(error);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
createSubscriptionManagerWriteAPI(walletClient) {
|
|
472
|
-
return {
|
|
473
|
-
subscribeTo: async (subscriber, target, options) => {
|
|
474
|
-
try {
|
|
475
|
-
const account = walletClient.account;
|
|
476
|
-
if (!account) {
|
|
477
|
-
throw new Error("No account connected to wallet");
|
|
478
|
-
}
|
|
479
|
-
const targetUsername = await this.readonly.bouncerStorage.userIdToUsername(target);
|
|
480
|
-
if (!targetUsername) {
|
|
481
|
-
throw new Error(`Target user ID ${target} not registered (no username found)`);
|
|
482
|
-
}
|
|
483
|
-
const address = this.getFactoryAddress();
|
|
484
|
-
const hash = await walletClient.writeContract({
|
|
485
|
-
address,
|
|
486
|
-
abi: this.requireAbi("Factory"),
|
|
487
|
-
functionName: "subscribeTo",
|
|
488
|
-
args: [targetUsername],
|
|
489
|
-
account,
|
|
490
|
-
chain: this.chain,
|
|
491
|
-
gas: options?.gasLimit
|
|
492
|
-
});
|
|
493
|
-
options?.onAccepted?.(hash);
|
|
494
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
495
|
-
if (typeof window !== "undefined") {
|
|
496
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
497
|
-
}
|
|
498
|
-
return receipt;
|
|
499
|
-
} catch (error) {
|
|
500
|
-
throw normalizeError(error);
|
|
501
|
-
}
|
|
502
|
-
},
|
|
503
|
-
unsubscribeFrom: async (subscriber, target, options) => {
|
|
504
|
-
try {
|
|
505
|
-
const account = walletClient.account;
|
|
506
|
-
if (!account) {
|
|
507
|
-
throw new Error("No account connected to wallet");
|
|
508
|
-
}
|
|
509
|
-
const targetUsername = await this.readonly.bouncerStorage.userIdToUsername(target);
|
|
510
|
-
if (!targetUsername) {
|
|
511
|
-
throw new Error(`Target user ID ${target} not registered (no username found)`);
|
|
512
|
-
}
|
|
513
|
-
const address = this.getFactoryAddress();
|
|
514
|
-
const hash = await walletClient.writeContract({
|
|
515
|
-
address,
|
|
516
|
-
abi: this.requireAbi("Factory"),
|
|
517
|
-
functionName: "unsubscribeFrom",
|
|
518
|
-
args: [targetUsername],
|
|
519
|
-
account,
|
|
520
|
-
chain: this.chain,
|
|
521
|
-
gas: options?.gasLimit
|
|
522
|
-
});
|
|
523
|
-
options?.onAccepted?.(hash);
|
|
524
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
525
|
-
if (typeof window !== "undefined") {
|
|
526
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
527
|
-
}
|
|
528
|
-
return receipt;
|
|
529
|
-
} catch (error) {
|
|
530
|
-
throw normalizeError(error);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
createAddressRegistryWriteAPI(walletClient) {
|
|
536
|
-
return {
|
|
537
|
-
addData: async (key, value, options) => {
|
|
538
|
-
try {
|
|
539
|
-
const account = walletClient.account;
|
|
540
|
-
if (!account) {
|
|
541
|
-
throw new Error("No account connected to wallet");
|
|
542
|
-
}
|
|
543
|
-
const address = this.getRegistryAddress();
|
|
544
|
-
const hash = await walletClient.writeContract({
|
|
545
|
-
address,
|
|
546
|
-
abi: addressRegistryAbi,
|
|
547
|
-
functionName: "addData",
|
|
548
|
-
args: [key, value],
|
|
549
|
-
account,
|
|
550
|
-
chain: this.chain,
|
|
551
|
-
gas: options?.gasLimit
|
|
552
|
-
});
|
|
553
|
-
options?.onAccepted?.(hash);
|
|
554
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
555
|
-
if (typeof window !== "undefined") {
|
|
556
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
557
|
-
}
|
|
558
|
-
return receipt;
|
|
559
|
-
} catch (error) {
|
|
560
|
-
throw normalizeError(error);
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
getLibraryRegistryStorageAddress() {
|
|
566
|
-
const dynamic = addressLoader.getAddress(this.readonly.chainId, "libraryRegistryStorage", this.environment);
|
|
567
|
-
if (!dynamic) {
|
|
568
|
-
throw new Error(
|
|
569
|
-
`LibraryRegistryStorage address not resolved for chain ${this.readonly.chainId} (${this.environment}) \u2014 await client.ready before writing.`
|
|
570
|
-
);
|
|
571
|
-
}
|
|
572
|
-
return dynamic;
|
|
573
|
-
}
|
|
574
|
-
createLibraryRegistryStorageWriteAPI(walletClient) {
|
|
575
|
-
const executeWrite = async (functionName, args, options) => {
|
|
576
|
-
try {
|
|
577
|
-
const account = walletClient.account;
|
|
578
|
-
if (!account) throw new Error("No account connected to wallet");
|
|
579
|
-
const address = this.getLibraryRegistryStorageAddress();
|
|
580
|
-
const hash = await walletClient.writeContract({
|
|
581
|
-
address,
|
|
582
|
-
abi: this.requireAbi("LibraryRegistryStorage"),
|
|
583
|
-
functionName,
|
|
584
|
-
args,
|
|
585
|
-
account,
|
|
586
|
-
chain: this.chain,
|
|
587
|
-
gas: options?.gasLimit
|
|
588
|
-
});
|
|
589
|
-
options?.onAccepted?.(hash);
|
|
590
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
591
|
-
if (typeof window !== "undefined") {
|
|
592
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
593
|
-
}
|
|
594
|
-
return receipt;
|
|
595
|
-
} catch (error) {
|
|
596
|
-
throw normalizeError(error);
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
return {
|
|
600
|
-
addUnverifiedCollection: (input, options) => executeWrite("addUnverifiedCollection", [input], options),
|
|
601
|
-
verifyCollection: (id, options) => executeWrite("verifyCollection", [id], options),
|
|
602
|
-
rejectCollection: (id, options) => executeWrite("rejectCollection", [id], options),
|
|
603
|
-
updateCollectionStats: (id, initialBookCount, dSafeBookCount, options) => executeWrite("updateCollectionStats", [id, BigInt(initialBookCount), BigInt(dSafeBookCount)], options),
|
|
604
|
-
setImportStatus: (id, status, options) => executeWrite("setImportStatus", [id, status], options),
|
|
605
|
-
setPublished: (id, isPublished, options) => executeWrite("setPublished", [id, isPublished], options),
|
|
606
|
-
setCollectionPublicLibrary: (id, publicLibraryId, options) => executeWrite("setCollectionPublicLibrary", [id, BigInt(publicLibraryId)], options),
|
|
607
|
-
setPublicLibraryStorage: (storageAddr, options) => executeWrite("setPublicLibraryStorage", [storageAddr], options)
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
getPublicLibraryStorageAddress() {
|
|
611
|
-
const dynamic = addressLoader.getAddress(this.readonly.chainId, "publicLibraryStorage", this.environment);
|
|
612
|
-
if (!dynamic) {
|
|
613
|
-
throw new Error(
|
|
614
|
-
`PublicLibraryStorage address not resolved for chain ${this.readonly.chainId} (${this.environment}) \u2014 await client.ready before writing.`
|
|
615
|
-
);
|
|
616
|
-
}
|
|
617
|
-
return dynamic;
|
|
618
|
-
}
|
|
619
|
-
createPublicLibraryStorageWriteAPI(walletClient) {
|
|
620
|
-
const executeWrite = async (functionName, args, options) => {
|
|
621
|
-
try {
|
|
622
|
-
const account = walletClient.account;
|
|
623
|
-
if (!account) throw new Error("No account connected to wallet");
|
|
624
|
-
const address = this.getPublicLibraryStorageAddress();
|
|
625
|
-
const hash = await walletClient.writeContract({
|
|
626
|
-
address,
|
|
627
|
-
abi: this.requireAbi("PublicLibraryStorage"),
|
|
628
|
-
functionName,
|
|
629
|
-
args,
|
|
630
|
-
account,
|
|
631
|
-
chain: this.chain,
|
|
632
|
-
gas: options?.gasLimit
|
|
633
|
-
});
|
|
634
|
-
options?.onAccepted?.(hash);
|
|
635
|
-
const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
|
|
636
|
-
if (typeof window !== "undefined") {
|
|
637
|
-
window.dispatchEvent(new Event("wallet_transaction_accepted"));
|
|
638
|
-
}
|
|
639
|
-
return receipt;
|
|
640
|
-
} catch (error) {
|
|
641
|
-
throw normalizeError(error);
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
return {
|
|
645
|
-
addPublicLibrary: (input, options) => executeWrite("addPublicLibrary", [input], options),
|
|
646
|
-
updatePublicLibrary: (id, input, options) => executeWrite("updatePublicLibrary", [BigInt(id), input], options)
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
// src/web3/session/writeClient.ts
|
|
652
|
-
async function createWriteClient(connector, chainId, environment = "production") {
|
|
653
|
-
const evmConnector = connector;
|
|
654
|
-
if (typeof evmConnector.getWalletClient !== "function") {
|
|
655
|
-
throw new Error(`Connector '${connector.type}' does not support EVM write operations`);
|
|
656
|
-
}
|
|
657
|
-
const accounts = await connector.getAccounts();
|
|
658
|
-
const account = accounts[0];
|
|
659
|
-
if (!account) {
|
|
660
|
-
throw new Error(`No account available for wallet '${connector.type}' \u2014 connect() first`);
|
|
661
|
-
}
|
|
662
|
-
const evmClient = await getReadyEvmClient(chainId, environment);
|
|
663
|
-
const walletClient = await evmConnector.getWalletClient(chainId);
|
|
664
|
-
return new EvmWriteClient(connector.type, evmClient, walletClient, account);
|
|
665
|
-
}
|
|
666
|
-
async function createPrivateKeyWriteClient(chainId, privateKey, environment = "production") {
|
|
667
|
-
const evmClient = await getReadyEvmClient(chainId, environment);
|
|
668
|
-
const walletClient = createPrivateKeyWalletClient(chainId, privateKey);
|
|
669
|
-
const account = addressFromPrivateKey(privateKey);
|
|
670
|
-
return new EvmWriteClient("private_key", evmClient, walletClient, account);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
// src/web3/session/mutations.ts
|
|
674
|
-
import { serializePatches, getLevel } from "@the_library/public/models";
|
|
675
|
-
var running = { lastRun: 0, running: false };
|
|
676
|
-
var resetTransactionState = () => {
|
|
677
|
-
running.running = false;
|
|
678
|
-
running.lastRun = 0;
|
|
679
|
-
};
|
|
680
|
-
var checkRunning = () => {
|
|
681
|
-
if (running.running && Date.now() - running.lastRun < 1e3 * 60) {
|
|
682
|
-
return false;
|
|
683
|
-
}
|
|
684
|
-
running.lastRun = Date.now();
|
|
685
|
-
running.running = true;
|
|
686
|
-
return true;
|
|
687
|
-
};
|
|
688
|
-
var handleWriteOperationErrors = (wallet, chainId, e) => {
|
|
689
|
-
console.error(`[session/mutations] error while transaction wallet=${wallet} chainId=${chainId}`, e);
|
|
690
|
-
resetTransactionState();
|
|
691
|
-
const isUserRejection = normalizeError(e).code === "USER_REJECTED";
|
|
692
|
-
WalletEvents.emitWalletError({
|
|
693
|
-
wallet,
|
|
694
|
-
chainId,
|
|
695
|
-
timestamp: Date.now(),
|
|
696
|
-
reason: isUserRejection ? "USER_REJECTED" /* USER_REJECTED */ : e?.code ?? "UNKNOWN_ERROR" /* UNKNOWN_ERROR */,
|
|
697
|
-
args: e
|
|
698
|
-
});
|
|
699
|
-
};
|
|
700
|
-
var transactionStarted = (wallet, chainId) => {
|
|
701
|
-
WalletEvents.emitWalletStateEvent({ wallet, chainId, event: "TRANSACTION_STARTED" /* TRANSACTION_STARTED */, timestamp: Date.now() });
|
|
702
|
-
};
|
|
703
|
-
var transactionDone = (wallet, chainId) => {
|
|
704
|
-
WalletEvents.emitWalletStateEvent({ wallet, chainId, event: "TRANSACTION_DONE" /* TRANSACTION_DONE */, timestamp: Date.now() });
|
|
705
|
-
};
|
|
706
|
-
var preTransaction = async (wallet, chainId) => {
|
|
707
|
-
if (!checkRunning()) {
|
|
708
|
-
console.log("[session/mutations] preTransaction skipped \u2014 another transaction is running, wait 1min");
|
|
709
|
-
return false;
|
|
710
|
-
}
|
|
711
|
-
return true;
|
|
712
|
-
};
|
|
713
|
-
var postTransaction = async (wallet, chainId, account) => {
|
|
714
|
-
running.running = false;
|
|
715
|
-
running.lastRun = 0;
|
|
716
|
-
WalletEvents.emitWalletStateEvent({
|
|
717
|
-
wallet,
|
|
718
|
-
chainId,
|
|
719
|
-
event: "UPDATING_STATE_STARTED" /* UPDATING_STATE_STARTED */,
|
|
720
|
-
functionName: "syncAccount",
|
|
721
|
-
timestamp: Date.now()
|
|
722
|
-
});
|
|
723
|
-
try {
|
|
724
|
-
await syncAccount(account, chainId, wallet, "production", true);
|
|
725
|
-
} catch (e) {
|
|
726
|
-
WalletEvents.emitWalletStateEvent({
|
|
727
|
-
wallet,
|
|
728
|
-
chainId,
|
|
729
|
-
event: "UPDATING_STATE_FAILED" /* UPDATING_STATE_FAILED */,
|
|
730
|
-
functionName: "syncAccount",
|
|
731
|
-
timestamp: Date.now()
|
|
732
|
-
});
|
|
733
|
-
console.error(e);
|
|
734
|
-
return false;
|
|
735
|
-
}
|
|
736
|
-
WalletEvents.emitWalletStateEvent({
|
|
737
|
-
wallet,
|
|
738
|
-
chainId,
|
|
739
|
-
event: "UPDATING_STATE_DONE" /* UPDATING_STATE_DONE */,
|
|
740
|
-
functionName: "syncAccount",
|
|
741
|
-
timestamp: Date.now()
|
|
742
|
-
});
|
|
743
|
-
return true;
|
|
744
|
-
};
|
|
745
|
-
async function getWriteClient(wallet, chainId) {
|
|
746
|
-
const connector = getConnector(wallet);
|
|
747
|
-
if (!connector) {
|
|
748
|
-
throw new Error(`No connector registered for wallet '${wallet}' \u2014 bootstrapWebSDK() must run first`);
|
|
749
|
-
}
|
|
750
|
-
return createWriteClient(connector, chainId);
|
|
751
|
-
}
|
|
752
|
-
async function runWriteOperation(wallet, chainId, account, fn, afterWrite) {
|
|
753
|
-
if (!await preTransaction(wallet, chainId)) return false;
|
|
754
|
-
transactionStarted(wallet, chainId);
|
|
755
|
-
try {
|
|
756
|
-
const client = await getWriteClient(wallet, chainId);
|
|
757
|
-
await fn(client);
|
|
758
|
-
} catch (e) {
|
|
759
|
-
handleWriteOperationErrors(wallet, chainId, e);
|
|
760
|
-
throw e;
|
|
761
|
-
}
|
|
762
|
-
transactionDone(wallet, chainId);
|
|
763
|
-
afterWrite?.();
|
|
764
|
-
return postTransaction(wallet, chainId, account);
|
|
765
|
-
}
|
|
766
|
-
var writeOperations = {
|
|
767
|
-
register: (wallet, chainId, account, amount) => {
|
|
768
|
-
const userGeo = typeof window !== "undefined" ? window.__userGeo : void 0;
|
|
769
|
-
let countryCode;
|
|
770
|
-
let languageCode;
|
|
771
|
-
if (userGeo?.location && userGeo?.locale) {
|
|
772
|
-
countryCode = userGeo.location.toUpperCase();
|
|
773
|
-
languageCode = userGeo.locale.split("-")[0];
|
|
774
|
-
} else {
|
|
775
|
-
const defaultLanguage = "en";
|
|
776
|
-
const defaultCountry = "";
|
|
777
|
-
const hasNavigator = typeof navigator !== "undefined";
|
|
778
|
-
const parts = hasNavigator ? navigator.language.split("-") : [defaultLanguage];
|
|
779
|
-
languageCode = parts[0];
|
|
780
|
-
countryCode = parts.length > 1 ? parts[1].toUpperCase() : defaultCountry;
|
|
781
|
-
}
|
|
782
|
-
return runWriteOperation(
|
|
783
|
-
wallet,
|
|
784
|
-
chainId,
|
|
785
|
-
account,
|
|
786
|
-
(client) => client.factory.register(countryCode, languageCode, amount, { value: amount })
|
|
787
|
-
);
|
|
788
|
-
},
|
|
789
|
-
retire: (wallet, chainId, account, options) => runWriteOperation(wallet, chainId, account, (client) => client.factory.unregister(options)),
|
|
790
|
-
vote: (wallet, chainId, account, projectId, lang, amount, options) => runWriteOperation(wallet, chainId, account, (client) => client.factory.donateToProject(projectId, lang, amount, options)),
|
|
791
|
-
save: (wallet, chainId, account, compressedActions, textIndexes, textData, level, options) => runWriteOperation(
|
|
792
|
-
wallet,
|
|
793
|
-
chainId,
|
|
794
|
-
account,
|
|
795
|
-
(client) => client.factory.save(compressedActions, level, textIndexes, textData, options),
|
|
796
|
-
() => {
|
|
797
|
-
if (!options?.skipCounterUpdate) {
|
|
798
|
-
const { lastPatchIndex } = sessionStore.lastSyncCounters(account, chainId);
|
|
799
|
-
sessionStore.setLastSavedPatchIndex(account, chainId, lastPatchIndex + compressedActions.length);
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
),
|
|
803
|
-
// postTransaction's syncAccount() refresh also runs SubscriptionClient.syncSince()
|
|
804
|
-
// (session/sync.ts) — the graph change from these two writes is picked up
|
|
805
|
-
// automatically, no bespoke "refresh subscriptions" step needed (spec §4.7/§15.8).
|
|
806
|
-
subscribe: (wallet, chainId, account, subscriber, target) => runWriteOperation(wallet, chainId, account, (client) => client.subscriptionManager.subscribeTo(subscriber, target)),
|
|
807
|
-
unsubscribe: (wallet, chainId, account, subscriber, target) => runWriteOperation(wallet, chainId, account, (client) => client.subscriptionManager.unsubscribeFrom(subscriber, target))
|
|
808
|
-
};
|
|
809
|
-
async function saveMyLevel(wallet, chainId, account, options) {
|
|
810
|
-
const { lastPatchIndex } = sessionStore.lastSyncCounters(account, chainId);
|
|
811
|
-
const nbPatches = await getNbPatches("mine");
|
|
812
|
-
if (nbPatches <= lastPatchIndex) return false;
|
|
813
|
-
const payload = await serializePatches(lastPatchIndex, nbPatches);
|
|
814
|
-
const level = getLevel("mine").level;
|
|
815
|
-
return writeOperations.save(wallet, chainId, account, payload.patches, payload.textIndex, payload.textData, level, options);
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
// src/web3/wallet/browsers.ts
|
|
819
|
-
var Browser = /* @__PURE__ */ ((Browser2) => {
|
|
820
|
-
Browser2["chromium"] = "chromium";
|
|
821
|
-
Browser2["firefox"] = "firefox";
|
|
822
|
-
Browser2["safari"] = "safari";
|
|
823
|
-
Browser2["edge"] = "edge";
|
|
824
|
-
Browser2["opera"] = "opera";
|
|
825
|
-
Browser2["brave"] = "brave";
|
|
826
|
-
Browser2["vivaldi"] = "vivaldi";
|
|
827
|
-
Browser2["yandex"] = "yandex";
|
|
828
|
-
Browser2["palemoon"] = "palemoon";
|
|
829
|
-
return Browser2;
|
|
830
|
-
})(Browser || {});
|
|
831
|
-
var Platform = /* @__PURE__ */ ((Platform2) => {
|
|
832
|
-
Platform2["android"] = "android";
|
|
833
|
-
Platform2["ios"] = "ios";
|
|
834
|
-
Platform2["browsers"] = "browsers";
|
|
835
|
-
return Platform2;
|
|
836
|
-
})(Platform || {});
|
|
837
|
-
var parseUserAgent = (userAgent = typeof navigator !== "undefined" ? navigator.userAgent : "") => {
|
|
838
|
-
const ua = userAgent.toLowerCase();
|
|
839
|
-
let browser;
|
|
840
|
-
if (ua.includes("yabrowser") || ua.includes("yandex")) {
|
|
841
|
-
browser = "yandex" /* yandex */;
|
|
842
|
-
} else if (ua.includes("brave")) {
|
|
843
|
-
browser = "brave" /* brave */;
|
|
844
|
-
} else if (ua.includes("vivaldi")) {
|
|
845
|
-
browser = "vivaldi" /* vivaldi */;
|
|
846
|
-
} else if (ua.includes("palemoon")) {
|
|
847
|
-
browser = "palemoon" /* palemoon */;
|
|
848
|
-
} else if (ua.includes("edg/") || ua.includes("edge/")) {
|
|
849
|
-
browser = "edge" /* edge */;
|
|
850
|
-
} else if (ua.includes("opr/") || ua.includes("opera/")) {
|
|
851
|
-
browser = "opera" /* opera */;
|
|
852
|
-
} else if (ua.includes("firefox/")) {
|
|
853
|
-
browser = "firefox" /* firefox */;
|
|
854
|
-
} else if (ua.includes("safari/") && !ua.includes("chrome/")) {
|
|
855
|
-
browser = "safari" /* safari */;
|
|
856
|
-
} else if (ua.includes("chrome/") || ua.includes("chromium/")) {
|
|
857
|
-
browser = "chromium" /* chromium */;
|
|
858
|
-
} else {
|
|
859
|
-
browser = "chromium" /* chromium */;
|
|
860
|
-
}
|
|
861
|
-
let platform;
|
|
862
|
-
if (ua.includes("android")) {
|
|
863
|
-
platform = "android" /* android */;
|
|
864
|
-
} else if (ua.includes("iphone") || ua.includes("ipad") || ua.includes("ipod")) {
|
|
865
|
-
platform = "ios" /* ios */;
|
|
866
|
-
} else {
|
|
867
|
-
platform = "browsers" /* browsers */;
|
|
868
|
-
}
|
|
869
|
-
return {
|
|
870
|
-
browser,
|
|
871
|
-
platform
|
|
872
|
-
};
|
|
873
|
-
};
|
|
874
|
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i4zIDE1LjVoMzguM2wyMi40LTE1LjUgMTEtOXoiLz4KICA8cGF0aCBmaWxsPSIjMTYxNjE2IiBzdHJva2U9IiMxNjE2MTYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0ibTE3Ny45IDIzMC45LTQuOC0zLjNoLTI3LjdsLTQuOCAzLjMtMi41LIUyLjEgMi4zLTIuMmgzNy43bDIuNSAyLjJ6Ii8+CiAgPHBhdGggZmlsbD0iIzc2M2QxNiIgc3Ryb2tlPSIjNzYzZDE2IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Im0yNzguMyAxMTQuMiA4LjUtNDAuOC0xMi43LTM3LjktOTYuMiA3MS40IDM3IDMxLjMgNTIuMyAxNS4zIDExLjYtMTMuNS01LTMuNiA4LTcuMy02LjItNC44IDgtNi4xek0zMS44IDczLjRsOC41IDQwLjgtNS40IDQgOCA2LjEtNi4xIDQuOCA4IDcuMy01IDMuNiAxMS41IDEzLjUgNTIuMy0xNS4zID3LTMxLjMtOTYuMi03MS40eiIvPgogIDxwYXRoIGQ9Im0yNjcuMiAxNTMuNS01Mi4zLTE1LjMgMTUuOSAyMy45LTIzLjcgNDYgMzEuMi0uNGg0Ni41em0tMTYzLjYtMTUuMy01Mi4zIDE1LjMtMTcuNCA1NC4yaDQ2LjRsMzEuMS40LTIzLjYtNDZ6bTcxIDI2LjQgMy4zLTU3LjcgMTUuMi00MS4xaC02Ny41bDE1IDQxLjEgMy41IDU3LjcgMS4yIDE4LjIuMSA0NC44aDI3LjdsLjItNDQuOHoiIGNsYXNzPSJzdDYiLz4KPC9zdmc+";
|
|
877
|
-
var walletMeta = {
|
|
878
|
-
metamask: {
|
|
879
|
-
displayName: "MetaMask",
|
|
880
|
-
logoUrl: METAMASK_LOGO_BASE64,
|
|
881
|
-
description: "The most popular Ethereum wallet extension",
|
|
882
|
-
website: "https://metamask.io/",
|
|
883
|
-
isInstalled() {
|
|
884
|
-
return typeof window !== "undefined" && typeof window.ethereum !== "undefined" && window.ethereum.isMetaMask;
|
|
885
|
-
},
|
|
886
|
-
isInstallable() {
|
|
887
|
-
try {
|
|
888
|
-
this.getInstallUrl();
|
|
889
|
-
return true;
|
|
890
|
-
} catch {
|
|
891
|
-
return false;
|
|
892
|
-
}
|
|
893
|
-
},
|
|
894
|
-
getInstallUrl(customBrowser) {
|
|
895
|
-
const { browser, platform } = parseUserAgent();
|
|
896
|
-
const targetBrowser = customBrowser || browser;
|
|
897
|
-
switch (platform) {
|
|
898
|
-
case "android" /* android */:
|
|
899
|
-
return "https://play.google.com/store/apps/details?id=io.metamask";
|
|
900
|
-
case "ios" /* ios */:
|
|
901
|
-
return "https://apps.apple.com/us/app/metamask-crypto-wallet/id1438144202";
|
|
902
|
-
case "browsers" /* browsers */:
|
|
903
|
-
switch (targetBrowser) {
|
|
904
|
-
case "chromium" /* chromium */:
|
|
905
|
-
case "brave" /* brave */:
|
|
906
|
-
return "https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn";
|
|
907
|
-
case "firefox" /* firefox */:
|
|
908
|
-
return "https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/";
|
|
909
|
-
case "opera" /* opera */:
|
|
910
|
-
return "https://addons.opera.com/en/extensions/details/metamask/";
|
|
911
|
-
case "edge" /* edge */:
|
|
912
|
-
return "https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm";
|
|
913
|
-
default:
|
|
914
|
-
throw new Error(`Browser ${targetBrowser} is not supported for installation of MetaMask extension.`);
|
|
915
|
-
}
|
|
916
|
-
default:
|
|
917
|
-
throw new Error(`Platform ${platform} is not supported for MetaMask.`);
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
},
|
|
921
|
-
private_key: {
|
|
922
|
-
displayName: "Private Key",
|
|
923
|
-
logoUrl: "",
|
|
924
|
-
description: "Direct embedded wallet using a raw private key",
|
|
925
|
-
website: "",
|
|
926
|
-
isInstalled() {
|
|
927
|
-
return true;
|
|
928
|
-
},
|
|
929
|
-
isInstallable() {
|
|
930
|
-
return false;
|
|
931
|
-
},
|
|
932
|
-
getInstallUrl() {
|
|
933
|
-
return "";
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
};
|
|
937
|
-
|
|
938
|
-
// src/web3/index.ts
|
|
939
|
-
import { formatEther, parseEther as parseEther2 } from "viem";
|
|
940
|
-
export {
|
|
941
|
-
Browser,
|
|
942
|
-
CACHE_DURATION_MS,
|
|
943
|
-
DEFAULT_CHAIN_ID,
|
|
944
|
-
EVM_CHAINS,
|
|
945
|
-
EventBus,
|
|
946
|
-
EventName,
|
|
947
|
-
EvmClient,
|
|
948
|
-
EvmWriteClient,
|
|
949
|
-
LibraryOwnership,
|
|
950
|
-
MetaMaskConnector,
|
|
951
|
-
NodeFileCacheStorage,
|
|
952
|
-
Platform,
|
|
953
|
-
PreferredFormat,
|
|
954
|
-
PrivateKeyConnector,
|
|
955
|
-
RegistryAddressLoader,
|
|
956
|
-
SubscriptionClient,
|
|
957
|
-
WalletError,
|
|
958
|
-
WalletEvents,
|
|
959
|
-
WalletState,
|
|
960
|
-
WalletUxError,
|
|
961
|
-
addressFromPrivateKey,
|
|
962
|
-
addressLoader,
|
|
963
|
-
addressRegistryAbi,
|
|
964
|
-
allRegisteredAccounts,
|
|
965
|
-
createEvmClient,
|
|
966
|
-
createMetaMaskConnector,
|
|
967
|
-
createNodeFileCacheStorage,
|
|
968
|
-
createPrivateKeyConnector,
|
|
969
|
-
createPrivateKeyWalletClient,
|
|
970
|
-
createPrivateKeyWriteClient,
|
|
971
|
-
createSessionStore,
|
|
972
|
-
createWriteClient,
|
|
973
|
-
cursorStore,
|
|
974
|
-
deserializeCursor,
|
|
975
|
-
emptyCursor,
|
|
976
|
-
formatEther,
|
|
977
|
-
getCachedEmail,
|
|
978
|
-
getChain,
|
|
979
|
-
getConnector,
|
|
980
|
-
getContractAbi,
|
|
981
|
-
getDecryptedPrivateKey,
|
|
982
|
-
getEventBus,
|
|
983
|
-
getEvmClient,
|
|
984
|
-
getPrivateKey,
|
|
985
|
-
getReadClient,
|
|
986
|
-
getReadyEvmClient,
|
|
987
|
-
getRegisteredConnectors,
|
|
988
|
-
getRegistryBaseUrl,
|
|
989
|
-
getSubscriptionClient,
|
|
990
|
-
handleWriteOperationErrors,
|
|
991
|
-
hasAnyPrivateKey,
|
|
992
|
-
hasEncryptedPrivateKey,
|
|
993
|
-
hasPrivateKey,
|
|
994
|
-
hasUnsavedPatches,
|
|
995
|
-
loadNetworkInfos,
|
|
996
|
-
loadProject,
|
|
997
|
-
loadProjects,
|
|
998
|
-
parseEther2 as parseEther,
|
|
999
|
-
parseUserAgent,
|
|
1000
|
-
projectLocale,
|
|
1001
|
-
pythAbi,
|
|
1002
|
-
readOnlyClients,
|
|
1003
|
-
readOnlyStagingClients,
|
|
1004
|
-
registerConnector,
|
|
1005
|
-
resetTransactionState,
|
|
1006
|
-
restoreAccountSave,
|
|
1007
|
-
saveMyLevel,
|
|
1008
|
-
serializeCursor,
|
|
1009
|
-
sessionStore,
|
|
1010
|
-
setCachedEmail,
|
|
1011
|
-
setRegistryBaseUrl,
|
|
1012
|
-
sidecarUrlsFromManifest,
|
|
1013
|
-
storeEncryptedPrivateKey,
|
|
1014
|
-
storePrivateKey,
|
|
1015
|
-
syncAccount,
|
|
1016
|
-
toViemChain,
|
|
1017
|
-
walletMeta,
|
|
1018
|
-
writeOperations
|
|
1019
|
-
};
|
|
1
|
+
import{$ as mt,A as re,B as Ve,C as Qe,D as Je,E as $e,F as qe,G as Xe,H as Z,I as G,J as Ke,K as et,L as Y,M as tt,N as nt,O as V,P as rt,Q as it,R as at,S as st,T as ot,U as ct,V as ut,W as dt,X as pt,Y as lt,Z as Q,_ as J,a as x,aa as gt,b as R,ba as yt,c as ne,ca as bt,d as S,da as ft,e as _,ea as ht,f as m,fa as It,g as O,ga as wt,h as We,i as Ee,j as Oe,k as je,l as De,m as ke,n as j,o as Ue,p as A,q as Be,r as h,s as Fe,t as ze,u as He,v as _e,w as Ze,x as Ge,y as Ye,z as T}from"../chunk-3XUKOVEF.js";import{a as Ne}from"../chunk-EMA2QJTW.js";import{a as Se,b as Me,c as ve,d as Le,e as Ce,f as xe,g as f,h as Re}from"../chunk-FN52YV7L.js";import{c as H}from"../chunk-GWQNULP4.js";import{$a as F,Ka as W,La as E,_a as B,db as z,l as U}from"../chunk-7G3BMGV2.js";var ie=(n=>(n[n.Public=0]="Public",n[n.Private=1]="Private",n))(ie||{});import{encodeFunctionData as ae,formatEther as M,parseEther as se}from"viem";var v=class{constructor(e,n,t,r){this.wallet=e,this.readonly=n,this.config=n.config,this.environment=n.environment,this.chain=n.chain,this.publicClient=n.publicClient,this._account=r,this.walletClient=t,this.writeOnly={factory:this.createFactoryWriteAPI(t),accountManager:this.createAccountManagerWriteAPI(t),bouncerStorage:this.createBouncerStorageWriteAPI(t),subscriptionManager:this.createSubscriptionManagerWriteAPI(t),addressRegistry:this.createAddressRegistryWriteAPI(t),libraryRegistryStorage:this.createLibraryRegistryStorageWriteAPI(t),publicLibraryStorage:this.createPublicLibraryStorageWriteAPI(t),dSafeHRStorage:this.createDSafeHRStorageWriteAPI(t),sendNative:this.sendNative.bind(this)}}async sendNative(e,n){let t=this.walletClient.account;if(!t)throw new Error("No account connected to wallet");return await this.walletClient.sendTransaction({account:t,to:e,value:se(n),chain:this.chain})}async minimumFeesIfShort(e,n,t){let r,i,a,o;try{let p=t();[r,{maxFeePerGas:i},{baseFeePerGas:a},o]=await Promise.all([this.publicClient.request({method:"eth_estimateGas",params:[{from:e,to:n,data:p}]}).then(BigInt),this.publicClient.estimateFeesPerGas(),this.publicClient.getBlock(),this.publicClient.getBalance({address:e})])}catch{return{}}if(!a||r*i<=o)return{};let c=this.chain.nativeCurrency.symbol,u=r*a,d=u<=o;if(typeof window<"u"&&window.dispatchEvent(new CustomEvent("wallet_low_balance",{detail:{needed:M(r*i),minimum:M(u),balance:M(o),symbol:c,fits:d}})),!d)throw new _("INSUFFICIENT_FUNDS",`Not enough ${c} for this save: it needs ~${Number(M(u)).toFixed(4)} ${c}, the wallet holds ${Number(M(o)).toFixed(4)} ${c}. Top up your gas.`);return{gas:r,maxFeePerGas:a,maxPriorityFeePerGas:0n}}get accountManager(){return this.writeOnly.accountManager}get bouncerStorage(){return this.writeOnly.bouncerStorage}get factory(){return this.writeOnly.factory}get subscriptionManager(){return this.writeOnly.subscriptionManager}get addressRegistry(){return this.writeOnly.addressRegistry}get libraryRegistryStorage(){return this.writeOnly.libraryRegistryStorage}get publicLibraryStorage(){return this.writeOnly.publicLibraryStorage}get dSafeHRStorage(){return this.writeOnly.dSafeHRStorage}getChainId(){return this.readonly.chainId}account(){return this._account}getNormalizedAddress(e){return e.toLowerCase()}requireAbi(e){let n=f.getAbi(this.readonly.chainId,e,this.environment);if(!n)throw new Error(`[EvmWriteClient] Registry ABI for '${e}' on chain ${this.readonly.chainId} is not loaded. The AddressRegistry may be offline, incomplete, or the chain has not finished syncing. Write operations are blocked until the registry is ready.`);return n}getFactoryAddress(){let e=f.getAddress(this.readonly.chainId,"factory",this.environment);if(!e)throw new Error(`Factory address not resolved for chain ${this.readonly.chainId} (${this.environment}) \u2014 await client.ready before writing.`);return e}getRegistryAddress(){let e=this.readonly.activeRegistryAddress;if(!e)throw new Error(`AddressRegistry address not configured for chain ${this.readonly.chainId} (${this.environment})`);return e}createFactoryWriteAPI(e){let n=async()=>{if(!this.config.main)return;let{price:t}=this.config;if(t.stable)return;let{pythOracle:r,usdPriceId:i}=t;if(!r||!i)return;let a=await fetch(`https://hermes.pyth.network/v2/updates/price/latest?ids[]=${i}&encoding=hex`);if(!a.ok)throw new Error(`Hermes price fetch failed: ${a.status}`);let c=(await a.json()).binary?.data??[];if(c.length===0)throw new Error("No price update data from Hermes");let u=c.map(g=>`0x${g}`),d=await this.publicClient.readContract({address:r,abi:x,functionName:"getUpdateFee",args:[u]}),p=e.account,l=await e.writeContract({address:r,abi:x,functionName:"updatePriceFeeds",args:[u],account:p,chain:this.chain,value:d});await this.publicClient.waitForTransactionReceipt({hash:l})};return{donateToProject:async(t,r,i,a)=>{try{let o=e.account;if(!o)throw new Error("No account connected to wallet");let c=this.getFactoryAddress(),u=BigInt(Math.round(i)),d=await e.writeContract({address:c,abi:this.requireAbi("Factory"),functionName:"voteForProject",args:[t,S(r),u],account:o,chain:this.chain,gas:a?.gasLimit});a?.onAccepted?.(d);let p=await this.publicClient.waitForTransactionReceipt({hash:d});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),p}catch(o){throw m(o)}},save:async(t,r,i,a,o)=>{try{let c=e.account;if(!c)throw new Error("No account connected to wallet");let u=this.getFactoryAddress(),d=this.requireAbi("Factory"),p=[t,r,i,a],l=o?.gasLimit?{}:await this.minimumFeesIfShort(c.address,u,()=>ae({abi:d,functionName:"save",args:p})),g=await e.writeContract({address:u,abi:d,functionName:"save",args:p,account:c,chain:this.chain,gas:o?.gasLimit,...l});o?.onAccepted?.(g);let y=await this.publicClient.waitForTransactionReceipt({hash:g});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),y}catch(c){throw m(c)}},createProject:async(t,r,i,a,o,c,u,d,p,l,g,y,b)=>{try{let w=e.account;if(!w)throw new Error("No account connected to wallet");let C=this.getFactoryAddress(),P=await e.writeContract({address:C,abi:this.requireAbi("Factory"),functionName:"createProject",args:[S(t),O(r),i,a,o,c,u,d,p,l,g,y],account:w,chain:this.chain,gas:b?.gasLimit});b?.onAccepted?.(P);let N=await this.publicClient.waitForTransactionReceipt({hash:P});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),N}catch(w){throw m(w)}},addProjectVersion:async(t,r,i,a,o,c,u,d,p,l,g,y,b,w,C)=>{try{let P=e.account;if(!P)throw new Error("No account connected to wallet");let N=this.getFactoryAddress(),k=await e.writeContract({address:N,abi:this.requireAbi("Factory"),functionName:"addProjectVersion",args:[BigInt(t),S(r),i,O(a),o,c,u,d,p,l,g,y,b,w],account:P,chain:this.chain,gas:C?.gasLimit});C?.onAccepted?.(k);let te=await this.publicClient.waitForTransactionReceipt({hash:k});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),te}catch(P){throw m(P)}},deleteProject:async(t,r,i)=>{try{let a=e.account;if(!a)throw new Error("No account connected to wallet");let o=this.getFactoryAddress(),c=await e.writeContract({address:o,abi:this.requireAbi("Factory"),functionName:"deleteProject",args:[t,S(r)],account:a,chain:this.chain,gas:i?.gasLimit});i?.onAccepted?.(c);let u=await this.publicClient.waitForTransactionReceipt({hash:c});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),u}catch(a){throw m(a)}},setVotePresets:async(t,r)=>{try{let i=e.account;if(!i)throw new Error("No account connected to wallet");let a=await e.writeContract({address:this.getFactoryAddress(),abi:this.requireAbi("Factory"),functionName:"setVotePresets",args:[t.map(o=>o.projectId),t.map(o=>S(o.lang)),t.map(o=>o.bps)],account:i,chain:this.chain,gas:r?.gasLimit});return r?.onAccepted?.(a),await this.publicClient.waitForTransactionReceipt({hash:a})}catch(i){throw m(i)}}}}createSubscriptionManagerWriteAPI(e){return{subscribeTo:async(n,t,r)=>{try{let i=e.account;if(!i)throw new Error("No account connected to wallet");let a=await this.readonly.bouncerStorage.userIdToUsername(t);if(!a)throw new Error(`Target user ID ${t} not registered (no username found)`);let o=this.getFactoryAddress(),c=await e.writeContract({address:o,abi:this.requireAbi("Factory"),functionName:"subscribeTo",args:[a],account:i,chain:this.chain,gas:r?.gasLimit});r?.onAccepted?.(c);let u=await this.publicClient.waitForTransactionReceipt({hash:c});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),u}catch(i){throw m(i)}},unsubscribeFrom:async(n,t,r)=>{try{let i=e.account;if(!i)throw new Error("No account connected to wallet");let a=await this.readonly.bouncerStorage.userIdToUsername(t);if(!a)throw new Error(`Target user ID ${t} not registered (no username found)`);let o=this.getFactoryAddress(),c=await e.writeContract({address:o,abi:this.requireAbi("Factory"),functionName:"unsubscribeFrom",args:[a],account:i,chain:this.chain,gas:r?.gasLimit});r?.onAccepted?.(c);let u=await this.publicClient.waitForTransactionReceipt({hash:c});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),u}catch(i){throw m(i)}}}}getAccountManagerAddress(){let e=f.getAddress(this.readonly.chainId,"accountManager",this.environment);if(!e)throw new Error(`AccountManager address not resolved for chain ${this.readonly.chainId} (${this.environment})`);return e}getBouncerStorageAddress(){let e=f.getAddress(this.readonly.chainId,"bouncerStorage",this.environment);if(!e)throw new Error(`BouncerStorage address not resolved for chain ${this.readonly.chainId} (${this.environment})`);return e}createBouncerStorageWriteAPI(e){return{newAccount:async(n,t,r,i,a,o)=>{try{let c=e.account;if(!c)throw new Error("No account connected to wallet");let u=this.getBouncerStorageAddress(),d=await e.writeContract({address:u,abi:this.requireAbi("BouncerStorage"),functionName:"newAccount",args:[n,t,r,i,a],account:c,chain:this.chain,gas:o?.gasLimit});o?.onAccepted?.(d);let p=await this.publicClient.waitForTransactionReceipt({hash:d});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),p}catch(c){throw m(c)}}}}createAccountManagerWriteAPI(e){return{registerStripe:async(n,t,r,i,a,o,c)=>{try{let u=e.account;if(!u)throw new Error("No account connected to wallet");let d=this.getAccountManagerAddress(),p=await e.writeContract({address:d,abi:this.requireAbi("AccountManager"),functionName:"registerStripe",args:[n,t,r,i,0n,a,o],account:u,chain:this.chain,gas:c?.gasLimit});c?.onAccepted?.(p);let l=await this.publicClient.waitForTransactionReceipt({hash:p});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),l}catch(u){throw m(u)}},fundStripe:async(n,t,r,i)=>{try{let a=e.account;if(!a)throw new Error("No account connected to wallet");let o=this.getAccountManagerAddress(),c=await e.writeContract({address:o,abi:this.requireAbi("AccountManager"),functionName:"fundStripe",args:[n,t,r],account:a,chain:this.chain,gas:i?.gasLimit});i?.onAccepted?.(c);let u=await this.publicClient.waitForTransactionReceipt({hash:c});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),u}catch(a){throw m(a)}},unregisterWithConsent:async(n,t,r)=>{try{let i=e.account;if(!i)throw new Error("No account connected to wallet");let a=this.getAccountManagerAddress(),o=await e.writeContract({address:a,abi:this.requireAbi("AccountManager"),functionName:"unregisterWithConsent",args:[BigInt(n),t],account:i,chain:this.chain,gas:r?.gasLimit});r?.onAccepted?.(o);let c=await this.publicClient.waitForTransactionReceipt({hash:o});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),c}catch(i){throw m(i)}}}}createAddressRegistryWriteAPI(e){return{addData:async(n,t,r)=>{try{let i=e.account;if(!i)throw new Error("No account connected to wallet");let a=this.getRegistryAddress(),o=await e.writeContract({address:a,abi:R,functionName:"addData",args:[n,t],account:i,chain:this.chain,gas:r?.gasLimit});r?.onAccepted?.(o);let c=await this.publicClient.waitForTransactionReceipt({hash:o});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),c}catch(i){throw m(i)}},addBlobRef:async(n,t,r,i)=>{try{let a=e.account;if(!a)throw new Error("No account connected to wallet");let o=this.getRegistryAddress(),c=await e.writeContract({address:o,abi:R,functionName:"addBlobRef",args:[n,t,r],account:a,chain:this.chain,gas:i?.gasLimit});i?.onAccepted?.(c);let u=await this.publicClient.waitForTransactionReceipt({hash:c});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),u}catch(a){throw m(a)}}}}getLibraryRegistryStorageAddress(){let e=f.getAddress(this.readonly.chainId,"libraryRegistryStorage",this.environment);if(!e)throw new Error(`LibraryRegistryStorage address not resolved for chain ${this.readonly.chainId} (${this.environment}) \u2014 await client.ready before writing.`);return e}createLibraryRegistryStorageWriteAPI(e){let n=async(t,r,i)=>{try{let a=e.account;if(!a)throw new Error("No account connected to wallet");let o=this.getLibraryRegistryStorageAddress(),c=await e.writeContract({address:o,abi:this.requireAbi("LibraryRegistryStorage"),functionName:t,args:r,account:a,chain:this.chain,gas:i?.gasLimit});i?.onAccepted?.(c);let u=await this.publicClient.waitForTransactionReceipt({hash:c});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),u}catch(a){throw m(a)}};return{addUnverifiedCollection:(t,r)=>n("addUnverifiedCollection",[t],r),verifyCollection:(t,r)=>n("verifyCollection",[t],r),rejectCollection:(t,r)=>n("rejectCollection",[t],r),updateCollectionStats:(t,r,i,a)=>n("updateCollectionStats",[t,BigInt(r),BigInt(i)],a),setImportStatus:(t,r,i)=>n("setImportStatus",[t,r],i),setPublished:(t,r,i)=>n("setPublished",[t,r],i),setCollectionPublicLibrary:(t,r,i)=>n("setCollectionPublicLibrary",[t,BigInt(r)],i),setPublicLibraryStorage:(t,r)=>n("setPublicLibraryStorage",[t],r)}}getPublicLibraryStorageAddress(){let e=f.getAddress(this.readonly.chainId,"publicLibraryStorage",this.environment);if(!e)throw new Error(`PublicLibraryStorage address not resolved for chain ${this.readonly.chainId} (${this.environment}) \u2014 await client.ready before writing.`);return e}createPublicLibraryStorageWriteAPI(e){let n=async(t,r,i)=>{try{let a=e.account;if(!a)throw new Error("No account connected to wallet");let o=this.getPublicLibraryStorageAddress(),c=await e.writeContract({address:o,abi:this.requireAbi("PublicLibraryStorage"),functionName:t,args:r,account:a,chain:this.chain,gas:i?.gasLimit});i?.onAccepted?.(c);let u=await this.publicClient.waitForTransactionReceipt({hash:c});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),u}catch(a){throw m(a)}};return{addPublicLibrary:(t,r)=>n("addPublicLibrary",[t],r),updatePublicLibrary:(t,r,i)=>n("updatePublicLibrary",[BigInt(t),r],i),addFormat:(t,r)=>n("addFormat",[t],r)}}getDSafeHRStorageAddress(){let e=f.getAddress(this.readonly.chainId,"dSafeHRStorage",this.environment);if(!e)throw new Error(`DSafeHRStorage address not resolved for chain ${this.readonly.chainId} (${this.environment}) \u2014 await client.ready before writing.`);return e}createDSafeHRStorageWriteAPI(e){let n=async(t,r,i)=>{try{let a=e.account;if(!a)throw new Error("No account connected to wallet");let o=this.getDSafeHRStorageAddress(),c=await e.writeContract({address:o,abi:this.requireAbi("DSafeHRStorage"),functionName:t,args:r,account:a,chain:this.chain,gas:i?.gasLimit});i?.onAccepted?.(c);let u=await this.publicClient.waitForTransactionReceipt({hash:c});return typeof window<"u"&&window.dispatchEvent(new Event("wallet_transaction_accepted")),u}catch(a){throw m(a)}};return{addStaff:(t,r,i)=>n("addStaff",[t,r],i),addStaffBatch:(t,r,i)=>n("addStaffBatch",[t,r],i),removeStaff:(t,r,i)=>n("removeStaff",[t,r],i),removeStaffBatch:(t,r,i)=>n("removeStaffBatch",[t,r],i),acquirePublishLock:(t,r)=>n("acquirePublishLock",[t],r),releasePublishLock:(t,r)=>n("releasePublishLock",[t],r),allocateRecordIds:(t,r,i,a)=>n("allocateRecordIds",[t,r,i],a),bumpLibrarySequence:(t,r)=>n("bumpLibrarySequence",[t],r)}}};async function $(s,e,n=A()){let t=s;if(typeof t.getWalletClient!="function")throw new Error(`Connector '${s.type}' does not support EVM write operations`);s.type==="private_key"&&await s.getChainId()!==e&&await t.connect(e);let i=(await s.getAccounts())[0];if(!i)throw new Error(`No account available for wallet '${s.type}' \u2014 connect() first`);let a=await j(e,n),o=await t.getWalletClient(e);return new v(s.type,a,o,i)}async function Ot(s,e,n=A()){let t=await j(s,n),r=J(s,e),i=Q(e);return new v("private_key",t,r,i)}var I={lastRun:0,running:!1},oe=()=>{I.running=!1,I.lastRun=0},ce=()=>I.running&&Date.now()-I.lastRun<1e3*60?!1:(I.lastRun=Date.now(),I.running=!0,!0),ue=(s,e,n)=>{console.error(`[session/mutations] error while transaction wallet=${s} chainId=${e}`,n),oe();let t=m(n).code==="USER_REJECTED";T.emitWalletError({wallet:s,chainId:e,timestamp:Date.now(),reason:t?"USER_REJECTED":n?.code??"UNKNOWN_ERROR",args:n})},de=(s,e)=>{T.emitWalletStateEvent({wallet:s,chainId:e,event:"TRANSACTION_STARTED",timestamp:Date.now()})},pe=(s,e)=>{T.emitWalletStateEvent({wallet:s,chainId:e,event:"TRANSACTION_DONE",timestamp:Date.now()})},le=async(s,e)=>ce()?!0:(console.log("[session/mutations] preTransaction skipped \u2014 another transaction is running, wait 1min"),!1),me=async(s,e,n)=>{I.running=!1,I.lastRun=0,T.emitWalletStateEvent({wallet:s,chainId:e,event:"UPDATING_STATE_STARTED",functionName:"syncAccount",timestamp:Date.now()});try{await Z(n,e,s,A(),!0)}catch(t){return T.emitWalletStateEvent({wallet:s,chainId:e,event:"UPDATING_STATE_FAILED",functionName:"syncAccount",timestamp:Date.now()}),console.error(t),!1}return T.emitWalletStateEvent({wallet:s,chainId:e,event:"UPDATING_STATE_DONE",functionName:"syncAccount",timestamp:Date.now()}),!0};async function ge(s,e){let n=V(s);if(!n)throw new Error(`No connector registered for wallet '${s}' \u2014 bootstrapWebSDK() must run first`);return $(n,e,A())}async function L(s,e,n,t,r){if(!await le(s,e))return!1;de(s,e);try{let i=await ge(s,e);await t(i)}catch(i){throw ue(s,e,i),i}return pe(s,e),r?.(),me(s,e,n)}var ye={retire:(s,e,n,t,r)=>L(s,e,n,i=>i.accountManager.unregisterWithConsent(t.expiry,t.signature,r)),vote:(s,e,n,t,r,i,a)=>L(s,e,n,o=>o.factory.donateToProject(t,r,i,a)),save:(s,e,n,t,r,i,a,o)=>L(s,e,n,c=>c.factory.save(t,a,r,i,o),()=>{if(!o?.skipCounterUpdate){let c=o?.consumedRows??t.length,{lastPatchIndex:u}=h.lastSyncCounters(n,e);h.setLastSavedPatchIndex(n,e,Math.max(u,o?.savedThrough??u+c))}}),subscribe:(s,e,n,t,r)=>L(s,e,n,i=>i.subscriptionManager.subscribeTo(t,r)),unsubscribe:(s,e,n,t,r)=>L(s,e,n,i=>i.subscriptionManager.unsubscribeFrom(t,r))},be=100,fe=s=>{switch(s.action){case 0:case 2:case 3:case 5:return`${s.objectType}:${s.objectId}:0`;case 4:return`${s.objectType}:${s.objectId}:${s.part}`;case 6:return`${s.objectType}:${s.objectId}:${s.part}`;default:return null}};function he(s){let e=[],n=[],t=new Set;for(let r of s){let i=U(r)?null:fe(r);i!==null&&!t.has(i)&&t.size>=be&&(e.push(n),n=[],t=new Set),i!==null&&t.add(i),n.push(r)}return n.length&&e.push(n),e}var D=new Map;function Jt(s,e,n,t){let r=`${A()}:${e}:${n.toLowerCase()}`,i=D.get(r);if(i)return i;let a=Ie(s,e,n,t);return D.set(r,a),a.finally(()=>D.delete(r)).catch(()=>{}),a}async function Ie(s,e,n,t){let{lastPatchIndex:r}=h.lastSyncCounters(n,e),i=await W("mine"),a=i>r?(await E("mine",r+1)).filter(g=>g.pk<=i&&!g.sourceStream):[],o;try{o=G}catch{}if(!(typeof o=="function"?await o(n,e):!0))return!1;a.length>0&&F.threadInstance&&await H(a,"mine");let{lastRestorationIndex:u}=h.lastSyncCounters(n,e),d=[],p=await we(s,e,n,t,d),l;try{l=Y}catch{}return p&&typeof l=="function"&&await l(n,e,u,d),p}async function we(s,e,n,t,r=[]){let{lastPatchIndex:i}=h.lastSyncCounters(n,e),a=await W("mine");if(a<=i)return!1;let o=Math.floor(await B.calculateLevel("mine"))+1,c=(await E("mine",i+1)).filter(l=>l.pk<=a),u=he(c),d=i,p=!1;for(let l=0;l<u.length;l++){let g=u[l],y=l===u.length-1?a:g[g.length-1].pk,b=z(g);if(b.patches.length===0)t?.skipCounterUpdate||h.setLastSavedPatchIndex(n,e,y);else{if(!await ye.save(s,e,n,b.patches,b.textIndex,b.textData,o,{...t,consumedRows:y-d,savedThrough:y}))return p;p=!0,r.push(...b.patches.map(BigInt))}d=y}return!u.length&&!t?.skipCounterUpdate&&h.setLastSavedPatchIndex(n,e,a),p}var Pe=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{internalType:"address",name:"caller",type:"address"}],name:"Forbidden",type:"error"},{inputs:[],name:"ImportsFinalized",type:"error"},{inputs:[{internalType:"uint64",name:"count",type:"uint64"}],name:"InvalidBatchSize",type:"error"},{inputs:[],name:"InvalidPublicLibraryId",type:"error"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"}],name:"LibraryIdOutOfRange",type:"error"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"address",name:"caller",type:"address"}],name:"NotLibraryStaff",type:"error"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"address",name:"caller",type:"address"}],name:"NotLockHolder",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"address",name:"holder",type:"address"},{internalType:"uint256",name:"expiresAt",type:"uint256"}],name:"PublishLockHeld",type:"error"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"address",name:"caller",type:"address"}],name:"PublishNotLocked",type:"error"},{inputs:[],name:"StorageFrozen",type:"error"},{anonymous:!1,inputs:[],name:"ImportsFinalized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldRegistry",type:"address"},{indexed:!0,internalType:"address",name:"newRegistry",type:"address"}],name:"LibraryRegistryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"libraryId",type:"uint256"},{indexed:!0,internalType:"address",name:"staff",type:"address"},{indexed:!1,internalType:"uint32",name:"seq",type:"uint32"}],name:"LibrarySequenceBumped",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"frozen",type:"bool"}],name:"MigrationFrozen",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"libraryId",type:"uint256"},{indexed:!0,internalType:"address",name:"staff",type:"address"},{indexed:!1,internalType:"uint256",name:"acquiredAt",type:"uint256"}],name:"PublishLockAcquired",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"libraryId",type:"uint256"},{indexed:!0,internalType:"address",name:"staff",type:"address"}],name:"PublishLockReleased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"libraryId",type:"uint256"},{indexed:!0,internalType:"uint8",name:"objectType",type:"uint8"},{indexed:!0,internalType:"address",name:"staff",type:"address"},{indexed:!1,internalType:"uint64",name:"startId",type:"uint64"},{indexed:!1,internalType:"uint64",name:"count",type:"uint64"}],name:"RecordIdsAllocated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"libraryId",type:"uint256"},{indexed:!0,internalType:"address",name:"staff",type:"address"}],name:"StaffAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"libraryId",type:"uint256"},{indexed:!0,internalType:"address",name:"staff",type:"address"}],name:"StaffRemoved",type:"event"},{inputs:[],name:"MAX_BATCH_SIZE",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"MAX_LOCK_DURATION",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"}],name:"acquirePublishLock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"address",name:"staff",type:"address"}],name:"addStaff",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"address[]",name:"staffMembers",type:"address[]"}],name:"addStaffBatch",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"uint8",name:"objectType",type:"uint8"},{internalType:"uint64",name:"count",type:"uint64"}],name:"allocateRecordIds",outputs:[{internalType:"uint64",name:"startId",type:"uint64"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"authorizedWriters",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"}],name:"bumpLibrarySequence",outputs:[{internalType:"uint32",name:"seq",type:"uint32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"offset",type:"uint256"},{internalType:"uint256",name:"limit",type:"uint256"}],name:"exportLibraries",outputs:[{internalType:"uint256[]",name:"libraryIds",type:"uint256[]"},{internalType:"uint32[]",name:"sequences",type:"uint32[]"},{internalType:"uint256",name:"total",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"}],name:"exportRecordCounters",outputs:[{internalType:"uint64[256]",name:"counters",type:"uint64[256]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"uint256",name:"offset",type:"uint256"},{internalType:"uint256",name:"limit",type:"uint256"}],name:"exportStaff",outputs:[{internalType:"address[]",name:"staff",type:"address[]"},{internalType:"uint256",name:"total",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"finalizeImports",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"freezeForMigration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"uint8",name:"objectType",type:"uint8"}],name:"getCurrentRecordCounter",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"}],name:"getLibrarySequence",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"}],name:"getPublishLock",outputs:[{internalType:"address",name:"holder",type:"address"},{internalType:"uint64",name:"acquiredAt",type:"uint64"},{internalType:"bool",name:"active",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"staff",type:"address"}],name:"getStaffLibraries",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"uint32",name:"sequence",type:"uint32"},{internalType:"uint64[256]",name:"counters",type:"uint64[256]"}],name:"importLibraryState",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"address[]",name:"staff",type:"address[]"}],name:"importStaff",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"importsFinalized",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"address",name:"caller",type:"address"}],name:"isStaffOf",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"libraryRegistry",outputs:[{internalType:"contract IPublicLibraryStorage",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"migrationFrozen",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"nbLibraries",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"}],name:"nbStaff",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"}],name:"releasePublishLock",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"address",name:"staff",type:"address"}],name:"removeStaff",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"libraryId",type:"uint256"},{internalType:"address[]",name:"staffMembers",type:"address[]"}],name:"removeStaffBatch",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"storageAddr",type:"address"}],name:"setLibraryRegistry",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unfreezeForMigration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"staff",type:"address"}],name:"verifyMember",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];var q={AddressRegistry:"The Card Catalog",Factory:"The Head Librarian",BouncerStorage:"The Library Card Office",ProjectManagerStorage:"The Project Manager",ScientistStorage:"The Statistician",BackupStorage:"The Archivist",AccountManager:"RegistrationDesk",SubscriptionManager:"The Membership Desk",LibraryRegistryStorage:"The Union Catalog",PublicLibraryStorage:"The Reading Room",DSafeHRStorage:"The Staff Office",StatsPivotStorage:"The Records Room",RelationshipIndexerStorage:"The Cross-Reference Desk",EmailRecoveryManager:"The Lost & Found"};function Ae(s){return q[s]??s}var X=(u=>(u.chromium="chromium",u.firefox="firefox",u.safari="safari",u.edge="edge",u.opera="opera",u.brave="brave",u.vivaldi="vivaldi",u.yandex="yandex",u.palemoon="palemoon",u))(X||{}),K=(t=>(t.android="android",t.ios="ios",t.browsers="browsers",t))(K||{}),ee=(s=typeof navigator<"u"?navigator.userAgent:"")=>{let e=s.toLowerCase(),n;e.includes("yabrowser")||e.includes("yandex")?n="yandex":e.includes("brave")?n="brave":e.includes("vivaldi")?n="vivaldi":e.includes("palemoon")?n="palemoon":e.includes("edg/")||e.includes("edge/")?n="edge":e.includes("opr/")||e.includes("opera/")?n="opera":e.includes("firefox/")?n="firefox":e.includes("safari/")&&!e.includes("chrome/")?n="safari":(e.includes("chrome/")||e.includes("chromium/"),n="chromium");let t;return e.includes("android")?t="android":e.includes("iphone")||e.includes("ipad")||e.includes("ipod")?t="ios":t="browsers",{browser:n,platform:t}};var Te="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLQogIC0gICAvKgogIC0gICAgKiBDb3B5cmlnaHQgKGMpIDIwMjYgRGF0YVBvbmQgRC1MaWJyYXJ5IFB0eSBMdGQuICgiVGhlIFNhbmN0dWFyeSIpCiAgLSAgICAqIE5vbi1Qcm9maXQgUHVibGljIExpYnJhcnkg4oCUIFRoZSBXb3JsZCBMaWJyYXJ5CiAgLSAgICAqCiAgLSAgICAqIExpY2Vuc2VkIHVuZGVyIHRoZSBELU9wZW4gQ29kZSBTb3ZlcmVpZ24gTGljZW5jZSB2MS4wCiAgLSAgICAqIGh0dHBzOi8vcmVnaXN0cnkud29ybGQuYmlibGlvdGVjaC5jb20vbGljZW5jZQogIC0gICAgKgogIC0gICAgKiBUZWNobmljYWwgR3VhcmRpYW4gKCJUaGUgU2hpZWxkIik6IFBvbmQgRW50ZXJwcmlzZSBQdHkgTHRkLiAoQUNOIDY5NCA3NDcgOTg3KQogIC0gICAgKiBBbGwgbGlhYmlsaXR5IGNsYWltcyBkaXJlY3RlZCB0byBQb25kIEVudGVycHJpc2UgUHR5IEx0ZC4KICAtICAgICogTW9kaWZpY2F0aW9uIGF1dG9tYXRpY2FsbHkgdm9pZHMgdGhlIGNlcnRpZmllZCBsaWFiaWxpdHkgcHJvdGVjdGlvbi4KICAtICAgICogR292ZXJuaW5nIGxhdzogU291dGggQXVzdHJhbGlhLgogIC0gICAgKi8KICAtCiAgL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aDI3LjdsLjItNDQuOHoiIGNsYXNzPSJzdDYiLz4KPC9zdmc+",mn={metamask:{displayName:"MetaMask",logoUrl:Te,description:"The most popular Ethereum wallet extension",website:"https://metamask.io/",isInstalled(){return typeof window<"u"&&typeof window.ethereum<"u"&&window.ethereum.isMetaMask},isInstallable(){try{return this.getInstallUrl(),!0}catch{return!1}},getInstallUrl(s){let{browser:e,platform:n}=ee(),t=s||e;switch(n){case"android":return"https://play.google.com/store/apps/details?id=io.metamask";case"ios":return"https://apps.apple.com/us/app/metamask-crypto-wallet/id1438144202";case"browsers":switch(t){case"chromium":case"brave":return"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn";case"firefox":return"https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/";case"opera":return"https://addons.opera.com/en/extensions/details/metamask/";case"edge":return"https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm";default:throw new Error(`Browser ${t} is not supported for installation of MetaMask extension.`)}default:throw new Error(`Platform ${n} is not supported for MetaMask.`)}}},private_key:{displayName:"Private Key",logoUrl:"",description:"Direct embedded wallet using a raw private key",website:"",isInstalled(){return!0},isInstallable(){return!1},getInstallUrl(){return""}}};import{formatEther as Mn,parseEther as vn}from"viem";export{X as Browser,q as CONTRACT_DISPLAY_NAMES,ze as EventBus,_e as EventName,We as EvmClient,v as EvmWriteClient,ie as LibraryOwnership,It as MetaMaskConnector,Le as NodeFileCacheStorage,bt as PROJECT_CACHE_TTL_MS,K as Platform,mt as PrivateKeyConnector,xe as RegistryAddressLoader,re as SubscriptionClient,Ge as WalletError,T as WalletEvents,Ze as WalletState,Ye as WalletUxError,Y as acknowledgeOwnSave,Q as addressFromPrivateKey,f as addressLoader,R as addressRegistryAbi,Fe as allRegisteredAccounts,Ee as createEvmClient,wt as createMetaMaskConnector,Ce as createNodeFileCacheStorage,gt as createPrivateKeyConnector,J as createPrivateKeyWalletClient,Ot as createPrivateKeyWriteClient,Be as createSessionStore,$ as createWriteClient,qe as cursorKey,Xe as cursorStore,Pe as dSafeHRStorageAbi,Je as deserializeCursor,$e as emptyCursor,Mn as formatEther,it as getCachedEmail,V as getConnector,Re as getContractAbi,Ae as getContractDisplayName,pt as getDecryptedPrivateKey,He as getEventBus,ke as getEvmClient,ot as getPrivateKey,De as getReadClient,j as getReadyEvmClient,rt as getRegisteredConnectors,ve as getRegistryBaseUrl,A as getSessionEnvironment,Ve as getSubscriptionClient,ue as handleWriteOperationErrors,ut as hasAnyPrivateKey,lt as hasEncryptedPrivateKey,ct as hasPrivateKey,Ke as hasUnsavedPatches,et as isOwnWrite,tt as loadNetworkInfos,ht as loadProject,ft as loadProjects,vn as parseEther,ee as parseUserAgent,yt as projectLocale,x as pythAbi,Oe as readOnlyClients,je as readOnlyStagingClients,nt as registerConnector,ne as relationshipIndexerStorageAbi,oe as resetTransactionState,G as restoreAccountSave,Jt as saveMyLevel,Qe as serializeCursor,h as sessionStore,at as setCachedEmail,Me as setRegistryBaseUrl,Ue as setSessionEnvironment,Se as sidecarUrlsFromManifest,dt as storeEncryptedPrivateKey,st as storePrivateKey,Z as syncAccount,Ne as toViemChain,mn as walletMeta,ye as writeOperations};
|
|
1020
2
|
//# sourceMappingURL=index.js.map
|