@gearbox-protocol/sdk 8.12.4 → 8.13.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.
@@ -68,9 +68,7 @@ const chains = {
68
68
  "0x354fe9f450F60b8547f88BE042E4A45b46128a06": "Chaos Labs",
69
69
  "0x4d427D418342d8CE89a7634c3a402851978B680A": "K3",
70
70
  "0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x",
71
- "0x3b56538833fc02f4f0e75609390f26ded0c32e42": "Re7"
72
- },
73
- testMarketConfigurators: {
71
+ "0x3b56538833fc02f4f0e75609390f26ded0c32e42": "Re7",
74
72
  "0x7a133fbd01736fd076158307c9476cc3877f1af5": "Invariant Group"
75
73
  },
76
74
  isPublic: true,
@@ -100,7 +100,7 @@ class PriceFeedRegister extends import_base.SDKConstruct {
100
100
  return result;
101
101
  }
102
102
  /**
103
- * Similar to generatePriceFeedsUpdateTxs, but will generate necessary price update transactions for external price feeds
103
+ * Similar to {@link generatePriceFeedsUpdateTxs}, but will generate necessary price update transactions for external price feeds
104
104
  * This does not add feeds to this register, so they won't be implicitly included in future generatePriceFeedsUpdateTxs calls
105
105
  * @param feeds
106
106
  * @param block
@@ -124,6 +124,22 @@ class PriceFeedRegister extends import_base.SDKConstruct {
124
124
  const feedContracts = result.map((data) => this.#createUpdatableProxy(data));
125
125
  return this.generatePriceFeedsUpdateTxs(feedContracts);
126
126
  }
127
+ /**
128
+ * Similar to {@link generateExternalPriceFeedsUpdateTxs}, but returns raw structures instead of transactions
129
+ * @param feeds
130
+ * @param block
131
+ * @returns
132
+ */
133
+ async generateExternalPriceFeedsUpdates(feeds, block) {
134
+ const { txs } = await this.generateExternalPriceFeedsUpdateTxs(
135
+ feeds,
136
+ block
137
+ );
138
+ return txs.map((tx) => ({
139
+ priceFeed: tx.data.priceFeed,
140
+ data: tx.raw.callData
141
+ }));
142
+ }
127
143
  has(address) {
128
144
  return this.#feeds.has(address);
129
145
  }
@@ -54,9 +54,7 @@ const chains = {
54
54
  "0x354fe9f450F60b8547f88BE042E4A45b46128a06": "Chaos Labs",
55
55
  "0x4d427D418342d8CE89a7634c3a402851978B680A": "K3",
56
56
  "0xc168343c791d56dd1da4b4b8b0cc1c1ec1a16e6b": "cp0x",
57
- "0x3b56538833fc02f4f0e75609390f26ded0c32e42": "Re7"
58
- },
59
- testMarketConfigurators: {
57
+ "0x3b56538833fc02f4f0e75609390f26ded0c32e42": "Re7",
60
58
  "0x7a133fbd01736fd076158307c9476cc3877f1af5": "Invariant Group"
61
59
  },
62
60
  isPublic: true,
@@ -83,7 +83,7 @@ class PriceFeedRegister extends SDKConstruct {
83
83
  return result;
84
84
  }
85
85
  /**
86
- * Similar to generatePriceFeedsUpdateTxs, but will generate necessary price update transactions for external price feeds
86
+ * Similar to {@link generatePriceFeedsUpdateTxs}, but will generate necessary price update transactions for external price feeds
87
87
  * This does not add feeds to this register, so they won't be implicitly included in future generatePriceFeedsUpdateTxs calls
88
88
  * @param feeds
89
89
  * @param block
@@ -107,6 +107,22 @@ class PriceFeedRegister extends SDKConstruct {
107
107
  const feedContracts = result.map((data) => this.#createUpdatableProxy(data));
108
108
  return this.generatePriceFeedsUpdateTxs(feedContracts);
109
109
  }
110
+ /**
111
+ * Similar to {@link generateExternalPriceFeedsUpdateTxs}, but returns raw structures instead of transactions
112
+ * @param feeds
113
+ * @param block
114
+ * @returns
115
+ */
116
+ async generateExternalPriceFeedsUpdates(feeds, block) {
117
+ const { txs } = await this.generateExternalPriceFeedsUpdateTxs(
118
+ feeds,
119
+ block
120
+ );
121
+ return txs.map((tx) => ({
122
+ priceFeed: tx.data.priceFeed,
123
+ data: tx.raw.callData
124
+ }));
125
+ }
110
126
  has(address) {
111
127
  return this.#feeds.has(address);
112
128
  }
@@ -1,4 +1,4 @@
1
- import type { Address, BlockTag } from "viem";
1
+ import type { Address, BlockTag, Hex } from "viem";
2
2
  import type { PriceFeedTreeNode } from "../../base/index.js";
3
3
  import { SDKConstruct } from "../../base/index.js";
4
4
  import type { GearboxSDK } from "../../GearboxSDK.js";
@@ -41,7 +41,7 @@ export declare class PriceFeedRegister extends SDKConstruct implements IHooks<Pr
41
41
  */
42
42
  generatePriceFeedsUpdateTxs(priceFeeds?: IPriceFeedContract[], logContext?: Record<string, any>): Promise<UpdatePriceFeedsResult>;
43
43
  /**
44
- * Similar to generatePriceFeedsUpdateTxs, but will generate necessary price update transactions for external price feeds
44
+ * Similar to {@link generatePriceFeedsUpdateTxs}, but will generate necessary price update transactions for external price feeds
45
45
  * This does not add feeds to this register, so they won't be implicitly included in future generatePriceFeedsUpdateTxs calls
46
46
  * @param feeds
47
47
  * @param block
@@ -52,6 +52,20 @@ export declare class PriceFeedRegister extends SDKConstruct implements IHooks<Pr
52
52
  } | {
53
53
  blockTag: BlockTag;
54
54
  }): Promise<UpdatePriceFeedsResult>;
55
+ /**
56
+ * Similar to {@link generateExternalPriceFeedsUpdateTxs}, but returns raw structures instead of transactions
57
+ * @param feeds
58
+ * @param block
59
+ * @returns
60
+ */
61
+ generateExternalPriceFeedsUpdates(feeds: Address[], block?: {
62
+ blockNumber: bigint;
63
+ } | {
64
+ blockTag: BlockTag;
65
+ }): Promise<Array<{
66
+ priceFeed: Address;
67
+ data: Hex;
68
+ }>>;
55
69
  has(address: Address): boolean;
56
70
  mustGet(address: Address): IPriceFeedContract;
57
71
  getOrCreate(data: PriceFeedTreeNode): IPriceFeedContract;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "8.12.4",
3
+ "version": "8.13.0",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",