@scallop-io/sui-scallop-sdk 1.3.4-alpha.7 → 1.3.4

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 (39) hide show
  1. package/dist/constants/common.d.ts +3 -3
  2. package/dist/constants/enum.d.ts +1 -1
  3. package/dist/constants/index.d.ts +1 -0
  4. package/dist/constants/poolAddress.d.ts +1 -1
  5. package/dist/index.js +434 -335
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +434 -335
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/models/scallopQuery.d.ts +11 -3
  10. package/dist/models/scallopUtils.d.ts +1 -1
  11. package/dist/queries/borrowLimitQuery.d.ts +9 -0
  12. package/dist/queries/coreQuery.d.ts +2 -0
  13. package/dist/queries/index.d.ts +1 -0
  14. package/dist/queries/portfolioQuery.d.ts +2 -0
  15. package/dist/queries/sCoinQuery.d.ts +1 -1
  16. package/dist/queries/supplyLimitQuery.d.ts +2 -2
  17. package/dist/types/query/core.d.ts +2 -0
  18. package/dist/types/utils.d.ts +1 -1
  19. package/package.json +1 -1
  20. package/src/constants/coinGecko.ts +4 -2
  21. package/src/constants/common.ts +6 -1
  22. package/src/constants/enum.ts +20 -15
  23. package/src/constants/index.ts +1 -0
  24. package/src/constants/poolAddress.ts +7 -1
  25. package/src/constants/pyth.ts +2 -0
  26. package/src/constants/testAddress.ts +76 -35
  27. package/src/models/scallopBuilder.ts +2 -3
  28. package/src/models/scallopQuery.ts +26 -18
  29. package/src/models/scallopUtils.ts +5 -6
  30. package/src/queries/borrowLimitQuery.ts +52 -0
  31. package/src/queries/coreQuery.ts +238 -229
  32. package/src/queries/index.ts +1 -0
  33. package/src/queries/isolatedAssetQuery.ts +4 -5
  34. package/src/queries/priceQuery.ts +6 -4
  35. package/src/queries/referralQuery.ts +0 -1
  36. package/src/queries/spoolQuery.ts +1 -1
  37. package/src/queries/supplyLimitQuery.ts +22 -18
  38. package/src/types/query/core.ts +2 -0
  39. package/src/types/utils.ts +1 -1
@@ -69,6 +69,8 @@ export declare class ScallopQuery {
69
69
  hasui?: MarketPool | undefined;
70
70
  vsui?: MarketPool | undefined;
71
71
  sca?: MarketPool | undefined;
72
+ fud?: MarketPool | undefined;
73
+ deep?: MarketPool | undefined;
72
74
  }>;
73
75
  /**
74
76
  * Get market pool
@@ -350,6 +352,8 @@ export declare class ScallopQuery {
350
352
  hasui?: import("../types").Lending | undefined;
351
353
  vsui?: import("../types").Lending | undefined;
352
354
  sca?: import("../types").Lending | undefined;
355
+ fud?: import("../types").Lending | undefined;
356
+ deep?: import("../types").Lending | undefined;
353
357
  }>;
354
358
  /**
355
359
  * Get user lending and spool information for specific pool.
@@ -452,7 +456,7 @@ export declare class ScallopQuery {
452
456
  * @param ownerAddress - The owner address.
453
457
  * @return All market sCoin amounts.
454
458
  */
455
- getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca", number>>>;
459
+ 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>>>;
456
460
  /**
457
461
  * Get sCoin amount.
458
462
  *
@@ -467,11 +471,15 @@ export declare class ScallopQuery {
467
471
  * @returns
468
472
  */
469
473
  getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
470
- getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca", number>>;
474
+ getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep", number>>;
471
475
  /**
472
- * Get supply limit of supply pool
476
+ * Get supply limit of lending pool
473
477
  */
474
478
  getPoolSupplyLimit(poolName: SupportPoolCoins): Promise<string | null>;
479
+ /**
480
+ * Get borrow limit of borrow pool
481
+ */
482
+ getPoolBorrowLimit(poolName: SupportPoolCoins): Promise<string | null>;
475
483
  /**
476
484
  * Get list of isolated assets
477
485
  */
@@ -69,7 +69,7 @@ export declare class ScallopUtils {
69
69
  * @param sCoinType
70
70
  * @returns sCoin name
71
71
  */
72
- parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca";
72
+ parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep";
73
73
  /**
74
74
  * Convert sCoin name into its underlying coin type
75
75
  * @param sCoinName
@@ -0,0 +1,9 @@
1
+ import { ScallopUtils } from 'src/models';
2
+ import { SupportPoolCoins } from 'src/types';
3
+ /**
4
+ * Return supply limit of a pool (including the decimals)
5
+ * @param utils
6
+ * @param poolName
7
+ * @returns supply limit (decimals included)
8
+ */
9
+ export declare const getBorrowLimit: (utils: ScallopUtils, poolName: SupportPoolCoins) => Promise<string | null>;
@@ -40,6 +40,8 @@ export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: Suppo
40
40
  hasui?: MarketPool | undefined;
41
41
  vsui?: MarketPool | undefined;
42
42
  sca?: MarketPool | undefined;
43
+ fud?: MarketPool | undefined;
44
+ deep?: MarketPool | undefined;
43
45
  }>;
44
46
  /**
45
47
  * Get market pool data.
@@ -9,3 +9,4 @@ export * from './sCoinQuery';
9
9
  export * from './spoolQuery';
10
10
  export * from './supplyLimitQuery';
11
11
  export * from './vescaQuery';
12
+ export * from './borrowLimitQuery';
@@ -24,6 +24,8 @@ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportP
24
24
  hasui?: Lending | undefined;
25
25
  vsui?: Lending | undefined;
26
26
  sca?: Lending | undefined;
27
+ fud?: Lending | undefined;
28
+ deep?: Lending | undefined;
27
29
  }>;
28
30
  /**
29
31
  * Get user lending infomation for specific pool.
@@ -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", number>>>;
22
+ }, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep", number>>>;
23
23
  /**
24
24
  * Query owned sCoin amount.
25
25
  *
@@ -1,5 +1,5 @@
1
- import { ScallopUtils } from '../models';
2
- import { SupportPoolCoins } from '../types';
1
+ import { ScallopUtils } from 'src/models';
2
+ import { SupportPoolCoins } from 'src/types';
3
3
  /**
4
4
  * Return supply limit of a pool (including the decimals)
5
5
  * @param utils
@@ -123,6 +123,7 @@ export type MarketPool = {
123
123
  coinDecimal: number;
124
124
  coinPrice: number;
125
125
  maxSupplyCoin: number;
126
+ maxBorrowCoin: number;
126
127
  isIsolated: boolean;
127
128
  } & Required<Pick<ParsedMarketPoolData, 'highKink' | 'midKink' | 'reserveFactor' | 'borrowWeight' | 'borrowFee' | 'marketCoinSupplyAmount' | 'minBorrowAmount'>> & CalculatedMarketPoolData;
128
129
  export type MarketCollateral = {
@@ -133,6 +134,7 @@ export type MarketCollateral = {
133
134
  coinWrappedType: CoinWrappedType;
134
135
  coinDecimal: number;
135
136
  coinPrice: number;
137
+ isIsolated: boolean;
136
138
  } & Required<Pick<ParsedMarketCollateralData, 'collateralFactor' | 'liquidationFactor' | 'liquidationDiscount' | 'liquidationPanelty' | 'liquidationReserveFactor'>> & CalculatedMarketCollateralData;
137
139
  export type OriginMarketPoolData = {
138
140
  type: {
@@ -13,7 +13,7 @@ export type PoolAddressInfo = {
13
13
  decimal: number;
14
14
  pythFeedId: string;
15
15
  lendingPoolAddress: string;
16
- collateralPoolAddress: string;
16
+ collateralPoolAddress?: string;
17
17
  sCoinAddress: string | undefined;
18
18
  marketCoinAddress: string;
19
19
  coinAddress: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "1.3.4-alpha.7",
3
+ "version": "1.3.4",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -1,11 +1,11 @@
1
1
  import { SupportPoolCoins } from 'src/types/constant/common';
2
2
 
3
3
  export const COIN_GECKGO_IDS: Record<SupportPoolCoins, string> = {
4
- usdc: 'usdc-coin',
4
+ usdc: 'usdc',
5
5
  sbeth: 'ethereum',
6
6
  weth: 'ethereum',
7
7
  wbtc: 'bitcoin',
8
- wusdc: 'usdc-coin',
8
+ wusdc: 'usdc',
9
9
  wusdt: 'tether',
10
10
  sui: 'sui',
11
11
  wapt: 'aptos',
@@ -15,4 +15,6 @@ export const COIN_GECKGO_IDS: Record<SupportPoolCoins, string> = {
15
15
  hasui: 'sui',
16
16
  vsui: 'sui',
17
17
  sca: 'scallop-2',
18
+ deep: 'deepbook',
19
+ fud: 'fud-the-pug',
18
20
  };
@@ -7,7 +7,8 @@ export const USE_TEST_ADDRESS: boolean = false;
7
7
  export const ADDRESSES_ID =
8
8
  IS_VE_SCA_TEST || USE_TEST_ADDRESS
9
9
  ? ('65fb07c39c845425d71d7b18' as const)
10
- : ('66f8e7ed9bb9e07fdfb86bbb' as const);
10
+ : ('675c65cd301dd817ea262e76' as const);
11
+ // : ('66f8e7ed9bb9e07fdfb86bbb' as const);
11
12
  // : ('664dfe22898c36c159e28bc8' as const);
12
13
 
13
14
  export const PROTOCOL_OBJECT_ID = IS_VE_SCA_TEST
@@ -44,6 +45,8 @@ export const SUPPORT_POOLS = [
44
45
  'hasui',
45
46
  'vsui',
46
47
  'sca',
48
+ 'fud',
49
+ 'deep',
47
50
  ] as const;
48
51
 
49
52
  export const SUPPORT_COLLATERALS = [
@@ -89,6 +92,8 @@ export const SUPPORT_SCOIN = [
89
92
  'scetus',
90
93
  'swsol',
91
94
  'swbtc',
95
+ 'sdeep',
96
+ 'sfud',
92
97
  ] as const;
93
98
 
94
99
  export const SUPPORT_SUI_BRIDGE = ['sbeth'] as const;
@@ -16,6 +16,8 @@ export const coinDecimals: types.SupportCoinDecimals = {
16
16
  hasui: 9,
17
17
  vsui: 9,
18
18
  sca: 9,
19
+ deep: 6,
20
+ fud: 5,
19
21
  susdc: 6,
20
22
  sweth: 8,
21
23
  ssbeth: 8,
@@ -30,6 +32,8 @@ export const coinDecimals: types.SupportCoinDecimals = {
30
32
  shasui: 9,
31
33
  svsui: 9,
32
34
  ssca: 9,
35
+ sdeep: 6,
36
+ sfud: 5,
33
37
  };
34
38
 
35
39
  export const assetCoins: types.AssetCoins = {
@@ -47,6 +51,8 @@ export const assetCoins: types.AssetCoins = {
47
51
  hasui: 'hasui',
48
52
  vsui: 'vsui',
49
53
  sca: 'sca',
54
+ deep: 'deep',
55
+ fud: 'fud',
50
56
  };
51
57
 
52
58
  export const marketCoins: types.MarketCoins = {
@@ -64,6 +70,8 @@ export const marketCoins: types.MarketCoins = {
64
70
  shasui: 'shasui',
65
71
  svsui: 'svsui',
66
72
  ssca: 'ssca',
73
+ sdeep: 'sdeep',
74
+ sfud: 'sfud',
67
75
  };
68
76
 
69
77
  export const sCoins: types.SCoins = {
@@ -80,6 +88,8 @@ export const sCoins: types.SCoins = {
80
88
  ssca: 'ssca',
81
89
  swsol: 'swsol',
82
90
  swbtc: 'swbtc',
91
+ sfud: 'sfud',
92
+ sdeep: 'sdeep',
83
93
  };
84
94
 
85
95
  export const stakeMarketCoins: types.StakeMarketCoins = {
@@ -140,6 +150,9 @@ export const coinIds: types.AssetCoinIds = {
140
150
  sca: IS_VE_SCA_TEST
141
151
  ? '0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524'
142
152
  : '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6',
153
+ // isolated assets
154
+ deep: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
155
+ fud: '0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1',
143
156
  };
144
157
 
145
158
  export const wormholeCoinIds: types.WormholeCoinIds = {
@@ -181,6 +194,9 @@ export const sCoinIds: types.SCoinIds = {
181
194
  '0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL',
182
195
  swbtc:
183
196
  '0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC',
197
+ sdeep:
198
+ '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
199
+ sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
184
200
  } as const;
185
201
 
186
202
  export const sCoinTypeToName = Object.entries(sCoinIds).reduce(
@@ -193,21 +209,10 @@ export const sCoinTypeToName = Object.entries(sCoinIds).reduce(
193
209
 
194
210
  // TEST VERSION
195
211
  // export const sCoinIds: types.SCoinIds = {
196
- // ssui: '0xfac769100bccc0caebcf4f4e2d00ac2f8883f07f724be28940df90605f5e7e9a::scallop_sui::SCALLOP_SUI',
197
- // scetus:
198
- // '0x8b71e6d323ed78515af2bead13bf3d0da1562ba4a99234eb7c4f14fd39ef0427::scallop_cetus::SCALLOP_CETUS',
199
- // ssca: '0x0a9d3c6c9af9f6e8def82921541bcbd17f73ed31bed3adcb684f2a4c267e42f0::scallop_sca::SCALLOP_SCA',
200
- // swusdc:
201
- // '0xaedc3ab75db8680b81a755015fa90124d217be93457b893c05bac033817defaf::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
202
- // swusdt:
203
- // '0xbf02fc87ddc104b342ad8414c85ceadf5b0c823c055a06fb0ed776272c01a52a::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
204
- // sweth: '0x27d54f43e3eda701be56b82e5756e41c84467cd202f5cf713d5f9e45a9f1b6bc::scallop_wormhole_eth::SCALLOP_WORMHOLE_ETH',
205
- // safsui:
206
- // '0xb75b46d975d8d80670b53a6bee90baaa8ce2e0b7d397f079447d641eef6b44ad::scallop_af_sui::SCALLOP_AF_SUI',
207
- // shasui:
208
- // '0xd973a723874e2c7cde196602a79155a1343a933f8cf87d9b1bb7408bc1acbc58::scallop_ha_sui::SCALLOP_HA_SUI',
209
- // svsui:
210
- // '0x97023a317320c4498cc4cd239dd02fd30c28246e5e8f81325d63f2bd8d70f6b3::scallop_v_sui::SCALLOP_V_SUI',
212
+ // ssui: '0xf569919046f19a0c40b519ecfbb6ca0319698cd5908716c29b62ef56541f298b::scallop_sui::SCALLOP_SUI',
213
+ // swusdt: '0xac781d9f73058ff5e69f9bf8dde32f2e8c71c66d7fe8497fc83b2d9182254b22::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
214
+ // swusdc: '0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
215
+ // ssca: '0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA',
211
216
  // } as const;
212
217
 
213
218
  // export const sCoinTreasuryCaps: types.SCoinTreasuryCaps = {
@@ -10,3 +10,4 @@ export * from './rpc';
10
10
  export * from './testAddress';
11
11
  export * from './tokenBucket';
12
12
  export * from './vesca';
13
+ export * from './testAddress';
@@ -4,7 +4,7 @@ export const POOL_ADDRESSES: Record<
4
4
  SupportPoolCoins,
5
5
  {
6
6
  lendingPoolAddress: string;
7
- collateralPoolAddress: string;
7
+ collateralPoolAddress?: string;
8
8
  }
9
9
  > = {
10
10
  usdc: {
@@ -91,4 +91,10 @@ export const POOL_ADDRESSES: Record<
91
91
  collateralPoolAddress:
92
92
  '0xff677a5d9e9dc8f08f0a8681ebfc7481d1c7d57bc441f2881974adcdd7b13c31',
93
93
  },
94
+ fud: {
95
+ lendingPoolAddress: '',
96
+ },
97
+ deep: {
98
+ lendingPoolAddress: '',
99
+ },
94
100
  };
@@ -22,4 +22,6 @@ export const PYTH_FEED_IDS: Record<SupportPoolCoins, string> = {
22
22
  hasui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
23
23
  vsui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
24
24
  sca: '7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc',
25
+ deep: '29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',
26
+ fud: '6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75',
25
27
  };
@@ -5,17 +5,17 @@ export const TEST_ADDRESSES: AddressesInterface = {
5
5
  // version:
6
6
  // '0x07871c4b3c847a0f674510d4978d5cf6f960452795e8ff6f189fd2088a3f6ac7',
7
7
  version:
8
- '0x6156d5cd1538bec8a167a40fe1209a4ec9cf8137921fe0a697f191ac561f0b09',
8
+ '0xd318de9b0f6873879a82cbfcc2daa1d1591a8b54e7cea9f4b567da63c692a52b',
9
9
  versionCap:
10
10
  '0x590a4011cb649b3878f3ea14b3a78674642a9548d79b7e091ef679574b158a07',
11
11
  // object:
12
12
  // '0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf',
13
13
  object:
14
- '0x87ddec2984645dbbe2403a509cc6edf393a43acdba9b77d45da2bcbefcf733c1',
14
+ '0x6c23585e940a989588432509107e98bae06dbca4e333f26d0635d401b3c7c76d',
15
15
  // market:
16
16
  // '0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9',
17
17
  market:
18
- '0x8606ed145cc887985b8ed793f7753ff5dc762a42c379dac035f568e1bac58490',
18
+ '0x9d6434e97f3f98fd9b0c0e1dca22632073985abcd22541feae7ee1e34cbe3af2',
19
19
  adminCap:
20
20
  '0x09689d018e71c337d9db6d67cbca06b74ed92196103624028ccc3ecea411777c',
21
21
  coinDecimalsRegistry:
@@ -23,8 +23,23 @@ export const TEST_ADDRESSES: AddressesInterface = {
23
23
  // obligationAccessStore:
24
24
  // '0x733e30b7c94d619d78cb8f5bc4bfbb759ced9a531239028caabb2474e5be59c9',
25
25
  obligationAccessStore:
26
- '0x48b472d68ca910c45f7f3b6c26836b6aa6d2569810d94b1b939023da05ae0a23',
26
+ '0x46e9b44a77ee9c9d33cc2689ecdfbb8f681935cbc6bdf6ac3df048e396c36c82',
27
27
  coins: {
28
+ usdc: {
29
+ id: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7',
30
+ metaData:
31
+ '0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6',
32
+ treasury: '',
33
+ oracle: {
34
+ supra: '',
35
+ switchboard: '',
36
+ pyth: {
37
+ feed: 'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
38
+ feedObject:
39
+ '0x5dec622733a204ca27f5a90d8c2fad453cc6665186fd5dff13a83d0b6c9027ab',
40
+ },
41
+ },
42
+ },
28
43
  cetus: {
29
44
  id: '0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b',
30
45
  metaData:
@@ -206,6 +221,21 @@ export const TEST_ADDRESSES: AddressesInterface = {
206
221
  },
207
222
  },
208
223
  },
224
+ sbeth: {
225
+ id: '0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29',
226
+ metaData:
227
+ '0x89b04ba87f8832d4d76e17a1c9dce72eb3e64d372cf02012b8d2de5384faeef0',
228
+ treasury: '',
229
+ oracle: {
230
+ supra: '',
231
+ switchboard: '',
232
+ pyth: {
233
+ feed: 'ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace',
234
+ feedObject:
235
+ '0x9193fd47f9a0ab99b6e365a464c8a9ae30e6150fc37ed2a89c1586631f6fc4ab',
236
+ },
237
+ },
238
+ },
209
239
  },
210
240
  oracles: {
211
241
  xOracle:
@@ -249,7 +279,7 @@ export const TEST_ADDRESSES: AddressesInterface = {
249
279
  '0x3f203f6fff6a69d151e4f1cd931f22b68c489ef2759765662fc7baf673943c9e',
250
280
  },
251
281
  protocol: {
252
- id: '0x87ddec2984645dbbe2403a509cc6edf393a43acdba9b77d45da2bcbefcf733c1',
282
+ id: '0xb784ea287d944e478a3ceaa071f8885072cce6b7224cf245914dc2f9963f460e',
253
283
  upgradeCap:
254
284
  '0x38527d154618d1fd5a644b90717fe07cf0e9f26b46b63e9568e611a3f86d5c1a',
255
285
  },
@@ -269,7 +299,7 @@ export const TEST_ADDRESSES: AddressesInterface = {
269
299
  // '0x0d535c35f608b9b01b7ccce11acf43b1dd80c1b72bf8b541744a6e28e8d2745f',
270
300
  // },
271
301
  query: {
272
- id: '0xe4f9d62d17746d5b9dbf0d5557747430021a71575780b515161210cdba0a4c1c',
302
+ id: '0x89706958f43fb170de134579e3fbc53972b946ee78bd2442d8e1adc36074fbdc',
273
303
  upgradeCap:
274
304
  '0x0d535c35f608b9b01b7ccce11acf43b1dd80c1b72bf8b541744a6e28e8d2745f',
275
305
  },
@@ -310,6 +340,11 @@ export const TEST_ADDRESSES: AddressesInterface = {
310
340
  // '0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9',
311
341
  '0xc3206071a8d43212efb6e3b5504f2321f8df97ab122b466c0bc7cfdf398dc13a',
312
342
  },
343
+ susdc: {
344
+ id: '0x0b5f5f413bd3799e4052c37311966c77f3a4545eb125d2e93e67a68478021918',
345
+ rewardPoolId:
346
+ '0x85ed6ed72ea97c35dbf0cdc7ed6fbc48d8ec15de9b17c74bf4512df8a6d7f166',
347
+ },
313
348
  swusdc: {
314
349
  // id: '0x4ace6648ddc64e646ba47a957c562c32c9599b3bba8f5ac1aadb2ae23a2f8ca0',
315
350
  id: '0xf1b383b9cf2e9f515fc69567df1053098f273849d09cd84b0278a773429bd2b2',
@@ -354,35 +389,35 @@ export const TEST_ADDRESSES: AddressesInterface = {
354
389
  config: '',
355
390
  },
356
391
  borrowIncentive: {
357
- id: '0x6152f696fc3a658f33c4b891764731a59153125ffedfa8bff7167c42823f58a9',
392
+ id: '0x85769d63565ce99c7622f8e336ca1460926ddf29738ad2a39407b5cac29f61fe',
358
393
  adminCap:
359
- '0xc486afa253646f4d381e81d7f1df8aa4723b845a6bb356f69bad635ffefffe2c',
394
+ '0x56ac8e6f2b360b2b35c0168d72cc6cd17d9592afb83709865cb87af24bb2025b',
360
395
  object:
361
- '0x002875153e09f8145ab63527bc85c00f2bd102e12f9573c47f8cdf1a1cb62934',
362
- query: '0x529edc54a3dce2207703ceebbccb0ac14133f7825c1f528775ba0d85a4063489',
396
+ '0x85769d63565ce99c7622f8e336ca1460926ddf29738ad2a39407b5cac29f61fe',
397
+ query: '0x8e0d00f8ff1199d7c5fe56cea0e901a525daeefff0445a1635ace8282ae3302c',
363
398
  incentivePools:
364
- '0x6547e143d406b5ccd5f46aae482497de279cc1a68c406f701df70a05f9212ab4',
399
+ '0x9d564c93128c6ab0c0d3e050a47f11df0b91494f3bb779bdc1301c1c637f15eb',
365
400
  incentiveAccounts:
366
- '0xc4701fdbc1c92f9a636d334d66012b3027659e9fb8aff27279a82edfb6b77d02',
401
+ '0x09e6040e798246de04941bc79a3ba62d3eca6d7a218cc30f21fb07f478fa2926',
367
402
  config:
368
- '0xdf5d04b4691cc67e82fd4db8394d89ff44823a9de29716c924f74bb4f11cc1f7',
403
+ '0x43d4ca1dfc90b161c4240facd119e74e4b850cca2957f88c2ec289c9380da064',
369
404
  },
370
405
  referral: {
371
- id: '0xa3654ebb63eb06c0f4ff52f8aa6512df9f164f7772bdf15dac3709bd3798dda9',
406
+ id: '0x1bf5a8ce77050d8052549d743e16b469f15aa6b81b752b78b6ebb65179665f5a',
372
407
  object:
373
408
  '0x5658d4bf5ddcba27e4337b4262108b3ad1716643cac8c2054ac341538adc72ec',
374
409
  adminCap:
375
410
  '0xc5dc06b9074291259f2cac460c940012c781c4430e42125c541cc43101c3bcbd',
376
411
  referralBindings:
377
- '0xf63299d58789d99de94092b9011323466e55ca0c1ea1a7a3786a589af46e1c09',
412
+ '0xcf184487782bed962bf678001efe775d31fb94b9992333a57594cf15d79d5ced',
378
413
  bindingTableId:
379
- '0x1c8202b17267ec8d6cf97ca013615354181a04f179570e42601ff2dae19294b1',
414
+ '0x41a50e258c0a266ce84e0e1a618dbf70b878cc943909e613089a50afcceb2bc0',
380
415
  referralRevenuePool:
381
- '0x6abd852caf90769c1b185cdf636d841673fa95528f0550f018b8a138bd283c07',
416
+ '0xc24e3e5e37032f29a3dd91a9a1f057af8821b7e6c148e9683900ac8b6d30f0c6',
382
417
  revenueTableId:
383
418
  '0x595baa3654c297bff84ab7786a2d250f019cefc66e8df8e89fd9d41e02bd30dd',
384
419
  referralTiers:
385
- '0x962cb903d8d7346190c5204785ccbb91b61086aa764f674c8145df82335cf83e',
420
+ '0x144350f3db9b46d11b140084cd54e6de0b9c3b8d265ce8059b51d0ef58ea464b',
386
421
  tiersTableId:
387
422
  '0xeac755a7a8b7798530905ac79e8c114f19d0f130f6eab012954f08faac29c75d',
388
423
  // authorizedWitnessList:
@@ -390,21 +425,21 @@ export const TEST_ADDRESSES: AddressesInterface = {
390
425
  authorizedWitnessList:
391
426
  '0x9d6223dc52015b8a3986a573590ef2af8f1b8f3e4685513888c052f001b87e7f',
392
427
  version:
393
- '0x1bd4b7285f72e11c316b828c7c47b3f4da18dcec9f9b3dba6d8629cbb6f93e5e',
428
+ '0x3545849eb97723e676a476ec9d4fe5f2eb0eb2c6b78972851114fd4c7ed4639f',
394
429
  },
395
430
  vesca: {
396
- id: '0xb15b6e0cdd85afb5028bea851dd249405e734d800a259147bbc24980629723a4',
431
+ id: '0x1158813b32962c2d22888fae257d5f2365b03631f0cd5d5b912ccdf51ff4e2f2',
397
432
  object:
398
- '0xb15b6e0cdd85afb5028bea851dd249405e734d800a259147bbc24980629723a4',
433
+ '0x1158813b32962c2d22888fae257d5f2365b03631f0cd5d5b912ccdf51ff4e2f2',
399
434
  adminCap:
400
435
  '0x8ffa76135c5b85c5fbd73a6448a4a733d826cb63a267ab817656acb77c72d4a5',
401
436
  tableId:
402
- '0xe3153b2bf124be0b86cb8bd468346a861efd0da52fc42197b54d2f616488a311',
403
- table: '0x611cb8d9d4d90867467b5ebdf4cc447a0047ed5b01334a28a29fcfe733e3d609',
437
+ '0x0a0b7f749baeb61e3dfee2b42245e32d0e6b484063f0a536b33e771d573d7246',
438
+ table: '0xd3a4632b1080f7d96e1c2487d4dabf2c1196916937c505a69954ac9f393be8d0',
404
439
  treasury:
405
- '0xe8c112c09b88158dc6c8e23d1fbae5b3c7136cdee54b7dafc08e65db28c4a5bc',
440
+ '0xafa4b6231e49c15a22d641ce33fda761baaf650fa21899dfa2eb1716146e7306',
406
441
  config:
407
- '0xe0a2ff281e73c1d53cfa85807080f87e833e4f1a7f93dcf8800b3865269a76b9',
442
+ '0x7cbcb0a342179577a117dfdff974cf1ab765d3b571067bf22ddf5f9e3a667922',
408
443
  },
409
444
  loyaltyProgram: {
410
445
  id: '0xd17bcf8b5a59652c36225d478564a8593ae0ed7d650bcacdda1d6fe179127907',
@@ -416,13 +451,13 @@ export const TEST_ADDRESSES: AddressesInterface = {
416
451
  '0x748a80395849ed37db1b0e14f2ab5d1d96458d2359ab3a84eb079d0f4ac7cf2e',
417
452
  },
418
453
  scoin: {
419
- id: '0xad2ca2aa5089df94bb2d444d5eb3520378c2f2dfb3a0bd2a2c994145ac4b0a53',
454
+ id: '0x773dab39c90fe05439b06a2d061795e52a974ff92c2aef90b2ee467acf7f33c8',
420
455
  coins: {
421
456
  ssui: {
422
457
  coinType:
423
- '0xfac769100bccc0caebcf4f4e2d00ac2f8883f07f724be28940df90605f5e7e9a::scallop_sui::SCALLOP_SUI',
458
+ '0xf569919046f19a0c40b519ecfbb6ca0319698cd5908716c29b62ef56541f298b::scallop_sui::SCALLOP_SUI',
424
459
  treasury:
425
- '0x9cb4551b36c17d37e19d700147fa819ea1c487ff8bcf18374de2cceb2e9d4845',
460
+ '0x0e499640a12c38dd9cc44532f5bc5fd1b6da86d2f9a8810357250f4b26e9e5c7',
426
461
  },
427
462
  scetus: {
428
463
  coinType:
@@ -432,21 +467,21 @@ export const TEST_ADDRESSES: AddressesInterface = {
432
467
  },
433
468
  ssca: {
434
469
  coinType:
435
- '0x0a9d3c6c9af9f6e8def82921541bcbd17f73ed31bed3adcb684f2a4c267e42f0::scallop_sca::SCALLOP_SCA',
470
+ '0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA',
436
471
  treasury:
437
- '0xe818636d1d6c46d6ea1a2dce9d94696d7cbc18ce27451b603eeaa47aba8d75e0',
472
+ '0x5f1c5de1df7341075d119570269b7b452af50afe8363080638f1ae29a554c038',
438
473
  },
439
474
  swusdc: {
440
475
  coinType:
441
- '0xaedc3ab75db8680b81a755015fa90124d217be93457b893c05bac033817defaf::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
476
+ '0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
442
477
  treasury:
443
- '0xfc6971648f867f7fd6928d1b873af71577e2eaf2c7543ef8bc82c431d833ae78',
478
+ '0x471fbab72578bab577263006fe32543b6e76153fffa2bef69affe4bc4934258f',
444
479
  },
445
480
  swusdt: {
446
481
  coinType:
447
- '0xbf02fc87ddc104b342ad8414c85ceadf5b0c823c055a06fb0ed776272c01a52a::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
482
+ '0xac781d9f73058ff5e69f9bf8dde32f2e8c71c66d7fe8497fc83b2d9182254b22::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
448
483
  treasury:
449
- '0xb9593e2c3a0ba796ee815012b75ae46468ea78cda0188b9ac6816efe65503521',
484
+ '0x921a4ed4bb4b4f11f51a462c83f4c0f6b60a90e441d1bc0d26d6fd893146bf4d',
450
485
  },
451
486
  sweth: {
452
487
  coinType:
@@ -470,7 +505,13 @@ export const TEST_ADDRESSES: AddressesInterface = {
470
505
  coinType:
471
506
  '0x97023a317320c4498cc4cd239dd02fd30c28246e5e8f81325d63f2bd8d70f6b3::scallop_v_sui::SCALLOP_V_SUI',
472
507
  treasury:
473
- '0x327114f0bf3559d7e2de10282147ed76a236c7c6775029165c4db09a6062ead6ƒ',
508
+ '0x327114f0bf3559d7e2de10282147ed76a236c7c6775029165c4db09a6062ead6',
509
+ },
510
+ ssbeth: {
511
+ coinType:
512
+ '0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH',
513
+ treasury:
514
+ '0xfd0f02def6358a1f266acfa1493d4707ee8387460d434fb667d63d755ff907ed',
474
515
  },
475
516
  },
476
517
  },
@@ -99,10 +99,9 @@ export class ScallopBuilder {
99
99
  * @param address - ScallopAddress instance.
100
100
  */
101
101
  public async init(force: boolean = false, address?: ScallopAddress) {
102
- if (force || !this.address.getAddresses() || !address?.getAddresses()) {
102
+ if (address && !this.address) this.address = address;
103
+ if (force || !this.address.getAddresses()) {
103
104
  await this.address.read();
104
- } else {
105
- this.address = address;
106
105
  }
107
106
  await this.query.init(force, this.address);
108
107
  await this.utils.init(force, this.address);
@@ -1,5 +1,10 @@
1
1
  import { SuiKit } from '@scallop-io/sui-kit';
2
- import { ADDRESSES_ID, SUPPORT_POOLS, SUPPORT_SPOOLS } from '../constants';
2
+ import {
3
+ ADDRESSES_ID,
4
+ SUPPORT_POOLS,
5
+ SUPPORT_SPOOLS,
6
+ DEFAULT_CACHE_OPTIONS,
7
+ } from '../constants';
3
8
  import {
4
9
  queryMarket,
5
10
  getObligations,
@@ -34,6 +39,14 @@ import {
34
39
  getFlashLoanFees,
35
40
  getVeSca,
36
41
  getBorrowIncentivePools,
42
+ getBorrowLimit,
43
+ getIsolatedAssets,
44
+ isIsolatedAsset,
45
+ getSupplyLimit,
46
+ getSCoinAmount,
47
+ getSCoinAmounts,
48
+ getSCoinSwapRate,
49
+ getSCoinTotalSupply,
37
50
  } from '../queries';
38
51
  import {
39
52
  ScallopQueryParams,
@@ -55,23 +68,10 @@ import { ScallopAddress } from './scallopAddress';
55
68
  import { ScallopUtils } from './scallopUtils';
56
69
  import { ScallopIndexer } from './scallopIndexer';
57
70
  import { ScallopCache } from './scallopCache';
58
- import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
59
71
  import { SuiObjectData } from '@mysten/sui/client';
60
- import {
61
- getSCoinAmount,
62
- getSCoinAmounts,
63
- getSCoinSwapRate,
64
- getSCoinTotalSupply,
65
- } from 'src/queries/sCoinQuery';
66
72
  import { normalizeSuiAddress } from '@mysten/sui/utils';
67
- import {
68
- getSupplyLimit,
69
- getIsolatedAssets,
70
- isIsolatedAsset,
71
- } from 'src/queries';
72
73
  import { withIndexerFallback } from 'src/utils/indexer';
73
74
  import { newSuiKit } from './suiKit';
74
-
75
75
  /**
76
76
  * @description
77
77
  * It provides methods for getting on-chain data from the Scallop contract.
@@ -174,11 +174,12 @@ export class ScallopQuery {
174
174
  * @param address - ScallopAddress instance.
175
175
  */
176
176
  public async init(force: boolean = false, address?: ScallopAddress) {
177
- if (force || !this.address.getAddresses() || !address?.getAddresses()) {
178
- await this.address.read();
179
- } else {
177
+ if (address && !this.address) {
180
178
  this.address = address;
181
179
  }
180
+ if (force || !this.address.getAddresses()) {
181
+ await this.address.read();
182
+ }
182
183
 
183
184
  await this.utils.init(force, this.address);
184
185
  }
@@ -781,12 +782,19 @@ export class ScallopQuery {
781
782
  }
782
783
 
783
784
  /**
784
- * Get supply limit of supply pool
785
+ * Get supply limit of lending pool
785
786
  */
786
787
  public async getPoolSupplyLimit(poolName: SupportPoolCoins) {
787
788
  return await getSupplyLimit(this.utils, poolName);
788
789
  }
789
790
 
791
+ /**
792
+ * Get borrow limit of borrow pool
793
+ */
794
+ public async getPoolBorrowLimit(poolName: SupportPoolCoins) {
795
+ return await getBorrowLimit(this.utils, poolName);
796
+ }
797
+
790
798
  /**
791
799
  * Get list of isolated assets
792
800
  */