@the_library/public 1.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.
Files changed (90) hide show
  1. package/README.md +2298 -0
  2. package/assets/branding/data-pond.png +0 -0
  3. package/assets/branding/dsafe-logo.png +0 -0
  4. package/assets/branding/founder-photo.jpg +0 -0
  5. package/assets/branding/icon_transparent.png +0 -0
  6. package/assets/branding/library-favicon.png +0 -0
  7. package/assets/branding/pond-enterprise-logo.jpg +0 -0
  8. package/assets/branding/pond-enterprise-logo.svg +27 -0
  9. package/dist/branding/index.d.ts +48 -0
  10. package/dist/branding/index.js +67 -0
  11. package/dist/branding/index.js.map +1 -0
  12. package/dist/chunk-2HFOWE5R.js +296 -0
  13. package/dist/chunk-2HFOWE5R.js.map +1 -0
  14. package/dist/chunk-3L6LH2XK.js +465 -0
  15. package/dist/chunk-3L6LH2XK.js.map +1 -0
  16. package/dist/chunk-4CWVFPBN.js +28 -0
  17. package/dist/chunk-4CWVFPBN.js.map +1 -0
  18. package/dist/chunk-AGHPATVL.js +65 -0
  19. package/dist/chunk-AGHPATVL.js.map +1 -0
  20. package/dist/chunk-JDUYLUDJ.js +4835 -0
  21. package/dist/chunk-JDUYLUDJ.js.map +1 -0
  22. package/dist/chunk-OEZK7IX7.js +77 -0
  23. package/dist/chunk-OEZK7IX7.js.map +1 -0
  24. package/dist/chunk-PUYDAUCI.js +2873 -0
  25. package/dist/chunk-PUYDAUCI.js.map +1 -0
  26. package/dist/chunk-WHWMTS7D.js +99 -0
  27. package/dist/chunk-WHWMTS7D.js.map +1 -0
  28. package/dist/chunk-Y7RS6RTM.js +342 -0
  29. package/dist/chunk-Y7RS6RTM.js.map +1 -0
  30. package/dist/chunk-ZEZGI2TP.js +197 -0
  31. package/dist/chunk-ZEZGI2TP.js.map +1 -0
  32. package/dist/core-dao-core-logo-VDT2I5IW.svg +33 -0
  33. package/dist/downloader/dl2-sw.js +199 -0
  34. package/dist/downloader/dl2-sw.js.map +1 -0
  35. package/dist/downloader/file-worker-v2.js +258 -0
  36. package/dist/downloader/file-worker-v2.js.map +1 -0
  37. package/dist/downloader/index.d.ts +45 -0
  38. package/dist/downloader/index.js +538 -0
  39. package/dist/downloader/index.js.map +1 -0
  40. package/dist/downloader/mu-worker-v2.js +197 -0
  41. package/dist/downloader/mu-worker-v2.js.map +1 -0
  42. package/dist/downloader/react.d.ts +19 -0
  43. package/dist/downloader/react.js +32 -0
  44. package/dist/downloader/react.js.map +1 -0
  45. package/dist/downloader/solid.d.ts +21 -0
  46. package/dist/downloader/solid.js +19 -0
  47. package/dist/downloader/solid.js.map +1 -0
  48. package/dist/downloader/sw.d.ts +22 -0
  49. package/dist/downloader/sw.js +119 -0
  50. package/dist/downloader/sw.js.map +1 -0
  51. package/dist/downloader/vue.d.ts +23 -0
  52. package/dist/downloader/vue.js +19 -0
  53. package/dist/downloader/vue.js.map +1 -0
  54. package/dist/level-state-J3pj64Tr.d.ts +15 -0
  55. package/dist/models/astro.d.ts +47 -0
  56. package/dist/models/astro.js +44 -0
  57. package/dist/models/astro.js.map +1 -0
  58. package/dist/models/index.d.ts +244 -0
  59. package/dist/models/index.js +340 -0
  60. package/dist/models/index.js.map +1 -0
  61. package/dist/models/models.d.ts +524 -0
  62. package/dist/models/models.js +46 -0
  63. package/dist/models/models.js.map +1 -0
  64. package/dist/models/models_v2.global.js +1 -0
  65. package/dist/models/patch-worker.js +543 -0
  66. package/dist/models/patch-worker.js.map +1 -0
  67. package/dist/models/react.d.ts +43 -0
  68. package/dist/models/react.js +73 -0
  69. package/dist/models/react.js.map +1 -0
  70. package/dist/models/solid.d.ts +73 -0
  71. package/dist/models/solid.js +95 -0
  72. package/dist/models/solid.js.map +1 -0
  73. package/dist/models/vue.d.ts +51 -0
  74. package/dist/models/vue.js +98 -0
  75. package/dist/models/vue.js.map +1 -0
  76. package/dist/orm-BvkX0aBT.d.ts +507 -0
  77. package/dist/session-vqOnyxga.d.ts +184 -0
  78. package/dist/state-BTsp-E4v.d.ts +111 -0
  79. package/dist/types-Dn0EFMO_.d.ts +293 -0
  80. package/dist/types-Xb8Ta9tZ.d.ts +155 -0
  81. package/dist/web3/index.d.ts +820 -0
  82. package/dist/web3/index.js +1020 -0
  83. package/dist/web3/index.js.map +1 -0
  84. package/dist/web3/registry.d.ts +145 -0
  85. package/dist/web3/registry.js +23 -0
  86. package/dist/web3/registry.js.map +1 -0
  87. package/dist/web3/vue.d.ts +174 -0
  88. package/dist/web3/vue.js +391 -0
  89. package/dist/web3/vue.js.map +1 -0
  90. package/package.json +124 -0
@@ -0,0 +1,820 @@
1
+ import { R as ReadOnlyDomainAPI, A as AddressRegistryReadAPI, c as ArchivistStorageReadAPI, B as BouncerStorageReadAPI, S as ScientistStorageReadAPI, F as FactoryReadAPI, d as ProjectManagerStorageReadAPI, e as SubscriptionManagerReadAPI, L as LibraryRegistryStorageReadAPI, f as PublicLibraryStorageReadAPI, g as WriteOnlyDomainAPI, h as FactoryWriteAPI, i as SubscriptionManagerWriteAPI, j as AddressRegistryWriteAPI, k as LibraryRegistryStorageWriteAPI, l as PublicLibraryStorageWriteAPI, W as WalletType, T as TransactionOptions, b as WalletConnector, E as EvmWalletConnector, C as ConnectResult } from '../types-Dn0EFMO_.js';
2
+ export { o as AddressRegistryContractRecord, p as AddressRegistryUpdateInfo, r as Collection, q as CollectionInput, m as ContractAddresses, w as ErrorCode, s as LibraryOwnership, N as NormalizedError, t as PreferredFormat, a as Project, P as ProjectVersion, v as PublicLibrary, u as PublicLibraryInput, n as StripeDonation } from '../types-Dn0EFMO_.js';
3
+ import * as viem from 'viem';
4
+ import { PublicClient, WalletClient, TransactionRequest } from 'viem';
5
+ export { formatEther, parseEther } from 'viem';
6
+ import { E as EvmChainConfig, a as SessionStore, W as Web3SessionAccount, S as SyncCursor, b as SubscriptionNode, c as WalkOptions, d as SubscriptionGraph, F as FetchOptions, e as Patch, f as SyncOptions, g as SyncResult } from '../types-Xb8Ta9tZ.js';
7
+ export { C as ChainPrice, D as DEFAULT_CHAIN_ID, k as EVM_CHAINS, j as PatchCacheAdapter, P as ProjectLocale, h as SessionState, m as getChain, i as loadProject, l as loadProjects, p as projectLocale, t as toViemChain } from '../types-Xb8Ta9tZ.js';
8
+ export { CACHE_DURATION_MS, CacheEntry, ContractLoadingStatus, LoadingStatus, Manifest, ManifestContractEntry, ManifestNetwork, ManifestProvenance, NodeFileCacheStorage, RegistryAddressLoader, RegistryCache, RegistryCacheStorage, ResolvedSidecarUrls, SidecarObjectPointers, V2DataBlock, addressLoader, createNodeFileCacheStorage, getContractAbi, getRegistryBaseUrl, setRegistryBaseUrl, sidecarUrlsFromManifest } from './registry.js';
9
+
10
+ declare class EvmClient implements ReadOnlyDomainAPI {
11
+ readonly ready: Promise<void>;
12
+ readonly chainId: number;
13
+ readonly chain: viem.Chain;
14
+ readonly publicClient: PublicClient;
15
+ readonly environment: 'production' | 'staging';
16
+ readonly config: EvmChainConfig;
17
+ private _contractAddresses;
18
+ addressRegistry: AddressRegistryReadAPI;
19
+ archivistStorage: ArchivistStorageReadAPI;
20
+ bouncerStorage: BouncerStorageReadAPI;
21
+ scientistStorage: ScientistStorageReadAPI;
22
+ factory: FactoryReadAPI;
23
+ projectManagerStorage: ProjectManagerStorageReadAPI;
24
+ subscriptionManager: SubscriptionManagerReadAPI;
25
+ libraryRegistryStorage: LibraryRegistryStorageReadAPI;
26
+ publicLibraryStorage: PublicLibraryStorageReadAPI;
27
+ getUsdPrice(): Promise<number>;
28
+ constructor(chainId: number, environment?: 'production' | 'staging');
29
+ private get activeRegistryAddress();
30
+ private addresses;
31
+ private requireAbi;
32
+ private read;
33
+ private createAddressRegistryReadAPI;
34
+ private createArchivistReadApi;
35
+ private createProjectManagerStorageReadAPI;
36
+ private createBouncerStorageReadAPI;
37
+ private createScientistStorageReadAPI;
38
+ private createFactoryReadAPI;
39
+ private createSubscriptionManagerReadAPI;
40
+ private createLibraryRegistryStorageReadAPI;
41
+ private createPublicLibraryStorageReadAPI;
42
+ getRegistryStatus(): Promise<any>;
43
+ }
44
+ declare function createEvmClient(chainId?: number, environment?: 'production' | 'staging'): EvmClient;
45
+
46
+ declare class EvmWriteClient implements WriteOnlyDomainAPI {
47
+ readonly readonly: EvmClient;
48
+ readonly writeOnly: WriteOnlyDomainAPI;
49
+ private readonly publicClient;
50
+ private readonly chain;
51
+ readonly config: EvmChainConfig;
52
+ readonly wallet: string;
53
+ private readonly environment;
54
+ private readonly _account;
55
+ constructor(wallet: string, readonlyApi: EvmClient, walletClient: WalletClient, account: string);
56
+ get factory(): FactoryWriteAPI;
57
+ get subscriptionManager(): SubscriptionManagerWriteAPI;
58
+ get addressRegistry(): AddressRegistryWriteAPI;
59
+ get libraryRegistryStorage(): LibraryRegistryStorageWriteAPI;
60
+ get publicLibraryStorage(): PublicLibraryStorageWriteAPI;
61
+ getChainId(): number;
62
+ account(): string;
63
+ getNormalizedAddress(address: string): string;
64
+ private requireAbi;
65
+ private getFactoryAddress;
66
+ private getRegistryAddress;
67
+ private createFactoryWriteAPI;
68
+ private createSubscriptionManagerWriteAPI;
69
+ private createAddressRegistryWriteAPI;
70
+ private getLibraryRegistryStorageAddress;
71
+ private createLibraryRegistryStorageWriteAPI;
72
+ private getPublicLibraryStorageAddress;
73
+ private createPublicLibraryStorageWriteAPI;
74
+ }
75
+
76
+ declare const readOnlyClients: Record<number, ReadOnlyDomainAPI>;
77
+ declare const readOnlyStagingClients: Record<number, ReadOnlyDomainAPI>;
78
+ declare function getReadClient(chainId: number, environment?: 'production' | 'staging'): ReadOnlyDomainAPI;
79
+ declare function getEvmClient(chainId: number, environment?: 'production' | 'staging'): EvmClient;
80
+ declare function getReadyEvmClient(chainId: number, environment?: 'production' | 'staging'): Promise<EvmClient>;
81
+
82
+ declare function createSessionStore(): SessionStore;
83
+ declare const sessionStore: SessionStore;
84
+ /**
85
+ * Returns all known accounts that have completed on-chain registration
86
+ * (i.e. `hasAccount === true`). This is a plain (non-reactive) snapshot —
87
+ * wrap in `computed()` at the call site if reactivity is needed.
88
+ */
89
+ declare const allRegisteredAccounts: () => Web3SessionAccount[];
90
+
91
+ /**
92
+ * Hydrates one address from chain and updates sessionStore. Replaces
93
+ * registry.addAccount(wallet, tech, chainId, address, forceRefresh).
94
+ */
95
+ declare function syncAccount(address: string, chainId: number, wallet: WalletType, environment?: 'production' | 'staging', forceRefresh?: boolean): Promise<Web3SessionAccount>;
96
+ /**
97
+ * Cross-device sync for the caller's own saved patches: checks local state
98
+ * against on-chain "writes" and, if the chain is ahead, decodes, persists to
99
+ * IndexedDB, and merges the missing patches into the live ORM — all
100
+ * internally. Callers get only a completion boolean; WalletEvents.onSaveRestored
101
+ * fires afterward as a UX-only "sync finished" signal (no patch payload to act on).
102
+ * Meant to be called once at boot, non-blocking (fire-and-forget).
103
+ * Replaces registry.restoreMySave(wallet, tech, chainId, account).
104
+ */
105
+ declare function restoreAccountSave(address: string, chainId: number, environment?: 'production' | 'staging'): Promise<boolean>;
106
+ /**
107
+ * Read-only check for whether the caller has locally-authored patches not
108
+ * yet pushed to BackupStorage via saveMyLevel() (mutations.ts). No wallet/
109
+ * connector required — safe to call just to drive a "you have unsaved
110
+ * changes" UI hint.
111
+ */
112
+ declare function hasUnsavedPatches(address: string, chainId: number): Promise<boolean>;
113
+ /**
114
+ * Pure data fetcher for network-wide statistics.
115
+ */
116
+ declare function loadNetworkInfos(chainId: number, environment?: 'production' | 'staging', forceRefresh?: boolean): Promise<any>;
117
+
118
+ declare const resetTransactionState: () => void;
119
+ declare const handleWriteOperationErrors: (wallet: WalletType, chainId: number, e: any) => void;
120
+ declare const writeOperations: {
121
+ register: (wallet: WalletType, chainId: number, account: string, amount: number) => Promise<boolean>;
122
+ retire: (wallet: WalletType, chainId: number, account: string, options?: TransactionOptions) => Promise<boolean>;
123
+ vote: (wallet: WalletType, chainId: number, account: string, projectId: number, lang: string, amount: number, options?: TransactionOptions) => Promise<boolean>;
124
+ save: (wallet: WalletType, chainId: number, account: string, compressedActions: Array<bigint>, textIndexes: Array<number>, textData: Array<string>, level: number, options?: TransactionOptions & {
125
+ skipCounterUpdate?: boolean;
126
+ }) => Promise<boolean>;
127
+ subscribe: (wallet: WalletType, chainId: number, account: string, subscriber: number, target: number) => Promise<boolean>;
128
+ unsubscribe: (wallet: WalletType, chainId: number, account: string, subscriber: number, target: number) => Promise<boolean>;
129
+ };
130
+ /**
131
+ * Assembles the caller's own locally-authored patches since their last save
132
+ * (getNbPatches/serializePatches, models_v2) and pushes them to BackupStorage
133
+ * via writeOperations.save — the pipeline apps used to assemble by hand.
134
+ * Returns false (no-op, no transaction sent) if there's nothing new to save.
135
+ */
136
+ declare function saveMyLevel(wallet: WalletType, chainId: number, account: string, options?: TransactionOptions & {
137
+ skipCounterUpdate?: boolean;
138
+ }): Promise<boolean>;
139
+
140
+ /**
141
+ * Bridges a connected WalletConnector to a concrete EvmWriteClient. Kept out of
142
+ * client/ and wallet/ so neither layer needs to know about the other:
143
+ * WalletConnector stays viem-free (client/types.ts), EvmWriteClient stays
144
+ * connector-agnostic (client/EvmWriteClient.ts) — this is the seam.
145
+ */
146
+ declare function createWriteClient(connector: WalletConnector, chainId: number, environment?: 'production' | 'staging'): Promise<EvmWriteClient>;
147
+ /**
148
+ * Same bridge as createWriteClient, but for a key that only ever exists
149
+ * decrypted-in-memory — for callers with their own encrypted vault (e.g. an
150
+ * admin tool) that want to sign without ever persisting the key via
151
+ * wallet/credentials.ts's plaintext localStorage or going through the
152
+ * connector registry.
153
+ */
154
+ declare function createPrivateKeyWriteClient(chainId: number, privateKey: string, environment?: 'production' | 'staging'): Promise<EvmWriteClient>;
155
+
156
+ interface SerializedCursor {
157
+ rootUserId: number;
158
+ knownNodes: Array<[number, SubscriptionNode]>;
159
+ countSnapshot: Array<[number, number]>;
160
+ patchIndex: Array<[number, number]>;
161
+ }
162
+ declare function serializeCursor(cursor: SyncCursor): SerializedCursor;
163
+ declare function deserializeCursor(serialized: SerializedCursor): SyncCursor;
164
+ declare function emptyCursor(rootUserId: number): SyncCursor;
165
+ /**
166
+ * IndexedDB-backed cursor store keyed by userId — a sibling of sessionStore,
167
+ * not a field on it (spec §15.8: SyncCursor is heavier than the counters
168
+ * already on Web3SessionAccount, and bloating that struct isn't worth it for
169
+ * 5 component files that reference it as a prop/ref type).
170
+ */
171
+ declare const cursorStore: {
172
+ get(userId: number): Promise<SyncCursor | undefined>;
173
+ set(userId: number, cursor: SyncCursor): Promise<void>;
174
+ clear(userId: number): Promise<void>;
175
+ };
176
+
177
+ interface SubscriptionClientConfig {
178
+ chainId: number;
179
+ environment?: 'production' | 'staging';
180
+ maxWalkNodes?: number;
181
+ maxDepth?: number;
182
+ }
183
+ /**
184
+ * Orchestrates graph walk + patch fetch. Algorithm unchanged from the
185
+ * original `web3_subscription_package.md` spec (§5-8); only the module
186
+ * boundary and the patch source (on-chain BackupStorage, not Arweave) moved.
187
+ */
188
+ declare class SubscriptionClient {
189
+ private readonly client;
190
+ private readonly defaultMaxWalkNodes?;
191
+ private readonly defaultMaxDepth?;
192
+ constructor(config: SubscriptionClientConfig);
193
+ walkGraph(rootUserId: number, opts?: WalkOptions): Promise<SubscriptionGraph>;
194
+ fetchPatches(graph: SubscriptionGraph, cursor?: Map<number, number>, opts?: FetchOptions): Promise<Patch[]>;
195
+ /** Full walk + fetch from scratch. */
196
+ sync(rootUserId: number, opts?: SyncOptions): Promise<SyncResult>;
197
+ /**
198
+ * Incremental sync (spec §8, unchanged algorithm): multicall
199
+ * getSubscriptionCount for every known node, deep re-walk only the nodes
200
+ * whose count changed (O4: completeness over cost), then fetch only new
201
+ * patches per node since the cursor.
202
+ */
203
+ syncSince(cursor: SyncCursor, opts?: SyncOptions): Promise<SyncResult>;
204
+ getSubscriptions(userId: number): Promise<number[]>;
205
+ getScore(userId: number): Promise<bigint>;
206
+ /**
207
+ * High-level API: load and apply library patches for a user by username.
208
+ * Orchestrates: username→userId lookup, sync, deserialize, and IndexedDB application.
209
+ * Errors are caught and logged to console but not thrown (graceful degradation).
210
+ */
211
+ loadLibraryByUsername(username: string): Promise<void>;
212
+ }
213
+
214
+ declare function getSubscriptionClient(chainId: number, environment?: 'production' | 'staging'): SubscriptionClient;
215
+
216
+ declare const addressRegistryAbi: readonly [{
217
+ readonly inputs: readonly [];
218
+ readonly stateMutability: "nonpayable";
219
+ readonly type: "constructor";
220
+ }, {
221
+ readonly anonymous: false;
222
+ readonly inputs: readonly [{
223
+ readonly indexed: true;
224
+ readonly internalType: "address";
225
+ readonly name: "oldAdmin";
226
+ readonly type: "address";
227
+ }, {
228
+ readonly indexed: true;
229
+ readonly internalType: "address";
230
+ readonly name: "newAdmin";
231
+ readonly type: "address";
232
+ }];
233
+ readonly name: "AdminChanged";
234
+ readonly type: "event";
235
+ }, {
236
+ readonly anonymous: false;
237
+ readonly inputs: readonly [{
238
+ readonly indexed: true;
239
+ readonly internalType: "string";
240
+ readonly name: "key";
241
+ readonly type: "string";
242
+ }, {
243
+ readonly indexed: false;
244
+ readonly internalType: "string";
245
+ readonly name: "arweaveTxId";
246
+ readonly type: "string";
247
+ }, {
248
+ readonly indexed: false;
249
+ readonly internalType: "bytes32";
250
+ readonly name: "sha256Hash";
251
+ readonly type: "bytes32";
252
+ }, {
253
+ readonly indexed: false;
254
+ readonly internalType: "uint256";
255
+ readonly name: "version";
256
+ readonly type: "uint256";
257
+ }];
258
+ readonly name: "BlobRefAdded";
259
+ readonly type: "event";
260
+ }, {
261
+ readonly anonymous: false;
262
+ readonly inputs: readonly [{
263
+ readonly indexed: true;
264
+ readonly internalType: "string";
265
+ readonly name: "name";
266
+ readonly type: "string";
267
+ }, {
268
+ readonly indexed: true;
269
+ readonly internalType: "address";
270
+ readonly name: "contractAddress";
271
+ readonly type: "address";
272
+ }, {
273
+ readonly indexed: false;
274
+ readonly internalType: "string";
275
+ readonly name: "abiUrl";
276
+ readonly type: "string";
277
+ }, {
278
+ readonly indexed: false;
279
+ readonly internalType: "uint256";
280
+ readonly name: "version";
281
+ readonly type: "uint256";
282
+ }];
283
+ readonly name: "ContractAdded";
284
+ readonly type: "event";
285
+ }, {
286
+ readonly anonymous: false;
287
+ readonly inputs: readonly [{
288
+ readonly indexed: true;
289
+ readonly internalType: "string";
290
+ readonly name: "key";
291
+ readonly type: "string";
292
+ }, {
293
+ readonly indexed: false;
294
+ readonly internalType: "string";
295
+ readonly name: "value";
296
+ readonly type: "string";
297
+ }, {
298
+ readonly indexed: false;
299
+ readonly internalType: "uint256";
300
+ readonly name: "version";
301
+ readonly type: "uint256";
302
+ }];
303
+ readonly name: "DataAdded";
304
+ readonly type: "event";
305
+ }, {
306
+ readonly inputs: readonly [{
307
+ readonly internalType: "string";
308
+ readonly name: "key";
309
+ readonly type: "string";
310
+ }, {
311
+ readonly internalType: "string";
312
+ readonly name: "arweaveTxId";
313
+ readonly type: "string";
314
+ }, {
315
+ readonly internalType: "bytes32";
316
+ readonly name: "sha256Hash";
317
+ readonly type: "bytes32";
318
+ }];
319
+ readonly name: "addBlobRef";
320
+ readonly outputs: readonly [];
321
+ readonly stateMutability: "nonpayable";
322
+ readonly type: "function";
323
+ }, {
324
+ readonly inputs: readonly [{
325
+ readonly internalType: "string";
326
+ readonly name: "name";
327
+ readonly type: "string";
328
+ }, {
329
+ readonly internalType: "address";
330
+ readonly name: "contractAddress";
331
+ readonly type: "address";
332
+ }, {
333
+ readonly internalType: "string";
334
+ readonly name: "abiUrl";
335
+ readonly type: "string";
336
+ }];
337
+ readonly name: "addContract";
338
+ readonly outputs: readonly [];
339
+ readonly stateMutability: "nonpayable";
340
+ readonly type: "function";
341
+ }, {
342
+ readonly inputs: readonly [{
343
+ readonly internalType: "string";
344
+ readonly name: "key";
345
+ readonly type: "string";
346
+ }, {
347
+ readonly internalType: "string";
348
+ readonly name: "value";
349
+ readonly type: "string";
350
+ }];
351
+ readonly name: "addData";
352
+ readonly outputs: readonly [];
353
+ readonly stateMutability: "nonpayable";
354
+ readonly type: "function";
355
+ }, {
356
+ readonly inputs: readonly [];
357
+ readonly name: "admin";
358
+ readonly outputs: readonly [{
359
+ readonly internalType: "address";
360
+ readonly name: "";
361
+ readonly type: "address";
362
+ }];
363
+ readonly stateMutability: "view";
364
+ readonly type: "function";
365
+ }, {
366
+ readonly inputs: readonly [{
367
+ readonly internalType: "address";
368
+ readonly name: "newAdmin";
369
+ readonly type: "address";
370
+ }];
371
+ readonly name: "changeAdmin";
372
+ readonly outputs: readonly [];
373
+ readonly stateMutability: "nonpayable";
374
+ readonly type: "function";
375
+ }, {
376
+ readonly inputs: readonly [];
377
+ readonly name: "getAllBlobRefKeys";
378
+ readonly outputs: readonly [{
379
+ readonly internalType: "string[]";
380
+ readonly name: "";
381
+ readonly type: "string[]";
382
+ }];
383
+ readonly stateMutability: "view";
384
+ readonly type: "function";
385
+ }, {
386
+ readonly inputs: readonly [];
387
+ readonly name: "getAllContractNames";
388
+ readonly outputs: readonly [{
389
+ readonly internalType: "string[]";
390
+ readonly name: "";
391
+ readonly type: "string[]";
392
+ }];
393
+ readonly stateMutability: "view";
394
+ readonly type: "function";
395
+ }, {
396
+ readonly inputs: readonly [];
397
+ readonly name: "getAllDataKeys";
398
+ readonly outputs: readonly [{
399
+ readonly internalType: "string[]";
400
+ readonly name: "";
401
+ readonly type: "string[]";
402
+ }];
403
+ readonly stateMutability: "view";
404
+ readonly type: "function";
405
+ }, {
406
+ readonly inputs: readonly [{
407
+ readonly internalType: "string";
408
+ readonly name: "key";
409
+ readonly type: "string";
410
+ }, {
411
+ readonly internalType: "uint256";
412
+ readonly name: "offset";
413
+ readonly type: "uint256";
414
+ }, {
415
+ readonly internalType: "uint256";
416
+ readonly name: "limit";
417
+ readonly type: "uint256";
418
+ }];
419
+ readonly name: "getBlobRefHistory";
420
+ readonly outputs: readonly [{
421
+ readonly components: readonly [{
422
+ readonly internalType: "string";
423
+ readonly name: "arweaveTxId";
424
+ readonly type: "string";
425
+ }, {
426
+ readonly internalType: "bytes32";
427
+ readonly name: "sha256Hash";
428
+ readonly type: "bytes32";
429
+ }];
430
+ readonly internalType: "struct AddressRegistry.BlobRef[]";
431
+ readonly name: "";
432
+ readonly type: "tuple[]";
433
+ }];
434
+ readonly stateMutability: "view";
435
+ readonly type: "function";
436
+ }, {
437
+ readonly inputs: readonly [{
438
+ readonly internalType: "string";
439
+ readonly name: "name";
440
+ readonly type: "string";
441
+ }];
442
+ readonly name: "getContractHistory";
443
+ readonly outputs: readonly [{
444
+ readonly components: readonly [{
445
+ readonly internalType: "address";
446
+ readonly name: "contractAddress";
447
+ readonly type: "address";
448
+ }, {
449
+ readonly internalType: "string";
450
+ readonly name: "abiUrl";
451
+ readonly type: "string";
452
+ }];
453
+ readonly internalType: "struct AddressRegistry.ContractRecord[]";
454
+ readonly name: "";
455
+ readonly type: "tuple[]";
456
+ }];
457
+ readonly stateMutability: "view";
458
+ readonly type: "function";
459
+ }, {
460
+ readonly inputs: readonly [{
461
+ readonly internalType: "string";
462
+ readonly name: "key";
463
+ readonly type: "string";
464
+ }];
465
+ readonly name: "getDataHistory";
466
+ readonly outputs: readonly [{
467
+ readonly internalType: "string[]";
468
+ readonly name: "";
469
+ readonly type: "string[]";
470
+ }];
471
+ readonly stateMutability: "view";
472
+ readonly type: "function";
473
+ }, {
474
+ readonly inputs: readonly [{
475
+ readonly internalType: "string";
476
+ readonly name: "key";
477
+ readonly type: "string";
478
+ }];
479
+ readonly name: "getLatestBlobRef";
480
+ readonly outputs: readonly [{
481
+ readonly internalType: "string";
482
+ readonly name: "";
483
+ readonly type: "string";
484
+ }, {
485
+ readonly internalType: "bytes32";
486
+ readonly name: "";
487
+ readonly type: "bytes32";
488
+ }];
489
+ readonly stateMutability: "view";
490
+ readonly type: "function";
491
+ }, {
492
+ readonly inputs: readonly [{
493
+ readonly internalType: "string";
494
+ readonly name: "name";
495
+ readonly type: "string";
496
+ }];
497
+ readonly name: "getLatestContract";
498
+ readonly outputs: readonly [{
499
+ readonly internalType: "address";
500
+ readonly name: "";
501
+ readonly type: "address";
502
+ }, {
503
+ readonly internalType: "string";
504
+ readonly name: "";
505
+ readonly type: "string";
506
+ }];
507
+ readonly stateMutability: "view";
508
+ readonly type: "function";
509
+ }, {
510
+ readonly inputs: readonly [{
511
+ readonly internalType: "string";
512
+ readonly name: "key";
513
+ readonly type: "string";
514
+ }];
515
+ readonly name: "getLatestData";
516
+ readonly outputs: readonly [{
517
+ readonly internalType: "string";
518
+ readonly name: "";
519
+ readonly type: "string";
520
+ }];
521
+ readonly stateMutability: "view";
522
+ readonly type: "function";
523
+ }];
524
+
525
+ declare const pythAbi: readonly [{
526
+ readonly inputs: readonly [{
527
+ readonly internalType: "bytes32";
528
+ readonly name: "id";
529
+ readonly type: "bytes32";
530
+ }];
531
+ readonly name: "getPriceUnsafe";
532
+ readonly outputs: readonly [{
533
+ readonly components: readonly [{
534
+ readonly internalType: "int64";
535
+ readonly name: "price";
536
+ readonly type: "int64";
537
+ }, {
538
+ readonly internalType: "uint64";
539
+ readonly name: "conf";
540
+ readonly type: "uint64";
541
+ }, {
542
+ readonly internalType: "int32";
543
+ readonly name: "expo";
544
+ readonly type: "int32";
545
+ }, {
546
+ readonly internalType: "uint256";
547
+ readonly name: "publishTime";
548
+ readonly type: "uint256";
549
+ }];
550
+ readonly internalType: "struct PythStructs.Price";
551
+ readonly name: "price";
552
+ readonly type: "tuple";
553
+ }];
554
+ readonly stateMutability: "view";
555
+ readonly type: "function";
556
+ }, {
557
+ readonly inputs: readonly [{
558
+ readonly internalType: "bytes[]";
559
+ readonly name: "updateData";
560
+ readonly type: "bytes[]";
561
+ }];
562
+ readonly name: "getUpdateFee";
563
+ readonly outputs: readonly [{
564
+ readonly internalType: "uint256";
565
+ readonly name: "feeAmount";
566
+ readonly type: "uint256";
567
+ }];
568
+ readonly stateMutability: "view";
569
+ readonly type: "function";
570
+ }, {
571
+ readonly inputs: readonly [{
572
+ readonly internalType: "bytes[]";
573
+ readonly name: "updateData";
574
+ readonly type: "bytes[]";
575
+ }];
576
+ readonly name: "updatePriceFeeds";
577
+ readonly outputs: readonly [];
578
+ readonly stateMutability: "payable";
579
+ readonly type: "function";
580
+ }];
581
+
582
+ declare enum EventName {
583
+ WALLET_STATE_CHANGED = "wallet:state:changed",
584
+ WALLET_CHAIN_CHANGED = "wallet:chain:changed",
585
+ WALLET_ERROR = "wallet:error",
586
+ SESSION_UPDATED = "session:updated",
587
+ WALLET_DISCONNECTED = "wallet:disconnected",
588
+ SESSION_DELETED = "session:deleted",
589
+ SAVE_RESTORED = "save:restored",
590
+ SUBSCRIPTION_PATCHES_SYNCED = "subscription:patches:synced"
591
+ }
592
+ declare enum WalletState {
593
+ INITIALIZING = "INITIALIZING",
594
+ UPDATING_STATE_STARTED = "UPDATING_STATE_STARTED",
595
+ UPDATING_STATE_DONE = "UPDATING_STATE_DONE",
596
+ UPDATING_STATE_FAILED = "UPDATING_STATE_FAILED",
597
+ READY = "READY",
598
+ INTERNAL_ERROR = "INTERNAL_ERROR",
599
+ NOT_CONNECTED = "NOT_CONNECTED",
600
+ NOT_INSTALLED = "NOT_INSTALLED",
601
+ NOT_ALLOWED = "NOT_ALLOWED",
602
+ NOT_SUPPORTED = "NOT_SUPPORTED",
603
+ NOT_READY = "NOT_READY",
604
+ CONNECT_STARTED = "CONNECT_STARTED",
605
+ CONNECT_DONE = "CONNECT_DONE",
606
+ CONNECT_FAILED = "CONNECT_FAILED",
607
+ TRANSACTION_STARTED = "TRANSACTION_STARTED",
608
+ TRANSACTION_DONE = "TRANSACTION_DONE",
609
+ TRANSACTION_FAILED = "TRANSACTION_FAILED",
610
+ TIMEOUT = "TIMEOUT",
611
+ CHAIN_CHANGED_STARTED = "CHAIN_CHANGED_STARTED",
612
+ CHAIN_CHANGED_DONE = "CHAIN_CHANGED_DONE",
613
+ CHAIN_CHANGED_FAILED = "CHAIN_CHANGED_FAILED",
614
+ WALLET_INSTALLED = "WALLET_INSTALLED"
615
+ }
616
+ declare enum WalletError {
617
+ NO_ACCOUNTS = "NO_ACCOUNTS",
618
+ USER_REJECTED = "USER_REJECTED",
619
+ INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
620
+ LOGIN_INTO_WALLET = "LOGIN_INTO_WALLET",
621
+ REQUEST_ALREADY_PENDING = "REQUEST_ALREADY_PENDING",
622
+ UNKNOWN_ERROR = "UNKNOWN_ERROR",
623
+ CONFIG_MISSING = "CONFIG_MISSING",
624
+ NOT_SUPPORTED = "NOT_SUPPORTED",
625
+ NOT_CONNECTED = "NOT_CONNECTED",
626
+ NOT_INSTALLED = "NOT_INSTALLED",
627
+ NOT_ALLOWED = "NOT_ALLOWED",
628
+ NETWORK_NOT_SUPPORTED = "NETWORK_NOT_SUPPORTED"
629
+ }
630
+ declare enum WalletUxError {
631
+ NO_ACCOUNT_SWITCH = "NO_ACCOUNT_SWITCH",
632
+ NO_NETWORK_SWITCH = "NO_NETWORK_SWITCH",
633
+ NETWORK_NOT_SUPPORTED = "NETWORK_NOT_SUPPORTED",
634
+ NO_INTERNET = "NO_INTERNET",
635
+ NO_DISCONNECT = "NO_DISCONNECT",
636
+ NO_ACCOUNT_DISCONNECT = "NO_ACCOUNT_DISCONNECT"
637
+ }
638
+
639
+ interface CommonWalletEvent {
640
+ wallet: WalletType;
641
+ chainId?: number;
642
+ timestamp: number;
643
+ }
644
+ interface WalletStateEvent extends CommonWalletEvent {
645
+ event: WalletState;
646
+ functionName?: string;
647
+ functionArgs?: any[];
648
+ }
649
+ interface WalletSessionEvent {
650
+ account: string;
651
+ chainId: number;
652
+ wallet: WalletType;
653
+ }
654
+ interface WalletSessionDeletedEvent {
655
+ account: string;
656
+ chainId: number;
657
+ wallet: WalletType;
658
+ }
659
+ interface WalletErrorEvent extends CommonWalletEvent {
660
+ reason: WalletUxError | WalletError;
661
+ args?: any[];
662
+ }
663
+ interface WalletChainChangedEvent extends CommonWalletEvent {
664
+ }
665
+ interface WalletDisconnectedEvent extends CommonWalletEvent {
666
+ reason?: string;
667
+ timestamp: number;
668
+ }
669
+ interface WalletSaveRestoredEvent extends CommonWalletEvent {
670
+ username: string;
671
+ account: string;
672
+ newRestorationIndex: number;
673
+ appliedCount: number;
674
+ }
675
+ interface SubscriptionPatchesSyncedEvent {
676
+ rootUserId: number;
677
+ chainId: number;
678
+ appliedCount: number;
679
+ timestamp: number;
680
+ }
681
+
682
+ type EventListener<T = any> = (data: T) => void;
683
+ /**
684
+ * Central EventBus for wallet and session events. Pub/sub pattern for
685
+ * cross-module communication within the SDK.
686
+ */
687
+ declare class EventBus {
688
+ private listeners;
689
+ on<T = any>(eventType: EventName, listener: EventListener<T>): () => void;
690
+ off<T = any>(eventType: EventName, listener: EventListener<T>): void;
691
+ emit<T = any>(eventType: EventName, data: T): void;
692
+ once<T = any>(eventType: EventName, listener: EventListener<T>): () => void;
693
+ clear(eventType?: EventName): void;
694
+ listenerCount(eventType: EventName): number;
695
+ }
696
+ declare function getEventBus(): EventBus;
697
+
698
+ declare const WalletEvents: {
699
+ emitWalletStateEvent: (data: WalletStateEvent) => void;
700
+ onWalletStateEvent: (listener: EventListener<WalletStateEvent>) => () => void;
701
+ emitSessionUpdated: (data: WalletSessionEvent) => void;
702
+ onSessionUpdated: (listener: EventListener<WalletSessionEvent>) => () => void;
703
+ emitChainChanged: (data: WalletChainChangedEvent) => void;
704
+ onChainChanged: (listener: EventListener<WalletChainChangedEvent>) => () => void;
705
+ emitDisconnected: (data: WalletDisconnectedEvent) => void;
706
+ onDisconnected: (listener: EventListener<WalletDisconnectedEvent>) => () => void;
707
+ emitWalletSessionDeleted: (data: WalletSessionDeletedEvent) => void;
708
+ onWalletSessionDeleted: (listener: EventListener<WalletSessionDeletedEvent>) => () => void;
709
+ emitWalletError: (data: WalletErrorEvent) => void;
710
+ onWalletError: (listener: EventListener<WalletErrorEvent>) => () => void;
711
+ emitSaveRestored: (data: WalletSaveRestoredEvent) => void;
712
+ onSaveRestored: (listener: EventListener<WalletSaveRestoredEvent>) => () => void;
713
+ emitSubscriptionPatchesSynced: (data: SubscriptionPatchesSyncedEvent) => void;
714
+ onSubscriptionPatchesSynced: (listener: EventListener<SubscriptionPatchesSyncedEvent>) => () => void;
715
+ };
716
+
717
+ declare enum Browser {
718
+ chromium = "chromium",
719
+ firefox = "firefox",
720
+ safari = "safari",
721
+ edge = "edge",
722
+ opera = "opera",
723
+ brave = "brave",
724
+ vivaldi = "vivaldi",
725
+ yandex = "yandex",
726
+ palemoon = "palemoon"
727
+ }
728
+ declare enum Platform {
729
+ android = "android",
730
+ ios = "ios",
731
+ browsers = "browsers"
732
+ }
733
+ declare const parseUserAgent: (userAgent?: string) => {
734
+ browser: Browser;
735
+ platform: Platform;
736
+ };
737
+
738
+ declare function getCachedEmail(): string | null;
739
+ declare function setCachedEmail(email: string | null): void;
740
+ /**
741
+ * Stores the private key in localStorage in plain text.
742
+ * @param chainId The chain/network ID
743
+ * @param privateKey The raw private key (with or without 0x)
744
+ */
745
+ declare function storePrivateKey(chainId: string | number, privateKey: string): void;
746
+ /**
747
+ * Retrieves the private key from localStorage.
748
+ * @param chainId The chain/network ID
749
+ * @returns The private key or null if not found
750
+ */
751
+ declare function getPrivateKey(chainId: string | number): string | null;
752
+ /**
753
+ * Checks if a private key exists in localStorage for a given chainId.
754
+ */
755
+ declare function hasPrivateKey(chainId: string | number): boolean;
756
+ /**
757
+ * Checks if any private key exists in localStorage.
758
+ */
759
+ declare function hasAnyPrivateKey(): boolean;
760
+ declare const storeEncryptedPrivateKey: (chainId: string | number, privateKey: string, _email?: string) => void;
761
+ declare const getDecryptedPrivateKey: (chainId: string | number, _email?: string) => string | null;
762
+ declare const hasEncryptedPrivateKey: (chainId: string | number) => boolean;
763
+
764
+ declare class MetaMaskConnector implements EvmWalletConnector {
765
+ readonly type: WalletType;
766
+ private accountChangedCallbacks;
767
+ private chainChangedCallbacks;
768
+ private isListening;
769
+ private getProvider;
770
+ isAvailable(): boolean;
771
+ private setupListeners;
772
+ connect(): Promise<ConnectResult>;
773
+ getAccounts(): Promise<string[]>;
774
+ getChainId(): Promise<number>;
775
+ requestSwitchChain(chainId: number): Promise<void>;
776
+ sendTransaction(tx: TransactionRequest, chainId: number): Promise<string>;
777
+ signMessage(message: string): Promise<string>;
778
+ getWalletClient(chainId: number): Promise<WalletClient>;
779
+ onAccountChanged(cb: (address: string) => void): () => void;
780
+ onChainChanged(cb: (chainId: number) => void): () => void;
781
+ disconnect(): void;
782
+ }
783
+ declare function createMetaMaskConnector(): MetaMaskConnector;
784
+
785
+ declare function addressFromPrivateKey(privateKey: string): string;
786
+ declare function createPrivateKeyWalletClient(chainId: number, privateKey: string): WalletClient;
787
+ declare class PrivateKeyConnector implements EvmWalletConnector {
788
+ readonly type: WalletType;
789
+ private activeChainId;
790
+ private chainChangedCallbacks;
791
+ isAvailable(): boolean;
792
+ connect(chainId?: number): Promise<ConnectResult>;
793
+ getAccounts(): Promise<string[]>;
794
+ getChainId(): Promise<number>;
795
+ requestSwitchChain(chainId: number): Promise<void>;
796
+ sendTransaction(tx: TransactionRequest, chainId: number): Promise<string>;
797
+ signMessage(message: string): Promise<string>;
798
+ getWalletClient(chainId: number): Promise<WalletClient>;
799
+ onAccountChanged(cb: (address: string) => void): () => void;
800
+ onChainChanged(cb: (chainId: number) => void): () => void;
801
+ disconnect(): void;
802
+ }
803
+ declare function createPrivateKeyConnector(): PrivateKeyConnector;
804
+
805
+ interface WalletMeta {
806
+ readonly displayName: string;
807
+ readonly logoUrl: string;
808
+ readonly description: string;
809
+ readonly website: string;
810
+ getInstallUrl(browser?: Browser): string;
811
+ isInstalled(): boolean;
812
+ isInstallable(): boolean;
813
+ }
814
+ declare const walletMeta: Record<WalletType, WalletMeta>;
815
+
816
+ declare function registerConnector(connector: WalletConnector): void;
817
+ declare function getConnector(type: WalletType): WalletConnector | undefined;
818
+ declare function getRegisteredConnectors(): WalletConnector[];
819
+
820
+ export { AddressRegistryReadAPI, AddressRegistryWriteAPI, ArchivistStorageReadAPI, BouncerStorageReadAPI, Browser, type CommonWalletEvent, ConnectResult, EventBus, type EventListener, EventName, EvmChainConfig, EvmClient, EvmWalletConnector, EvmWriteClient, FactoryReadAPI, FactoryWriteAPI, FetchOptions, LibraryRegistryStorageReadAPI, LibraryRegistryStorageWriteAPI, MetaMaskConnector, Patch, Platform, PrivateKeyConnector, ProjectManagerStorageReadAPI, PublicLibraryStorageReadAPI, PublicLibraryStorageWriteAPI, ReadOnlyDomainAPI, ScientistStorageReadAPI, SessionStore, SubscriptionClient, type SubscriptionClientConfig, SubscriptionGraph, SubscriptionManagerReadAPI, SubscriptionManagerWriteAPI, SubscriptionNode, type SubscriptionPatchesSyncedEvent, SyncCursor, SyncOptions, SyncResult, TransactionOptions, WalkOptions, type WalletChainChangedEvent, WalletConnector, type WalletDisconnectedEvent, WalletError, type WalletErrorEvent, WalletEvents, type WalletMeta, type WalletSaveRestoredEvent, type WalletSessionDeletedEvent, type WalletSessionEvent, WalletState, type WalletStateEvent, WalletType, WalletUxError, Web3SessionAccount, WriteOnlyDomainAPI, addressFromPrivateKey, addressRegistryAbi, allRegisteredAccounts, createEvmClient, createMetaMaskConnector, createPrivateKeyConnector, createPrivateKeyWalletClient, createPrivateKeyWriteClient, createSessionStore, createWriteClient, cursorStore, deserializeCursor, emptyCursor, getCachedEmail, getConnector, getDecryptedPrivateKey, getEventBus, getEvmClient, getPrivateKey, getReadClient, getReadyEvmClient, getRegisteredConnectors, getSubscriptionClient, handleWriteOperationErrors, hasAnyPrivateKey, hasEncryptedPrivateKey, hasPrivateKey, hasUnsavedPatches, loadNetworkInfos, parseUserAgent, pythAbi, readOnlyClients, readOnlyStagingClients, registerConnector, resetTransactionState, restoreAccountSave, saveMyLevel, serializeCursor, sessionStore, setCachedEmail, storeEncryptedPrivateKey, storePrivateKey, syncAccount, walletMeta, writeOperations };