@scallop-io/sui-scallop-sdk 2.2.2 → 2.3.0-lst-x-oracle-alpha.1
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/address-Bp_gAUMw.d.ts +165 -0
- package/dist/chunk-4GSK5DO7.js +25 -0
- package/dist/chunk-B4M6FI47.mjs +5 -0
- package/dist/constants/index.d.mts +262 -0
- package/dist/constants/index.d.ts +262 -0
- package/dist/constants/index.js +86 -0
- package/dist/constants/index.mjs +5 -0
- package/dist/models/index.d.mts +393 -0
- package/dist/models/index.d.ts +393 -0
- package/dist/models/index.js +34 -0
- package/dist/models/index.mjs +16 -0
- package/dist/queryKeys-AaZqDYle.d.ts +43 -0
- package/dist/{index.d.mts → scallopUtils-Cxm9zldY.d.ts} +1748 -2586
- package/dist/types/index.d.mts +9 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.mjs +1 -0
- package/package.json +23 -11
- package/src/builders/borrowIncentiveBuilder.ts +2 -2
- package/src/builders/coreBuilder.ts +1 -1
- package/src/builders/index.ts +2 -2
- package/src/builders/oracles/error.ts +29 -0
- package/src/builders/oracles/index.ts +115 -363
- package/src/builders/oracles/oraclePackageRegistry.ts +323 -0
- package/src/builders/oracles/priceFeedUpdater.ts +112 -0
- package/src/builders/oracles/priceUpdateRequester.ts +50 -0
- package/src/builders/oracles/xOracleUpdateStrategy.ts +178 -0
- package/src/builders/oracles/xOracleUpdater.ts +160 -0
- package/src/builders/vescaBuilder.ts +2 -2
- package/src/constants/api.ts +2 -0
- package/src/constants/common.ts +0 -3
- package/src/constants/index.ts +2 -1
- package/src/constants/package.ts +14 -0
- package/src/constants/testAddress.ts +190 -105
- package/src/constants/xoracle.ts +8 -2
- package/src/models/scallopAddress.ts +24 -4
- package/src/models/scallopBuilder.ts +4 -4
- package/src/models/scallopClient.ts +1 -1
- package/src/models/scallopConstants.ts +2 -2
- package/src/models/scallopIndexer.ts +3 -2
- package/src/models/scallopQuery.ts +52 -36
- package/src/models/scallopQueryClient.ts +1 -1
- package/src/models/scallopSuiKit.ts +1 -1
- package/src/models/scallopUtils.ts +5 -8
- package/src/queries/borrowIncentiveQuery.ts +2 -3
- package/src/queries/coreQuery.ts +2 -3
- package/src/queries/index.ts +4 -3
- package/src/queries/loyaltyProgramQuery.ts +1 -1
- package/src/queries/portfolioQuery.ts +13 -13
- package/src/queries/sCoinQuery.ts +2 -2
- package/src/queries/spoolQuery.ts +8 -8
- package/src/queries/vescaQuery.ts +2 -2
- package/src/queries/xOracleQuery.ts +20 -3
- package/src/types/address.ts +85 -47
- package/src/types/constant/index.ts +2 -1
- package/src/types/constant/package.ts +3 -0
- package/src/types/constant/xOracle.ts +10 -7
- package/src/types/query/index.ts +0 -1
- package/src/utils/builder.ts +1 -1
- package/src/utils/index.ts +2 -2
- package/src/utils/query.ts +6 -6
- package/src/utils/util.ts +1 -1
- package/dist/index.d.ts +0 -3242
- package/dist/index.js +0 -49
- package/dist/index.mjs +0 -15
- package/src/builders/oracles/pyth.ts +0 -44
- package/src/index.ts +0 -13
- package/src/queries/ownerQuery.ts +0 -32
- package/src/types/constant/enum.ts +0 -64
- package/src/types/query/sCoin.ts +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { ah as BalanceSheet, B as BaseScallopTxBlock, ai as BorrowDynamic, aj as BorrowFee, Y as BorrowIncentiveAccountKey, a5 as BorrowIncentiveAccounts, ab as BorrowIncentiveAccountsQueryInterface, p as BorrowIncentiveIds, q as BorrowIncentiveNormalMethods, $ as BorrowIncentivePool, _ as BorrowIncentivePoolPoints, Z as BorrowIncentivePools, aa as BorrowIncentivePoolsQueryInterface, r as BorrowIncentiveQuickMethods, t as BorrowIncentiveTxBlock, a4 as CalculatedBorrowIncentivePoolPointData, au as CalculatedMarketCollateralData, ar as CalculatedMarketPoolData, aP as CalculatedSpoolData, aT as CalculatedSpoolRewardPoolData, ae as CoinAmounts, b2 as CoinPrices, X as CoinWrappedType, am as CollateralStat, C as CoreIds, d as CoreNormalMethods, e as CoreQuickMethods, g as CoreTxBlock, u as GenerateBorrowIncentiveNormalMethod, v as GenerateBorrowIncentiveQuickMethod, G as GenerateCoreNormalMethod, h as GenerateCoreQuickMethod, H as GenerateLoyaltyProgramNormalMethod, I as GenerateLoyaltyProgramQuickMethod, R as GenerateSCoinNormalMethod, T as GenerateSCoinQuickMethod, n as GenerateSpoolNormalMethod, o as GenerateSpoolQuickMethod, z as GenerateVeScaNormalMethod, A as GenerateVeScaQuickMethod, ak as InterestModel, aD as Lending, aB as Lendings, az as LoyaltyProgramInfo, L as LoyaltyProgramNormalMethods, D as LoyaltyProgramQuickMethods, F as LoyaltyProgramTxBlock, av as Market, af as MarketCoinAmounts, ao as MarketCollateral, ad as MarketCollaterals, an as MarketPool, ac as MarketPools, ax as MarketQueryInterface, N as NestedResult, aw as Obligation, aE as ObligationAccount, aC as ObligationAccounts, aI as ObligationBorrowIncentive, aH as ObligationBorrowIncentiveReward, aF as ObligationCollateral, aG as ObligationDebt, ay as ObligationQueryInterface, b1 as OptionalKeys, a7 as OriginBorrowIncentiveAccountData, a6 as OriginBorrowIncentiveAccountPoolData, a1 as OriginBorrowIncentivePoolData, a0 as OriginBorrowIncentivePoolPointData, as as OriginMarketCollateralData, ap as OriginMarketPoolData, aM as OriginSpoolData, aR as OriginSpoolRewardPoolData, a9 as ParsedBorrowIncentiveAccountData, a8 as ParsedBorrowIncentiveAccountPoolData, a3 as ParsedBorrowIncentivePoolData, a2 as ParsedBorrowIncentivePoolPointData, at as ParsedMarketCollateralData, aq as ParsedMarketPoolData, aO as ParsedSpoolData, aS as ParsedSpoolRewardPoolData, U as PoolAddress, Q as QuickMethodReturnType, al as RiskModel, ag as SCoinAmounts, P as SCoinTxBlock, b as ScallopTxBlock, c as SelectCoinReturnType, aL as Spool, aN as SpoolData, i as SpoolIds, j as SpoolNormalMethods, k as SpoolQuickMethods, aQ as SpoolRewardPool, m as SpoolTxBlock, aK as Spools, aX as StakeAccount, aW as StakeAccounts, aY as StakePool, aU as StakePools, aZ as StakeRewardPool, aV as StakeRewardPools, s as SuiTxBlockWithBorrowIncentiveNormalMethods, f as SuiTxBlockWithCoreNormalMethods, E as SuiTxBlockWithLoyaltyProgramNormalMethods, S as SuiTxBlockWithSCoin, O as SuiTxBlockWithSCoinNormalMethods, a as SuiTxBlockWithSpool, l as SuiTxBlockWithSpoolNormalMethods, x as SuiTxBlockWithVeScaNormalMethods, aJ as TotalValueLocked, aA as VeScaLoyaltyProgramInfo, V as VeScaNormalMethods, w as VeScaQuickMethods, a$ as VeScaTreasuryFields, b0 as VeScaTreasuryInfo, y as VeScaTxBlock, a_ as Vesca, W as Whitelist, K as sCoinNormalMethods, J as sCoinPkgIds, M as sCoinQuickMethods } from '../scallopUtils-Cxm9zldY.js';
|
|
2
|
+
export { Q as QueryKeys } from '../queryKeys-AaZqDYle.js';
|
|
3
|
+
export { g as AddressStringPath, A as AddressesInterface, B as BasePackage, f as OracleLst, e as OracleLstConfig, O as OracleLstPackage, P as PackageName, d as SupportOracleLst, S as SupportOracleType, c as SupportedOracleSuiLst, b as xOracleListType, x as xOracleRuleType, a as xOracleRules } from '../address-Bp_gAUMw.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';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { ah as BalanceSheet, B as BaseScallopTxBlock, ai as BorrowDynamic, aj as BorrowFee, Y as BorrowIncentiveAccountKey, a5 as BorrowIncentiveAccounts, ab as BorrowIncentiveAccountsQueryInterface, p as BorrowIncentiveIds, q as BorrowIncentiveNormalMethods, $ as BorrowIncentivePool, _ as BorrowIncentivePoolPoints, Z as BorrowIncentivePools, aa as BorrowIncentivePoolsQueryInterface, r as BorrowIncentiveQuickMethods, t as BorrowIncentiveTxBlock, a4 as CalculatedBorrowIncentivePoolPointData, au as CalculatedMarketCollateralData, ar as CalculatedMarketPoolData, aP as CalculatedSpoolData, aT as CalculatedSpoolRewardPoolData, ae as CoinAmounts, b2 as CoinPrices, X as CoinWrappedType, am as CollateralStat, C as CoreIds, d as CoreNormalMethods, e as CoreQuickMethods, g as CoreTxBlock, u as GenerateBorrowIncentiveNormalMethod, v as GenerateBorrowIncentiveQuickMethod, G as GenerateCoreNormalMethod, h as GenerateCoreQuickMethod, H as GenerateLoyaltyProgramNormalMethod, I as GenerateLoyaltyProgramQuickMethod, R as GenerateSCoinNormalMethod, T as GenerateSCoinQuickMethod, n as GenerateSpoolNormalMethod, o as GenerateSpoolQuickMethod, z as GenerateVeScaNormalMethod, A as GenerateVeScaQuickMethod, ak as InterestModel, aD as Lending, aB as Lendings, az as LoyaltyProgramInfo, L as LoyaltyProgramNormalMethods, D as LoyaltyProgramQuickMethods, F as LoyaltyProgramTxBlock, av as Market, af as MarketCoinAmounts, ao as MarketCollateral, ad as MarketCollaterals, an as MarketPool, ac as MarketPools, ax as MarketQueryInterface, N as NestedResult, aw as Obligation, aE as ObligationAccount, aC as ObligationAccounts, aI as ObligationBorrowIncentive, aH as ObligationBorrowIncentiveReward, aF as ObligationCollateral, aG as ObligationDebt, ay as ObligationQueryInterface, b1 as OptionalKeys, a7 as OriginBorrowIncentiveAccountData, a6 as OriginBorrowIncentiveAccountPoolData, a1 as OriginBorrowIncentivePoolData, a0 as OriginBorrowIncentivePoolPointData, as as OriginMarketCollateralData, ap as OriginMarketPoolData, aM as OriginSpoolData, aR as OriginSpoolRewardPoolData, a9 as ParsedBorrowIncentiveAccountData, a8 as ParsedBorrowIncentiveAccountPoolData, a3 as ParsedBorrowIncentivePoolData, a2 as ParsedBorrowIncentivePoolPointData, at as ParsedMarketCollateralData, aq as ParsedMarketPoolData, aO as ParsedSpoolData, aS as ParsedSpoolRewardPoolData, U as PoolAddress, Q as QuickMethodReturnType, al as RiskModel, ag as SCoinAmounts, P as SCoinTxBlock, b as ScallopTxBlock, c as SelectCoinReturnType, aL as Spool, aN as SpoolData, i as SpoolIds, j as SpoolNormalMethods, k as SpoolQuickMethods, aQ as SpoolRewardPool, m as SpoolTxBlock, aK as Spools, aX as StakeAccount, aW as StakeAccounts, aY as StakePool, aU as StakePools, aZ as StakeRewardPool, aV as StakeRewardPools, s as SuiTxBlockWithBorrowIncentiveNormalMethods, f as SuiTxBlockWithCoreNormalMethods, E as SuiTxBlockWithLoyaltyProgramNormalMethods, S as SuiTxBlockWithSCoin, O as SuiTxBlockWithSCoinNormalMethods, a as SuiTxBlockWithSpool, l as SuiTxBlockWithSpoolNormalMethods, x as SuiTxBlockWithVeScaNormalMethods, aJ as TotalValueLocked, aA as VeScaLoyaltyProgramInfo, V as VeScaNormalMethods, w as VeScaQuickMethods, a$ as VeScaTreasuryFields, b0 as VeScaTreasuryInfo, y as VeScaTxBlock, a_ as Vesca, W as Whitelist, K as sCoinNormalMethods, J as sCoinPkgIds, M as sCoinQuickMethods } from '../scallopUtils-Cxm9zldY.js';
|
|
2
|
+
export { Q as QueryKeys } from '../queryKeys-AaZqDYle.js';
|
|
3
|
+
export { g as AddressStringPath, A as AddressesInterface, B as BasePackage, f as OracleLst, e as OracleLstConfig, O as OracleLstPackage, P as PackageName, d as SupportOracleLst, S as SupportOracleType, c as SupportedOracleSuiLst, b as xOracleListType, x as xOracleRuleType, a as xOracleRules } from '../address-Bp_gAUMw.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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scallop-io/sui-scallop-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-lst-x-oracle-alpha.1",
|
|
4
4
|
"description": "Typescript sdk for interacting with Scallop contract on SUI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sui",
|
|
@@ -22,15 +22,27 @@
|
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=18.15.0"
|
|
24
24
|
},
|
|
25
|
-
"main": "./dist/index.js",
|
|
26
|
-
"module": "./dist/index.mjs",
|
|
27
|
-
"types": "./dist/index.d.ts",
|
|
25
|
+
"main": "./dist/models/index.js",
|
|
26
|
+
"module": "./dist/models/index.mjs",
|
|
27
|
+
"types": "./dist/models/index.d.ts",
|
|
28
28
|
"exports": {
|
|
29
|
-
"
|
|
30
|
-
"source": "./src/index.ts",
|
|
31
|
-
"import": "./dist/index.mjs",
|
|
32
|
-
"require": "./dist/index.js",
|
|
33
|
-
"default": "./dist/index.js"
|
|
29
|
+
"./models": {
|
|
30
|
+
"source": "./src/models/index.ts",
|
|
31
|
+
"import": "./dist/models/index.mjs",
|
|
32
|
+
"require": "./dist/models/index.js",
|
|
33
|
+
"default": "./dist/models/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./types": {
|
|
36
|
+
"source": "./src/types/index.ts",
|
|
37
|
+
"import": "./dist/types/index.mjs",
|
|
38
|
+
"require": "./dist/types/index.js",
|
|
39
|
+
"default": "./dist/types/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./constants": {
|
|
42
|
+
"source": "./src/constants/index.ts",
|
|
43
|
+
"import": "./dist/constants/index.mjs",
|
|
44
|
+
"require": "./dist/constants/index.js",
|
|
45
|
+
"default": "./dist/constants/index.js"
|
|
34
46
|
}
|
|
35
47
|
},
|
|
36
48
|
"files": [
|
|
@@ -146,8 +158,8 @@
|
|
|
146
158
|
"scripts": {
|
|
147
159
|
"clean": "rm -rf tsconfig.tsbuildinfo ./dist",
|
|
148
160
|
"build": "pnpm run build:tsup",
|
|
149
|
-
"build:tsup": "tsup ./src/index.ts --format esm,cjs --splitting --minify --treeshake --dts",
|
|
150
|
-
"watch:tsup": "tsup ./src/index.ts --format esm,cjs --clean --splitting --watch",
|
|
161
|
+
"build:tsup": "tsup ./src/models/index.ts ./src/constants/index.ts ./src/types/index.ts --format esm,cjs --clean --splitting --minify --treeshake --dts",
|
|
162
|
+
"watch:tsup": "tsup ./src/models/index.ts ./src/constants/index.ts ./src/types/index.ts --format esm,cjs --clean --splitting --watch",
|
|
151
163
|
"watch:types": "tsc --watch",
|
|
152
164
|
"watch": "pnpm run clean & pnpm run watch:types & pnpm run watch:tsup",
|
|
153
165
|
"test": "pnpm test:typecheck && pnpm test:unit",
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
SuiTxBlock as SuiKitTxBlock,
|
|
4
4
|
SUI_CLOCK_OBJECT_ID,
|
|
5
5
|
} from '@scallop-io/sui-kit';
|
|
6
|
-
import { getObligations, getObligationLocked } from 'src/queries';
|
|
7
6
|
import { requireSender } from 'src/utils';
|
|
8
7
|
import type { SuiObjectArg } from '@scallop-io/sui-kit';
|
|
9
8
|
import type { ScallopBuilder } from 'src/models';
|
|
@@ -15,7 +14,8 @@ import type {
|
|
|
15
14
|
BorrowIncentiveTxBlock,
|
|
16
15
|
ScallopTxBlock,
|
|
17
16
|
} from 'src/types';
|
|
18
|
-
import { OLD_BORROW_INCENTIVE_PROTOCOL_ID } from 'src/constants';
|
|
17
|
+
import { OLD_BORROW_INCENTIVE_PROTOCOL_ID } from 'src/constants/common';
|
|
18
|
+
import { getObligationLocked, getObligations } from 'src/queries/coreQuery';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Check and get Obligation information from transaction block.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
-
import { getObligations } from '
|
|
4
|
+
import { getObligations } from 'src/queries/coreQuery';
|
|
5
5
|
import { updateOracles } from './oracles';
|
|
6
6
|
import { requireSender } from '../utils';
|
|
7
7
|
import type { SuiObjectArg, TransactionResult } from '@scallop-io/sui-kit';
|
package/src/builders/index.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { newCoreTxBlock } from './coreBuilder';
|
|
|
4
4
|
import { newSpoolTxBlock } from './spoolBuilder';
|
|
5
5
|
import { newBorrowIncentiveTxBlock } from './borrowIncentiveBuilder';
|
|
6
6
|
import { newVeScaTxBlock } from './vescaBuilder';
|
|
7
|
-
import type { ScallopBuilder } from 'src/models';
|
|
8
|
-
import type { ScallopTxBlock } from 'src/types';
|
|
9
7
|
import { newReferralTxBlock } from './referralBuilder';
|
|
10
8
|
import { newLoyaltyProgramTxBlock } from './loyaltyProgramBuilder';
|
|
11
9
|
import { newSCoinTxBlock } from './sCoinBuilder';
|
|
10
|
+
import { ScallopTxBlock } from 'src/types/builder';
|
|
11
|
+
import type { ScallopBuilder } from 'src/models';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Create a new ScallopTxBlock instance.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown when someone asks for an oracle type we haven’t onboarded yet.
|
|
3
|
+
*/
|
|
4
|
+
class UnsupportedOracleError extends Error {
|
|
5
|
+
constructor(oracle: string) {
|
|
6
|
+
super(`Unsupported oracle type: ${oracle}`);
|
|
7
|
+
this.name = 'UnsupportedOracleError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class UnsupportedLstUpdateError extends Error {
|
|
12
|
+
constructor(lst: string) {
|
|
13
|
+
super(`Unsupported LST update for: ${lst}`);
|
|
14
|
+
this.name = 'UnsupportedLstUpdateError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class UnsupportedLstOracleError extends Error {
|
|
19
|
+
constructor(lst: string, oracle: string) {
|
|
20
|
+
super(`Unsupported LST oracle update for: ${lst} with oracle: ${oracle}`);
|
|
21
|
+
this.name = 'UnsupportedLstOracleError';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
UnsupportedOracleError,
|
|
27
|
+
UnsupportedLstUpdateError,
|
|
28
|
+
UnsupportedLstOracleError,
|
|
29
|
+
};
|