@gearbox-protocol/sdk 8.4.1 → 8.4.3

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.
@@ -36,6 +36,9 @@ class V300StalenessPeriodPlugin extends import_BasePlugin.BasePlugin {
36
36
  super.sdk = sdk;
37
37
  this.#syncedTo = import_constants.ADDRESS_PROVIDER_BLOCK[sdk.provider.networkType] - 1n;
38
38
  }
39
+ get sdk() {
40
+ return super.sdk;
41
+ }
39
42
  get loaded() {
40
43
  return !!this.#syncedTo;
41
44
  }
@@ -146,23 +146,18 @@ class RouterV310Contract extends import_AbstractRouterContract.AbstractRouterCon
146
146
  */
147
147
  async findClaimAllRewards(props) {
148
148
  const tData = props.creditAccount.tokens.map((a) => ({
149
- balance: a.balance,
149
+ balance: 0n,
150
150
  claimRewards: true,
151
- leftoverBalance: a.balance,
152
- numSplits: 0n,
151
+ leftoverBalance: 0n,
152
+ numSplits: 1n,
153
153
  token: a.token
154
154
  }));
155
+ const { result } = await this.contract.simulate.processClaims([
156
+ props.creditAccount.creditAccount,
157
+ tData
158
+ ]);
155
159
  return {
156
- calls: [
157
- {
158
- target: this.address,
159
- callData: (0, import_viem.encodeFunctionData)({
160
- abi: this.abi,
161
- functionName: "processClaims",
162
- args: [props.creditAccount.creditAccount, tData]
163
- })
164
- }
165
- ]
160
+ calls: [...result]
166
161
  };
167
162
  }
168
163
  /**
@@ -13,6 +13,9 @@ class V300StalenessPeriodPlugin extends BasePlugin {
13
13
  super.sdk = sdk;
14
14
  this.#syncedTo = ADDRESS_PROVIDER_BLOCK[sdk.provider.networkType] - 1n;
15
15
  }
16
+ get sdk() {
17
+ return super.sdk;
18
+ }
16
19
  get loaded() {
17
20
  return !!this.#syncedTo;
18
21
  }
@@ -1,4 +1,4 @@
1
- import { encodeFunctionData, getAddress } from "viem";
1
+ import { getAddress } from "viem";
2
2
  import { iGearboxRouterV310Abi } from "../../abi/routerV310.js";
3
3
  import { BigIntMath } from "../sdk-legacy/index.js";
4
4
  import { AddressMap } from "../utils/AddressMap.js";
@@ -123,23 +123,18 @@ class RouterV310Contract extends AbstractRouterContract {
123
123
  */
124
124
  async findClaimAllRewards(props) {
125
125
  const tData = props.creditAccount.tokens.map((a) => ({
126
- balance: a.balance,
126
+ balance: 0n,
127
127
  claimRewards: true,
128
- leftoverBalance: a.balance,
129
- numSplits: 0n,
128
+ leftoverBalance: 0n,
129
+ numSplits: 1n,
130
130
  token: a.token
131
131
  }));
132
+ const { result } = await this.contract.simulate.processClaims([
133
+ props.creditAccount.creditAccount,
134
+ tData
135
+ ]);
132
136
  return {
133
- calls: [
134
- {
135
- target: this.address,
136
- callData: encodeFunctionData({
137
- abi: this.abi,
138
- functionName: "processClaims",
139
- args: [props.creditAccount.creditAccount, tData]
140
- })
141
- }
142
- ]
137
+ calls: [...result]
143
138
  };
144
139
  }
145
140
  /**
@@ -21,6 +21,7 @@ export interface V300StalenessPeriodPluginState {
21
21
  export declare class V300StalenessPeriodPlugin extends BasePlugin<V300StalenessPeriodPluginState> implements IGearboxSDKPlugin<V300StalenessPeriodPluginState> {
22
22
  #private;
23
23
  set sdk(sdk: GearboxSDK<any>);
24
+ get sdk(): GearboxSDK<any>;
24
25
  get loaded(): boolean;
25
26
  load(force?: boolean): Promise<V300StalenessPeriodPluginState>;
26
27
  get state(): V300StalenessPeriodPluginState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "8.4.1",
3
+ "version": "8.4.3",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",