@gearbox-protocol/sdk 12.3.9 → 12.3.11
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/transports.js +3 -3
- package/dist/cjs/permissionless/bindings/treasury-splitter.js +8 -1
- package/dist/cjs/sdk/GearboxSDK.js +1 -1
- package/dist/esm/dev/RevolverTransport.js +5 -5
- package/dist/esm/dev/transports.js +2 -2
- package/dist/esm/permissionless/bindings/treasury-splitter.js +9 -2
- package/dist/esm/sdk/GearboxSDK.js +1 -1
- package/dist/types/dev/RevolverTransport.d.ts +2 -2
- 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,
|
|
@@ -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
|
});
|
|
@@ -99,7 +99,14 @@ class TreasurySplitterContract extends import_sdk.BaseContract {
|
|
|
99
99
|
});
|
|
100
100
|
return {
|
|
101
101
|
functionName: decoded.functionName,
|
|
102
|
-
...
|
|
102
|
+
...this.parseFunctionParams(decoded)
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
case "setDefaultSplit": {
|
|
106
|
+
const [receivers, proportions] = args;
|
|
107
|
+
return {
|
|
108
|
+
receivers: (0, import_sdk.json_stringify)(receivers),
|
|
109
|
+
proportions: (0, import_sdk.json_stringify)(proportions.map((proportion) => `${proportion / 100}% [${proportion}]`))
|
|
103
110
|
};
|
|
104
111
|
}
|
|
105
112
|
default:
|
|
@@ -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,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
|
};
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
decodeFunctionData
|
|
3
3
|
} from "viem";
|
|
4
4
|
import { ITreasurySplitterAbi } from "../../abi/310/iTreasurySplitter.js";
|
|
5
|
-
import { BaseContract } from "../../sdk/index.js";
|
|
5
|
+
import { BaseContract, json_stringify } from "../../sdk/index.js";
|
|
6
6
|
const abi = ITreasurySplitterAbi;
|
|
7
7
|
class TreasurySplitterContract extends BaseContract {
|
|
8
8
|
constructor(addr, client) {
|
|
@@ -78,7 +78,14 @@ class TreasurySplitterContract extends BaseContract {
|
|
|
78
78
|
});
|
|
79
79
|
return {
|
|
80
80
|
functionName: decoded.functionName,
|
|
81
|
-
...
|
|
81
|
+
...this.parseFunctionParams(decoded)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
case "setDefaultSplit": {
|
|
85
|
+
const [receivers, proportions] = args;
|
|
86
|
+
return {
|
|
87
|
+
receivers: json_stringify(receivers),
|
|
88
|
+
proportions: json_stringify(proportions.map((proportion) => `${proportion / 100}% [${proportion}]`))
|
|
82
89
|
};
|
|
83
90
|
}
|
|
84
91
|
default:
|
|
@@ -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,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.11",
|
|
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",
|