@scallop-io/sui-scallop-sdk 1.4.5 → 1.4.7

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 (38) hide show
  1. package/dist/constants/index.d.ts +0 -1
  2. package/dist/constants/poolAddress.d.ts +1 -0
  3. package/dist/index.d.ts +0 -1
  4. package/dist/index.js +1644 -1478
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +1848 -1678
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/models/scallop.d.ts +1 -2
  9. package/dist/models/scallopCache.d.ts +16 -11
  10. package/dist/models/scallopQuery.d.ts +67 -3
  11. package/dist/queries/poolAddressesQuery.d.ts +2 -0
  12. package/dist/queries/portfolioQuery.d.ts +60 -3
  13. package/dist/types/model.d.ts +8 -2
  14. package/dist/utils/index.d.ts +0 -2
  15. package/package.json +1 -1
  16. package/src/constants/index.ts +0 -1
  17. package/src/constants/poolAddress.ts +93 -25
  18. package/src/constants/queryKeys.ts +1 -1
  19. package/src/index.ts +0 -1
  20. package/src/models/scallop.ts +8 -13
  21. package/src/models/scallopAddress.ts +2 -9
  22. package/src/models/scallopBuilder.ts +3 -6
  23. package/src/models/scallopCache.ts +96 -55
  24. package/src/models/scallopClient.ts +3 -6
  25. package/src/models/scallopIndexer.ts +1 -5
  26. package/src/models/scallopQuery.ts +42 -16
  27. package/src/models/scallopUtils.ts +7 -11
  28. package/src/queries/coreQuery.ts +4 -4
  29. package/src/queries/poolAddressesQuery.ts +6 -0
  30. package/src/queries/portfolioQuery.ts +209 -8
  31. package/src/queries/sCoinQuery.ts +2 -2
  32. package/src/types/model.ts +13 -2
  33. package/src/utils/index.ts +0 -2
  34. package/src/utils/indexer.ts +3 -1
  35. package/dist/constants/tokenBucket.d.ts +0 -2
  36. package/dist/utils/tokenBucket.d.ts +0 -11
  37. package/src/constants/tokenBucket.ts +0 -2
  38. package/src/utils/tokenBucket.ts +0 -68
@@ -8,7 +8,6 @@ import type { ScallopBuilderParams, ScallopClientParams, ScallopParams, ScallopQ
8
8
  import { ScallopIndexer } from './scallopIndexer';
9
9
  import { ScallopCache } from './scallopCache';
10
10
  import { QueryClientConfig } from '@tanstack/query-core';
11
- import { TokenBucket } from 'src/utils';
12
11
  import type { QueryClient } from '@tanstack/query-core';
13
12
  /**
14
13
  * @argument params - The parameters for the Scallop instance.
@@ -32,7 +31,7 @@ export declare class Scallop {
32
31
  suiKit: SuiKit;
33
32
  cache: ScallopCache;
34
33
  private address;
35
- constructor(params: ScallopParams, cacheOptions?: QueryClientConfig, tokenBucket?: TokenBucket, queryClient?: QueryClient);
34
+ constructor(params: ScallopParams, cacheOptions?: QueryClientConfig, queryClient?: QueryClient);
36
35
  /**
37
36
  * Get a scallop address instance that already has read addresses.
38
37
  *
@@ -1,8 +1,8 @@
1
- import { QueryClient, QueryClientConfig } from '@tanstack/query-core';
1
+ import { QueryClient } from '@tanstack/query-core';
2
2
  import { SuiObjectArg } from '@scallop-io/sui-kit';
3
3
  import { SuiKit } from '@scallop-io/sui-kit';
4
- import type { SuiObjectResponse, SuiObjectDataOptions, SuiObjectData, GetOwnedObjectsParams, DevInspectResults, GetDynamicFieldsParams, DynamicFieldPage, GetDynamicFieldObjectParams, GetBalanceParams } from '@mysten/sui/client';
5
- import { TokenBucket } from 'src/utils';
4
+ import type { SuiObjectResponse, SuiObjectDataOptions, SuiObjectData, GetOwnedObjectsParams, DevInspectResults, GetDynamicFieldsParams, DynamicFieldPage, GetDynamicFieldObjectParams, GetBalanceParams, CoinBalance } from '@mysten/sui/client';
5
+ import { ScallopCacheInstanceParams, ScallopCacheParams } from 'src/types';
6
6
  type QueryInspectTxnParams = {
7
7
  queryTarget: string;
8
8
  args: SuiObjectArg[];
@@ -21,13 +21,19 @@ type QueryInspectTxnParams = {
21
21
  * ```
22
22
  */
23
23
  export declare class ScallopCache {
24
- readonly queryClient: QueryClient;
25
- readonly _suiKit: SuiKit;
26
- private tokenBucket;
24
+ readonly params: ScallopCacheParams;
25
+ queryClient: QueryClient;
26
+ suiKit: SuiKit;
27
27
  walletAddress: string;
28
- constructor(suiKit: SuiKit, walletAddress?: string, cacheOptions?: QueryClientConfig, tokenBucket?: TokenBucket, queryClient?: QueryClient);
29
- private get suiKit();
28
+ private tokensPerInterval;
29
+ private interval;
30
+ private tokens;
31
+ private lastRefill;
32
+ constructor(params: ScallopCacheParams, instance?: ScallopCacheInstanceParams);
30
33
  private get client();
34
+ private refill;
35
+ private removeTokens;
36
+ private callWithRateLimit;
31
37
  /**
32
38
  * @description Invalidate cache based on the refetchType parameter
33
39
  * @param refetchType Determines the type of queries to be refetched. Defaults to `active`.
@@ -37,7 +43,6 @@ export declare class ScallopCache {
37
43
  * - `all`: All queries that match the refetch predicate will be refetched in the background.
38
44
  * - `none`: No queries will be refetched. Queries that match the refetch predicate will only be marked as invalid.
39
45
  */
40
- invalidateAllCache(): Promise<Promise<void>[]>;
41
46
  private retryFn;
42
47
  /**
43
48
  * @description Provides cache for inspectTxn of the SuiKit.
@@ -69,8 +74,8 @@ export declare class ScallopCache {
69
74
  queryGetDynamicFields(input: GetDynamicFieldsParams): Promise<DynamicFieldPage | null>;
70
75
  queryGetDynamicFieldObject(input: GetDynamicFieldObjectParams): Promise<SuiObjectResponse | null>;
71
76
  queryGetAllCoinBalances(owner: string): Promise<{
72
- [k: string]: string;
77
+ [k: string]: CoinBalance;
73
78
  }>;
74
- queryGetCoinBalance(input: GetBalanceParams): Promise<string>;
79
+ queryGetCoinBalance(input: GetBalanceParams): Promise<CoinBalance | null>;
75
80
  }
76
81
  export {};
@@ -1,5 +1,5 @@
1
1
  import { SuiKit, SuiObjectArg } from '@scallop-io/sui-kit';
2
- import { ScallopQueryParams, SupportStakeMarketCoins, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, SupportMarketCoins, SupportBorrowIncentiveCoins, SupportSCoin, ScallopQueryInstanceParams, MarketPool, CoinPrices, MarketPools } from '../types';
2
+ import { ScallopQueryParams, SupportStakeMarketCoins, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, SupportMarketCoins, SupportBorrowIncentiveCoins, SupportSCoin, ScallopQueryInstanceParams, MarketPool, CoinPrices, MarketPools, MarketCollaterals } from '../types';
3
3
  import { ScallopAddress } from './scallopAddress';
4
4
  import { ScallopUtils } from './scallopUtils';
5
5
  import { ScallopIndexer } from './scallopIndexer';
@@ -60,7 +60,7 @@ export declare class ScallopQuery {
60
60
  indexer?: boolean;
61
61
  }): Promise<{
62
62
  pools: MarketPools;
63
- collaterals: import("../types").MarketCollaterals;
63
+ collaterals: MarketCollaterals;
64
64
  }>;
65
65
  /**
66
66
  * Get market pool
@@ -352,6 +352,7 @@ export declare class ScallopQuery {
352
352
  */
353
353
  getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, args?: {
354
354
  indexer?: boolean;
355
+ marketPools?: MarketPools;
355
356
  }): Promise<{
356
357
  usdc?: import("../types").Lending | undefined;
357
358
  sbeth?: import("../types").Lending | undefined;
@@ -394,6 +395,10 @@ export declare class ScallopQuery {
394
395
  */
395
396
  getObligationAccounts(ownerAddress?: string, args?: {
396
397
  indexer?: boolean;
398
+ market?: {
399
+ collaterals: MarketCollaterals;
400
+ pools: MarketPools;
401
+ };
397
402
  }): Promise<{
398
403
  [x: string]: import("../types").ObligationAccount | undefined;
399
404
  }>;
@@ -562,7 +567,7 @@ export declare class ScallopQuery {
562
567
  swapt?: number | undefined;
563
568
  }>;
564
569
  /**
565
- * Query all address (lending pool, collateral pool, borrow dynamics, interest models) of all pool
570
+ * Query all address (lending pool, collateral pool, borrow dynamics, interest models, etc.) of all pool
566
571
  * @returns
567
572
  */
568
573
  getPoolAddresses(): Promise<import("../types").OptionalKeys<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd", {
@@ -571,6 +576,7 @@ export declare class ScallopQuery {
571
576
  borrowDynamic?: string;
572
577
  spoolReward?: string;
573
578
  spool?: string;
579
+ sCoinType?: string;
574
580
  sCoinTreasury?: string;
575
581
  interestModel?: string;
576
582
  riskModel?: string;
@@ -580,5 +586,63 @@ export declare class ScallopQuery {
580
586
  isolatedAssetKey?: string;
581
587
  coinDecimalId?: string;
582
588
  borrowIncentivePoolId?: string;
589
+ coinType?: string;
583
590
  }>>>;
591
+ /**
592
+ * Get user portfolio
593
+ */
594
+ getUserPortfolio(args?: {
595
+ walletAddress?: string;
596
+ indexer?: boolean;
597
+ }): Promise<{
598
+ lendings: {
599
+ totalSupplyValue: number;
600
+ suppliedPools: {
601
+ suppliedCoin: number;
602
+ suppliedValue: number;
603
+ stakedCoin: number;
604
+ coinName: "usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
605
+ symbol: string;
606
+ coinType: string;
607
+ coinPrice: number;
608
+ coinDecimals: number;
609
+ supplyApr: number;
610
+ supplyApy: number;
611
+ incentiveApr: number;
612
+ }[];
613
+ };
614
+ borrowings: {
615
+ obligations: {
616
+ obligationId: string;
617
+ totalDebtsInUsd: number;
618
+ totalCollateralInUsd: number;
619
+ riskLevel: number;
620
+ availableCollateralInUsd: number;
621
+ totalUnhealthyCollateralInUsd: number;
622
+ borrowedPools: {
623
+ coinName: "usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
624
+ symbol: string;
625
+ coinDecimals: number;
626
+ coinType: string;
627
+ coinPrice: number;
628
+ borrowedCoin: number;
629
+ borrowedValueInUsd: number;
630
+ borrowApr: number | undefined;
631
+ borrowApy: number | undefined;
632
+ incentiveInfos: {
633
+ coinName: "usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
634
+ symbol: string;
635
+ coinType: string;
636
+ incentiveApr: number;
637
+ }[];
638
+ }[];
639
+ }[];
640
+ totalDebtValue: number;
641
+ totalCollateralValue: number;
642
+ };
643
+ pendingRewards: {
644
+ lendings: any;
645
+ borrowIncentives: any;
646
+ };
647
+ }>;
584
648
  }
@@ -6,6 +6,7 @@ export declare const getAllAddresses: (query: ScallopQuery) => Promise<OptionalK
6
6
  borrowDynamic?: string;
7
7
  spoolReward?: string;
8
8
  spool?: string;
9
+ sCoinType?: string;
9
10
  sCoinTreasury?: string;
10
11
  interestModel?: string;
11
12
  riskModel?: string;
@@ -15,4 +16,5 @@ export declare const getAllAddresses: (query: ScallopQuery) => Promise<OptionalK
15
16
  isolatedAssetKey?: string;
16
17
  coinDecimalId?: string;
17
18
  borrowIncentivePoolId?: string;
19
+ coinType?: string;
18
20
  }>>>;
@@ -1,5 +1,5 @@
1
1
  import type { ScallopQuery } from '../models';
2
- import type { Market, SupportPoolCoins, MarketPool, Spool, StakeAccount, Lending, ObligationAccount, CoinAmounts, CoinPrices, TotalValueLocked } from '../types';
2
+ import type { Market, SupportPoolCoins, MarketPool, Spool, StakeAccount, Lending, ObligationAccount, CoinAmounts, CoinPrices, TotalValueLocked, MarketPools, MarketCollaterals } from '../types';
3
3
  import { SuiObjectRef } from '@mysten/sui/client';
4
4
  /**
5
5
  * Get user lending infomation for specific pools.
@@ -10,7 +10,7 @@ import { SuiObjectRef } from '@mysten/sui/client';
10
10
  * @param indexer - Whether to use indexer.
11
11
  * @return User lending infomation for specific pools.
12
12
  */
13
- export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, indexer?: boolean) => Promise<{
13
+ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, marketPools?: MarketPools, indexer?: boolean) => Promise<{
14
14
  usdc?: Lending | undefined;
15
15
  sbeth?: Lending | undefined;
16
16
  weth?: Lending | undefined;
@@ -55,7 +55,10 @@ export declare const getLending: (query: ScallopQuery, poolCoinName: SupportPool
55
55
  * @param indexer - Whether to use indexer.
56
56
  * @return All obligation accounts data.
57
57
  */
58
- export declare const getObligationAccounts: (query: ScallopQuery, ownerAddress?: string, indexer?: boolean) => Promise<{
58
+ export declare const getObligationAccounts: (query: ScallopQuery, ownerAddress?: string, market?: {
59
+ pools: MarketPools;
60
+ collaterals: MarketCollaterals;
61
+ }, indexer?: boolean) => Promise<{
59
62
  [x: string]: ObligationAccount | undefined;
60
63
  }>;
61
64
  /**
@@ -75,3 +78,57 @@ export declare const getObligationAccount: (query: ScallopQuery, obligation: str
75
78
  * @return Total value locked data.
76
79
  */
77
80
  export declare const getTotalValueLocked: (query: ScallopQuery, indexer?: boolean) => Promise<TotalValueLocked>;
81
+ /**
82
+ * Get user portfolio by wallet address
83
+ */
84
+ export declare const getUserPortfolio: (query: ScallopQuery, walletAddress: string, indexer?: boolean) => Promise<{
85
+ lendings: {
86
+ totalSupplyValue: number;
87
+ suppliedPools: {
88
+ suppliedCoin: number;
89
+ suppliedValue: number;
90
+ stakedCoin: number;
91
+ coinName: "usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
92
+ symbol: string;
93
+ coinType: string;
94
+ coinPrice: number;
95
+ coinDecimals: number;
96
+ supplyApr: number;
97
+ supplyApy: number;
98
+ incentiveApr: number;
99
+ }[];
100
+ };
101
+ borrowings: {
102
+ obligations: {
103
+ obligationId: string;
104
+ totalDebtsInUsd: number;
105
+ totalCollateralInUsd: number;
106
+ riskLevel: number;
107
+ availableCollateralInUsd: number;
108
+ totalUnhealthyCollateralInUsd: number;
109
+ borrowedPools: {
110
+ coinName: "usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
111
+ symbol: string;
112
+ coinDecimals: number;
113
+ coinType: string;
114
+ coinPrice: number;
115
+ borrowedCoin: number;
116
+ borrowedValueInUsd: number;
117
+ borrowApr: number | undefined;
118
+ borrowApy: number | undefined;
119
+ incentiveInfos: {
120
+ coinName: "usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
121
+ symbol: string;
122
+ coinType: string;
123
+ incentiveApr: number;
124
+ }[];
125
+ }[];
126
+ }[];
127
+ totalDebtValue: number;
128
+ totalCollateralValue: number;
129
+ };
130
+ pendingRewards: {
131
+ lendings: any;
132
+ borrowIncentives: any;
133
+ };
134
+ }>;
@@ -4,6 +4,7 @@ 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
6
  import { AddressesInterface } from './address';
7
+ import { QueryClient, QueryClientConfig } from '@tanstack/query-core';
7
8
  export type ScallopClientFnReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : Transaction;
8
9
  export type ScallopClientVeScaReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : {
9
10
  tx: Transaction;
@@ -12,7 +13,9 @@ export type ScallopClientVeScaReturnType<T extends boolean> = T extends true ? S
12
13
  export type ScallopBaseInstanceParams = {
13
14
  suiKit?: SuiKit;
14
15
  };
15
- export type ScallopCacheInstanceParams = ScallopBaseInstanceParams;
16
+ export type ScallopCacheInstanceParams = ScallopBaseInstanceParams & {
17
+ queryClient?: QueryClient;
18
+ };
16
19
  export type ScallopAddressInstanceParams = ScallopBaseInstanceParams & {
17
20
  cache?: ScallopCache;
18
21
  };
@@ -43,7 +46,7 @@ export type ScallopParams = {
43
46
  forceAddressesInterface?: Partial<Record<NetworkType, AddressesInterface>>;
44
47
  walletAddress?: string;
45
48
  } & SuiKitParams;
46
- export type ScallopClientParams = ScallopParams & ScallopBuilderParams & ScallopQueryParams & ScallopUtilsParams;
49
+ export type ScallopClientParams = ScallopParams & ScallopBuilderParams & ScallopQueryParams & ScallopUtilsParams & ScallopCacheParams;
47
50
  export type ScallopBuilderParams = ScallopParams & {
48
51
  pythEndpoints?: string[];
49
52
  usePythPullModel?: boolean;
@@ -52,3 +55,6 @@ export type ScallopQueryParams = ScallopParams & ScallopUtilsParams;
52
55
  export type ScallopUtilsParams = ScallopParams & {
53
56
  pythEndpoints?: string[];
54
57
  };
58
+ export type ScallopCacheParams = Omit<ScallopParams, 'addressId' | 'forceAddressesInterface'> & {
59
+ cacheOptions?: QueryClientConfig;
60
+ };
@@ -1,7 +1,5 @@
1
1
  export * from './builder';
2
2
  export * from './query';
3
3
  export * from './util';
4
- export * from './tokenBucket';
5
4
  export * from './indexer';
6
5
  export * from './core';
7
- export * from './tokenBucket';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -8,6 +8,5 @@ export * from './pyth';
8
8
  export * from './queryKeys';
9
9
  export * from './rpc';
10
10
  export * from './testAddress';
11
- export * from './tokenBucket';
12
11
  export * from './vesca';
13
12
  export * from './testAddress';
@@ -18,6 +18,7 @@ export const POOL_ADDRESSES: OptionalKeys<
18
18
  borrowLimitKey?: string;
19
19
  isolatedAssetKey?: string;
20
20
  coinDecimalId?: string;
21
+ sCoinType?: string;
21
22
  }
22
23
  >
23
24
  > = {
@@ -44,8 +45,12 @@ export const POOL_ADDRESSES: OptionalKeys<
44
45
  '0x85ed6ed72ea97c35dbf0cdc7ed6fbc48d8ec15de9b17c74bf4512df8a6d7f166',
45
46
  sCoinTreasury:
46
47
  '0xbe6b63021f3d82e0e7e977cdd718ed7c019cf2eba374b7b546220402452f938e',
48
+ sCoinType:
49
+ '0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC',
47
50
  coinDecimalId:
48
51
  '0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6',
52
+ coinType:
53
+ 'dba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',
49
54
  },
50
55
  sbeth: {
51
56
  lendingPoolAddress:
@@ -69,8 +74,12 @@ export const POOL_ADDRESSES: OptionalKeys<
69
74
  spoolReward: undefined,
70
75
  sCoinTreasury:
71
76
  '0xfd0f02def6358a1f266acfa1493d4707ee8387460d434fb667d63d755ff907ed',
77
+ sCoinType:
78
+ '0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH',
72
79
  coinDecimalId:
73
80
  '0x89b04ba87f8832d4d76e17a1c9dce72eb3e64d372cf02012b8d2de5384faeef0',
81
+ coinType:
82
+ 'd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH',
74
83
  },
75
84
  weth: {
76
85
  lendingPoolAddress:
@@ -95,8 +104,12 @@ export const POOL_ADDRESSES: OptionalKeys<
95
104
  '0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077',
96
105
  sCoinTreasury:
97
106
  '0x4b7f5da0e306c9d52490a0c1d4091e653d6b89778b9b4f23c877e534e4d9cd21',
107
+ sCoinType:
108
+ '0x67540ceb850d418679e69f1fb6b2093d6df78a2a699ffc733f7646096d552e9b::scallop_wormhole_eth::SCALLOP_WORMHOLE_ETH',
98
109
  coinDecimalId:
99
110
  '0x8900e4ceede3363bef086d6b50ca89d816d0e90bf6bc46efefe1f8455e08f50f',
111
+ coinType:
112
+ 'af8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN',
100
113
  },
101
114
  wbtc: {
102
115
  lendingPoolAddress:
@@ -120,8 +133,12 @@ export const POOL_ADDRESSES: OptionalKeys<
120
133
  spoolReward: undefined,
121
134
  sCoinTreasury:
122
135
  '0xe2883934ea42c99bc998bbe0f01dd6d27aa0e27a56455707b1b34e6a41c20baa',
136
+ sCoinType:
137
+ '0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC',
123
138
  coinDecimalId:
124
139
  '0x5d3c6e60eeff8a05b693b481539e7847dfe33013e7070cdcb387f5c0cac05dfd',
140
+ coinType:
141
+ '027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN',
125
142
  },
126
143
  wusdc: {
127
144
  lendingPoolAddress:
@@ -146,8 +163,12 @@ export const POOL_ADDRESSES: OptionalKeys<
146
163
  '0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8',
147
164
  sCoinTreasury:
148
165
  '0x50c5cfcbcca3aaacab0984e4d7ad9a6ad034265bebb440f0d1cd688ec20b2548',
166
+ sCoinType:
167
+ '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
149
168
  coinDecimalId:
150
169
  '0x4fbf84f3029bd0c0b77164b587963be957f853eccf834a67bb9ecba6ec80f189',
170
+ coinType:
171
+ '5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN',
151
172
  },
152
173
  wusdt: {
153
174
  lendingPoolAddress:
@@ -172,8 +193,12 @@ export const POOL_ADDRESSES: OptionalKeys<
172
193
  '0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080',
173
194
  sCoinTreasury:
174
195
  '0x1f02e2fed702b477732d4ad6044aaed04f2e8e586a169153694861a901379df0',
196
+ sCoinType:
197
+ '0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
175
198
  coinDecimalId:
176
199
  '0xfb0e3eb97dd158a5ae979dddfa24348063843c5b20eb8381dd5fa7c93699e45c',
200
+ coinType:
201
+ 'c060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN',
177
202
  },
178
203
  sui: {
179
204
  lendingPoolAddress:
@@ -198,8 +223,12 @@ export const POOL_ADDRESSES: OptionalKeys<
198
223
  '0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9',
199
224
  sCoinTreasury:
200
225
  '0x5c1678c8261ac9eec024d4d630006a9f55c80dc0b1aa38a003fcb1d425818c6b',
226
+ sCoinType:
227
+ '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
201
228
  coinDecimalId:
202
229
  '0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3',
230
+ coinType:
231
+ '0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',
203
232
  },
204
233
  wapt: {
205
234
  lendingPoolAddress:
@@ -220,33 +249,11 @@ export const POOL_ADDRESSES: OptionalKeys<
220
249
  spool: undefined,
221
250
  spoolReward: undefined,
222
251
  sCoinTreasury: undefined,
252
+ sCoinType: undefined,
223
253
  coinDecimalId:
224
254
  '0xc969c5251f372c0f34c32759f1d315cf1ea0ee5e4454b52aea08778eacfdd0a8',
225
- },
226
- wsol: {
227
- lendingPoolAddress:
228
- '0x985682c42984cdfb03f9ff7d8923344c2fe096b1ae4b82ea17721af19d22a21f',
229
- collateralPoolAddress:
230
- '0xdc1cc2c371a043ae8e3c3fe2d013c35f1346960b7dbb4c072982c5b794ed144f',
231
- borrowDynamic:
232
- '0xe3f301e16d4f1273ea659dd82c5c3f124ca5a5883a5726c7ec0f77bf43b70895',
233
- interestModel:
234
- '0xd95affaee077006b8dbb4b108c1b087e95fc6e5143ef0682da345d5b35bc6356',
235
- riskModel:
236
- '0x8e0da6358073144ec3557400c87f04991ba3a13ca7e0d0a19daed45260b32f16',
237
- borrowFeeKey:
238
- '0x604bffbc817e8e12db15f2373a9e15b2c7adbc510649cdf2cc62a594af90671c',
239
- supplyLimitKey:
240
- '0xbd419b536b3f9c9d4adfc20372ca6feedc53cc31798ac860dbfc847bcf05f54b',
241
- borrowLimitKey:
242
- '0x77d453c51948f32564c810bc73f9ba7abde880657b7f89e1c8a3bc28fa36ee87',
243
- isolatedAssetKey: undefined,
244
- spool: undefined,
245
- spoolReward: undefined,
246
- sCoinTreasury:
247
- '0x760fd66f5be869af4382fa32b812b3c67f0eca1bb1ed7a5578b21d56e1848819',
248
- coinDecimalId:
249
- '0x4d2c39082b4477e3e79dc4562d939147ab90c42fc5f3e4acf03b94383cd69b6e',
255
+ coinType:
256
+ '3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37::coin::COIN',
250
257
  },
251
258
  cetus: {
252
259
  lendingPoolAddress:
@@ -271,8 +278,41 @@ export const POOL_ADDRESSES: OptionalKeys<
271
278
  '0x6835c1224126a45086fc6406adc249e3f30df18d779ca4f4e570e38716a17f3f',
272
279
  sCoinTreasury:
273
280
  '0xa283c63488773c916cb3d6c64109536160d5eb496caddc721eb39aad2977d735',
281
+ sCoinType:
282
+ '0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS',
274
283
  coinDecimalId:
275
284
  '0x4c0dce55eff2db5419bbd2d239d1aa22b4a400c01bbb648b058a9883989025da',
285
+ coinType:
286
+ '06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS',
287
+ },
288
+ wsol: {
289
+ lendingPoolAddress:
290
+ '0x985682c42984cdfb03f9ff7d8923344c2fe096b1ae4b82ea17721af19d22a21f',
291
+ collateralPoolAddress:
292
+ '0xdc1cc2c371a043ae8e3c3fe2d013c35f1346960b7dbb4c072982c5b794ed144f',
293
+ borrowDynamic:
294
+ '0xe3f301e16d4f1273ea659dd82c5c3f124ca5a5883a5726c7ec0f77bf43b70895',
295
+ interestModel:
296
+ '0xd95affaee077006b8dbb4b108c1b087e95fc6e5143ef0682da345d5b35bc6356',
297
+ riskModel:
298
+ '0x8e0da6358073144ec3557400c87f04991ba3a13ca7e0d0a19daed45260b32f16',
299
+ borrowFeeKey:
300
+ '0x604bffbc817e8e12db15f2373a9e15b2c7adbc510649cdf2cc62a594af90671c',
301
+ supplyLimitKey:
302
+ '0xbd419b536b3f9c9d4adfc20372ca6feedc53cc31798ac860dbfc847bcf05f54b',
303
+ borrowLimitKey:
304
+ '0x77d453c51948f32564c810bc73f9ba7abde880657b7f89e1c8a3bc28fa36ee87',
305
+ isolatedAssetKey: undefined,
306
+ spool: undefined,
307
+ spoolReward: undefined,
308
+ sCoinTreasury:
309
+ '0x760fd66f5be869af4382fa32b812b3c67f0eca1bb1ed7a5578b21d56e1848819',
310
+ sCoinType:
311
+ '0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL',
312
+ coinDecimalId:
313
+ '0x4d2c39082b4477e3e79dc4562d939147ab90c42fc5f3e4acf03b94383cd69b6e',
314
+ coinType:
315
+ 'b7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN',
276
316
  },
277
317
  afsui: {
278
318
  lendingPoolAddress:
@@ -297,8 +337,12 @@ export const POOL_ADDRESSES: OptionalKeys<
297
337
  '0x89255a2f86ed7fbfef35ab8b7be48cc7667015975be2685dd9a55a9a64baf76e',
298
338
  sCoinTreasury:
299
339
  '0x55f4dfe9e40bc4cc11c70fcb1f3daefa2bdc330567c58d4f0792fbd9f9175a62',
340
+ sCoinType:
341
+ '0x00671b1fa2a124f5be8bdae8b91ee711462c5d9e31bda232e70fd9607b523c88::scallop_af_sui::SCALLOP_AF_SUI',
300
342
  coinDecimalId:
301
343
  '0x2f9217f533e51334873a39b8026a4aa6919497b47f49d0986a4f1aec66f8a34d',
344
+ coinType:
345
+ 'f325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI',
302
346
  },
303
347
  hasui: {
304
348
  lendingPoolAddress:
@@ -323,8 +367,12 @@ export const POOL_ADDRESSES: OptionalKeys<
323
367
  '0x6f3563644d3e2ef13176dbf9d865bd93479df60ccbe07b7e66db57f6309f5a66',
324
368
  sCoinTreasury:
325
369
  '0x404ccc1404d74a90eb6f9c9d4b6cda6d417fb03189f80d9070a35e5dab1df0f5',
370
+ sCoinType:
371
+ '0x9a2376943f7d22f88087c259c5889925f332ca4347e669dc37d54c2bf651af3c::scallop_ha_sui::SCALLOP_HA_SUI',
326
372
  coinDecimalId:
327
373
  '0x2c5f33af93f6511df699aaaa5822d823aac6ed99d4a0de2a4a50b3afa0172e24',
374
+ coinType:
375
+ 'bde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI',
328
376
  },
329
377
  vsui: {
330
378
  lendingPoolAddress:
@@ -349,8 +397,12 @@ export const POOL_ADDRESSES: OptionalKeys<
349
397
  '0xbca914adce058ad0902c7f3cfcd698392a475f00dcfdc3f76001d0370b98777a',
350
398
  sCoinTreasury:
351
399
  '0xc06688ee1af25abc286ffb1d18ce273d1d5907cd1064c25f4e8ca61ea989c1d1',
400
+ sCoinType:
401
+ '0xe1a1cc6bcf0001a015eab84bcc6713393ce20535f55b8b6f35c142e057a25fbe::scallop_v_sui::SCALLOP_V_SUI',
352
402
  coinDecimalId:
353
403
  '0xabd84a23467b33854ab25cf862006fd97479f8f6f53e50fe732c43a274d939bd',
404
+ coinType:
405
+ '549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT',
354
406
  },
355
407
  sca: {
356
408
  lendingPoolAddress:
@@ -374,8 +426,12 @@ export const POOL_ADDRESSES: OptionalKeys<
374
426
  spoolReward: undefined,
375
427
  sCoinTreasury:
376
428
  '0xe04bfc95e00252bd654ee13c08edef9ac5e4b6ae4074e8390db39e9a0109c529',
429
+ sCoinType:
430
+ '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
377
431
  coinDecimalId:
378
432
  '0x5d26a1e9a55c88147ac870bfa31b729d7f49f8804b8b3adfdf3582d301cca844',
433
+ coinType:
434
+ '7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA',
379
435
  },
380
436
  fud: {
381
437
  lendingPoolAddress:
@@ -398,8 +454,12 @@ export const POOL_ADDRESSES: OptionalKeys<
398
454
  spoolReward: undefined,
399
455
  sCoinTreasury:
400
456
  '0xf25212f11d182decff7a86165699a73e3d5787aced203ca539f43cfbc10db867',
457
+ sCoinType:
458
+ '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
401
459
  coinDecimalId:
402
460
  '0x01087411ef48aaac1eb6e24803213e3a60a03b147dac930e5e341f17a85e524e',
461
+ coinType:
462
+ '76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1::fud::FUD',
403
463
  },
404
464
  deep: {
405
465
  lendingPoolAddress:
@@ -422,8 +482,12 @@ export const POOL_ADDRESSES: OptionalKeys<
422
482
  spoolReward: undefined,
423
483
  sCoinTreasury:
424
484
  '0xc63838fabe37b25ad897392d89876d920f5e0c6a406bf3abcb84753d2829bc88',
485
+ sCoinType:
486
+ '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
425
487
  coinDecimalId:
426
488
  '0x6e60b051a08fa836f5a7acd7c464c8d9825bc29c44657fe170fe9b8e1e4770c0',
489
+ coinType:
490
+ 'deeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP',
427
491
  },
428
492
  fdusd: {
429
493
  lendingPoolAddress:
@@ -447,7 +511,11 @@ export const POOL_ADDRESSES: OptionalKeys<
447
511
  spoolReward: undefined,
448
512
  sCoinTreasury:
449
513
  '0xdad9bc6293e694f67a5274ea51b596e0bdabfafc585ae6d7e82888e65f1a03e0',
514
+ sCoinType:
515
+ '0x6711551c1e7652a270d9fbf0eee25d99594c157cde3cb5fbb49035eb59b1b001::scallop_fdusd::SCALLOP_FDUSD',
450
516
  coinDecimalId:
451
517
  '0xdebee5265a67c186ed87fe93303d33dfe1de53e3b4fd7d9329c2852860acd3e7',
518
+ coinType:
519
+ 'f16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD',
452
520
  },
453
521
  };
@@ -49,7 +49,7 @@ export const queryKeys = {
49
49
  {
50
50
  walletAddress,
51
51
  options,
52
- objectIds: JSON.stringify(objectIds ?? []),
52
+ objectIds: JSON.stringify(objectIds ?? undefined),
53
53
  },
54
54
  ],
55
55
  getOwnedObjects: (input?: Partial<GetOwnedObjectsParams>) => [
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from './constants';
2
2
  export * from './models';
3
3
  export type * from './types';
4
- export * from './utils/tokenBucket';
@@ -15,12 +15,6 @@ import type {
15
15
  import { ScallopIndexer } from './scallopIndexer';
16
16
  import { ScallopCache } from './scallopCache';
17
17
  import { QueryClientConfig } from '@tanstack/query-core';
18
- import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
19
- import { TokenBucket } from 'src/utils';
20
- import {
21
- DEFAULT_INTERVAL_IN_MS,
22
- DEFAULT_TOKENS_PER_INTERVAL,
23
- } from 'src/constants/tokenBucket';
24
18
  import type { QueryClient } from '@tanstack/query-core';
25
19
  import { newSuiKit } from './suiKit';
26
20
 
@@ -51,18 +45,19 @@ export class Scallop {
51
45
  public constructor(
52
46
  params: ScallopParams,
53
47
  cacheOptions?: QueryClientConfig,
54
- tokenBucket?: TokenBucket,
55
48
  queryClient?: QueryClient
56
49
  ) {
57
50
  this.params = params;
58
51
  this.suiKit = newSuiKit(params);
59
52
  this.cache = new ScallopCache(
60
- this.suiKit,
61
- params.walletAddress,
62
- cacheOptions ?? DEFAULT_CACHE_OPTIONS,
63
- tokenBucket ??
64
- new TokenBucket(DEFAULT_TOKENS_PER_INTERVAL, DEFAULT_INTERVAL_IN_MS),
65
- queryClient
53
+ {
54
+ ...this.params,
55
+ cacheOptions,
56
+ },
57
+ {
58
+ suiKit: this.suiKit,
59
+ queryClient,
60
+ }
66
61
  );
67
62
  this.address = new ScallopAddress(
68
63
  {