@scallop-io/sui-scallop-sdk 1.3.4-alpha.5 → 1.3.4-alpha.7
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/builders/borrowIncentiveBuilder.d.ts +1 -1
- package/dist/builders/coreBuilder.d.ts +2 -2
- package/dist/builders/index.d.ts +2 -2
- package/dist/builders/oracle.d.ts +2 -2
- package/dist/builders/referralBuilder.d.ts +1 -1
- package/dist/builders/spoolBuilder.d.ts +2 -2
- package/dist/builders/vescaBuilder.d.ts +2 -2
- package/dist/constants/coinGecko.d.ts +1 -1
- package/dist/constants/enum.d.ts +1 -1
- package/dist/constants/index.d.ts +1 -1
- package/dist/index.js +96 -96
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -96
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallop.d.ts +1 -1
- package/dist/models/scallopAddress.d.ts +1 -1
- package/dist/models/scallopBuilder.d.ts +1 -1
- package/dist/models/scallopClient.d.ts +8 -8
- package/dist/models/scallopIndexer.d.ts +1 -1
- package/dist/models/scallopQuery.d.ts +96 -96
- package/dist/models/scallopUtils.d.ts +2 -2
- package/dist/queries/borrowIncentiveQuery.d.ts +12 -12
- package/dist/queries/coreQuery.d.ts +2 -2
- package/dist/queries/isolatedAssetQuery.d.ts +2 -2
- package/dist/queries/portfolioQuery.d.ts +2 -2
- package/dist/queries/priceQuery.d.ts +2 -2
- package/dist/queries/spoolQuery.d.ts +2 -2
- package/dist/queries/supplyLimitQuery.d.ts +2 -2
- package/dist/queries/vescaQuery.d.ts +2 -2
- package/dist/types/address.d.ts +1 -1
- package/dist/types/builder/borrowIncentive.d.ts +2 -2
- package/dist/types/builder/core.d.ts +2 -2
- package/dist/types/builder/index.d.ts +4 -5
- package/dist/types/builder/referral.d.ts +1 -1
- package/dist/types/builder/sCoin.d.ts +1 -1
- package/dist/types/builder/spool.d.ts +2 -2
- package/dist/types/constant/common.d.ts +1 -1
- package/dist/types/model.d.ts +2 -2
- package/dist/types/query/borrowIncentive.d.ts +1 -1
- package/dist/types/query/core.d.ts +1 -1
- package/dist/types/query/portfolio.d.ts +1 -1
- package/dist/types/query/spool.d.ts +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/query.d.ts +2 -2
- package/dist/utils/util.d.ts +2 -2
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +8 -8
- package/src/builders/coreBuilder.ts +5 -5
- package/src/builders/index.ts +2 -2
- package/src/builders/oracle.ts +4 -4
- package/src/builders/referralBuilder.ts +1 -1
- package/src/builders/spoolBuilder.ts +6 -6
- package/src/builders/vescaBuilder.ts +4 -4
- package/src/constants/coinGecko.ts +1 -1
- package/src/constants/enum.ts +1 -1
- package/src/constants/index.ts +1 -1
- package/src/models/scallop.ts +5 -5
- package/src/models/scallopAddress.ts +6 -9
- package/src/models/scallopBuilder.ts +5 -4
- package/src/models/scallopCache.ts +4 -4
- package/src/models/scallopClient.ts +4 -4
- package/src/models/scallopIndexer.ts +4 -3
- package/src/models/scallopQuery.ts +4 -8
- package/src/models/scallopUtils.ts +8 -11
- package/src/models/suiKit.ts +1 -1
- package/src/queries/borrowIncentiveQuery.ts +5 -5
- package/src/queries/coreQuery.ts +4 -4
- package/src/queries/isolatedAssetQuery.ts +2 -2
- package/src/queries/portfolioQuery.ts +4 -4
- package/src/queries/priceQuery.ts +2 -2
- package/src/queries/spoolQuery.ts +5 -5
- package/src/queries/supplyLimitQuery.ts +2 -2
- package/src/queries/vescaQuery.ts +2 -2
- package/src/types/address.ts +1 -1
- package/src/types/builder/borrowIncentive.ts +3 -3
- package/src/types/builder/core.ts +3 -3
- package/src/types/builder/index.ts +4 -5
- package/src/types/builder/referral.ts +1 -1
- package/src/types/builder/sCoin.ts +1 -1
- package/src/types/builder/spool.ts +2 -2
- package/src/types/constant/common.ts +1 -1
- package/src/types/model.ts +2 -2
- package/src/types/query/borrowIncentive.ts +2 -2
- package/src/types/query/core.ts +1 -1
- package/src/types/query/portfolio.ts +2 -2
- package/src/types/query/spool.ts +1 -1
- package/src/utils/builder.ts +1 -1
- package/src/utils/index.ts +2 -2
- package/src/utils/query.ts +3 -3
- package/src/utils/tokenBucket.ts +1 -1
- package/src/utils/util.ts +4 -4
- package/dist/test.d.ts +0 -0
- package/src/test.ts +0 -30
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SuiTxBlock as SuiKitTxBlock, SuiObjectArg } from '@scallop-io/sui-kit';
|
|
2
2
|
import type { Argument, TransactionResult } from '@mysten/sui/transactions';
|
|
3
|
-
import type { ScallopBuilder } from '
|
|
4
|
-
import { SupportCollateralCoins, SupportPoolCoins, SupportAssetCoins } from '
|
|
3
|
+
import type { ScallopBuilder } from '../../models';
|
|
4
|
+
import type { SupportCollateralCoins, SupportPoolCoins, SupportAssetCoins } from '../constant';
|
|
5
5
|
import { SuiTxBlockWithSpool } from '.';
|
|
6
6
|
export type CoreIds = {
|
|
7
7
|
protocolPkg: string;
|
|
@@ -5,14 +5,13 @@ import type { VeScaTxBlock } from './vesca';
|
|
|
5
5
|
import type { ReferralTxBlock } from './referral';
|
|
6
6
|
import { LoyaltyProgramTxBlock } from './loyaltyProgram';
|
|
7
7
|
import { SCoinTxBlock } from './sCoin';
|
|
8
|
-
import { SupportAssetCoins } from '
|
|
9
|
-
export type * from './borrowIncentive';
|
|
8
|
+
import { SupportAssetCoins } from '../constant';
|
|
10
9
|
export type * from './core';
|
|
11
|
-
export type * from './loyaltyProgram';
|
|
12
|
-
export type * from './referral';
|
|
13
|
-
export type * from './sCoin';
|
|
14
10
|
export type * from './spool';
|
|
11
|
+
export type * from './borrowIncentive';
|
|
15
12
|
export type * from './vesca';
|
|
13
|
+
export type * from './loyaltyProgram';
|
|
14
|
+
export type * from './sCoin';
|
|
16
15
|
export type BaseScallopTxBlock = ReferralTxBlock & LoyaltyProgramTxBlock & BorrowIncentiveTxBlock & VeScaTxBlock;
|
|
17
16
|
export type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
|
|
18
17
|
export type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SuiObjectArg, TransactionResult, SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
2
2
|
import { ScallopBuilder } from 'src/models';
|
|
3
|
-
import { SupportPoolCoins } from '
|
|
3
|
+
import { SupportPoolCoins } from '../constant';
|
|
4
4
|
export type ReferralIds = {
|
|
5
5
|
referralPgkId: string;
|
|
6
6
|
referralBindings: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SuiObjectArg, SuiTxBlock as SuiKitTxBlock, TransactionResult } from '@scallop-io/sui-kit';
|
|
2
|
-
import { SupportSCoin } from '
|
|
2
|
+
import { SupportSCoin } from '../constant';
|
|
3
3
|
import { ScallopBuilder } from 'src/models';
|
|
4
4
|
import { BaseScallopTxBlock } from '.';
|
|
5
5
|
export type sCoinPkgIds = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SuiTxBlock as SuiKitTxBlock, SuiAddressArg, SuiObjectArg } from '@scallop-io/sui-kit';
|
|
2
2
|
import type { TransactionResult } from '@mysten/sui/transactions';
|
|
3
|
-
import type { ScallopBuilder } from '
|
|
4
|
-
import { SupportStakeMarketCoins } from '
|
|
3
|
+
import type { ScallopBuilder } from '../../models';
|
|
4
|
+
import type { SupportStakeMarketCoins } from '../constant';
|
|
5
5
|
import { SuiTxBlockWithSCoin } from '.';
|
|
6
6
|
export type SpoolIds = {
|
|
7
7
|
spoolPkg: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SUPPORT_POOLS, SUPPORT_COLLATERALS, SUPPORT_ORACLES, SUPPORT_PACKAGES, SUPPORT_SPOOLS, SUPPORT_SPOOLS_REWARDS, SUPPORT_BORROW_INCENTIVE_POOLS, SUPPORT_BORROW_INCENTIVE_REWARDS, SUPPORT_SCOIN, SUPPORT_SUI_BRIDGE, SUPPORT_WORMHOLE } from '
|
|
1
|
+
import { SUPPORT_POOLS, SUPPORT_COLLATERALS, SUPPORT_ORACLES, SUPPORT_PACKAGES, SUPPORT_SPOOLS, SUPPORT_SPOOLS_REWARDS, SUPPORT_BORROW_INCENTIVE_POOLS, SUPPORT_BORROW_INCENTIVE_REWARDS, SUPPORT_SCOIN, SUPPORT_SUI_BRIDGE, SUPPORT_WORMHOLE } from '../../constants';
|
|
2
2
|
type ParseMarketCoins<T extends string> = `s${T}`;
|
|
3
3
|
type ParseCoins<T extends string> = T extends `s${infer R}` ? R : never;
|
|
4
4
|
export type SupportCoins = SupportAssetCoins | SupportMarketCoins | SupportStakeMarketCoins | SupportSCoin;
|
package/dist/types/model.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SuiTransactionBlockResponse } from '@mysten/sui/client';
|
|
2
2
|
import type { Transaction, TransactionResult } from '@mysten/sui/transactions';
|
|
3
3
|
import type { SuiKit, SuiKitParams, NetworkType } from '@scallop-io/sui-kit';
|
|
4
|
-
import type { ScallopAddress, ScallopQuery, ScallopUtils, ScallopBuilder, ScallopIndexer } from '
|
|
5
|
-
import { ScallopCache } from 'src/models';
|
|
4
|
+
import type { ScallopAddress, ScallopQuery, ScallopUtils, ScallopBuilder, ScallopIndexer } from '../models';
|
|
5
|
+
import { ScallopCache } from 'src/models/scallopCache';
|
|
6
6
|
import { AddressesInterface } from './address';
|
|
7
7
|
export type ScallopClientFnReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : Transaction;
|
|
8
8
|
export type ScallopClientVeScaReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SupportBorrowIncentiveCoins, SupportBorrowIncentiveRewardCoins } from '
|
|
1
|
+
import type { SupportBorrowIncentiveCoins, SupportBorrowIncentiveRewardCoins } from '../constant';
|
|
2
2
|
export interface BorrowIncentiveAccountKey {
|
|
3
3
|
id: string;
|
|
4
4
|
onwerId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SupportPoolCoins, SupportCollateralCoins, SupportMarketCoins, CoinWrappedType, SupportSCoin } from '
|
|
1
|
+
import type { SupportPoolCoins, SupportCollateralCoins, SupportMarketCoins, CoinWrappedType, SupportSCoin } from '../constant';
|
|
2
2
|
type OptionalKeys<T> = {
|
|
3
3
|
[K in keyof T]?: T[K];
|
|
4
4
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MarketPool } from './core';
|
|
2
2
|
import type { Spool } from './spool';
|
|
3
|
-
import { SupportPoolCoins, SupportCollateralCoins, SupportBorrowIncentiveRewardCoins } from '
|
|
3
|
+
import type { SupportPoolCoins, SupportCollateralCoins, SupportBorrowIncentiveRewardCoins } from '../constant';
|
|
4
4
|
type OptionalKeys<T> = {
|
|
5
5
|
[K in keyof T]?: T[K];
|
|
6
6
|
};
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/query.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
|
-
import type { ScallopUtils } from '
|
|
3
|
-
import { OriginMarketPoolData, ParsedMarketPoolData, CalculatedMarketPoolData, OriginMarketCollateralData, ParsedMarketCollateralData, CalculatedMarketCollateralData, OriginSpoolData, ParsedSpoolData, CalculatedSpoolData, OriginSpoolRewardPoolData, ParsedSpoolRewardPoolData, CalculatedSpoolRewardPoolData, OriginBorrowIncentivePoolData, ParsedBorrowIncentivePoolData, OriginBorrowIncentiveAccountData, ParsedBorrowIncentiveAccountData, OriginBorrowIncentivePoolPointData, ParsedBorrowIncentivePoolPointData, CalculatedBorrowIncentivePoolPointData, OriginBorrowIncentiveAccountPoolData, ParsedBorrowIncentiveAccountPoolData } from '
|
|
2
|
+
import type { ScallopUtils } from '../models';
|
|
3
|
+
import type { OriginMarketPoolData, ParsedMarketPoolData, CalculatedMarketPoolData, OriginMarketCollateralData, ParsedMarketCollateralData, CalculatedMarketCollateralData, OriginSpoolData, ParsedSpoolData, CalculatedSpoolData, OriginSpoolRewardPoolData, ParsedSpoolRewardPoolData, CalculatedSpoolRewardPoolData, OriginBorrowIncentivePoolData, ParsedBorrowIncentivePoolData, OriginBorrowIncentiveAccountData, ParsedBorrowIncentiveAccountData, OriginBorrowIncentivePoolPointData, ParsedBorrowIncentivePoolPointData, CalculatedBorrowIncentivePoolPointData, OriginBorrowIncentiveAccountPoolData, ParsedBorrowIncentiveAccountPoolData } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Parse origin market pool data to a more readable format.
|
|
6
6
|
*
|
package/dist/utils/util.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PriceFeed } from '@pythnetwork/pyth-sui-js';
|
|
2
|
-
import type { ScallopAddress } from '
|
|
3
|
-
import { SupportAssetCoins, SupportCoins, SupportMarketCoins, SupportSCoin, SupportSuiBridgeCoins, SupportWormholeCoins } from '
|
|
2
|
+
import type { ScallopAddress } from '../models';
|
|
3
|
+
import type { SupportAssetCoins, SupportCoins, SupportMarketCoins, SupportSCoin, SupportSuiBridgeCoins, SupportWormholeCoins } from '../types';
|
|
4
4
|
export declare const isMarketCoin: (coinName: SupportCoins) => coinName is SupportMarketCoins | SupportSCoin;
|
|
5
5
|
export declare const isSuiBridgeAsset: (coinName: any) => coinName is SupportSuiBridgeCoins;
|
|
6
6
|
export declare const isWormholeAsset: (coinName: any) => coinName is SupportWormholeCoins;
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
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, getObligationLocked } from '
|
|
5
|
-
import { requireSender } from '
|
|
4
|
+
import { getObligations, getObligationLocked } from '../queries';
|
|
5
|
+
import { requireSender } from '../utils';
|
|
6
6
|
import type { SuiObjectArg } from '@scallop-io/sui-kit';
|
|
7
7
|
import type { ScallopBuilder } from 'src/models';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
GenerateBorrowIncentiveNormalMethod,
|
|
8
|
+
import type {
|
|
11
9
|
BorrowIncentiveIds,
|
|
12
|
-
|
|
10
|
+
GenerateBorrowIncentiveNormalMethod,
|
|
13
11
|
GenerateBorrowIncentiveQuickMethod,
|
|
14
|
-
ScallopTxBlock,
|
|
15
12
|
SuiTxBlockWithBorrowIncentiveNormalMethods,
|
|
16
13
|
BorrowIncentiveTxBlock,
|
|
17
|
-
|
|
14
|
+
ScallopTxBlock,
|
|
15
|
+
VescaIds,
|
|
16
|
+
} from '../types';
|
|
17
|
+
import { OLD_BORROW_INCENTIVE_PROTOCOL_ID } from 'src/constants';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Check and get Obligation information from transaction block.
|
|
@@ -1,12 +1,12 @@
|
|
|
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 '../queries';
|
|
5
5
|
import { updateOracles } from './oracle';
|
|
6
|
-
import { requireSender } from '
|
|
6
|
+
import { requireSender } from '../utils';
|
|
7
7
|
import type { SuiObjectArg, TransactionResult } from '@scallop-io/sui-kit';
|
|
8
|
-
import type { ScallopBuilder } from '
|
|
9
|
-
import {
|
|
8
|
+
import type { ScallopBuilder } from '../models';
|
|
9
|
+
import type {
|
|
10
10
|
CoreIds,
|
|
11
11
|
GenerateCoreNormalMethod,
|
|
12
12
|
GenerateCoreQuickMethod,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
ScallopTxBlock,
|
|
16
16
|
NestedResult,
|
|
17
17
|
SuiTxBlockWithSpool,
|
|
18
|
-
} from '
|
|
18
|
+
} from '../types';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Check and get Obligation information from transaction block.
|
package/src/builders/index.ts
CHANGED
|
@@ -4,8 +4,8 @@ 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 '
|
|
8
|
-
import { ScallopTxBlock } from '
|
|
7
|
+
import type { ScallopBuilder } from '../models';
|
|
8
|
+
import type { ScallopTxBlock } from '../types';
|
|
9
9
|
import { newReferralTxBlock } from './referralBuilder';
|
|
10
10
|
import { newLoyaltyProgramTxBlock } from './loyaltyProgramBuilder';
|
|
11
11
|
import { newSCoinTxBlock } from './sCoinBuilder';
|
package/src/builders/oracle.ts
CHANGED
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
SuiPythClient,
|
|
4
4
|
SuiPriceServiceConnection,
|
|
5
5
|
} from '@pythnetwork/pyth-sui-js';
|
|
6
|
-
import { SUPPORT_COLLATERALS, SUPPORT_POOLS } from '
|
|
6
|
+
import { SUPPORT_COLLATERALS, SUPPORT_POOLS } from '../constants';
|
|
7
7
|
import type { TransactionArgument } from '@mysten/sui/transactions';
|
|
8
8
|
import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
9
|
-
import type { ScallopBuilder } from '
|
|
10
|
-
import { SupportAssetCoins, SupportOracleType } from '
|
|
11
|
-
import { PYTH_ENDPOINTS } from 'src/constants';
|
|
9
|
+
import type { ScallopBuilder } from '../models';
|
|
10
|
+
import type { SupportAssetCoins, SupportOracleType } from '../types';
|
|
11
|
+
import { PYTH_ENDPOINTS } from 'src/constants/pyth';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Update the price of the oracle for multiple coin.
|
|
@@ -1,13 +1,13 @@
|
|
|
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 { spoolRewardCoins } from '
|
|
5
|
-
import { getStakeAccounts } from '
|
|
6
|
-
import { requireSender } from '
|
|
4
|
+
import { spoolRewardCoins } from '../constants/enum';
|
|
5
|
+
import { getStakeAccounts } from '../queries/spoolQuery';
|
|
6
|
+
import { requireSender } from '../utils';
|
|
7
7
|
import type { SuiAddressArg } from '@scallop-io/sui-kit';
|
|
8
8
|
import type { TransactionResult } from '@mysten/sui/transactions';
|
|
9
|
-
import type { ScallopBuilder } from '
|
|
10
|
-
import {
|
|
9
|
+
import type { ScallopBuilder } from '../models';
|
|
10
|
+
import type {
|
|
11
11
|
SpoolIds,
|
|
12
12
|
GenerateSpoolNormalMethod,
|
|
13
13
|
GenerateSpoolQuickMethod,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
SupportStakeMarketCoins,
|
|
17
17
|
ScallopTxBlock,
|
|
18
18
|
SuiTxBlockWithSCoin,
|
|
19
|
-
} from '
|
|
19
|
+
} from '../types';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Check and get stake account id from transaction block.
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
SuiTxBlock as SuiKitTxBlock,
|
|
6
6
|
} from '@scallop-io/sui-kit';
|
|
7
7
|
import { SCA_COIN_TYPE } from 'src/constants';
|
|
8
|
-
import { ScallopBuilder } from '
|
|
9
|
-
import { getVeSca, getVeScas } from '
|
|
8
|
+
import { ScallopBuilder } from '../models';
|
|
9
|
+
import { getVeSca, getVeScas } from '../queries';
|
|
10
10
|
import {
|
|
11
11
|
requireSender,
|
|
12
12
|
checkLockSca,
|
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
checkExtendLockAmount,
|
|
15
15
|
checkRenewExpiredVeSca,
|
|
16
16
|
checkVesca,
|
|
17
|
-
} from '
|
|
17
|
+
} from '../utils';
|
|
18
18
|
import type {
|
|
19
19
|
TransactionObjectArgument,
|
|
20
20
|
SuiObjectArg,
|
|
21
21
|
} from '@scallop-io/sui-kit';
|
|
22
|
-
import {
|
|
22
|
+
import type {
|
|
23
23
|
GenerateVeScaNormalMethod,
|
|
24
24
|
GenerateVeScaQuickMethod,
|
|
25
25
|
RedeemScaQuickReturnType,
|
package/src/constants/enum.ts
CHANGED
package/src/constants/index.ts
CHANGED
package/src/models/scallop.ts
CHANGED
|
@@ -4,23 +4,23 @@ import { ScallopClient } from './scallopClient';
|
|
|
4
4
|
import { ScallopBuilder } from './scallopBuilder';
|
|
5
5
|
import { ScallopQuery } from './scallopQuery';
|
|
6
6
|
import { ScallopUtils } from './scallopUtils';
|
|
7
|
-
import { ADDRESSES_ID } from '
|
|
8
|
-
import {
|
|
7
|
+
import { ADDRESSES_ID } from '../constants';
|
|
8
|
+
import type {
|
|
9
9
|
ScallopBuilderParams,
|
|
10
10
|
ScallopClientParams,
|
|
11
11
|
ScallopParams,
|
|
12
12
|
ScallopQueryParams,
|
|
13
13
|
ScallopUtilsParams,
|
|
14
|
-
} from '
|
|
14
|
+
} from '../types/';
|
|
15
15
|
import { ScallopIndexer } from './scallopIndexer';
|
|
16
16
|
import { ScallopCache } from './scallopCache';
|
|
17
17
|
import { QueryClientConfig } from '@tanstack/query-core';
|
|
18
|
-
import { DEFAULT_CACHE_OPTIONS } from 'src/constants';
|
|
18
|
+
import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
|
|
19
19
|
import { TokenBucket } from 'src/utils';
|
|
20
20
|
import {
|
|
21
21
|
DEFAULT_INTERVAL_IN_MS,
|
|
22
22
|
DEFAULT_TOKENS_PER_INTERVAL,
|
|
23
|
-
} from 'src/constants';
|
|
23
|
+
} from 'src/constants/tokenBucket';
|
|
24
24
|
import type { QueryClient } from '@tanstack/query-core';
|
|
25
25
|
import { newSuiKit } from './suiKit';
|
|
26
26
|
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
API_BASE_URL,
|
|
3
|
-
USE_TEST_ADDRESS,
|
|
4
|
-
DEFAULT_CACHE_OPTIONS,
|
|
5
|
-
TEST_ADDRESSES,
|
|
6
|
-
queryKeys,
|
|
7
|
-
} from 'src/constants';
|
|
1
|
+
import { API_BASE_URL, USE_TEST_ADDRESS } from '../constants';
|
|
8
2
|
import { SuiKit, type NetworkType } from '@scallop-io/sui-kit';
|
|
9
|
-
import {
|
|
3
|
+
import type {
|
|
10
4
|
ScallopAddressParams,
|
|
11
5
|
AddressesInterface,
|
|
12
6
|
AddressStringPath,
|
|
13
7
|
ScallopAddressInstanceParams,
|
|
14
|
-
} from '
|
|
8
|
+
} from '../types';
|
|
15
9
|
import { ScallopCache } from './scallopCache';
|
|
10
|
+
import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
|
|
16
11
|
import axios, { AxiosInstance } from 'axios';
|
|
12
|
+
import { TEST_ADDRESSES } from 'src/constants/testAddress';
|
|
13
|
+
import { queryKeys } from 'src/constants';
|
|
17
14
|
|
|
18
15
|
const EMPTY_ADDRESSES: AddressesInterface = {
|
|
19
16
|
core: {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { normalizeSuiAddress } from '@mysten/sui/utils';
|
|
2
2
|
import { SuiKit } from '@scallop-io/sui-kit';
|
|
3
|
-
import { ADDRESSES_ID
|
|
4
|
-
import { newScallopTxBlock } from '
|
|
3
|
+
import { ADDRESSES_ID } from '../constants';
|
|
4
|
+
import { newScallopTxBlock } from '../builders';
|
|
5
5
|
import { ScallopAddress } from './scallopAddress';
|
|
6
6
|
import { ScallopQuery } from './scallopQuery';
|
|
7
7
|
import { ScallopUtils } from './scallopUtils';
|
|
8
8
|
import type { SuiTransactionBlockResponse } from '@mysten/sui/client';
|
|
9
9
|
import type { Transaction } from '@mysten/sui/transactions';
|
|
10
10
|
import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
11
|
-
import {
|
|
11
|
+
import type {
|
|
12
12
|
ScallopBuilderParams,
|
|
13
13
|
ScallopTxBlock,
|
|
14
14
|
SupportMarketCoins,
|
|
@@ -16,8 +16,9 @@ import {
|
|
|
16
16
|
SupportSCoin,
|
|
17
17
|
ScallopBuilderInstanceParams,
|
|
18
18
|
SelectCoinReturnType,
|
|
19
|
-
} from '
|
|
19
|
+
} from '../types';
|
|
20
20
|
import { ScallopCache } from './scallopCache';
|
|
21
|
+
import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
|
|
21
22
|
import { newSuiKit } from './suiKit';
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -17,13 +17,13 @@ import type {
|
|
|
17
17
|
GetBalanceParams,
|
|
18
18
|
SuiClient,
|
|
19
19
|
} from '@mysten/sui/client';
|
|
20
|
+
import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
|
|
21
|
+
import { callWithRateLimit, TokenBucket } from 'src/utils';
|
|
20
22
|
import {
|
|
21
|
-
DEFAULT_CACHE_OPTIONS,
|
|
22
23
|
DEFAULT_INTERVAL_IN_MS,
|
|
23
24
|
DEFAULT_TOKENS_PER_INTERVAL,
|
|
24
|
-
|
|
25
|
-
} from 'src/constants';
|
|
26
|
-
import { callWithRateLimit, TokenBucket } from 'src/utils';
|
|
25
|
+
} from 'src/constants/tokenBucket';
|
|
26
|
+
import { queryKeys } from 'src/constants';
|
|
27
27
|
|
|
28
28
|
type QueryInspectTxnParams = {
|
|
29
29
|
queryTarget: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { normalizeSuiAddress } from '@mysten/sui/utils';
|
|
2
2
|
import { SuiKit } from '@scallop-io/sui-kit';
|
|
3
|
+
import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
|
|
3
4
|
import {
|
|
4
5
|
ADDRESSES_ID,
|
|
5
|
-
DEFAULT_CACHE_OPTIONS,
|
|
6
6
|
SUPPORT_BORROW_INCENTIVE_POOLS,
|
|
7
7
|
SUPPORT_BORROW_INCENTIVE_REWARDS,
|
|
8
8
|
SUPPORT_SCOIN,
|
|
9
9
|
SUPPORT_SPOOLS,
|
|
10
|
-
} from '
|
|
10
|
+
} from '../constants';
|
|
11
11
|
import { ScallopAddress } from './scallopAddress';
|
|
12
12
|
import { ScallopUtils } from './scallopUtils';
|
|
13
13
|
import { ScallopBuilder } from './scallopBuilder';
|
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
import { ScallopCache } from './scallopCache';
|
|
21
21
|
import { requireSender } from 'src/utils';
|
|
22
22
|
import type { SuiObjectArg } from '@scallop-io/sui-kit';
|
|
23
|
-
import {
|
|
23
|
+
import type {
|
|
24
24
|
ScallopClientFnReturnType,
|
|
25
25
|
ScallopClientParams,
|
|
26
26
|
SupportPoolCoins,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
SupportSCoin,
|
|
34
34
|
ScallopClientVeScaReturnType,
|
|
35
35
|
ScallopClientInstanceParams,
|
|
36
|
-
} from '
|
|
36
|
+
} from '../types';
|
|
37
37
|
import { newSuiKit } from './suiKit';
|
|
38
38
|
|
|
39
39
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios, { AxiosInstance } from 'axios';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { SDK_API_BASE_URL } from '../constants';
|
|
3
|
+
import type {
|
|
4
4
|
Market,
|
|
5
5
|
MarketPools,
|
|
6
6
|
MarketPool,
|
|
@@ -20,8 +20,9 @@ import {
|
|
|
20
20
|
BorrowIncentivePoolPoints,
|
|
21
21
|
SupportBorrowIncentiveRewardCoins,
|
|
22
22
|
ScallopIndexerInstanceParams,
|
|
23
|
-
} from '
|
|
23
|
+
} from '../types';
|
|
24
24
|
import { ScallopCache } from './scallopCache';
|
|
25
|
+
import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
|
|
25
26
|
import { SuiKit } from '@scallop-io/sui-kit';
|
|
26
27
|
import { queryKeys } from 'src/constants';
|
|
27
28
|
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { SuiKit } from '@scallop-io/sui-kit';
|
|
2
|
-
import {
|
|
3
|
-
ADDRESSES_ID,
|
|
4
|
-
SUPPORT_POOLS,
|
|
5
|
-
SUPPORT_SPOOLS,
|
|
6
|
-
DEFAULT_CACHE_OPTIONS,
|
|
7
|
-
} from 'src/constants';
|
|
2
|
+
import { ADDRESSES_ID, SUPPORT_POOLS, SUPPORT_SPOOLS } from '../constants';
|
|
8
3
|
import {
|
|
9
4
|
queryMarket,
|
|
10
5
|
getObligations,
|
|
@@ -39,7 +34,7 @@ import {
|
|
|
39
34
|
getFlashLoanFees,
|
|
40
35
|
getVeSca,
|
|
41
36
|
getBorrowIncentivePools,
|
|
42
|
-
} from '
|
|
37
|
+
} from '../queries';
|
|
43
38
|
import {
|
|
44
39
|
ScallopQueryParams,
|
|
45
40
|
SupportStakeMarketCoins,
|
|
@@ -55,11 +50,12 @@ import {
|
|
|
55
50
|
MarketPool,
|
|
56
51
|
CoinPrices,
|
|
57
52
|
MarketPools,
|
|
58
|
-
} from '
|
|
53
|
+
} from '../types';
|
|
59
54
|
import { ScallopAddress } from './scallopAddress';
|
|
60
55
|
import { ScallopUtils } from './scallopUtils';
|
|
61
56
|
import { ScallopIndexer } from './scallopIndexer';
|
|
62
57
|
import { ScallopCache } from './scallopCache';
|
|
58
|
+
import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
|
|
63
59
|
import { SuiObjectData } from '@mysten/sui/client';
|
|
64
60
|
import {
|
|
65
61
|
getSCoinAmount,
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
COIN_GECKGO_IDS,
|
|
22
22
|
POOL_ADDRESSES,
|
|
23
23
|
sCoinTypeToName,
|
|
24
|
-
} from '
|
|
25
|
-
import { getPythPrices, queryObligation } from '
|
|
24
|
+
} from '../constants';
|
|
25
|
+
import { getPythPrices, queryObligation } from '../queries';
|
|
26
26
|
import {
|
|
27
27
|
parseDataFromPythPriceFeed,
|
|
28
28
|
isMarketCoin,
|
|
@@ -30,15 +30,11 @@ import {
|
|
|
30
30
|
findClosestUnlockRound,
|
|
31
31
|
isSuiBridgeAsset,
|
|
32
32
|
isWormholeAsset,
|
|
33
|
-
} from '
|
|
34
|
-
import {
|
|
35
|
-
DEFAULT_CACHE_OPTIONS,
|
|
36
|
-
PYTH_ENDPOINTS,
|
|
37
|
-
PYTH_FEED_IDS,
|
|
38
|
-
queryKeys,
|
|
39
|
-
} from 'src/constants';
|
|
33
|
+
} from '../utils';
|
|
34
|
+
import { PYTH_ENDPOINTS, PYTH_FEED_IDS } from 'src/constants/pyth';
|
|
40
35
|
import { ScallopCache } from './scallopCache';
|
|
41
|
-
import {
|
|
36
|
+
import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
|
|
37
|
+
import type {
|
|
42
38
|
ScallopUtilsParams,
|
|
43
39
|
SupportCoins,
|
|
44
40
|
SupportAssetCoins,
|
|
@@ -52,7 +48,8 @@ import {
|
|
|
52
48
|
SupportSuiBridgeCoins,
|
|
53
49
|
SupportWormholeCoins,
|
|
54
50
|
PoolAddressInfo,
|
|
55
|
-
} from '
|
|
51
|
+
} from '../types';
|
|
52
|
+
import { queryKeys } from 'src/constants';
|
|
56
53
|
import type { SuiObjectArg, SuiTxArg, SuiTxBlock } from '@scallop-io/sui-kit';
|
|
57
54
|
import { newSuiKit } from './suiKit';
|
|
58
55
|
|
package/src/models/suiKit.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { normalizeStructTag } from '@mysten/sui/utils';
|
|
2
|
-
import { SUPPORT_BORROW_INCENTIVE_POOLS } from '
|
|
2
|
+
import { SUPPORT_BORROW_INCENTIVE_POOLS } from '../constants';
|
|
3
3
|
import {
|
|
4
4
|
parseOriginBorrowIncentivePoolData,
|
|
5
5
|
parseOriginBorrowIncentiveAccountData,
|
|
6
6
|
calculateBorrowIncentivePoolPointData,
|
|
7
|
-
} from '
|
|
8
|
-
import type { ScallopAddress, ScallopQuery, ScallopUtils } from '
|
|
9
|
-
import {
|
|
7
|
+
} from '../utils';
|
|
8
|
+
import type { ScallopAddress, ScallopQuery, ScallopUtils } from '../models';
|
|
9
|
+
import type {
|
|
10
10
|
BorrowIncentivePoolsQueryInterface,
|
|
11
11
|
BorrowIncentivePools,
|
|
12
12
|
BorrowIncentiveAccountsQueryInterface,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
OptionalKeys,
|
|
18
18
|
BorrowIncentivePool,
|
|
19
19
|
CoinPrices,
|
|
20
|
-
} from '
|
|
20
|
+
} from '../types';
|
|
21
21
|
import BigNumber from 'bignumber.js';
|
|
22
22
|
|
|
23
23
|
/**
|
package/src/queries/coreQuery.ts
CHANGED
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
BORROW_FEE_PROTOCOL_ID,
|
|
7
7
|
USE_TEST_ADDRESS,
|
|
8
8
|
FlashLoanFeeObjectMap,
|
|
9
|
-
} from '
|
|
9
|
+
} from '../constants';
|
|
10
10
|
import {
|
|
11
11
|
parseOriginMarketPoolData,
|
|
12
12
|
calculateMarketPoolData,
|
|
13
13
|
parseOriginMarketCollateralData,
|
|
14
14
|
calculateMarketCollateralData,
|
|
15
|
-
} from '
|
|
15
|
+
} from '../utils';
|
|
16
16
|
import type { SuiObjectResponse, SuiObjectData } from '@mysten/sui/client';
|
|
17
17
|
import type { SuiObjectArg } from '@scallop-io/sui-kit';
|
|
18
|
-
import type { ScallopAddress, ScallopCache, ScallopQuery } from '
|
|
18
|
+
import type { ScallopAddress, ScallopCache, ScallopQuery } from '../models';
|
|
19
19
|
import {
|
|
20
20
|
Market,
|
|
21
21
|
MarketPools,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
SupportMarketCoins,
|
|
37
37
|
OptionalKeys,
|
|
38
38
|
CoinPrices,
|
|
39
|
-
} from '
|
|
39
|
+
} from '../types';
|
|
40
40
|
import BigNumber from 'bignumber.js';
|
|
41
41
|
import { getSupplyLimit } from './supplyLimitQuery';
|
|
42
42
|
// import { isIsolatedAsset } from './isolatedAsset';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DynamicFieldInfo, DynamicFieldName } from '@mysten/sui/client';
|
|
2
|
-
import { ScallopAddress, ScallopUtils } from '
|
|
3
|
-
import { SupportPoolCoins } from '
|
|
2
|
+
import { ScallopAddress, ScallopUtils } from '../models';
|
|
3
|
+
import { SupportPoolCoins } from '../types';
|
|
4
4
|
import { z as zod } from 'zod';
|
|
5
5
|
|
|
6
6
|
const isolatedAssetZod = zod.object({
|