@gearbox-protocol/sdk 10.8.0 → 11.0.0-next.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.
@@ -85,6 +85,48 @@ const extraZappers = {
85
85
  decimals: 18
86
86
  },
87
87
  pool: "0xA9d17f6D3285208280a1Fd9B94479c62e0AABa64"
88
+ },
89
+ {
90
+ baseParams: {
91
+ addr: "0x62af1fc6e54e66aba5322a3491b5ce1808a6fe89",
92
+ version: 310n,
93
+ contractType: "0x5a41505045523a3a455243343632360000000000000000000000000000000000",
94
+ serializedParams: "0x000000000000000000000000da00000035fef4082f78def6a8903bee419fbf8e"
95
+ },
96
+ tokenIn: {
97
+ addr: "0xda00000035fef4082F78dEF6A8903bee419FbF8E",
98
+ symbol: "dUSDCV3",
99
+ name: "Trade USDC v3",
100
+ decimals: 6
101
+ },
102
+ tokenOut: {
103
+ addr: "0xF0795C47fA58d00f5F77F4D5c01F31eE891E21B4",
104
+ symbol: "rUSDC",
105
+ name: "Tulipa USDC",
106
+ decimals: 6
107
+ },
108
+ pool: "0xF0795C47fA58d00f5F77F4D5c01F31eE891E21B4"
109
+ },
110
+ {
111
+ baseParams: {
112
+ addr: "0x70383bac778f0285ddb5f35afbd631e5a4675c58",
113
+ version: 310n,
114
+ contractType: "0x5a41505045523a3a5354414b45445f4552433436323600000000000000000000",
115
+ serializedParams: "0x0000000000000000000000009ef444a6d7f4a5adcd68fd5329aa5240c90e14d2000000000000000000000000da00000035fef4082f78def6a8903bee419fbf8e"
116
+ },
117
+ tokenIn: {
118
+ addr: "0x9ef444a6d7F4A5adcd68FD5329aA5240C90E14d2",
119
+ symbol: "farmdUSDCV3",
120
+ name: "Farming of Trade USDC v3",
121
+ decimals: 6
122
+ },
123
+ tokenOut: {
124
+ addr: "0xF0795C47fA58d00f5F77F4D5c01F31eE891E21B4",
125
+ symbol: "rUSDC",
126
+ name: "Tulipa USDC",
127
+ decimals: 6
128
+ },
129
+ pool: "0xF0795C47fA58d00f5F77F4D5c01F31eE891E21B4"
88
130
  }
89
131
  ]
90
132
  };
@@ -931,10 +931,7 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
931
931
  { account: creditAccount?.creditAccount, manager: cm.name },
932
932
  `generating price feed updates for ${tStr} from ${priceFeeds.length}${remark} price feeds`
933
933
  );
934
- return this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(
935
- priceFeeds,
936
- creditAccount ? { account: creditAccount.creditAccount } : void 0
937
- );
934
+ return this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(priceFeeds);
938
935
  }
939
936
  /**
940
937
  * Returns account price updates that can be used in credit facade multicall or liquidator calls
@@ -42,6 +42,7 @@ class AliasLossPolicyV310Contract extends import_base.BaseContract {
42
42
  args: [creditAccount],
43
43
  blockNumber
44
44
  });
45
+ this.logger?.debug({ feeds: pfs }, "got required alias price feeds");
45
46
  const updates = await this.sdk.priceFeeds.generateExternalPriceFeedsUpdates(
46
47
  [...pfs],
47
48
  blockNumber ? { blockNumber } : void 0
@@ -74,10 +74,9 @@ class PriceFeedRegister extends import_base.SDKConstruct {
74
74
  * @param priceFeeds Array oftop-level price feeds, actual updatable price feeds will be derived.
75
75
  * Or filter criteria, that will gather all main or reserve price feeds from all oracles
76
76
  * If not provided will use all price feeds that are attached
77
- * @param logContext extra information for logging
78
77
  * @returns
79
78
  */
80
- async generatePriceFeedsUpdateTxs(priceFeeds, logContext = {}) {
79
+ async generatePriceFeedsUpdateTxs(priceFeeds) {
81
80
  let updateables = this.#feeds.values();
82
81
  let filterRemark = "";
83
82
  if (priceFeeds) {
@@ -96,9 +95,7 @@ class PriceFeedRegister extends import_base.SDKConstruct {
96
95
  updates: [],
97
96
  timestamp: Math.floor(Date.now() / 1e3)
98
97
  };
99
- const updates = (await Promise.all(
100
- this.updaters.map((u) => u.getUpdateTxs(updateables, logContext))
101
- )).flat();
98
+ const updates = (await Promise.all(this.updaters.map((u) => u.getUpdateTxs(updateables)))).flat();
102
99
  let maxTimestamp = 0;
103
100
  for (const tx of updates) {
104
101
  const { data } = tx;
@@ -115,7 +112,6 @@ class PriceFeedRegister extends import_base.SDKConstruct {
115
112
  const result = { txs, timestamp: maxTimestamp };
116
113
  const tsDelta = BigInt(maxTimestamp) - this.sdk.timestamp;
117
114
  this.logger?.debug(
118
- logContext,
119
115
  `generated ${txs.length}${filterRemark} price feed update transactions, timestamp: ${maxTimestamp} (delta ${tsDelta})`
120
116
  );
121
117
  if (txs.length) {
@@ -127,28 +123,20 @@ class PriceFeedRegister extends import_base.SDKConstruct {
127
123
  /**
128
124
  * Similar to {@link generatePriceFeedsUpdateTxs}, but returns raw structures instead of transactions
129
125
  * @param priceFeeds
130
- * @param logContext
131
126
  * @returns
132
127
  */
133
- async generatePriceFeedsUpdates(priceFeeds, logContext = {}) {
134
- const updates = await this.generatePriceFeedsUpdateTxs(
135
- priceFeeds,
136
- logContext
137
- );
128
+ async generatePriceFeedsUpdates(priceFeeds) {
129
+ const updates = await this.generatePriceFeedsUpdateTxs(priceFeeds);
138
130
  return (0, import_getRawPriceUpdates.getRawPriceUpdates)(updates);
139
131
  }
140
132
  /**
141
133
  * Similar to {@link generatePriceFeedsUpdates}, but returns raw transaction to PriceFeedStore.updatePrices
142
134
  * @param priceFeeds
143
- * @param logContext
144
135
  * @returns
145
136
  */
146
- async getPriceFeedStoreUpdateTx(priceFeeds, logContext = {}) {
137
+ async getPriceFeedStoreUpdateTx(priceFeeds) {
147
138
  const pfs = this.sdk.addressProvider.getAddress(import_constants.AP_PRICE_FEED_STORE);
148
- const updates = await this.generatePriceFeedsUpdates(
149
- priceFeeds,
150
- logContext
151
- );
139
+ const updates = await this.generatePriceFeedsUpdates(priceFeeds);
152
140
  return (0, import_utils.createRawTx)(pfs, {
153
141
  abi: (0, import_viem.parseAbi)(["function updatePrices((address,bytes)[])"]),
154
142
  functionName: "updatePrices",
@@ -82,9 +82,8 @@ class PythUpdater extends import_base.SDKConstruct {
82
82
  historical: !!ts
83
83
  });
84
84
  }
85
- async getUpdateTxs(feeds, logContext = {}) {
85
+ async getUpdateTxs(feeds) {
86
86
  this.#logger?.debug(
87
- logContext,
88
87
  `generating update transactions for ${feeds.length} pyth price feeds`
89
88
  );
90
89
  const pythFeeds = new Map(
@@ -120,7 +119,6 @@ class PythUpdater extends import_base.SDKConstruct {
120
119
  }
121
120
  }
122
121
  this.#logger?.debug(
123
- logContext,
124
122
  `generated ${results.length} update transactions for pyth price feeds: ${Array.from(pythFeeds.keys()).join(", ")}${tsRange}`
125
123
  );
126
124
  return results;
@@ -89,9 +89,8 @@ class RedstoneUpdater extends import_base.SDKConstruct {
89
89
  historical: !!ts
90
90
  });
91
91
  }
92
- async getUpdateTxs(feeds, logContext = {}) {
92
+ async getUpdateTxs(feeds) {
93
93
  this.#logger?.debug(
94
- logContext,
95
94
  `generating update transactions for ${feeds.length} redstone price feeds`
96
95
  );
97
96
  const groupedFeeds = {};
@@ -149,7 +148,6 @@ class RedstoneUpdater extends import_base.SDKConstruct {
149
148
  }
150
149
  }
151
150
  this.#logger?.debug(
152
- logContext,
153
151
  `generated ${results.length} update transactions for redstone price feeds: ${Array.from(priceFeeds.keys()).join(", ")}${tsRange}`
154
152
  );
155
153
  return results;
@@ -62,6 +62,48 @@ const extraZappers = {
62
62
  decimals: 18
63
63
  },
64
64
  pool: "0xA9d17f6D3285208280a1Fd9B94479c62e0AABa64"
65
+ },
66
+ {
67
+ baseParams: {
68
+ addr: "0x62af1fc6e54e66aba5322a3491b5ce1808a6fe89",
69
+ version: 310n,
70
+ contractType: "0x5a41505045523a3a455243343632360000000000000000000000000000000000",
71
+ serializedParams: "0x000000000000000000000000da00000035fef4082f78def6a8903bee419fbf8e"
72
+ },
73
+ tokenIn: {
74
+ addr: "0xda00000035fef4082F78dEF6A8903bee419FbF8E",
75
+ symbol: "dUSDCV3",
76
+ name: "Trade USDC v3",
77
+ decimals: 6
78
+ },
79
+ tokenOut: {
80
+ addr: "0xF0795C47fA58d00f5F77F4D5c01F31eE891E21B4",
81
+ symbol: "rUSDC",
82
+ name: "Tulipa USDC",
83
+ decimals: 6
84
+ },
85
+ pool: "0xF0795C47fA58d00f5F77F4D5c01F31eE891E21B4"
86
+ },
87
+ {
88
+ baseParams: {
89
+ addr: "0x70383bac778f0285ddb5f35afbd631e5a4675c58",
90
+ version: 310n,
91
+ contractType: "0x5a41505045523a3a5354414b45445f4552433436323600000000000000000000",
92
+ serializedParams: "0x0000000000000000000000009ef444a6d7f4a5adcd68fd5329aa5240c90e14d2000000000000000000000000da00000035fef4082f78def6a8903bee419fbf8e"
93
+ },
94
+ tokenIn: {
95
+ addr: "0x9ef444a6d7F4A5adcd68FD5329aA5240C90E14d2",
96
+ symbol: "farmdUSDCV3",
97
+ name: "Farming of Trade USDC v3",
98
+ decimals: 6
99
+ },
100
+ tokenOut: {
101
+ addr: "0xF0795C47fA58d00f5F77F4D5c01F31eE891E21B4",
102
+ symbol: "rUSDC",
103
+ name: "Tulipa USDC",
104
+ decimals: 6
105
+ },
106
+ pool: "0xF0795C47fA58d00f5F77F4D5c01F31eE891E21B4"
65
107
  }
66
108
  ]
67
109
  };
@@ -921,10 +921,7 @@ class AbstractCreditAccountService extends SDKConstruct {
921
921
  { account: creditAccount?.creditAccount, manager: cm.name },
922
922
  `generating price feed updates for ${tStr} from ${priceFeeds.length}${remark} price feeds`
923
923
  );
924
- return this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(
925
- priceFeeds,
926
- creditAccount ? { account: creditAccount.creditAccount } : void 0
927
- );
924
+ return this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(priceFeeds);
928
925
  }
929
926
  /**
930
927
  * Returns account price updates that can be used in credit facade multicall or liquidator calls
@@ -19,6 +19,7 @@ class AliasLossPolicyV310Contract extends BaseContract {
19
19
  args: [creditAccount],
20
20
  blockNumber
21
21
  });
22
+ this.logger?.debug({ feeds: pfs }, "got required alias price feeds");
22
23
  const updates = await this.sdk.priceFeeds.generateExternalPriceFeedsUpdates(
23
24
  [...pfs],
24
25
  blockNumber ? { blockNumber } : void 0
@@ -63,10 +63,9 @@ class PriceFeedRegister extends SDKConstruct {
63
63
  * @param priceFeeds Array oftop-level price feeds, actual updatable price feeds will be derived.
64
64
  * Or filter criteria, that will gather all main or reserve price feeds from all oracles
65
65
  * If not provided will use all price feeds that are attached
66
- * @param logContext extra information for logging
67
66
  * @returns
68
67
  */
69
- async generatePriceFeedsUpdateTxs(priceFeeds, logContext = {}) {
68
+ async generatePriceFeedsUpdateTxs(priceFeeds) {
70
69
  let updateables = this.#feeds.values();
71
70
  let filterRemark = "";
72
71
  if (priceFeeds) {
@@ -85,9 +84,7 @@ class PriceFeedRegister extends SDKConstruct {
85
84
  updates: [],
86
85
  timestamp: Math.floor(Date.now() / 1e3)
87
86
  };
88
- const updates = (await Promise.all(
89
- this.updaters.map((u) => u.getUpdateTxs(updateables, logContext))
90
- )).flat();
87
+ const updates = (await Promise.all(this.updaters.map((u) => u.getUpdateTxs(updateables)))).flat();
91
88
  let maxTimestamp = 0;
92
89
  for (const tx of updates) {
93
90
  const { data } = tx;
@@ -104,7 +101,6 @@ class PriceFeedRegister extends SDKConstruct {
104
101
  const result = { txs, timestamp: maxTimestamp };
105
102
  const tsDelta = BigInt(maxTimestamp) - this.sdk.timestamp;
106
103
  this.logger?.debug(
107
- logContext,
108
104
  `generated ${txs.length}${filterRemark} price feed update transactions, timestamp: ${maxTimestamp} (delta ${tsDelta})`
109
105
  );
110
106
  if (txs.length) {
@@ -116,28 +112,20 @@ class PriceFeedRegister extends SDKConstruct {
116
112
  /**
117
113
  * Similar to {@link generatePriceFeedsUpdateTxs}, but returns raw structures instead of transactions
118
114
  * @param priceFeeds
119
- * @param logContext
120
115
  * @returns
121
116
  */
122
- async generatePriceFeedsUpdates(priceFeeds, logContext = {}) {
123
- const updates = await this.generatePriceFeedsUpdateTxs(
124
- priceFeeds,
125
- logContext
126
- );
117
+ async generatePriceFeedsUpdates(priceFeeds) {
118
+ const updates = await this.generatePriceFeedsUpdateTxs(priceFeeds);
127
119
  return getRawPriceUpdates(updates);
128
120
  }
129
121
  /**
130
122
  * Similar to {@link generatePriceFeedsUpdates}, but returns raw transaction to PriceFeedStore.updatePrices
131
123
  * @param priceFeeds
132
- * @param logContext
133
124
  * @returns
134
125
  */
135
- async getPriceFeedStoreUpdateTx(priceFeeds, logContext = {}) {
126
+ async getPriceFeedStoreUpdateTx(priceFeeds) {
136
127
  const pfs = this.sdk.addressProvider.getAddress(AP_PRICE_FEED_STORE);
137
- const updates = await this.generatePriceFeedsUpdates(
138
- priceFeeds,
139
- logContext
140
- );
128
+ const updates = await this.generatePriceFeedsUpdates(priceFeeds);
141
129
  return createRawTx(pfs, {
142
130
  abi: parseAbi(["function updatePrices((address,bytes)[])"]),
143
131
  functionName: "updatePrices",
@@ -62,9 +62,8 @@ class PythUpdater extends SDKConstruct {
62
62
  historical: !!ts
63
63
  });
64
64
  }
65
- async getUpdateTxs(feeds, logContext = {}) {
65
+ async getUpdateTxs(feeds) {
66
66
  this.#logger?.debug(
67
- logContext,
68
67
  `generating update transactions for ${feeds.length} pyth price feeds`
69
68
  );
70
69
  const pythFeeds = new Map(
@@ -100,7 +99,6 @@ class PythUpdater extends SDKConstruct {
100
99
  }
101
100
  }
102
101
  this.#logger?.debug(
103
- logContext,
104
102
  `generated ${results.length} update transactions for pyth price feeds: ${Array.from(pythFeeds.keys()).join(", ")}${tsRange}`
105
103
  );
106
104
  return results;
@@ -67,9 +67,8 @@ class RedstoneUpdater extends SDKConstruct {
67
67
  historical: !!ts
68
68
  });
69
69
  }
70
- async getUpdateTxs(feeds, logContext = {}) {
70
+ async getUpdateTxs(feeds) {
71
71
  this.#logger?.debug(
72
- logContext,
73
72
  `generating update transactions for ${feeds.length} redstone price feeds`
74
73
  );
75
74
  const groupedFeeds = {};
@@ -127,7 +126,6 @@ class RedstoneUpdater extends SDKConstruct {
127
126
  }
128
127
  }
129
128
  this.#logger?.debug(
130
- logContext,
131
129
  `generated ${results.length} update transactions for redstone price feeds: ${Array.from(priceFeeds.keys()).join(", ")}${tsRange}`
132
130
  );
133
131
  return results;
@@ -42,36 +42,33 @@ export declare class PriceFeedRegister extends SDKConstruct implements IHooks<Pr
42
42
  * @param priceFeeds Array oftop-level price feeds, actual updatable price feeds will be derived.
43
43
  * Or filter criteria, that will gather all main or reserve price feeds from all oracles
44
44
  * If not provided will use all price feeds that are attached
45
- * @param logContext extra information for logging
46
45
  * @returns
47
46
  */
48
47
  generatePriceFeedsUpdateTxs(priceFeeds?: IPriceFeedContract[] | {
49
48
  main: true;
50
49
  } | {
51
50
  reserve: true;
52
- }, logContext?: Record<string, any>): Promise<UpdatePriceFeedsResult>;
51
+ }): Promise<UpdatePriceFeedsResult>;
53
52
  /**
54
53
  * Similar to {@link generatePriceFeedsUpdateTxs}, but returns raw structures instead of transactions
55
54
  * @param priceFeeds
56
- * @param logContext
57
55
  * @returns
58
56
  */
59
57
  generatePriceFeedsUpdates(priceFeeds?: IPriceFeedContract[] | {
60
58
  main: true;
61
59
  } | {
62
60
  reserve: true;
63
- }, logContext?: Record<string, any>): Promise<PriceUpdateV310[]>;
61
+ }): Promise<PriceUpdateV310[]>;
64
62
  /**
65
63
  * Similar to {@link generatePriceFeedsUpdates}, but returns raw transaction to PriceFeedStore.updatePrices
66
64
  * @param priceFeeds
67
- * @param logContext
68
65
  * @returns
69
66
  */
70
67
  getPriceFeedStoreUpdateTx(priceFeeds?: IPriceFeedContract[] | {
71
68
  main: true;
72
69
  } | {
73
70
  reserve: true;
74
- }, logContext?: Record<string, any>): Promise<RawTx>;
71
+ }): Promise<RawTx>;
75
72
  /**
76
73
  * Similar to {@link generatePriceFeedsUpdateTxs}, but will generate necessary price update transactions for external price feeds
77
74
  * This does not add feeds to this register, so they won't be implicitly included in future generatePriceFeedsUpdateTxs calls
@@ -21,6 +21,6 @@ export type PythOptions = z.infer<typeof PythOptions>;
21
21
  export declare class PythUpdater extends SDKConstruct implements IPriceUpdater<PythUpdateTask> {
22
22
  #private;
23
23
  constructor(sdk: GearboxSDK, opts?: PythOptions);
24
- getUpdateTxs(feeds: IPriceFeedContract[], logContext?: Record<string, any>): Promise<PythUpdateTx[]>;
24
+ getUpdateTxs(feeds: IPriceFeedContract[]): Promise<PythUpdateTx[]>;
25
25
  }
26
26
  export {};
@@ -24,6 +24,6 @@ export type RedstoneOptions = z.infer<typeof RedstoneOptions>;
24
24
  export declare class RedstoneUpdater extends SDKConstruct implements IPriceUpdater<RedstoneUpdateTask> {
25
25
  #private;
26
26
  constructor(sdk: GearboxSDK, opts?: RedstoneOptions);
27
- getUpdateTxs(feeds: IPriceFeedContract[], logContext?: Record<string, any>): Promise<RedstoneUpdateTx[]>;
27
+ getUpdateTxs(feeds: IPriceFeedContract[]): Promise<RedstoneUpdateTx[]>;
28
28
  }
29
29
  export {};
@@ -8,7 +8,7 @@ export interface IPriceUpdateTask {
8
8
  cached: boolean;
9
9
  }
10
10
  export interface IPriceUpdater<T extends IPriceUpdateTask = IPriceUpdateTask> {
11
- getUpdateTxs: (feeds: IPriceFeedContract[], logContext?: Record<string, any>) => Promise<IPriceUpdateTx<T>[]>;
11
+ getUpdateTxs: (feeds: IPriceFeedContract[]) => Promise<IPriceUpdateTx<T>[]>;
12
12
  }
13
13
  export interface TimestampedCalldata {
14
14
  dataFeedId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "10.8.0",
3
+ "version": "11.0.0-next.1",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",
@@ -65,10 +65,10 @@
65
65
  "zod": "^4.1.12"
66
66
  },
67
67
  "devDependencies": {
68
- "@biomejs/biome": "^2.3.4",
68
+ "@biomejs/biome": "^2.3.5",
69
69
  "@commitlint/cli": "^20.1.0",
70
70
  "@commitlint/config-conventional": "^20.0.0",
71
- "@gearbox-protocol/biome-config": "^1.0.10",
71
+ "@gearbox-protocol/biome-config": "^1.0.11",
72
72
  "@types/cross-spawn": "^6.0.6",
73
73
  "axios": "^1.13.2",
74
74
  "cross-spawn": "^7.0.6",
@@ -80,7 +80,7 @@
80
80
  "tsx": "^4.20.6",
81
81
  "typescript": "^5.9.3",
82
82
  "viem-deal": "^2.0.4",
83
- "vitest": "^4.0.7"
83
+ "vitest": "^4.0.8"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "axios": "^1.0.0",