@scallop-io/sui-scallop-sdk 1.3.41 → 1.4.1-alpha.1

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 (46) hide show
  1. package/dist/constants/common.d.ts +3 -3
  2. package/dist/constants/enum.d.ts +2 -2
  3. package/dist/constants/tokenBucket.d.ts +1 -1
  4. package/dist/index.js +412 -334
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +411 -333
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/models/scallopClient.d.ts +4 -4
  9. package/dist/models/scallopQuery.d.ts +74 -20
  10. package/dist/models/scallopUtils.d.ts +11 -11
  11. package/dist/queries/borrowIncentiveQuery.d.ts +2 -2
  12. package/dist/queries/coreQuery.d.ts +0 -2
  13. package/dist/queries/portfolioQuery.d.ts +0 -2
  14. package/dist/queries/priceQuery.d.ts +32 -2
  15. package/dist/queries/sCoinQuery.d.ts +1 -1
  16. package/dist/test.d.ts +0 -0
  17. package/dist/types/builder/borrowIncentive.d.ts +6 -6
  18. package/dist/types/constant/common.d.ts +1 -1
  19. package/dist/types/utils.d.ts +2 -6
  20. package/package.json +1 -1
  21. package/src/builders/borrowIncentiveBuilder.ts +2 -13
  22. package/src/constants/coinGecko.ts +3 -2
  23. package/src/constants/common.ts +10 -5
  24. package/src/constants/enum.ts +44 -34
  25. package/src/constants/poolAddress.ts +9 -8
  26. package/src/constants/pyth.ts +3 -2
  27. package/src/constants/tokenBucket.ts +1 -1
  28. package/src/models/scallopClient.ts +27 -10
  29. package/src/models/scallopQuery.ts +55 -31
  30. package/src/models/scallopUtils.ts +23 -18
  31. package/src/queries/borrowIncentiveQuery.ts +29 -12
  32. package/src/queries/borrowLimitQuery.ts +3 -2
  33. package/src/queries/coreQuery.ts +185 -196
  34. package/src/queries/isolatedAssetQuery.ts +3 -2
  35. package/src/queries/portfolioQuery.ts +81 -77
  36. package/src/queries/priceQuery.ts +35 -2
  37. package/src/queries/sCoinQuery.ts +3 -3
  38. package/src/queries/spoolQuery.ts +4 -6
  39. package/src/queries/supplyLimitQuery.ts +3 -2
  40. package/src/test.ts +20 -0
  41. package/src/types/builder/borrowIncentive.ts +10 -15
  42. package/src/types/constant/common.ts +1 -2
  43. package/src/types/utils.ts +2 -10
  44. package/src/utils/indexer.ts +9 -3
  45. package/src/utils/query.ts +0 -87
  46. package/src/utils/tokenBucket.ts +2 -2
@@ -7,7 +7,7 @@ import type { SuiTransactionBlockResponse } from '@mysten/sui/client';
7
7
  import type { TransactionObjectArgument } from '@mysten/sui/transactions';
8
8
  import { ScallopCache } from './scallopCache';
9
9
  import type { SuiObjectArg } from '@scallop-io/sui-kit';
10
- import type { ScallopClientFnReturnType, ScallopClientParams, SupportPoolCoins, SupportCollateralCoins, SupportAssetCoins, SupportStakeCoins, SupportStakeMarketCoins, SupportBorrowIncentiveCoins, ScallopTxBlock, ScallopClientVeScaReturnType, ScallopClientInstanceParams } from '../types';
10
+ import type { ScallopClientFnReturnType, ScallopClientParams, SupportPoolCoins, SupportCollateralCoins, SupportAssetCoins, SupportStakeCoins, SupportStakeMarketCoins, ScallopTxBlock, ScallopClientVeScaReturnType, ScallopClientInstanceParams } from '../types';
11
11
  /**
12
12
  * @description
13
13
  * It provides contract interaction operations for general users.
@@ -284,16 +284,16 @@ export declare class ScallopClient {
284
284
  */
285
285
  unstakeObligation<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
286
286
  /**
287
- * unstake market coin from the specific spool.
287
+ * Claim borrow incentive reward.
288
288
  *
289
- * @param marketCoinName - Types of mak coin.
289
+ * @param poolName
290
290
  * @param amount - The amount of coins would deposit.
291
291
  * @param sign - Decide to directly sign the transaction or return the transaction block.
292
292
  * @param accountId - The stake account object.
293
293
  * @param walletAddress - The wallet address of the owner.
294
294
  * @return Transaction block response or transaction block
295
295
  */
296
- claimBorrowIncentive<S extends boolean>(coinName: SupportBorrowIncentiveCoins, obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
296
+ claimBorrowIncentive<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
297
297
  /**
298
298
  * Function to migrate all market coin in user wallet into sCoin
299
299
  * @returns Transaction response
@@ -38,8 +38,9 @@ export declare class ScallopQuery {
38
38
  * @param indexer - Whether to use indexer.
39
39
  * @return Market data.
40
40
  */
41
- queryMarket(indexer?: boolean, args?: {
42
- coinPrices: CoinPrices;
41
+ queryMarket(args?: {
42
+ coinPrices?: CoinPrices;
43
+ indexer?: boolean;
43
44
  }): Promise<import("../types").Market>;
44
45
  /**
45
46
  * Get market pools.
@@ -52,8 +53,9 @@ export declare class ScallopQuery {
52
53
  * @param indexer - Whether to use indexer.
53
54
  * @return Market pools data.
54
55
  */
55
- getMarketPools(poolCoinNames?: SupportPoolCoins[], indexer?: boolean, args?: {
56
+ getMarketPools(poolCoinNames?: SupportPoolCoins[], args?: {
56
57
  coinPrices?: CoinPrices;
58
+ indexer?: boolean;
57
59
  }): Promise<{
58
60
  usdc?: MarketPool | undefined;
59
61
  sbeth?: MarketPool | undefined;
@@ -69,8 +71,6 @@ export declare class ScallopQuery {
69
71
  hasui?: MarketPool | undefined;
70
72
  vsui?: MarketPool | undefined;
71
73
  sca?: MarketPool | undefined;
72
- fud?: MarketPool | undefined;
73
- deep?: MarketPool | undefined;
74
74
  }>;
75
75
  /**
76
76
  * Get market pool
@@ -79,9 +79,10 @@ export declare class ScallopQuery {
79
79
  * @param indexer - Whether to use indexer.
80
80
  * @return Market pool data.
81
81
  */
82
- getMarketPool(poolCoinName: SupportPoolCoins, indexer?: boolean, args?: {
82
+ getMarketPool(poolCoinName: SupportPoolCoins, args?: {
83
83
  marketObject?: SuiObjectData | null;
84
84
  coinPrice?: number;
85
+ indexer?: boolean;
85
86
  }): Promise<MarketPool | undefined>;
86
87
  /**
87
88
  * Get market collaterals.
@@ -94,7 +95,9 @@ export declare class ScallopQuery {
94
95
  * @param indexer - Whether to use indexer.
95
96
  * @return Market collaterals data.
96
97
  */
97
- getMarketCollaterals(collateralCoinNames?: SupportCollateralCoins[], indexer?: boolean): Promise<{
98
+ getMarketCollaterals(collateralCoinNames?: SupportCollateralCoins[], args?: {
99
+ indexer?: boolean;
100
+ }): Promise<{
98
101
  usdc?: import("../types").MarketCollateral | undefined;
99
102
  sbeth?: import("../types").MarketCollateral | undefined;
100
103
  weth?: import("../types").MarketCollateral | undefined;
@@ -117,7 +120,9 @@ export declare class ScallopQuery {
117
120
  * @param indexer - Whether to use indexer.
118
121
  * @return Market collateral data.
119
122
  */
120
- getMarketCollateral(collateralCoinName: SupportCollateralCoins, indexer?: boolean): Promise<import("../types").MarketCollateral | undefined>;
123
+ getMarketCollateral(collateralCoinName: SupportCollateralCoins, args?: {
124
+ indexer?: boolean;
125
+ }): Promise<import("../types").MarketCollateral | undefined>;
121
126
  /**
122
127
  * Get obligations data.
123
128
  *
@@ -185,9 +190,10 @@ export declare class ScallopQuery {
185
190
  * @param indexer - Whether to use indexer.
186
191
  * @return Spools data.
187
192
  */
188
- getSpools(stakeMarketCoinNames?: SupportStakeMarketCoins[], indexer?: boolean, args?: {
193
+ getSpools(stakeMarketCoinNames?: SupportStakeMarketCoins[], args?: {
189
194
  marketPools?: MarketPools;
190
195
  coinPrices?: CoinPrices;
196
+ indexer?: boolean;
191
197
  }): Promise<{
192
198
  susdc?: import("../types").Spool | undefined;
193
199
  sweth?: import("../types").Spool | undefined;
@@ -206,9 +212,10 @@ export declare class ScallopQuery {
206
212
  * @param indexer - Whether to use indexer.
207
213
  * @return Spool data.
208
214
  */
209
- getSpool(stakeMarketCoinName: SupportStakeMarketCoins, indexer?: boolean, args?: {
215
+ getSpool(stakeMarketCoinName: SupportStakeMarketCoins, args?: {
210
216
  marketPool?: MarketPool;
211
217
  coinPrices?: CoinPrices;
218
+ indexer?: boolean;
212
219
  }): Promise<import("../types").Spool | undefined>;
213
220
  /**
214
221
  * Get stake accounts data for all stake pools (spools).
@@ -296,8 +303,10 @@ export declare class ScallopQuery {
296
303
  * @param indexer - Whether to use indexer.
297
304
  * @return Borrow incentive pools data.
298
305
  */
299
- getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean, args?: {
306
+ getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[], args?: {
300
307
  coinPrices: CoinPrices;
308
+ indexer?: boolean;
309
+ marketPools?: MarketPools;
301
310
  }): Promise<{
302
311
  usdc?: import("../types").BorrowIncentivePool | undefined;
303
312
  sbeth?: import("../types").BorrowIncentivePool | undefined;
@@ -337,7 +346,9 @@ export declare class ScallopQuery {
337
346
  * @param indexer - Whether to use indexer.
338
347
  * @return All lending and spool infomation.
339
348
  */
340
- getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, indexer?: boolean): Promise<{
349
+ getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, args?: {
350
+ indexer?: boolean;
351
+ }): Promise<{
341
352
  usdc?: import("../types").Lending | undefined;
342
353
  sbeth?: import("../types").Lending | undefined;
343
354
  weth?: import("../types").Lending | undefined;
@@ -352,8 +363,6 @@ export declare class ScallopQuery {
352
363
  hasui?: import("../types").Lending | undefined;
353
364
  vsui?: import("../types").Lending | undefined;
354
365
  sca?: import("../types").Lending | undefined;
355
- fud?: import("../types").Lending | undefined;
356
- deep?: import("../types").Lending | undefined;
357
366
  }>;
358
367
  /**
359
368
  * Get user lending and spool information for specific pool.
@@ -363,7 +372,9 @@ export declare class ScallopQuery {
363
372
  * @param indexer - Whether to use indexer.
364
373
  * @return Lending pool data.
365
374
  */
366
- getLending(poolCoinName: SupportPoolCoins, ownerAddress?: string, indexer?: boolean): Promise<import("../types").Lending>;
375
+ getLending(poolCoinName: SupportPoolCoins, ownerAddress?: string, args?: {
376
+ indexer?: boolean;
377
+ }): Promise<import("../types").Lending>;
367
378
  /**
368
379
  * Get user all obligation accounts information.
369
380
  *
@@ -374,7 +385,9 @@ export declare class ScallopQuery {
374
385
  * @param indexer - Whether to use indexer.
375
386
  * @return All obligation accounts information.
376
387
  */
377
- getObligationAccounts(ownerAddress?: string, indexer?: boolean): Promise<{
388
+ getObligationAccounts(ownerAddress?: string, args?: {
389
+ indexer: boolean;
390
+ }): Promise<{
378
391
  [x: string]: import("../types").ObligationAccount | undefined;
379
392
  }>;
380
393
  /**
@@ -388,7 +401,9 @@ export declare class ScallopQuery {
388
401
  * @param indexer - Whether to use indexer.
389
402
  * @return Borrowing and collateral information.
390
403
  */
391
- getObligationAccount(obligationId: string, ownerAddress?: string, indexer?: boolean): Promise<import("../types").ObligationAccount>;
404
+ getObligationAccount(obligationId: string, ownerAddress?: string, args?: {
405
+ indexer?: boolean;
406
+ }): Promise<import("../types").ObligationAccount>;
392
407
  /**
393
408
  * Get total value locked.
394
409
  *
@@ -398,7 +413,9 @@ export declare class ScallopQuery {
398
413
  *
399
414
  * @return Total value locked.
400
415
  */
401
- getTvl(indexer?: boolean): Promise<import("../types").TotalValueLocked>;
416
+ getTvl(args?: {
417
+ indexer?: boolean;
418
+ }): Promise<import("../types").TotalValueLocked>;
402
419
  /**
403
420
  * Get veSca data.
404
421
  * @param veScaKey
@@ -456,7 +473,7 @@ export declare class ScallopQuery {
456
473
  * @param ownerAddress - The owner address.
457
474
  * @return All market sCoin amounts.
458
475
  */
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>>>;
476
+ getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca", number>>>;
460
477
  /**
461
478
  * Get sCoin amount.
462
479
  *
@@ -471,7 +488,7 @@ export declare class ScallopQuery {
471
488
  * @returns
472
489
  */
473
490
  getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
474
- getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep", number>>;
491
+ getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca", number>>;
475
492
  /**
476
493
  * Get supply limit of lending pool
477
494
  */
@@ -494,4 +511,41 @@ export declare class ScallopQuery {
494
511
  * @returns price data
495
512
  */
496
513
  getCoinPriceByIndexer(poolName: SupportPoolCoins): Promise<number>;
514
+ /**
515
+ * Get all coin prices, including sCoin
516
+ * @returns prices data
517
+ */
518
+ getAllCoinPrices(args?: {
519
+ marketPools?: MarketPools;
520
+ coinPrices?: CoinPrices;
521
+ }): Promise<{
522
+ susdc?: number | undefined;
523
+ ssbeth?: number | undefined;
524
+ sweth?: number | undefined;
525
+ swbtc?: number | undefined;
526
+ swusdc?: number | undefined;
527
+ swusdt?: number | undefined;
528
+ ssui?: number | undefined;
529
+ swsol?: number | undefined;
530
+ scetus?: number | undefined;
531
+ safsui?: number | undefined;
532
+ shasui?: number | undefined;
533
+ svsui?: number | undefined;
534
+ ssca?: number | undefined;
535
+ usdc?: number | undefined;
536
+ sbeth?: number | undefined;
537
+ weth?: number | undefined;
538
+ wbtc?: number | undefined;
539
+ wusdc?: number | undefined;
540
+ wusdt?: number | undefined;
541
+ sui?: number | undefined;
542
+ wapt?: number | undefined;
543
+ wsol?: number | undefined;
544
+ cetus?: number | undefined;
545
+ afsui?: number | undefined;
546
+ hasui?: number | undefined;
547
+ vsui?: number | undefined;
548
+ sca?: number | undefined;
549
+ swapt?: number | undefined;
550
+ }>;
497
551
  }
@@ -1,7 +1,7 @@
1
1
  import { SuiKit } from '@scallop-io/sui-kit';
2
2
  import { ScallopAddress } from './scallopAddress';
3
3
  import { ScallopCache } from './scallopCache';
4
- import type { ScallopUtilsParams, SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins, SupportBorrowIncentiveCoins, CoinWrappedType, SupportSCoin, ScallopUtilsInstanceParams, SupportSuiBridgeCoins, SupportWormholeCoins, PoolAddressInfo } from '../types';
4
+ import type { ScallopUtilsParams, SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins, CoinWrappedType, SupportSCoin, ScallopUtilsInstanceParams, SupportSuiBridgeCoins, SupportWormholeCoins, PoolAddressInfo } from '../types';
5
5
  import type { SuiObjectArg, SuiTxArg, SuiTxBlock } from '@scallop-io/sui-kit';
6
6
  /**
7
7
  * @description
@@ -50,7 +50,7 @@ export declare class ScallopUtils {
50
50
  * @param coinName - Specific support coin name.
51
51
  * @return Coin type.
52
52
  */
53
- parseCoinType(coinName: SupportCoins): string;
53
+ parseCoinType(coinName: SupportCoins, useOldMarketCoin?: boolean): string;
54
54
  /**
55
55
  * Convert coin name to sCoin name.
56
56
  *
@@ -58,6 +58,13 @@ export declare class ScallopUtils {
58
58
  * @return sCoin name.
59
59
  */
60
60
  parseSCoinName<T extends SupportSCoin>(coinName: SupportCoins | SupportMarketCoins): T | undefined;
61
+ /**
62
+ * Convert sCoin name to coin name.
63
+ * This function will parse new sCoin name `scallop_...` to its old market coin name which is shorter
64
+ * e.g: `scallop_sui -> ssui
65
+ * @return sCoin name
66
+ */
67
+ parseCoinNameFromSCoinName(coinName: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca";
61
68
  /**
62
69
  * Convert sCoin name into sCoin type
63
70
  * @param sCoinName
@@ -69,7 +76,7 @@ export declare class ScallopUtils {
69
76
  * @param sCoinType
70
77
  * @returns sCoin name
71
78
  */
72
- parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep";
79
+ parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca";
73
80
  /**
74
81
  * Convert sCoin name into its underlying coin type
75
82
  * @param sCoinName
@@ -124,13 +131,6 @@ export declare class ScallopUtils {
124
131
  * @return Spool reward coin name.
125
132
  */
126
133
  getSpoolRewardCoinName: (stakeMarketCoinName: SupportStakeMarketCoins) => "sui";
127
- /**
128
- * Get reward type of borrow incentive pool.
129
- *
130
- * @param borrowIncentiveCoinName - Support borrow incentive coin.
131
- * @return Borrow incentive reward coin name.
132
- */
133
- getBorrowIncentiveRewardCoinName: (borrowIncentiveCoinName: SupportBorrowIncentiveCoins) => ("sui" | "sca")[];
134
134
  /**
135
135
  * Get coin decimal.
136
136
  *
@@ -188,7 +188,7 @@ export declare class ScallopUtils {
188
188
  * @param assetCoinNames - Specific an array of support asset coin name.
189
189
  * @return Asset coin price.
190
190
  */
191
- getCoinPrices(_?: SupportAssetCoins[]): Promise<import("../types").OptionalKeys<Record<SupportAssetCoins, number>>>;
191
+ getCoinPrices(_?: SupportAssetCoins[]): Promise<import("../types").OptionalKeys<Record<SupportCoins, number>>>;
192
192
  /**
193
193
  * Convert apr to apy.
194
194
  *
@@ -1,5 +1,5 @@
1
1
  import type { ScallopAddress, ScallopQuery, ScallopUtils } from '../models';
2
- import type { BorrowIncentivePoolsQueryInterface, SupportBorrowIncentiveCoins, BorrowIncentivePool, CoinPrices } from '../types';
2
+ import type { BorrowIncentivePoolsQueryInterface, SupportBorrowIncentiveCoins, BorrowIncentivePool, CoinPrices, MarketPools } from '../types';
3
3
  /**
4
4
  * Query borrow incentive pools data using moveCall
5
5
  * @param address
@@ -14,7 +14,7 @@ export declare const queryBorrowIncentivePools: (address: ScallopAddress) => Pro
14
14
  * @param indexer - Whether to use indexer.
15
15
  * @return Borrow incentive pools data.
16
16
  */
17
- export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean, coinPrices?: CoinPrices) => Promise<{
17
+ export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean, marketPools?: MarketPools, coinPrices?: CoinPrices) => Promise<{
18
18
  usdc?: BorrowIncentivePool | undefined;
19
19
  sbeth?: BorrowIncentivePool | undefined;
20
20
  weth?: BorrowIncentivePool | undefined;
@@ -40,8 +40,6 @@ 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;
45
43
  }>;
46
44
  /**
47
45
  * Get market pool data.
@@ -24,8 +24,6 @@ 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;
29
27
  }>;
30
28
  /**
31
29
  * Get user lending infomation for specific pool.
@@ -1,6 +1,6 @@
1
1
  import { SuiObjectData } from '@mysten/sui/client';
2
- import type { ScallopAddress } from '../models';
3
- import type { SupportAssetCoins } from '../types';
2
+ import type { ScallopAddress, ScallopQuery } from '../models';
3
+ import type { CoinPrices, MarketPools, SupportAssetCoins } from '../types';
4
4
  /**
5
5
  * Get price from pyth fee object.
6
6
  *
@@ -14,3 +14,33 @@ export declare const getPythPrice: ({ address, }: {
14
14
  export declare const getPythPrices: ({ address, }: {
15
15
  address: ScallopAddress;
16
16
  }, assetCoinNames: SupportAssetCoins[]) => Promise<Record<SupportAssetCoins, number>>;
17
+ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: MarketPools, coinPrices?: CoinPrices) => Promise<{
18
+ susdc?: number | undefined;
19
+ ssbeth?: number | undefined;
20
+ sweth?: number | undefined;
21
+ swbtc?: number | undefined;
22
+ swusdc?: number | undefined;
23
+ swusdt?: number | undefined;
24
+ ssui?: number | undefined;
25
+ swsol?: number | undefined;
26
+ scetus?: number | undefined;
27
+ safsui?: number | undefined;
28
+ shasui?: number | undefined;
29
+ svsui?: number | undefined;
30
+ ssca?: number | undefined;
31
+ usdc?: number | undefined;
32
+ sbeth?: number | undefined;
33
+ weth?: number | undefined;
34
+ wbtc?: number | undefined;
35
+ wusdc?: number | undefined;
36
+ wusdt?: number | undefined;
37
+ sui?: number | undefined;
38
+ wapt?: number | undefined;
39
+ wsol?: number | undefined;
40
+ cetus?: number | undefined;
41
+ afsui?: number | undefined;
42
+ hasui?: number | undefined;
43
+ vsui?: number | undefined;
44
+ sca?: number | undefined;
45
+ swapt?: number | undefined;
46
+ }>;
@@ -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", number>>>;
23
23
  /**
24
24
  * Query owned sCoin amount.
25
25
  *
package/dist/test.d.ts ADDED
File without changes
@@ -1,7 +1,7 @@
1
1
  import type { SuiTxBlock as SuiKitTxBlock, SuiObjectArg } from '@scallop-io/sui-kit';
2
2
  import type { TransactionResult } from '@mysten/sui/transactions';
3
3
  import type { ScallopBuilder } from '../../models';
4
- import type { SupportBorrowIncentiveCoins, SupportBorrowIncentiveRewardCoins } from '../constant';
4
+ import type { SupportBorrowIncentiveRewardCoins } from '../constant';
5
5
  export type BorrowIncentiveIds = {
6
6
  borrowIncentivePkg: string;
7
7
  query: string;
@@ -14,14 +14,14 @@ export type BorrowIncentiveNormalMethods = {
14
14
  stakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
15
15
  stakeObligationWithVesca: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, veScaKey: SuiObjectArg) => void;
16
16
  unstakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
17
- claimBorrowIncentive: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, coinName: SupportBorrowIncentiveCoins, rewardType: SupportBorrowIncentiveRewardCoins) => TransactionResult;
17
+ claimBorrowIncentive: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, rewardType: SupportBorrowIncentiveRewardCoins) => TransactionResult;
18
18
  deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => void;
19
19
  };
20
20
  export type BorrowIncentiveQuickMethods = {
21
- stakeObligationQuick(obligation?: SuiObjectArg, obligationKey?: SuiObjectArg): Promise<void>;
22
- stakeObligationWithVeScaQuick(obligation?: SuiObjectArg, obligationKey?: SuiObjectArg, veScaKey?: SuiObjectArg): Promise<void>;
23
- unstakeObligationQuick(obligation?: SuiObjectArg, obligationKey?: SuiObjectArg): Promise<void>;
24
- claimBorrowIncentiveQuick(coinName: SupportBorrowIncentiveCoins, rewardType: SupportBorrowIncentiveRewardCoins, obligation?: SuiObjectArg, obligationKey?: SuiObjectArg): Promise<TransactionResult>;
21
+ stakeObligationQuick(obligation?: string, obligationKey?: string): Promise<void>;
22
+ stakeObligationWithVeScaQuick(obligation?: string, obligationKey?: string, veScaKey?: string): Promise<void>;
23
+ unstakeObligationQuick(obligation?: string, obligationKey?: string): Promise<void>;
24
+ claimBorrowIncentiveQuick(rewardType: SupportBorrowIncentiveRewardCoins, obligation?: string, obligationKey?: string): Promise<TransactionResult>;
25
25
  };
26
26
  export type SuiTxBlockWithBorrowIncentiveNormalMethods = SuiKitTxBlock & BorrowIncentiveNormalMethods;
27
27
  export type BorrowIncentiveTxBlock = SuiTxBlockWithBorrowIncentiveNormalMethods & BorrowIncentiveQuickMethods;
@@ -2,7 +2,7 @@ import { SUPPORT_POOLS, SUPPORT_COLLATERALS, SUPPORT_ORACLES, SUPPORT_PACKAGES,
2
2
  type ParseMarketCoins<T extends string> = `s${T}`;
3
3
  type ParseCoins<T extends string> = T extends `s${infer R}` ? R : never;
4
4
  export type SupportCoins = SupportAssetCoins | SupportMarketCoins | SupportStakeMarketCoins | SupportSCoin;
5
- export type SupportAssetCoins = SupportPoolCoins | SupportCollateralCoins | SupportStakeRewardCoins | SupportBorrowIncentiveRewardCoins;
5
+ export type SupportAssetCoins = SupportPoolCoins | SupportCollateralCoins | SupportStakeRewardCoins;
6
6
  export type SupportPoolCoins = (typeof SUPPORT_POOLS)[number];
7
7
  export type SupportCollateralCoins = (typeof SUPPORT_COLLATERALS)[number];
8
8
  export type SupportMarketCoins = ParseMarketCoins<SupportPoolCoins> | SupportStakeMarketCoins;
@@ -1,12 +1,8 @@
1
- import type { SupportAssetCoins } from './constant';
1
+ import type { SupportCoins } from './constant';
2
2
  export type OptionalKeys<T> = {
3
3
  [K in keyof T]?: T[K];
4
4
  };
5
- export type CoinPrices = OptionalKeys<Record<SupportAssetCoins, number>>;
6
- export type PriceMap = Map<SupportAssetCoins, {
7
- price: number;
8
- publishTime: number;
9
- }>;
5
+ export type CoinPrices = OptionalKeys<Record<SupportCoins, number>>;
10
6
  export type PoolAddressInfo = {
11
7
  name: string;
12
8
  coingeckoId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "1.3.41",
3
+ "version": "1.4.1-alpha.1",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -143,17 +143,7 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
143
143
  ]
144
144
  );
145
145
  },
146
- claimBorrowIncentive: (
147
- obligationId,
148
- obligationKey,
149
- coinName,
150
- rewardCoinName
151
- ) => {
152
- const rewardCoinNames =
153
- builder.utils.getBorrowIncentiveRewardCoinName(coinName);
154
- if (rewardCoinNames.includes(rewardCoinName) === false) {
155
- throw new Error(`Invalid reward coin name ${rewardCoinName}`);
156
- }
146
+ claimBorrowIncentive: (obligationId, obligationKey, rewardCoinName) => {
157
147
  const rewardType = builder.utils.parseCoinType(rewardCoinName);
158
148
  return txBlock.moveCall(
159
149
  `${borrowIncentiveIds.borrowIncentivePkg}::user::redeem_rewards`,
@@ -284,11 +274,11 @@ const generateBorrowIncentiveQuickMethod: GenerateBorrowIncentiveQuickMethod =
284
274
  }
285
275
  },
286
276
  claimBorrowIncentiveQuick: async (
287
- coinName,
288
277
  rewardCoinName,
289
278
  obligation,
290
279
  obligationKey
291
280
  ) => {
281
+ // check for available reward coin names
292
282
  const { obligationId: obligationArg, obligationKey: obligationKeyArg } =
293
283
  await requireObligationInfo(
294
284
  builder,
@@ -300,7 +290,6 @@ const generateBorrowIncentiveQuickMethod: GenerateBorrowIncentiveQuickMethod =
300
290
  return txBlock.claimBorrowIncentive(
301
291
  obligationArg,
302
292
  obligationKeyArg,
303
- coinName,
304
293
  rewardCoinName
305
294
  );
306
295
  },
@@ -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
- deep: 'deepbook',
19
- fud: 'fud-the-pug',
18
+ // TODO: enable for production
19
+ // deep: 'deepbook',
20
+ // fud: 'fud-the-pug',
20
21
  };
@@ -45,8 +45,9 @@ export const SUPPORT_POOLS = [
45
45
  'hasui',
46
46
  'vsui',
47
47
  'sca',
48
- 'fud',
49
- 'deep',
48
+ // TODO: enable for production
49
+ // 'fud',
50
+ // 'deep',
50
51
  ] as const;
51
52
 
52
53
  export const SUPPORT_COLLATERALS = [
@@ -92,8 +93,9 @@ export const SUPPORT_SCOIN = [
92
93
  'scetus',
93
94
  'swsol',
94
95
  'swbtc',
95
- 'sdeep',
96
- 'sfud',
96
+ // TODO: enable for production
97
+ // 'sdeep',
98
+ // 'sfud',
97
99
  ] as const;
98
100
 
99
101
  export const SUPPORT_SUI_BRIDGE = ['sbeth'] as const;
@@ -121,7 +123,10 @@ export const SUPPORT_BORROW_INCENTIVE_POOLS = [
121
123
  'usdc',
122
124
  ] as const;
123
125
 
124
- export const SUPPORT_BORROW_INCENTIVE_REWARDS = ['sui', 'sca'] as const;
126
+ export const SUPPORT_BORROW_INCENTIVE_REWARDS = [
127
+ ...SUPPORT_POOLS,
128
+ ...SUPPORT_SCOIN,
129
+ ] as const;
125
130
  export const SUPPORT_ORACLES = ['supra', 'switchboard', 'pyth'] as const;
126
131
 
127
132
  export const SUPPORT_PACKAGES = [