@gearbox-protocol/sdk 8.14.3 → 8.15.0

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.
@@ -52,7 +52,7 @@ class GearboxSDK {
52
52
  #marketRegister;
53
53
  #priceFeeds;
54
54
  logger;
55
- gasLimit = 550000000n;
55
+ gasLimit;
56
56
  /**
57
57
  * Interest rate models can be reused across chain (and SDK operates on chain level)
58
58
  * TODO: use whatever interface is necessary for InterestRateModels
@@ -85,7 +85,8 @@ class GearboxSDK {
85
85
  ignoreUpdateablePrices,
86
86
  ignoreMarkets,
87
87
  marketConfigurators: mcs,
88
- strictContractTypes
88
+ strictContractTypes,
89
+ gasLimit
89
90
  } = options;
90
91
  let { networkType, addressProvider, chainId } = options;
91
92
  const attachClient = (0, import_viem.createPublicClient)({
@@ -110,7 +111,8 @@ class GearboxSDK {
110
111
  provider,
111
112
  logger,
112
113
  plugins,
113
- strictContractTypes
114
+ strictContractTypes,
115
+ gasLimit
114
116
  }).#attach({
115
117
  addressProvider,
116
118
  blockNumber,
@@ -122,7 +124,7 @@ class GearboxSDK {
122
124
  });
123
125
  }
124
126
  static hydrate(options, state) {
125
- const { logger, plugins, strictContractTypes, ...rest } = options;
127
+ const { logger, plugins, strictContractTypes, gasLimit, ...rest } = options;
126
128
  const provider = new import_chain.Provider({
127
129
  ...rest,
128
130
  chainId: state.chainId,
@@ -132,7 +134,8 @@ class GearboxSDK {
132
134
  provider,
133
135
  plugins,
134
136
  logger,
135
- strictContractTypes
137
+ strictContractTypes,
138
+ gasLimit
136
139
  }).#hydrate(rest, state);
137
140
  }
138
141
  constructor(options) {
@@ -143,6 +146,9 @@ class GearboxSDK {
143
146
  for (const plugin of Object.values(this.plugins)) {
144
147
  plugin.sdk = this;
145
148
  }
149
+ if (options.gasLimit !== null) {
150
+ this.gasLimit = options.gasLimit || 550000000n;
151
+ }
146
152
  }
147
153
  async #attach(opts) {
148
154
  const {
@@ -264,11 +264,10 @@ const chains = {
264
264
  Hemi: (0, import_viem.defineChain)({
265
265
  ...import_chains.hemi,
266
266
  network: "Hemi",
267
- defaultMarketConfigurators: {},
268
- testMarketConfigurators: {
267
+ defaultMarketConfigurators: {
269
268
  "0xc9961b8a0c763779690577f2c76962c086af2fe3": "Invariant Group"
270
269
  },
271
- isPublic: false,
270
+ isPublic: true,
272
271
  wellKnownToken: {
273
272
  address: "0xad11a8BEb98bbf61dbb1aa0F6d6F2ECD87b35afA",
274
273
  symbol: "USDC.e"
@@ -65,7 +65,12 @@ const SDKOptions = import_v4.z.object({
65
65
  /**
66
66
  * Options related to pyth price feeds
67
67
  */
68
- pyth: import_updates.PythOptions.optional()
68
+ pyth: import_updates.PythOptions.optional(),
69
+ /**
70
+ * Explicit gas limit for read eth_calls
71
+ * Null to disable explicitly setting gas limit, undefined to use default sdk value
72
+ */
73
+ gasLimit: import_v4.z.bigint().nonnegative().nullable().optional()
69
74
  });
70
75
  // Annotate the CommonJS export names for ESM import in node:
71
76
  0 && (module.exports = {
@@ -50,7 +50,7 @@ class GearboxSDK {
50
50
  #marketRegister;
51
51
  #priceFeeds;
52
52
  logger;
53
- gasLimit = 550000000n;
53
+ gasLimit;
54
54
  /**
55
55
  * Interest rate models can be reused across chain (and SDK operates on chain level)
56
56
  * TODO: use whatever interface is necessary for InterestRateModels
@@ -83,7 +83,8 @@ class GearboxSDK {
83
83
  ignoreUpdateablePrices,
84
84
  ignoreMarkets,
85
85
  marketConfigurators: mcs,
86
- strictContractTypes
86
+ strictContractTypes,
87
+ gasLimit
87
88
  } = options;
88
89
  let { networkType, addressProvider, chainId } = options;
89
90
  const attachClient = createPublicClient({
@@ -108,7 +109,8 @@ class GearboxSDK {
108
109
  provider,
109
110
  logger,
110
111
  plugins,
111
- strictContractTypes
112
+ strictContractTypes,
113
+ gasLimit
112
114
  }).#attach({
113
115
  addressProvider,
114
116
  blockNumber,
@@ -120,7 +122,7 @@ class GearboxSDK {
120
122
  });
121
123
  }
122
124
  static hydrate(options, state) {
123
- const { logger, plugins, strictContractTypes, ...rest } = options;
125
+ const { logger, plugins, strictContractTypes, gasLimit, ...rest } = options;
124
126
  const provider = new Provider({
125
127
  ...rest,
126
128
  chainId: state.chainId,
@@ -130,7 +132,8 @@ class GearboxSDK {
130
132
  provider,
131
133
  plugins,
132
134
  logger,
133
- strictContractTypes
135
+ strictContractTypes,
136
+ gasLimit
134
137
  }).#hydrate(rest, state);
135
138
  }
136
139
  constructor(options) {
@@ -141,6 +144,9 @@ class GearboxSDK {
141
144
  for (const plugin of Object.values(this.plugins)) {
142
145
  plugin.sdk = this;
143
146
  }
147
+ if (options.gasLimit !== null) {
148
+ this.gasLimit = options.gasLimit || 550000000n;
149
+ }
144
150
  }
145
151
  async #attach(opts) {
146
152
  const {
@@ -250,11 +250,10 @@ const chains = {
250
250
  Hemi: defineChain({
251
251
  ...hemi,
252
252
  network: "Hemi",
253
- defaultMarketConfigurators: {},
254
- testMarketConfigurators: {
253
+ defaultMarketConfigurators: {
255
254
  "0xc9961b8a0c763779690577f2c76962c086af2fe3": "Invariant Group"
256
255
  },
257
- isPublic: false,
256
+ isPublic: true,
258
257
  wellKnownToken: {
259
258
  address: "0xad11a8BEb98bbf61dbb1aa0F6d6F2ECD87b35afA",
260
259
  symbol: "USDC.e"
@@ -45,7 +45,12 @@ const SDKOptions = z.object({
45
45
  /**
46
46
  * Options related to pyth price feeds
47
47
  */
48
- pyth: PythOptions.optional()
48
+ pyth: PythOptions.optional(),
49
+ /**
50
+ * Explicit gas limit for read eth_calls
51
+ * Null to disable explicitly setting gas limit, undefined to use default sdk value
52
+ */
53
+ gasLimit: z.bigint().nonnegative().nullable().optional()
49
54
  });
50
55
  export {
51
56
  SDKOptions
@@ -31,7 +31,7 @@ export declare class GearboxSDK<const Plugins extends PluginsMap = {}> {
31
31
  #private;
32
32
  readonly plugins: Plugins;
33
33
  readonly logger?: ILogger;
34
- gasLimit: bigint | undefined;
34
+ readonly gasLimit: bigint | undefined;
35
35
  /**
36
36
  * Interest rate models can be reused across chain (and SDK operates on chain level)
37
37
  * TODO: use whatever interface is necessary for InterestRateModels
@@ -23,6 +23,7 @@ export declare const SDKOptions: z.ZodObject<{
23
23
  cacheTTL: z.ZodOptional<z.ZodNumber>;
24
24
  ignoreMissingFeeds: z.ZodOptional<z.ZodBoolean>;
25
25
  }, z.core.$strip>>;
26
+ gasLimit: z.ZodOptional<z.ZodNullable<z.ZodBigInt>>;
26
27
  }, z.core.$strip>;
27
28
  export type SDKOptions<Plugins extends PluginsMap> = Omit<z.infer<typeof SDKOptions>, "logger" | "plugins"> & {
28
29
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "8.14.3",
3
+ "version": "8.15.0",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",