@gearbox-protocol/sdk 11.2.0 → 11.2.1

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.
@@ -30,7 +30,7 @@ function chunkedLogsTransport({
30
30
  }) {
31
31
  return (opts) => {
32
32
  const baseTransport = transport(opts);
33
- return (0, import_viem.custom)({
33
+ const customTransport = (0, import_viem.custom)({
34
34
  async request({ method, params }) {
35
35
  if (method === "eth_getLogs") {
36
36
  const [logsParams] = params;
@@ -108,6 +108,10 @@ function chunkedLogsTransport({
108
108
  return baseTransport.request({ method, params });
109
109
  }
110
110
  })(opts);
111
+ return {
112
+ ...customTransport,
113
+ value: baseTransport.value
114
+ };
111
115
  };
112
116
  }
113
117
  // Annotate the CommonJS export names for ESM import in node:
@@ -59,7 +59,8 @@ function getCallsTouchedPriceFeeds(parsedCalls) {
59
59
  }
60
60
  async function getCallsTouchedUpdatablePriceFeeds({
61
61
  parsedCalls,
62
- client
62
+ client,
63
+ gasLimit
63
64
  }) {
64
65
  const addressProvider = new import_bindings.AddressProviderContract(
65
66
  import_addresses.Addresses.ADDRESS_PROVIDER,
@@ -70,8 +71,9 @@ async function getCallsTouchedUpdatablePriceFeeds({
70
71
  310n
71
72
  );
72
73
  const sdk = await import_sdk.GearboxSDK.attach({
73
- rpcURLs: [client.transport.url],
74
- marketConfigurators: []
74
+ client,
75
+ marketConfigurators: [],
76
+ gasLimit
75
77
  });
76
78
  const touchedFeeds = parsedCalls.flatMap(
77
79
  (call) => getCallTouchedPriceFeeds(call)
@@ -40,15 +40,17 @@ function getUpdateCalldata(tx) {
40
40
  async function getPriceUpdateTx({
41
41
  client,
42
42
  priceFeeds,
43
- useMulticall3 = false
43
+ useMulticall3 = false,
44
+ gasLimit
44
45
  }) {
45
46
  const pfStore = new import_bindings.PriceFeedStoreContract(
46
47
  import_addresses.Addresses.PRICE_FEED_STORE,
47
48
  client
48
49
  );
49
50
  const sdk = await import_sdk.GearboxSDK.attach({
50
- rpcURLs: [client.transport.url],
51
- marketConfigurators: []
51
+ client,
52
+ marketConfigurators: [],
53
+ gasLimit
52
54
  });
53
55
  const updateTxs = await sdk.priceFeeds.generateExternalPriceFeedsUpdateTxs(priceFeeds);
54
56
  if (useMulticall3) {
@@ -96,10 +96,15 @@ async function getPricesChunk({
96
96
  async function getPrices({
97
97
  client,
98
98
  priceFeeds,
99
- chunkSize = 10
99
+ chunkSize = 10,
100
+ gasLimit
100
101
  }) {
102
+ if (!client.chain) {
103
+ throw new Error("Chain not defined");
104
+ }
101
105
  const sdk = await import_sdk.GearboxSDK.attach({
102
- rpcURLs: [client.transport.url],
106
+ client,
107
+ gasLimit,
103
108
  marketConfigurators: [],
104
109
  redstone: {
105
110
  ignoreMissingFeeds: true
@@ -11,7 +11,7 @@ function chunkedLogsTransport({
11
11
  }) {
12
12
  return (opts) => {
13
13
  const baseTransport = transport(opts);
14
- return custom({
14
+ const customTransport = custom({
15
15
  async request({ method, params }) {
16
16
  if (method === "eth_getLogs") {
17
17
  const [logsParams] = params;
@@ -89,6 +89,10 @@ function chunkedLogsTransport({
89
89
  return baseTransport.request({ method, params });
90
90
  }
91
91
  })(opts);
92
+ return {
93
+ ...customTransport,
94
+ value: baseTransport.value
95
+ };
92
96
  };
93
97
  }
94
98
  export {
@@ -34,7 +34,8 @@ function getCallsTouchedPriceFeeds(parsedCalls) {
34
34
  }
35
35
  async function getCallsTouchedUpdatablePriceFeeds({
36
36
  parsedCalls,
37
- client
37
+ client,
38
+ gasLimit
38
39
  }) {
39
40
  const addressProvider = new AddressProviderContract(
40
41
  Addresses.ADDRESS_PROVIDER,
@@ -45,8 +46,9 @@ async function getCallsTouchedUpdatablePriceFeeds({
45
46
  310n
46
47
  );
47
48
  const sdk = await GearboxSDK.attach({
48
- rpcURLs: [client.transport.url],
49
- marketConfigurators: []
49
+ client,
50
+ marketConfigurators: [],
51
+ gasLimit
50
52
  });
51
53
  const touchedFeeds = parsedCalls.flatMap(
52
54
  (call) => getCallTouchedPriceFeeds(call)
@@ -24,15 +24,17 @@ function getUpdateCalldata(tx) {
24
24
  async function getPriceUpdateTx({
25
25
  client,
26
26
  priceFeeds,
27
- useMulticall3 = false
27
+ useMulticall3 = false,
28
+ gasLimit
28
29
  }) {
29
30
  const pfStore = new PriceFeedStoreContract(
30
31
  Addresses.PRICE_FEED_STORE,
31
32
  client
32
33
  );
33
34
  const sdk = await GearboxSDK.attach({
34
- rpcURLs: [client.transport.url],
35
- marketConfigurators: []
35
+ client,
36
+ marketConfigurators: [],
37
+ gasLimit
36
38
  });
37
39
  const updateTxs = await sdk.priceFeeds.generateExternalPriceFeedsUpdateTxs(priceFeeds);
38
40
  if (useMulticall3) {
@@ -1,4 +1,6 @@
1
- import { multicall3Abi } from "viem";
1
+ import {
2
+ multicall3Abi
3
+ } from "viem";
2
4
  import { GearboxSDK } from "../../../sdk/index.js";
3
5
  import { simulateMulticall } from "../../../sdk/utils/viem/index.js";
4
6
  const latestRoundDataAbi = [
@@ -73,10 +75,15 @@ async function getPricesChunk({
73
75
  async function getPrices({
74
76
  client,
75
77
  priceFeeds,
76
- chunkSize = 10
78
+ chunkSize = 10,
79
+ gasLimit
77
80
  }) {
81
+ if (!client.chain) {
82
+ throw new Error("Chain not defined");
83
+ }
78
84
  const sdk = await GearboxSDK.attach({
79
- rpcURLs: [client.transport.url],
85
+ client,
86
+ gasLimit,
80
87
  marketConfigurators: [],
81
88
  redstone: {
82
89
  ignoreMissingFeeds: true
@@ -11,7 +11,8 @@ export declare function getCallsTouchedPriceFeeds(parsedCalls: ParsedCall[]): Ad
11
11
  /**
12
12
  * @deprecated This helper will be removed in the next releases.
13
13
  */
14
- export declare function getCallsTouchedUpdatablePriceFeeds({ parsedCalls, client, }: {
14
+ export declare function getCallsTouchedUpdatablePriceFeeds({ parsedCalls, client, gasLimit, }: {
15
15
  client: PublicClient;
16
16
  parsedCalls: ParsedCall[];
17
+ gasLimit?: bigint;
17
18
  }): Promise<Address[]>;
@@ -2,8 +2,9 @@ import { type Address, type PublicClient } from "viem";
2
2
  import { type IPriceUpdateTx, type RawTx } from "../../../sdk/index.js";
3
3
  import { type PriceUpdate } from "../../bindings/index.js";
4
4
  export declare function getUpdateCalldata(tx: IPriceUpdateTx): PriceUpdate;
5
- export declare function getPriceUpdateTx({ client, priceFeeds, useMulticall3, }: {
5
+ export declare function getPriceUpdateTx({ client, priceFeeds, useMulticall3, gasLimit, }: {
6
6
  client: PublicClient;
7
7
  priceFeeds: Address[];
8
8
  useMulticall3?: boolean;
9
+ gasLimit?: bigint;
9
10
  }): Promise<RawTx | undefined>;
@@ -1,6 +1,7 @@
1
1
  import { type Address, type PublicClient } from "viem";
2
- export declare function getPrices({ client, priceFeeds, chunkSize, }: {
2
+ export declare function getPrices({ client, priceFeeds, chunkSize, gasLimit }: {
3
3
  client: PublicClient;
4
4
  priceFeeds: Address[];
5
5
  chunkSize?: number;
6
+ gasLimit?: bigint;
6
7
  }): Promise<Record<Address, bigint | null>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "11.2.0",
3
+ "version": "11.2.1",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",