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

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 (59) hide show
  1. package/dist/constants/common.d.ts +1 -1
  2. package/dist/constants/enum.d.ts +0 -1
  3. package/dist/constants/index.d.ts +0 -7
  4. package/dist/constants/pyth.d.ts +0 -2
  5. package/dist/constants/queryKeys.d.ts +3 -1
  6. package/dist/constants/tokenBucket.d.ts +1 -1
  7. package/dist/index.js +2317 -2481
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +2316 -2470
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/models/scallopPrice.d.ts +0 -0
  12. package/dist/models/scallopQuery.d.ts +25 -40
  13. package/dist/models/scallopUtils.d.ts +3 -13
  14. package/dist/queries/borrowIncentiveQuery.d.ts +2 -2
  15. package/dist/queries/coreQuery.d.ts +3 -3
  16. package/dist/queries/index.d.ts +5 -8
  17. package/dist/queries/{isolatedAssetQuery.d.ts → isolatedAsset.d.ts} +2 -2
  18. package/dist/queries/sCoinQuery.d.ts +1 -1
  19. package/dist/queries/spoolQuery.d.ts +3 -3
  20. package/dist/queries/{supplyLimitQuery.d.ts → supplyLimit.d.ts} +2 -2
  21. package/dist/types/query/index.d.ts +4 -4
  22. package/dist/types/utils.d.ts +0 -12
  23. package/dist/utils/util.d.ts +2 -2
  24. package/package.json +1 -1
  25. package/src/builders/loyaltyProgramBuilder.ts +1 -1
  26. package/src/constants/common.ts +2 -1
  27. package/src/constants/enum.ts +0 -8
  28. package/src/constants/index.ts +0 -7
  29. package/src/constants/pyth.ts +0 -19
  30. package/src/constants/queryKeys.ts +5 -1
  31. package/src/constants/tokenBucket.ts +1 -1
  32. package/src/models/scallop.ts +2 -3
  33. package/src/models/scallopAddress.ts +2 -2
  34. package/src/models/scallopBuilder.ts +3 -4
  35. package/src/models/scallopCache.ts +1 -1
  36. package/src/models/scallopClient.ts +26 -27
  37. package/src/models/scallopPrice.ts +0 -0
  38. package/src/models/scallopQuery.ts +17 -63
  39. package/src/models/scallopUtils.ts +96 -96
  40. package/src/queries/borrowIncentiveQuery.ts +13 -6
  41. package/src/queries/coreQuery.ts +23 -38
  42. package/src/queries/index.ts +5 -8
  43. package/src/queries/{isolatedAssetQuery.ts → isolatedAsset.ts} +2 -2
  44. package/src/queries/loyaltyProgramQuery.ts +1 -1
  45. package/src/queries/portfolioQuery.ts +34 -55
  46. package/src/queries/spoolQuery.ts +17 -17
  47. package/src/queries/{supplyLimitQuery.ts → supplyLimit.ts} +2 -2
  48. package/src/types/query/index.ts +4 -4
  49. package/src/types/utils.ts +0 -13
  50. package/src/utils/tokenBucket.ts +1 -2
  51. package/src/utils/util.ts +1 -2
  52. package/dist/constants/coinGecko.d.ts +0 -2
  53. package/dist/constants/poolAddress.d.ts +0 -5
  54. package/dist/constants/rpc.d.ts +0 -1
  55. package/dist/models/suiKit.d.ts +0 -2
  56. package/src/constants/coinGecko.ts +0 -18
  57. package/src/constants/poolAddress.ts +0 -94
  58. package/src/constants/rpc.ts +0 -16
  59. package/src/models/suiKit.ts +0 -11
File without changes
@@ -1,5 +1,5 @@
1
1
  import { SuiKit } 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 } from '../types';
3
3
  import { ScallopAddress } from './scallopAddress';
4
4
  import { ScallopUtils } from './scallopUtils';
5
5
  import { ScallopIndexer } from './scallopIndexer';
@@ -38,9 +38,7 @@ export declare class ScallopQuery {
38
38
  * @param indexer - Whether to use indexer.
39
39
  * @return Market data.
40
40
  */
41
- queryMarket(indexer?: boolean, args?: {
42
- coinPrices: CoinPrices;
43
- }): Promise<import("../types").Market>;
41
+ queryMarket(indexer?: boolean): Promise<import("../types").Market>;
44
42
  /**
45
43
  * Get market pools.
46
44
  *
@@ -52,23 +50,21 @@ export declare class ScallopQuery {
52
50
  * @param indexer - Whether to use indexer.
53
51
  * @return Market pools data.
54
52
  */
55
- getMarketPools(poolCoinNames?: SupportPoolCoins[], indexer?: boolean, args?: {
56
- coinPrices?: CoinPrices;
57
- }): Promise<{
58
- usdc?: MarketPool | undefined;
59
- sbeth?: MarketPool | undefined;
60
- weth?: MarketPool | undefined;
61
- wbtc?: MarketPool | undefined;
62
- wusdc?: MarketPool | undefined;
63
- wusdt?: MarketPool | undefined;
64
- sui?: MarketPool | undefined;
65
- wapt?: MarketPool | undefined;
66
- wsol?: MarketPool | undefined;
67
- cetus?: MarketPool | undefined;
68
- afsui?: MarketPool | undefined;
69
- hasui?: MarketPool | undefined;
70
- vsui?: MarketPool | undefined;
71
- sca?: MarketPool | undefined;
53
+ getMarketPools(poolCoinNames?: SupportPoolCoins[], indexer?: boolean): Promise<{
54
+ usdc?: import("../types").MarketPool | undefined;
55
+ sbeth?: import("../types").MarketPool | undefined;
56
+ weth?: import("../types").MarketPool | undefined;
57
+ wbtc?: import("../types").MarketPool | undefined;
58
+ wusdc?: import("../types").MarketPool | undefined;
59
+ wusdt?: import("../types").MarketPool | undefined;
60
+ sui?: import("../types").MarketPool | undefined;
61
+ wapt?: import("../types").MarketPool | undefined;
62
+ wsol?: import("../types").MarketPool | undefined;
63
+ cetus?: import("../types").MarketPool | undefined;
64
+ afsui?: import("../types").MarketPool | undefined;
65
+ hasui?: import("../types").MarketPool | undefined;
66
+ vsui?: import("../types").MarketPool | undefined;
67
+ sca?: import("../types").MarketPool | undefined;
72
68
  }>;
73
69
  /**
74
70
  * Get market pool
@@ -77,10 +73,7 @@ export declare class ScallopQuery {
77
73
  * @param indexer - Whether to use indexer.
78
74
  * @return Market pool data.
79
75
  */
80
- getMarketPool(poolCoinName: SupportPoolCoins, indexer?: boolean, args?: {
81
- marketObject?: SuiObjectData | null;
82
- coinPrice?: number;
83
- }): Promise<MarketPool | undefined>;
76
+ getMarketPool(poolCoinName: SupportPoolCoins, indexer?: boolean): Promise<import("../types").MarketPool | undefined>;
84
77
  /**
85
78
  * Get market collaterals.
86
79
  *
@@ -183,15 +176,12 @@ export declare class ScallopQuery {
183
176
  * @param indexer - Whether to use indexer.
184
177
  * @return Spools data.
185
178
  */
186
- getSpools(stakeMarketCoinNames?: SupportStakeMarketCoins[], indexer?: boolean, args?: {
187
- marketPools?: MarketPools;
188
- coinPrices?: CoinPrices;
189
- }): Promise<{
179
+ getSpools(stakeMarketCoinNames?: SupportStakeMarketCoins[], indexer?: boolean): Promise<{
190
180
  susdc?: import("../types").Spool | undefined;
191
181
  sweth?: import("../types").Spool | undefined;
182
+ ssui?: import("../types").Spool | undefined;
192
183
  swusdc?: import("../types").Spool | undefined;
193
184
  swusdt?: import("../types").Spool | undefined;
194
- ssui?: import("../types").Spool | undefined;
195
185
  scetus?: import("../types").Spool | undefined;
196
186
  safsui?: import("../types").Spool | undefined;
197
187
  shasui?: import("../types").Spool | undefined;
@@ -204,10 +194,7 @@ export declare class ScallopQuery {
204
194
  * @param indexer - Whether to use indexer.
205
195
  * @return Spool data.
206
196
  */
207
- getSpool(stakeMarketCoinName: SupportStakeMarketCoins, indexer?: boolean, args?: {
208
- marketPool?: MarketPool;
209
- coinPrices?: CoinPrices;
210
- }): Promise<import("../types").Spool | undefined>;
197
+ getSpool(stakeMarketCoinName: SupportStakeMarketCoins, indexer?: boolean): Promise<import("../types").Spool | undefined>;
211
198
  /**
212
199
  * Get stake accounts data for all stake pools (spools).
213
200
  *
@@ -236,9 +223,9 @@ export declare class ScallopQuery {
236
223
  getStakePools(stakeMarketCoinNames?: SupportStakeMarketCoins[]): Promise<{
237
224
  susdc?: import("../types").StakePool | undefined;
238
225
  sweth?: import("../types").StakePool | undefined;
226
+ ssui?: import("../types").StakePool | undefined;
239
227
  swusdc?: import("../types").StakePool | undefined;
240
228
  swusdt?: import("../types").StakePool | undefined;
241
- ssui?: import("../types").StakePool | undefined;
242
229
  scetus?: import("../types").StakePool | undefined;
243
230
  safsui?: import("../types").StakePool | undefined;
244
231
  shasui?: import("../types").StakePool | undefined;
@@ -268,9 +255,9 @@ export declare class ScallopQuery {
268
255
  getStakeRewardPools(stakeMarketCoinNames?: SupportStakeMarketCoins[]): Promise<{
269
256
  susdc?: import("../types").StakeRewardPool | undefined;
270
257
  sweth?: import("../types").StakeRewardPool | undefined;
258
+ ssui?: import("../types").StakeRewardPool | undefined;
271
259
  swusdc?: import("../types").StakeRewardPool | undefined;
272
260
  swusdt?: import("../types").StakeRewardPool | undefined;
273
- ssui?: import("../types").StakeRewardPool | undefined;
274
261
  scetus?: import("../types").StakeRewardPool | undefined;
275
262
  safsui?: import("../types").StakeRewardPool | undefined;
276
263
  shasui?: import("../types").StakeRewardPool | undefined;
@@ -294,9 +281,7 @@ export declare class ScallopQuery {
294
281
  * @param indexer - Whether to use indexer.
295
282
  * @return Borrow incentive pools data.
296
283
  */
297
- getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean, args?: {
298
- coinPrices: CoinPrices;
299
- }): Promise<{
284
+ getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean): Promise<{
300
285
  usdc?: import("../types").BorrowIncentivePool | undefined;
301
286
  sbeth?: import("../types").BorrowIncentivePool | undefined;
302
287
  weth?: import("../types").BorrowIncentivePool | undefined;
@@ -452,7 +437,7 @@ export declare class ScallopQuery {
452
437
  * @param ownerAddress - The owner address.
453
438
  * @return All market sCoin amounts.
454
439
  */
455
- getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca", number>>>;
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>>>;
456
441
  /**
457
442
  * Get sCoin amount.
458
443
  *
@@ -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, 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
@@ -22,6 +22,7 @@ export declare class ScallopUtils {
22
22
  address: ScallopAddress;
23
23
  cache: ScallopCache;
24
24
  walletAddress: string;
25
+ private _priceMap;
25
26
  constructor(params: ScallopUtilsParams, instance?: ScallopUtilsInstanceParams);
26
27
  isSuiBridgeAsset(coinName: any): coinName is SupportSuiBridgeCoins;
27
28
  isWormholeAsset(coinName: any): coinName is SupportWormholeCoins;
@@ -64,12 +65,6 @@ export declare class ScallopUtils {
64
65
  * @returns sCoin type
65
66
  */
66
67
  parseSCoinType(sCoinName: SupportSCoin): string;
67
- /**
68
- * Convert sCoinType into sCoin name
69
- * @param sCoinType
70
- * @returns sCoin name
71
- */
72
- parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca";
73
68
  /**
74
69
  * Convert sCoin name into its underlying coin type
75
70
  * @param sCoinName
@@ -188,7 +183,7 @@ export declare class ScallopUtils {
188
183
  * @param assetCoinNames - Specific an array of support asset coin name.
189
184
  * @return Asset coin price.
190
185
  */
191
- getCoinPrices(_?: SupportAssetCoins[]): Promise<import("../types").OptionalKeys<Record<SupportAssetCoins, number>>>;
186
+ getCoinPrices(assetCoinNames?: SupportAssetCoins[]): Promise<import("../types").OptionalKeys<Record<SupportAssetCoins, number>>>;
192
187
  /**
193
188
  * Convert apr to apy.
194
189
  *
@@ -219,9 +214,4 @@ export declare class ScallopUtils {
219
214
  * @return New unlock at in seconds timestamp.
220
215
  */
221
216
  getUnlockAt(extendLockPeriodInDay?: number, unlockAtInMillisTimestamp?: number): number;
222
- /**
223
- * Get detailed contract address and price id information for supported pool in Scallop
224
- * @returns Supported pool informations
225
- */
226
- getSupportedPoolAddresses(): PoolAddressInfo[];
227
217
  }
@@ -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 } 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) => Promise<{
18
18
  usdc?: BorrowIncentivePool | undefined;
19
19
  sbeth?: BorrowIncentivePool | undefined;
20
20
  weth?: BorrowIncentivePool | undefined;
@@ -1,7 +1,7 @@
1
1
  import type { SuiObjectData } from '@mysten/sui/client';
2
2
  import type { SuiObjectArg } from '@scallop-io/sui-kit';
3
3
  import type { ScallopAddress, ScallopCache, ScallopQuery } from '../models';
4
- import { Market, MarketPool, MarketCollateral, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, ObligationQueryInterface, Obligation, SupportMarketCoins, OptionalKeys, CoinPrices } from '../types';
4
+ import { Market, MarketPool, MarketCollateral, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, ObligationQueryInterface, Obligation, SupportMarketCoins, OptionalKeys } from '../types';
5
5
  /**
6
6
  * Query market data.
7
7
  *
@@ -12,7 +12,7 @@ import { Market, MarketPool, MarketCollateral, SupportAssetCoins, SupportPoolCoi
12
12
  * @param indexer - Whether to use indexer.
13
13
  * @return Market data.
14
14
  */
15
- export declare const queryMarket: (query: ScallopQuery, indexer?: boolean, coinPrices?: CoinPrices) => Promise<Market>;
15
+ export declare const queryMarket: (query: ScallopQuery, indexer?: boolean) => Promise<Market>;
16
16
  /**
17
17
  * Get coin market pools data.
18
18
  *
@@ -25,7 +25,7 @@ export declare const queryMarket: (query: ScallopQuery, indexer?: boolean, coinP
25
25
  * @param indexer - Whether to use indexer.
26
26
  * @return Market pools data.
27
27
  */
28
- export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], indexer?: boolean, coinPrices?: CoinPrices) => Promise<{
28
+ export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], indexer?: boolean) => Promise<{
29
29
  usdc?: MarketPool | undefined;
30
30
  sbeth?: MarketPool | undefined;
31
31
  weth?: MarketPool | undefined;
@@ -1,11 +1,8 @@
1
- export * from './borrowIncentiveQuery';
2
1
  export * from './coreQuery';
3
- export * from './isolatedAssetQuery';
4
- export * from './loyaltyProgramQuery';
5
- export * from './portfolioQuery';
6
- export * from './priceQuery';
7
- export * from './referralQuery';
8
- export * from './sCoinQuery';
9
2
  export * from './spoolQuery';
10
- export * from './supplyLimitQuery';
3
+ export * from './borrowIncentiveQuery';
4
+ export * from './priceQuery';
5
+ export * from './portfolioQuery';
11
6
  export * from './vescaQuery';
7
+ export * from './referralQuery';
8
+ export * from './loyaltyProgramQuery';
@@ -1,5 +1,5 @@
1
- import { ScallopAddress, ScallopUtils } from '../models';
2
- import { SupportPoolCoins } from '../types';
1
+ import { ScallopAddress, ScallopUtils } from 'src/models';
2
+ import { SupportPoolCoins } from 'src/types';
3
3
  /**
4
4
  * Return list of isolated assets coin types
5
5
  * @param utils ScallopUtils
@@ -19,7 +19,7 @@ export declare const getSCoinTotalSupply: ({ utils, }: {
19
19
  */
20
20
  export declare const getSCoinAmounts: ({ utils, }: {
21
21
  utils: ScallopUtils;
22
- }, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca", number>>>;
22
+ }, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "sweth" | "ssui" | "swusdc" | "swusdt" | "scetus" | "safsui" | "shasui" | "svsui" | "ssbeth" | "ssca" | "swsol" | "swbtc", number>>>;
23
23
  /**
24
24
  * Query owned sCoin amount.
25
25
  *
@@ -1,5 +1,5 @@
1
1
  import type { ScallopQuery, ScallopUtils } from '../models';
2
- import type { MarketPool, Spool, StakePool, StakeRewardPool, StakeAccounts, SupportStakeMarketCoins, CoinPrices, MarketPools } from '../types';
2
+ import type { MarketPool, Spool, StakePool, StakeRewardPool, StakeAccounts, SupportStakeMarketCoins, CoinPrices } from '../types';
3
3
  /**
4
4
  * Get spools data.
5
5
  *
@@ -8,12 +8,12 @@ import type { MarketPool, Spool, StakePool, StakeRewardPool, StakeAccounts, Supp
8
8
  * @param indexer - Whether to use indexer.
9
9
  * @return Spools data.
10
10
  */
11
- export declare const getSpools: (query: ScallopQuery, stakeMarketCoinNames?: SupportStakeMarketCoins[], indexer?: boolean, marketPools?: MarketPools, coinPrices?: CoinPrices) => Promise<{
11
+ export declare const getSpools: (query: ScallopQuery, stakeMarketCoinNames?: SupportStakeMarketCoins[], indexer?: boolean) => Promise<{
12
12
  susdc?: Spool | undefined;
13
13
  sweth?: Spool | undefined;
14
+ ssui?: Spool | undefined;
14
15
  swusdc?: Spool | undefined;
15
16
  swusdt?: Spool | undefined;
16
- ssui?: Spool | undefined;
17
17
  scetus?: Spool | undefined;
18
18
  safsui?: Spool | undefined;
19
19
  shasui?: Spool | undefined;
@@ -1,5 +1,5 @@
1
- import { ScallopUtils } from '../models';
2
- import { SupportPoolCoins } from '../types';
1
+ import { ScallopUtils } from 'src/models';
2
+ import { SupportPoolCoins } from 'src/types';
3
3
  /**
4
4
  * Return supply limit of a pool (including the decimals)
5
5
  * @param utils
@@ -1,7 +1,7 @@
1
- export type * from './borrowIncentive';
2
1
  export type * from './core';
3
- export type * from './loyaltyProgram';
4
- export type * from './portfolio';
5
- export type * from './sCoin';
6
2
  export type * from './spool';
3
+ export type * from './borrowIncentive';
4
+ export type * from './portfolio';
7
5
  export type * from './vesca';
6
+ export type * from './loyaltyProgram';
7
+ export type * from './sCoin';
@@ -7,15 +7,3 @@ export type PriceMap = Map<SupportAssetCoins, {
7
7
  price: number;
8
8
  publishTime: number;
9
9
  }>;
10
- export type PoolAddressInfo = {
11
- name: string;
12
- coingeckoId: string;
13
- decimal: number;
14
- pythFeedId: string;
15
- lendingPoolAddress: string;
16
- collateralPoolAddress: string;
17
- sCoinAddress: string | undefined;
18
- marketCoinAddress: string;
19
- coinAddress: string;
20
- sCoinName: string | undefined;
21
- };
@@ -1,7 +1,7 @@
1
1
  import type { PriceFeed } from '@pythnetwork/pyth-sui-js';
2
2
  import type { ScallopAddress } from '../models';
3
- import type { SupportAssetCoins, SupportCoins, SupportMarketCoins, SupportSCoin, SupportSuiBridgeCoins, SupportWormholeCoins } from '../types';
4
- export declare const isMarketCoin: (coinName: SupportCoins) => coinName is SupportMarketCoins | SupportSCoin;
3
+ import type { SupportAssetCoins, SupportCoins, SupportMarketCoins, SupportSuiBridgeCoins, SupportWormholeCoins } from '../types';
4
+ export declare const isMarketCoin: (coinName: SupportCoins) => coinName is SupportMarketCoins;
5
5
  export declare const isSuiBridgeAsset: (coinName: any) => coinName is SupportSuiBridgeCoins;
6
6
  export declare const isWormholeAsset: (coinName: any) => coinName is SupportWormholeCoins;
7
7
  export declare const parseAssetSymbol: (coinName: SupportCoins) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "1.3.4-alpha.7",
3
+ "version": "1.3.4-hotfix",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -38,7 +38,7 @@ const generateLoyaltyProgramQuickMethod: GenerateLoyaltyProgramQuickMethod = ({
38
38
  }) => {
39
39
  return {
40
40
  claimLoyaltyRevenueQuick: async (veScaKey) => {
41
- veScaKey = veScaKey ?? (await builder.query.getVeScas())[0]?.keyObject;
41
+ veScaKey = veScaKey || (await builder.query.getVeScas())[0]?.keyObject;
42
42
  const sender = requireSender(txBlock);
43
43
  if (!veScaKey) throw new Error(`No veScaKey found for user ${sender}`);
44
44
 
@@ -1,3 +1,4 @@
1
+ // export const API_BASE_URL = 'https://sui.api.scallop.io';
1
2
  export const API_BASE_URL = 'https://sui.apis.scallop.io' as const;
2
3
  export const SDK_API_BASE_URL = 'https://sdk.api.scallop.io' as const;
3
4
 
@@ -7,7 +8,7 @@ export const USE_TEST_ADDRESS: boolean = false;
7
8
  export const ADDRESSES_ID =
8
9
  IS_VE_SCA_TEST || USE_TEST_ADDRESS
9
10
  ? ('65fb07c39c845425d71d7b18' as const)
10
- : ('66f8e7ed9bb9e07fdfb86bbb' as const);
11
+ : ('675c65cd301dd817ea262e76' as const);
11
12
  // : ('664dfe22898c36c159e28bc8' as const);
12
13
 
13
14
  export const PROTOCOL_OBJECT_ID = IS_VE_SCA_TEST
@@ -183,14 +183,6 @@ export const sCoinIds: types.SCoinIds = {
183
183
  '0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC',
184
184
  } as const;
185
185
 
186
- export const sCoinTypeToName = Object.entries(sCoinIds).reduce(
187
- (acc, [coinName, coinType]) => {
188
- acc[coinType] = coinName as types.SupportSCoin;
189
- return acc;
190
- },
191
- {} as Record<string, types.SupportSCoin>
192
- );
193
-
194
186
  // TEST VERSION
195
187
  // export const sCoinIds: types.SCoinIds = {
196
188
  // ssui: '0xfac769100bccc0caebcf4f4e2d00ac2f8883f07f724be28940df90605f5e7e9a::scallop_sui::SCALLOP_SUI',
@@ -1,12 +1,5 @@
1
- export * from './cache';
2
- export * from './coinGecko';
3
1
  export * from './common';
4
2
  export * from './enum';
5
3
  export * from './flashloan';
6
- export * from './poolAddress';
7
- export * from './pyth';
8
4
  export * from './queryKeys';
9
- export * from './rpc';
10
- export * from './testAddress';
11
- export * from './tokenBucket';
12
5
  export * from './vesca';
@@ -1,25 +1,6 @@
1
- import { SupportPoolCoins } from 'src/types';
2
-
3
1
  export const PYTH_ENDPOINTS: {
4
2
  [k in 'mainnet' | 'testnet']: string[];
5
3
  } = {
6
4
  testnet: ['https://hermes-beta.pyth.network'],
7
5
  mainnet: ['https://hermes.pyth.network', 'https://scallop.rpc.p2p.world'],
8
6
  };
9
-
10
- export const PYTH_FEED_IDS: Record<SupportPoolCoins, string> = {
11
- usdc: 'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
12
- sbeth: 'ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace',
13
- weth: 'ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace',
14
- wbtc: 'e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43',
15
- wusdc: 'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
16
- wusdt: '2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b',
17
- sui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
18
- wapt: '03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5',
19
- wsol: 'ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d',
20
- cetus: 'e5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef',
21
- afsui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
22
- hasui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
23
- vsui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
24
- sca: '7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc',
25
- };
@@ -99,6 +99,10 @@ export const queryKeys = {
99
99
  ],
100
100
  },
101
101
  oracle: {
102
- getPythLatestPriceFeeds: () => ['oracle', 'getPythPriceIds'],
102
+ getPythLatestPriceFeed: (pythPriceId?: string) => [
103
+ 'oracle',
104
+ 'getPythPriceId',
105
+ { pythPriceId },
106
+ ],
103
107
  },
104
108
  };
@@ -1,2 +1,2 @@
1
- export const DEFAULT_TOKENS_PER_INTERVAL = 10;
1
+ export const DEFAULT_TOKENS_PER_INTERVAL = 50;
2
2
  export const DEFAULT_INTERVAL_IN_MS = 300;
@@ -22,7 +22,6 @@ import {
22
22
  DEFAULT_TOKENS_PER_INTERVAL,
23
23
  } from 'src/constants/tokenBucket';
24
24
  import type { QueryClient } from '@tanstack/query-core';
25
- import { newSuiKit } from './suiKit';
26
25
 
27
26
  /**
28
27
  * @argument params - The parameters for the Scallop instance.
@@ -55,7 +54,7 @@ export class Scallop {
55
54
  queryClient?: QueryClient
56
55
  ) {
57
56
  this.params = params;
58
- this.suiKit = newSuiKit(params);
57
+ this.suiKit = new SuiKit(params);
59
58
  this.cache = new ScallopCache(
60
59
  this.suiKit,
61
60
  params.walletAddress,
@@ -66,7 +65,7 @@ export class Scallop {
66
65
  );
67
66
  this.address = new ScallopAddress(
68
67
  {
69
- id: params?.addressesId ?? ADDRESSES_ID,
68
+ id: params?.addressesId || ADDRESSES_ID,
70
69
  network: params?.networkType,
71
70
  forceInterface: params?.forceAddressesInterface,
72
71
  },
@@ -393,11 +393,11 @@ export class ScallopAddress {
393
393
  'Content-Type': 'application/json',
394
394
  Accept: 'application/json',
395
395
  },
396
- timeout: 8000,
396
+ timeout: 30000,
397
397
  });
398
398
  if (auth) this._auth = auth;
399
399
  this._id = id;
400
- this._network = network ?? 'mainnet';
400
+ this._network = network || 'mainnet';
401
401
  this._addressesMap = USE_TEST_ADDRESS
402
402
  ? new Map([['mainnet', TEST_ADDRESSES]])
403
403
  : new Map();
@@ -19,7 +19,6 @@ import type {
19
19
  } from '../types';
20
20
  import { ScallopCache } from './scallopCache';
21
21
  import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
22
- import { newSuiKit } from './suiKit';
23
22
 
24
23
  /**
25
24
  * @description
@@ -47,11 +46,11 @@ export class ScallopBuilder {
47
46
  params: ScallopBuilderParams,
48
47
  instance?: ScallopBuilderInstanceParams
49
48
  ) {
50
- this.suiKit = instance?.suiKit ?? newSuiKit(params);
49
+ this.suiKit = instance?.suiKit ?? new SuiKit(params);
51
50
 
52
51
  this.params = params;
53
52
  this.walletAddress = normalizeSuiAddress(
54
- params?.walletAddress ?? this.suiKit.currentAddress()
53
+ params?.walletAddress || this.suiKit.currentAddress()
55
54
  );
56
55
 
57
56
  if (instance?.query) {
@@ -67,7 +66,7 @@ export class ScallopBuilder {
67
66
  );
68
67
  this.address = new ScallopAddress(
69
68
  {
70
- id: params?.addressesId ?? ADDRESSES_ID,
69
+ id: params?.addressesId || ADDRESSES_ID,
71
70
  network: params?.networkType,
72
71
  forceInterface: params?.forceAddressesInterface,
73
72
  },
@@ -255,7 +255,7 @@ export class ScallopCache {
255
255
  if (!input.coinType) return '0';
256
256
 
257
257
  return (
258
- ((await this.queryGetAllCoinBalances(input.owner)) ?? {})[
258
+ ((await this.queryGetAllCoinBalances(input.owner)) || {})[
259
259
  normalizeStructTag(input.coinType)
260
260
  ] ?? '0'
261
261
  );