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

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 (56) hide show
  1. package/dist/index.d.mts +2838 -11
  2. package/dist/index.d.ts +2838 -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 +1 -1
  7. package/src/builders/coreBuilder.ts +1 -1
  8. package/src/builders/loyaltyProgramBuilder.ts +1 -1
  9. package/src/builders/referralBuilder.ts +1 -1
  10. package/src/builders/sCoinBuilder.ts +1 -1
  11. package/src/builders/spoolBuilder.ts +1 -1
  12. package/src/builders/vescaBuilder.ts +1 -1
  13. package/src/constants/index.ts +0 -1
  14. package/src/constants/testAddress.ts +2 -2
  15. package/src/index.ts +12 -3
  16. package/src/models/scallop.ts +1 -1
  17. package/src/models/scallopAddress.ts +1 -1
  18. package/src/models/scallopBuilder.ts +1 -1
  19. package/src/models/scallopClient.ts +1 -1
  20. package/src/models/scallopConstants.ts +1 -1
  21. package/src/models/scallopQuery.ts +2 -2
  22. package/src/models/scallopUtils.ts +2 -2
  23. package/src/models/utils.ts +97 -0
  24. package/src/queries/borrowIncentiveQuery.ts +2 -2
  25. package/src/queries/coreQuery.ts +1 -1
  26. package/src/queries/portfolioQuery.ts +2 -2
  27. package/src/queries/spoolQuery.ts +1 -1
  28. package/src/{utils/query.ts → queries/utils.ts} +19 -1
  29. package/src/types/builder/index.ts +1 -26
  30. package/src/types/builder/type.ts +25 -0
  31. package/src/types/constant/package.ts +15 -2
  32. package/dist/address-CW2IpaLn.d.ts +0 -165
  33. package/dist/chunk-E3URAUAC.js +0 -25
  34. package/dist/chunk-YA77R5GT.mjs +0 -5
  35. package/dist/constants/index.d.mts +0 -262
  36. package/dist/constants/index.d.ts +0 -262
  37. package/dist/constants/index.js +0 -86
  38. package/dist/constants/index.mjs +0 -5
  39. package/dist/models/index.d.mts +0 -393
  40. package/dist/models/index.d.ts +0 -393
  41. package/dist/models/index.js +0 -34
  42. package/dist/models/index.mjs +0 -16
  43. package/dist/queryKeys-AaZqDYle.d.ts +0 -43
  44. package/dist/scallopUtils-BZLZd2z8.d.ts +0 -2404
  45. package/dist/types/index.d.mts +0 -9
  46. package/dist/types/index.d.ts +0 -9
  47. package/dist/types/index.js +0 -2
  48. package/dist/types/index.mjs +0 -1
  49. package/src/constants/package.ts +0 -14
  50. package/src/types/index.ts +0 -5
  51. package/src/utils/core.ts +0 -18
  52. package/src/utils/index.ts +0 -5
  53. package/src/utils/indexer.ts +0 -47
  54. package/src/utils/util.ts +0 -42
  55. /package/src/{utils/builder.ts → builders/utils.ts} +0 -0
  56. /package/src/types/{utils.ts → util.ts} +0 -0
@@ -1,9 +0,0 @@
1
- export { aq as BalanceSheet, B as BaseScallopTxBlock, ar as BorrowDynamic, as as BorrowFee, a5 as BorrowIncentiveAccountKey, ae as BorrowIncentiveAccounts, ak as BorrowIncentiveAccountsQueryInterface, y as BorrowIncentiveIds, z as BorrowIncentiveNormalMethods, a8 as BorrowIncentivePool, a7 as BorrowIncentivePoolPoints, a6 as BorrowIncentivePools, aj as BorrowIncentivePoolsQueryInterface, A as BorrowIncentiveQuickMethods, E as BorrowIncentiveTxBlock, ad as CalculatedBorrowIncentivePoolPointData, aD as CalculatedMarketCollateralData, aA as CalculatedMarketPoolData, aY as CalculatedSpoolData, b0 as CalculatedSpoolRewardPoolData, an as CoinAmounts, bb as CoinPrices, a4 as CoinWrappedType, av as CollateralStat, C as CoreIds, m as CoreNormalMethods, n as CoreQuickMethods, p as CoreTxBlock, F as GenerateBorrowIncentiveNormalMethod, H as GenerateBorrowIncentiveQuickMethod, G as GenerateCoreNormalMethod, q as GenerateCoreQuickMethod, U as GenerateLoyaltyProgramNormalMethod, W as GenerateLoyaltyProgramQuickMethod, a0 as GenerateSCoinNormalMethod, a1 as GenerateSCoinQuickMethod, w as GenerateSpoolNormalMethod, x as GenerateSpoolQuickMethod, L as GenerateVeScaNormalMethod, M as GenerateVeScaQuickMethod, at as InterestModel, aM as Lending, aK as Lendings, aI as LoyaltyProgramInfo, O as LoyaltyProgramNormalMethods, P as LoyaltyProgramQuickMethods, T as LoyaltyProgramTxBlock, aE as Market, ao as MarketCoinAmounts, ax as MarketCollateral, am as MarketCollaterals, aw as MarketPool, al as MarketPools, aG as MarketQueryInterface, N as NestedResult, aF as Obligation, aN as ObligationAccount, aL as ObligationAccounts, aR as ObligationBorrowIncentive, aQ as ObligationBorrowIncentiveReward, aO as ObligationCollateral, aP as ObligationDebt, aH as ObligationQueryInterface, ba as OptionalKeys, ag as OriginBorrowIncentiveAccountData, af as OriginBorrowIncentiveAccountPoolData, aa as OriginBorrowIncentivePoolData, a9 as OriginBorrowIncentivePoolPointData, aB as OriginMarketCollateralData, ay as OriginMarketPoolData, aV as OriginSpoolData, a_ as OriginSpoolRewardPoolData, ai as ParsedBorrowIncentiveAccountData, ah as ParsedBorrowIncentiveAccountPoolData, ac as ParsedBorrowIncentivePoolData, ab as ParsedBorrowIncentivePoolPointData, aC as ParsedMarketCollateralData, az as ParsedMarketPoolData, aX as ParsedSpoolData, a$ as ParsedSpoolRewardPoolData, a2 as PoolAddress, Q as QuickMethodReturnType, au as RiskModel, ap as SCoinAmounts, $ as SCoinTxBlock, k as ScallopTxBlock, l as SelectCoinReturnType, aU as Spool, aW as SpoolData, r as SpoolIds, s as SpoolNormalMethods, t as SpoolQuickMethods, aZ as SpoolRewardPool, v as SpoolTxBlock, aT as Spools, b4 as StakeAccount, b3 as StakeAccounts, b5 as StakePool, b1 as StakePools, b6 as StakeRewardPool, b2 as StakeRewardPools, D as SuiTxBlockWithBorrowIncentiveNormalMethods, o as SuiTxBlockWithCoreNormalMethods, R as SuiTxBlockWithLoyaltyProgramNormalMethods, i as SuiTxBlockWithSCoin, _ as SuiTxBlockWithSCoinNormalMethods, j as SuiTxBlockWithSpool, u as SuiTxBlockWithSpoolNormalMethods, J as SuiTxBlockWithVeScaNormalMethods, aS as TotalValueLocked, aJ as VeScaLoyaltyProgramInfo, V as VeScaNormalMethods, I as VeScaQuickMethods, b8 as VeScaTreasuryFields, b9 as VeScaTreasuryInfo, K as VeScaTxBlock, b7 as Vesca, a3 as Whitelist, Y as sCoinNormalMethods, X as sCoinPkgIds, Z as sCoinQuickMethods } from '../scallopUtils-BZLZd2z8.js';
2
- export { Q as QueryKeys } from '../queryKeys-AaZqDYle.js';
3
- export { l as AddressStringPath, A as AddressesInterface, B as BasePackage, k as OracleLst, j as OracleLstConfig, O as OracleLstPackage, h as PackageName, i as SupportOracleLst, d as SupportOracleType, g as SupportedOracleSuiLst, f as xOracleListType, x as xOracleRuleType, e as xOracleRules } from '../address-CW2IpaLn.js';
4
- import '@tanstack/query-core';
5
- import '@scallop-io/sui-kit';
6
- import 'axios';
7
- import '@mysten/sui/dist/cjs/client';
8
- import '@mysten/sui/client';
9
- import '@mysten/sui/transactions';
@@ -1,9 +0,0 @@
1
- export { aq as BalanceSheet, B as BaseScallopTxBlock, ar as BorrowDynamic, as as BorrowFee, a5 as BorrowIncentiveAccountKey, ae as BorrowIncentiveAccounts, ak as BorrowIncentiveAccountsQueryInterface, y as BorrowIncentiveIds, z as BorrowIncentiveNormalMethods, a8 as BorrowIncentivePool, a7 as BorrowIncentivePoolPoints, a6 as BorrowIncentivePools, aj as BorrowIncentivePoolsQueryInterface, A as BorrowIncentiveQuickMethods, E as BorrowIncentiveTxBlock, ad as CalculatedBorrowIncentivePoolPointData, aD as CalculatedMarketCollateralData, aA as CalculatedMarketPoolData, aY as CalculatedSpoolData, b0 as CalculatedSpoolRewardPoolData, an as CoinAmounts, bb as CoinPrices, a4 as CoinWrappedType, av as CollateralStat, C as CoreIds, m as CoreNormalMethods, n as CoreQuickMethods, p as CoreTxBlock, F as GenerateBorrowIncentiveNormalMethod, H as GenerateBorrowIncentiveQuickMethod, G as GenerateCoreNormalMethod, q as GenerateCoreQuickMethod, U as GenerateLoyaltyProgramNormalMethod, W as GenerateLoyaltyProgramQuickMethod, a0 as GenerateSCoinNormalMethod, a1 as GenerateSCoinQuickMethod, w as GenerateSpoolNormalMethod, x as GenerateSpoolQuickMethod, L as GenerateVeScaNormalMethod, M as GenerateVeScaQuickMethod, at as InterestModel, aM as Lending, aK as Lendings, aI as LoyaltyProgramInfo, O as LoyaltyProgramNormalMethods, P as LoyaltyProgramQuickMethods, T as LoyaltyProgramTxBlock, aE as Market, ao as MarketCoinAmounts, ax as MarketCollateral, am as MarketCollaterals, aw as MarketPool, al as MarketPools, aG as MarketQueryInterface, N as NestedResult, aF as Obligation, aN as ObligationAccount, aL as ObligationAccounts, aR as ObligationBorrowIncentive, aQ as ObligationBorrowIncentiveReward, aO as ObligationCollateral, aP as ObligationDebt, aH as ObligationQueryInterface, ba as OptionalKeys, ag as OriginBorrowIncentiveAccountData, af as OriginBorrowIncentiveAccountPoolData, aa as OriginBorrowIncentivePoolData, a9 as OriginBorrowIncentivePoolPointData, aB as OriginMarketCollateralData, ay as OriginMarketPoolData, aV as OriginSpoolData, a_ as OriginSpoolRewardPoolData, ai as ParsedBorrowIncentiveAccountData, ah as ParsedBorrowIncentiveAccountPoolData, ac as ParsedBorrowIncentivePoolData, ab as ParsedBorrowIncentivePoolPointData, aC as ParsedMarketCollateralData, az as ParsedMarketPoolData, aX as ParsedSpoolData, a$ as ParsedSpoolRewardPoolData, a2 as PoolAddress, Q as QuickMethodReturnType, au as RiskModel, ap as SCoinAmounts, $ as SCoinTxBlock, k as ScallopTxBlock, l as SelectCoinReturnType, aU as Spool, aW as SpoolData, r as SpoolIds, s as SpoolNormalMethods, t as SpoolQuickMethods, aZ as SpoolRewardPool, v as SpoolTxBlock, aT as Spools, b4 as StakeAccount, b3 as StakeAccounts, b5 as StakePool, b1 as StakePools, b6 as StakeRewardPool, b2 as StakeRewardPools, D as SuiTxBlockWithBorrowIncentiveNormalMethods, o as SuiTxBlockWithCoreNormalMethods, R as SuiTxBlockWithLoyaltyProgramNormalMethods, i as SuiTxBlockWithSCoin, _ as SuiTxBlockWithSCoinNormalMethods, j as SuiTxBlockWithSpool, u as SuiTxBlockWithSpoolNormalMethods, J as SuiTxBlockWithVeScaNormalMethods, aS as TotalValueLocked, aJ as VeScaLoyaltyProgramInfo, V as VeScaNormalMethods, I as VeScaQuickMethods, b8 as VeScaTreasuryFields, b9 as VeScaTreasuryInfo, K as VeScaTxBlock, b7 as Vesca, a3 as Whitelist, Y as sCoinNormalMethods, X as sCoinPkgIds, Z as sCoinQuickMethods } from '../scallopUtils-BZLZd2z8.js';
2
- export { Q as QueryKeys } from '../queryKeys-AaZqDYle.js';
3
- export { l as AddressStringPath, A as AddressesInterface, B as BasePackage, k as OracleLst, j as OracleLstConfig, O as OracleLstPackage, h as PackageName, i as SupportOracleLst, d as SupportOracleType, g as SupportedOracleSuiLst, f as xOracleListType, x as xOracleRuleType, e as xOracleRules } from '../address-CW2IpaLn.js';
4
- import '@tanstack/query-core';
5
- import '@scallop-io/sui-kit';
6
- import 'axios';
7
- import '@mysten/sui/dist/cjs/client';
8
- import '@mysten/sui/client';
9
- import '@mysten/sui/transactions';
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
-
@@ -1,14 +0,0 @@
1
- export 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;
@@ -1,5 +0,0 @@
1
- export type * from './builder';
2
- export type * from './constant';
3
- export type * from './query';
4
- export type * from './address';
5
- export type * from './utils';
package/src/utils/core.ts DELETED
@@ -1,18 +0,0 @@
1
- import { SuiObjectData } from '@mysten/sui/client';
2
-
3
- export const parseObjectAs = <T>(object: SuiObjectData): T => {
4
- if (!(object && object.content && 'fields' in object.content))
5
- throw new Error(`Failed to parse object ${object}`);
6
-
7
- const fields = object.content.fields as any;
8
-
9
- if (typeof fields === 'object' && 'value' in fields) {
10
- const value = fields.value;
11
- if (typeof value === 'object' && 'fields' in value)
12
- return value.fields as T;
13
- return value as T;
14
- } else if (typeof fields === 'object') {
15
- return fields as T;
16
- }
17
- return fields as T;
18
- };
@@ -1,5 +0,0 @@
1
- export * from './builder';
2
- export * from './core';
3
- export * from './indexer';
4
- export * from './query';
5
- export * from './util';
@@ -1,47 +0,0 @@
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
- }
package/src/utils/util.ts DELETED
@@ -1,42 +0,0 @@
1
- import { MAX_LOCK_DURATION } from 'src/constants/vesca';
2
- // import { ScallopConstants } from 'src/models/scallopConstants';
3
-
4
- /**
5
- * Find the closest unlock round timestamp (12AM) to the given unlock at timestamp in seconds.
6
- *
7
- * @param unlockAtInSecondTimestamp - Unlock at in seconds timestamp to find the closest round.
8
- * @returns Closest round (12AM) in seconds timestamp.
9
- */
10
- export const findClosestUnlockRound = (unlockAtInSecondTimestamp: number) => {
11
- const unlockDate = new Date(unlockAtInSecondTimestamp * 1000);
12
- const closestTwelveAM = new Date(unlockAtInSecondTimestamp * 1000);
13
-
14
- closestTwelveAM.setUTCHours(0, 0, 0, 0); // Set the time to the next 12 AM UTC
15
-
16
- // If the current time is past 12 AM, set the date to the next day
17
- if (unlockDate.getUTCHours() >= 0) {
18
- closestTwelveAM.setUTCDate(closestTwelveAM.getUTCDate() + 1);
19
- }
20
-
21
- const now = new Date().getTime();
22
- // check if unlock period > 4 years
23
- if (closestTwelveAM.getTime() - now > MAX_LOCK_DURATION * 1000) {
24
- closestTwelveAM.setUTCDate(closestTwelveAM.getUTCDate() - 1);
25
- }
26
- return Math.floor(closestTwelveAM.getTime() / 1000);
27
- };
28
-
29
- export const partitionArray = <T>(array: T[], chunkSize: number) => {
30
- const result: T[][] = [];
31
- for (let i = 0; i < array.length; i += chunkSize) {
32
- result.push(array.slice(i, i + chunkSize));
33
- }
34
- return result;
35
- };
36
-
37
- export const parseUrl = (url: string) => {
38
- if (url.endsWith('/')) {
39
- url = url.slice(0, -1);
40
- }
41
- return url;
42
- };
File without changes
File without changes