@fxhash/config 0.0.10 → 0.0.12

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/dist/index.d.ts CHANGED
@@ -1,14 +1,429 @@
1
- import { type IEthApis, ethTestnetApis } from "./api/eth.js";
2
- import { type ITezosApis, tezosTestnetApis, tezosMainnetApis } from "./api/tezos.js";
3
- import { fxhashDevApis, fxhashPrdApis } from "./api/fxhash.js";
4
- import { type ITezosContracts, tezosMainnetContracts, tezosTestnetContracts } from "./contracts/tezos.js";
5
- import { type IEthContracts, ethTestnetContracts } from "./contracts/eth.js";
6
- import { type GPURenderingConfig } from "./config/gpu.js";
7
- import { fxhashConfig, prdConfig, devConfig, localConfig, config, setConfig } from "./config.js";
8
- import { type IFxhashEnvConfig, type IFxhashNetworkConfig, type TBlockchain, type TBlockchainNetwork, type TEnv, type IFxhashConfig } from "./types.js";
9
- export { ethTestnetApis, tezosTestnetApis, tezosMainnetApis, fxhashDevApis, fxhashPrdApis, tezosTestnetContracts, tezosMainnetContracts, ethTestnetContracts, fxhashConfig, devConfig, prdConfig, localConfig, config, setConfig, type IEthApis, type ITezosApis, type ITezosContracts, type IEthContracts, type IFxhashEnvConfig, type IFxhashNetworkConfig, type TBlockchain, type TBlockchainNetwork, type TEnv, type IFxhashConfig, type GPURenderingConfig };
10
- export * from "./types.js";
11
- export * from "./helpers.js";
12
- export * from "./utils/index.js";
13
- export { isAppMetadataValid } from "./config/metadata.js";
14
- export default fxhashConfig;
1
+ import { Result } from "@fxhash/utils";
2
+ import { IRichErrorMessages, RichError, RichErrorUnion } from "@fxhash/errors";
3
+
4
+ //#region src/api/eth.d.ts
5
+ interface IEthApis {
6
+ rpcs: string[];
7
+ reservoir: string;
8
+ safe: string;
9
+ whitelist: string;
10
+ alchemy: {
11
+ rpc: string;
12
+ };
13
+ }
14
+ declare const ethTestnetApis: IEthApis;
15
+ //#endregion
16
+ //#region src/api/tezos.d.ts
17
+ interface ITezosApis {
18
+ tzktWebsite: string;
19
+ tzkt: string;
20
+ tzktPro: string;
21
+ rpcs: string[];
22
+ }
23
+ declare const tezosTestnetApis: ITezosApis;
24
+ declare const tezosMainnetApis: ITezosApis;
25
+ //#endregion
26
+ //#region src/api/base.d.ts
27
+ interface IBaseApis {
28
+ rpcs: string[];
29
+ reservoir: string;
30
+ safe: string;
31
+ whitelist: string;
32
+ alchemy: {
33
+ rpc: string;
34
+ };
35
+ }
36
+ //#endregion
37
+ //#region src/config/algolia.d.ts
38
+ type AlgoliaConfig = {
39
+ appId: string;
40
+ enabled: boolean;
41
+ indexGenerativeTokens: string;
42
+ indexOffers: string;
43
+ indexUsers: string;
44
+ indexArticles: string;
45
+ indexAccounts: string;
46
+ };
47
+ //#endregion
48
+ //#region src/config/gpu.d.ts
49
+ declare const GPU_VERSIONS: readonly ["v111", "v132"];
50
+ type GPUVersion = (typeof GPU_VERSIONS)[number];
51
+ interface GPURenderingVersionConfig {
52
+ date: string;
53
+ version: string;
54
+ batchArn: string;
55
+ }
56
+ type GPURenderingConfig = Record<GPUVersion, GPURenderingVersionConfig>;
57
+ // Environment configs
58
+ //#endregion
59
+ //#region src/contracts/base.d.ts
60
+ interface IBaseContracts {
61
+ multicall3: `0x${string}`;
62
+ seaport_zone: `0x${string}`;
63
+ issuer_factory_v1: `0x${string}`;
64
+ fixed_price_minter_v1: `0x${string}`;
65
+ dutch_auction_minter_v1: `0x${string}`;
66
+ mint_ticket_factory_v1: `0x${string}`;
67
+ ticket_redeemer_v1: `0x${string}`;
68
+ ipfs_renderer_v1: `0x${string}`;
69
+ onchfs_renderer_v1: `0x${string}`;
70
+ randomizer_v1: `0x${string}`;
71
+ role_registry_v1: `0x${string}`;
72
+ contract_registry_v1: `0x${string}`;
73
+ gen_art_token_impl_v1: `0x${string}`;
74
+ mint_ticket_impl_v1: `0x${string}`;
75
+ onchfs_file_system: `0x${string}`;
76
+ onchfs_content_store: `0x${string}`;
77
+ seaport: `0x${string}`;
78
+ fxhashTeamSafeAddress: `0x${string}`;
79
+ signerSafe: `0x${string}`;
80
+ moderationSafe: `0x${string}`;
81
+ farcaster_frame_fixed_price_minter_v1: `0x${string}`;
82
+ fx_token: `0x${string}`;
83
+ fx_airdrop: `0x${string}`;
84
+ fx_tez_airdrop: `0x${string}`;
85
+ fx_token_launchpad: `0x${string}`;
86
+ fx_project_factory: `0x${string}`;
87
+ }
88
+ //#endregion
89
+ //#region src/contracts/eth.d.ts
90
+ interface IEthContracts {
91
+ multicall3: `0x${string}`;
92
+ seaport_zone: `0x${string}`;
93
+ issuer_factory_v1: `0x${string}`;
94
+ fixed_price_minter_v1: `0x${string}`;
95
+ dutch_auction_minter_v1: `0x${string}`;
96
+ mint_ticket_factory_v1: `0x${string}`;
97
+ ticket_redeemer_v1: `0x${string}`;
98
+ ipfs_renderer_v1: `0x${string}`;
99
+ onchfs_renderer_v1: `0x${string}`;
100
+ randomizer_v1: `0x${string}`;
101
+ role_registry_v1: `0x${string}`;
102
+ contract_registry_v1: `0x${string}`;
103
+ gen_art_token_impl_v1: `0x${string}`;
104
+ mint_ticket_impl_v1: `0x${string}`;
105
+ onchfs_file_system: `0x${string}`;
106
+ onchfs_content_store: `0x${string}`;
107
+ seaport: `0x${string}`;
108
+ fxhashTeamSafeAddress: `0x${string}`;
109
+ signerSafe: `0x${string}`;
110
+ moderationSafe: `0x${string}`;
111
+ farcaster_frame_fixed_price_minter_v1: `0x${string}`;
112
+ fx_token: `0x${string}`;
113
+ }
114
+ declare const ethTestnetContracts: IEthContracts;
115
+ /**
116
+ * TODO
117
+ * -----------------------------------------------------------------------------
118
+ * Put the actual addresses.
119
+ */
120
+ //#endregion
121
+ //#region src/contracts/tezos.d.ts
122
+ interface ITezosContracts {
123
+ allowed_mint: string;
124
+ allowed_mint_issuer: string;
125
+ allowed_mint_issuer_v3: string;
126
+ allowed_mint_v3: string;
127
+ articles: string;
128
+ card_proxy: string;
129
+ collaboration_factory: string;
130
+ consumable_database: string;
131
+ cycles: string;
132
+ gentk_v1: string;
133
+ gentk_v1_data: string;
134
+ gentk_v2: string;
135
+ gentk_v3: string;
136
+ issuer_tickets: string;
137
+ issuer_v0: string;
138
+ issuer_v1: string;
139
+ issuer_v2: string;
140
+ issuer_v3: string;
141
+ marketplace_v1: string;
142
+ marketplace_v2: string;
143
+ marketplace_v3: string;
144
+ moderation_articles: string;
145
+ moderation_team: string;
146
+ moderation_token: string;
147
+ moderation_token_v3: string;
148
+ moderation_user: string;
149
+ pricing_dutch_auction: string;
150
+ pricing_dutch_auction_v3: string;
151
+ pricing_fixed: string;
152
+ pricing_fixed_v3: string;
153
+ randomizer: string;
154
+ randomizer_v2: string;
155
+ token_moderation: string;
156
+ treasury: string;
157
+ user_moderation: string;
158
+ user_register: string;
159
+ onchfs_files: string;
160
+ }
161
+ // The Tezos Smart Contracts addresses on testnet
162
+ declare const tezosTestnetContracts: ITezosContracts;
163
+ // The Tezos Smart Contracts on mainnet
164
+ declare const tezosMainnetContracts: ITezosContracts;
165
+ //#endregion
166
+ //#region src/types.d.ts
167
+ interface IFxhashApis {
168
+ website: string;
169
+ docs: string;
170
+ main: string;
171
+ hasura: string;
172
+ hasuraGql: string;
173
+ file: string;
174
+ fileInternal: string;
175
+ walletInternal: string;
176
+ fsEmulator: string;
177
+ extract: string;
178
+ extractInternal: string;
179
+ media: string;
180
+ ethMetadata: string;
181
+ ipfsInternal: string;
182
+ ipfsGateway: string;
183
+ ipfsGatewaySafe: string;
184
+ ipfsGatewayInternal: string;
185
+ onchfsProxy: string;
186
+ opensea: string;
187
+ authority: {
188
+ api: string;
189
+ };
190
+ capture: {
191
+ lambdas: {
192
+ small: string;
193
+ medium: string;
194
+ large: string;
195
+ };
196
+ proxy: {
197
+ ipfs: string;
198
+ onchfs: string;
199
+ };
200
+ };
201
+ events: {
202
+ liveBackend: string;
203
+ };
204
+ indexer: {
205
+ tez: string;
206
+ eth: string;
207
+ base: string;
208
+ };
209
+ }
210
+ /**
211
+ * A mapping of blockchains in their "human-readable" format with their proper
212
+ * blockchain identifier.
213
+ */
214
+ declare const BlockchainIdentifiers: {
215
+ readonly TezosGhostnet: "tezos:NetXnHfVqm9iesp";
216
+ readonly TezosMainnet: "tezos:NetXdQprcVkpaWU";
217
+ readonly EthereumMainnet: "eip155:1";
218
+ readonly EthereumGoerli: "eip155:5";
219
+ readonly EthereumSepolia: "eip155:11155111";
220
+ readonly BaseSepolia: "eip155:84532";
221
+ readonly BaseMainnet: "eip155:8453";
222
+ };
223
+ /**
224
+ * An union of all the blockchains supported by fxhash, defined by their chain
225
+ * identifier. Can be used to facilitate typescript auto-completion with string
226
+ * when enums aren't as good.
227
+ */
228
+ type BlockchainIdentifier = (typeof BlockchainIdentifiers)[keyof typeof BlockchainIdentifiers];
229
+ // the variations supported by the config
230
+ type TBlockchain = "tez" | "eth" | "base";
231
+ type TBlockchainNetwork = "testnet" | "mainnet";
232
+ type TEnv = "dev" | "prd" | "local" | "localDocker";
233
+ type TEnvName = "development" | "production" | "local" | "localDocker";
234
+ interface IFxhashNetworkConfig {
235
+ network: string;
236
+ chainId: BlockchainIdentifier;
237
+ ethFeeReceiver: `0x${string}`;
238
+ wertRelayer: string;
239
+ fxhashFees: {
240
+ primary: number;
241
+ secondary: number;
242
+ };
243
+ royaltyBasisPoint: number;
244
+ splitBasisPoint: number;
245
+ }
246
+ /**
247
+ * Meta info about the application. Can be used by wallets to scope the
248
+ * application making requests for instance.
249
+ */
250
+ interface IAppMetadata {
251
+ /**
252
+ * Application name. Will be displayed by wallets when a request is made
253
+ * (signing a message, sending a transaction)
254
+ */
255
+ name: string;
256
+ /**
257
+ * A short sentence (<25 words) describing the app. Might be used by wallets
258
+ * to display extra info about your app.
259
+ */
260
+ description: string;
261
+ /**
262
+ * **IMPORTANT**: This should match the URL in which the JS context making
263
+ * requests to wallets will be executed. **If doesn't match execution
264
+ * context domain, wallets may display a red warning.
265
+ */
266
+ url: string;
267
+ /**
268
+ * URL to your application icon. Recommended: PNG 256x256
269
+ * May be used by wallet apps in their UI when users interact with your app.
270
+ */
271
+ icon?: string;
272
+ }
273
+ interface IFxhashEnvConfig {
274
+ envName: TEnvName;
275
+ metadata: IAppMetadata;
276
+ gtMinPrice: string;
277
+ walletConnectId: string;
278
+ splitsApiKey: string;
279
+ projectLockTime: number;
280
+ referrerShare: number;
281
+ cloudflareTurnstileSiteKey: string;
282
+ cloudflareTurnstileSiteKeyV2: string;
283
+ syndicateProjectId: string;
284
+ awsS3Bucket: string;
285
+ awsS3Region: string;
286
+ openTelemetryTarget: string;
287
+ algolia: AlgoliaConfig;
288
+ gpu: GPURenderingConfig;
289
+ authJwtPublicKey: string;
290
+ }
291
+ type TBlockchainContacts = { [B in TBlockchain]: {
292
+ tez: ITezosContracts;
293
+ eth: IEthContracts;
294
+ base: IBaseContracts;
295
+ }[B] };
296
+ type TBlockchainApis = { [B in TBlockchain]: {
297
+ tez: ITezosApis;
298
+ eth: IEthApis;
299
+ base: IBaseApis;
300
+ }[B] };
301
+ type TNetworkBlockchainConfig = { [B in TBlockchain]: {
302
+ tez: IFxhashNetworkConfig;
303
+ eth: IFxhashNetworkConfig;
304
+ base: IFxhashNetworkConfig;
305
+ }[B] };
306
+ type IFxhashConfig = {
307
+ networks: { [N in TBlockchainNetwork]: { [B in TBlockchain]: {
308
+ contracts: TBlockchainContacts[B];
309
+ config: TNetworkBlockchainConfig[B];
310
+ apis: TBlockchainApis[B];
311
+ } } };
312
+ envs: { [K in TEnv]: {
313
+ apis: IFxhashApis;
314
+ config: IFxhashEnvConfig;
315
+ } };
316
+ };
317
+ type IFxhashConfigSingleEnv = { [B in TBlockchain]: {
318
+ contracts: TBlockchainContacts[B];
319
+ config: TNetworkBlockchainConfig[B];
320
+ apis: TBlockchainApis[B];
321
+ } } & {
322
+ apis: IFxhashApis;
323
+ config: IFxhashEnvConfig;
324
+ };
325
+ //#endregion
326
+ //#region src/api/fxhash.d.ts
327
+ // list of APIs dev leverages
328
+ declare const fxhashDevApis: IFxhashApis;
329
+ // list of APIs for when fxhash is ran locally
330
+ // The ports must correspond to the ports the services are running on
331
+ // defined in the root docker compose file of the monorepo
332
+
333
+ // list of APIs prod leverages
334
+ declare const fxhashPrdApis: IFxhashApis;
335
+ /**
336
+ * Given some env, returns the associated APIs config.
337
+ */
338
+ //#endregion
339
+ //#region src/config.d.ts
340
+ /**
341
+ * --------------------------------------------------------
342
+ */
343
+ declare const fxhashConfig: IFxhashConfig;
344
+ declare const localConfig: IFxhashConfigSingleEnv;
345
+ declare const devConfig: IFxhashConfigSingleEnv;
346
+ declare const prdConfig: IFxhashConfigSingleEnv;
347
+ declare let config: IFxhashConfigSingleEnv;
348
+ declare function setConfig(userConfig: Partial<IFxhashConfigSingleEnv>): IFxhashConfigSingleEnv;
349
+ //#endregion
350
+ //#region src/helpers.d.ts
351
+ declare function getDockerInternalUrl(url: string): string;
352
+ declare const isProd: boolean;
353
+ declare const isLocal: boolean;
354
+ declare const isDockerLocal: boolean;
355
+ declare function getEnv(): TEnv;
356
+ //#endregion
357
+ //#region src/utils/cid.d.ts
358
+ /**
359
+ * Returns the CID or a resource, whether it's already a CID or an ipfs://<CID> or onchfs://<CID> resource
360
+ * @param resource either a CID or an ipfs://<CID> or onchfs://<CID> string
361
+ */
362
+ declare function cidFromUriOrCid(resource: string): string;
363
+ //#endregion
364
+ //#region src/utils/ipfs.d.ts
365
+ declare enum EGatewayIpfs {
366
+ FXHASH = "FXHASH",
367
+ FXHASH_SAFE = "FXHASH_SAFE",
368
+ IPFSIO = "IPFSIO",
369
+ }
370
+ declare const ipfsRegex: RegExp;
371
+ /**
372
+ * Given a gateway enum, outputs the http url root of the gateway
373
+ */
374
+ declare function ipfsGatewayRoot(gateway: EGatewayIpfs): string;
375
+ /**
376
+ * Returns the CID or a resource, whether it's already a CID or an ipfs://<CID> resource
377
+ * @param resource either a CID or a ipfs://<CID> string
378
+ */
379
+ declare function ipfsCidFromUriOrCid(resource: string): string;
380
+ /**
381
+ * Given a CID or ipfs://<CID>, returns an URL to a gateway pointing to the resource
382
+ * @param resource the resource input, either a CID or ipfs://<CID>
383
+ * @param gateway the gateway URL to use for the resource
384
+ */
385
+ declare function ipfsGatewayUrl(resource: string | null | undefined, gateway?: EGatewayIpfs): string;
386
+ /**
387
+ * given a URI (either ipfs://<CID>, onchfs://<CID> or temp://<CID>),
388
+ * returns the URL to the resource
389
+ */
390
+ declare function proxyUrl(uri: string): string;
391
+ //#endregion
392
+ //#region src/utils/onchfs.d.ts
393
+ declare const onchfsRegex: RegExp;
394
+ /**
395
+ * Returns the CID or a resource, whether it's already a CID or an onchfs://<CID> resource
396
+ * @param resource either a CID or a onchfs://<CID> string
397
+ */
398
+ declare function onchfsCidFromUriOrCid(resource: string): string;
399
+ //#endregion
400
+ //#region src/utils/contracts.d.ts
401
+ declare const tezosContractPrefixesByContractAddress: Record<string, string>;
402
+ declare function getObjktIdFromContract(contract: string, id: string): string;
403
+ //#endregion
404
+ //#region src/errors/metadata.d.ts
405
+ declare class AppMetadataInvalidTypeError extends RichError {
406
+ name: "AppMetadataInvalidTypeError";
407
+ messages: {
408
+ dev: string;
409
+ };
410
+ }
411
+ declare class AppMetadataMissingPropertiesError extends RichError {
412
+ name: "AppMetadataMissingPropertiesError";
413
+ constructor(messages: IRichErrorMessages);
414
+ constructor(properties: string[]);
415
+ }
416
+ declare const AppMetadataErrors: (typeof AppMetadataInvalidTypeError | typeof AppMetadataMissingPropertiesError)[];
417
+ type AppMetadataError = RichErrorUnion<typeof AppMetadataErrors>;
418
+ //#endregion
419
+ //#region src/config/metadata.d.ts
420
+ /**
421
+ * Test whether some value is a valid {@link IAppMetadata} interface. If not,
422
+ * the issue causing it to be invalid is returned as a failure.
423
+ * @param value Any value which should be tested for being valid App Metadata
424
+ * @returns A Result with void success or failure with the issue
425
+ */
426
+ declare function isAppMetadataValid(value: any): Result<void, AppMetadataError>;
427
+ //#endregion
428
+ export { BlockchainIdentifier, BlockchainIdentifiers, EGatewayIpfs, GPURenderingConfig, IAppMetadata, IEthApis, IEthContracts, IFxhashApis, IFxhashConfig, IFxhashConfigSingleEnv, IFxhashEnvConfig, IFxhashNetworkConfig, ITezosApis, ITezosContracts, TBlockchain, TBlockchainNetwork, TEnv, TEnvName, cidFromUriOrCid, config, fxhashConfig as default, fxhashConfig, devConfig, ethTestnetApis, ethTestnetContracts, fxhashDevApis, fxhashPrdApis, getDockerInternalUrl, getEnv, getObjktIdFromContract, ipfsCidFromUriOrCid, ipfsGatewayRoot, ipfsGatewayUrl, ipfsRegex, isAppMetadataValid, isDockerLocal, isLocal, isProd, localConfig, onchfsCidFromUriOrCid, onchfsRegex, prdConfig, proxyUrl, setConfig, tezosContractPrefixesByContractAddress, tezosMainnetApis, tezosMainnetContracts, tezosTestnetApis, tezosTestnetContracts };
429
+ //# sourceMappingURL=index.d.ts.map