@metamask-previews/config-registry-controller 0.0.0-preview-32ed9958c
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/CHANGELOG.md +14 -0
- package/LICENSE +20 -0
- package/README.md +15 -0
- package/dist/ConfigRegistryController.cjs +132 -0
- package/dist/ConfigRegistryController.cjs.map +1 -0
- package/dist/ConfigRegistryController.d.cts +134 -0
- package/dist/ConfigRegistryController.d.cts.map +1 -0
- package/dist/ConfigRegistryController.d.mts +134 -0
- package/dist/ConfigRegistryController.d.mts.map +1 -0
- package/dist/ConfigRegistryController.mjs +128 -0
- package/dist/ConfigRegistryController.mjs.map +1 -0
- package/dist/config-registry-api-service/config-registry-api-service.cjs +123 -0
- package/dist/config-registry-api-service/config-registry-api-service.cjs.map +1 -0
- package/dist/config-registry-api-service/config-registry-api-service.d.cts +56 -0
- package/dist/config-registry-api-service/config-registry-api-service.d.cts.map +1 -0
- package/dist/config-registry-api-service/config-registry-api-service.d.mts +56 -0
- package/dist/config-registry-api-service/config-registry-api-service.d.mts.map +1 -0
- package/dist/config-registry-api-service/config-registry-api-service.mjs +119 -0
- package/dist/config-registry-api-service/config-registry-api-service.mjs.map +1 -0
- package/dist/config-registry-api-service/filters.cjs +30 -0
- package/dist/config-registry-api-service/filters.cjs.map +1 -0
- package/dist/config-registry-api-service/filters.d.cts +15 -0
- package/dist/config-registry-api-service/filters.d.cts.map +1 -0
- package/dist/config-registry-api-service/filters.d.mts +15 -0
- package/dist/config-registry-api-service/filters.d.mts.map +1 -0
- package/dist/config-registry-api-service/filters.mjs +26 -0
- package/dist/config-registry-api-service/filters.mjs.map +1 -0
- package/dist/config-registry-api-service/index.cjs +8 -0
- package/dist/config-registry-api-service/index.cjs.map +1 -0
- package/dist/config-registry-api-service/index.d.cts +6 -0
- package/dist/config-registry-api-service/index.d.cts.map +1 -0
- package/dist/config-registry-api-service/index.d.mts +6 -0
- package/dist/config-registry-api-service/index.d.mts.map +1 -0
- package/dist/config-registry-api-service/index.mjs +3 -0
- package/dist/config-registry-api-service/index.mjs.map +1 -0
- package/dist/config-registry-api-service/types.cjs +69 -0
- package/dist/config-registry-api-service/types.cjs.map +1 -0
- package/dist/config-registry-api-service/types.d.cts +476 -0
- package/dist/config-registry-api-service/types.d.cts.map +1 -0
- package/dist/config-registry-api-service/types.d.mts +476 -0
- package/dist/config-registry-api-service/types.d.mts.map +1 -0
- package/dist/config-registry-api-service/types.mjs +65 -0
- package/dist/config-registry-api-service/types.mjs.map +1 -0
- package/dist/index.cjs +15 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +5 -0
- package/dist/index.mjs.map +1 -0
- package/dist/selectors.cjs +34 -0
- package/dist/selectors.cjs.map +1 -0
- package/dist/selectors.d.cts +314 -0
- package/dist/selectors.d.cts.map +1 -0
- package/dist/selectors.d.mts +314 -0
- package/dist/selectors.d.mts.map +1 -0
- package/dist/selectors.mjs +30 -0
- package/dist/selectors.mjs.map +1 -0
- package/dist/utils/feature-flags.cjs +27 -0
- package/dist/utils/feature-flags.cjs.map +1 -0
- package/dist/utils/feature-flags.d.cts +9 -0
- package/dist/utils/feature-flags.d.cts.map +1 -0
- package/dist/utils/feature-flags.d.mts +9 -0
- package/dist/utils/feature-flags.d.mts.map +1 -0
- package/dist/utils/feature-flags.mjs +23 -0
- package/dist/utils/feature-flags.mjs.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import type { Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Schema for a single chain in the CAIP-2 config registry API response.
|
|
4
|
+
* chainId is in CAIP-2 format (e.g. "eip155:1", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp").
|
|
5
|
+
*/
|
|
6
|
+
export declare const RegistryNetworkConfigSchema: import("@metamask/superstruct").Struct<{
|
|
7
|
+
imageUrl: string;
|
|
8
|
+
name: string;
|
|
9
|
+
chainId: string;
|
|
10
|
+
coingeckoPlatformId: string;
|
|
11
|
+
assets: {
|
|
12
|
+
listUrl: string;
|
|
13
|
+
native: {
|
|
14
|
+
symbol: string;
|
|
15
|
+
assetId: string;
|
|
16
|
+
imageUrl: string;
|
|
17
|
+
name: string;
|
|
18
|
+
decimals: number;
|
|
19
|
+
coingeckoCoinId: string;
|
|
20
|
+
};
|
|
21
|
+
governance?: {
|
|
22
|
+
symbol: string;
|
|
23
|
+
assetId: string;
|
|
24
|
+
imageUrl: string;
|
|
25
|
+
name: string;
|
|
26
|
+
decimals: number;
|
|
27
|
+
coingeckoCoinId: string;
|
|
28
|
+
} | undefined;
|
|
29
|
+
};
|
|
30
|
+
rpcProviders: {
|
|
31
|
+
default: {
|
|
32
|
+
url: string;
|
|
33
|
+
type: string;
|
|
34
|
+
networkClientId: string;
|
|
35
|
+
};
|
|
36
|
+
fallbacks: string[];
|
|
37
|
+
};
|
|
38
|
+
blockExplorerUrls: {
|
|
39
|
+
default: string;
|
|
40
|
+
fallbacks: string[];
|
|
41
|
+
};
|
|
42
|
+
config: {
|
|
43
|
+
isActive: boolean;
|
|
44
|
+
isTestnet: boolean;
|
|
45
|
+
isDefault: boolean;
|
|
46
|
+
isFeatured: boolean;
|
|
47
|
+
isDeprecated: boolean;
|
|
48
|
+
isDeletable: boolean;
|
|
49
|
+
priority: number;
|
|
50
|
+
};
|
|
51
|
+
geckoTerminalPlatformId?: string | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
chainId: import("@metamask/superstruct").Struct<string, null>;
|
|
54
|
+
name: import("@metamask/superstruct").Struct<string, null>;
|
|
55
|
+
imageUrl: import("@metamask/superstruct").Struct<string, null>;
|
|
56
|
+
coingeckoPlatformId: import("@metamask/superstruct").Struct<string, null>;
|
|
57
|
+
geckoTerminalPlatformId: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
58
|
+
assets: import("@metamask/superstruct").Struct<{
|
|
59
|
+
listUrl: string;
|
|
60
|
+
native: {
|
|
61
|
+
symbol: string;
|
|
62
|
+
assetId: string;
|
|
63
|
+
imageUrl: string;
|
|
64
|
+
name: string;
|
|
65
|
+
decimals: number;
|
|
66
|
+
coingeckoCoinId: string;
|
|
67
|
+
};
|
|
68
|
+
governance?: {
|
|
69
|
+
symbol: string;
|
|
70
|
+
assetId: string;
|
|
71
|
+
imageUrl: string;
|
|
72
|
+
name: string;
|
|
73
|
+
decimals: number;
|
|
74
|
+
coingeckoCoinId: string;
|
|
75
|
+
} | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
listUrl: import("@metamask/superstruct").Struct<string, null>;
|
|
78
|
+
native: import("@metamask/superstruct").Struct<{
|
|
79
|
+
symbol: string;
|
|
80
|
+
assetId: string;
|
|
81
|
+
imageUrl: string;
|
|
82
|
+
name: string;
|
|
83
|
+
decimals: number;
|
|
84
|
+
coingeckoCoinId: string;
|
|
85
|
+
}, {
|
|
86
|
+
assetId: import("@metamask/superstruct").Struct<string, null>;
|
|
87
|
+
imageUrl: import("@metamask/superstruct").Struct<string, null>;
|
|
88
|
+
name: import("@metamask/superstruct").Struct<string, null>;
|
|
89
|
+
symbol: import("@metamask/superstruct").Struct<string, null>;
|
|
90
|
+
decimals: import("@metamask/superstruct").Struct<number, null>;
|
|
91
|
+
coingeckoCoinId: import("@metamask/superstruct").Struct<string, null>;
|
|
92
|
+
}>;
|
|
93
|
+
governance: import("@metamask/superstruct").Struct<{
|
|
94
|
+
symbol: string;
|
|
95
|
+
assetId: string;
|
|
96
|
+
imageUrl: string;
|
|
97
|
+
name: string;
|
|
98
|
+
decimals: number;
|
|
99
|
+
coingeckoCoinId: string;
|
|
100
|
+
} | undefined, {
|
|
101
|
+
assetId: import("@metamask/superstruct").Struct<string, null>;
|
|
102
|
+
imageUrl: import("@metamask/superstruct").Struct<string, null>;
|
|
103
|
+
name: import("@metamask/superstruct").Struct<string, null>;
|
|
104
|
+
symbol: import("@metamask/superstruct").Struct<string, null>;
|
|
105
|
+
decimals: import("@metamask/superstruct").Struct<number, null>;
|
|
106
|
+
coingeckoCoinId: import("@metamask/superstruct").Struct<string, null>;
|
|
107
|
+
}>;
|
|
108
|
+
}>;
|
|
109
|
+
rpcProviders: import("@metamask/superstruct").Struct<{
|
|
110
|
+
default: {
|
|
111
|
+
url: string;
|
|
112
|
+
type: string;
|
|
113
|
+
networkClientId: string;
|
|
114
|
+
};
|
|
115
|
+
fallbacks: string[];
|
|
116
|
+
}, {
|
|
117
|
+
default: import("@metamask/superstruct").Struct<{
|
|
118
|
+
url: string;
|
|
119
|
+
type: string;
|
|
120
|
+
networkClientId: string;
|
|
121
|
+
}, {
|
|
122
|
+
url: import("@metamask/superstruct").Struct<string, null>;
|
|
123
|
+
type: import("@metamask/superstruct").Struct<string, null>;
|
|
124
|
+
networkClientId: import("@metamask/superstruct").Struct<string, null>;
|
|
125
|
+
}>;
|
|
126
|
+
fallbacks: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
127
|
+
}>;
|
|
128
|
+
blockExplorerUrls: import("@metamask/superstruct").Struct<{
|
|
129
|
+
default: string;
|
|
130
|
+
fallbacks: string[];
|
|
131
|
+
}, {
|
|
132
|
+
default: import("@metamask/superstruct").Struct<string, null>;
|
|
133
|
+
fallbacks: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
134
|
+
}>;
|
|
135
|
+
config: import("@metamask/superstruct").Struct<{
|
|
136
|
+
isActive: boolean;
|
|
137
|
+
isTestnet: boolean;
|
|
138
|
+
isDefault: boolean;
|
|
139
|
+
isFeatured: boolean;
|
|
140
|
+
isDeprecated: boolean;
|
|
141
|
+
isDeletable: boolean;
|
|
142
|
+
priority: number;
|
|
143
|
+
}, {
|
|
144
|
+
isActive: import("@metamask/superstruct").Struct<boolean, null>;
|
|
145
|
+
isTestnet: import("@metamask/superstruct").Struct<boolean, null>;
|
|
146
|
+
isDefault: import("@metamask/superstruct").Struct<boolean, null>;
|
|
147
|
+
isFeatured: import("@metamask/superstruct").Struct<boolean, null>;
|
|
148
|
+
isDeprecated: import("@metamask/superstruct").Struct<boolean, null>;
|
|
149
|
+
isDeletable: import("@metamask/superstruct").Struct<boolean, null>;
|
|
150
|
+
priority: import("@metamask/superstruct").Struct<number, null>;
|
|
151
|
+
}>;
|
|
152
|
+
}>;
|
|
153
|
+
/**
|
|
154
|
+
* Top-level API response shape. Uses `data.chains` (CAIP-2) and `data.version`.
|
|
155
|
+
*/
|
|
156
|
+
export declare const RegistryConfigApiResponseSchema: import("@metamask/superstruct").Struct<{
|
|
157
|
+
data: {
|
|
158
|
+
version: string;
|
|
159
|
+
timestamp: number;
|
|
160
|
+
chains: {
|
|
161
|
+
imageUrl: string;
|
|
162
|
+
name: string;
|
|
163
|
+
chainId: string;
|
|
164
|
+
coingeckoPlatformId: string;
|
|
165
|
+
assets: {
|
|
166
|
+
listUrl: string;
|
|
167
|
+
native: {
|
|
168
|
+
symbol: string;
|
|
169
|
+
assetId: string;
|
|
170
|
+
imageUrl: string;
|
|
171
|
+
name: string;
|
|
172
|
+
decimals: number;
|
|
173
|
+
coingeckoCoinId: string;
|
|
174
|
+
};
|
|
175
|
+
governance?: {
|
|
176
|
+
symbol: string;
|
|
177
|
+
assetId: string;
|
|
178
|
+
imageUrl: string;
|
|
179
|
+
name: string;
|
|
180
|
+
decimals: number;
|
|
181
|
+
coingeckoCoinId: string;
|
|
182
|
+
} | undefined;
|
|
183
|
+
};
|
|
184
|
+
rpcProviders: {
|
|
185
|
+
default: {
|
|
186
|
+
url: string;
|
|
187
|
+
type: string;
|
|
188
|
+
networkClientId: string;
|
|
189
|
+
};
|
|
190
|
+
fallbacks: string[];
|
|
191
|
+
};
|
|
192
|
+
blockExplorerUrls: {
|
|
193
|
+
default: string;
|
|
194
|
+
fallbacks: string[];
|
|
195
|
+
};
|
|
196
|
+
config: {
|
|
197
|
+
isActive: boolean;
|
|
198
|
+
isTestnet: boolean;
|
|
199
|
+
isDefault: boolean;
|
|
200
|
+
isFeatured: boolean;
|
|
201
|
+
isDeprecated: boolean;
|
|
202
|
+
isDeletable: boolean;
|
|
203
|
+
priority: number;
|
|
204
|
+
};
|
|
205
|
+
geckoTerminalPlatformId?: string | undefined;
|
|
206
|
+
}[];
|
|
207
|
+
};
|
|
208
|
+
}, {
|
|
209
|
+
data: import("@metamask/superstruct").Struct<{
|
|
210
|
+
version: string;
|
|
211
|
+
timestamp: number;
|
|
212
|
+
chains: {
|
|
213
|
+
imageUrl: string;
|
|
214
|
+
name: string;
|
|
215
|
+
chainId: string;
|
|
216
|
+
coingeckoPlatformId: string;
|
|
217
|
+
assets: {
|
|
218
|
+
listUrl: string;
|
|
219
|
+
native: {
|
|
220
|
+
symbol: string;
|
|
221
|
+
assetId: string;
|
|
222
|
+
imageUrl: string;
|
|
223
|
+
name: string;
|
|
224
|
+
decimals: number;
|
|
225
|
+
coingeckoCoinId: string;
|
|
226
|
+
};
|
|
227
|
+
governance?: {
|
|
228
|
+
symbol: string;
|
|
229
|
+
assetId: string;
|
|
230
|
+
imageUrl: string;
|
|
231
|
+
name: string;
|
|
232
|
+
decimals: number;
|
|
233
|
+
coingeckoCoinId: string;
|
|
234
|
+
} | undefined;
|
|
235
|
+
};
|
|
236
|
+
rpcProviders: {
|
|
237
|
+
default: {
|
|
238
|
+
url: string;
|
|
239
|
+
type: string;
|
|
240
|
+
networkClientId: string;
|
|
241
|
+
};
|
|
242
|
+
fallbacks: string[];
|
|
243
|
+
};
|
|
244
|
+
blockExplorerUrls: {
|
|
245
|
+
default: string;
|
|
246
|
+
fallbacks: string[];
|
|
247
|
+
};
|
|
248
|
+
config: {
|
|
249
|
+
isActive: boolean;
|
|
250
|
+
isTestnet: boolean;
|
|
251
|
+
isDefault: boolean;
|
|
252
|
+
isFeatured: boolean;
|
|
253
|
+
isDeprecated: boolean;
|
|
254
|
+
isDeletable: boolean;
|
|
255
|
+
priority: number;
|
|
256
|
+
};
|
|
257
|
+
geckoTerminalPlatformId?: string | undefined;
|
|
258
|
+
}[];
|
|
259
|
+
}, {
|
|
260
|
+
version: import("@metamask/superstruct").Struct<string, null>;
|
|
261
|
+
timestamp: import("@metamask/superstruct").Struct<number, null>;
|
|
262
|
+
chains: import("@metamask/superstruct").Struct<{
|
|
263
|
+
imageUrl: string;
|
|
264
|
+
name: string;
|
|
265
|
+
chainId: string;
|
|
266
|
+
coingeckoPlatformId: string;
|
|
267
|
+
assets: {
|
|
268
|
+
listUrl: string;
|
|
269
|
+
native: {
|
|
270
|
+
symbol: string;
|
|
271
|
+
assetId: string;
|
|
272
|
+
imageUrl: string;
|
|
273
|
+
name: string;
|
|
274
|
+
decimals: number;
|
|
275
|
+
coingeckoCoinId: string;
|
|
276
|
+
};
|
|
277
|
+
governance?: {
|
|
278
|
+
symbol: string;
|
|
279
|
+
assetId: string;
|
|
280
|
+
imageUrl: string;
|
|
281
|
+
name: string;
|
|
282
|
+
decimals: number;
|
|
283
|
+
coingeckoCoinId: string;
|
|
284
|
+
} | undefined;
|
|
285
|
+
};
|
|
286
|
+
rpcProviders: {
|
|
287
|
+
default: {
|
|
288
|
+
url: string;
|
|
289
|
+
type: string;
|
|
290
|
+
networkClientId: string;
|
|
291
|
+
};
|
|
292
|
+
fallbacks: string[];
|
|
293
|
+
};
|
|
294
|
+
blockExplorerUrls: {
|
|
295
|
+
default: string;
|
|
296
|
+
fallbacks: string[];
|
|
297
|
+
};
|
|
298
|
+
config: {
|
|
299
|
+
isActive: boolean;
|
|
300
|
+
isTestnet: boolean;
|
|
301
|
+
isDefault: boolean;
|
|
302
|
+
isFeatured: boolean;
|
|
303
|
+
isDeprecated: boolean;
|
|
304
|
+
isDeletable: boolean;
|
|
305
|
+
priority: number;
|
|
306
|
+
};
|
|
307
|
+
geckoTerminalPlatformId?: string | undefined;
|
|
308
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
309
|
+
imageUrl: string;
|
|
310
|
+
name: string;
|
|
311
|
+
chainId: string;
|
|
312
|
+
coingeckoPlatformId: string;
|
|
313
|
+
assets: {
|
|
314
|
+
listUrl: string;
|
|
315
|
+
native: {
|
|
316
|
+
symbol: string;
|
|
317
|
+
assetId: string;
|
|
318
|
+
imageUrl: string;
|
|
319
|
+
name: string;
|
|
320
|
+
decimals: number;
|
|
321
|
+
coingeckoCoinId: string;
|
|
322
|
+
};
|
|
323
|
+
governance?: {
|
|
324
|
+
symbol: string;
|
|
325
|
+
assetId: string;
|
|
326
|
+
imageUrl: string;
|
|
327
|
+
name: string;
|
|
328
|
+
decimals: number;
|
|
329
|
+
coingeckoCoinId: string;
|
|
330
|
+
} | undefined;
|
|
331
|
+
};
|
|
332
|
+
rpcProviders: {
|
|
333
|
+
default: {
|
|
334
|
+
url: string;
|
|
335
|
+
type: string;
|
|
336
|
+
networkClientId: string;
|
|
337
|
+
};
|
|
338
|
+
fallbacks: string[];
|
|
339
|
+
};
|
|
340
|
+
blockExplorerUrls: {
|
|
341
|
+
default: string;
|
|
342
|
+
fallbacks: string[];
|
|
343
|
+
};
|
|
344
|
+
config: {
|
|
345
|
+
isActive: boolean;
|
|
346
|
+
isTestnet: boolean;
|
|
347
|
+
isDefault: boolean;
|
|
348
|
+
isFeatured: boolean;
|
|
349
|
+
isDeprecated: boolean;
|
|
350
|
+
isDeletable: boolean;
|
|
351
|
+
priority: number;
|
|
352
|
+
};
|
|
353
|
+
geckoTerminalPlatformId?: string | undefined;
|
|
354
|
+
}, {
|
|
355
|
+
chainId: import("@metamask/superstruct").Struct<string, null>;
|
|
356
|
+
name: import("@metamask/superstruct").Struct<string, null>;
|
|
357
|
+
imageUrl: import("@metamask/superstruct").Struct<string, null>;
|
|
358
|
+
coingeckoPlatformId: import("@metamask/superstruct").Struct<string, null>;
|
|
359
|
+
geckoTerminalPlatformId: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
360
|
+
assets: import("@metamask/superstruct").Struct<{
|
|
361
|
+
listUrl: string;
|
|
362
|
+
native: {
|
|
363
|
+
symbol: string;
|
|
364
|
+
assetId: string;
|
|
365
|
+
imageUrl: string;
|
|
366
|
+
name: string;
|
|
367
|
+
decimals: number;
|
|
368
|
+
coingeckoCoinId: string;
|
|
369
|
+
};
|
|
370
|
+
governance?: {
|
|
371
|
+
symbol: string;
|
|
372
|
+
assetId: string;
|
|
373
|
+
imageUrl: string;
|
|
374
|
+
name: string;
|
|
375
|
+
decimals: number;
|
|
376
|
+
coingeckoCoinId: string;
|
|
377
|
+
} | undefined;
|
|
378
|
+
}, {
|
|
379
|
+
listUrl: import("@metamask/superstruct").Struct<string, null>;
|
|
380
|
+
native: import("@metamask/superstruct").Struct<{
|
|
381
|
+
symbol: string;
|
|
382
|
+
assetId: string;
|
|
383
|
+
imageUrl: string;
|
|
384
|
+
name: string;
|
|
385
|
+
decimals: number;
|
|
386
|
+
coingeckoCoinId: string;
|
|
387
|
+
}, {
|
|
388
|
+
assetId: import("@metamask/superstruct").Struct<string, null>;
|
|
389
|
+
imageUrl: import("@metamask/superstruct").Struct<string, null>;
|
|
390
|
+
name: import("@metamask/superstruct").Struct<string, null>;
|
|
391
|
+
symbol: import("@metamask/superstruct").Struct<string, null>;
|
|
392
|
+
decimals: import("@metamask/superstruct").Struct<number, null>;
|
|
393
|
+
coingeckoCoinId: import("@metamask/superstruct").Struct<string, null>;
|
|
394
|
+
}>;
|
|
395
|
+
governance: import("@metamask/superstruct").Struct<{
|
|
396
|
+
symbol: string;
|
|
397
|
+
assetId: string;
|
|
398
|
+
imageUrl: string;
|
|
399
|
+
name: string;
|
|
400
|
+
decimals: number;
|
|
401
|
+
coingeckoCoinId: string;
|
|
402
|
+
} | undefined, {
|
|
403
|
+
assetId: import("@metamask/superstruct").Struct<string, null>;
|
|
404
|
+
imageUrl: import("@metamask/superstruct").Struct<string, null>;
|
|
405
|
+
name: import("@metamask/superstruct").Struct<string, null>;
|
|
406
|
+
symbol: import("@metamask/superstruct").Struct<string, null>;
|
|
407
|
+
decimals: import("@metamask/superstruct").Struct<number, null>;
|
|
408
|
+
coingeckoCoinId: import("@metamask/superstruct").Struct<string, null>;
|
|
409
|
+
}>;
|
|
410
|
+
}>;
|
|
411
|
+
rpcProviders: import("@metamask/superstruct").Struct<{
|
|
412
|
+
default: {
|
|
413
|
+
url: string;
|
|
414
|
+
type: string;
|
|
415
|
+
networkClientId: string;
|
|
416
|
+
};
|
|
417
|
+
fallbacks: string[];
|
|
418
|
+
}, {
|
|
419
|
+
default: import("@metamask/superstruct").Struct<{
|
|
420
|
+
url: string;
|
|
421
|
+
type: string;
|
|
422
|
+
networkClientId: string;
|
|
423
|
+
}, {
|
|
424
|
+
url: import("@metamask/superstruct").Struct<string, null>;
|
|
425
|
+
type: import("@metamask/superstruct").Struct<string, null>;
|
|
426
|
+
networkClientId: import("@metamask/superstruct").Struct<string, null>;
|
|
427
|
+
}>;
|
|
428
|
+
fallbacks: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
429
|
+
}>;
|
|
430
|
+
blockExplorerUrls: import("@metamask/superstruct").Struct<{
|
|
431
|
+
default: string;
|
|
432
|
+
fallbacks: string[];
|
|
433
|
+
}, {
|
|
434
|
+
default: import("@metamask/superstruct").Struct<string, null>;
|
|
435
|
+
fallbacks: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
436
|
+
}>;
|
|
437
|
+
config: import("@metamask/superstruct").Struct<{
|
|
438
|
+
isActive: boolean;
|
|
439
|
+
isTestnet: boolean;
|
|
440
|
+
isDefault: boolean;
|
|
441
|
+
isFeatured: boolean;
|
|
442
|
+
isDeprecated: boolean;
|
|
443
|
+
isDeletable: boolean;
|
|
444
|
+
priority: number;
|
|
445
|
+
}, {
|
|
446
|
+
isActive: import("@metamask/superstruct").Struct<boolean, null>;
|
|
447
|
+
isTestnet: import("@metamask/superstruct").Struct<boolean, null>;
|
|
448
|
+
isDefault: import("@metamask/superstruct").Struct<boolean, null>;
|
|
449
|
+
isFeatured: import("@metamask/superstruct").Struct<boolean, null>;
|
|
450
|
+
isDeprecated: import("@metamask/superstruct").Struct<boolean, null>;
|
|
451
|
+
isDeletable: import("@metamask/superstruct").Struct<boolean, null>;
|
|
452
|
+
priority: import("@metamask/superstruct").Struct<number, null>;
|
|
453
|
+
}>;
|
|
454
|
+
}>>;
|
|
455
|
+
}>;
|
|
456
|
+
}>;
|
|
457
|
+
export type RegistryNetworkConfig = Infer<typeof RegistryNetworkConfigSchema>;
|
|
458
|
+
export type RegistryConfigApiResponse = Infer<typeof RegistryConfigApiResponseSchema>;
|
|
459
|
+
export declare function validateRegistryConfigApiResponse(data: unknown): asserts data is RegistryConfigApiResponse;
|
|
460
|
+
export type FetchConfigOptions = {
|
|
461
|
+
etag?: string;
|
|
462
|
+
};
|
|
463
|
+
export type FetchConfigResult = {
|
|
464
|
+
modified: false;
|
|
465
|
+
etag?: string;
|
|
466
|
+
/**
|
|
467
|
+
* Cached data from the service when available (e.g. after a previous
|
|
468
|
+
* successful fetch). Omitted when the service has no cache yet.
|
|
469
|
+
*/
|
|
470
|
+
data?: RegistryConfigApiResponse;
|
|
471
|
+
} | {
|
|
472
|
+
modified: true;
|
|
473
|
+
data: RegistryConfigApiResponse;
|
|
474
|
+
etag?: string;
|
|
475
|
+
};
|
|
476
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/config-registry-api-service/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAoDnD;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUtC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM1C,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAE9E,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAC3C,OAAO,+BAA+B,CACvC,CAAC;AAEF,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,IAAI,IAAI,yBAAyB,CAE3C;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IACE,QAAQ,EAAE,KAAK,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,yBAAyB,CAAC;CAClC,GACD;IACE,QAAQ,EAAE,IAAI,CAAC;IACf,IAAI,EAAE,yBAAyB,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { array, assert, boolean, number, optional, string, type } from "@metamask/superstruct";
|
|
2
|
+
const AssetSchema = type({
|
|
3
|
+
assetId: string(),
|
|
4
|
+
imageUrl: string(),
|
|
5
|
+
name: string(),
|
|
6
|
+
symbol: string(),
|
|
7
|
+
decimals: number(),
|
|
8
|
+
coingeckoCoinId: string(),
|
|
9
|
+
});
|
|
10
|
+
const AssetsSchema = type({
|
|
11
|
+
listUrl: string(),
|
|
12
|
+
native: AssetSchema,
|
|
13
|
+
governance: optional(AssetSchema),
|
|
14
|
+
});
|
|
15
|
+
const RpcProviderSchema = type({
|
|
16
|
+
url: string(),
|
|
17
|
+
type: string(),
|
|
18
|
+
networkClientId: string(),
|
|
19
|
+
});
|
|
20
|
+
const RpcProvidersSchema = type({
|
|
21
|
+
default: RpcProviderSchema,
|
|
22
|
+
fallbacks: array(string()),
|
|
23
|
+
});
|
|
24
|
+
const BlockExplorerUrlsSchema = type({
|
|
25
|
+
default: string(),
|
|
26
|
+
fallbacks: array(string()),
|
|
27
|
+
});
|
|
28
|
+
const ChainConfigSchema = type({
|
|
29
|
+
isActive: boolean(),
|
|
30
|
+
isTestnet: boolean(),
|
|
31
|
+
isDefault: boolean(),
|
|
32
|
+
isFeatured: boolean(),
|
|
33
|
+
isDeprecated: boolean(),
|
|
34
|
+
isDeletable: boolean(),
|
|
35
|
+
priority: number(),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Schema for a single chain in the CAIP-2 config registry API response.
|
|
39
|
+
* chainId is in CAIP-2 format (e.g. "eip155:1", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp").
|
|
40
|
+
*/
|
|
41
|
+
export const RegistryNetworkConfigSchema = type({
|
|
42
|
+
chainId: string(),
|
|
43
|
+
name: string(),
|
|
44
|
+
imageUrl: string(),
|
|
45
|
+
coingeckoPlatformId: string(),
|
|
46
|
+
geckoTerminalPlatformId: optional(string()),
|
|
47
|
+
assets: AssetsSchema,
|
|
48
|
+
rpcProviders: RpcProvidersSchema,
|
|
49
|
+
blockExplorerUrls: BlockExplorerUrlsSchema,
|
|
50
|
+
config: ChainConfigSchema,
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Top-level API response shape. Uses `data.chains` (CAIP-2) and `data.version`.
|
|
54
|
+
*/
|
|
55
|
+
export const RegistryConfigApiResponseSchema = type({
|
|
56
|
+
data: type({
|
|
57
|
+
version: string(),
|
|
58
|
+
timestamp: number(),
|
|
59
|
+
chains: array(RegistryNetworkConfigSchema),
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
export function validateRegistryConfigApiResponse(data) {
|
|
63
|
+
assert(data, RegistryConfigApiResponseSchema);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/config-registry-api-service/types.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACL,8BAA8B;AAE/B,MAAM,WAAW,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE;IACjB,QAAQ,EAAE,MAAM,EAAE;IAClB,IAAI,EAAE,MAAM,EAAE;IACd,MAAM,EAAE,MAAM,EAAE;IAChB,QAAQ,EAAE,MAAM,EAAE;IAClB,eAAe,EAAE,MAAM,EAAE;CAC1B,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE;IACjB,MAAM,EAAE,WAAW;IACnB,UAAU,EAAE,QAAQ,CAAC,WAAW,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,IAAI,CAAC;IAC7B,GAAG,EAAE,MAAM,EAAE;IACb,IAAI,EAAE,MAAM,EAAE;IACd,eAAe,EAAE,MAAM,EAAE;CAC1B,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,iBAAiB;IAC1B,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,IAAI,CAAC;IACnC,OAAO,EAAE,MAAM,EAAE;IACjB,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,OAAO,EAAE;IACnB,SAAS,EAAE,OAAO,EAAE;IACpB,SAAS,EAAE,OAAO,EAAE;IACpB,UAAU,EAAE,OAAO,EAAE;IACrB,YAAY,EAAE,OAAO,EAAE;IACvB,WAAW,EAAE,OAAO,EAAE;IACtB,QAAQ,EAAE,MAAM,EAAE;CACnB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC;IAC9C,OAAO,EAAE,MAAM,EAAE;IACjB,IAAI,EAAE,MAAM,EAAE;IACd,QAAQ,EAAE,MAAM,EAAE;IAClB,mBAAmB,EAAE,MAAM,EAAE;IAC7B,uBAAuB,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC3C,MAAM,EAAE,YAAY;IACpB,YAAY,EAAE,kBAAkB;IAChC,iBAAiB,EAAE,uBAAuB;IAC1C,MAAM,EAAE,iBAAiB;CAC1B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,CAAC;IAClD,IAAI,EAAE,IAAI,CAAC;QACT,OAAO,EAAE,MAAM,EAAE;QACjB,SAAS,EAAE,MAAM,EAAE;QACnB,MAAM,EAAE,KAAK,CAAC,2BAA2B,CAAC;KAC3C,CAAC;CACH,CAAC,CAAC;AAQH,MAAM,UAAU,iCAAiC,CAC/C,IAAa;IAEb,MAAM,CAAC,IAAI,EAAE,+BAA+B,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n array,\n assert,\n boolean,\n number,\n optional,\n string,\n type,\n} from '@metamask/superstruct';\n\nconst AssetSchema = type({\n assetId: string(),\n imageUrl: string(),\n name: string(),\n symbol: string(),\n decimals: number(),\n coingeckoCoinId: string(),\n});\n\nconst AssetsSchema = type({\n listUrl: string(),\n native: AssetSchema,\n governance: optional(AssetSchema),\n});\n\nconst RpcProviderSchema = type({\n url: string(),\n type: string(),\n networkClientId: string(),\n});\n\nconst RpcProvidersSchema = type({\n default: RpcProviderSchema,\n fallbacks: array(string()),\n});\n\nconst BlockExplorerUrlsSchema = type({\n default: string(),\n fallbacks: array(string()),\n});\n\nconst ChainConfigSchema = type({\n isActive: boolean(),\n isTestnet: boolean(),\n isDefault: boolean(),\n isFeatured: boolean(),\n isDeprecated: boolean(),\n isDeletable: boolean(),\n priority: number(),\n});\n\n/**\n * Schema for a single chain in the CAIP-2 config registry API response.\n * chainId is in CAIP-2 format (e.g. \"eip155:1\", \"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp\").\n */\nexport const RegistryNetworkConfigSchema = type({\n chainId: string(),\n name: string(),\n imageUrl: string(),\n coingeckoPlatformId: string(),\n geckoTerminalPlatformId: optional(string()),\n assets: AssetsSchema,\n rpcProviders: RpcProvidersSchema,\n blockExplorerUrls: BlockExplorerUrlsSchema,\n config: ChainConfigSchema,\n});\n\n/**\n * Top-level API response shape. Uses `data.chains` (CAIP-2) and `data.version`.\n */\nexport const RegistryConfigApiResponseSchema = type({\n data: type({\n version: string(),\n timestamp: number(),\n chains: array(RegistryNetworkConfigSchema),\n }),\n});\n\nexport type RegistryNetworkConfig = Infer<typeof RegistryNetworkConfigSchema>;\n\nexport type RegistryConfigApiResponse = Infer<\n typeof RegistryConfigApiResponseSchema\n>;\n\nexport function validateRegistryConfigApiResponse(\n data: unknown,\n): asserts data is RegistryConfigApiResponse {\n assert(data, RegistryConfigApiResponseSchema);\n}\n\nexport type FetchConfigOptions = {\n etag?: string;\n};\n\nexport type FetchConfigResult =\n | {\n modified: false;\n etag?: string;\n /**\n * Cached data from the service when available (e.g. after a previous\n * successful fetch). Omitted when the service has no cache yet.\n */\n data?: RegistryConfigApiResponse;\n }\n | {\n modified: true;\n data: RegistryConfigApiResponse;\n etag?: string;\n };\n"]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isConfigRegistryApiEnabled = exports.filterNetworks = exports.ConfigRegistryApiService = exports.selectNetworks = exports.selectFeaturedNetworks = exports.DEFAULT_POLLING_INTERVAL = exports.ConfigRegistryController = void 0;
|
|
4
|
+
var ConfigRegistryController_1 = require("./ConfigRegistryController.cjs");
|
|
5
|
+
Object.defineProperty(exports, "ConfigRegistryController", { enumerable: true, get: function () { return ConfigRegistryController_1.ConfigRegistryController; } });
|
|
6
|
+
Object.defineProperty(exports, "DEFAULT_POLLING_INTERVAL", { enumerable: true, get: function () { return ConfigRegistryController_1.DEFAULT_POLLING_INTERVAL; } });
|
|
7
|
+
var selectors_1 = require("./selectors.cjs");
|
|
8
|
+
Object.defineProperty(exports, "selectFeaturedNetworks", { enumerable: true, get: function () { return selectors_1.selectFeaturedNetworks; } });
|
|
9
|
+
Object.defineProperty(exports, "selectNetworks", { enumerable: true, get: function () { return selectors_1.selectNetworks; } });
|
|
10
|
+
var config_registry_api_service_1 = require("./config-registry-api-service/index.cjs");
|
|
11
|
+
Object.defineProperty(exports, "ConfigRegistryApiService", { enumerable: true, get: function () { return config_registry_api_service_1.ConfigRegistryApiService; } });
|
|
12
|
+
Object.defineProperty(exports, "filterNetworks", { enumerable: true, get: function () { return config_registry_api_service_1.filterNetworks; } });
|
|
13
|
+
var feature_flags_1 = require("./utils/feature-flags.cjs");
|
|
14
|
+
Object.defineProperty(exports, "isConfigRegistryApiEnabled", { enumerable: true, get: function () { return feature_flags_1.isConfigRegistryApiEnabled; } });
|
|
15
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAYA,2EAGoC;AAFlC,oIAAA,wBAAwB,OAAA;AACxB,oIAAA,wBAAwB,OAAA;AAE1B,6CAAqE;AAA5D,mHAAA,sBAAsB,OAAA;AAAE,2GAAA,cAAc,OAAA;AAS/C,uFAGuC;AAFrC,uIAAA,wBAAwB,OAAA;AACxB,6HAAA,cAAc,OAAA;AAEhB,2DAAmE;AAA1D,2HAAA,0BAA0B,OAAA","sourcesContent":["export type {\n ConfigRegistryControllerState,\n ConfigRegistryControllerOptions,\n ConfigRegistryControllerActions,\n ConfigRegistryControllerGetStateAction,\n ConfigRegistryControllerStartPollingAction,\n ConfigRegistryControllerStopPollingAction,\n ConfigRegistryControllerEvents,\n ConfigRegistryControllerStateChangeEvent,\n ConfigRegistryControllerMessenger,\n ConfigRegistryMessenger,\n} from './ConfigRegistryController';\nexport {\n ConfigRegistryController,\n DEFAULT_POLLING_INTERVAL,\n} from './ConfigRegistryController';\nexport { selectFeaturedNetworks, selectNetworks } from './selectors';\nexport type {\n FetchConfigOptions,\n FetchConfigResult,\n RegistryNetworkConfig,\n RegistryConfigApiResponse,\n ConfigRegistryApiServiceOptions,\n NetworkFilterOptions,\n} from './config-registry-api-service';\nexport {\n ConfigRegistryApiService,\n filterNetworks,\n} from './config-registry-api-service';\nexport { isConfigRegistryApiEnabled } from './utils/feature-flags';\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { ConfigRegistryControllerState, ConfigRegistryControllerOptions, ConfigRegistryControllerActions, ConfigRegistryControllerGetStateAction, ConfigRegistryControllerStartPollingAction, ConfigRegistryControllerStopPollingAction, ConfigRegistryControllerEvents, ConfigRegistryControllerStateChangeEvent, ConfigRegistryControllerMessenger, ConfigRegistryMessenger, } from "./ConfigRegistryController.cjs";
|
|
2
|
+
export { ConfigRegistryController, DEFAULT_POLLING_INTERVAL, } from "./ConfigRegistryController.cjs";
|
|
3
|
+
export { selectFeaturedNetworks, selectNetworks } from "./selectors.cjs";
|
|
4
|
+
export type { FetchConfigOptions, FetchConfigResult, RegistryNetworkConfig, RegistryConfigApiResponse, ConfigRegistryApiServiceOptions, NetworkFilterOptions, } from "./config-registry-api-service/index.cjs";
|
|
5
|
+
export { ConfigRegistryApiService, filterNetworks, } from "./config-registry-api-service/index.cjs";
|
|
6
|
+
export { isConfigRegistryApiEnabled } from "./utils/feature-flags.cjs";
|
|
7
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,EAC/B,sCAAsC,EACtC,0CAA0C,EAC1C,yCAAyC,EACzC,8BAA8B,EAC9B,wCAAwC,EACxC,iCAAiC,EACjC,uBAAuB,GACxB,uCAAmC;AACpC,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,uCAAmC;AACpC,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,wBAAoB;AACrE,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,+BAA+B,EAC/B,oBAAoB,GACrB,gDAAsC;AACvC,OAAO,EACL,wBAAwB,EACxB,cAAc,GACf,gDAAsC;AACvC,OAAO,EAAE,0BAA0B,EAAE,kCAA8B"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { ConfigRegistryControllerState, ConfigRegistryControllerOptions, ConfigRegistryControllerActions, ConfigRegistryControllerGetStateAction, ConfigRegistryControllerStartPollingAction, ConfigRegistryControllerStopPollingAction, ConfigRegistryControllerEvents, ConfigRegistryControllerStateChangeEvent, ConfigRegistryControllerMessenger, ConfigRegistryMessenger, } from "./ConfigRegistryController.mjs";
|
|
2
|
+
export { ConfigRegistryController, DEFAULT_POLLING_INTERVAL, } from "./ConfigRegistryController.mjs";
|
|
3
|
+
export { selectFeaturedNetworks, selectNetworks } from "./selectors.mjs";
|
|
4
|
+
export type { FetchConfigOptions, FetchConfigResult, RegistryNetworkConfig, RegistryConfigApiResponse, ConfigRegistryApiServiceOptions, NetworkFilterOptions, } from "./config-registry-api-service/index.mjs";
|
|
5
|
+
export { ConfigRegistryApiService, filterNetworks, } from "./config-registry-api-service/index.mjs";
|
|
6
|
+
export { isConfigRegistryApiEnabled } from "./utils/feature-flags.mjs";
|
|
7
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,EAC/B,sCAAsC,EACtC,0CAA0C,EAC1C,yCAAyC,EACzC,8BAA8B,EAC9B,wCAAwC,EACxC,iCAAiC,EACjC,uBAAuB,GACxB,uCAAmC;AACpC,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,uCAAmC;AACpC,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,wBAAoB;AACrE,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,+BAA+B,EAC/B,oBAAoB,GACrB,gDAAsC;AACvC,OAAO,EACL,wBAAwB,EACxB,cAAc,GACf,gDAAsC;AACvC,OAAO,EAAE,0BAA0B,EAAE,kCAA8B"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ConfigRegistryController, DEFAULT_POLLING_INTERVAL } from "./ConfigRegistryController.mjs";
|
|
2
|
+
export { selectFeaturedNetworks, selectNetworks } from "./selectors.mjs";
|
|
3
|
+
export { ConfigRegistryApiService, filterNetworks } from "./config-registry-api-service/index.mjs";
|
|
4
|
+
export { isConfigRegistryApiEnabled } from "./utils/feature-flags.mjs";
|
|
5
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACzB,uCAAmC;AACpC,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,wBAAoB;AASrE,OAAO,EACL,wBAAwB,EACxB,cAAc,EACf,gDAAsC;AACvC,OAAO,EAAE,0BAA0B,EAAE,kCAA8B","sourcesContent":["export type {\n ConfigRegistryControllerState,\n ConfigRegistryControllerOptions,\n ConfigRegistryControllerActions,\n ConfigRegistryControllerGetStateAction,\n ConfigRegistryControllerStartPollingAction,\n ConfigRegistryControllerStopPollingAction,\n ConfigRegistryControllerEvents,\n ConfigRegistryControllerStateChangeEvent,\n ConfigRegistryControllerMessenger,\n ConfigRegistryMessenger,\n} from './ConfigRegistryController';\nexport {\n ConfigRegistryController,\n DEFAULT_POLLING_INTERVAL,\n} from './ConfigRegistryController';\nexport { selectFeaturedNetworks, selectNetworks } from './selectors';\nexport type {\n FetchConfigOptions,\n FetchConfigResult,\n RegistryNetworkConfig,\n RegistryConfigApiResponse,\n ConfigRegistryApiServiceOptions,\n NetworkFilterOptions,\n} from './config-registry-api-service';\nexport {\n ConfigRegistryApiService,\n filterNetworks,\n} from './config-registry-api-service';\nexport { isConfigRegistryApiEnabled } from './utils/feature-flags';\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectFeaturedNetworks = exports.selectNetworks = void 0;
|
|
4
|
+
const reselect_1 = require("reselect");
|
|
5
|
+
const config_registry_api_service_1 = require("./config-registry-api-service/index.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Base selector to get all networks from the controller state.
|
|
8
|
+
*
|
|
9
|
+
* @param state - The ConfigRegistryController state
|
|
10
|
+
* @returns All network configurations keyed by chain ID
|
|
11
|
+
*/
|
|
12
|
+
const selectNetworks = (state) => state.configs.networks;
|
|
13
|
+
exports.selectNetworks = selectNetworks;
|
|
14
|
+
/**
|
|
15
|
+
* Selector to get featured, active, non-testnet networks.
|
|
16
|
+
* Use this for the default network list (e.g. main network picker).
|
|
17
|
+
*
|
|
18
|
+
* @param state - The ConfigRegistryController state
|
|
19
|
+
* @returns Filtered network configurations keyed by chain ID
|
|
20
|
+
*/
|
|
21
|
+
exports.selectFeaturedNetworks = (0, reselect_1.createSelector)(exports.selectNetworks, (networks) => {
|
|
22
|
+
const networkArray = Object.values(networks);
|
|
23
|
+
const filtered = (0, config_registry_api_service_1.filterNetworks)(networkArray, {
|
|
24
|
+
isFeatured: true,
|
|
25
|
+
isActive: true,
|
|
26
|
+
isTestnet: false,
|
|
27
|
+
});
|
|
28
|
+
const result = {};
|
|
29
|
+
filtered.forEach((config) => {
|
|
30
|
+
result[config.chainId] = config;
|
|
31
|
+
});
|
|
32
|
+
return result;
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=selectors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.cjs","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAE1C,yFAA+D;AAI/D;;;;;GAKG;AACI,MAAM,cAAc,GAAG,CAC5B,KAAoC,EACG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;AAFtD,QAAA,cAAc,kBAEwC;AAEnE;;;;;;GAMG;AACU,QAAA,sBAAsB,GAAG,IAAA,yBAAc,EAClD,sBAAc,EACd,CAAC,QAAQ,EAAyC,EAAE;IAClD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,IAAA,4CAAc,EAAC,YAAY,EAAE;QAC5C,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC;IACH,MAAM,MAAM,GAA0C,EAAE,CAAC;IACzD,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAC1B,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CACF,CAAC","sourcesContent":["import { createSelector } from 'reselect';\n\nimport { filterNetworks } from './config-registry-api-service';\nimport type { RegistryNetworkConfig } from './config-registry-api-service';\nimport type { ConfigRegistryControllerState } from './ConfigRegistryController';\n\n/**\n * Base selector to get all networks from the controller state.\n *\n * @param state - The ConfigRegistryController state\n * @returns All network configurations keyed by chain ID\n */\nexport const selectNetworks = (\n state: ConfigRegistryControllerState,\n): Record<string, RegistryNetworkConfig> => state.configs.networks;\n\n/**\n * Selector to get featured, active, non-testnet networks.\n * Use this for the default network list (e.g. main network picker).\n *\n * @param state - The ConfigRegistryController state\n * @returns Filtered network configurations keyed by chain ID\n */\nexport const selectFeaturedNetworks = createSelector(\n selectNetworks,\n (networks): Record<string, RegistryNetworkConfig> => {\n const networkArray = Object.values(networks);\n const filtered = filterNetworks(networkArray, {\n isFeatured: true,\n isActive: true,\n isTestnet: false,\n });\n const result: Record<string, RegistryNetworkConfig> = {};\n filtered.forEach((config) => {\n result[config.chainId] = config;\n });\n return result;\n },\n);\n"]}
|