@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,111 @@
1
+ type FilePhase$1 = 'unknown' | 'queued' | 'downloading' | 'done' | 'error';
2
+ interface FileState$1 {
3
+ phase: FilePhase$1;
4
+ loaded?: number;
5
+ total?: number;
6
+ error?: string;
7
+ }
8
+ interface BookData {
9
+ txId: string;
10
+ dimensions: Array<{
11
+ width: number;
12
+ height: number;
13
+ }>;
14
+ parsed: boolean;
15
+ }
16
+ type WorkerCommand = {
17
+ type: 'GetFile';
18
+ txId: string;
19
+ mime: 'pdf' | 'preview';
20
+ } | {
21
+ type: 'ProcessPages';
22
+ txId: string;
23
+ from: number;
24
+ to: number;
25
+ } | {
26
+ type: 'CancelDownload';
27
+ txId: string;
28
+ };
29
+ type WorkerMessage = {
30
+ type: 'FileRpcResponse';
31
+ ok: boolean;
32
+ key: string;
33
+ error?: string;
34
+ } | {
35
+ type: 'HYDRATE';
36
+ payload: HydratePayload;
37
+ } | {
38
+ type: 'DownloadProgress';
39
+ txId: string;
40
+ loaded: number;
41
+ total?: number;
42
+ } | {
43
+ type: 'DownloadFinished';
44
+ txId: string;
45
+ key: string;
46
+ mime: 'pdf' | 'preview';
47
+ } | {
48
+ type: 'DownloadError';
49
+ txId: string;
50
+ error: string;
51
+ retryable: boolean;
52
+ } | {
53
+ type: 'StoragePruneStarted';
54
+ targetFreeBytes: number;
55
+ } | {
56
+ type: 'StoragePruned';
57
+ removed: number;
58
+ freedBytes: number;
59
+ prunedTxIds: string[];
60
+ } | {
61
+ type: 'MuPageDone';
62
+ txId: string;
63
+ page: number;
64
+ } | {
65
+ type: 'MuPageError';
66
+ txId: string;
67
+ page: number;
68
+ error: string;
69
+ } | {
70
+ type: 'MuPdfData';
71
+ txId: string;
72
+ bookData: BookData;
73
+ };
74
+ interface HydratePayload {
75
+ files: Array<[txId: string, state: FileState$1]>;
76
+ renders: Array<[txId: string, pages: Array<[page: number, phase: FilePhase$1]>]>;
77
+ }
78
+
79
+ type FilePhase = 'unknown' | 'queued' | 'downloading' | 'done' | 'error';
80
+ interface FileState {
81
+ phase: FilePhase;
82
+ loaded?: number;
83
+ total?: number;
84
+ error?: string;
85
+ }
86
+ interface RenderState {
87
+ bookData?: BookData;
88
+ pages: Map<number, FilePhase>;
89
+ }
90
+ interface PruningState {
91
+ active: boolean;
92
+ freedBytes: number;
93
+ removedCount: number;
94
+ }
95
+ type Listener = (changedKey: string) => void;
96
+ declare const downloadState: {
97
+ readonly files: ReadonlyMap<string, FileState>;
98
+ readonly renders: ReadonlyMap<string, RenderState>;
99
+ readonly pruning: Readonly<PruningState>;
100
+ get(txId: string): FileState;
101
+ getRender(txId: string): RenderState;
102
+ summary(): {
103
+ active: number;
104
+ queued: number;
105
+ loaded: number;
106
+ total: number;
107
+ };
108
+ subscribe(listener: Listener): () => void;
109
+ };
110
+
111
+ export { type BookData as B, type FileState as F, type HydratePayload as H, type PruningState as P, type RenderState as R, type WorkerCommand as W, type FilePhase as a, type WorkerMessage as b, downloadState as d };
@@ -0,0 +1,293 @@
1
+ import { TransactionRequest, WalletClient } from 'viem';
2
+
3
+ interface ContractAddresses {
4
+ factory: string;
5
+ bouncerStorage: string;
6
+ scientistStorage: string;
7
+ backupStorage: string;
8
+ projectManagerStorage: string;
9
+ subscriptionManager?: string;
10
+ libraryRegistryStorage?: string;
11
+ publicLibraryStorage?: string;
12
+ }
13
+ interface StripeDonation {
14
+ stripePaymentId: string;
15
+ amountUSD: bigint;
16
+ username: string;
17
+ donor: string;
18
+ country: string;
19
+ language: string;
20
+ timestamp: number;
21
+ chainId: number | string;
22
+ }
23
+ interface BouncerStorageReadAPI {
24
+ hasAccount(address: string): Promise<boolean>;
25
+ userInfos(address: string): Promise<[username: string, country: string, language: string, userId: number]>;
26
+ userData(userId: number): Promise<[id: number, addr: string, username: string, language: string, country: string]>;
27
+ getUsernameByAddress(address: string): Promise<string>;
28
+ userIdOf(address: string): Promise<number>;
29
+ userIdToUsername(userId: number): Promise<string>;
30
+ usernameToUserId(username: string): Promise<number>;
31
+ userAddr(userId: number): Promise<string>;
32
+ getAccountCountByCountryLanguage(country: string, language: string): Promise<number>;
33
+ getAllLocationCounts(): Promise<any[]>;
34
+ getActiveLocationCount(): Promise<number>;
35
+ nbAccounts(): Promise<number>;
36
+ identityStats(): Promise<[nbVerbs: number, nbAdjectives: number]>;
37
+ isAuthorized(address: string): Promise<boolean>;
38
+ getLatestRegisteredUser(): Promise<string | null>;
39
+ getTokenName(): Promise<string>;
40
+ }
41
+ interface ArchivistStorageReadAPI {
42
+ userLevel(userId: number): Promise<number>;
43
+ isAuthorized(address: string): Promise<boolean>;
44
+ nbWrites(userId: number): Promise<number>;
45
+ loadActions(userId: number): Promise<[bigint[], bigint[], string[]]>;
46
+ loadActionsSince(userId: number, index: number): Promise<[bigint[], bigint[], string[]]>;
47
+ }
48
+ interface ScientistStorageReadAPI {
49
+ getLastMonthId(): Promise<number>;
50
+ getDeploymentDate(): Promise<[year: number, month: number]>;
51
+ getStatsRaw(action: number, objectType: number, monthId: number): Promise<[bigint[], number[]]>;
52
+ isAuthorized(address: string): Promise<boolean>;
53
+ }
54
+ interface ProjectManagerStorageReadAPI {
55
+ nbProjects(): Promise<number>;
56
+ getProjectSupportedLanguages(projectId: number): Promise<Array<string>>;
57
+ addressDonationsPerProject(address: string): Promise<Array<number>>;
58
+ balanceOfAddress(address: string): Promise<{
59
+ total: number;
60
+ donations: number;
61
+ unspent: number;
62
+ }>;
63
+ loadProject(projectId: number): Promise<{
64
+ id: number;
65
+ balance: number;
66
+ versions: any[];
67
+ availableLanguages: string[];
68
+ }>;
69
+ projectVotingBalances(projectId: number): Promise<number>;
70
+ getWeeklyDonations(week: number): Promise<StripeDonation[]>;
71
+ getDonationsRange(fromWeek: number, toWeek: number): Promise<StripeDonation[]>;
72
+ isAuthorized(address: string): Promise<boolean>;
73
+ admin(): Promise<string>;
74
+ getNbLanguages(projectId: number): Promise<number>;
75
+ getLanguageAtIndex(projectId: number, index: number): Promise<string>;
76
+ getNbVersions(projectId: number, lang: string): Promise<number>;
77
+ getVersion(projectId: number, lang: string, versionNumber: number): Promise<ProjectVersion>;
78
+ getVotingBalance(projectId: number, lang: string): Promise<bigint>;
79
+ getUserBalances(address: string): Promise<[donated: bigint, allocated: bigint, remaining: bigint]>;
80
+ }
81
+ interface FactoryReadAPI {
82
+ nbWritesByUsername(username: string): Promise<number>;
83
+ loadUsername(username: string): Promise<[bigint[], bigint[], string[]]>;
84
+ loadUsernameSince(username: string, index: number): Promise<[bigint[], bigint[], string[]]>;
85
+ load(): Promise<[bigint[], bigint[], string[]]>;
86
+ isAuthorized(address: string): Promise<boolean>;
87
+ owner(): Promise<string>;
88
+ oracleSigner(): Promise<string>;
89
+ bouncerStorage(): Promise<string>;
90
+ scientistStorage(): Promise<string>;
91
+ backupStorage(): Promise<string>;
92
+ projectManagerStorage(): Promise<string>;
93
+ usedPaymentIntents(paymentIntentId: string): Promise<boolean>;
94
+ }
95
+ interface TransactionOptions {
96
+ feeLimit?: number;
97
+ gasLimit?: bigint;
98
+ value?: number;
99
+ onAccepted?: (txId: string) => void;
100
+ }
101
+ interface FactoryWriteAPI {
102
+ register(country: string, language: string, paymentValue: number, options?: TransactionOptions): Promise<any>;
103
+ unregister(options?: TransactionOptions): Promise<any>;
104
+ save(patches: Array<bigint>, level: number, textIndex: Array<number>, text: Array<string>, options?: TransactionOptions): Promise<any>;
105
+ createProject(lang: string, uri: string, publicationDate: number, name: string, headline: string, arweaveAddressLogo: string, arweaveAddressBanner: string, descriptionMarkdown: string, minimumFundingBeforeStartWork: number, maximumFunding: number, tags: number[], complexity: number, options?: TransactionOptions): Promise<any>;
106
+ addProjectVersion(projectId: number, lang: string, publicationDate: number, uri: string, name: string, headline: string, arweaveAddressLogo: string, arweaveAddressBanner: string, descriptionMarkdown: string, minimumFundingBeforeStartWork: number, maximumFunding: number, tags: number[], status: number, complexity: number, options?: TransactionOptions): Promise<any>;
107
+ deleteProject(projectId: number, lang: string, options?: TransactionOptions): Promise<any>;
108
+ registerStripe(country: string, language: string, paymentIntentId: string, votes: bigint, signature: string, options?: TransactionOptions): Promise<any>;
109
+ fundStripe(paymentIntentId: string, votes: bigint, signature: string, options?: TransactionOptions): Promise<any>;
110
+ donateToProject(projectId: number, lang: string, amount: number, options?: TransactionOptions): Promise<any>;
111
+ }
112
+ interface AddressRegistryWriteAPI {
113
+ addData(key: string, value: string, options?: TransactionOptions): Promise<any>;
114
+ }
115
+ interface AddressRegistryContractRecord {
116
+ contractAddress: string;
117
+ abiUrl: string;
118
+ }
119
+ interface AddressRegistryUpdateInfo {
120
+ timestamp: number;
121
+ blockNumber: bigint;
122
+ transactionHash: string;
123
+ }
124
+ interface AddressRegistryReadAPI {
125
+ getLatestContract(name: string): Promise<[address: string, abiUrl: string]>;
126
+ getContractHistory(name: string): Promise<AddressRegistryContractRecord[]>;
127
+ getAllContractNames(): Promise<string[]>;
128
+ getLatestData(key: string): Promise<string>;
129
+ getAllDataKeys(): Promise<string[]>;
130
+ getLastUpdateInfo(name: string): Promise<AddressRegistryUpdateInfo | null>;
131
+ admin(): Promise<string>;
132
+ }
133
+ interface CollectionInput {
134
+ id: string;
135
+ slug: string;
136
+ manifestUrl: string;
137
+ importerUsername: string;
138
+ owner: string;
139
+ fileCount: number;
140
+ libraryType: number;
141
+ publicLibraryId: number;
142
+ country: string;
143
+ language: string;
144
+ isPublic: boolean;
145
+ initialBookCount: number;
146
+ dSafeBookCount: number;
147
+ }
148
+ interface Collection extends CollectionInput {
149
+ verified: boolean;
150
+ createdAt: number;
151
+ updatedAt: number;
152
+ importStatus: number;
153
+ published: boolean;
154
+ }
155
+ interface LibraryRegistryStorageReadAPI {
156
+ getUnverifiedCollectionIds(): Promise<string[]>;
157
+ getVerifiedCollectionIds(): Promise<string[]>;
158
+ getCollection(id: string): Promise<Collection>;
159
+ }
160
+ interface LibraryRegistryStorageWriteAPI {
161
+ addUnverifiedCollection(input: CollectionInput, options?: TransactionOptions): Promise<any>;
162
+ verifyCollection(id: string, options?: TransactionOptions): Promise<any>;
163
+ rejectCollection(id: string, options?: TransactionOptions): Promise<any>;
164
+ updateCollectionStats(id: string, initialBookCount: number, dSafeBookCount: number, options?: TransactionOptions): Promise<any>;
165
+ setImportStatus(id: string, status: number, options?: TransactionOptions): Promise<any>;
166
+ setPublished(id: string, isPublished: boolean, options?: TransactionOptions): Promise<any>;
167
+ setCollectionPublicLibrary(id: string, publicLibraryId: number, options?: TransactionOptions): Promise<any>;
168
+ setPublicLibraryStorage(storageAddr: string, options?: TransactionOptions): Promise<any>;
169
+ }
170
+ declare enum LibraryOwnership {
171
+ Public = 0,
172
+ Private = 1
173
+ }
174
+ declare enum PreferredFormat {
175
+ MARC21 = 0,
176
+ UNIMARC = 1,
177
+ MARCXML = 2,
178
+ DublinCore = 3,
179
+ MODS = 4,
180
+ BIBFRAME = 5,
181
+ ONIX = 6,
182
+ OPDS = 7,
183
+ InternetArchive = 8,
184
+ HathiTrust = 9,
185
+ EAD = 10,
186
+ Other = 11
187
+ }
188
+ interface PublicLibraryInput {
189
+ name: string;
190
+ physicalAddress: string;
191
+ country: string;
192
+ language: string;
193
+ ownership: LibraryOwnership | number;
194
+ website: string;
195
+ preferredFormat: PreferredFormat | number;
196
+ }
197
+ interface PublicLibrary extends PublicLibraryInput {
198
+ id: number;
199
+ createdAt: number;
200
+ updatedAt: number;
201
+ }
202
+ interface PublicLibraryStorageReadAPI {
203
+ libraryExists(id: number): Promise<boolean>;
204
+ getPublicLibrary(id: number): Promise<PublicLibrary>;
205
+ nbLibraries(): Promise<number>;
206
+ }
207
+ interface PublicLibraryStorageWriteAPI {
208
+ addPublicLibrary(input: PublicLibraryInput, options?: TransactionOptions): Promise<any>;
209
+ updatePublicLibrary(id: number, input: PublicLibraryInput, options?: TransactionOptions): Promise<any>;
210
+ }
211
+ interface SubscriptionManagerReadAPI {
212
+ getSubscriptions(userId: number): Promise<number[]>;
213
+ getSubscriptionCount(userId: number): Promise<bigint>;
214
+ isSubscribed(subscriber: number, target: number): Promise<boolean>;
215
+ scoreOf(userId: number): Promise<bigint>;
216
+ }
217
+ interface SubscriptionManagerWriteAPI {
218
+ subscribeTo(subscriber: number, target: number, options?: TransactionOptions): Promise<any>;
219
+ unsubscribeFrom(subscriber: number, target: number, options?: TransactionOptions): Promise<any>;
220
+ }
221
+ interface ReadOnlyDomainAPI {
222
+ readonly chainId: number;
223
+ readonly ready: Promise<void>;
224
+ readonly bouncerStorage: BouncerStorageReadAPI;
225
+ readonly scientistStorage: ScientistStorageReadAPI;
226
+ readonly archivistStorage: ArchivistStorageReadAPI;
227
+ readonly projectManagerStorage: ProjectManagerStorageReadAPI;
228
+ readonly factory: FactoryReadAPI;
229
+ readonly addressRegistry: AddressRegistryReadAPI;
230
+ readonly subscriptionManager: SubscriptionManagerReadAPI;
231
+ readonly libraryRegistryStorage: LibraryRegistryStorageReadAPI;
232
+ readonly publicLibraryStorage: PublicLibraryStorageReadAPI;
233
+ getUsdPrice(): Promise<number>;
234
+ getRegistryStatus(): Promise<any>;
235
+ }
236
+ interface WriteOnlyDomainAPI {
237
+ readonly factory: FactoryWriteAPI;
238
+ readonly subscriptionManager: SubscriptionManagerWriteAPI;
239
+ readonly addressRegistry: AddressRegistryWriteAPI;
240
+ readonly libraryRegistryStorage: LibraryRegistryStorageWriteAPI;
241
+ readonly publicLibraryStorage: PublicLibraryStorageWriteAPI;
242
+ }
243
+ interface ProjectVersion {
244
+ uri: string;
245
+ publicationDate: Date;
246
+ name: string;
247
+ headline: string;
248
+ descriptionMarkdown: string;
249
+ arweaveAddressLogo: string;
250
+ arweaveAddressBanner: string;
251
+ minimumFundingBeforeStartWork: number;
252
+ maximumFunding: number;
253
+ tags: Array<number>;
254
+ status: number;
255
+ complexity: number;
256
+ }
257
+ interface Project {
258
+ id: number;
259
+ balance: number;
260
+ availableLanguages: Array<string>;
261
+ versions: Array<ProjectVersion>;
262
+ }
263
+ type ErrorCode = 'REVERT' | 'INSUFFICIENT_FUNDS' | 'NONCE_TOO_LOW' | 'USER_REJECTED' | 'NETWORK_ERROR' | 'TIMEOUT' | 'INVALID_ARGUMENT' | 'INVALID_COMPRESSED_ACTIONS' | 'UNSUPPORTED_OPERATION' | 'SWITCH_CHAIN_ERROR' | 'SWITCH_TO_UNSUPPORTED_CHAIN' | 'NO_WALLET_CONNECTED' | 'WALLET_NOT_INSTALLED' | 'UNKNOWN';
264
+ interface NormalizedError {
265
+ code: ErrorCode;
266
+ message: string;
267
+ reason?: string;
268
+ data?: any;
269
+ originalError?: any;
270
+ }
271
+ type WalletType = 'metamask' | 'private_key';
272
+ interface ConnectResult {
273
+ address: string;
274
+ chainId: number;
275
+ }
276
+ interface WalletConnector {
277
+ readonly type: WalletType;
278
+ isAvailable(): boolean;
279
+ connect(): Promise<ConnectResult>;
280
+ getAccounts(): Promise<string[]>;
281
+ getChainId(): Promise<number>;
282
+ requestSwitchChain(chainId: number): Promise<void>;
283
+ sendTransaction(tx: TransactionRequest, chainId: number): Promise<string>;
284
+ signMessage(message: string): Promise<string>;
285
+ onAccountChanged(cb: (address: string) => void): () => void;
286
+ onChainChanged(cb: (chainId: number) => void): () => void;
287
+ disconnect(): void;
288
+ }
289
+ interface EvmWalletConnector extends WalletConnector {
290
+ getWalletClient(chainId: number): Promise<WalletClient>;
291
+ }
292
+
293
+ export { type AddressRegistryReadAPI as A, type BouncerStorageReadAPI as B, type ConnectResult as C, type EvmWalletConnector as E, type FactoryReadAPI as F, type LibraryRegistryStorageReadAPI as L, type NormalizedError as N, type ProjectVersion as P, type ReadOnlyDomainAPI as R, type ScientistStorageReadAPI as S, type TransactionOptions as T, type WalletType as W, type Project as a, type WalletConnector as b, type ArchivistStorageReadAPI as c, type ProjectManagerStorageReadAPI as d, type SubscriptionManagerReadAPI as e, type PublicLibraryStorageReadAPI as f, type WriteOnlyDomainAPI as g, type FactoryWriteAPI as h, type SubscriptionManagerWriteAPI as i, type AddressRegistryWriteAPI as j, type LibraryRegistryStorageWriteAPI as k, type PublicLibraryStorageWriteAPI as l, type ContractAddresses as m, type StripeDonation as n, type AddressRegistryContractRecord as o, type AddressRegistryUpdateInfo as p, type CollectionInput as q, type Collection as r, LibraryOwnership as s, PreferredFormat as t, type PublicLibraryInput as u, type PublicLibrary as v, type ErrorCode as w };
@@ -0,0 +1,155 @@
1
+ import { Chain } from 'viem';
2
+ import { W as WalletType, P as ProjectVersion, a as Project } from './types-Dn0EFMO_.js';
3
+
4
+ type ChainPrice = {
5
+ stable: true;
6
+ } | {
7
+ stable?: false;
8
+ pythOracle: string;
9
+ usdPriceId: string;
10
+ };
11
+ interface EvmChainConfig {
12
+ chainId: number;
13
+ name: string;
14
+ symbol: string;
15
+ shortName: string;
16
+ decimals: number;
17
+ explorer: string;
18
+ rpc: string;
19
+ website: string;
20
+ main: boolean;
21
+ logo: string;
22
+ price: ChainPrice;
23
+ addresses?: {
24
+ addressRegistry?: string;
25
+ stagingAddressRegistry?: string;
26
+ [contract: string]: string | undefined;
27
+ };
28
+ deployed?: boolean;
29
+ stagingDeployed?: boolean;
30
+ }
31
+ declare const EVM_CHAINS: Record<number, EvmChainConfig>;
32
+ declare const DEFAULT_CHAIN_ID = 1116;
33
+ declare function getChain(chainId: number | string): EvmChainConfig;
34
+ declare function toViemChain(config: EvmChainConfig): Chain;
35
+
36
+ interface Web3SessionAccount {
37
+ account: string;
38
+ username: string;
39
+ hasAccount: boolean;
40
+ userId: number;
41
+ lastPatchIndex: number;
42
+ lastRestorationIndex: number;
43
+ country?: string;
44
+ language?: string;
45
+ lastUpdated?: number;
46
+ level?: number;
47
+ projectBalance?: {
48
+ contributions: number;
49
+ allocated: number;
50
+ remaining: number;
51
+ };
52
+ donationsPerProject?: number[];
53
+ chainId: number;
54
+ wallet: WalletType;
55
+ }
56
+ interface SessionState {
57
+ active: Web3SessionAccount | null;
58
+ known: Web3SessionAccount[];
59
+ }
60
+ interface SessionStore {
61
+ getState(): SessionState;
62
+ setActive(account: Web3SessionAccount | null): void;
63
+ addKnown(account: Web3SessionAccount): void;
64
+ updateAccount(address: string, chainId: number, patch: Partial<Web3SessionAccount>): void;
65
+ removeAccount(address: string, chainId: number): void;
66
+ clearAll(): void;
67
+ setLastSavedPatchIndex(address: string, chainId: number, index: number): void;
68
+ setLastRestorationIndex(address: string, chainId: number, index: number): void;
69
+ lastSyncCounters(address: string, chainId: number): {
70
+ lastPatchIndex: number;
71
+ lastRestorationIndex: number;
72
+ };
73
+ updateProjectVotes(address: string, chainId: number, projectId: number, amount: number): void;
74
+ persist(): void;
75
+ load(): void;
76
+ subscribe(listener: () => void): () => void;
77
+ }
78
+
79
+ interface ProjectLocale {
80
+ id: number;
81
+ lang: string;
82
+ version: ProjectVersion;
83
+ balance: number;
84
+ }
85
+ declare const projectLocale: (project: Project, userLanguage: string, chainId: number) => ProjectLocale;
86
+ declare const loadProjects: (chainId: number, language: string) => Promise<Array<ProjectLocale | null>>;
87
+ declare const loadProject: (chainId: number, language: string, projectId: number, refresh?: boolean) => Promise<ProjectLocale>;
88
+
89
+ interface SubscriptionNode {
90
+ userId: number;
91
+ subscriptions: number[];
92
+ score?: bigint;
93
+ }
94
+ /**
95
+ * A patch batch fetched from one userId's on-chain BackupStorage history
96
+ * (spec §15.2: reads directly from BackupStorage.loadActions/loadActionsSince —
97
+ * no Arweave TX resolution, per O2).
98
+ *
99
+ * `raw` decoding is deferred until the web3-sdk / models_v2 / downloader_v2
100
+ * bundling (spec §16) — per explicit decision, O3 stays unresolved for now and
101
+ * `raw` is left fully opaque (O3 Option 2). Callers that need the decoded
102
+ * patch content import their own models_v2 codec against
103
+ * `raw as { compressedActions: bigint[]; indexes: bigint[]; stringIndexes: string[] }`.
104
+ */
105
+ interface Patch {
106
+ userId: number;
107
+ fromIndex: number;
108
+ toIndex: number;
109
+ raw: unknown;
110
+ }
111
+ interface SubscriptionGraph {
112
+ rootUserId: number;
113
+ nodes: Map<number, SubscriptionNode>;
114
+ truncated: boolean;
115
+ }
116
+ interface SyncResult {
117
+ patches: Patch[];
118
+ cursor: SyncCursor;
119
+ truncated: boolean;
120
+ }
121
+ /**
122
+ * Serializable — safe to persist in IndexedDB between sessions (spec §15.8).
123
+ * `patchIndex` replaces the original spec's arweaveTxId `Set<string>` with a
124
+ * per-userId last-delivered-index map, since patches are now on-chain and
125
+ * index-addressed (BackupStorage.loadActionsSince), not txId-addressed.
126
+ */
127
+ interface SyncCursor {
128
+ rootUserId: number;
129
+ knownNodes: Map<number, SubscriptionNode>;
130
+ countSnapshot: Map<number, number>;
131
+ patchIndex: Map<number, number>;
132
+ }
133
+ interface WalkOptions {
134
+ maxNodes?: number;
135
+ maxDepth?: number;
136
+ }
137
+ interface FetchOptions {
138
+ concurrency?: number;
139
+ }
140
+ interface SyncOptions extends WalkOptions, FetchOptions {
141
+ cursor?: SyncCursor;
142
+ }
143
+ /**
144
+ * Carried forward from the original spec (§15.5, "unchanged") for API shape
145
+ * compatibility. Not wired into patch-resolver.ts today — the original
146
+ * motivation (avoid re-fetching immutable Arweave data by txId) doesn't map
147
+ * onto index-paginated on-chain reads, which are already cheap to re-issue.
148
+ * Left available for a future persistent cache if that changes.
149
+ */
150
+ interface PatchCacheAdapter {
151
+ get(key: string): Promise<Patch | undefined>;
152
+ set(key: string, patch: Patch): Promise<void>;
153
+ }
154
+
155
+ export { type ChainPrice as C, DEFAULT_CHAIN_ID as D, type EvmChainConfig as E, type FetchOptions as F, type ProjectLocale as P, type SyncCursor as S, type Web3SessionAccount as W, type SessionStore as a, type SubscriptionNode as b, type WalkOptions as c, type SubscriptionGraph as d, type Patch as e, type SyncOptions as f, type SyncResult as g, type SessionState as h, loadProject as i, type PatchCacheAdapter as j, EVM_CHAINS as k, loadProjects as l, getChain as m, projectLocale as p, toViemChain as t };