@gearbox-protocol/cli-utils 6.3.2 → 6.3.4
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/getProviders.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ILogger } from "@gearbox-protocol/sdk";
|
|
1
2
|
import type { ProviderConfig } from "@gearbox-protocol/sdk/dev";
|
|
2
3
|
import type { ProvidersSchema } from "./providers-schema.js";
|
|
3
|
-
export declare function getProviders(config: ProvidersSchema): ProviderConfig[];
|
|
4
|
+
export declare function getProviders(config: ProvidersSchema, logger?: ILogger): ProviderConfig[];
|
package/dist/getProviders.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import { CensoredURL } from "./CensoredURL.js";
|
|
1
2
|
import { getAlchemyUrl, getAnkrUrl, getDrpcUrl, getErpcKey, getThirdWebUrl, } from "./providers.js";
|
|
2
|
-
export function getProviders(config) {
|
|
3
|
-
const { network, enabledProviders
|
|
3
|
+
export function getProviders(config, logger) {
|
|
4
|
+
const { network, enabledProviders = [
|
|
5
|
+
"erpc",
|
|
6
|
+
"custom",
|
|
7
|
+
"drpc",
|
|
8
|
+
"alchemy",
|
|
9
|
+
"ankr",
|
|
10
|
+
"thirdweb",
|
|
11
|
+
], alchemyKeys = [], ankrKeys = [], drpcKeys = [], thirdwebKeys = [], jsonRpcProviders = [], erpcProjectId, erpcUrl, } = config;
|
|
4
12
|
const result = [];
|
|
5
13
|
for (const p of enabledProviders) {
|
|
6
14
|
switch (p) {
|
|
@@ -68,6 +76,15 @@ export function getProviders(config) {
|
|
|
68
76
|
break;
|
|
69
77
|
}
|
|
70
78
|
}
|
|
79
|
+
if (logger) {
|
|
80
|
+
const providers = result
|
|
81
|
+
.filter(p => !!p.url)
|
|
82
|
+
.map(p => ({
|
|
83
|
+
name: p.name,
|
|
84
|
+
url: new CensoredURL(p.url),
|
|
85
|
+
}));
|
|
86
|
+
logger.debug({ providers, network }, "gathered providers");
|
|
87
|
+
}
|
|
71
88
|
return result
|
|
72
89
|
.map(p => ({
|
|
73
90
|
...p,
|
|
@@ -30,14 +30,14 @@ export declare const ProvidersSchema: z.ZodObject<{
|
|
|
30
30
|
Somnia: "Somnia";
|
|
31
31
|
}>;
|
|
32
32
|
jsonRpcProviders: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodURL, z.ZodTransform<CensoredURL, string>>>>, z.ZodTransform<CensoredURL[] | undefined, CensoredURL[]>>>;
|
|
33
|
-
enabledProviders: z.
|
|
33
|
+
enabledProviders: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodEnum<{
|
|
34
34
|
custom: "custom";
|
|
35
35
|
alchemy: "alchemy";
|
|
36
36
|
drpc: "drpc";
|
|
37
37
|
ankr: "ankr";
|
|
38
38
|
thirdweb: "thirdweb";
|
|
39
39
|
erpc: "erpc";
|
|
40
|
-
}
|
|
40
|
+
}>>>>;
|
|
41
41
|
alchemyKeys: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<CensoredString<string>, string>>>>, z.ZodTransform<CensoredString<string>[] | undefined, CensoredString<string>[]>>>;
|
|
42
42
|
drpcKeys: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<CensoredString<string>, string>>>>, z.ZodTransform<CensoredString<string>[] | undefined, CensoredString<string>[]>>>;
|
|
43
43
|
ankrKeys: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<CensoredString<string>, string>>>>, z.ZodTransform<CensoredString<string>[] | undefined, CensoredString<string>[]>>>;
|
package/dist/providers-schema.js
CHANGED
|
@@ -37,7 +37,6 @@ export const ProvidersSchema = z.object({
|
|
|
37
37
|
enabledProviders: stringArrayLike()
|
|
38
38
|
.pipe(z.array(RpcProvider))
|
|
39
39
|
.optional()
|
|
40
|
-
.default(["erpc", "custom", "drpc", "alchemy", "ankr", "thirdweb"])
|
|
41
40
|
.register(zommandRegistry, {
|
|
42
41
|
flags: "--enabled-providers <providers...>",
|
|
43
42
|
description: "Keyed RPC providers to use, comma separated, order matters. Possible values: custom (for full json rpc urls)/alchemy/drpc/ankr/thirdweb",
|