@scallop-io/sui-scallop-sdk 2.3.0-lst-x-oracle-alpha.3 → 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.
- package/dist/index.d.mts +2838 -11
- package/dist/index.d.ts +2838 -11
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -1
- package/package.json +6 -35
- package/src/builders/borrowIncentiveBuilder.ts +1 -1
- package/src/builders/coreBuilder.ts +1 -1
- package/src/builders/loyaltyProgramBuilder.ts +1 -1
- package/src/builders/referralBuilder.ts +1 -1
- package/src/builders/sCoinBuilder.ts +5 -1
- package/src/builders/spoolBuilder.ts +1 -1
- package/src/builders/vescaBuilder.ts +1 -1
- package/src/constants/index.ts +0 -1
- package/src/constants/testAddress.ts +10 -10
- package/src/index.ts +12 -3
- package/src/models/scallop.ts +1 -1
- package/src/models/scallopAddress.ts +1 -1
- package/src/models/scallopBuilder.ts +1 -1
- package/src/models/scallopClient.ts +1 -1
- package/src/models/scallopConstants.ts +1 -1
- package/src/models/scallopQuery.ts +2 -2
- package/src/models/scallopUtils.ts +2 -2
- package/src/models/utils.ts +97 -0
- package/src/queries/borrowIncentiveQuery.ts +2 -2
- package/src/queries/coreQuery.ts +1 -1
- package/src/queries/portfolioQuery.ts +2 -2
- package/src/queries/spoolQuery.ts +1 -1
- package/src/{utils/query.ts → queries/utils.ts} +19 -1
- package/src/types/builder/index.ts +1 -26
- package/src/types/builder/type.ts +25 -0
- package/src/types/constant/package.ts +15 -2
- package/dist/address-CW2IpaLn.d.ts +0 -165
- package/dist/chunk-E3URAUAC.js +0 -25
- package/dist/chunk-YA77R5GT.mjs +0 -5
- package/dist/constants/index.d.mts +0 -262
- package/dist/constants/index.d.ts +0 -262
- package/dist/constants/index.js +0 -86
- package/dist/constants/index.mjs +0 -5
- package/dist/models/index.d.mts +0 -393
- package/dist/models/index.d.ts +0 -393
- package/dist/models/index.js +0 -34
- package/dist/models/index.mjs +0 -16
- package/dist/queryKeys-AaZqDYle.d.ts +0 -43
- package/dist/scallopUtils-BZLZd2z8.d.ts +0 -2404
- package/dist/types/index.d.mts +0 -9
- package/dist/types/index.d.ts +0 -9
- package/dist/types/index.js +0 -2
- package/dist/types/index.mjs +0 -1
- package/src/constants/package.ts +0 -14
- package/src/types/index.ts +0 -5
- package/src/utils/core.ts +0 -18
- package/src/utils/index.ts +0 -5
- package/src/utils/indexer.ts +0 -47
- package/src/utils/util.ts +0 -42
- /package/src/{utils/builder.ts → builders/utils.ts} +0 -0
- /package/src/types/{utils.ts → util.ts} +0 -0
package/dist/types/index.d.mts
DELETED
|
@@ -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';
|
package/dist/types/index.d.ts
DELETED
|
@@ -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';
|
package/dist/types/index.js
DELETED
package/dist/types/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/src/constants/package.ts
DELETED
package/src/types/index.ts
DELETED
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
|
-
};
|
package/src/utils/index.ts
DELETED
package/src/utils/indexer.ts
DELETED
|
@@ -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
|