@scallop-io/sui-scallop-sdk 1.4.3 → 1.4.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.
@@ -1,10 +1,11 @@
1
- import { SuiKit } from '@scallop-io/sui-kit';
1
+ import { SuiKit, SuiObjectArg } from '@scallop-io/sui-kit';
2
2
  import { ScallopQueryParams, SupportStakeMarketCoins, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, SupportMarketCoins, SupportBorrowIncentiveCoins, SupportSCoin, ScallopQueryInstanceParams, MarketPool, CoinPrices, MarketPools } from '../types';
3
3
  import { ScallopAddress } from './scallopAddress';
4
4
  import { ScallopUtils } from './scallopUtils';
5
5
  import { ScallopIndexer } from './scallopIndexer';
6
6
  import { ScallopCache } from './scallopCache';
7
7
  import { SuiObjectData } from '@mysten/sui/client';
8
+ import { SuiObjectRef } from '@mysten/sui/client';
8
9
  /**
9
10
  * @description
10
11
  * It provides methods for getting on-chain data from the Scallop contract.
@@ -100,6 +101,7 @@ export declare class ScallopQuery {
100
101
  hasui?: import("../types").MarketCollateral | undefined;
101
102
  vsui?: import("../types").MarketCollateral | undefined;
102
103
  sca?: import("../types").MarketCollateral | undefined;
104
+ fdusd?: import("../types").MarketCollateral | undefined;
103
105
  }>;
104
106
  /**
105
107
  * Get market collateral
@@ -124,7 +126,7 @@ export declare class ScallopQuery {
124
126
  * @param obligationId - The obligation id.
125
127
  * @return Obligation data.
126
128
  */
127
- queryObligation(obligationId: string): Promise<import("../types").ObligationQueryInterface | undefined>;
129
+ queryObligation(obligationId: string | SuiObjectArg): Promise<import("../types").ObligationQueryInterface | undefined>;
128
130
  /**
129
131
  * Get all asset coin amounts.
130
132
  *
@@ -312,6 +314,7 @@ export declare class ScallopQuery {
312
314
  sca?: import("../types").BorrowIncentivePool | undefined;
313
315
  fud?: import("../types").BorrowIncentivePool | undefined;
314
316
  deep?: import("../types").BorrowIncentivePool | undefined;
317
+ fdusd?: import("../types").BorrowIncentivePool | undefined;
315
318
  }>;
316
319
  /**
317
320
  * Get borrow incentive accounts data.
@@ -320,7 +323,7 @@ export declare class ScallopQuery {
320
323
  * @param ownerAddress - The owner address.
321
324
  * @return Borrow incentive accounts data.
322
325
  */
323
- getBorrowIncentiveAccounts(obligationId: string, coinNames?: SupportBorrowIncentiveCoins[]): Promise<{
326
+ getBorrowIncentiveAccounts(obligationId: string | SuiObjectRef, coinNames?: SupportBorrowIncentiveCoins[]): Promise<{
324
327
  usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
325
328
  sbeth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
326
329
  weth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
@@ -337,6 +340,7 @@ export declare class ScallopQuery {
337
340
  sca?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
338
341
  fud?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
339
342
  deep?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
343
+ fdusd?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
340
344
  }>;
341
345
  /**
342
346
  * Get user lending and spool infomation for specific pools.
@@ -365,6 +369,7 @@ export declare class ScallopQuery {
365
369
  sca?: import("../types").Lending | undefined;
366
370
  fud?: import("../types").Lending | undefined;
367
371
  deep?: import("../types").Lending | undefined;
372
+ fdusd?: import("../types").Lending | undefined;
368
373
  }>;
369
374
  /**
370
375
  * Get user lending and spool information for specific pool.
@@ -475,7 +480,7 @@ export declare class ScallopQuery {
475
480
  * @param ownerAddress - The owner address.
476
481
  * @return All market sCoin amounts.
477
482
  */
478
- getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep", number>>>;
483
+ getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd", number>>>;
479
484
  /**
480
485
  * Get sCoin amount.
481
486
  *
@@ -490,7 +495,7 @@ export declare class ScallopQuery {
490
495
  * @returns
491
496
  */
492
497
  getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
493
- getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep", number>>;
498
+ getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd", number>>;
494
499
  /**
495
500
  * Get supply limit of lending pool
496
501
  */
@@ -536,6 +541,7 @@ export declare class ScallopQuery {
536
541
  ssca?: number | undefined;
537
542
  sfud?: number | undefined;
538
543
  sdeep?: number | undefined;
544
+ sfdusd?: number | undefined;
539
545
  usdc?: number | undefined;
540
546
  sbeth?: number | undefined;
541
547
  weth?: number | undefined;
@@ -552,13 +558,14 @@ export declare class ScallopQuery {
552
558
  sca?: number | undefined;
553
559
  fud?: number | undefined;
554
560
  deep?: number | undefined;
561
+ fdusd?: number | undefined;
555
562
  swapt?: number | undefined;
556
563
  }>;
557
564
  /**
558
565
  * Query all address (lending pool, collateral pool, borrow dynamics, interest models) of all pool
559
566
  * @returns
560
567
  */
561
- getPoolAddresses(): Promise<import("../types").OptionalKeys<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep", {
568
+ getPoolAddresses(): Promise<import("../types").OptionalKeys<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd", {
562
569
  lendingPoolAddress?: string;
563
570
  collateralPoolAddress?: string;
564
571
  borrowDynamic?: string;
@@ -65,7 +65,7 @@ export declare class ScallopUtils {
65
65
  * if no `scallop_...` is encountered, return coinName
66
66
  * @return sCoin name
67
67
  */
68
- parseSCoinTypeNameToMarketCoinName(coinName: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep";
68
+ parseSCoinTypeNameToMarketCoinName(coinName: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
69
69
  /**
70
70
  * Convert sCoin name into sCoin type
71
71
  * @param sCoinName
@@ -77,7 +77,7 @@ export declare class ScallopUtils {
77
77
  * @param sCoinType
78
78
  * @returns sCoin name
79
79
  */
80
- parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep";
80
+ parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
81
81
  /**
82
82
  * Convert sCoin name into its underlying coin type
83
83
  * @param sCoinName
@@ -1,5 +1,6 @@
1
1
  import type { ScallopAddress, ScallopQuery, ScallopUtils } from '../models';
2
2
  import type { BorrowIncentivePoolsQueryInterface, SupportBorrowIncentiveCoins, BorrowIncentivePool, CoinPrices, MarketPools } from '../types';
3
+ import { SuiObjectRef } from '@mysten/sui/client';
3
4
  /**
4
5
  * Query borrow incentive pools data using moveCall
5
6
  * @param address
@@ -31,6 +32,7 @@ export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncent
31
32
  sca?: BorrowIncentivePool | undefined;
32
33
  fud?: BorrowIncentivePool | undefined;
33
34
  deep?: BorrowIncentivePool | undefined;
35
+ fdusd?: BorrowIncentivePool | undefined;
34
36
  }>;
35
37
  /**
36
38
  * Query borrow incentive accounts data.
@@ -41,7 +43,7 @@ export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncent
41
43
  */
42
44
  export declare const queryBorrowIncentiveAccounts: ({ utils, }: {
43
45
  utils: ScallopUtils;
44
- }, obligationId: string, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[]) => Promise<{
46
+ }, obligationId: string | SuiObjectRef, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[]) => Promise<{
45
47
  usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
46
48
  sbeth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
47
49
  weth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
@@ -58,6 +60,7 @@ export declare const queryBorrowIncentiveAccounts: ({ utils, }: {
58
60
  sca?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
59
61
  fud?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
60
62
  deep?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
63
+ fdusd?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
61
64
  }>;
62
65
  /**
63
66
  * Check veSca bind status
@@ -80,6 +80,7 @@ export declare const getMarketCollaterals: (query: ScallopQuery, collateralCoinN
80
80
  hasui?: MarketCollateral | undefined;
81
81
  vsui?: MarketCollateral | undefined;
82
82
  sca?: MarketCollateral | undefined;
83
+ fdusd?: MarketCollateral | undefined;
83
84
  }>;
84
85
  /**
85
86
  * Get market collateral data.
@@ -1,6 +1,6 @@
1
1
  import { ScallopQuery } from 'src/models';
2
2
  import { OptionalKeys } from 'src/types';
3
- export declare const getAllAddresses: (query: ScallopQuery) => Promise<OptionalKeys<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep", {
3
+ export declare const getAllAddresses: (query: ScallopQuery) => Promise<OptionalKeys<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd", {
4
4
  lendingPoolAddress?: string;
5
5
  collateralPoolAddress?: string;
6
6
  borrowDynamic?: string;
@@ -1,5 +1,6 @@
1
1
  import type { ScallopQuery } from '../models';
2
2
  import type { Market, SupportPoolCoins, MarketPool, Spool, StakeAccount, Lending, ObligationAccount, CoinAmounts, CoinPrices, TotalValueLocked } from '../types';
3
+ import { SuiObjectRef } from '@mysten/sui/client';
3
4
  /**
4
5
  * Get user lending infomation for specific pools.
5
6
  *
@@ -26,6 +27,7 @@ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportP
26
27
  sca?: Lending | undefined;
27
28
  fud?: Lending | undefined;
28
29
  deep?: Lending | undefined;
30
+ fdusd?: Lending | undefined;
29
31
  }>;
30
32
  /**
31
33
  * Get user lending infomation for specific pool.
@@ -60,11 +62,11 @@ export declare const getObligationAccounts: (query: ScallopQuery, ownerAddress?:
60
62
  * Get obligation account data.
61
63
  *
62
64
  * @param query - The Scallop query instance.
63
- * @param obligationId - The obligation id.
65
+ * @param obligation - The obligation id.
64
66
  * @param indexer - Whether to use indexer.
65
67
  * @return Obligation account data.
66
68
  */
67
- export declare const getObligationAccount: (query: ScallopQuery, obligationId: string, ownerAddress?: string, indexer?: boolean, market?: Market, coinPrices?: CoinPrices, coinAmounts?: CoinAmounts) => Promise<ObligationAccount>;
69
+ export declare const getObligationAccount: (query: ScallopQuery, obligation: string | SuiObjectRef, ownerAddress?: string, indexer?: boolean, market?: Market, coinPrices?: CoinPrices, coinAmounts?: CoinAmounts) => Promise<ObligationAccount>;
68
70
  /**
69
71
  * Get total value locked data.
70
72
  *
@@ -30,6 +30,7 @@ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: Marke
30
30
  ssca?: number | undefined;
31
31
  sfud?: number | undefined;
32
32
  sdeep?: number | undefined;
33
+ sfdusd?: number | undefined;
33
34
  usdc?: number | undefined;
34
35
  sbeth?: number | undefined;
35
36
  weth?: number | undefined;
@@ -46,5 +47,6 @@ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: Marke
46
47
  sca?: number | undefined;
47
48
  fud?: number | undefined;
48
49
  deep?: number | undefined;
50
+ fdusd?: number | undefined;
49
51
  swapt?: number | undefined;
50
52
  }>;
@@ -19,7 +19,7 @@ export declare const getSCoinTotalSupply: ({ utils, }: {
19
19
  */
20
20
  export declare const getSCoinAmounts: ({ utils, }: {
21
21
  utils: ScallopUtils;
22
- }, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep", number>>>;
22
+ }, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd", number>>>;
23
23
  /**
24
24
  * Query owned sCoin amount.
25
25
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -15,6 +15,7 @@ export const COIN_GECKGO_IDS: Record<SupportPoolCoins, string> = {
15
15
  hasui: 'sui',
16
16
  vsui: 'sui',
17
17
  sca: 'scallop-2',
18
+ fdusd: 'first-digital-usd',
18
19
  deep: 'deepbook',
19
20
  fud: 'fud-the-pug',
20
21
  };
@@ -46,6 +46,7 @@ export const SUPPORT_POOLS = [
46
46
  'sca',
47
47
  'fud',
48
48
  'deep',
49
+ 'fdusd',
49
50
  ] as const;
50
51
 
51
52
  export const SUPPORT_COLLATERALS = [
@@ -63,6 +64,7 @@ export const SUPPORT_COLLATERALS = [
63
64
  'hasui',
64
65
  'vsui',
65
66
  'sca',
67
+ 'fdusd',
66
68
  ] as const;
67
69
 
68
70
  export const SUPPORT_SPOOLS = [
@@ -93,6 +95,7 @@ export const SUPPORT_SCOIN = [
93
95
  'swbtc',
94
96
  'sdeep',
95
97
  'sfud',
98
+ 'sfdusd',
96
99
  ] as const;
97
100
 
98
101
  export const SUPPORT_SUI_BRIDGE = ['sbeth'] as const;
@@ -16,6 +16,7 @@ export const coinDecimals: types.SupportCoinDecimals = {
16
16
  hasui: 9,
17
17
  vsui: 9,
18
18
  sca: 9,
19
+ fdusd: 6,
19
20
  deep: 6,
20
21
  fud: 5,
21
22
  susdc: 6,
@@ -32,6 +33,7 @@ export const coinDecimals: types.SupportCoinDecimals = {
32
33
  shasui: 9,
33
34
  svsui: 9,
34
35
  ssca: 9,
36
+ sfdusd: 6,
35
37
  sdeep: 6,
36
38
  sfud: 5,
37
39
  };
@@ -51,6 +53,7 @@ export const assetCoins: types.AssetCoins = {
51
53
  hasui: 'hasui',
52
54
  vsui: 'vsui',
53
55
  sca: 'sca',
56
+ fdusd: 'fdusd',
54
57
  deep: 'deep',
55
58
  fud: 'fud',
56
59
  };
@@ -70,6 +73,7 @@ export const marketCoins: types.MarketCoins = {
70
73
  shasui: 'shasui',
71
74
  svsui: 'svsui',
72
75
  ssca: 'ssca',
76
+ sfdusd: 'sfdusd',
73
77
  sdeep: 'sdeep',
74
78
  sfud: 'sfud',
75
79
  };
@@ -88,6 +92,7 @@ export const sCoins: types.SCoins = {
88
92
  ssca: 'ssca',
89
93
  swsol: 'swsol',
90
94
  swbtc: 'swbtc',
95
+ sfdusd: 'sfdusd',
91
96
  sfud: 'sfud',
92
97
  sdeep: 'sdeep',
93
98
  };
@@ -137,6 +142,7 @@ export const coinIds: types.AssetCoinIds = {
137
142
  sca: IS_VE_SCA_TEST
138
143
  ? '0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524'
139
144
  : '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6',
145
+ fdusd: '0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a',
140
146
  // isolated assets
141
147
  deep: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
142
148
  fud: '0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1',
@@ -181,6 +187,8 @@ export const sCoinIds: types.SCoinIds = {
181
187
  '0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL',
182
188
  swbtc:
183
189
  '0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC',
190
+ sfdusd:
191
+ '0x6711551c1e7652a270d9fbf0eee25d99594c157cde3cb5fbb49035eb59b1b001::scallop_fdusd::SCALLOP_FDUSD',
184
192
  sdeep:
185
193
  '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
186
194
  sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
@@ -425,4 +425,29 @@ export const POOL_ADDRESSES: OptionalKeys<
425
425
  coinDecimalId:
426
426
  '0x6e60b051a08fa836f5a7acd7c464c8d9825bc29c44657fe170fe9b8e1e4770c0',
427
427
  },
428
+ fdusd: {
429
+ lendingPoolAddress:
430
+ '0x4f46051a01f05c3ad9aecf29a771aad5c884e1a1888e08d7709085e3a095bc9c',
431
+ collateralPoolAddress:
432
+ '0x4f6647a9afcfdb62bb9b27e4d1cb7bd7130aca1b4f13fa7164453c869c1681ae',
433
+ borrowDynamic:
434
+ '0x4ddcf19b6290a8b048ecb314b14ef7f52c1c5b9ddc9259a2a242cd91d681a085',
435
+ interestModel:
436
+ '0xb57a33706b29d2d253c74c1c0869e6e20da99036338d2b0b7235ab41621ee9dd',
437
+ riskModel:
438
+ '0xd65fb21758dc1e6184940a1a27efb13228d7cf5e19f6dcca06cc2d996af4a6b9',
439
+ borrowFeeKey:
440
+ '0xafe673a27747b063fa918d2dfe47794e44af553737ac562c2a63186539a07f45',
441
+ supplyLimitKey:
442
+ '0x730e0785ba056a7a95f4a6959371a598d7fe782e81c40785c79982ced4cf4e35',
443
+ borrowLimitKey:
444
+ '0x1630c6954918a06fe56312afb8958366c5ed7af653dae0e32c09d088da38577e',
445
+ isolatedAssetKey: undefined,
446
+ spool: undefined,
447
+ spoolReward: undefined,
448
+ sCoinTreasury:
449
+ '0xdad9bc6293e694f67a5274ea51b596e0bdabfafc585ae6d7e82888e65f1a03e0',
450
+ coinDecimalId:
451
+ '0xdebee5265a67c186ed87fe93303d33dfe1de53e3b4fd7d9329c2852860acd3e7',
452
+ },
428
453
  };
@@ -22,6 +22,7 @@ export const PYTH_FEED_IDS: Record<SupportPoolCoins, string> = {
22
22
  hasui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
23
23
  vsui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
24
24
  sca: '7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc',
25
+ fdusd: '0xccdc1a08923e2e4f4b1e6ea89de6acbc5fe1948e9706f5604b8cb50bc1ed3979',
25
26
  deep: '29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',
26
27
  fud: '6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75',
27
28
  };
@@ -236,6 +236,21 @@ export const TEST_ADDRESSES: AddressesInterface = {
236
236
  },
237
237
  },
238
238
  },
239
+ fdusd: {
240
+ id: '0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a',
241
+ metaData:
242
+ '0xdebee5265a67c186ed87fe93303d33dfe1de53e3b4fd7d9329c2852860acd3e7',
243
+ treasury: '',
244
+ oracle: {
245
+ supra: '',
246
+ switchboard: '',
247
+ pyth: {
248
+ feed: '0xccdc1a08923e2e4f4b1e6ea89de6acbc5fe1948e9706f5604b8cb50bc1ed3979',
249
+ feedObject:
250
+ '0x5f6583b2b0fe1ecf94aaffeaab8a838794693960cea48c0da282d5f4a24be027',
251
+ },
252
+ },
253
+ },
239
254
  deep: {
240
255
  id: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
241
256
  metaData:
@@ -543,6 +558,12 @@ export const TEST_ADDRESSES: AddressesInterface = {
543
558
  treasury:
544
559
  '0xfd0f02def6358a1f266acfa1493d4707ee8387460d434fb667d63d755ff907ed',
545
560
  },
561
+ sfdusd: {
562
+ coinType:
563
+ '0x6711551c1e7652a270d9fbf0eee25d99594c157cde3cb5fbb49035eb59b1b001::scallop_fdusd::SCALLOP_FDUSD',
564
+ treasury:
565
+ '0xdad9bc6293e694f67a5274ea51b596e0bdabfafc585ae6d7e82888e65f1a03e0',
566
+ },
546
567
  sdeep: {
547
568
  coinType:
548
569
  '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
@@ -1,4 +1,4 @@
1
- import { SuiKit } from '@scallop-io/sui-kit';
1
+ import { SuiKit, SuiObjectArg } from '@scallop-io/sui-kit';
2
2
  import {
3
3
  ADDRESSES_ID,
4
4
  SUPPORT_POOLS,
@@ -72,6 +72,7 @@ import { SuiObjectData } from '@mysten/sui/client';
72
72
  import { normalizeSuiAddress } from '@mysten/sui/utils';
73
73
  import { withIndexerFallback } from 'src/utils/indexer';
74
74
  import { newSuiKit } from './suiKit';
75
+ import { SuiObjectRef } from '@mysten/sui/client';
75
76
  /**
76
77
  * @description
77
78
  * It provides methods for getting on-chain data from the Scallop contract.
@@ -298,7 +299,7 @@ export class ScallopQuery {
298
299
  * @param obligationId - The obligation id.
299
300
  * @return Obligation data.
300
301
  */
301
- public async queryObligation(obligationId: string) {
302
+ public async queryObligation(obligationId: string | SuiObjectArg) {
302
303
  return queryObligation(this, obligationId);
303
304
  }
304
305
 
@@ -564,7 +565,7 @@ export class ScallopQuery {
564
565
  * @return Borrow incentive accounts data.
565
566
  */
566
567
  public async getBorrowIncentiveAccounts(
567
- obligationId: string,
568
+ obligationId: string | SuiObjectRef,
568
569
  coinNames?: SupportBorrowIncentiveCoins[]
569
570
  ) {
570
571
  return await queryBorrowIncentiveAccounts(this, obligationId, coinNames);
@@ -23,6 +23,7 @@ import type {
23
23
  MarketPools,
24
24
  } from '../types';
25
25
  import BigNumber from 'bignumber.js';
26
+ import { SuiObjectRef } from '@mysten/sui/client';
26
27
 
27
28
  /**
28
29
  * Query borrow incentive pools data using moveCall
@@ -188,7 +189,7 @@ export const queryBorrowIncentiveAccounts = async (
188
189
  }: {
189
190
  utils: ScallopUtils;
190
191
  },
191
- obligationId: string,
192
+ obligationId: string | SuiObjectRef,
192
193
  borrowIncentiveCoinNames: SupportBorrowIncentiveCoins[] = [
193
194
  ...SUPPORT_BORROW_INCENTIVE_POOLS,
194
195
  ]
@@ -292,33 +292,65 @@ const queryRequiredMarketObjects = async (
292
292
  // Map the results back to poolCoinNames
293
293
  const mapObjects = (
294
294
  tasks: { poolCoinName: string; [key: string]: string | undefined }[],
295
- fetchedObjects: SuiObjectData[]
295
+ fetchedObjects: SuiObjectData[],
296
+ keyValue: string
296
297
  ) => {
297
298
  const resultMap: Record<string, SuiObjectData> = {};
298
- let fetchedIndex = 0;
299
+ const fetchedObjectMap = fetchedObjects.reduce(
300
+ (acc, obj) => {
301
+ acc[obj.objectId] = obj;
302
+ return acc;
303
+ },
304
+ {} as Record<string, SuiObjectData>
305
+ );
299
306
 
300
307
  for (const task of tasks) {
301
- const key = task[Object.keys(task)[1]]; // current object key being queried
302
- if (key) {
303
- resultMap[task.poolCoinName] = fetchedObjects[fetchedIndex];
304
- fetchedIndex++;
308
+ if (task[keyValue]) {
309
+ resultMap[task.poolCoinName] = fetchedObjectMap[task[keyValue]];
305
310
  }
306
311
  }
307
312
  return resultMap;
308
313
  };
309
314
 
310
- const balanceSheetMap = mapObjects(tasks, balanceSheetObjects);
311
- const collateralStatMap = mapObjects(tasks, collateralStatObjects);
312
- const borrowDynamicMap = mapObjects(tasks, borrowDynamicObjects);
313
- const interestModelMap = mapObjects(tasks, interestModelObjects);
314
- const riskModelMap = mapObjects(tasks, riskModelObjects);
315
- const borrowFeeMap = mapObjects(tasks, borrowFeeObjects);
316
- const supplyLimitMap = mapObjects(tasks, supplyLimitObjects);
317
- const borrowLimitMap = mapObjects(tasks, borrowLimitObjects);
318
- const isolatedAssetMap = mapObjects(tasks, isolatedAssetObjects);
319
-
315
+ const balanceSheetMap = mapObjects(
316
+ tasks,
317
+ balanceSheetObjects,
318
+ 'balanceSheet'
319
+ );
320
+ const collateralStatMap = mapObjects(
321
+ tasks,
322
+ collateralStatObjects,
323
+ 'collateralStat'
324
+ );
325
+ const borrowDynamicMap = mapObjects(
326
+ tasks,
327
+ borrowDynamicObjects,
328
+ 'borrowDynamic'
329
+ );
330
+ const interestModelMap = mapObjects(
331
+ tasks,
332
+ interestModelObjects,
333
+ 'interestModel'
334
+ );
335
+ const riskModelMap = mapObjects(tasks, riskModelObjects, 'riskModel');
336
+ const borrowFeeMap = mapObjects(tasks, borrowFeeObjects, 'borrowFeeKey');
337
+ const supplyLimitMap = mapObjects(
338
+ tasks,
339
+ supplyLimitObjects,
340
+ 'supplyLimitKey'
341
+ );
342
+ const borrowLimitMap = mapObjects(
343
+ tasks,
344
+ borrowLimitObjects,
345
+ 'borrowLimitKey'
346
+ );
347
+ const isolatedAssetMap = mapObjects(
348
+ tasks,
349
+ isolatedAssetObjects,
350
+ 'isolatedAssetKey'
351
+ );
320
352
  // Construct the final requiredObjects result
321
- return poolCoinNames.reduce(
353
+ const result = poolCoinNames.reduce(
322
354
  (acc, name) => {
323
355
  acc[name] = {
324
356
  balanceSheet: balanceSheetMap[name],
@@ -348,6 +380,8 @@ const queryRequiredMarketObjects = async (
348
380
  }
349
381
  >
350
382
  );
383
+
384
+ return result;
351
385
  };
352
386
 
353
387
  /**
@@ -27,6 +27,8 @@ import type {
27
27
  SupportBorrowIncentiveRewardCoins,
28
28
  SupportAssetCoins,
29
29
  } from '../types';
30
+ import { SuiObjectRef } from '@mysten/sui/client';
31
+ import { queryMultipleObjects } from './objectsQuery';
30
32
 
31
33
  /**
32
34
  * Get user lending infomation for specific pools.
@@ -311,7 +313,7 @@ export const getObligationAccounts = async (
311
313
  ownerAddress?: string,
312
314
  indexer: boolean = false
313
315
  ) => {
314
- const market = await query.queryMarket({ indexer });
316
+ const market = await query.getMarketPools(undefined, { indexer });
315
317
  const coinPrices = await query.getAllCoinPrices({
316
318
  marketPools: market.pools,
317
319
  });
@@ -320,12 +322,16 @@ export const getObligationAccounts = async (
320
322
  query.getObligations(ownerAddress),
321
323
  ]);
322
324
 
325
+ const obligationObjects = await queryMultipleObjects(
326
+ query.cache,
327
+ obligations.map((obligation) => obligation.id)
328
+ );
323
329
  const obligationAccounts: ObligationAccounts = {};
324
330
  await Promise.allSettled(
325
- obligations.map(async (obligation) => {
331
+ obligations.map(async (obligation, idx) => {
326
332
  obligationAccounts[obligation.keyId] = await getObligationAccount(
327
333
  query,
328
- obligation.id,
334
+ obligationObjects[idx] ?? obligation.id,
329
335
  ownerAddress,
330
336
  indexer,
331
337
  market,
@@ -342,13 +348,13 @@ export const getObligationAccounts = async (
342
348
  * Get obligation account data.
343
349
  *
344
350
  * @param query - The Scallop query instance.
345
- * @param obligationId - The obligation id.
351
+ * @param obligation - The obligation id.
346
352
  * @param indexer - Whether to use indexer.
347
353
  * @return Obligation account data.
348
354
  */
349
355
  export const getObligationAccount = async (
350
356
  query: ScallopQuery,
351
- obligationId: string,
357
+ obligation: string | SuiObjectRef,
352
358
  ownerAddress?: string,
353
359
  indexer: boolean = false,
354
360
  market?: Market,
@@ -362,7 +368,6 @@ export const getObligationAccount = async (
362
368
  ...SUPPORT_COLLATERALS,
363
369
  ] as SupportCollateralCoins[];
364
370
 
365
- // market = market ?? (await query.queryMarket({ indexer }));
366
371
  market = market ?? (await query.getMarketPools(undefined, { indexer }));
367
372
  coinPrices =
368
373
  coinPrices ?? (await query.getAllCoinPrices({ marketPools: market.pools }));
@@ -371,13 +376,13 @@ export const getObligationAccount = async (
371
376
 
372
377
  const [obligationQuery, borrowIncentivePools, borrowIncentiveAccounts] =
373
378
  await Promise.all([
374
- query.queryObligation(obligationId),
379
+ query.queryObligation(obligation),
375
380
  query.getBorrowIncentivePools(undefined, {
376
381
  coinPrices,
377
382
  indexer,
378
383
  marketPools: market.pools,
379
384
  }),
380
- query.getBorrowIncentiveAccounts(obligationId),
385
+ query.getBorrowIncentiveAccounts(obligation),
381
386
  ]);
382
387
 
383
388
  const collaterals: ObligationAccount['collaterals'] = {};
@@ -657,7 +662,8 @@ export const getObligationAccount = async (
657
662
  : BigNumber(0);
658
663
 
659
664
  const obligationAccount: ObligationAccount = {
660
- obligationId: obligationId,
665
+ obligationId:
666
+ typeof obligation === 'string' ? obligation : obligation.objectId,
661
667
  // Deposited collateral value (collateral balance)
662
668
  totalDepositedValue: totalDepositedValue.toNumber(),
663
669
  // Borrowed debt value (liabilities balance)
@@ -790,7 +796,6 @@ export const getTotalValueLocked = async (
790
796
  query: ScallopQuery,
791
797
  indexer: boolean = false
792
798
  ) => {
793
- // const market = await query.queryMarket({ indexer });
794
799
  const market = await query.getMarketPools(undefined, { indexer });
795
800
 
796
801
  let supplyValue = BigNumber(0);