@suilend/sdk 1.1.85 → 1.1.86

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.
Files changed (31) hide show
  1. package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +7 -11
  2. package/_generated/_dependencies/source/0x1/option/structs.d.ts +4 -6
  3. package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +6 -10
  4. package/_generated/_dependencies/source/0x2/bag/structs.d.ts +8 -15
  5. package/_generated/_dependencies/source/0x2/balance/structs.d.ts +6 -10
  6. package/_generated/_dependencies/source/0x2/object/structs.d.ts +8 -14
  7. package/_generated/_dependencies/source/0x2/object-table/structs.d.ts +8 -15
  8. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.d.ts +4 -7
  9. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.d.ts +12 -23
  10. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.d.ts +30 -58
  11. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +4 -6
  12. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.d.ts +75 -146
  13. package/_generated/_framework/util.d.ts +4 -16
  14. package/_generated/_framework/vector.d.ts +12 -5
  15. package/_generated/suilend/cell/structs.d.ts +6 -10
  16. package/_generated/suilend/decimal/structs.d.ts +3 -5
  17. package/_generated/suilend/lending-market/structs.d.ts +392 -368
  18. package/_generated/suilend/liquidity-mining/structs.d.ts +160 -134
  19. package/_generated/suilend/obligation/structs.d.ts +217 -332
  20. package/_generated/suilend/rate-limiter/structs.d.ts +17 -32
  21. package/_generated/suilend/reserve/structs.d.ts +393 -383
  22. package/_generated/suilend/reserve-config/structs.d.ts +40 -76
  23. package/client.d.ts +1 -1
  24. package/client.js +2 -2
  25. package/lib/initialize.d.ts +1 -2
  26. package/lib/initialize.js +62 -54
  27. package/lib/strategyOwnerCap.js +24 -16
  28. package/lib/types.d.ts +0 -1
  29. package/package.json +1 -1
  30. package/parsers/lendingMarket.d.ts +0 -1
  31. package/parsers/lendingMarket.js +2 -3
@@ -61,65 +61,38 @@ export declare class ReserveConfig implements StructClass {
61
61
  static get r(): reified.StructClassReified<ReserveConfig, ReserveConfigFields>;
62
62
  static phantom(): PhantomReified<ToTypeStr<ReserveConfig>>;
63
63
  static get p(): reified.PhantomReified<"0x1f54a9a2d71799553197e9ea24557797c6398d6a65f2d4d3818c9304b75d5e21::reserve_config::ReserveConfig" | "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::reserve_config::ReserveConfig">;
64
- static get bcs(): import("@mysten/sui/bcs").BcsType<{
65
- open_ltv_pct: number;
66
- close_ltv_pct: number;
67
- max_close_ltv_pct: number;
68
- borrow_weight_bps: string;
69
- deposit_limit: string;
70
- borrow_limit: string;
71
- liquidation_bonus_bps: string;
72
- max_liquidation_bonus_bps: string;
73
- deposit_limit_usd: string;
74
- borrow_limit_usd: string;
75
- interest_rate_utils: number[];
76
- interest_rate_aprs: string[];
77
- borrow_fee_bps: string;
78
- spread_fee_bps: string;
79
- protocol_liquidation_fee_bps: string;
80
- isolated: boolean;
81
- open_attributed_borrow_limit_usd: string;
82
- close_attributed_borrow_limit_usd: string;
83
- additional_fields: {
84
- id: {
85
- id: {
86
- bytes: string;
87
- };
88
- };
89
- size: string;
90
- };
91
- }, {
92
- open_ltv_pct: number;
93
- close_ltv_pct: number;
94
- max_close_ltv_pct: number;
95
- borrow_weight_bps: string | number | bigint;
96
- deposit_limit: string | number | bigint;
97
- borrow_limit: string | number | bigint;
98
- liquidation_bonus_bps: string | number | bigint;
99
- max_liquidation_bonus_bps: string | number | bigint;
100
- deposit_limit_usd: string | number | bigint;
101
- borrow_limit_usd: string | number | bigint;
102
- interest_rate_utils: Iterable<number> & {
64
+ static get bcs(): import("@mysten/sui/bcs").BcsStruct<{
65
+ open_ltv_pct: import("@mysten/sui/bcs").BcsType<number, number, "u8">;
66
+ close_ltv_pct: import("@mysten/sui/bcs").BcsType<number, number, "u8">;
67
+ max_close_ltv_pct: import("@mysten/sui/bcs").BcsType<number, number, "u8">;
68
+ borrow_weight_bps: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
69
+ deposit_limit: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
70
+ borrow_limit: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
71
+ liquidation_bonus_bps: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
72
+ max_liquidation_bonus_bps: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
73
+ deposit_limit_usd: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
74
+ borrow_limit_usd: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
75
+ interest_rate_utils: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
103
76
  length: number;
104
- };
105
- interest_rate_aprs: Iterable<string | number | bigint> & {
77
+ }, string>;
78
+ interest_rate_aprs: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
106
79
  length: number;
107
- };
108
- borrow_fee_bps: string | number | bigint;
109
- spread_fee_bps: string | number | bigint;
110
- protocol_liquidation_fee_bps: string | number | bigint;
111
- isolated: boolean;
112
- open_attributed_borrow_limit_usd: string | number | bigint;
113
- close_attributed_borrow_limit_usd: string | number | bigint;
114
- additional_fields: {
115
- id: {
116
- id: {
117
- bytes: string;
118
- };
119
- };
120
- size: string | number | bigint;
121
- };
122
- }>;
80
+ }, string>;
81
+ borrow_fee_bps: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
82
+ spread_fee_bps: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
83
+ protocol_liquidation_fee_bps: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
84
+ isolated: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
85
+ open_attributed_borrow_limit_usd: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
86
+ close_attributed_borrow_limit_usd: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
87
+ additional_fields: import("@mysten/sui/bcs").BcsStruct<{
88
+ id: import("@mysten/sui/bcs").BcsStruct<{
89
+ id: import("@mysten/sui/bcs").BcsStruct<{
90
+ bytes: import("@mysten/sui/bcs").BcsType<string, string, string>;
91
+ }, string>;
92
+ }, string>;
93
+ size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
94
+ }, string>;
95
+ }, string>;
123
96
  static fromFields(fields: Record<string, any>): ReserveConfig;
124
97
  static fromFieldsWithTypes(item: FieldsWithTypes): ReserveConfig;
125
98
  static fromBcs(data: Uint8Array): ReserveConfig;
@@ -199,25 +172,16 @@ export declare class ReserveConfigBuilder implements StructClass {
199
172
  static get r(): reified.StructClassReified<ReserveConfigBuilder, ReserveConfigBuilderFields>;
200
173
  static phantom(): PhantomReified<ToTypeStr<ReserveConfigBuilder>>;
201
174
  static get p(): reified.PhantomReified<"0x1f54a9a2d71799553197e9ea24557797c6398d6a65f2d4d3818c9304b75d5e21::reserve_config::ReserveConfigBuilder" | "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::reserve_config::ReserveConfigBuilder">;
202
- static get bcs(): import("@mysten/sui/bcs").BcsType<{
203
- fields: {
204
- id: {
205
- id: {
206
- bytes: string;
207
- };
208
- };
209
- size: string;
210
- };
211
- }, {
212
- fields: {
213
- id: {
214
- id: {
215
- bytes: string;
216
- };
217
- };
218
- size: string | number | bigint;
219
- };
220
- }>;
175
+ static get bcs(): import("@mysten/sui/bcs").BcsStruct<{
176
+ fields: import("@mysten/sui/bcs").BcsStruct<{
177
+ id: import("@mysten/sui/bcs").BcsStruct<{
178
+ id: import("@mysten/sui/bcs").BcsStruct<{
179
+ bytes: import("@mysten/sui/bcs").BcsType<string, string, string>;
180
+ }, string>;
181
+ }, string>;
182
+ size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
183
+ }, string>;
184
+ }, string>;
221
185
  static fromFields(fields: Record<string, any>): ReserveConfigBuilder;
222
186
  static fromFieldsWithTypes(item: FieldsWithTypes): ReserveConfigBuilder;
223
187
  static fromBcs(data: Uint8Array): ReserveConfigBuilder;
package/client.d.ts CHANGED
@@ -46,7 +46,7 @@ export declare class SuilendClient {
46
46
  getObligation(obligationId: string): Promise<Obligation<string>>;
47
47
  static getLendingMarketOwnerCapId(ownerId: string, lendingMarketTypeArgs: string[], client: SuiClient): Promise<string | undefined>;
48
48
  getLendingMarketOwnerCapId(ownerId: string): Promise<string | undefined>;
49
- createReserve(lendingMarketOwnerCapId: string, transaction: Transaction, pythPriceId: string, coinType: string, createReserveConfigArgs: CreateReserveConfigArgs): Promise<import("@mysten/sui/transactions").TransactionResult>;
49
+ createReserve(lendingMarketOwnerCapId: string, transaction: Transaction, pythPriceId: string, coinType: string, createReserveConfigArgs: CreateReserveConfigArgs, coinMetadataId?: string): Promise<import("@mysten/sui/transactions").TransactionResult>;
50
50
  addReward(ownerId: string, lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardCoinType: string, rewardValue: string, startTimeMs: bigint, endTimeMs: bigint, transaction: Transaction, mergeCoins?: boolean): Promise<import("@mysten/sui/transactions").TransactionResult>;
51
51
  cancelReward(lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardIndex: bigint, rewardCoinType: string, transaction: Transaction): import("@mysten/sui/transactions").TransactionResult;
52
52
  closeReward(lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardIndex: bigint, rewardCoinType: string, transaction: Transaction): import("@mysten/sui/transactions").TransactionResult;
package/client.js CHANGED
@@ -192,7 +192,7 @@ class SuilendClient {
192
192
  return SuilendClient.getLendingMarketOwnerCapId(ownerId, this.lendingMarket.$typeArgs, this.client);
193
193
  });
194
194
  }
195
- createReserve(lendingMarketOwnerCapId, transaction, pythPriceId, coinType, createReserveConfigArgs) {
195
+ createReserve(lendingMarketOwnerCapId, transaction, pythPriceId, coinType, createReserveConfigArgs, coinMetadataId) {
196
196
  return __awaiter(this, void 0, void 0, function* () {
197
197
  const [config] = (0, functions_4.createReserveConfig)(transaction, createReserveConfigArgs);
198
198
  // Assumes the pyth price feed exists
@@ -211,7 +211,7 @@ class SuilendClient {
211
211
  lendingMarket: transaction.object(this.lendingMarket.id),
212
212
  priceInfo: transaction.object(priceInfoObjectIds[0]),
213
213
  config: transaction.object(config),
214
- coinMetadata: transaction.object(coin_metadata.id),
214
+ coinMetadata: transaction.object(coinMetadataId !== null && coinMetadataId !== void 0 ? coinMetadataId : coin_metadata.id),
215
215
  clock: transaction.object(utils_1.SUI_CLOCK_OBJECT_ID),
216
216
  });
217
217
  });
@@ -4,7 +4,7 @@ import { Reserve } from "../_generated/suilend/reserve/structs";
4
4
  import { SuilendClient } from "../client";
5
5
  import { ParsedReserve } from "../parsers";
6
6
  import { LendingMarketMetadata, StrategyOwnerCap } from "./types";
7
- export declare const RESERVES_CUSTOM_ORDER: string[];
7
+ export declare const RESERVES_CUSTOM_ORDER: Record<string, string[]>;
8
8
  export declare const NORMALIZED_MAYA_COINTYPE: string;
9
9
  export declare const NORMALIZED_mPOINTS_COINTYPE: string;
10
10
  export declare const NORMALIZED_TREATS_COINTYPE: string;
@@ -141,7 +141,6 @@ export declare const initializeSuilend: (suiClient: SuiClient, suilendClient: Su
141
141
  type: string;
142
142
  ownerCapId: string | undefined;
143
143
  name: string;
144
- slug: string;
145
144
  isHidden: boolean;
146
145
  totalSupplyUsd: BigNumber;
147
146
  totalBorrowUsd: BigNumber;
package/lib/initialize.js CHANGED
@@ -55,50 +55,56 @@ const parsers_1 = require("../parsers");
55
55
  const simulate = __importStar(require("../utils/simulate"));
56
56
  const constants_1 = require("./constants");
57
57
  const strategyOwnerCap_1 = require("./strategyOwnerCap");
58
- exports.RESERVES_CUSTOM_ORDER = [
59
- // MAIN ASSETS
60
- sui_fe_1.NORMALIZED_sSUI_COINTYPE,
61
- // MAIN ASSETS - Ecosystem LSTs
62
- sui_fe_1.NORMALIZED_mSUI_COINTYPE,
63
- sui_fe_1.NORMALIZED_fudSUI_COINTYPE,
64
- sui_fe_1.NORMALIZED_kSUI_COINTYPE,
65
- sui_fe_1.NORMALIZED_trevinSUI_COINTYPE,
66
- sui_fe_1.NORMALIZED_upSUI_COINTYPE,
67
- sui_fe_1.NORMALIZED_yapSUI_COINTYPE,
68
- sui_fe_1.NORMALIZED_iSUI_COINTYPE,
69
- sui_fe_1.NORMALIZED_flSUI_COINTYPE,
70
- sui_fe_1.NORMALIZED_oshiSUI_COINTYPE,
71
- sui_fe_1.NORMALIZED_jugSUI_COINTYPE,
72
- sui_fe_1.NORMALIZED_stratSUI_COINTYPE,
73
- sui_fe_1.NORMALIZED_SUI_COINTYPE,
74
- sui_fe_1.NORMALIZED_USDC_COINTYPE,
75
- sui_fe_1.NORMALIZED_wUSDC_COINTYPE,
76
- sui_fe_1.NORMALIZED_suiUSDT_COINTYPE,
77
- sui_fe_1.NORMALIZED_wUSDT_COINTYPE,
78
- sui_fe_1.NORMALIZED_AUSD_COINTYPE,
79
- sui_fe_1.NORMALIZED_LBTC_COINTYPE,
80
- sui_fe_1.NORMALIZED_wBTC_COINTYPE,
81
- sui_fe_1.NORMALIZED_xBTC_COINTYPE,
82
- sui_fe_1.NORMALIZED_suiETH_COINTYPE,
83
- sui_fe_1.NORMALIZED_WETH_COINTYPE,
84
- sui_fe_1.NORMALIZED_SOL_COINTYPE,
85
- sui_fe_1.NORMALIZED_DEEP_COINTYPE,
86
- sui_fe_1.NORMALIZED_WAL_COINTYPE,
87
- // ISOLATED ASSETS
88
- sui_fe_1.NORMALIZED_SEND_COINTYPE,
89
- sui_fe_1.NORMALIZED_IKA_COINTYPE,
90
- sui_fe_1.NORMALIZED_HAEDAL_COINTYPE,
91
- sui_fe_1.NORMALIZED_BLUE_COINTYPE,
92
- sui_fe_1.NORMALIZED_NS_COINTYPE,
93
- sui_fe_1.NORMALIZED_UP_COINTYPE,
94
- sui_fe_1.NORMALIZED_DMC_COINTYPE,
95
- sui_fe_1.NORMALIZED_ALKIMI_COINTYPE,
96
- sui_fe_1.NORMALIZED_KOBAN_COINTYPE,
97
- sui_fe_1.NORMALIZED_mUSD_COINTYPE,
98
- sui_fe_1.NORMALIZED_BUCK_COINTYPE,
99
- sui_fe_1.NORMALIZED_HIPPO_COINTYPE,
100
- sui_fe_1.NORMALIZED_FUD_COINTYPE,
101
- ];
58
+ exports.RESERVES_CUSTOM_ORDER = {
59
+ [client_1.LENDING_MARKET_ID]: [
60
+ // MAIN ASSETS
61
+ sui_fe_1.NORMALIZED_sSUI_COINTYPE,
62
+ // MAIN ASSETS - Ecosystem LSTs
63
+ sui_fe_1.NORMALIZED_mSUI_COINTYPE,
64
+ sui_fe_1.NORMALIZED_fudSUI_COINTYPE,
65
+ sui_fe_1.NORMALIZED_kSUI_COINTYPE,
66
+ sui_fe_1.NORMALIZED_trevinSUI_COINTYPE,
67
+ sui_fe_1.NORMALIZED_upSUI_COINTYPE,
68
+ sui_fe_1.NORMALIZED_yapSUI_COINTYPE,
69
+ sui_fe_1.NORMALIZED_iSUI_COINTYPE,
70
+ sui_fe_1.NORMALIZED_flSUI_COINTYPE,
71
+ sui_fe_1.NORMALIZED_oshiSUI_COINTYPE,
72
+ sui_fe_1.NORMALIZED_jugSUI_COINTYPE,
73
+ sui_fe_1.NORMALIZED_stratSUI_COINTYPE,
74
+ sui_fe_1.NORMALIZED_SUI_COINTYPE,
75
+ sui_fe_1.NORMALIZED_USDC_COINTYPE,
76
+ sui_fe_1.NORMALIZED_wUSDC_COINTYPE,
77
+ sui_fe_1.NORMALIZED_suiUSDT_COINTYPE,
78
+ sui_fe_1.NORMALIZED_wUSDT_COINTYPE,
79
+ sui_fe_1.NORMALIZED_AUSD_COINTYPE,
80
+ sui_fe_1.NORMALIZED_LBTC_COINTYPE,
81
+ sui_fe_1.NORMALIZED_wBTC_COINTYPE,
82
+ sui_fe_1.NORMALIZED_xBTC_COINTYPE,
83
+ sui_fe_1.NORMALIZED_suiETH_COINTYPE,
84
+ sui_fe_1.NORMALIZED_WETH_COINTYPE,
85
+ sui_fe_1.NORMALIZED_SOL_COINTYPE,
86
+ sui_fe_1.NORMALIZED_DEEP_COINTYPE,
87
+ sui_fe_1.NORMALIZED_WAL_COINTYPE,
88
+ // ISOLATED ASSETS
89
+ sui_fe_1.NORMALIZED_SEND_COINTYPE,
90
+ sui_fe_1.NORMALIZED_IKA_COINTYPE,
91
+ sui_fe_1.NORMALIZED_HAEDAL_COINTYPE,
92
+ sui_fe_1.NORMALIZED_BLUE_COINTYPE,
93
+ sui_fe_1.NORMALIZED_NS_COINTYPE,
94
+ sui_fe_1.NORMALIZED_UP_COINTYPE,
95
+ sui_fe_1.NORMALIZED_DMC_COINTYPE,
96
+ sui_fe_1.NORMALIZED_ALKIMI_COINTYPE,
97
+ sui_fe_1.NORMALIZED_KOBAN_COINTYPE,
98
+ sui_fe_1.NORMALIZED_mUSD_COINTYPE,
99
+ sui_fe_1.NORMALIZED_BUCK_COINTYPE,
100
+ sui_fe_1.NORMALIZED_HIPPO_COINTYPE,
101
+ sui_fe_1.NORMALIZED_FUD_COINTYPE,
102
+ ],
103
+ "0x0d3a7f758d19d11e8526f66cca43403a99da16862c570c43efe0f8c4a500f7f2": [
104
+ sui_fe_1.NORMALIZED_sdeUSD_COINTYPE,
105
+ sui_fe_1.NORMALIZED_USDC_COINTYPE,
106
+ ],
107
+ };
102
108
  const MAYA_COINTYPE = "0x3bf0aeb7b9698b18ec7937290a5701088fcd5d43ad11a2564b074d022a6d71ec::maya::MAYA";
103
109
  const mPOINTS_COINTYPE = "0x7bae0b3b7b6c3da899fe3f4af95b7110633499c02b8c6945110d799d99deaa68::mpoints::MPOINTS";
104
110
  const TREATS_COINTYPE = "0x0dadb7fa2771c2952f96161fc1f0c105d1f22d53926b9ff2498a8eea2f6eb204::treats::TREATS";
@@ -189,16 +195,18 @@ const initializeSuilend = (suiClient, suilendClient, lendingMarketMetadata) => _
189
195
  // (walReserve.smoothedPrice.value as bigint) = walPrice;
190
196
  // }
191
197
  const lendingMarket = (0, parsers_1.parseLendingMarket)(suilendClient.lendingMarket, refreshedRawReserves, coinMetadataMap, nowS, lendingMarketMetadata);
192
- lendingMarket.reserves = lendingMarket.reserves.slice().sort((a, b) => {
193
- const aCustomOrderIndex = exports.RESERVES_CUSTOM_ORDER.indexOf(a.coinType);
194
- const bCustomOrderIndex = exports.RESERVES_CUSTOM_ORDER.indexOf(b.coinType);
195
- if (aCustomOrderIndex > -1 && bCustomOrderIndex > -1)
196
- return aCustomOrderIndex - bCustomOrderIndex;
197
- else if (aCustomOrderIndex === -1 && bCustomOrderIndex === -1)
198
- return 0;
199
- else
200
- return aCustomOrderIndex > -1 ? -1 : 1;
201
- });
198
+ if (!!exports.RESERVES_CUSTOM_ORDER[lendingMarket.id]) {
199
+ lendingMarket.reserves = lendingMarket.reserves.slice().sort((a, b) => {
200
+ const aCustomOrderIndex = exports.RESERVES_CUSTOM_ORDER[lendingMarket.id].indexOf(a.coinType);
201
+ const bCustomOrderIndex = exports.RESERVES_CUSTOM_ORDER[lendingMarket.id].indexOf(b.coinType);
202
+ if (aCustomOrderIndex > -1 && bCustomOrderIndex > -1)
203
+ return aCustomOrderIndex - bCustomOrderIndex;
204
+ else if (aCustomOrderIndex === -1 && bCustomOrderIndex === -1)
205
+ return 0;
206
+ else
207
+ return aCustomOrderIndex > -1 ? -1 : 1;
208
+ });
209
+ }
202
210
  const reserveMap = lendingMarket.reserves.reduce((acc, reserve) => (Object.assign(Object.assign({}, acc), { [reserve.coinType]: reserve })), {});
203
211
  return {
204
212
  lendingMarket,
@@ -244,26 +244,34 @@ const strategyClaimRewardsAndSwapForCoinType = (address, cetusSdk, cetusPartnerI
244
244
  const amountsAndSortedQuotesMap = Object.fromEntries(yield Promise.all(Object.entries(mergedCoinsMap)
245
245
  .filter(([coinType]) => swappedCoinTypes.includes(coinType))
246
246
  .map(([coinType, coin]) => (() => __awaiter(void 0, void 0, void 0, function* () {
247
- // Get amount
248
- const { rawAmount: amount } = filteredRewardsMap[coinType]; // Use underestimate (rewards keep accruing)
249
- // Get routes
250
- const routers = yield cetusSdk.findRouters({
251
- from: coinType,
252
- target: depositReserve.coinType,
253
- amount: new bn_js_1.default(amount.toString()), // Underestimate (rewards keep accruing)
254
- byAmountIn: true,
255
- });
256
- if (!routers)
257
- throw new Error(`No swap quote found for ${coinType}`);
258
- console.log("[strategyClaimRewardsAndSwapForCoinType] routers", {
259
- coinType,
260
- routers,
261
- });
262
- return [coinType, { coin, routers }];
247
+ try {
248
+ // Get amount
249
+ const { rawAmount: amount } = filteredRewardsMap[coinType]; // Use underestimate (rewards keep accruing)
250
+ // Get routes
251
+ const routers = yield cetusSdk.findRouters({
252
+ from: coinType,
253
+ target: depositReserve.coinType,
254
+ amount: new bn_js_1.default(amount.toString()), // Underestimate (rewards keep accruing)
255
+ byAmountIn: true,
256
+ });
257
+ if (!routers)
258
+ throw new Error(`No swap quote found for ${coinType}`);
259
+ console.log("[strategyClaimRewardsAndSwapForCoinType] routers", {
260
+ coinType,
261
+ routers,
262
+ });
263
+ return [coinType, { coin, routers }];
264
+ }
265
+ catch (err) {
266
+ console.error(err);
267
+ return [coinType, { coin, routers: undefined }];
268
+ }
263
269
  }))())));
264
270
  console.log("[strategyClaimRewardsAndSwapForCoinType] amountsAndSortedQuotesMap", { amountsAndSortedQuotesMap });
265
271
  // 3.2.2) Swap
266
272
  for (const [coinType, { coin: coinIn, routers }] of Object.entries(amountsAndSortedQuotesMap)) {
273
+ if (routers === undefined)
274
+ continue; // Skip coin if no swap quote found
267
275
  console.log("[strategyClaimRewardsAndSwapForCoinType] swapping coinType", coinType);
268
276
  let coinOut;
269
277
  try {
package/lib/types.d.ts CHANGED
@@ -241,6 +241,5 @@ export type LendingMarketMetadata = {
241
241
  type: string;
242
242
  lendingMarketOwnerCapId: string;
243
243
  name?: string;
244
- slug?: string;
245
244
  isHidden?: boolean;
246
245
  };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/sdk","version":"1.1.85","private":false,"description":"A TypeScript SDK for interacting with the Suilend program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./client":"./client.js","./strategies":"./strategies.js","./api/events":"./api/events.js","./api":"./api/index.js","./lib/constants":"./lib/constants.js","./lib":"./lib/index.js","./lib/initialize":"./lib/initialize.js","./lib/liquidityMining":"./lib/liquidityMining.js","./lib/strategyOwnerCap":"./lib/strategyOwnerCap.js","./lib/transactions":"./lib/transactions.js","./lib/types":"./lib/types.js","./parsers/apiReserveAssetDataEvent":"./parsers/apiReserveAssetDataEvent.js","./parsers":"./parsers/index.js","./parsers/lendingMarket":"./parsers/lendingMarket.js","./parsers/obligation":"./parsers/obligation.js","./parsers/rateLimiter":"./parsers/rateLimiter.js","./parsers/reserve":"./parsers/reserve.js","./swap":"./swap/index.js","./swap/quote":"./swap/quote.js","./swap/transaction":"./swap/transaction.js","./utils/events":"./utils/events.js","./utils":"./utils/index.js","./utils/obligation":"./utils/obligation.js","./utils/simulate":"./utils/simulate.js","./_generated/_framework/reified":"./_generated/_framework/reified.js","./_generated/_framework/util":"./_generated/_framework/util.js","./_generated/_framework/vector":"./_generated/_framework/vector.js","./_generated/suilend":"./_generated/suilend/index.js","./_generated/suilend/cell/structs":"./_generated/suilend/cell/structs.js","./_generated/suilend/decimal/structs":"./_generated/suilend/decimal/structs.js","./_generated/suilend/lending-market/functions":"./_generated/suilend/lending-market/functions.js","./_generated/suilend/lending-market/structs":"./_generated/suilend/lending-market/structs.js","./_generated/suilend/lending-market-registry/functions":"./_generated/suilend/lending-market-registry/functions.js","./_generated/suilend/liquidity-mining/structs":"./_generated/suilend/liquidity-mining/structs.js","./_generated/suilend/obligation/structs":"./_generated/suilend/obligation/structs.js","./_generated/suilend/rate-limiter/functions":"./_generated/suilend/rate-limiter/functions.js","./_generated/suilend/rate-limiter/structs":"./_generated/suilend/rate-limiter/structs.js","./_generated/suilend/reserve/structs":"./_generated/suilend/reserve/structs.js","./_generated/suilend/reserve-config/functions":"./_generated/suilend/reserve-config/functions.js","./_generated/suilend/reserve-config/structs":"./_generated/suilend/reserve-config/structs.js","./_generated/_dependencies/source/0x1":"./_generated/_dependencies/source/0x1/index.js","./_generated/_dependencies/source/0x2":"./_generated/_dependencies/source/0x2/index.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js","./_generated/_dependencies/source/0x1/ascii/structs":"./_generated/_dependencies/source/0x1/ascii/structs.js","./_generated/_dependencies/source/0x1/option/structs":"./_generated/_dependencies/source/0x1/option/structs.js","./_generated/_dependencies/source/0x1/type-name/structs":"./_generated/_dependencies/source/0x1/type-name/structs.js","./_generated/_dependencies/source/0x2/bag/structs":"./_generated/_dependencies/source/0x2/bag/structs.js","./_generated/_dependencies/source/0x2/balance/structs":"./_generated/_dependencies/source/0x2/balance/structs.js","./_generated/_dependencies/source/0x2/object/structs":"./_generated/_dependencies/source/0x2/object/structs.js","./_generated/_dependencies/source/0x2/object-table/structs":"./_generated/_dependencies/source/0x2/object-table/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/suilend/suilend-fe-public.git"},"bugs":{"url":"https://github.com/suilend/suilend-fe-public/issues"},"dependencies":{"@7kprotocol/sdk-ts":"^3.4.1","@cetusprotocol/aggregator-sdk":"^1.2.1","@flowx-finance/sdk":"^1.13.5","@pythnetwork/pyth-sui-js":"^2.2.0","@suilend/springsui-sdk":"^1.0.26","aftermath-ts-sdk":"^1.3.22","bignumber.js":"^9.1.2","bn.js":"^5.2.2","crypto-js":"^4.2.0","lodash":"^4.17.21","p-limit":"3.1.0","uuid":"^11.0.3"},"devDependencies":{"@types/bn.js":"^5.2.0","@types/lodash":"^4.17.20","ts-node":"^10.9.2"},"peerDependencies":{"@mysten/bcs":"1.6.0","@mysten/sui":"1.28.2","@suilend/sui-fe":"^0.3.32"},"overrides":{"chalk":"5.3.0","strip-ansi":"7.1.0","color-convert":"2.0.1","color-name":"1.1.4","is-core-module":"2.13.1","error-ex":"1.3.2","has-ansi":"5.0.1"}}
1
+ {"name":"@suilend/sdk","version":"1.1.86","private":false,"description":"A TypeScript SDK for interacting with the Suilend program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./client":"./client.js","./strategies":"./strategies.js","./api/events":"./api/events.js","./api":"./api/index.js","./lib/constants":"./lib/constants.js","./lib":"./lib/index.js","./lib/initialize":"./lib/initialize.js","./lib/liquidityMining":"./lib/liquidityMining.js","./lib/strategyOwnerCap":"./lib/strategyOwnerCap.js","./lib/transactions":"./lib/transactions.js","./lib/types":"./lib/types.js","./parsers/apiReserveAssetDataEvent":"./parsers/apiReserveAssetDataEvent.js","./parsers":"./parsers/index.js","./parsers/lendingMarket":"./parsers/lendingMarket.js","./parsers/obligation":"./parsers/obligation.js","./parsers/rateLimiter":"./parsers/rateLimiter.js","./parsers/reserve":"./parsers/reserve.js","./swap":"./swap/index.js","./swap/quote":"./swap/quote.js","./swap/transaction":"./swap/transaction.js","./utils/events":"./utils/events.js","./utils":"./utils/index.js","./utils/obligation":"./utils/obligation.js","./utils/simulate":"./utils/simulate.js","./_generated/_framework/reified":"./_generated/_framework/reified.js","./_generated/_framework/util":"./_generated/_framework/util.js","./_generated/_framework/vector":"./_generated/_framework/vector.js","./_generated/suilend":"./_generated/suilend/index.js","./_generated/suilend/cell/structs":"./_generated/suilend/cell/structs.js","./_generated/suilend/decimal/structs":"./_generated/suilend/decimal/structs.js","./_generated/suilend/lending-market/functions":"./_generated/suilend/lending-market/functions.js","./_generated/suilend/lending-market/structs":"./_generated/suilend/lending-market/structs.js","./_generated/suilend/lending-market-registry/functions":"./_generated/suilend/lending-market-registry/functions.js","./_generated/suilend/liquidity-mining/structs":"./_generated/suilend/liquidity-mining/structs.js","./_generated/suilend/obligation/structs":"./_generated/suilend/obligation/structs.js","./_generated/suilend/rate-limiter/functions":"./_generated/suilend/rate-limiter/functions.js","./_generated/suilend/rate-limiter/structs":"./_generated/suilend/rate-limiter/structs.js","./_generated/suilend/reserve/structs":"./_generated/suilend/reserve/structs.js","./_generated/suilend/reserve-config/functions":"./_generated/suilend/reserve-config/functions.js","./_generated/suilend/reserve-config/structs":"./_generated/suilend/reserve-config/structs.js","./_generated/_dependencies/source/0x1":"./_generated/_dependencies/source/0x1/index.js","./_generated/_dependencies/source/0x2":"./_generated/_dependencies/source/0x2/index.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js","./_generated/_dependencies/source/0x1/ascii/structs":"./_generated/_dependencies/source/0x1/ascii/structs.js","./_generated/_dependencies/source/0x1/option/structs":"./_generated/_dependencies/source/0x1/option/structs.js","./_generated/_dependencies/source/0x1/type-name/structs":"./_generated/_dependencies/source/0x1/type-name/structs.js","./_generated/_dependencies/source/0x2/bag/structs":"./_generated/_dependencies/source/0x2/bag/structs.js","./_generated/_dependencies/source/0x2/balance/structs":"./_generated/_dependencies/source/0x2/balance/structs.js","./_generated/_dependencies/source/0x2/object/structs":"./_generated/_dependencies/source/0x2/object/structs.js","./_generated/_dependencies/source/0x2/object-table/structs":"./_generated/_dependencies/source/0x2/object-table/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/suilend/suilend-fe-public.git"},"bugs":{"url":"https://github.com/suilend/suilend-fe-public/issues"},"dependencies":{"@7kprotocol/sdk-ts":"^3.4.1","@cetusprotocol/aggregator-sdk":"^1.2.1","@flowx-finance/sdk":"^1.13.5","@pythnetwork/pyth-sui-js":"^2.2.0","@suilend/springsui-sdk":"^1.0.27","aftermath-ts-sdk":"^1.3.22","bignumber.js":"^9.1.2","bn.js":"^5.2.2","crypto-js":"^4.2.0","lodash":"^4.17.21","p-limit":"3.1.0","uuid":"^11.0.3"},"devDependencies":{"@types/bn.js":"^5.2.0","@types/lodash":"^4.17.20","ts-node":"^10.9.2"},"peerDependencies":{"@mysten/bcs":"1.8.1","@mysten/sui":"1.42.0","@suilend/sui-fe":"^0.3.36"},"overrides":{"chalk":"5.3.0","strip-ansi":"7.1.0","color-convert":"2.0.1","color-name":"1.1.4","is-core-module":"2.13.1","error-ex":"1.3.2","has-ansi":"5.0.1"}}
@@ -136,7 +136,6 @@ export declare const parseLendingMarket: (lendingMarket: LendingMarket<string>,
136
136
  type: string;
137
137
  ownerCapId: string | undefined;
138
138
  name: string;
139
- slug: string;
140
139
  isHidden: boolean;
141
140
  /**
142
141
  * @deprecated since version 1.0.3. Use `depositedAmountUsd` instead.
@@ -8,7 +8,7 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
8
  const rateLimiter_1 = require("./rateLimiter");
9
9
  const reserve_1 = require("./reserve");
10
10
  const parseLendingMarket = (lendingMarket, reserves, coinMetadataMap, nowS, lendingMarketMetadata) => {
11
- var _a, _b, _c, _d;
11
+ var _a, _b, _c;
12
12
  const id = lendingMarket.id;
13
13
  const type = lendingMarket.$typeArgs[0];
14
14
  const version = lendingMarket.version;
@@ -43,8 +43,7 @@ const parseLendingMarket = (lendingMarket, reserves, coinMetadataMap, nowS, lend
43
43
  type,
44
44
  ownerCapId: (_a = lendingMarketMetadata === null || lendingMarketMetadata === void 0 ? void 0 : lendingMarketMetadata.lendingMarketOwnerCapId) !== null && _a !== void 0 ? _a : undefined,
45
45
  name: (_b = lendingMarketMetadata === null || lendingMarketMetadata === void 0 ? void 0 : lendingMarketMetadata.name) !== null && _b !== void 0 ? _b : type.split("::").slice(1).join(" "),
46
- slug: (_c = lendingMarketMetadata === null || lendingMarketMetadata === void 0 ? void 0 : lendingMarketMetadata.slug) !== null && _c !== void 0 ? _c : type.split("::").slice(1).join("-").toLowerCase(),
47
- isHidden: (_d = lendingMarketMetadata === null || lendingMarketMetadata === void 0 ? void 0 : lendingMarketMetadata.isHidden) !== null && _d !== void 0 ? _d : true,
46
+ isHidden: (_c = lendingMarketMetadata === null || lendingMarketMetadata === void 0 ? void 0 : lendingMarketMetadata.isHidden) !== null && _c !== void 0 ? _c : true,
48
47
  /**
49
48
  * @deprecated since version 1.0.3. Use `depositedAmountUsd` instead.
50
49
  */