@gearbox-protocol/sdk 1.23.0 → 1.23.2

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.
@@ -11,7 +11,7 @@ export interface Rewards {
11
11
  calls: Array<MultiCall>;
12
12
  }
13
13
  export interface AdapterWithType {
14
- adapter: string;
14
+ contractAddress: string;
15
15
  contract: SupportedContract;
16
16
  }
17
17
  export declare class RewardClaimer {
@@ -8,7 +8,7 @@ import { CreditAccountData } from "./creditAccount";
8
8
  import { CreditManagerData } from "./creditManager";
9
9
  import { AdapterWithType, Rewards } from "./rewardClaimer";
10
10
  export interface RewardDistribution {
11
- adapter: string;
11
+ contractAddress: string;
12
12
  contract: SupportedContract;
13
13
  token: SupportedToken;
14
14
  }
@@ -31,8 +31,8 @@ class RewardConvex {
31
31
  .filter(([_, params]) => params.type === adapters_1.AdapterInterface.CONVEX_V1_BASE_REWARD_POOL)
32
32
  .map(([contract]) => contract);
33
33
  return Object.entries(cm.adapters)
34
- .map(([contract, adapter]) => ({
35
- adapter,
34
+ .map(([contract]) => ({
35
+ contractAddress: contract,
36
36
  contract: contracts_1.contractsByAddress[contract.toLowerCase()],
37
37
  }))
38
38
  .filter(a => convexPools.includes(a.contract));
@@ -43,13 +43,13 @@ class RewardConvex {
43
43
  const adapters = this.findAdapters(cm);
44
44
  for (let a of adapters) {
45
45
  calls.push({
46
- address: a.adapter,
46
+ address: a.contractAddress,
47
47
  interface: RewardConvex.poolInterface,
48
48
  method: "earned(address)",
49
49
  params: [creditAccount],
50
50
  });
51
51
  distribution.push({
52
- adapter: a.adapter,
52
+ contractAddress: a.contractAddress,
53
53
  contract: a.contract,
54
54
  token: "CRV",
55
55
  });
@@ -62,7 +62,7 @@ class RewardConvex {
62
62
  params: [creditAccount],
63
63
  });
64
64
  distribution.push({
65
- adapter: a.adapter,
65
+ contractAddress: a.contractAddress,
66
66
  contract: a.contract,
67
67
  token: er.rewardToken,
68
68
  });
@@ -77,7 +77,7 @@ class RewardConvex {
77
77
  const result = {};
78
78
  const callData = RewardConvex.poolInterface.encodeFunctionData("getReward(address,bool)", [creditAccount, true]);
79
79
  for (let i = 0; i < rewards.length; i++) {
80
- const { contract, adapter, token } = distribution[i];
80
+ const { contract, contractAddress, token } = distribution[i];
81
81
  const reward = rewards[i];
82
82
  if (!reward.isZero()) {
83
83
  if (!result[contract]) {
@@ -86,7 +86,7 @@ class RewardConvex {
86
86
  rewards: {},
87
87
  calls: [
88
88
  {
89
- target: adapter,
89
+ target: contractAddress,
90
90
  callData,
91
91
  },
92
92
  ],
@@ -20,12 +20,12 @@ describe("RewardConvex test", () => {
20
20
  };
21
21
  const expectedResult = [
22
22
  {
23
- adapter: ADAPTER_CONVEX_3CRV_POOL,
24
23
  contract: "CONVEX_3CRV_POOL",
24
+ contractAddress: contracts_1.contractsByNetwork.Mainnet.CONVEX_3CRV_POOL,
25
25
  },
26
26
  {
27
- adapter: ADAPTER_CONVEX_FRAX3CRV_POOL,
28
27
  contract: "CONVEX_FRAX3CRV_POOL",
28
+ contractAddress: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
29
29
  },
30
30
  ];
31
31
  const result = rewardConvex_1.RewardConvex.findAdapters(cm);
@@ -41,13 +41,13 @@ describe("RewardConvex test", () => {
41
41
  };
42
42
  const calls = [
43
43
  {
44
- address: ADAPTER_CONVEX_3CRV_POOL,
44
+ address: contracts_1.contractsByNetwork.Mainnet.CONVEX_3CRV_POOL,
45
45
  interface: rewardConvex_1.RewardConvex.poolInterface,
46
46
  method: "earned(address)",
47
47
  params: [CREDIT_ACCOUNT],
48
48
  },
49
49
  {
50
- address: ADAPTER_CONVEX_FRAX3CRV_POOL,
50
+ address: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
51
51
  interface: rewardConvex_1.RewardConvex.poolInterface,
52
52
  method: "earned(address)",
53
53
  params: [CREDIT_ACCOUNT],
@@ -62,17 +62,17 @@ describe("RewardConvex test", () => {
62
62
  ];
63
63
  const distribution = [
64
64
  {
65
- adapter: ADAPTER_CONVEX_3CRV_POOL,
65
+ contractAddress: contracts_1.contractsByNetwork.Mainnet.CONVEX_3CRV_POOL,
66
66
  contract: "CONVEX_3CRV_POOL",
67
67
  token: "CRV",
68
68
  },
69
69
  {
70
- adapter: ADAPTER_CONVEX_FRAX3CRV_POOL,
70
+ contractAddress: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
71
71
  contract: "CONVEX_FRAX3CRV_POOL",
72
72
  token: "CRV",
73
73
  },
74
74
  {
75
- adapter: ADAPTER_CONVEX_FRAX3CRV_POOL,
75
+ contractAddress: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
76
76
  contract: "CONVEX_FRAX3CRV_POOL",
77
77
  token: "FXS",
78
78
  },
@@ -82,23 +82,23 @@ describe("RewardConvex test", () => {
82
82
  });
83
83
  it("parseResults parse data correctly", () => {
84
84
  const rewards = [
85
- ethers_1.BigNumber.from(1000),
86
- ethers_1.BigNumber.from(2000),
87
- ethers_1.BigNumber.from(4000),
85
+ ethers_1.BigNumber.from(1000n),
86
+ ethers_1.BigNumber.from(2000n),
87
+ ethers_1.BigNumber.from(4000n),
88
88
  ];
89
89
  const distribution = [
90
90
  {
91
- adapter: ADAPTER_CONVEX_3CRV_POOL,
91
+ contractAddress: contracts_1.contractsByNetwork.Mainnet.CONVEX_3CRV_POOL,
92
92
  contract: "CONVEX_3CRV_POOL",
93
93
  token: "CRV",
94
94
  },
95
95
  {
96
- adapter: ADAPTER_CONVEX_FRAX3CRV_POOL,
96
+ contractAddress: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
97
97
  contract: "CONVEX_FRAX3CRV_POOL",
98
98
  token: "CRV",
99
99
  },
100
100
  {
101
- adapter: ADAPTER_CONVEX_FRAX3CRV_POOL,
101
+ contractAddress: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
102
102
  contract: "CONVEX_FRAX3CRV_POOL",
103
103
  token: "FXS",
104
104
  },
@@ -113,7 +113,7 @@ describe("RewardConvex test", () => {
113
113
  },
114
114
  calls: [
115
115
  {
116
- target: ADAPTER_CONVEX_3CRV_POOL,
116
+ target: contracts_1.contractsByNetwork.Mainnet.CONVEX_3CRV_POOL,
117
117
  callData,
118
118
  },
119
119
  ],
@@ -126,7 +126,7 @@ describe("RewardConvex test", () => {
126
126
  },
127
127
  calls: [
128
128
  {
129
- target: ADAPTER_CONVEX_FRAX3CRV_POOL,
129
+ target: contracts_1.contractsByNetwork.Goerli.CONVEX_FRAX3CRV_POOL,
130
130
  callData,
131
131
  },
132
132
  ],
@@ -86,7 +86,12 @@ function toSignificant(num, decimals) {
86
86
  return number.toSignificantDigits(6, 4).toString();
87
87
  }
88
88
  exports.toSignificant = toSignificant;
89
- const toBigInt = (v) => BigInt(v.toString());
89
+ const toBigInt = (v) => {
90
+ const value = typeof v === "object" && v.type === "BigNumber"
91
+ ? v.hex
92
+ : v.toString();
93
+ return BigInt(value);
94
+ };
90
95
  exports.toBigInt = toBigInt;
91
96
  function toBN(num, decimals) {
92
97
  if (num === "")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "1.23.0",
3
+ "version": "1.23.2",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@types/deep-eql": "^4.0.0",
28
- "axios": "^1.2.0",
28
+ "axios": "^1.2.6",
29
29
  "decimal.js-light": "^2.5.1",
30
30
  "deep-eql": "^4.1.0",
31
31
  "moment": "^2.29.4"