@scallop-io/sui-scallop-sdk 1.3.0-alpha.1 → 1.3.0-alpha.3

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 (41) hide show
  1. package/dist/constants/common.d.ts +6 -4
  2. package/dist/constants/enum.d.ts +1 -0
  3. package/dist/index.js +211 -137
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +208 -137
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/models/scallopBuilder.d.ts +4 -4
  8. package/dist/models/scallopQuery.d.ts +11 -3
  9. package/dist/models/scallopUtils.d.ts +4 -2
  10. package/dist/queries/borrowIncentiveQuery.d.ts +2 -0
  11. package/dist/queries/coreQuery.d.ts +2 -0
  12. package/dist/queries/portfolioQuery.d.ts +1 -0
  13. package/dist/queries/sCoinQuery.d.ts +1 -1
  14. package/dist/queries/vescaQuery.d.ts +1 -1
  15. package/dist/types/constant/common.d.ts +3 -1
  16. package/dist/types/constant/enum.d.ts +7 -1
  17. package/dist/types/model.d.ts +3 -0
  18. package/dist/utils/index.d.ts +1 -0
  19. package/dist/utils/indexer.d.ts +17 -0
  20. package/dist/utils/util.d.ts +4 -2
  21. package/package.json +6 -6
  22. package/src/builders/coreBuilder.ts +2 -2
  23. package/src/builders/referralBuilder.ts +1 -1
  24. package/src/builders/spoolBuilder.ts +1 -1
  25. package/src/constants/common.ts +15 -1
  26. package/src/constants/enum.ts +13 -0
  27. package/src/models/scallop.ts +1 -0
  28. package/src/models/scallopAddress.ts +13 -1
  29. package/src/models/scallopBuilder.ts +1 -0
  30. package/src/models/scallopClient.ts +6 -4
  31. package/src/models/scallopQuery.ts +42 -2
  32. package/src/models/scallopUtils.ts +54 -23
  33. package/src/queries/coreQuery.ts +0 -1
  34. package/src/queries/spoolQuery.ts +40 -103
  35. package/src/queries/vescaQuery.ts +8 -2
  36. package/src/types/constant/common.ts +4 -0
  37. package/src/types/constant/enum.ts +9 -0
  38. package/src/types/model.ts +3 -0
  39. package/src/utils/index.ts +1 -0
  40. package/src/utils/indexer.ts +39 -0
  41. package/src/utils/util.ts +25 -3
@@ -64,8 +64,8 @@ export declare class ScallopBuilder {
64
64
  * @return Take coin and left coin.
65
65
  */
66
66
  selectMarketCoin(txBlock: ScallopTxBlock | SuiKitTxBlock, marketCoinName: SupportMarketCoins, amount: number, sender?: string): Promise<{
67
- takeCoin: any;
68
- leftCoin: any;
67
+ takeCoin: import("@scallop-io/sui-kit").TransactionObjectArgument;
68
+ leftCoin: import("@scallop-io/sui-kit").TransactionObjectArgument;
69
69
  totalAmount: number;
70
70
  }>;
71
71
  /**
@@ -78,8 +78,8 @@ export declare class ScallopBuilder {
78
78
  * @return Take coin and left coin.
79
79
  */
80
80
  selectSCoin(txBlock: ScallopTxBlock | SuiKitTxBlock, sCoinName: SupportSCoin, amount: number, sender?: string): Promise<{
81
- takeCoin: any;
82
- leftCoin: any;
81
+ takeCoin: import("@scallop-io/sui-kit").TransactionObjectArgument;
82
+ leftCoin: import("@scallop-io/sui-kit").TransactionObjectArgument;
83
83
  totalAmount: number;
84
84
  }>;
85
85
  /**
@@ -52,6 +52,7 @@ export declare class ScallopQuery {
52
52
  */
53
53
  getMarketPools(poolCoinNames?: SupportPoolCoins[], indexer?: boolean): Promise<{
54
54
  usdc?: import("../types").MarketPool | undefined;
55
+ sbeth?: import("../types").MarketPool | undefined;
55
56
  weth?: import("../types").MarketPool | undefined;
56
57
  wbtc?: import("../types").MarketPool | undefined;
57
58
  wusdc?: import("../types").MarketPool | undefined;
@@ -86,6 +87,7 @@ export declare class ScallopQuery {
86
87
  */
87
88
  getMarketCollaterals(collateralCoinNames?: SupportCollateralCoins[], indexer?: boolean): Promise<{
88
89
  usdc?: import("../types").MarketCollateral | undefined;
90
+ sbeth?: import("../types").MarketCollateral | undefined;
89
91
  weth?: import("../types").MarketCollateral | undefined;
90
92
  wbtc?: import("../types").MarketCollateral | undefined;
91
93
  wusdc?: import("../types").MarketCollateral | undefined;
@@ -281,6 +283,7 @@ export declare class ScallopQuery {
281
283
  */
282
284
  getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean): Promise<{
283
285
  usdc?: import("../types").BorrowIncentivePool | undefined;
286
+ sbeth?: import("../types").BorrowIncentivePool | undefined;
284
287
  weth?: import("../types").BorrowIncentivePool | undefined;
285
288
  wusdc?: import("../types").BorrowIncentivePool | undefined;
286
289
  wusdt?: import("../types").BorrowIncentivePool | undefined;
@@ -299,6 +302,7 @@ export declare class ScallopQuery {
299
302
  */
300
303
  getBorrowIncentiveAccounts(obligationId: string, coinNames?: SupportBorrowIncentiveCoins[]): Promise<{
301
304
  usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
305
+ sbeth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
302
306
  weth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
303
307
  wusdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
304
308
  wusdt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
@@ -318,6 +322,7 @@ export declare class ScallopQuery {
318
322
  */
319
323
  getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, indexer?: boolean): Promise<{
320
324
  usdc?: import("../types").Lending | undefined;
325
+ sbeth?: import("../types").Lending | undefined;
321
326
  weth?: import("../types").Lending | undefined;
322
327
  wbtc?: import("../types").Lending | undefined;
323
328
  wusdc?: import("../types").Lending | undefined;
@@ -386,7 +391,10 @@ export declare class ScallopQuery {
386
391
  * @param walletAddress
387
392
  * @returns array of veSca
388
393
  */
389
- getVeScas(walletAddress?: string): Promise<import("../types").Vesca[]>;
394
+ getVeScas({ walletAddress, excludeEmpty, }?: {
395
+ walletAddress?: string;
396
+ excludeEmpty?: boolean;
397
+ }): Promise<import("../types").Vesca[]>;
390
398
  /**
391
399
  * Get total vesca treasury with movecall
392
400
  * @returns Promise<string | undefined>
@@ -429,7 +437,7 @@ export declare class ScallopQuery {
429
437
  * @param ownerAddress - The owner address.
430
438
  * @return All market sCoin amounts.
431
439
  */
432
- getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "sweth" | "ssui" | "swusdc" | "swusdt" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "swsol" | "swbtc", number>>>;
440
+ getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "sweth" | "ssui" | "swusdc" | "swusdt" | "scetus" | "safsui" | "shasui" | "svsui" | "ssbeth" | "ssca" | "swsol" | "swbtc", number>>>;
433
441
  /**
434
442
  * Get sCoin amount.
435
443
  *
@@ -444,7 +452,7 @@ export declare class ScallopQuery {
444
452
  * @returns
445
453
  */
446
454
  getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
447
- getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca", number>>;
455
+ getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca", number>>;
448
456
  /**
449
457
  * Get supply limit of supply pool
450
458
  */
@@ -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 } from '../types';
4
+ import type { ScallopUtilsParams, SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins, SupportBorrowIncentiveCoins, CoinWrappedType, SupportSCoin, ScallopUtilsInstanceParams, SupportSuiBridgeCoins, SupportWormholeCoins } from '../types';
5
5
  import type { SuiObjectArg, SuiTxArg, SuiTxBlock } from '@scallop-io/sui-kit';
6
6
  /**
7
7
  * @description
@@ -24,6 +24,8 @@ export declare class ScallopUtils {
24
24
  walletAddress: string;
25
25
  private _priceMap;
26
26
  constructor(params: ScallopUtilsParams, instance?: ScallopUtilsInstanceParams);
27
+ isSuiBridgeAsset(coinName: any): coinName is SupportSuiBridgeCoins;
28
+ isWormholeAsset(coinName: any): coinName is SupportWormholeCoins;
27
29
  /**
28
30
  * Request the scallop API to initialize data.
29
31
  *
@@ -97,7 +99,7 @@ export declare class ScallopUtils {
97
99
  parseCoinNameFromType<T extends SupportMarketCoins>(coinType: string): T extends SupportMarketCoins ? T : SupportMarketCoins;
98
100
  parseCoinNameFromType<T extends SupportCoins>(coinType: string): T extends SupportCoins ? T : SupportCoins;
99
101
  /**
100
- * Convert marke coin name to coin name.
102
+ * Convert market coin name to coin name.
101
103
  *
102
104
  * @param marketCoinName - Specific support market coin name.
103
105
  * @return Coin Name.
@@ -16,6 +16,7 @@ export declare const queryBorrowIncentivePools: (address: ScallopAddress) => Pro
16
16
  */
17
17
  export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean) => Promise<{
18
18
  usdc?: BorrowIncentivePool | undefined;
19
+ sbeth?: BorrowIncentivePool | undefined;
19
20
  weth?: BorrowIncentivePool | undefined;
20
21
  wusdc?: BorrowIncentivePool | undefined;
21
22
  wusdt?: BorrowIncentivePool | undefined;
@@ -36,6 +37,7 @@ export declare const queryBorrowIncentiveAccounts: ({ utils, }: {
36
37
  utils: ScallopUtils;
37
38
  }, obligationId: string, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[]) => Promise<{
38
39
  usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
40
+ sbeth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
39
41
  weth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
40
42
  wusdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
41
43
  wusdt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
@@ -27,6 +27,7 @@ export declare const queryMarket: (query: ScallopQuery, indexer?: boolean) => Pr
27
27
  */
28
28
  export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], indexer?: boolean) => Promise<{
29
29
  usdc?: MarketPool | undefined;
30
+ sbeth?: MarketPool | undefined;
30
31
  weth?: MarketPool | undefined;
31
32
  wbtc?: MarketPool | undefined;
32
33
  wusdc?: MarketPool | undefined;
@@ -65,6 +66,7 @@ export declare const getMarketPool: (query: ScallopQuery, poolCoinName: SupportP
65
66
  */
66
67
  export declare const getMarketCollaterals: (query: ScallopQuery, collateralCoinNames?: SupportCollateralCoins[], indexer?: boolean) => Promise<{
67
68
  usdc?: MarketCollateral | undefined;
69
+ sbeth?: MarketCollateral | undefined;
68
70
  weth?: MarketCollateral | undefined;
69
71
  wbtc?: MarketCollateral | undefined;
70
72
  wusdc?: MarketCollateral | undefined;
@@ -11,6 +11,7 @@ import type { Market, SupportPoolCoins, MarketPool, Spool, StakeAccount, Lending
11
11
  */
12
12
  export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, indexer?: boolean) => Promise<{
13
13
  usdc?: Lending | undefined;
14
+ sbeth?: Lending | undefined;
14
15
  weth?: Lending | undefined;
15
16
  wbtc?: Lending | undefined;
16
17
  wusdc?: Lending | undefined;
@@ -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" | "sweth" | "ssui" | "swusdc" | "swusdt" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "swsol" | "swbtc", number>>>;
22
+ }, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "sweth" | "ssui" | "swusdc" | "swusdt" | "scetus" | "safsui" | "shasui" | "svsui" | "ssbeth" | "ssca" | "swsol" | "swbtc", number>>>;
23
23
  /**
24
24
  * Query owned sCoin amount.
25
25
  *
@@ -18,7 +18,7 @@ export declare const getVescaKeys: (utils: ScallopUtils, ownerAddress?: string)
18
18
  */
19
19
  export declare const getVeScas: ({ utils, }: {
20
20
  utils: ScallopUtils;
21
- }, ownerAddress?: string) => Promise<Vesca[]>;
21
+ }, ownerAddress?: string, excludeEmpty?: boolean) => Promise<Vesca[]>;
22
22
  /**
23
23
  * Get veSca data.
24
24
  *
@@ -1,4 +1,4 @@
1
- import { SUPPORT_POOLS, SUPPORT_COLLATERALS, SUPPORT_ORACLES, SUPPORT_PACKAGES, SUPPORT_SPOOLS, SUPPORT_SPOOLS_REWARDS, SUPPORT_BORROW_INCENTIVE_POOLS, SUPPORT_BORROW_INCENTIVE_REWARDS, SUPPORT_SCOIN } from '../../constants';
1
+ import { SUPPORT_POOLS, SUPPORT_COLLATERALS, SUPPORT_ORACLES, SUPPORT_PACKAGES, SUPPORT_SPOOLS, SUPPORT_SPOOLS_REWARDS, SUPPORT_BORROW_INCENTIVE_POOLS, SUPPORT_BORROW_INCENTIVE_REWARDS, SUPPORT_SCOIN, SUPPORT_SUI_BRIDGE, SUPPORT_WORMHOLE } from '../../constants';
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;
@@ -7,6 +7,8 @@ export type SupportPoolCoins = (typeof SUPPORT_POOLS)[number];
7
7
  export type SupportCollateralCoins = (typeof SUPPORT_COLLATERALS)[number];
8
8
  export type SupportMarketCoins = ParseMarketCoins<SupportPoolCoins> | SupportStakeMarketCoins;
9
9
  export type SupportStakeMarketCoins = (typeof SUPPORT_SPOOLS)[number];
10
+ export type SupportSuiBridgeCoins = (typeof SUPPORT_SUI_BRIDGE)[number];
11
+ export type SupportWormholeCoins = (typeof SUPPORT_WORMHOLE)[number];
10
12
  export type SupportStakeCoins = Extract<SupportPoolCoins, ParseCoins<SupportStakeMarketCoins>>;
11
13
  export type SupportStakeRewardCoins = (typeof SUPPORT_SPOOLS_REWARDS)[number];
12
14
  export type SupportBorrowIncentiveCoins = (typeof SUPPORT_BORROW_INCENTIVE_POOLS)[number];
@@ -1,4 +1,4 @@
1
- import { SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins, SupportStakeRewardCoins, SupportBorrowIncentiveCoins, SupportBorrowIncentiveRewardCoins, SupportSCoin } from './common';
1
+ import { SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins, SupportStakeRewardCoins, SupportBorrowIncentiveCoins, SupportBorrowIncentiveRewardCoins, SupportSCoin, SupportSuiBridgeCoins } from './common';
2
2
  export type Coins = {
3
3
  [K in SupportCoins]: K;
4
4
  };
@@ -17,6 +17,9 @@ export type StakeMarketCoins = {
17
17
  export type StakeRewardCoins = {
18
18
  [key in SupportStakeMarketCoins]: SupportStakeRewardCoins;
19
19
  };
20
+ export type SuiBridgeCoins = {
21
+ [K in SupportSuiBridgeCoins]: K;
22
+ };
20
23
  export type BorrowIncentiveRewardCoins = {
21
24
  [key in SupportBorrowIncentiveCoins]: SupportBorrowIncentiveRewardCoins[];
22
25
  };
@@ -39,4 +42,7 @@ export type WormholeCoinIds = {
39
42
  export type VoloCoinIds = {
40
43
  [key in PickFromUnion<SupportAssetCoins, 'vsui'>]: string;
41
44
  };
45
+ export type SuiBridgedCoinPackageIds = {
46
+ [key in SupportSuiBridgeCoins]: string;
47
+ };
42
48
  export {};
@@ -3,6 +3,7 @@ import type { Transaction, TransactionResult } from '@mysten/sui/transactions';
3
3
  import type { SuiKit, SuiKitParams, NetworkType } from '@scallop-io/sui-kit';
4
4
  import type { ScallopAddress, ScallopQuery, ScallopUtils, ScallopBuilder, ScallopIndexer } from '../models';
5
5
  import { ScallopCache } from 'src/models/scallopCache';
6
+ import { AddressesInterface } from './address';
6
7
  export type ScallopClientFnReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : Transaction;
7
8
  export type ScallopClientVeScaReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : {
8
9
  tx: Transaction;
@@ -35,9 +36,11 @@ export type ScallopAddressParams = {
35
36
  id: string;
36
37
  auth?: string;
37
38
  network?: NetworkType;
39
+ forceInterface?: Partial<Record<NetworkType, AddressesInterface>>;
38
40
  };
39
41
  export type ScallopParams = {
40
42
  addressesId?: string;
43
+ forceAddressesInterface?: Partial<Record<NetworkType, AddressesInterface>>;
41
44
  walletAddress?: string;
42
45
  } & SuiKitParams;
43
46
  export type ScallopClientParams = ScallopParams & ScallopBuilderParams & ScallopQueryParams & ScallopUtilsParams;
@@ -2,3 +2,4 @@ export * from './builder';
2
2
  export * from './query';
3
3
  export * from './util';
4
4
  export * from './tokenBucket';
5
+ export * from './indexer';
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Generic wrapper for methods with indexer fallback.
3
+ *
4
+ * @param method - The method to call with fallback behavior.
5
+ * @param context - The context (`this`) of the class instance.
6
+ * @param args - The arguments to pass to the method.
7
+ * @returns The result of the method call.
8
+ */
9
+ export declare function callMethodWithIndexerFallback(method: Function, context: any, ...args: any[]): Promise<any>;
10
+ /**
11
+ * This function creates a wrapper for methods that have an indexer parameter.
12
+ * It ensures fallback behavior if indexer fails.
13
+ *
14
+ * @param method - The method to wrap.
15
+ * @returns A function that applies indexer fallback.
16
+ */
17
+ export declare function withIndexerFallback(method: Function): (...args: any[]) => Promise<any>;
@@ -1,8 +1,10 @@
1
1
  import type { PriceFeed } from '@pythnetwork/pyth-sui-js';
2
2
  import type { ScallopAddress } from '../models';
3
- import type { SupportAssetCoins, SupportCoins, SupportMarketCoins } from '../types';
3
+ import type { SupportAssetCoins, SupportCoins, SupportMarketCoins, SupportSuiBridgeCoins, SupportWormholeCoins } from '../types';
4
4
  export declare const isMarketCoin: (coinName: SupportCoins) => coinName is SupportMarketCoins;
5
- export declare const parseAssetSymbol: (coinName: SupportAssetCoins) => string;
5
+ export declare const isSuiBridgeAsset: (coinName: any) => coinName is SupportSuiBridgeCoins;
6
+ export declare const isWormholeAsset: (coinName: any) => coinName is SupportWormholeCoins;
7
+ export declare const parseAssetSymbol: (coinName: SupportCoins) => string;
6
8
  /**
7
9
  * Parse price from pyth price feed.
8
10
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "1.3.0-alpha.1",
3
+ "version": "1.3.0-alpha.3",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -46,7 +46,7 @@
46
46
  "@noble/hashes": "^1.3.2",
47
47
  "@pythnetwork/price-service-client": "^1.8.2",
48
48
  "@pythnetwork/pyth-sui-js": "2.0.0",
49
- "@scallop-io/sui-kit": "1.3.0",
49
+ "@scallop-io/sui-kit": "1.3.1-alpha.1",
50
50
  "@scure/bip39": "^1.2.1",
51
51
  "@tanstack/query-core": "^5.28.0",
52
52
  "axios": "^1.6.0",
@@ -64,8 +64,8 @@
64
64
  "@commitlint/config-conventional": "^18.1.0",
65
65
  "@commitlint/prompt-cli": "^18.2.0",
66
66
  "@types/node": "^20.4.2",
67
- "@typescript-eslint/eslint-plugin": "^6.10.0",
68
- "@typescript-eslint/parser": "^6.10.0",
67
+ "@typescript-eslint/eslint-plugin": "^8.11.0",
68
+ "@typescript-eslint/parser": "8.10.0",
69
69
  "dotenv": "^16.3.1",
70
70
  "eslint": "^8.53.0",
71
71
  "eslint-config-prettier": "^9.0.0",
@@ -78,13 +78,13 @@
78
78
  "tsconfig-paths": "^4.2.0",
79
79
  "tsup": "^7.2.0",
80
80
  "typedoc": "^0.26.3",
81
- "typescript": "^5.3.3",
81
+ "typescript": "5.5.4",
82
82
  "vitest": "^0.34.6"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "@mysten/sui": "1.3.0",
86
86
  "@mysten/sui.js": "0.54.1",
87
- "@scallop-io/sui-kit": "1.3.0",
87
+ "@scallop-io/sui-kit": "1.3.1-alpha.1",
88
88
  "bn.js": "^5.2.1"
89
89
  },
90
90
  "lint-staged": {
@@ -364,11 +364,11 @@ const generateCoreQuickMethod: GenerateCoreQuickMethod = ({
364
364
  txBlock.transferObjects([leftCoin], sender);
365
365
  txBlock.mergeCoins(marketCoins, [walletMarketCoins]);
366
366
  }
367
- } catch (e) {
367
+ } catch (_e) {
368
368
  // ignore
369
369
  }
370
370
  return txBlock.withdraw(marketCoins, poolCoinName);
371
- } catch (e) {
371
+ } catch (_e) {
372
372
  // no sCoin found
373
373
  const { leftCoin, takeCoin: walletMarketCoins } =
374
374
  await builder.selectMarketCoin(
@@ -118,7 +118,7 @@ const generateReferralQuickMethod: GenerateReferralQuickMethod = ({
118
118
  builder.utils.parseCoinType(coinName)
119
119
  );
120
120
  txBlock.mergeCoins(rewardCoin, coins.slice(0, 500));
121
- } catch (e) {
121
+ } catch (_e) {
122
122
  // ignore
123
123
  } finally {
124
124
  objToTransfer.push(rewardCoin);
@@ -107,7 +107,7 @@ const stakeHelper = async (
107
107
  }
108
108
  txBlock.transferObjects([leftCoin], sender);
109
109
  return totalAmount;
110
- } catch (e) {
110
+ } catch (_e) {
111
111
  return 0;
112
112
  }
113
113
  };
@@ -32,6 +32,7 @@ export const OLD_BORROW_INCENTIVE_PROTOCOL_ID =
32
32
 
33
33
  export const SUPPORT_POOLS = [
34
34
  'usdc', // native USDC
35
+ 'sbeth', // native ETH
35
36
  'weth',
36
37
  'wbtc',
37
38
  'wusdc',
@@ -47,7 +48,8 @@ export const SUPPORT_POOLS = [
47
48
  ] as const;
48
49
 
49
50
  export const SUPPORT_COLLATERALS = [
50
- 'usdc',
51
+ 'usdc', // native USDC
52
+ 'sbeth', // native ETH
51
53
  'weth',
52
54
  'wbtc',
53
55
  'wusdc',
@@ -76,6 +78,7 @@ export const SUPPORT_SPOOLS = [
76
78
 
77
79
  export const SUPPORT_SCOIN = [
78
80
  'susdc',
81
+ 'ssbeth',
79
82
  'ssui',
80
83
  'swusdc',
81
84
  'swusdt',
@@ -89,6 +92,16 @@ export const SUPPORT_SCOIN = [
89
92
  'swbtc',
90
93
  ] as const;
91
94
 
95
+ export const SUPPORT_SUI_BRIDGE = ['sbeth'] as const;
96
+ export const SUPPORT_WORMHOLE = [
97
+ 'wusdc',
98
+ 'wusdt',
99
+ 'weth',
100
+ 'wbtc',
101
+ 'wapt',
102
+ 'wsol',
103
+ ] as const;
104
+
92
105
  export const SUPPORT_SPOOLS_REWARDS = ['sui'] as const;
93
106
 
94
107
  export const SUPPORT_BORROW_INCENTIVE_POOLS = [
@@ -99,6 +112,7 @@ export const SUPPORT_BORROW_INCENTIVE_POOLS = [
99
112
  'hasui',
100
113
  'vsui',
101
114
  'weth',
115
+ 'sbeth',
102
116
  'sca',
103
117
  'usdc',
104
118
  ] as const;
@@ -3,6 +3,7 @@ import { IS_VE_SCA_TEST } from './common';
3
3
 
4
4
  export const coinDecimals: types.SupportCoinDecimals = {
5
5
  usdc: 6,
6
+ sbeth: 8,
6
7
  weth: 8,
7
8
  wbtc: 8,
8
9
  wusdc: 6,
@@ -17,6 +18,7 @@ export const coinDecimals: types.SupportCoinDecimals = {
17
18
  sca: 9,
18
19
  susdc: 6,
19
20
  sweth: 8,
21
+ ssbeth: 8,
20
22
  swbtc: 8,
21
23
  swusdc: 6,
22
24
  swusdt: 6,
@@ -32,6 +34,7 @@ export const coinDecimals: types.SupportCoinDecimals = {
32
34
 
33
35
  export const assetCoins: types.AssetCoins = {
34
36
  usdc: 'usdc',
37
+ sbeth: 'sbeth',
35
38
  weth: 'weth',
36
39
  wbtc: 'wbtc',
37
40
  wusdc: 'wusdc',
@@ -48,6 +51,7 @@ export const assetCoins: types.AssetCoins = {
48
51
 
49
52
  export const marketCoins: types.MarketCoins = {
50
53
  susdc: 'susdc',
54
+ ssbeth: 'ssbeth',
51
55
  sweth: 'sweth',
52
56
  swbtc: 'swbtc',
53
57
  swusdc: 'swusdc',
@@ -64,6 +68,7 @@ export const marketCoins: types.MarketCoins = {
64
68
 
65
69
  export const sCoins: types.SCoins = {
66
70
  susdc: 'susdc',
71
+ ssbeth: 'ssbeth',
67
72
  sweth: 'sweth',
68
73
  swusdc: 'swusdc',
69
74
  swusdt: 'swusdt',
@@ -101,6 +106,10 @@ export const spoolRewardCoins: types.StakeRewardCoins = {
101
106
  susdc: 'sui',
102
107
  };
103
108
 
109
+ export const suiBridgeCoins: types.SuiBridgeCoins = {
110
+ sbeth: 'sbeth',
111
+ };
112
+
104
113
  export const borrowIncentiveRewardCoins: types.BorrowIncentiveRewardCoins = {
105
114
  usdc: ['sui', 'sca'],
106
115
  sui: ['sui', 'sca'],
@@ -111,11 +120,13 @@ export const borrowIncentiveRewardCoins: types.BorrowIncentiveRewardCoins = {
111
120
  hasui: ['sui'],
112
121
  vsui: ['sui'],
113
122
  weth: ['sui'],
123
+ sbeth: ['sui'],
114
124
  };
115
125
 
116
126
  export const coinIds: types.AssetCoinIds = {
117
127
  usdc: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7',
118
128
  sui: '0x0000000000000000000000000000000000000000000000000000000000000002',
129
+ sbeth: '0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29',
119
130
  weth: '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5',
120
131
  wbtc: '0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881',
121
132
  wusdc: '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf',
@@ -148,6 +159,8 @@ export const voloCoinIds: types.VoloCoinIds = {
148
159
  export const sCoinIds: types.SCoinIds = {
149
160
  susdc:
150
161
  '0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC',
162
+ ssbeth:
163
+ '0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH',
151
164
  ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
152
165
  scetus:
153
166
  '0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS',
@@ -64,6 +64,7 @@ export class Scallop {
64
64
  {
65
65
  id: params?.addressesId || ADDRESSES_ID,
66
66
  network: params?.networkType,
67
+ forceInterface: params?.forceAddressesInterface,
67
68
  },
68
69
  { cache: this.cache }
69
70
  );
@@ -377,7 +377,7 @@ export class ScallopAddress {
377
377
  params: ScallopAddressParams,
378
378
  instance?: ScallopAddressInstanceParams
379
379
  ) {
380
- const { id, auth, network } = params;
380
+ const { id, auth, network, forceInterface } = params;
381
381
  this.cache =
382
382
  instance?.cache ??
383
383
  new ScallopCache(
@@ -401,6 +401,18 @@ export class ScallopAddress {
401
401
  ? new Map([['mainnet', TEST_ADDRESSES]])
402
402
  : new Map();
403
403
  if (USE_TEST_ADDRESS) this._currentAddresses = TEST_ADDRESSES;
404
+
405
+ // Set the addresses from the forceInterface if it is provided.
406
+ if (forceInterface) {
407
+ for (const [network, addresses] of Object.entries<AddressesInterface>(
408
+ forceInterface
409
+ )) {
410
+ if (['localnet', 'devnet', 'testnet', 'mainnet'].includes(network)) {
411
+ if (network === this._network) this._currentAddresses = addresses;
412
+ this._addressesMap.set(network as NetworkType, addresses);
413
+ }
414
+ }
415
+ }
404
416
  }
405
417
 
406
418
  /**
@@ -72,6 +72,7 @@ export class ScallopBuilder {
72
72
  {
73
73
  id: params?.addressesId || ADDRESSES_ID,
74
74
  network: params?.networkType,
75
+ forceInterface: params?.forceAddressesInterface,
75
76
  },
76
77
  {
77
78
  cache: this.cache,
@@ -85,6 +85,7 @@ export class ScallopClient {
85
85
  {
86
86
  id: params?.addressesId || ADDRESSES_ID,
87
87
  network: params?.networkType,
88
+ forceInterface: params?.forceAddressesInterface,
88
89
  },
89
90
  {
90
91
  cache: this.cache,
@@ -813,7 +814,6 @@ export class ScallopClient {
813
814
  const stakeCoinName =
814
815
  this.utils.parseCoinName<SupportStakeCoins>(stakeMarketCoinName);
815
816
 
816
- console.log(stakeMarketCoin, stakeCoinName);
817
817
  if (stakeMarketCoin) {
818
818
  const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
819
819
  await this.utils.mergeSimilarCoins(
@@ -1054,7 +1054,7 @@ export class ScallopClient {
1054
1054
  if (sCoin) {
1055
1055
  sCoins.push(sCoin);
1056
1056
  }
1057
- } catch (e: any) {
1057
+ } catch (_e: any) {
1058
1058
  // ignore
1059
1059
  }
1060
1060
  }
@@ -1097,7 +1097,9 @@ export class ScallopClient {
1097
1097
  ): Promise<ScallopClientVeScaReturnType<S>> {
1098
1098
  // get all veSca keys
1099
1099
  const veScaKeys = (
1100
- (await this.query.getVeScas(this.walletAddress)) ?? []
1100
+ (await this.query.getVeScas({
1101
+ walletAddress: this.walletAddress,
1102
+ })) ?? []
1101
1103
  ).map(({ keyObject }) => keyObject);
1102
1104
  if (veScaKeys.length === 0) {
1103
1105
  throw new Error('No veSCA found in the wallet');
@@ -1113,7 +1115,7 @@ export class ScallopClient {
1113
1115
  const scaCoin = await tx.redeemScaQuick(key, false);
1114
1116
  if (!scaCoin) return;
1115
1117
  scaCoins.push(scaCoin);
1116
- } catch (e) {
1118
+ } catch (_e) {
1117
1119
  // ignore
1118
1120
  }
1119
1121
  })
@@ -62,6 +62,7 @@ import {
62
62
  } from 'src/queries/sCoinQuery';
63
63
  import { normalizeSuiAddress } from '@mysten/sui/utils';
64
64
  import { getSupplyLimit } from 'src/queries/supplyLimit';
65
+ import { withIndexerFallback } from 'src/utils/indexer';
65
66
 
66
67
  /**
67
68
  * @description
@@ -111,6 +112,7 @@ export class ScallopQuery {
111
112
  {
112
113
  id: params?.addressesId || ADDRESSES_ID,
113
114
  network: params?.networkType,
115
+ forceInterface: params?.forceAddressesInterface,
114
116
  },
115
117
  {
116
118
  cache: this.cache,
@@ -123,8 +125,40 @@ export class ScallopQuery {
123
125
  this.indexer =
124
126
  instance?.indexer ??
125
127
  new ScallopIndexer(this.params, { cache: this.cache });
128
+
129
+ // Wrap any method that has an indexer parameter as the last parameter
130
+ this.queryMarket = withIndexerFallback.call(this, this.queryMarket);
131
+ this.getMarketPools = withIndexerFallback.call(this, this.getMarketPools);
132
+ this.getMarketPool = withIndexerFallback.call(this, this.getMarketPool);
133
+ this.getMarketCollaterals = withIndexerFallback.call(
134
+ this,
135
+ this.getMarketCollaterals
136
+ );
137
+ this.getMarketCollateral = withIndexerFallback.call(
138
+ this,
139
+ this.getMarketCollateral
140
+ );
141
+ this.getSpools = withIndexerFallback.call(this, this.getSpools);
142
+ this.getSpool = withIndexerFallback.call(this, this.getSpool);
143
+ this.getBorrowIncentivePools = withIndexerFallback.call(
144
+ this,
145
+ this.getBorrowIncentivePools
146
+ );
147
+ this.getLendings = withIndexerFallback.call(this, this.getLendings);
148
+ this.getLending = withIndexerFallback.call(this, this.getLending);
149
+ this.getObligationAccounts = withIndexerFallback.call(
150
+ this,
151
+ this.getObligationAccounts
152
+ );
153
+ this.getObligationAccount = withIndexerFallback.call(
154
+ this,
155
+ this.getObligationAccount
156
+ );
157
+ this.getTvl = withIndexerFallback.call(this, this.getTvl);
126
158
  }
127
159
 
160
+ /* ========================================================== */
161
+
128
162
  /**
129
163
  * Request the scallop API to initialize data.
130
164
  *
@@ -579,8 +613,14 @@ export class ScallopQuery {
579
613
  * @param walletAddress
580
614
  * @returns array of veSca
581
615
  */
582
- public async getVeScas(walletAddress: string = this.walletAddress) {
583
- return await getVeScas(this, walletAddress);
616
+ public async getVeScas({
617
+ walletAddress = this.walletAddress,
618
+ excludeEmpty = false,
619
+ }: {
620
+ walletAddress?: string;
621
+ excludeEmpty?: boolean;
622
+ } = {}) {
623
+ return await getVeScas(this, walletAddress, excludeEmpty);
584
624
  }
585
625
 
586
626
  /**