@scallop-io/sui-scallop-sdk 2.3.0-lst-x-oracle-alpha.5 → 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.
- package/dist/index.d.mts +67 -36
- package/dist/index.d.ts +67 -36
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +1 -1
- package/src/builders/coreBuilder.ts +1 -1
- package/src/builders/loyaltyProgramBuilder.ts +1 -1
- package/src/builders/oracles/index.ts +1 -1
- package/src/builders/oracles/oraclePackageRegistry.ts +2 -3
- package/src/builders/oracles/priceFeedUpdater.ts +1 -1
- package/src/builders/oracles/xOracleUpdateStrategy.ts +1 -1
- package/src/builders/oracles/xOracleUpdater.ts +1 -1
- package/src/builders/referralBuilder.ts +1 -1
- package/src/builders/sCoinBuilder.ts +1 -1
- package/src/builders/spoolBuilder.ts +1 -1
- package/src/builders/vescaBuilder.ts +2 -2
- package/src/queries/coreQuery.ts +1 -1
- package/src/queries/loyaltyProgramQuery.ts +1 -1
- package/src/queries/poolAddressesQuery.ts +3 -1
- package/src/queries/priceQuery.ts +3 -2
- package/src/queries/sCoinQuery.ts +1 -1
- package/src/queries/spoolQuery.ts +4 -4
- package/src/queries/vescaQuery.ts +1 -1
- package/src/queries/xOracleQuery.ts +1 -1
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
SuiTxBlockWithBorrowIncentiveNormalMethods,
|
|
14
14
|
BorrowIncentiveTxBlock,
|
|
15
15
|
ScallopTxBlock,
|
|
16
|
-
} from 'src/types';
|
|
16
|
+
} from 'src/types/builder';
|
|
17
17
|
import { OLD_BORROW_INCENTIVE_PROTOCOL_ID } from 'src/constants/common';
|
|
18
18
|
import { getObligationLocked, getObligations } from 'src/queries/coreQuery';
|
|
19
19
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
LoyaltyProgramTxBlock,
|
|
8
8
|
ScallopTxBlock,
|
|
9
9
|
SuiTxBlockWithLoyaltyProgramNormalMethods,
|
|
10
|
-
} from 'src/types';
|
|
10
|
+
} from 'src/types/builder';
|
|
11
11
|
import { requireSender } from './utils';
|
|
12
12
|
|
|
13
13
|
const generateLoyaltyProgramNormalMethod: GenerateLoyaltyProgramNormalMethod =
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from './priceFeedUpdater';
|
|
11
11
|
import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
12
12
|
import type { ScallopBuilder } from 'src/models';
|
|
13
|
-
import type { SupportOracleType, xOracleRuleType } from 'src/types';
|
|
13
|
+
import type { SupportOracleType, xOracleRuleType } from 'src/types/constant';
|
|
14
14
|
import { PriceUpdateRequester } from './priceUpdateRequester';
|
|
15
15
|
import { UnsupportedOracleError } from './error';
|
|
16
16
|
|
|
@@ -5,11 +5,10 @@ import {
|
|
|
5
5
|
BasePackage,
|
|
6
6
|
OracleLst,
|
|
7
7
|
OracleLstConfig,
|
|
8
|
-
SupportedOracleSuiLst,
|
|
9
8
|
SupportOracleLst,
|
|
10
|
-
|
|
11
|
-
} from 'src/types';
|
|
9
|
+
} from 'src/types/address';
|
|
12
10
|
import { UnsupportedOracleError } from './error';
|
|
11
|
+
import { SupportedOracleSuiLst, SupportOracleType } from 'src/types/constant';
|
|
13
12
|
|
|
14
13
|
export type XOraclePackages = {
|
|
15
14
|
xOraclePackageId: string;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from '@pythnetwork/pyth-sui-js';
|
|
5
5
|
import { SuiTxBlock } from '@scallop-io/sui-kit';
|
|
6
6
|
import { ScallopBuilder } from 'src/models';
|
|
7
|
-
import { SupportOracleType } from 'src/types';
|
|
7
|
+
import { SupportOracleType } from 'src/types/constant';
|
|
8
8
|
|
|
9
9
|
type PythPriceFeedUpdateOptions = {
|
|
10
10
|
usePythPullModel: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SuiTxBlock, TransactionArgument } from '@scallop-io/sui-kit';
|
|
2
|
-
import { SupportOracleType, xOracleRuleType } from 'src/types';
|
|
2
|
+
import { SupportOracleType, xOracleRuleType } from 'src/types/constant';
|
|
3
3
|
import { SUPPORT_SUI_LST } from 'src/constants/xoracle';
|
|
4
4
|
import { IOraclePackageRegistry } from './oraclePackageRegistry';
|
|
5
5
|
import {
|
|
@@ -20,15 +20,15 @@ import type {
|
|
|
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.
|
package/src/queries/coreQuery.ts
CHANGED
|
@@ -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
|
|
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,6 +1,7 @@
|
|
|
1
1
|
import { SuiObjectData } from '@mysten/sui/client';
|
|
2
2
|
import type { ScallopAddress, ScallopQuery, ScallopSuiKit } from 'src/models';
|
|
3
|
-
import type {
|
|
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:
|
|
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
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
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 { 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.
|