@gearbox-protocol/sdk 12.3.10 → 12.3.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/cjs/dev/RevolverTransport.js +4 -4
- package/dist/cjs/dev/providers.js +6 -2
- package/dist/cjs/dev/transports.js +3 -3
- package/dist/cjs/sdk/GearboxSDK.js +1 -1
- package/dist/esm/dev/RevolverTransport.js +5 -5
- package/dist/esm/dev/providers.js +4 -1
- package/dist/esm/dev/transports.js +2 -2
- package/dist/esm/sdk/GearboxSDK.js +1 -1
- package/dist/types/dev/RevolverTransport.d.ts +2 -2
- package/dist/types/dev/providers.d.ts +8 -1
- package/dist/types/dev/transports.d.ts +1 -1
- package/dist/types/sdk/GearboxSDK.d.ts +1 -1
- package/package.json +6 -6
|
@@ -45,7 +45,7 @@ const providerConfigSchema = import_v4.z.object({
|
|
|
45
45
|
/**
|
|
46
46
|
* HTTP transport options to use for this provider
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
httpTransportOptions: import_transports.httpTransportOptionsSchema.optional()
|
|
49
49
|
});
|
|
50
50
|
const SelectionStrategy = import_v4.z.enum(["simple", "ordered"]);
|
|
51
51
|
const revolverTransportConfigSchema = import_v4.z.object({
|
|
@@ -66,7 +66,7 @@ const revolverTransportConfigSchema = import_v4.z.object({
|
|
|
66
66
|
/**
|
|
67
67
|
* Default HTTP options to use for all providers, can be overridden by provider config
|
|
68
68
|
*/
|
|
69
|
-
defaultHTTPOptions: import_transports.
|
|
69
|
+
defaultHTTPOptions: import_transports.httpTransportOptionsSchema.optional(),
|
|
70
70
|
/**
|
|
71
71
|
* Default cooldown, in milliseconds, to wait before try this transport again
|
|
72
72
|
*/
|
|
@@ -107,11 +107,11 @@ class RevolverTransport {
|
|
|
107
107
|
shouldRetry: config.shouldRetry ?? defaultShouldRetry
|
|
108
108
|
};
|
|
109
109
|
const transports = config.providers.map(
|
|
110
|
-
({ url, name, cooldown,
|
|
110
|
+
({ url, name, cooldown, httpTransportOptions }) => ({
|
|
111
111
|
name,
|
|
112
112
|
transport: (0, import_viem.http)(url, {
|
|
113
113
|
...config.defaultHTTPOptions,
|
|
114
|
-
...
|
|
114
|
+
...httpTransportOptions,
|
|
115
115
|
key: name,
|
|
116
116
|
name,
|
|
117
117
|
onFetchRequest: this.#config.onRequest ? (...args) => this.#config.onRequest?.(name, ...args) : void 0,
|
|
@@ -24,9 +24,11 @@ __export(providers_exports, {
|
|
|
24
24
|
getDrpcUrl: () => getDrpcUrl,
|
|
25
25
|
getErpcKey: () => getErpcKey,
|
|
26
26
|
getRpcProviderUrl: () => getRpcProviderUrl,
|
|
27
|
-
getThirdWebUrl: () => getThirdWebUrl
|
|
27
|
+
getThirdWebUrl: () => getThirdWebUrl,
|
|
28
|
+
rpcProvidersSchema: () => rpcProvidersSchema
|
|
28
29
|
});
|
|
29
30
|
module.exports = __toCommonJS(providers_exports);
|
|
31
|
+
var import_v4 = require("zod/v4");
|
|
30
32
|
var import_sdk = require("../sdk/index.js");
|
|
31
33
|
const SUPPORTED_RPC_PROVIDERS = [
|
|
32
34
|
"alchemy",
|
|
@@ -34,6 +36,7 @@ const SUPPORTED_RPC_PROVIDERS = [
|
|
|
34
36
|
"thirdweb",
|
|
35
37
|
"ankr"
|
|
36
38
|
];
|
|
39
|
+
const rpcProvidersSchema = import_v4.z.enum(SUPPORTED_RPC_PROVIDERS);
|
|
37
40
|
function getRpcProviderUrl(provider, network, apiKey, protocol = "http") {
|
|
38
41
|
switch (provider) {
|
|
39
42
|
case "alchemy":
|
|
@@ -158,5 +161,6 @@ function getErpcKey(network, projectId, urlBase) {
|
|
|
158
161
|
getDrpcUrl,
|
|
159
162
|
getErpcKey,
|
|
160
163
|
getRpcProviderUrl,
|
|
161
|
-
getThirdWebUrl
|
|
164
|
+
getThirdWebUrl,
|
|
165
|
+
rpcProvidersSchema
|
|
162
166
|
});
|
|
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var transports_exports = {};
|
|
20
20
|
__export(transports_exports, {
|
|
21
|
-
|
|
21
|
+
httpTransportOptionsSchema: () => httpTransportOptionsSchema
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(transports_exports);
|
|
24
24
|
var import_v4 = require("zod/v4");
|
|
25
|
-
const
|
|
25
|
+
const httpTransportOptionsSchema = import_v4.z.object({
|
|
26
26
|
/**
|
|
27
27
|
* Whether to enable Batch JSON-RPC.
|
|
28
28
|
* @link https://www.jsonrpc.org/specification#batch
|
|
@@ -67,5 +67,5 @@ const httpTransportConfigSchema = import_v4.z.object({
|
|
|
67
67
|
});
|
|
68
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
69
69
|
0 && (module.exports = {
|
|
70
|
-
|
|
70
|
+
httpTransportOptionsSchema
|
|
71
71
|
});
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "viem";
|
|
13
13
|
import { z } from "zod/v4";
|
|
14
14
|
import { NetworkType } from "../sdk/index.js";
|
|
15
|
-
import {
|
|
15
|
+
import { httpTransportOptionsSchema } from "./transports.js";
|
|
16
16
|
const providerConfigSchema = z.object({
|
|
17
17
|
/**
|
|
18
18
|
* Provider name for display purposes
|
|
@@ -29,7 +29,7 @@ const providerConfigSchema = z.object({
|
|
|
29
29
|
/**
|
|
30
30
|
* HTTP transport options to use for this provider
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
httpTransportOptions: httpTransportOptionsSchema.optional()
|
|
33
33
|
});
|
|
34
34
|
const SelectionStrategy = z.enum(["simple", "ordered"]);
|
|
35
35
|
const revolverTransportConfigSchema = z.object({
|
|
@@ -50,7 +50,7 @@ const revolverTransportConfigSchema = z.object({
|
|
|
50
50
|
/**
|
|
51
51
|
* Default HTTP options to use for all providers, can be overridden by provider config
|
|
52
52
|
*/
|
|
53
|
-
defaultHTTPOptions:
|
|
53
|
+
defaultHTTPOptions: httpTransportOptionsSchema.optional(),
|
|
54
54
|
/**
|
|
55
55
|
* Default cooldown, in milliseconds, to wait before try this transport again
|
|
56
56
|
*/
|
|
@@ -91,11 +91,11 @@ class RevolverTransport {
|
|
|
91
91
|
shouldRetry: config.shouldRetry ?? defaultShouldRetry
|
|
92
92
|
};
|
|
93
93
|
const transports = config.providers.map(
|
|
94
|
-
({ url, name, cooldown,
|
|
94
|
+
({ url, name, cooldown, httpTransportOptions }) => ({
|
|
95
95
|
name,
|
|
96
96
|
transport: http(url, {
|
|
97
97
|
...config.defaultHTTPOptions,
|
|
98
|
-
...
|
|
98
|
+
...httpTransportOptions,
|
|
99
99
|
key: name,
|
|
100
100
|
name,
|
|
101
101
|
onFetchRequest: this.#config.onRequest ? (...args) => this.#config.onRequest?.(name, ...args) : void 0,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
1
2
|
import { chains, getChain } from "../sdk/index.js";
|
|
2
3
|
const SUPPORTED_RPC_PROVIDERS = [
|
|
3
4
|
"alchemy",
|
|
@@ -5,6 +6,7 @@ const SUPPORTED_RPC_PROVIDERS = [
|
|
|
5
6
|
"thirdweb",
|
|
6
7
|
"ankr"
|
|
7
8
|
];
|
|
9
|
+
const rpcProvidersSchema = z.enum(SUPPORTED_RPC_PROVIDERS);
|
|
8
10
|
function getRpcProviderUrl(provider, network, apiKey, protocol = "http") {
|
|
9
11
|
switch (provider) {
|
|
10
12
|
case "alchemy":
|
|
@@ -128,5 +130,6 @@ export {
|
|
|
128
130
|
getDrpcUrl,
|
|
129
131
|
getErpcKey,
|
|
130
132
|
getRpcProviderUrl,
|
|
131
|
-
getThirdWebUrl
|
|
133
|
+
getThirdWebUrl,
|
|
134
|
+
rpcProvidersSchema
|
|
132
135
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
const
|
|
2
|
+
const httpTransportOptionsSchema = z.object({
|
|
3
3
|
/**
|
|
4
4
|
* Whether to enable Batch JSON-RPC.
|
|
5
5
|
* @link https://www.jsonrpc.org/specification#batch
|
|
@@ -43,5 +43,5 @@ const httpTransportConfigSchema = z.object({
|
|
|
43
43
|
timeout: z.number().optional()
|
|
44
44
|
});
|
|
45
45
|
export {
|
|
46
|
-
|
|
46
|
+
httpTransportOptionsSchema
|
|
47
47
|
};
|
|
@@ -6,7 +6,7 @@ export declare const providerConfigSchema: z.ZodObject<{
|
|
|
6
6
|
name: z.ZodString;
|
|
7
7
|
url: z.ZodURL;
|
|
8
8
|
cooldown: z.ZodOptional<z.ZodNumber>;
|
|
9
|
-
|
|
9
|
+
httpTransportOptions: z.ZodOptional<z.ZodObject<{
|
|
10
10
|
batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
11
11
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
12
12
|
wait: z.ZodOptional<z.ZodNumber>;
|
|
@@ -62,7 +62,7 @@ export declare const revolverTransportConfigSchema: z.ZodObject<{
|
|
|
62
62
|
name: z.ZodString;
|
|
63
63
|
url: z.ZodURL;
|
|
64
64
|
cooldown: z.ZodOptional<z.ZodNumber>;
|
|
65
|
-
|
|
65
|
+
httpTransportOptions: z.ZodOptional<z.ZodObject<{
|
|
66
66
|
batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
67
67
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
68
68
|
wait: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
1
2
|
import { type NetworkType } from "../sdk/index.js";
|
|
2
3
|
export declare const SUPPORTED_RPC_PROVIDERS: readonly ["alchemy", "drpc", "thirdweb", "ankr"];
|
|
3
|
-
export
|
|
4
|
+
export declare const rpcProvidersSchema: z.ZodEnum<{
|
|
5
|
+
alchemy: "alchemy";
|
|
6
|
+
drpc: "drpc";
|
|
7
|
+
thirdweb: "thirdweb";
|
|
8
|
+
ankr: "ankr";
|
|
9
|
+
}>;
|
|
10
|
+
export type RpcProvider = z.infer<typeof rpcProvidersSchema>;
|
|
4
11
|
export declare function getRpcProviderUrl(provider: RpcProvider, network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
|
|
5
12
|
export declare function getAlchemyUrl(network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
|
|
6
13
|
export declare function getDrpcUrl(network: NetworkType, apiKey: string, protocol?: "http" | "ws"): string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const httpTransportOptionsSchema: z.ZodObject<{
|
|
3
3
|
batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
4
4
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
5
5
|
wait: z.ZodOptional<z.ZodNumber>;
|
|
@@ -40,7 +40,7 @@ export type ClientOptions = {
|
|
|
40
40
|
* Retry count for RPC
|
|
41
41
|
*/
|
|
42
42
|
retryCount?: number;
|
|
43
|
-
|
|
43
|
+
httpTransportOptions?: HttpRpcClientOptions | undefined;
|
|
44
44
|
} | {
|
|
45
45
|
/**
|
|
46
46
|
* Alternatively, can pass viem transport
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.12",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/cjs/sdk/index.js",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
"date-fns": "^4.1.0",
|
|
63
63
|
"decimal.js-light": "^2.5.1",
|
|
64
64
|
"viem": ">=2.23.15 <3.0.0",
|
|
65
|
-
"zod": "^4.
|
|
65
|
+
"zod": "^4.3.5"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@biomejs/biome": "^2.3.
|
|
69
|
-
"@commitlint/cli": "^20.
|
|
70
|
-
"@commitlint/config-conventional": "^20.
|
|
71
|
-
"@gearbox-protocol/biome-config": "^1.0.
|
|
68
|
+
"@biomejs/biome": "^2.3.11",
|
|
69
|
+
"@commitlint/cli": "^20.3.0",
|
|
70
|
+
"@commitlint/config-conventional": "^20.3.0",
|
|
71
|
+
"@gearbox-protocol/biome-config": "^1.0.17",
|
|
72
72
|
"@types/cross-spawn": "^6.0.6",
|
|
73
73
|
"axios": "^1.13.2",
|
|
74
74
|
"cross-spawn": "^7.0.6",
|