@scallop-io/sui-scallop-sdk 2.3.0-lst-x-oracle-alpha.9 → 2.3.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/index.d.mts +1841 -1809
- package/dist/index.d.ts +1841 -1809
- package/dist/index.js +49 -2
- package/dist/index.mjs +15 -2
- package/package.json +8 -7
- package/src/builders/borrowIncentiveBuilder.ts +4 -4
- package/src/builders/coreBuilder.ts +86 -59
- package/src/builders/index.ts +2 -2
- package/src/builders/loyaltyProgramBuilder.ts +2 -2
- package/src/builders/oracles/index.ts +365 -114
- package/src/builders/oracles/pyth.ts +135 -0
- package/src/builders/referralBuilder.ts +4 -10
- package/src/builders/sCoinBuilder.ts +2 -2
- package/src/builders/spoolBuilder.ts +5 -8
- package/src/builders/vescaBuilder.ts +5 -5
- package/src/constants/common.ts +3 -0
- package/src/constants/index.ts +1 -1
- package/src/constants/queryKeys.ts +1 -1
- package/src/constants/rpc.ts +0 -1
- package/src/constants/testAddress.ts +99 -271
- package/src/constants/xoracle.ts +2 -8
- package/src/index.ts +1 -1
- package/src/models/index.ts +1 -2
- package/src/models/interface.ts +7 -7
- package/src/models/rateLimiter.ts +55 -0
- package/src/models/scallop.ts +2 -2
- package/src/models/scallopAddress.ts +7 -35
- package/src/models/scallopBuilder.ts +19 -12
- package/src/models/scallopClient.ts +47 -33
- package/src/models/scallopConstants.ts +3 -3
- package/src/models/scallopIndexer.ts +3 -4
- package/src/models/scallopQuery.ts +113 -57
- package/src/models/scallopQueryClient.ts +1 -1
- package/src/models/scallopSuiKit.ts +1 -1
- package/src/models/scallopUtils.ts +12 -7
- package/src/queries/borrowIncentiveQuery.ts +4 -3
- package/src/queries/coreQuery.ts +114 -186
- package/src/queries/index.ts +3 -4
- package/src/queries/loyaltyProgramQuery.ts +2 -2
- package/src/queries/ownerQuery.ts +32 -0
- package/src/queries/poolAddressesQuery.ts +1 -4
- package/src/queries/portfolioQuery.ts +68 -16
- package/src/queries/priceQuery.ts +2 -3
- package/src/queries/sCoinQuery.ts +2 -2
- package/src/queries/spoolQuery.ts +57 -74
- package/src/queries/vescaQuery.ts +3 -3
- package/src/queries/xOracleQuery.ts +4 -21
- package/src/types/address.ts +47 -98
- package/src/types/builder/core.ts +40 -15
- package/src/types/builder/index.ts +17 -1
- package/src/types/constant/enum.ts +64 -0
- package/src/types/constant/index.ts +1 -2
- package/src/types/constant/xOracle.ts +7 -10
- package/src/types/index.ts +1 -1
- package/src/types/query/core.ts +3 -0
- package/src/types/query/index.ts +1 -0
- package/src/types/query/sCoin.ts +1 -0
- package/src/{builders/utils.ts → utils/builder.ts} +1 -1
- package/src/utils/core.ts +18 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/indexer.ts +47 -0
- package/src/{queries/utils.ts → utils/query.ts} +7 -25
- package/src/utils/util.ts +42 -0
- package/src/builders/oracles/error.ts +0 -18
- package/src/builders/oracles/oraclePackageRegistry.ts +0 -336
- package/src/builders/oracles/priceFeedUpdater.ts +0 -112
- package/src/builders/oracles/priceUpdateRequester.ts +0 -50
- package/src/builders/oracles/xOracleUpdateStrategy.ts +0 -214
- package/src/builders/oracles/xOracleUpdater.ts +0 -153
- package/src/constants/api.ts +0 -2
- package/src/models/utils.ts +0 -97
- package/src/types/builder/type.ts +0 -25
- package/src/types/constant/package.ts +0 -16
- /package/src/types/{util.ts → utils.ts} +0 -0
|
@@ -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 '
|
|
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';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Check and get stake account id from transaction block.
|
|
@@ -196,7 +196,7 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
|
|
|
196
196
|
*
|
|
197
197
|
* @description
|
|
198
198
|
* The quick methods are the same as the normal methods, but they will automatically
|
|
199
|
-
* help users organize transaction blocks,
|
|
199
|
+
* help users organize transaction blocks, including getting stake account info, and transferring
|
|
200
200
|
* coins to the sender. So, they are all asynchronous methods.
|
|
201
201
|
*
|
|
202
202
|
* @param builder - Scallop builder instance.
|
|
@@ -273,7 +273,7 @@ const generateSpoolQuickMethod: GenerateSpoolQuickMethod = ({
|
|
|
273
273
|
for (const account of stakeAccounts) {
|
|
274
274
|
if (account.staked === 0) continue;
|
|
275
275
|
const amountToUnstake = Math.min(amount, account.staked);
|
|
276
|
-
const marketCoin =
|
|
276
|
+
const marketCoin = txBlock.unstake(
|
|
277
277
|
account.id,
|
|
278
278
|
amountToUnstake,
|
|
279
279
|
stakeMarketCoinName
|
|
@@ -281,10 +281,7 @@ const generateSpoolQuickMethod: GenerateSpoolQuickMethod = ({
|
|
|
281
281
|
|
|
282
282
|
// convert to new sCoin
|
|
283
283
|
if (returnSCoin) {
|
|
284
|
-
const sCoin =
|
|
285
|
-
stakeMarketCoinName,
|
|
286
|
-
marketCoin
|
|
287
|
-
);
|
|
284
|
+
const sCoin = txBlock.mintSCoin(stakeMarketCoinName, marketCoin);
|
|
288
285
|
toTransfer.push(sCoin);
|
|
289
286
|
} else {
|
|
290
287
|
toTransfer.push(marketCoin);
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
Transaction,
|
|
5
5
|
SuiTxBlock as SuiKitTxBlock,
|
|
6
6
|
} from '@scallop-io/sui-kit';
|
|
7
|
-
import { SCA_COIN_TYPE } from 'src/constants
|
|
7
|
+
import { SCA_COIN_TYPE } from 'src/constants';
|
|
8
8
|
import { ScallopBuilder } from 'src/models';
|
|
9
|
-
import { getVeSca, getVeScas } from 'src/queries
|
|
9
|
+
import { getVeSca, getVeScas } from 'src/queries';
|
|
10
10
|
import {
|
|
11
11
|
requireSender,
|
|
12
12
|
checkLockSca,
|
|
@@ -14,21 +14,21 @@ import {
|
|
|
14
14
|
checkExtendLockAmount,
|
|
15
15
|
checkRenewExpiredVeSca,
|
|
16
16
|
checkVesca,
|
|
17
|
-
} from '
|
|
17
|
+
} from 'src/utils';
|
|
18
18
|
import type {
|
|
19
19
|
TransactionObjectArgument,
|
|
20
20
|
SuiObjectArg,
|
|
21
21
|
} from '@scallop-io/sui-kit';
|
|
22
22
|
import type {
|
|
23
|
+
AddressesInterface,
|
|
23
24
|
GenerateVeScaNormalMethod,
|
|
24
25
|
GenerateVeScaQuickMethod,
|
|
25
26
|
QuickMethodReturnType,
|
|
26
27
|
ScallopTxBlock,
|
|
27
28
|
SuiTxBlockWithVeScaNormalMethods,
|
|
28
29
|
VeScaTxBlock,
|
|
29
|
-
} from 'src/types
|
|
30
|
+
} from 'src/types';
|
|
30
31
|
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/constants/common.ts
CHANGED
package/src/constants/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ export const queryKeys = {
|
|
|
11
11
|
getPoolAddresses: () => ['api', 'getPoolAddresses'],
|
|
12
12
|
getMarket: () => ['api', 'getMarket'],
|
|
13
13
|
getSpools: () => ['api', 'getSpools'],
|
|
14
|
-
|
|
14
|
+
getBorrowIncentivePools: () => ['api', 'getBorrowIncentivePools'],
|
|
15
15
|
getTotalValueLocked: () => ['api', 'getTotalValueLocked'],
|
|
16
16
|
},
|
|
17
17
|
|
package/src/constants/rpc.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { getFullnodeUrl } from '@mysten/sui/client';
|
|
|
2
2
|
|
|
3
3
|
export const RPC_PROVIDERS = [
|
|
4
4
|
getFullnodeUrl('mainnet'),
|
|
5
|
-
'https://sui-mainnet.public.blastapi.io',
|
|
6
5
|
'https://sui-mainnet-ca-2.cosmostation.io',
|
|
7
6
|
'https://sui-mainnet-eu-4.cosmostation.io',
|
|
8
7
|
'https://sui-mainnet-endpoint.blockvision.org',
|