@scallop-io/sui-scallop-sdk 2.3.0-lst-x-oracle-alpha.4 → 2.3.0-lst-x-oracle-alpha.6

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 (67) hide show
  1. package/dist/index.d.mts +2869 -11
  2. package/dist/index.d.ts +2869 -11
  3. package/dist/index.js +2 -2
  4. package/dist/index.mjs +2 -1
  5. package/package.json +6 -35
  6. package/src/builders/borrowIncentiveBuilder.ts +2 -2
  7. package/src/builders/coreBuilder.ts +2 -2
  8. package/src/builders/loyaltyProgramBuilder.ts +2 -2
  9. package/src/builders/oracles/index.ts +1 -1
  10. package/src/builders/oracles/oraclePackageRegistry.ts +2 -3
  11. package/src/builders/oracles/priceFeedUpdater.ts +1 -1
  12. package/src/builders/oracles/xOracleUpdateStrategy.ts +1 -1
  13. package/src/builders/oracles/xOracleUpdater.ts +1 -1
  14. package/src/builders/referralBuilder.ts +2 -2
  15. package/src/builders/sCoinBuilder.ts +2 -2
  16. package/src/builders/spoolBuilder.ts +2 -2
  17. package/src/builders/vescaBuilder.ts +3 -3
  18. package/src/constants/index.ts +0 -1
  19. package/src/constants/testAddress.ts +2 -2
  20. package/src/index.ts +12 -3
  21. package/src/models/scallop.ts +1 -1
  22. package/src/models/scallopAddress.ts +1 -1
  23. package/src/models/scallopBuilder.ts +1 -1
  24. package/src/models/scallopClient.ts +1 -1
  25. package/src/models/scallopConstants.ts +1 -1
  26. package/src/models/scallopQuery.ts +2 -2
  27. package/src/models/scallopUtils.ts +2 -2
  28. package/src/models/utils.ts +97 -0
  29. package/src/queries/borrowIncentiveQuery.ts +2 -2
  30. package/src/queries/coreQuery.ts +2 -2
  31. package/src/queries/loyaltyProgramQuery.ts +1 -1
  32. package/src/queries/poolAddressesQuery.ts +3 -1
  33. package/src/queries/portfolioQuery.ts +2 -2
  34. package/src/queries/priceQuery.ts +3 -2
  35. package/src/queries/sCoinQuery.ts +1 -1
  36. package/src/queries/spoolQuery.ts +5 -5
  37. package/src/{utils/query.ts → queries/utils.ts} +19 -1
  38. package/src/queries/vescaQuery.ts +1 -1
  39. package/src/queries/xOracleQuery.ts +1 -1
  40. package/src/types/builder/index.ts +1 -26
  41. package/src/types/builder/type.ts +25 -0
  42. package/src/types/constant/package.ts +15 -2
  43. package/dist/address-CW2IpaLn.d.ts +0 -165
  44. package/dist/chunk-E3URAUAC.js +0 -25
  45. package/dist/chunk-YA77R5GT.mjs +0 -5
  46. package/dist/constants/index.d.mts +0 -262
  47. package/dist/constants/index.d.ts +0 -262
  48. package/dist/constants/index.js +0 -86
  49. package/dist/constants/index.mjs +0 -5
  50. package/dist/models/index.d.mts +0 -393
  51. package/dist/models/index.d.ts +0 -393
  52. package/dist/models/index.js +0 -34
  53. package/dist/models/index.mjs +0 -16
  54. package/dist/queryKeys-AaZqDYle.d.ts +0 -43
  55. package/dist/scallopUtils-BZLZd2z8.d.ts +0 -2404
  56. package/dist/types/index.d.mts +0 -9
  57. package/dist/types/index.d.ts +0 -9
  58. package/dist/types/index.js +0 -2
  59. package/dist/types/index.mjs +0 -1
  60. package/src/constants/package.ts +0 -14
  61. package/src/types/index.ts +0 -5
  62. package/src/utils/core.ts +0 -18
  63. package/src/utils/index.ts +0 -5
  64. package/src/utils/indexer.ts +0 -47
  65. package/src/utils/util.ts +0 -42
  66. /package/src/{utils/builder.ts → builders/utils.ts} +0 -0
  67. /package/src/types/{utils.ts → util.ts} +0 -0
@@ -8,8 +8,8 @@ import {
8
8
  ScallopTxBlock,
9
9
  SuiTxBlockWithSCoinNormalMethods,
10
10
  sCoinPkgIds,
11
- } from 'src/types';
12
- import { requireSender } from 'src/utils';
11
+ } from 'src/types/builder';
12
+ import { requireSender } from './utils';
13
13
 
14
14
  const generateSCoinNormalMethod: GenerateSCoinNormalMethod = ({
15
15
  builder,
@@ -2,7 +2,7 @@ import { Transaction } from '@mysten/sui/transactions';
2
2
  import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils';
3
3
  import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
4
4
  import { getStakeAccounts } from '../queries/spoolQuery';
5
- import { requireSender } from '../utils';
5
+ import { requireSender } from './utils';
6
6
  import type { SuiAddressArg } from '@scallop-io/sui-kit';
7
7
  import type { TransactionResult } from '@mysten/sui/transactions';
8
8
  import type { ScallopBuilder } from 'src/models';
@@ -14,7 +14,7 @@ import type {
14
14
  SpoolTxBlock,
15
15
  ScallopTxBlock,
16
16
  SuiTxBlockWithSCoin,
17
- } from 'src/types';
17
+ } from 'src/types/builder';
18
18
 
19
19
  /**
20
20
  * Check and get stake account id from transaction block.
@@ -14,21 +14,21 @@ import {
14
14
  checkExtendLockAmount,
15
15
  checkRenewExpiredVeSca,
16
16
  checkVesca,
17
- } from 'src/utils';
17
+ } from './utils';
18
18
  import type {
19
19
  TransactionObjectArgument,
20
20
  SuiObjectArg,
21
21
  } from '@scallop-io/sui-kit';
22
22
  import type {
23
- AddressesInterface,
24
23
  GenerateVeScaNormalMethod,
25
24
  GenerateVeScaQuickMethod,
26
25
  QuickMethodReturnType,
27
26
  ScallopTxBlock,
28
27
  SuiTxBlockWithVeScaNormalMethods,
29
28
  VeScaTxBlock,
30
- } from 'src/types';
29
+ } from 'src/types/builder';
31
30
  import { SuiObjectData } from '@mysten/sui/client';
31
+ import { AddressesInterface } from 'src/types/address';
32
32
 
33
33
  /**
34
34
  * Check and get veSCA data from transaction block.
@@ -1,7 +1,6 @@
1
1
  export * from './api';
2
2
  export * from './cache';
3
3
  export * from './common';
4
- export * from './package';
5
4
  export * from './queryKeys';
6
5
  export * from './rpc';
7
6
  export * from './testAddress';
@@ -449,7 +449,7 @@ export const TEST_ADDRESSES: AddressesInterface = {
449
449
  },
450
450
  };
451
451
 
452
- export const WHITELIST = {
452
+ export const TEST_WHITELIST = {
453
453
  lending: new Set([
454
454
  'usdc',
455
455
  // 'sbeth',
@@ -584,7 +584,7 @@ export const WHITELIST = {
584
584
  emerging: new Set(['wal', 'deep', 'sca', 'cetus']),
585
585
  };
586
586
 
587
- export const POOL_ADDRESSES = {
587
+ export const TEST_POOL_ADDRESSES = {
588
588
  usdc: {
589
589
  coinName: 'usdc',
590
590
  symbol: 'USDC',
package/src/index.ts CHANGED
@@ -1,3 +1,12 @@
1
- export type * from './constants';
2
- export type * from './models';
3
- export type * from './types';
1
+ export * from './constants';
2
+ export {
3
+ Scallop,
4
+ ScallopConstants,
5
+ ScallopAddress,
6
+ ScallopBuilder,
7
+ ScallopQuery,
8
+ ScallopSuiKit,
9
+ ScallopClient,
10
+ ScallopIndexer,
11
+ ScallopUtils,
12
+ } from './models';
@@ -18,7 +18,7 @@ import ScallopClient, { ScallopClientParams } from './scallopClient';
18
18
  * ```
19
19
  */
20
20
 
21
- export type ScallopParams = {
21
+ type ScallopParams = {
22
22
  client?: ScallopClient;
23
23
  } & ScallopClientParams;
24
24
  class Scallop {
@@ -5,7 +5,7 @@ import { AddressesInterface, AddressStringPath } from 'src/types/address';
5
5
  import ScallopAxios, { ScallopAxiosParams } from './scallopAxios';
6
6
  import { QueryKey } from '@tanstack/query-core';
7
7
  import { AxiosRequestConfig } from 'axios';
8
- import { parseUrl } from 'src/utils';
8
+ import { parseUrl } from './utils';
9
9
 
10
10
  export type ScallopAddressParams = {
11
11
  addressId?: string;
@@ -12,7 +12,7 @@ import type {
12
12
  SuiTxArg,
13
13
  SuiVecTxArg,
14
14
  } from '@scallop-io/sui-kit';
15
- import type { ScallopTxBlock, SelectCoinReturnType } from 'src/types';
15
+ import type { ScallopTxBlock, SelectCoinReturnType } from 'src/types/builder';
16
16
  import { ScallopBuilderInterface } from './interface';
17
17
 
18
18
  export type ScallopBuilderParams = {
@@ -5,7 +5,7 @@ import type {
5
5
  TransactionObjectArgument,
6
6
  TransactionResult,
7
7
  } from '@mysten/sui/transactions';
8
- import { requireSender } from 'src/utils';
8
+ import { requireSender } from './utils';
9
9
  import type { NetworkType, SuiObjectArg } from '@scallop-io/sui-kit';
10
10
  import { ScallopClientInterface } from './interface';
11
11
  import { ScallopTxBlock } from 'src/types/builder';
@@ -2,7 +2,7 @@ import { PoolAddress, Whitelist } from 'src/types/constant';
2
2
  import ScallopAddress, { ScallopAddressParams } from './scallopAddress';
3
3
  import { NetworkType, parseStructTag } from '@scallop-io/sui-kit';
4
4
  import { queryKeys } from 'src/constants/queryKeys';
5
- import { parseUrl } from 'src/utils';
5
+ import { parseUrl } from './utils';
6
6
 
7
7
  const isEmptyObject = (obj: object) => {
8
8
  return Object.keys(obj).length === 0;
@@ -1,6 +1,6 @@
1
1
  import ScallopUtils, { ScallopUtilsParams } from './scallopUtils';
2
2
  import ScallopIndexer, { ScallopIndexerParams } from './scallopIndexer';
3
- import { withIndexerFallback } from 'src/utils';
3
+ import { withIndexerFallback } from './utils';
4
4
  import {
5
5
  MarketCollaterals,
6
6
  MarketPool,
@@ -76,7 +76,7 @@ import {
76
76
  getPriceUpdatePolicies,
77
77
  getAssetOracles,
78
78
  } from 'src/queries/xOracleQuery';
79
- import { CoinPrices } from 'src/types/utils';
79
+ import { CoinPrices } from 'src/types/util';
80
80
  import { SupportOracleType, xOracleRules } from 'src/types/constant';
81
81
 
82
82
  export type ScallopQueryParams = {
@@ -7,7 +7,7 @@ import {
7
7
  Transaction,
8
8
  } from '@scallop-io/sui-kit';
9
9
  import ScallopConstants, { ScallopConstantsParams } from './scallopConstants';
10
- import { findClosestUnlockRound } from 'src/utils';
10
+ import { findClosestUnlockRound } from './utils';
11
11
  import { PriceFeed, SuiPriceServiceConnection } from '@pythnetwork/pyth-sui-js';
12
12
  import ScallopSuiKit, { ScallopSuiKitParams } from './scallopSuiKit';
13
13
  import { SuiObjectData } from '@mysten/sui/dist/cjs/client';
@@ -16,7 +16,7 @@ import { ScallopUtilsInterface } from './interface';
16
16
  import { MAX_LOCK_DURATION, UNLOCK_ROUND_DURATION } from 'src/constants/vesca';
17
17
  import { queryKeys } from 'src/constants/queryKeys';
18
18
  import { CoinWrappedType, PoolAddress } from 'src/types/constant';
19
- import { CoinPrices } from 'src/types/utils';
19
+ import { CoinPrices } from 'src/types/util';
20
20
 
21
21
  export type ScallopUtilsParams = {
22
22
  pythEndpoints?: string[];
@@ -0,0 +1,97 @@
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 async function callMethodWithIndexerFallback(
10
+ method: Function,
11
+ context: any,
12
+ ...args: any[]
13
+ ) {
14
+ const lastArgs = args[args.length - 1]; // Assume last argument is always `indexer`
15
+
16
+ if (typeof lastArgs === 'object' && lastArgs.indexer) {
17
+ try {
18
+ return await method.apply(context, args);
19
+ } catch (e: any) {
20
+ console.warn(
21
+ `Indexer requests failed: ${e.message}. Retrying without indexer..`
22
+ );
23
+ return await method.apply(context, [
24
+ ...args.slice(0, -1),
25
+ {
26
+ ...lastArgs,
27
+ indexer: false,
28
+ },
29
+ ]);
30
+ }
31
+ }
32
+ return await method.apply(context, args);
33
+ }
34
+
35
+ /**
36
+ * This function creates a wrapper for methods that have an indexer parameter.
37
+ * It ensures fallback behavior if indexer fails.
38
+ *
39
+ * @param method - The method to wrap.
40
+ * @returns A function that applies indexer fallback.
41
+ */
42
+ export function withIndexerFallback(method: Function) {
43
+ return (...args: any[]) => {
44
+ // @ts-ignore
45
+ return callMethodWithIndexerFallback(method, this, ...args); // Preserve `this` with arrow function
46
+ };
47
+ }
48
+
49
+ import { SuiTxBlock } from '@scallop-io/sui-kit';
50
+ import { MAX_LOCK_DURATION } from 'src/constants/vesca';
51
+ // import { ScallopConstants } from 'src/models/scallopConstants';
52
+
53
+ /**
54
+ * Find the closest unlock round timestamp (12AM) to the given unlock at timestamp in seconds.
55
+ *
56
+ * @param unlockAtInSecondTimestamp - Unlock at in seconds timestamp to find the closest round.
57
+ * @returns Closest round (12AM) in seconds timestamp.
58
+ */
59
+ export const findClosestUnlockRound = (unlockAtInSecondTimestamp: number) => {
60
+ const unlockDate = new Date(unlockAtInSecondTimestamp * 1000);
61
+ const closestTwelveAM = new Date(unlockAtInSecondTimestamp * 1000);
62
+
63
+ closestTwelveAM.setUTCHours(0, 0, 0, 0); // Set the time to the next 12 AM UTC
64
+
65
+ // If the current time is past 12 AM, set the date to the next day
66
+ if (unlockDate.getUTCHours() >= 0) {
67
+ closestTwelveAM.setUTCDate(closestTwelveAM.getUTCDate() + 1);
68
+ }
69
+
70
+ const now = new Date().getTime();
71
+ // check if unlock period > 4 years
72
+ if (closestTwelveAM.getTime() - now > MAX_LOCK_DURATION * 1000) {
73
+ closestTwelveAM.setUTCDate(closestTwelveAM.getUTCDate() - 1);
74
+ }
75
+ return Math.floor(closestTwelveAM.getTime() / 1000);
76
+ };
77
+
78
+ export const parseUrl = (url: string) => {
79
+ if (url.endsWith('/')) {
80
+ url = url.slice(0, -1);
81
+ }
82
+ return url;
83
+ };
84
+
85
+ /**
86
+ * Check and get the sender from the transaction block.
87
+ *
88
+ * @param txBlock - TxBlock created by SuiKit.
89
+ * @return Sender of transaction.
90
+ */
91
+ export const requireSender = (txBlock: SuiTxBlock) => {
92
+ const sender = txBlock.blockData.sender;
93
+ if (!sender) {
94
+ throw new Error('Sender is required');
95
+ }
96
+ return sender;
97
+ };
@@ -3,7 +3,7 @@ import {
3
3
  parseOriginBorrowIncentivePoolData,
4
4
  parseOriginBorrowIncentiveAccountData,
5
5
  calculateBorrowIncentivePoolPointData,
6
- } from 'src/utils';
6
+ } from './utils';
7
7
  import type {
8
8
  ScallopAddress,
9
9
  ScallopQuery,
@@ -20,7 +20,7 @@ import type {
20
20
  } from 'src/types/query';
21
21
  import BigNumber from 'bignumber.js';
22
22
  import { SuiObjectRef } from '@mysten/sui/client';
23
- import { CoinPrices, OptionalKeys } from 'src/types/utils';
23
+ import { CoinPrices, OptionalKeys } from 'src/types/util';
24
24
 
25
25
  /**
26
26
  * Query borrow incentive pools data using moveCall
@@ -5,7 +5,7 @@ import {
5
5
  parseOriginMarketCollateralData,
6
6
  calculateMarketCollateralData,
7
7
  parseObjectAs,
8
- } from 'src/utils';
8
+ } from './utils';
9
9
  import type {
10
10
  SuiObjectResponse,
11
11
  SuiObjectData,
@@ -43,7 +43,7 @@ import {
43
43
  ScallopIndexer,
44
44
  ScallopAddress,
45
45
  } from 'src/models';
46
- import { CoinPrices, OptionalKeys } from 'src/types';
46
+ import { CoinPrices, OptionalKeys } from 'src/types/util';
47
47
 
48
48
  /**
49
49
  * Query market data.
@@ -2,7 +2,7 @@ import { SuiObjectData } from '@mysten/sui/client';
2
2
  import BigNumber from 'bignumber.js';
3
3
  import { MAX_LOCK_DURATION } from 'src/constants/vesca';
4
4
  import { ScallopQuery } from 'src/models';
5
- import { LoyaltyProgramInfo, VeScaLoyaltyProgramInfo } from 'src/types';
5
+ import { LoyaltyProgramInfo, VeScaLoyaltyProgramInfo } from 'src/types/query';
6
6
  import { z as zod } from 'zod';
7
7
 
8
8
  const rewardPoolFieldsZod = zod
@@ -1,5 +1,7 @@
1
1
  import { getFullnodeUrl, SuiClient, SuiParsedData } from '@mysten/sui/client';
2
- import { AddressesInterface, OptionalKeys, PoolAddress } from 'src/types';
2
+ import { AddressesInterface } from 'src/types/address';
3
+ import { PoolAddress } from 'src/types/constant';
4
+ import { OptionalKeys } from 'src/types/util';
3
5
 
4
6
  const RPC_PROVIDERS = [
5
7
  getFullnodeUrl('mainnet'),
@@ -1,5 +1,5 @@
1
1
  import BigNumber from 'bignumber.js';
2
- import { minBigNumber, estimatedFactor } from 'src/utils';
2
+ import { minBigNumber, estimatedFactor } from './utils';
3
3
  import type { ScallopQuery } from 'src/models';
4
4
  import { SuiObjectRef } from '@mysten/sui/client';
5
5
  import { normalizeStructTag, SUI_TYPE_ARG } from '@scallop-io/sui-kit';
@@ -18,7 +18,7 @@ import {
18
18
  StakeAccount,
19
19
  TotalValueLocked,
20
20
  } from 'src/types/query';
21
- import { CoinPrices } from 'src/types/utils';
21
+ import { CoinPrices } from 'src/types/util';
22
22
 
23
23
  /**
24
24
  * Get user lending infomation for specific pools.
@@ -1,6 +1,7 @@
1
1
  import { SuiObjectData } from '@mysten/sui/client';
2
2
  import type { ScallopAddress, ScallopQuery, ScallopSuiKit } from 'src/models';
3
- import type { CoinPrices, MarketPools, OptionalKeys } from '../types';
3
+ import type { MarketPools } from 'src/types/query';
4
+ import type { CoinPrices } from 'src/types/util';
4
5
  import BigNumber from 'bignumber.js';
5
6
 
6
7
  /**
@@ -150,7 +151,7 @@ export const getAllCoinPrices = async (
150
151
  throw new Error(`Failed to fetch market pool for getAllCoinPrices`);
151
152
  }
152
153
 
153
- const sCoinPrices: OptionalKeys<Record<string, number>> = {};
154
+ const sCoinPrices: CoinPrices = {};
154
155
  query.constants.whitelist.scoin.forEach((sCoinName) => {
155
156
  const coinName = query.utils.parseCoinName(sCoinName);
156
157
  sCoinPrices[sCoinName] = BigNumber(coinPrices[coinName] ?? 0)
@@ -2,7 +2,7 @@ import { bcs } from '@mysten/sui/bcs';
2
2
  import assert from 'assert';
3
3
  import BigNumber from 'bignumber.js';
4
4
  import { ScallopQuery, ScallopUtils } from 'src/models';
5
- import { OptionalKeys } from 'src/types';
5
+ import { OptionalKeys } from 'src/types/util';
6
6
 
7
7
  /**
8
8
  * Get total supply of sCoin
@@ -5,10 +5,9 @@ import {
5
5
  parseOriginSpoolRewardPoolData,
6
6
  calculateSpoolRewardPoolData,
7
7
  parseObjectAs,
8
- } from 'src/utils';
8
+ } from './utils';
9
9
  import type { SuiObjectData, SuiObjectResponse } from '@mysten/sui/client';
10
10
  import type { ScallopQuery, ScallopUtils } from 'src/models';
11
- import { CoinPrices } from 'src/types';
12
11
  import {
13
12
  OriginSpoolData,
14
13
  OriginSpoolRewardPoolData,
@@ -20,6 +19,7 @@ import {
20
19
  StakePool,
21
20
  StakeRewardPool,
22
21
  } from 'src/types/query';
22
+ import { CoinPrices } from 'src/types/util';
23
23
 
24
24
  const queryRequiredSpoolObjects = async (
25
25
  query: ScallopQuery,
@@ -164,11 +164,11 @@ export const getSpools = async (
164
164
  if (!stakeMarketCoinNames.includes(spool.marketCoinName)) return;
165
165
  const coinName = query.utils.parseCoinName(spool.marketCoinName);
166
166
  const rewardCoinName = query.utils.getSpoolRewardCoinName();
167
- spool.coinPrice = coinPrices[coinName] ?? spool.coinPrice;
167
+ spool.coinPrice = coinPrices?.[coinName] ?? spool.coinPrice;
168
168
  spool.marketCoinPrice =
169
- coinPrices[spool.marketCoinName] ?? spool.marketCoinPrice;
169
+ coinPrices?.[spool.marketCoinName] ?? spool.marketCoinPrice;
170
170
  spool.rewardCoinPrice =
171
- coinPrices[rewardCoinName] ?? spool.rewardCoinPrice;
171
+ coinPrices?.[rewardCoinName] ?? spool.rewardCoinPrice;
172
172
  spools[spool.marketCoinName] = spool;
173
173
  };
174
174
  Object.values(spoolsIndexer)
@@ -1,6 +1,6 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import { normalizeStructTag } from '@mysten/sui/utils';
3
- import type { ScallopUtils } from '../models';
3
+ import type { ScallopUtils } from 'src/models';
4
4
  import {
5
5
  OriginMarketPoolData,
6
6
  ParsedMarketPoolData,
@@ -24,6 +24,7 @@ import {
24
24
  OriginBorrowIncentiveAccountData,
25
25
  ParsedBorrowIncentiveAccountData,
26
26
  } from 'src/types/query';
27
+ import { SuiObjectData } from '@mysten/sui/client';
27
28
 
28
29
  /**
29
30
  * Parse origin market pool data to a more readable format.
@@ -642,3 +643,20 @@ export const estimatedFactor = (
642
643
 
643
644
  return adjustFactor;
644
645
  };
646
+
647
+ export const parseObjectAs = <T>(object: SuiObjectData): T => {
648
+ if (!(object && object.content && 'fields' in object.content))
649
+ throw new Error(`Failed to parse object ${object}`);
650
+
651
+ const fields = object.content.fields as any;
652
+
653
+ if (typeof fields === 'object' && 'value' in fields) {
654
+ const value = fields.value;
655
+ if (typeof value === 'object' && 'fields' in value)
656
+ return value.fields as T;
657
+ return value as T;
658
+ } else if (typeof fields === 'object') {
659
+ return fields as T;
660
+ }
661
+ return fields as T;
662
+ };
@@ -1,5 +1,5 @@
1
1
  import BigNumber from 'bignumber.js';
2
- import { VeScaTreasuryFields, VeScaTreasuryInfo, Vesca } from 'src/types';
2
+ import { VeScaTreasuryFields, VeScaTreasuryInfo, Vesca } from 'src/types/query';
3
3
  import {
4
4
  type SuiObjectResponse,
5
5
  type SuiObjectData,
@@ -1,6 +1,6 @@
1
1
  import { SuiObjectResponse } from '@mysten/sui/client';
2
2
  import { ScallopAddress, ScallopSuiKit, ScallopUtils } from 'src/models';
3
- import { SupportOracleType, xOracleRuleType } from 'src/types';
3
+ import { SupportOracleType, xOracleRuleType } from 'src/types/constant';
4
4
 
5
5
  /**
6
6
  * Query the price update policy table ids. Usually the value for these table will be constant.
@@ -1,32 +1,7 @@
1
- import type { CoreTxBlock, NestedResult } from './core';
2
- import type { SpoolTxBlock } from './spool';
3
- import type { BorrowIncentiveTxBlock } from './borrowIncentive';
4
- import type { VeScaTxBlock } from './vesca';
5
- import type { ReferralTxBlock } from './referral';
6
- import { LoyaltyProgramTxBlock } from './loyaltyProgram';
7
- import { SCoinTxBlock } from './sCoin';
8
-
9
1
  export type * from './core';
10
2
  export type * from './spool';
11
3
  export type * from './borrowIncentive';
12
4
  export type * from './vesca';
13
5
  export type * from './loyaltyProgram';
14
6
  export type * from './sCoin';
15
-
16
- export type BaseScallopTxBlock = ReferralTxBlock &
17
- LoyaltyProgramTxBlock &
18
- BorrowIncentiveTxBlock &
19
- VeScaTxBlock;
20
-
21
- export type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
22
- export type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
23
- export type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
24
-
25
- export type SelectCoinReturnType<T extends string> = T extends 'sui'
26
- ? {
27
- takeCoin: NestedResult;
28
- }
29
- : {
30
- takeCoin: NestedResult;
31
- leftCoin: NestedResult;
32
- };
7
+ export type * from './type';
@@ -0,0 +1,25 @@
1
+ import type { CoreTxBlock, NestedResult } from './core';
2
+ import type { SpoolTxBlock } from './spool';
3
+ import type { BorrowIncentiveTxBlock } from './borrowIncentive';
4
+ import type { VeScaTxBlock } from './vesca';
5
+ import type { ReferralTxBlock } from './referral';
6
+ import type { LoyaltyProgramTxBlock } from './loyaltyProgram';
7
+ import type { SCoinTxBlock } from './sCoin';
8
+
9
+ export type BaseScallopTxBlock = ReferralTxBlock &
10
+ LoyaltyProgramTxBlock &
11
+ BorrowIncentiveTxBlock &
12
+ VeScaTxBlock;
13
+
14
+ export type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
15
+ export type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
16
+ export type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
17
+
18
+ export type SelectCoinReturnType<T extends string> = T extends 'sui'
19
+ ? {
20
+ takeCoin: NestedResult;
21
+ }
22
+ : {
23
+ takeCoin: NestedResult;
24
+ leftCoin: NestedResult;
25
+ };
@@ -1,3 +1,16 @@
1
- import { PACKAGE_NAMES } from 'src/constants/package';
1
+ const _PACKAGE_NAMES = [
2
+ 'coinDecimalsRegistry',
3
+ 'math',
4
+ 'whitelist',
5
+ 'x',
6
+ 'protocol',
7
+ 'protocolWhitelist',
8
+ 'query',
9
+ 'supra',
10
+ 'pyth',
11
+ 'switchboard',
12
+ 'xOracle',
13
+ 'testCoin',
14
+ ] as const;
2
15
 
3
- export type PackageName = (typeof PACKAGE_NAMES)[number];
16
+ export type PackageName = (typeof _PACKAGE_NAMES)[number];