@scallop-io/sui-scallop-sdk 1.4.0 → 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 (42) hide show
  1. package/dist/constants/common.d.ts +3 -3
  2. package/dist/constants/enum.d.ts +2 -2
  3. package/dist/index.js +220 -150
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +219 -149
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/models/scallopClient.d.ts +4 -4
  8. package/dist/models/scallopQuery.d.ts +40 -6
  9. package/dist/models/scallopUtils.d.ts +11 -11
  10. package/dist/queries/borrowIncentiveQuery.d.ts +2 -2
  11. package/dist/queries/coreQuery.d.ts +0 -2
  12. package/dist/queries/portfolioQuery.d.ts +0 -2
  13. package/dist/queries/priceQuery.d.ts +32 -2
  14. package/dist/queries/sCoinQuery.d.ts +1 -1
  15. package/dist/test.d.ts +0 -0
  16. package/dist/types/builder/borrowIncentive.d.ts +6 -6
  17. package/dist/types/constant/common.d.ts +1 -1
  18. package/dist/types/utils.d.ts +2 -6
  19. package/package.json +1 -1
  20. package/src/builders/borrowIncentiveBuilder.ts +2 -13
  21. package/src/constants/coinGecko.ts +3 -2
  22. package/src/constants/common.ts +10 -5
  23. package/src/constants/enum.ts +44 -34
  24. package/src/constants/poolAddress.ts +9 -8
  25. package/src/constants/pyth.ts +3 -2
  26. package/src/models/scallopClient.ts +27 -10
  27. package/src/models/scallopQuery.ts +18 -1
  28. package/src/models/scallopUtils.ts +23 -18
  29. package/src/queries/borrowIncentiveQuery.ts +29 -12
  30. package/src/queries/borrowLimitQuery.ts +3 -2
  31. package/src/queries/coreQuery.ts +4 -10
  32. package/src/queries/isolatedAssetQuery.ts +3 -2
  33. package/src/queries/portfolioQuery.ts +65 -62
  34. package/src/queries/priceQuery.ts +35 -2
  35. package/src/queries/sCoinQuery.ts +1 -1
  36. package/src/queries/spoolQuery.ts +2 -4
  37. package/src/queries/supplyLimitQuery.ts +3 -2
  38. package/src/test.ts +20 -0
  39. package/src/types/builder/borrowIncentive.ts +10 -15
  40. package/src/types/constant/common.ts +1 -2
  41. package/src/types/utils.ts +2 -10
  42. package/src/utils/query.ts +0 -87
@@ -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
@@ -71,8 +71,6 @@ export declare class ScallopQuery {
71
71
  hasui?: MarketPool | undefined;
72
72
  vsui?: MarketPool | undefined;
73
73
  sca?: MarketPool | undefined;
74
- fud?: MarketPool | undefined;
75
- deep?: MarketPool | undefined;
76
74
  }>;
77
75
  /**
78
76
  * Get market pool
@@ -308,6 +306,7 @@ export declare class ScallopQuery {
308
306
  getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[], args?: {
309
307
  coinPrices: CoinPrices;
310
308
  indexer?: boolean;
309
+ marketPools?: MarketPools;
311
310
  }): Promise<{
312
311
  usdc?: import("../types").BorrowIncentivePool | undefined;
313
312
  sbeth?: import("../types").BorrowIncentivePool | undefined;
@@ -364,8 +363,6 @@ export declare class ScallopQuery {
364
363
  hasui?: import("../types").Lending | undefined;
365
364
  vsui?: import("../types").Lending | undefined;
366
365
  sca?: import("../types").Lending | undefined;
367
- fud?: import("../types").Lending | undefined;
368
- deep?: import("../types").Lending | undefined;
369
366
  }>;
370
367
  /**
371
368
  * Get user lending and spool information for specific pool.
@@ -476,7 +473,7 @@ export declare class ScallopQuery {
476
473
  * @param ownerAddress - The owner address.
477
474
  * @return All market sCoin amounts.
478
475
  */
479
- 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>>>;
480
477
  /**
481
478
  * Get sCoin amount.
482
479
  *
@@ -491,7 +488,7 @@ export declare class ScallopQuery {
491
488
  * @returns
492
489
  */
493
490
  getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
494
- 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>>;
495
492
  /**
496
493
  * Get supply limit of lending pool
497
494
  */
@@ -514,4 +511,41 @@ export declare class ScallopQuery {
514
511
  * @returns price data
515
512
  */
516
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
+ }>;
517
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.4.0",
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 = [
@@ -16,8 +16,9 @@ export const coinDecimals: types.SupportCoinDecimals = {
16
16
  hasui: 9,
17
17
  vsui: 9,
18
18
  sca: 9,
19
- deep: 6,
20
- fud: 5,
19
+ // TODO: enable for production
20
+ // deep: 6,
21
+ // fud: 5,
21
22
  susdc: 6,
22
23
  sweth: 8,
23
24
  ssbeth: 8,
@@ -32,8 +33,9 @@ export const coinDecimals: types.SupportCoinDecimals = {
32
33
  shasui: 9,
33
34
  svsui: 9,
34
35
  ssca: 9,
35
- sdeep: 6,
36
- sfud: 5,
36
+ // TODO: enable for production
37
+ // sdeep: 6,
38
+ // sfud: 5,
37
39
  };
38
40
 
39
41
  export const assetCoins: types.AssetCoins = {
@@ -51,8 +53,9 @@ export const assetCoins: types.AssetCoins = {
51
53
  hasui: 'hasui',
52
54
  vsui: 'vsui',
53
55
  sca: 'sca',
54
- deep: 'deep',
55
- fud: 'fud',
56
+ // TODO: enable for production
57
+ // deep: 'deep',
58
+ // fud: 'fud',
56
59
  };
57
60
 
58
61
  export const marketCoins: types.MarketCoins = {
@@ -70,8 +73,9 @@ export const marketCoins: types.MarketCoins = {
70
73
  shasui: 'shasui',
71
74
  svsui: 'svsui',
72
75
  ssca: 'ssca',
73
- sdeep: 'sdeep',
74
- sfud: 'sfud',
76
+ // TODO: enable for production
77
+ // sdeep: 'sdeep',
78
+ // sfud: 'sfud',
75
79
  };
76
80
 
77
81
  export const sCoins: types.SCoins = {
@@ -88,8 +92,9 @@ export const sCoins: types.SCoins = {
88
92
  ssca: 'ssca',
89
93
  swsol: 'swsol',
90
94
  swbtc: 'swbtc',
91
- sfud: 'sfud',
92
- sdeep: 'sdeep',
95
+ // TODO: enable for production
96
+ // sfud: 'sfud',
97
+ // sdeep: 'sdeep',
93
98
  };
94
99
 
95
100
  export const stakeMarketCoins: types.StakeMarketCoins = {
@@ -120,19 +125,6 @@ export const suiBridgeCoins: types.SuiBridgeCoins = {
120
125
  sbeth: 'sbeth',
121
126
  };
122
127
 
123
- export const borrowIncentiveRewardCoins: types.BorrowIncentiveRewardCoins = {
124
- usdc: ['sui', 'sca'],
125
- sui: ['sui', 'sca'],
126
- wusdc: ['sui', 'sca'],
127
- wusdt: ['sui', 'sca'],
128
- sca: ['sui', 'sca'],
129
- afsui: ['sui'],
130
- hasui: ['sui'],
131
- vsui: ['sui'],
132
- weth: ['sui'],
133
- sbeth: ['sui'],
134
- };
135
-
136
128
  export const coinIds: types.AssetCoinIds = {
137
129
  usdc: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7',
138
130
  sui: '0x0000000000000000000000000000000000000000000000000000000000000002',
@@ -151,8 +143,8 @@ export const coinIds: types.AssetCoinIds = {
151
143
  ? '0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524'
152
144
  : '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6',
153
145
  // isolated assets
154
- deep: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
155
- fud: '0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1',
146
+ // deep: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
147
+ // fud: '0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1',
156
148
  };
157
149
 
158
150
  export const wormholeCoinIds: types.WormholeCoinIds = {
@@ -174,14 +166,24 @@ export const sCoinIds: types.SCoinIds = {
174
166
  '0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC',
175
167
  ssbeth:
176
168
  '0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH',
177
- ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
169
+ // prod values
170
+ // ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
171
+ // swusdc:
172
+ // '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
173
+ // swusdt:
174
+ // '0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
175
+ // ssca: '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
176
+
177
+ // test values
178
+ ssui: '0xf569919046f19a0c40b519ecfbb6ca0319698cd5908716c29b62ef56541f298b::scallop_sui::SCALLOP_SUI',
179
+ swusdt:
180
+ '0xac781d9f73058ff5e69f9bf8dde32f2e8c71c66d7fe8497fc83b2d9182254b22::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
181
+ swusdc:
182
+ '0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
183
+ ssca: '0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA',
184
+
178
185
  scetus:
179
186
  '0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS',
180
- ssca: '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
181
- swusdc:
182
- '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
183
- swusdt:
184
- '0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
185
187
  sweth:
186
188
  '0x67540ceb850d418679e69f1fb6b2093d6df78a2a699ffc733f7646096d552e9b::scallop_wormhole_eth::SCALLOP_WORMHOLE_ETH',
187
189
  safsui:
@@ -194,9 +196,9 @@ export const sCoinIds: types.SCoinIds = {
194
196
  '0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL',
195
197
  swbtc:
196
198
  '0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC',
197
- sdeep:
198
- '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
199
- sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
199
+ // sdeep:
200
+ // '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
201
+ // sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
200
202
  } as const;
201
203
 
202
204
  export const sCoinTypeToName = Object.entries(sCoinIds).reduce(
@@ -207,6 +209,14 @@ export const sCoinTypeToName = Object.entries(sCoinIds).reduce(
207
209
  {} as Record<string, types.SupportSCoin>
208
210
  );
209
211
 
212
+ export const sCoinRawNameToName = Object.entries(sCoinIds).reduce(
213
+ (acc, [coinName, coinType]) => {
214
+ acc[coinType.split('::')[2].toLowerCase()] = coinName as types.SupportSCoin;
215
+ return acc;
216
+ },
217
+ {} as Record<string, types.SupportSCoin>
218
+ );
219
+
210
220
  // TEST VERSION
211
221
  // export const sCoinIds: types.SCoinIds = {
212
222
  // ssui: '0xf569919046f19a0c40b519ecfbb6ca0319698cd5908716c29b62ef56541f298b::scallop_sui::SCALLOP_SUI',
@@ -91,12 +91,13 @@ export const POOL_ADDRESSES: Record<
91
91
  collateralPoolAddress:
92
92
  '0xff677a5d9e9dc8f08f0a8681ebfc7481d1c7d57bc441f2881974adcdd7b13c31',
93
93
  },
94
- fud: {
95
- lendingPoolAddress:
96
- '0x14367ddca30e2860cb89ed4eaca20c7ece260c5d59dd9990d2c85a8321326acb',
97
- },
98
- deep: {
99
- lendingPoolAddress:
100
- '0xf4a67ffb43da1e1c61c049f188f19463ea8dbbf2d5ef4722d6df854ff1b1cc03',
101
- },
94
+ // TODO: enable for production
95
+ // fud: {
96
+ // lendingPoolAddress:
97
+ // '0x14367ddca30e2860cb89ed4eaca20c7ece260c5d59dd9990d2c85a8321326acb',
98
+ // },
99
+ // deep: {
100
+ // lendingPoolAddress:
101
+ // '0xf4a67ffb43da1e1c61c049f188f19463ea8dbbf2d5ef4722d6df854ff1b1cc03',
102
+ // },
102
103
  };
@@ -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
- deep: '29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',
26
- fud: '6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75',
25
+ // TODO: enable for production
26
+ // deep: '29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',
27
+ // fud: '6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75',
27
28
  };