impermax-sdk 2.1.61 → 2.1.63

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.
@@ -189,6 +189,9 @@ exports.AMM_FACTORY = {
189
189
  [types_1.Networks.Real]: {
190
190
  [Amms.pearl]: '0x2B965fDf04f9e9bEEf1659464Ef3A0094A68D923',
191
191
  [Amms.pearlStable]: '0x28E22D8c807b6E6c0ECa4373fC3B9920453cEEEe',
192
+ },
193
+ [types_1.Networks.Sonic]: {
194
+ [Amms.equalizer]: '0xDDD9845Ba0D8f38d3045f804f67A1a8B9A528FcC',
192
195
  }
193
196
  };
194
197
  function getAmmByFactory(network, address) {
@@ -261,6 +264,7 @@ exports.AMM_SUBGRAPH_URLS = {
261
264
  [types_1.Networks.Scroll]: {},
262
265
  [types_1.Networks.Real]: {},
263
266
  [types_1.Networks.Optimism]: {},
267
+ [types_1.Networks.Sonic]: {},
264
268
  };
265
269
  exports.ADD_LIQUIDITY_URLS = {
266
270
  [types_1.Networks.Ropsten]: {
@@ -346,6 +350,10 @@ exports.ADD_LIQUIDITY_URLS = {
346
350
  [types_1.Networks.Real]: {
347
351
  [Amms.pearlStable]: 'https://www.pearl.exchange/supply-liquidity/v2/',
348
352
  [Amms.pearl]: 'https://www.pearl.exchange/supply-liquidity/v2/',
353
+ },
354
+ [types_1.Networks.Sonic]: {
355
+ [Amms.pearlStable]: 'https://www.pearl.exchange/supply-liquidity/v2/',
356
+ [Amms.pearl]: 'https://www.pearl.exchange/supply-liquidity/v2/',
349
357
  }
350
358
  };
351
359
  exports.AMM_LP_FEE = {
@@ -432,5 +440,8 @@ exports.AMM_LP_FEE = {
432
440
  [types_1.Networks.Real]: {
433
441
  [Amms.pearlStable]: 0,
434
442
  [Amms.pearl]: 0,
443
+ },
444
+ [types_1.Networks.Sonic]: {
445
+ [Amms.equalizer]: 0
435
446
  }
436
447
  };
@@ -23,4 +23,5 @@ exports.CHAIN_IDS = {
23
23
  [types_1.Networks.Blast]: 81457,
24
24
  [types_1.Networks.Real]: 111188,
25
25
  [types_1.Networks.Optimism]: 10,
26
+ [types_1.Networks.Sonic]: 146
26
27
  };
@@ -23,4 +23,5 @@ exports.CLAIM_AGGREGATOR = {
23
23
  [types_1.Networks.Scroll]: '',
24
24
  [types_1.Networks.Optimism]: '',
25
25
  [types_1.Networks.Real]: '',
26
+ [types_1.Networks.Sonic]: '',
26
27
  };
@@ -24,4 +24,5 @@ exports.IMPERMAX_CHEF = {
24
24
  [types_1.Networks.Scroll]: '',
25
25
  [types_1.Networks.Optimism]: '',
26
26
  [types_1.Networks.Real]: '',
27
+ [types_1.Networks.Sonic]: '',
27
28
  };
@@ -23,4 +23,5 @@ exports.IMPERMAX_CONFIG_MANAGER = {
23
23
  [types_1.Networks.Mantle]: '0x6daC1AbEA1E903765358EFD4Ac4e6E817F78F4CB',
24
24
  [types_1.Networks.Optimism]: '0xC8301bD3f86e642904aeD9b588cA9d9350b3B160',
25
25
  [types_1.Networks.Real]: '0x274C36c461C02B39a110A0801EbB218eC076B79B',
26
+ [types_1.Networks.Sonic]: '0x1A3e33E38D2e70D43f65772f63c5B3f52073b37E',
26
27
  };
@@ -66,6 +66,9 @@ exports.IMPERMAX_FACTORY = {
66
66
  [types_1.Networks.Optimism]: {
67
67
  [types_1.Factory.SOLV2]: '0xa058Ba91958cD30D44c7B0Cf58A369876Fb70B05',
68
68
  },
69
+ [types_1.Networks.Sonic]: {
70
+ [types_1.Factory.SOLV2]: '0x26fca5916c20D252feEF7A58E39886d3d3112b91',
71
+ },
69
72
  };
70
73
  function getFactoryByAddress(network, address) {
71
74
  if (!address)
@@ -23,4 +23,5 @@ exports.IMX = {
23
23
  [types_1.Networks.Scroll]: '',
24
24
  [types_1.Networks.Optimism]: '',
25
25
  [types_1.Networks.Real]: '',
26
+ [types_1.Networks.Sonic]: ''
26
27
  };
@@ -23,4 +23,5 @@ exports.LENDING_VAULT_WATCHER = {
23
23
  [types_1.Networks.Scroll]: '0x0774eBA9e1b20B0f191AbC59a5798838F4bd938c',
24
24
  [types_1.Networks.Optimism]: '',
25
25
  [types_1.Networks.Real]: '',
26
+ [types_1.Networks.Sonic]: '0x0680AD510475844a0555914FD38979B31FdA3b2f',
26
27
  };
@@ -23,6 +23,7 @@ exports.MERKLE_DISTRIBUTOR_IBEX = {
23
23
  [types_1.Networks.Scroll]: '',
24
24
  [types_1.Networks.Optimism]: '',
25
25
  [types_1.Networks.Real]: '',
26
+ [types_1.Networks.Sonic]: '',
26
27
  };
27
28
  exports.MERKLE_DISTRIBUTOR_IBEX_2 = {
28
29
  [types_1.Networks.Polygon]: '0x1c813cDd6dAecE2CB83C52F0798504e42816E9C5',
@@ -45,6 +46,7 @@ exports.MERKLE_DISTRIBUTOR_IBEX_2 = {
45
46
  [types_1.Networks.Scroll]: '',
46
47
  [types_1.Networks.Optimism]: '',
47
48
  [types_1.Networks.Real]: '',
49
+ [types_1.Networks.Sonic]: '',
48
50
  };
49
51
  exports.MERKLE_DISTRIBUTOR_ETH = {
50
52
  [types_1.Networks.Polygon]: '0x7ce2f634f0698ecdca051ef1dc4be96ef3d05a62',
@@ -67,4 +69,5 @@ exports.MERKLE_DISTRIBUTOR_ETH = {
67
69
  [types_1.Networks.Scroll]: '',
68
70
  [types_1.Networks.Optimism]: '',
69
71
  [types_1.Networks.Real]: '',
72
+ [types_1.Networks.Sonic]: '',
70
73
  };
@@ -23,6 +23,7 @@ exports.POOL_TOKEN_ROUTER = {
23
23
  [types_1.Networks.Real]: '0x3784D354863fe8862d60E446E3f29A08c21D1Ea9',
24
24
  [types_1.Networks.Mantle]: '0xF4A9dda025e65945E7A3F873D6146A12c8110A19',
25
25
  [types_1.Networks.Optimism]: '0xb5657FA5ba87CaD11b9150c319069625d423aaD4',
26
+ [types_1.Networks.Sonic]: '0x35A0e3C5adbddF6D917353f9b468C5cdE80ee380' // '0xcBdf792456367a91708C0036E0678eCFB1f09654',
26
27
  };
27
28
  exports.ROUTER = {
28
29
  [types_1.Networks.Ropsten]: {
@@ -91,6 +92,9 @@ exports.ROUTER = {
91
92
  [types_1.Factory.SOLV2]: '0x64515b2f866Ac9B1297f03329d82a8507332fEf5',
92
93
  [types_1.Factory.SOL_STABLE]: '0x3784D354863fe8862d60E446E3f29A08c21D1Ea9'
93
94
  },
95
+ [types_1.Networks.Sonic]: {
96
+ [types_1.Factory.SOLV2]: '0xcBdf792456367a91708C0036E0678eCFB1f09654',
97
+ }
94
98
  };
95
99
  exports.ROUTER_V3 = {
96
100
  [types_1.Networks.Ropsten]: {},
@@ -115,4 +119,5 @@ exports.ROUTER_V3 = {
115
119
  [types_1.Networks.Optimism]: {},
116
120
  [types_1.Networks.Mantle]: {},
117
121
  [types_1.Networks.Real]: {},
122
+ [types_1.Networks.Sonic]: {}
118
123
  };
@@ -46,4 +46,5 @@ exports.SIMPLE_UNISWAP_ORACLE = {
46
46
  [types_1.Networks.Mantle]: {
47
47
  [types_1.Factory.V2V2]: '0x936c30E14daED88fd29bf4FCe2965EbEDe633846'
48
48
  },
49
+ [types_1.Networks.Sonic]: {},
49
50
  };
@@ -23,5 +23,6 @@ exports.WETH = {
23
23
  [types_1.Networks.Mantle]: '0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8',
24
24
  [types_1.Networks.Scroll]: '0x5300000000000000000000000000000000000004',
25
25
  [types_1.Networks.Optimism]: '0x4200000000000000000000000000000000000006',
26
- [types_1.Networks.Real]: '0x90c6E93849E06EC7478ba24522329d14A5954Df4', // reETH
26
+ [types_1.Networks.Real]: '0x90c6E93849E06EC7478ba24522329d14A5954Df4',
27
+ [types_1.Networks.Sonic]: '0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38', // ws
27
28
  };
@@ -23,4 +23,5 @@ exports.DEBANK_IDS = {
23
23
  [types_1.Networks.Scroll]: 'scrl',
24
24
  [types_1.Networks.Optimism]: 'op',
25
25
  [types_1.Networks.Real]: 'real',
26
+ [types_1.Networks.Sonic]: 'sonic'
26
27
  };
@@ -23,6 +23,7 @@ exports.MERKLE_URL_IBEX = {
23
23
  [types_1.Networks.Scroll]: '',
24
24
  [types_1.Networks.Optimism]: '',
25
25
  [types_1.Networks.Real]: '',
26
+ [types_1.Networks.Sonic]: '',
26
27
  };
27
28
  exports.MERKLE_URL_IBEX_2 = {
28
29
  [types_1.Networks.Polygon]: 'https://misty-rice-9880.impermax.workers.dev',
@@ -45,6 +46,7 @@ exports.MERKLE_URL_IBEX_2 = {
45
46
  [types_1.Networks.Scroll]: '',
46
47
  [types_1.Networks.Optimism]: '',
47
48
  [types_1.Networks.Real]: '',
49
+ [types_1.Networks.Sonic]: '',
48
50
  };
49
51
  exports.MERKLE_URL_ETH = {
50
52
  [types_1.Networks.Polygon]: 'https://damp-hill-13d0.impermax.workers.dev',
@@ -67,4 +69,5 @@ exports.MERKLE_URL_ETH = {
67
69
  [types_1.Networks.Scroll]: '',
68
70
  [types_1.Networks.Optimism]: '',
69
71
  [types_1.Networks.Real]: '',
72
+ [types_1.Networks.Sonic]: '',
70
73
  };
package/lib/config/eth.js CHANGED
@@ -23,6 +23,7 @@ exports.ETH_NAME = {
23
23
  [types_1.Networks.Scroll]: 'Ethereum',
24
24
  [types_1.Networks.Optimism]: 'Ethereum',
25
25
  [types_1.Networks.Real]: 'Ethereum',
26
+ [types_1.Networks.Sonic]: 'S'
26
27
  };
27
28
  exports.ETH_SYMBOL = {
28
29
  [types_1.Networks.Ropsten]: 'ETH',
@@ -45,4 +46,5 @@ exports.ETH_SYMBOL = {
45
46
  [types_1.Networks.Scroll]: 'ETH',
46
47
  [types_1.Networks.Optimism]: 'ETH',
47
48
  [types_1.Networks.Real]: 'reETH',
49
+ [types_1.Networks.Sonic]: 'S'
48
50
  };
@@ -192,7 +192,8 @@ exports.STAKED_LP_FACTORY = {
192
192
  [types_1.Networks.Real]: {
193
193
  [Farms.pearl]: '0x2B965fDf04f9e9bEEf1659464Ef3A0094A68D923',
194
194
  [Farms.pearlStable]: '0x28E22D8c807b6E6c0ECa4373fC3B9920453cEEEe',
195
- }
195
+ },
196
+ [types_1.Networks.Sonic]: {}
196
197
  };
197
198
  function getFarmByStakedLPFactory(network, address) {
198
199
  if (!address)
@@ -29,6 +29,7 @@ exports.IMPERMAX_POOLS_API = {
29
29
  [types_1.Networks.Optimism]: {},
30
30
  [types_1.Networks.Real]: {},
31
31
  [types_1.Networks.Blast]: {},
32
+ [types_1.Networks.Sonic]: {},
32
33
  };
33
34
  // For lending pools
34
35
  exports.IMPERMAX_VAULT_API = {
@@ -58,5 +59,6 @@ exports.IMPERMAX_VAULT_API = {
58
59
  [types_1.Networks.Blast]: {
59
60
  [types_1.VaultType.LENDING]: "https://blast-lendingvaults-production.up.railway.app/vaults/"
60
61
  },
62
+ [types_1.Networks.Sonic]: {},
61
63
  };
62
64
  // Add more here
@@ -24,6 +24,7 @@ export declare const CONFIG_MANAGER_SUBGRAPH_URL: {
24
24
  base: string;
25
25
  optimism: string;
26
26
  "re.al": string;
27
+ sonic: string;
27
28
  };
28
29
  export declare const WHITELIST_SUBGRAPH_URL: {
29
30
  ropsten: string;
@@ -129,6 +129,12 @@ exports.IMPERMAX_SUBGRAPH_URL = {
129
129
  "https://api.goldsky.com/api/public/project_cm2rhb30ot9wu01to8c9h9e37/subgraphs/impermax-real-solv2/3.0/gn",
130
130
  ],
131
131
  },
132
+ [types_1.Networks.Sonic]: {
133
+ [types_1.Factory.SOLV2]: [
134
+ 'https://sonic-factory-production.up.railway.app/',
135
+ 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/HK9BA4oFp1xaoQW7YVP4m2nbxX7q2bQCZWNPKBtudtZR'
136
+ ]
137
+ }
132
138
  };
133
139
  // TODO: Since these are part of core we should add redundancy like above, left arrays to fill
134
140
  exports.VAULT_SUBGRAPH_URL = {
@@ -185,6 +191,11 @@ exports.VAULT_SUBGRAPH_URL = {
185
191
  [types_1.VaultType.HEDGED]: [],
186
192
  [types_1.VaultType.LEVERAGED]: [],
187
193
  },
194
+ [types_1.Networks.Sonic]: {
195
+ [types_1.VaultType.LENDING]: [
196
+ "https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/AHj91C4xwYSfyHAnZiMa1pC4ZwRtzqG3QGVyJchEsJAC"
197
+ ]
198
+ }
188
199
  };
189
200
  exports.IMPERMAX_CHEF_SUBGRAPH_URL = {
190
201
  [types_1.Networks.Ropsten]: "",
@@ -208,6 +219,7 @@ exports.IMPERMAX_CHEF_SUBGRAPH_URL = {
208
219
  [types_1.Networks.Scroll]: "",
209
220
  [types_1.Networks.Optimism]: "",
210
221
  [types_1.Networks.Real]: "",
222
+ [types_1.Networks.Sonic]: "",
211
223
  };
212
224
  exports.BLOCKS_SUBGRAPH_URL = {
213
225
  [types_1.Networks.Ropsten]: "",
@@ -230,6 +242,7 @@ exports.BLOCKS_SUBGRAPH_URL = {
230
242
  [types_1.Networks.Scroll]: "",
231
243
  [types_1.Networks.Real]: "",
232
244
  [types_1.Networks.Optimism]: "",
245
+ [types_1.Networks.Sonic]: "",
233
246
  };
234
247
  exports.XIMX_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/impermax-finance/imx-staking";
235
248
  exports.CONFIG_MANAGER_SUBGRAPH_URL = {
@@ -252,6 +265,7 @@ exports.CONFIG_MANAGER_SUBGRAPH_URL = {
252
265
  [types_1.Networks.Base]: "https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/6y4Bb2KSFsqyjbARM8EpKkqFRt62ELasVCVckg2bv7jB",
253
266
  [types_1.Networks.Optimism]: "https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/GWFrv8MNg5fpD19fxdu32G1Wt6om8qb1wbacpgHDyvC8",
254
267
  [types_1.Networks.Real]: "https://api.goldsky.com/api/public/project_cm2d5q4l4w31601vz4swb3vmi/subgraphs/impermax-config-manager-real/1.0/gn",
268
+ [types_1.Networks.Sonic]: "https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/DqzQAecRNGsoRgwVre16Fha9XTPFf9QBo8iZxubysy2x"
255
269
  };
256
270
  exports.WHITELIST_SUBGRAPH_URL = {
257
271
  [types_1.Networks.Ropsten]: "",
@@ -19,7 +19,8 @@ export declare enum Networks {
19
19
  Mantle = "mantle",
20
20
  Scroll = "scroll",
21
21
  Optimism = "optimism",
22
- Real = "re.al"
22
+ Real = "re.al",
23
+ Sonic = "sonic"
23
24
  }
24
25
  export declare enum Factory {
25
26
  V2V1 = "1",
@@ -23,6 +23,7 @@ var Networks;
23
23
  Networks["Scroll"] = "scroll";
24
24
  Networks["Optimism"] = "optimism";
25
25
  Networks["Real"] = "re.al";
26
+ Networks["Sonic"] = "sonic";
26
27
  })(Networks = exports.Networks || (exports.Networks = {}));
27
28
  // FACTORIES
28
29
  var Factory;
@@ -12,15 +12,18 @@ export interface LeveragedPositionsParams {
12
12
  export declare enum SupplyPositionsOrderBy {
13
13
  TVL = 0
14
14
  }
15
- export interface SupplyPositionsParams {
16
- networks?: Array<Networks>;
17
- }
18
15
  export declare enum VaultPositionsOrderBy {
19
16
  TVL = 0
20
17
  }
18
+ export interface SupplyPositionsParams {
19
+ networks?: Array<Networks>;
20
+ }
21
21
  export interface VaultPositionsParams {
22
22
  networks?: Array<Networks>;
23
23
  }
24
+ export interface TopPositionsParams extends SupplyPositionsParams, VaultPositionsParams {
25
+ limit?: number;
26
+ }
24
27
  export declare enum PositionType {
25
28
  MARKET = "Market",
26
29
  VAULT = "Vault",
@@ -45,9 +48,9 @@ export default class OffchainMultichainAccount {
45
48
  getLeveragedPositions(params?: LeveragedPositionsParams, orderBy?: LeveragedPositionsOrderBy): Promise<Array<OffchainLeveragedPosition>>;
46
49
  getSupplyPositions(params?: SupplyPositionsParams, orderBy?: SupplyPositionsOrderBy): Promise<Array<OffchainAccountLendingPool>>;
47
50
  getVaultPositions(params?: VaultPositionsParams, orderBy?: VaultPositionsOrderBy): Promise<Array<OffchainAccountVault>>;
51
+ getTopPositions(params?: TopPositionsParams): Promise<Array<AccountPosition>>;
48
52
  getTotalBalanceUSD(): Promise<number>;
49
53
  getVaultsBalanceUSD(): Promise<number>;
50
54
  getSupplyBalanceUSD(): Promise<number>;
51
- getTopPositions(limit?: number): Promise<Array<AccountPosition>>;
52
55
  getNetAPR(): Promise<number>;
53
56
  }
@@ -51,8 +51,9 @@ class OffchainMultichainAccount {
51
51
  }
52
52
  // Easier to return the lending pool object instead of borrowable?
53
53
  getSupplyPositions(params = {}, orderBy = SupplyPositionsOrderBy.TVL) {
54
+ var _a;
54
55
  return __awaiter(this, void 0, void 0, function* () {
55
- const allNetworks = params.networks || Object.values(types_1.Networks);
56
+ const allNetworks = (_a = params.networks) !== null && _a !== void 0 ? _a : Object.values(types_1.Networks);
56
57
  // Get user supply positions in each network
57
58
  const networkPromises = allNetworks.map((network) => __awaiter(this, void 0, void 0, function* () {
58
59
  const offchainAccount = this.getOffchainAccount(network);
@@ -75,8 +76,9 @@ class OffchainMultichainAccount {
75
76
  });
76
77
  }
77
78
  getVaultPositions(params = {}, orderBy = VaultPositionsOrderBy.TVL) {
79
+ var _a;
78
80
  return __awaiter(this, void 0, void 0, function* () {
79
- const allNetworks = params.networks || Object.values(types_1.Networks);
81
+ const allNetworks = (_a = params.networks) !== null && _a !== void 0 ? _a : Object.values(types_1.Networks);
80
82
  const networksWithVaults = allNetworks.filter((network) => this.offchainMultichain.networkHasVault(network));
81
83
  // Get user positions in each network
82
84
  const networkPromises = networksWithVaults.map((network) => __awaiter(this, void 0, void 0, function* () {
@@ -98,42 +100,14 @@ class OffchainMultichainAccount {
98
100
  return results.flat();
99
101
  });
100
102
  }
101
- // Account stats
102
- getTotalBalanceUSD() {
103
- return __awaiter(this, void 0, void 0, function* () {
104
- const [vaultBalanceUSD, supplyBalanceUSD] = yield Promise.all([
105
- this.getVaultsBalanceUSD(),
106
- this.getSupplyBalanceUSD(),
107
- ]);
108
- return vaultBalanceUSD + supplyBalanceUSD;
109
- });
110
- }
111
- getVaultsBalanceUSD() {
112
- return __awaiter(this, void 0, void 0, function* () {
113
- const vaultPositions = yield this.getVaultPositions();
114
- const depositedValue = yield Promise.all(vaultPositions.map((i) => i.getValue()));
115
- return depositedValue.reduce((acc, val) => acc + val, 0);
116
- });
117
- }
118
- getSupplyBalanceUSD() {
119
- return __awaiter(this, void 0, void 0, function* () {
120
- const supplyPositions = yield this.getSupplyPositions();
121
- const suppliedValue = yield Promise.all(supplyPositions.map((pool) => __awaiter(this, void 0, void 0, function* () {
122
- const [valueA, valueB] = yield Promise.all([
123
- pool.getBorrowableA().getValue(),
124
- pool.getBorrowableB().getValue(),
125
- ]);
126
- return valueA + valueB;
127
- })));
128
- return suppliedValue.reduce((acc, val) => acc + val, 0);
129
- });
130
- }
131
103
  // Gets the top positions for a user
132
- getTopPositions(limit = 10) {
104
+ getTopPositions(params = {}) {
105
+ var _a;
133
106
  return __awaiter(this, void 0, void 0, function* () {
107
+ const limit = (_a = params.limit) !== null && _a !== void 0 ? _a : 10;
134
108
  const [supplyPositions, vaultPositions] = yield Promise.all([
135
- this.getSupplyPositions(),
136
- this.getVaultPositions(),
109
+ this.getSupplyPositions(params),
110
+ this.getVaultPositions(params),
137
111
  ]);
138
112
  // Lending Market positions
139
113
  const supplyValues = yield Promise.all(supplyPositions.map((pool) => __awaiter(this, void 0, void 0, function* () {
@@ -144,7 +118,7 @@ class OffchainMultichainAccount {
144
118
  pool.getBorrowableB().getPoolToken().getSymbol(),
145
119
  pool.getLendingPool().getOffchain().network,
146
120
  pool.getLendingPool().getLendingPoolData(),
147
- pool.getLendingPool().getFactory()
121
+ pool.getLendingPool().getFactory(),
148
122
  ]);
149
123
  const totalValue = valueA + valueB;
150
124
  return {
@@ -153,7 +127,7 @@ class OffchainMultichainAccount {
153
127
  type: PositionType.MARKET,
154
128
  network: network,
155
129
  id: data.id,
156
- factory: factory
130
+ factory: factory,
157
131
  };
158
132
  })));
159
133
  // Vault positions
@@ -162,7 +136,7 @@ class OffchainMultichainAccount {
162
136
  vault.getValue(),
163
137
  vault.getPoolToken().getSymbol(),
164
138
  vault.getPoolToken().getOffchain().network,
165
- vault.getPoolToken().getPoolTokenData()
139
+ vault.getPoolToken().getPoolTokenData(),
166
140
  ]);
167
141
  return {
168
142
  name: symbol,
@@ -170,7 +144,7 @@ class OffchainMultichainAccount {
170
144
  type: PositionType.VAULT,
171
145
  network: network,
172
146
  id: data.id,
173
- factory: undefined
147
+ factory: undefined,
174
148
  };
175
149
  })));
176
150
  const allPositions = [...supplyValues, ...vaultValues].sort((a, b) => b.value - a.value);
@@ -178,7 +152,7 @@ class OffchainMultichainAccount {
178
152
  if (allPositions.length <= limit || limit <= 1) {
179
153
  return allPositions.map((pos) => (Object.assign(Object.assign({}, pos), { percentage: (pos.value / totalValue) * 100 })));
180
154
  }
181
- // Top N-1 positions and calculate "Other"
155
+ // Top N-1 positions and calculate "Other"
182
156
  const topNMinusOne = allPositions.slice(0, limit - 1);
183
157
  const remainingPositions = allPositions.slice(limit - 1);
184
158
  const remainingValue = remainingPositions.reduce((sum, pos) => sum + pos.value, 0);
@@ -190,12 +164,42 @@ class OffchainMultichainAccount {
190
164
  type: PositionType.OTHER,
191
165
  network: types_1.Networks.Mainnet,
192
166
  id: "",
193
- factory: undefined
167
+ factory: undefined,
194
168
  },
195
169
  ].map((pos) => (Object.assign(Object.assign({}, pos), { percentage: (pos.value / totalValue) * 100 })));
196
170
  return result;
197
171
  });
198
172
  }
173
+ // Account stats
174
+ getTotalBalanceUSD() {
175
+ return __awaiter(this, void 0, void 0, function* () {
176
+ const [vaultBalanceUSD, supplyBalanceUSD] = yield Promise.all([
177
+ this.getVaultsBalanceUSD(),
178
+ this.getSupplyBalanceUSD(),
179
+ ]);
180
+ return vaultBalanceUSD + supplyBalanceUSD;
181
+ });
182
+ }
183
+ getVaultsBalanceUSD() {
184
+ return __awaiter(this, void 0, void 0, function* () {
185
+ const vaultPositions = yield this.getVaultPositions();
186
+ const depositedValue = yield Promise.all(vaultPositions.map((i) => i.getValue()));
187
+ return depositedValue.reduce((acc, val) => acc + val, 0);
188
+ });
189
+ }
190
+ getSupplyBalanceUSD() {
191
+ return __awaiter(this, void 0, void 0, function* () {
192
+ const supplyPositions = yield this.getSupplyPositions();
193
+ const suppliedValue = yield Promise.all(supplyPositions.map((pool) => __awaiter(this, void 0, void 0, function* () {
194
+ const [valueA, valueB] = yield Promise.all([
195
+ pool.getBorrowableA().getValue(),
196
+ pool.getBorrowableB().getValue(),
197
+ ]);
198
+ return valueA + valueB;
199
+ })));
200
+ return suppliedValue.reduce((acc, val) => acc + val, 0);
201
+ });
202
+ }
199
203
  getNetAPR() {
200
204
  return __awaiter(this, void 0, void 0, function* () {
201
205
  return 1;
@@ -31,6 +31,7 @@ const LlamaChains = {
31
31
  [types_1.Networks.Optimism]: "optimism",
32
32
  [types_1.Networks.Real]: "re.al",
33
33
  [types_1.Networks.Blast]: "blast",
34
+ [types_1.Networks.Sonic]: "sonic",
34
35
  };
35
36
  // Class to get the APR from DefiLlama directly, only makes 1 call to api and caches all pools
36
37
  class OffchainAPRHelper {
@@ -468,15 +468,16 @@ function initializeTvlData() {
468
468
  types_1.Networks.Arbitrum,
469
469
  types_1.Networks.Polygon,
470
470
  types_1.Networks.Avalanche,
471
- // Networks.Moonriver,
472
471
  types_1.Networks.Fantom,
472
+ // Networks.Moonriver,
473
473
  // Networks.Canto,
474
- types_1.Networks.ZksyncEra,
475
474
  // Networks.Mantle,
475
+ types_1.Networks.ZksyncEra,
476
476
  types_1.Networks.Base,
477
477
  types_1.Networks.Scroll,
478
478
  types_1.Networks.Real,
479
479
  types_1.Networks.Blast,
480
+ types_1.Networks.Sonic
480
481
  ]; // exclude ropsten
481
482
  const calls = [];
482
483
  for (const network of networks) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.61",
3
+ "version": "2.1.63",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",