@gearbox-protocol/sdk 10.2.3 → 10.2.5

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.
@@ -97,13 +97,15 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
97
97
  assetsToWithdraw,
98
98
  creditAccount: ca,
99
99
  permits,
100
- to
100
+ to,
101
+ tokensToClaim
101
102
  }) {
102
103
  const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
103
104
  const addCollateral = collateralAssets.filter((a) => a.balance > 0);
104
105
  const router = this.sdk.routerFor(ca);
105
106
  const claimPath = await router.findClaimAllRewards({
106
107
  calls: [],
108
+ tokensToClaim,
107
109
  creditAccount: ca
108
110
  });
109
111
  const priceUpdates = await this.getPriceUpdatesForFacade({
@@ -132,12 +134,14 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
132
134
  assetsToWithdraw,
133
135
  creditAccount: ca,
134
136
  permits,
135
- to
137
+ to,
138
+ tokensToClaim
136
139
  }) {
137
140
  const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
138
141
  const router = this.sdk.routerFor(ca);
139
142
  const claimPath = await router.findClaimAllRewards({
140
143
  calls: [],
144
+ tokensToClaim,
141
145
  creditAccount: ca
142
146
  });
143
147
  const priceUpdates = await this.getPriceUpdatesForFacade({
@@ -167,12 +171,14 @@ class CreditAccountServiceV310 extends import_AbstractCreditAccountsService.Abst
167
171
  calls: legacyCalls,
168
172
  creditAccount: ca,
169
173
  minQuota,
170
- averageQuota
174
+ averageQuota,
175
+ tokensToClaim
171
176
  }) {
172
177
  const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
173
178
  const router = this.sdk.routerFor(ca);
174
179
  const claimPath = await router.findClaimAllRewards({
175
180
  calls: legacyCalls,
181
+ tokensToClaim,
176
182
  creditAccount: ca
177
183
  });
178
184
  if (claimPath.calls.length === 0) throw new Error("No path to execute");
@@ -146,7 +146,7 @@ class RouterV310Contract extends import_AbstractRouterContract.AbstractRouterCon
146
146
  * Implements {@link IRouterContract.findClaimAllRewards}
147
147
  */
148
148
  async findClaimAllRewards(props) {
149
- const tData = props.creditAccount.tokens.map((a) => ({
149
+ const tData = props.tokensToClaim.map((a) => ({
150
150
  balance: 0n,
151
151
  claimRewards: true,
152
152
  leftoverBalance: 0n,
@@ -74,13 +74,15 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
74
74
  assetsToWithdraw,
75
75
  creditAccount: ca,
76
76
  permits,
77
- to
77
+ to,
78
+ tokensToClaim
78
79
  }) {
79
80
  const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
80
81
  const addCollateral = collateralAssets.filter((a) => a.balance > 0);
81
82
  const router = this.sdk.routerFor(ca);
82
83
  const claimPath = await router.findClaimAllRewards({
83
84
  calls: [],
85
+ tokensToClaim,
84
86
  creditAccount: ca
85
87
  });
86
88
  const priceUpdates = await this.getPriceUpdatesForFacade({
@@ -109,12 +111,14 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
109
111
  assetsToWithdraw,
110
112
  creditAccount: ca,
111
113
  permits,
112
- to
114
+ to,
115
+ tokensToClaim
113
116
  }) {
114
117
  const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
115
118
  const router = this.sdk.routerFor(ca);
116
119
  const claimPath = await router.findClaimAllRewards({
117
120
  calls: [],
121
+ tokensToClaim,
118
122
  creditAccount: ca
119
123
  });
120
124
  const priceUpdates = await this.getPriceUpdatesForFacade({
@@ -144,12 +148,14 @@ class CreditAccountServiceV310 extends AbstractCreditAccountService {
144
148
  calls: legacyCalls,
145
149
  creditAccount: ca,
146
150
  minQuota,
147
- averageQuota
151
+ averageQuota,
152
+ tokensToClaim
148
153
  }) {
149
154
  const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
150
155
  const router = this.sdk.routerFor(ca);
151
156
  const claimPath = await router.findClaimAllRewards({
152
157
  calls: legacyCalls,
158
+ tokensToClaim,
153
159
  creditAccount: ca
154
160
  });
155
161
  if (claimPath.calls.length === 0) throw new Error("No path to execute");
@@ -123,7 +123,7 @@ class RouterV310Contract extends AbstractRouterContract {
123
123
  * Implements {@link IRouterContract.findClaimAllRewards}
124
124
  */
125
125
  async findClaimAllRewards(props) {
126
- const tData = props.creditAccount.tokens.map((a) => ({
126
+ const tData = props.tokensToClaim.map((a) => ({
127
127
  balance: 0n,
128
128
  claimRewards: true,
129
129
  leftoverBalance: 0n,
@@ -12,13 +12,13 @@ export declare class CreditAccountServiceV310 extends AbstractCreditAccountServi
12
12
  /**
13
13
  * Implements {@link ICreditAccountsService.repayCreditAccount}
14
14
  */
15
- repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, }: RepayCreditAccountProps): Promise<CreditAccountOperationResult>;
15
+ repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, }: RepayCreditAccountProps): Promise<CreditAccountOperationResult>;
16
16
  /**
17
17
  * Implements {@link ICreditAccountsService.repayAndLiquidateCreditAccount}
18
18
  */
19
- repayAndLiquidateCreditAccount({ collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, }: RepayAndLiquidateCreditAccountProps): Promise<CreditAccountOperationResult>;
19
+ repayAndLiquidateCreditAccount({ collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, }: RepayAndLiquidateCreditAccountProps): Promise<CreditAccountOperationResult>;
20
20
  /**
21
21
  * Implements {@link ICreditAccountsService.claimFarmRewards}
22
22
  */
23
- claimFarmRewards({ calls: legacyCalls, creditAccount: ca, minQuota, averageQuota, }: ClaimFarmRewardsProps): Promise<CreditAccountOperationResult>;
23
+ claimFarmRewards({ calls: legacyCalls, creditAccount: ca, minQuota, averageQuota, tokensToClaim, }: ClaimFarmRewardsProps): Promise<CreditAccountOperationResult>;
24
24
  }
@@ -108,6 +108,7 @@ export interface RepayAndLiquidateCreditAccountProps {
108
108
  * permits of tokens to withdraw (in any permittable token is present)
109
109
  */
110
110
  permits: Record<string, PermitResult>;
111
+ tokensToClaim: Asset[];
111
112
  }
112
113
  export interface PrepareUpdateQuotasProps {
113
114
  /**
@@ -222,6 +223,7 @@ export interface ClaimFarmRewardsProps extends PrepareUpdateQuotasProps {
222
223
  * minimal credit account data on which operation is performed
223
224
  */
224
225
  creditAccount: RouterCASlice;
226
+ tokensToClaim: Asset[];
225
227
  }
226
228
  export interface EnableTokensProps {
227
229
  /**
@@ -180,6 +180,10 @@ export interface FindClaimAllRewardsProps {
180
180
  * Minimal credit account data on which operation is performed
181
181
  */
182
182
  creditAccount: RouterCASlice;
183
+ /**
184
+ * List of token rewards of which we want to claim and swap to underlying token during closing ca process
185
+ */
186
+ tokensToClaim: Array<Asset>;
183
187
  /**
184
188
  * Legacy property - array of MultiCall from getRewards
185
189
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "10.2.3",
3
+ "version": "10.2.5",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",