@scallop-io/sui-scallop-sdk 3.0.2 → 4.1.0
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/Logger-Cg2iFdpH.d.ts +8 -0
- package/dist/builder.cjs +22 -0
- package/dist/builder.d.cts +28 -0
- package/dist/builder.d.ts +28 -0
- package/dist/builder.js +4 -0
- package/dist/chunk-33AK5RWM.js +15 -0
- package/dist/chunk-6UQ4NWEU.js +3 -0
- package/dist/chunk-DIC6P5HB.js +11 -0
- package/dist/chunk-S34VOEZN.js +3 -0
- package/dist/chunk-VTGQACWU.js +6 -0
- package/dist/client.cjs +21 -0
- package/dist/client.d.cts +401 -0
- package/dist/client.d.ts +401 -0
- package/dist/client.js +5 -0
- package/dist/errors.cjs +10 -0
- package/dist/errors.d.cts +32 -0
- package/dist/errors.d.ts +32 -0
- package/dist/errors.js +1 -0
- package/dist/index.cjs +51 -34
- package/dist/index.d.cts +130 -3145
- package/dist/index.d.ts +130 -3145
- package/dist/index.js +8 -12
- package/dist/logger.cjs +6 -0
- package/dist/logger.d.cts +7 -0
- package/dist/logger.d.ts +7 -0
- package/dist/logger.js +1 -0
- package/dist/query-DkitepDi.d.ts +3305 -0
- package/dist/query.cjs +19 -0
- package/dist/query.d.cts +9 -0
- package/dist/query.d.ts +9 -0
- package/dist/query.js +3 -0
- package/dist/types.cjs +2 -0
- package/dist/types.d.cts +90 -0
- package/dist/types.d.ts +90 -0
- package/dist/types.js +1 -0
- package/package.json +98 -56
- package/src/constants/api.ts +2 -0
- package/src/constants/coinType.ts +2 -0
- package/src/constants/common.ts +0 -7
- package/src/constants/index.ts +2 -0
- package/src/constants/queryKeys.ts +14 -7
- package/src/constants/testAddress.ts +1 -0
- package/src/datasources/api.ts +34 -0
- package/src/datasources/indexer.ts +8 -0
- package/src/datasources/onchain.ts +121 -0
- package/src/entries/builder.ts +5 -0
- package/src/entries/client.ts +3 -0
- package/src/entries/errors.ts +2 -0
- package/src/entries/index.ts +17 -0
- package/src/entries/logger.ts +2 -0
- package/src/entries/query.ts +6 -0
- package/src/entries/types.ts +2 -0
- package/src/errors/ScallopConfigError.ts +8 -0
- package/src/errors/ScallopError.ts +30 -0
- package/src/errors/ScallopIndexerError.ts +8 -0
- package/src/errors/ScallopParseError.ts +8 -0
- package/src/errors/ScallopRpcError.ts +8 -0
- package/src/errors/ScallopTransactionBuildError.ts +8 -0
- package/src/errors/index.ts +6 -0
- package/src/logger/Logger.ts +6 -0
- package/src/logger/consoleLogger.ts +13 -0
- package/src/logger/index.ts +3 -0
- package/src/logger/noopLogger.ts +8 -0
- package/src/mappers/index.ts +1 -0
- package/src/mappers/moveTypeMapper.ts +48 -0
- package/src/models/index.ts +8 -10
- package/src/models/interface.ts +9 -9
- package/src/models/scallop.ts +9 -16
- package/src/models/scallopAddress/const.ts +416 -0
- package/src/models/scallopAddress/index.ts +188 -0
- package/src/models/scallopAddress/types.ts +212 -0
- package/src/models/{scallopBuilder.ts → scallopBuilder/index.ts} +65 -29
- package/src/models/scallopBuilder/types.ts +37 -0
- package/src/models/{scallopClient.ts → scallopClient/index.ts} +157 -598
- package/src/models/scallopClient/types.ts +25 -0
- package/src/models/scallopConstants/config/AddressConfigSource.ts +13 -0
- package/src/models/scallopConstants/config/ConfigValidator.ts +70 -0
- package/src/models/scallopConstants/config/PoolAddressConfigSource.ts +12 -0
- package/src/models/scallopConstants/config/ScallopConfig.ts +80 -0
- package/src/models/scallopConstants/config/ScallopConfigSnapshot.ts +46 -0
- package/src/models/scallopConstants/config/WhitelistConfigSource.ts +16 -0
- package/src/models/scallopConstants/config/index.ts +6 -0
- package/src/models/scallopConstants/const.ts +19 -0
- package/src/models/scallopConstants/constantsSource.ts +98 -0
- package/src/models/scallopConstants/deriveConstants.ts +150 -0
- package/src/models/scallopConstants/index.ts +257 -0
- package/src/models/scallopConstants/loadConstantsState.ts +135 -0
- package/src/models/scallopConstants/types.ts +77 -0
- package/src/models/scallopConstants/utils.ts +69 -0
- package/src/models/scallopQuery/index.ts +1279 -0
- package/src/models/scallopQuery/types.ts +9 -0
- package/src/models/scallopQuery/utils.ts +13 -0
- package/src/models/scallopUtils/index.ts +505 -0
- package/src/models/scallopUtils/types.ts +30 -0
- package/src/models/transactionExecutor.ts +122 -0
- package/src/repositories/addressApi/helpers.ts +14 -0
- package/src/repositories/addressApi/index.ts +24 -0
- package/src/repositories/addressApi/schema.ts +0 -0
- package/src/repositories/addressApi/types.ts +177 -0
- package/src/repositories/base.ts +38 -0
- package/src/repositories/borrowIncentive/bcs.ts +11 -0
- package/src/repositories/borrowIncentive/helpers.ts +396 -0
- package/src/repositories/borrowIncentive/index.ts +52 -0
- package/src/{types/query/borrowIncentive.ts → repositories/borrowIncentive/types.ts} +69 -23
- package/src/repositories/borrowIncentive/utils.ts +234 -0
- package/src/repositories/cache.ts +4 -0
- package/src/repositories/coinBalance/helpers.ts +394 -0
- package/src/repositories/coinBalance/index.ts +69 -0
- package/src/repositories/coinBalance/types.ts +33 -0
- package/src/repositories/flashloan/const.ts +3 -0
- package/src/repositories/flashloan/helpers.ts +107 -0
- package/src/repositories/flashloan/index.ts +34 -0
- package/src/repositories/flashloan/types.ts +16 -0
- package/src/repositories/isolatedAssets/bcs.ts +4 -0
- package/src/repositories/isolatedAssets/const.ts +2 -0
- package/src/repositories/isolatedAssets/helpers.ts +91 -0
- package/src/repositories/isolatedAssets/index.ts +42 -0
- package/src/repositories/isolatedAssets/types.ts +35 -0
- package/src/repositories/loyaltyProgram/bcs.ts +7 -0
- package/src/repositories/loyaltyProgram/helpers.ts +117 -0
- package/src/repositories/loyaltyProgram/index.ts +28 -0
- package/src/repositories/loyaltyProgram/schema.ts +18 -0
- package/src/repositories/loyaltyProgram/types.ts +37 -0
- package/src/repositories/market/const.ts +6 -0
- package/src/repositories/market/helpers.ts +740 -0
- package/src/repositories/market/index.ts +137 -0
- package/src/repositories/market/mapper.ts +30 -0
- package/src/repositories/market/types.ts +443 -0
- package/src/repositories/market/utils.ts +285 -0
- package/src/repositories/obligation/helpers.ts +228 -0
- package/src/repositories/obligation/index.ts +51 -0
- package/src/repositories/obligation/types.ts +71 -0
- package/src/repositories/obligation/utils.ts +57 -0
- package/src/repositories/poolAddresses/const.ts +5 -0
- package/src/repositories/poolAddresses/helpers.ts +422 -0
- package/src/repositories/poolAddresses/index.ts +56 -0
- package/src/repositories/poolAddresses/schema.ts +34 -0
- package/src/repositories/poolAddresses/types.ts +69 -0
- package/src/repositories/price/const.ts +1 -0
- package/src/repositories/price/helpers.ts +237 -0
- package/src/repositories/price/index.ts +91 -0
- package/src/repositories/price/schema.ts +24 -0
- package/src/repositories/price/types.ts +56 -0
- package/src/repositories/price/utils.ts +21 -0
- package/src/repositories/referral/bcs.ts +3 -0
- package/src/repositories/referral/helper.ts +24 -0
- package/src/repositories/referral/index.ts +31 -0
- package/src/repositories/referral/types.ts +33 -0
- package/src/repositories/spool/const.ts +1 -0
- package/src/repositories/spool/helpers.ts +471 -0
- package/src/repositories/spool/index.ts +135 -0
- package/src/{types/query/spool.ts → repositories/spool/types.ts} +67 -2
- package/src/repositories/spool/utils.ts +215 -0
- package/src/repositories/types.ts +39 -0
- package/src/repositories/utils.ts +137 -0
- package/src/repositories/veSca/bcs.ts +6 -0
- package/src/repositories/veSca/helpers.ts +341 -0
- package/src/repositories/veSca/index.ts +57 -0
- package/src/repositories/veSca/types.ts +79 -0
- package/src/repositories/veScaLoyaltyProgram/bcs.ts +3 -0
- package/src/repositories/veScaLoyaltyProgram/helpers.ts +135 -0
- package/src/repositories/veScaLoyaltyProgram/index.ts +28 -0
- package/src/repositories/veScaLoyaltyProgram/schema.ts +15 -0
- package/src/repositories/veScaLoyaltyProgram/types.ts +47 -0
- package/src/repositories/wiring/datasources.ts +42 -0
- package/src/repositories/wiring/metadata.ts +292 -0
- package/src/repositories/wiring/registry.ts +194 -0
- package/src/repositories/wiring/source.ts +63 -0
- package/src/repositories/xOracle/bcs.ts +7 -0
- package/src/repositories/xOracle/const.ts +1 -0
- package/src/repositories/xOracle/helpers.ts +304 -0
- package/src/repositories/xOracle/index.ts +45 -0
- package/src/repositories/xOracle/types.ts +96 -0
- package/src/repositories/xOracle/utils.ts +3 -0
- package/src/services/client/BorrowService.ts +229 -0
- package/src/services/client/CollateralService.ts +76 -0
- package/src/services/client/LendingService.ts +75 -0
- package/src/services/client/ReferralService.ts +71 -0
- package/src/services/client/SpoolService.ts +170 -0
- package/src/services/client/VeScaService.ts +142 -0
- package/src/services/client/types.ts +44 -0
- package/src/services/index.ts +8 -0
- package/src/services/query/portfolioCalculations.ts +1171 -0
- package/src/txBuilders/borrowIncentive/index.ts +80 -0
- package/src/txBuilders/borrowIncentive/moveCalls.ts +124 -0
- package/src/txBuilders/borrowIncentive/quick.ts +207 -0
- package/src/txBuilders/context.ts +62 -0
- package/src/txBuilders/core/index.ts +95 -0
- package/src/txBuilders/core/moveCalls.ts +241 -0
- package/src/txBuilders/core/quick.ts +306 -0
- package/src/{builders → txBuilders}/index.ts +35 -9
- package/src/txBuilders/loyaltyProgram/index.ts +78 -0
- package/src/txBuilders/loyaltyProgram/moveCalls.ts +44 -0
- package/src/txBuilders/loyaltyProgram/quick.ts +58 -0
- package/src/txBuilders/manifest.ts +160 -0
- package/src/txBuilders/modules.ts +70 -0
- package/src/{builders → txBuilders}/oracles/index.ts +3 -2
- package/src/{builders → txBuilders}/oracles/pyth.ts +4 -3
- package/src/txBuilders/referral/index.ts +72 -0
- package/src/txBuilders/referral/moveCalls.ts +93 -0
- package/src/txBuilders/referral/quick.ts +57 -0
- package/src/txBuilders/sCoin/index.ts +72 -0
- package/src/txBuilders/sCoin/moveCalls.ts +36 -0
- package/src/txBuilders/sCoin/quick.ts +34 -0
- package/src/txBuilders/spool/index.ts +82 -0
- package/src/txBuilders/spool/moveCalls.ts +79 -0
- package/src/{builders/spoolBuilder.ts → txBuilders/spool/quick.ts} +22 -162
- package/src/txBuilders/utils.ts +36 -0
- package/src/txBuilders/verify.ts +45 -0
- package/src/txBuilders/vesca/index.ts +75 -0
- package/src/txBuilders/vesca/moveCalls.ts +147 -0
- package/src/{builders/vescaBuilder.ts → txBuilders/vesca/quick.ts} +85 -274
- package/src/types/address.ts +4 -178
- package/src/types/builder/borrowIncentive.ts +4 -3
- package/src/types/builder/core.ts +6 -33
- package/src/types/builder/index.ts +5 -1
- package/src/types/builder/loyaltyProgram.ts +4 -3
- package/src/types/builder/modules.ts +49 -0
- package/src/types/builder/referral.ts +5 -4
- package/src/types/builder/sCoin.ts +20 -2
- package/src/types/builder/spool.ts +22 -2
- package/src/types/builder/vesca.ts +4 -12
- package/src/types/constant/index.ts +3 -1
- package/src/types/constant/queryKeys.ts +15 -8
- package/src/types/index.ts +5 -6
- package/src/types/internal/dto.ts +46 -0
- package/src/types/internal/index.ts +2 -0
- package/src/types/internal/move.ts +13 -0
- package/src/types/public/index.ts +21 -0
- package/src/types/query/core.ts +0 -317
- package/src/types/query/index.ts +3 -4
- package/src/types/query/portfolio.ts +2 -15
- package/src/types/repositories/borrowIncentive.ts +12 -0
- package/src/types/repositories/index.ts +9 -0
- package/src/types/repositories/loyaltyProgram.ts +2 -0
- package/src/types/repositories/market.ts +13 -0
- package/src/types/repositories/spool.ts +21 -0
- package/src/types/repositories/veSca.ts +5 -0
- package/src/types/repositories/veScaLoyaltyProgram.ts +2 -0
- package/src/types/sui.ts +0 -1
- package/src/utils/array.ts +7 -0
- package/src/utils/cache.ts +17 -0
- package/src/utils/object.ts +30 -12
- package/src/utils/query.ts +9 -190
- package/src/utils/vesca.ts +0 -8
- package/src/builders/borrowIncentiveBuilder.ts +0 -372
- package/src/builders/coreBuilder.ts +0 -636
- package/src/builders/loyaltyProgramBuilder.ts +0 -142
- package/src/builders/referralBuilder.ts +0 -192
- package/src/builders/sCoinBuilder.ts +0 -124
- package/src/index.ts +0 -13
- package/src/models/scallopAddress.ts +0 -841
- package/src/models/scallopAxios.ts +0 -185
- package/src/models/scallopConstants.ts +0 -380
- package/src/models/scallopIndexer.ts +0 -226
- package/src/models/scallopQuery.ts +0 -974
- package/src/models/scallopQueryClient.ts +0 -29
- package/src/models/scallopSuiKit.ts +0 -480
- package/src/models/scallopUtils.ts +0 -734
- package/src/queries/borrowIncentiveQuery.ts +0 -361
- package/src/queries/borrowLimitQuery.ts +0 -33
- package/src/queries/coreQuery.ts +0 -1173
- package/src/queries/flashloanFeeQuery.ts +0 -92
- package/src/queries/index.ts +0 -15
- package/src/queries/isolatedAssetQuery.ts +0 -103
- package/src/queries/loyaltyProgramQuery.ts +0 -178
- package/src/queries/ownerQuery.ts +0 -32
- package/src/queries/poolAddressesQuery.ts +0 -340
- package/src/queries/portfolioQuery.ts +0 -1149
- package/src/queries/priceQuery.ts +0 -37
- package/src/queries/referralQuery.ts +0 -42
- package/src/queries/sCoinQuery.ts +0 -195
- package/src/queries/spoolQuery.ts +0 -542
- package/src/queries/supplyLimitQuery.ts +0 -32
- package/src/queries/switchboardQuery.ts +0 -65
- package/src/queries/vescaQuery.ts +0 -312
- package/src/queries/xOracleQuery.ts +0 -149
- package/src/types/constant/common.ts +0 -55
- package/src/types/query/loyaltyProgram.ts +0 -12
- package/src/types/query/vesca.ts +0 -27
- package/src/utils/index.ts +0 -7
- package/src/utils/indexer.ts +0 -47
- /package/src/{models → datasources}/rateLimiter.ts +0 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { S as ScallopBuilder, f as ScallopQuery, g as ScallopUtils, h as ScallopConstants, be as TransactionExecutor, bf as DefaultTxInclude, a as ScallopTxBlock, e as SuiObjectData, b as ScallopBuilderConstructorParams, bg as ScallopClientInterface, bh as OnChainDataSource, aw as ScallopAddress } from './query-DkitepDi.js';
|
|
2
|
+
import * as _scallop_io_sui_kit from '@scallop-io/sui-kit';
|
|
3
|
+
import { SuiObjectArg, SuiTransactionBlockResponse, NetworkType } from '@scallop-io/sui-kit';
|
|
4
|
+
import { Transaction, TransactionObjectArgument, TransactionResult } from '@mysten/sui/transactions';
|
|
5
|
+
import { SuiClientTypes } from '@mysten/sui/client';
|
|
6
|
+
import '@tanstack/query-core';
|
|
7
|
+
import './Logger-Cg2iFdpH.js';
|
|
8
|
+
import 'axios';
|
|
9
|
+
import '@mysten/sui/cryptography';
|
|
10
|
+
import '@pythnetwork/pyth-sui-js';
|
|
11
|
+
|
|
12
|
+
type ClientTxResult<S extends boolean, Include extends DefaultTxInclude = DefaultTxInclude> = S extends true ? SuiClientTypes.TransactionResult<Include> : Transaction;
|
|
13
|
+
/**
|
|
14
|
+
* The exact surface that client-side application services consume. Derived
|
|
15
|
+
* structurally from the concrete model classes so the types stay in sync.
|
|
16
|
+
*
|
|
17
|
+
* `ScallopClient` is structurally assignable to this interface (it already
|
|
18
|
+
* exposes every member via fields/getters), which lets services accept either
|
|
19
|
+
* a `ScallopClient` or a hand-built fake without depending on the concrete
|
|
20
|
+
* class.
|
|
21
|
+
*/
|
|
22
|
+
interface ClientServiceContext {
|
|
23
|
+
readonly walletAddress: string;
|
|
24
|
+
readonly builder: Pick<ScallopBuilder, 'createTxBlock'>;
|
|
25
|
+
readonly query: Pick<ScallopQuery, 'getObligations' | 'getObligationAccount' | 'getStakeAccounts' | 'getVeScas'>;
|
|
26
|
+
readonly utils: Pick<ScallopUtils, 'logger' | 'mergeSimilarCoins' | 'parseCoinName' | 'parseCoinType' | 'parseMarketCoinName' | 'parseSCoinType'>;
|
|
27
|
+
readonly constants: Pick<ScallopConstants, 'whitelist'>;
|
|
28
|
+
readonly executor: TransactionExecutor;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare class CollateralService {
|
|
32
|
+
private readonly ctx;
|
|
33
|
+
constructor(ctx: ClientServiceContext);
|
|
34
|
+
depositCollateral<S extends boolean>(collateralCoinName: string, amount: number, sign?: S, obligationId?: string, walletAddress?: string, isSponsoredTx?: boolean): Promise<ClientTxResult<S>>;
|
|
35
|
+
withdrawCollateral<S extends boolean>(collateralCoinName: string, amount: number, sign?: S, obligationId?: string, obligationKey?: string, walletAddress?: string, isSponsoredTx?: boolean): Promise<ClientTxResult<S>>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare class LendingService {
|
|
39
|
+
private readonly ctx;
|
|
40
|
+
constructor(ctx: ClientServiceContext);
|
|
41
|
+
supply<S extends boolean>(poolCoinName: string, amount: number, sign?: S, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
42
|
+
withdraw<S extends boolean>(poolCoinName: string, amount: number, sign?: S, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
43
|
+
flashLoan<S extends boolean>(poolCoinName: string, amount: number, callback: (txBlock: ScallopTxBlock, coin: TransactionObjectArgument | string) => SuiObjectArg | Promise<SuiObjectArg>, sign?: S, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Application service for borrow-side lifecycle operations:
|
|
48
|
+
* - obligation creation
|
|
49
|
+
* - borrow / repay
|
|
50
|
+
* - supply + auto-stake convenience
|
|
51
|
+
* - borrow-incentive stake / unstake / claim
|
|
52
|
+
*
|
|
53
|
+
* Each method preserves the public ScallopClient signature one-to-one.
|
|
54
|
+
*/
|
|
55
|
+
declare class BorrowService {
|
|
56
|
+
private readonly ctx;
|
|
57
|
+
constructor(ctx: ClientServiceContext);
|
|
58
|
+
openObligation<S extends boolean>(sign?: S): Promise<ClientTxResult<S>>;
|
|
59
|
+
borrow<S extends boolean>(poolCoinName: string, amount: number, sign: S | undefined, obligationId: string, obligationKey: string, walletAddress?: string, isSponsoredTx?: boolean): Promise<ClientTxResult<S>>;
|
|
60
|
+
repay<S extends boolean>(poolCoinName: string, amount: number, sign: S | undefined, obligationId: string, obligationKey: string, walletAddress?: string, isSponsoredTx?: boolean): Promise<ClientTxResult<S>>;
|
|
61
|
+
supplyAndStake<S extends boolean>(stakeCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
62
|
+
stakeObligation<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
63
|
+
unstakeObligation<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
64
|
+
claimBorrowIncentive<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Application service for spool lifecycle:
|
|
69
|
+
* - createStakeAccount
|
|
70
|
+
* - stake / unstake
|
|
71
|
+
* - unstake + auto-withdraw convenience
|
|
72
|
+
* - claim spool rewards
|
|
73
|
+
*/
|
|
74
|
+
declare class SpoolService {
|
|
75
|
+
private readonly ctx;
|
|
76
|
+
constructor(ctx: ClientServiceContext);
|
|
77
|
+
createStakeAccount<S extends boolean>(marketCoinName: string, sign?: S, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
78
|
+
stake<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
79
|
+
unstake<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
80
|
+
unstakeAndWithdraw<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
81
|
+
claim<S extends boolean>(stakeMarketCoinName: string, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type VeScaClaimResult<S extends boolean> = S extends true ? SuiTransactionBlockResponse : {
|
|
85
|
+
tx: Transaction;
|
|
86
|
+
scaCoin: TransactionResult;
|
|
87
|
+
};
|
|
88
|
+
type SignedOrTx<S extends boolean> = S extends true ? SuiTransactionBlockResponse : Transaction;
|
|
89
|
+
/**
|
|
90
|
+
* Application service for veSCA operations:
|
|
91
|
+
* - lock / extend / claim helpers (thin wrappers over the tx-block quick
|
|
92
|
+
* methods, so callers can stay on the service object instead of touching
|
|
93
|
+
* `tx` directly).
|
|
94
|
+
* - claim-all-unlocked-SCA aggregation across every veSCA owned by the
|
|
95
|
+
* wallet (parity with the legacy ScallopClient method).
|
|
96
|
+
*/
|
|
97
|
+
declare class VeScaService {
|
|
98
|
+
private readonly ctx;
|
|
99
|
+
constructor(ctx: ClientServiceContext);
|
|
100
|
+
lockSca<S extends boolean>(params: {
|
|
101
|
+
amountOrCoin?: SuiObjectArg | number;
|
|
102
|
+
lockPeriodInDays?: number;
|
|
103
|
+
autoCheck?: boolean;
|
|
104
|
+
veScaKey?: SuiObjectData | string;
|
|
105
|
+
}, sign?: S, walletAddress?: string): Promise<SignedOrTx<S>>;
|
|
106
|
+
extendLockPeriod<S extends boolean>(params: {
|
|
107
|
+
lockPeriodInDays: number;
|
|
108
|
+
autoCheck?: boolean;
|
|
109
|
+
veScaKey?: SuiObjectData | string;
|
|
110
|
+
}, sign?: S, walletAddress?: string): Promise<SignedOrTx<S>>;
|
|
111
|
+
extendLockAmount<S extends boolean>(params: {
|
|
112
|
+
scaAmount: number;
|
|
113
|
+
autoCheck?: boolean;
|
|
114
|
+
veScaKey?: SuiObjectData | string;
|
|
115
|
+
}, sign?: S, walletAddress?: string): Promise<SignedOrTx<S>>;
|
|
116
|
+
claimAllUnlockedSca<S extends boolean>(sign?: S, walletAddress?: string): Promise<VeScaClaimResult<S>>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Application service for referral lifecycle:
|
|
121
|
+
* - bindToReferral
|
|
122
|
+
* - claimReferralRevenue
|
|
123
|
+
* - burnReferralTicket
|
|
124
|
+
*
|
|
125
|
+
* Thin wrappers around the tx-block referral methods so callers can stay on
|
|
126
|
+
* the service object instead of touching `tx` directly.
|
|
127
|
+
*/
|
|
128
|
+
declare class ReferralService {
|
|
129
|
+
private readonly ctx;
|
|
130
|
+
constructor(ctx: ClientServiceContext);
|
|
131
|
+
bindToReferral<S extends boolean>(veScaKeyId: string, sign?: S, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
132
|
+
claimReferralRevenue<S extends boolean>(veScaKey: SuiObjectArg, coinNames?: string[], sign?: S, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
133
|
+
burnReferralTicket<S extends boolean>(ticket: SuiObjectArg, poolCoinName: string, sign?: S, walletAddress?: string): Promise<ClientTxResult<S>>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
type ScallopClientConstructorParams = {
|
|
137
|
+
networkType?: SuiClientTypes.Network;
|
|
138
|
+
builder?: ScallopBuilder;
|
|
139
|
+
} & ScallopBuilderConstructorParams;
|
|
140
|
+
type ScallopClientFnReturnType<T extends boolean, Include extends DefaultTxInclude = DefaultTxInclude> = T extends true ? SuiClientTypes.TransactionResult<Include> : Transaction;
|
|
141
|
+
type ScallopClientVeScaReturnType<T extends boolean, Include extends DefaultTxInclude = DefaultTxInclude> = T extends true ? SuiClientTypes.TransactionResult<Include> : {
|
|
142
|
+
tx: Transaction;
|
|
143
|
+
scaCoin: TransactionResult;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @description
|
|
148
|
+
* It provides contract interaction operations for general users.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* const scallopClient = new ScallopClient(<parameters>);
|
|
153
|
+
* await scallopClient.init();
|
|
154
|
+
* scallopClient.<client functions>();
|
|
155
|
+
* await scallopClient.<client async functions>();
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
declare class ScallopClient implements ScallopClientInterface {
|
|
159
|
+
readonly builder: ScallopBuilder;
|
|
160
|
+
readonly collateralService: CollateralService;
|
|
161
|
+
readonly lendingService: LendingService;
|
|
162
|
+
readonly borrowService: BorrowService;
|
|
163
|
+
readonly spoolService: SpoolService;
|
|
164
|
+
readonly veScaService: VeScaService;
|
|
165
|
+
readonly referralService: ReferralService;
|
|
166
|
+
networkType: NetworkType;
|
|
167
|
+
constructor({ builder, networkType, ...scallopBuilderArgs }: ScallopClientConstructorParams);
|
|
168
|
+
get query(): ScallopQuery;
|
|
169
|
+
get utils(): ScallopUtils;
|
|
170
|
+
get constants(): ScallopConstants;
|
|
171
|
+
get walletAddress(): string;
|
|
172
|
+
get suiKit(): _scallop_io_sui_kit.SuiKit;
|
|
173
|
+
get onchain(): OnChainDataSource;
|
|
174
|
+
get executor(): TransactionExecutor;
|
|
175
|
+
get address(): ScallopAddress;
|
|
176
|
+
/**
|
|
177
|
+
* Request the scallop API to initialize data.
|
|
178
|
+
*
|
|
179
|
+
* @param force - Whether to force initialization.
|
|
180
|
+
*/
|
|
181
|
+
init(force?: boolean): Promise<void>;
|
|
182
|
+
/**
|
|
183
|
+
* Open obligation.
|
|
184
|
+
*
|
|
185
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
186
|
+
* @return Transaction block response or transaction block.
|
|
187
|
+
*/
|
|
188
|
+
openObligation(): Promise<SuiTransactionBlockResponse>;
|
|
189
|
+
openObligation<S extends boolean>(sign?: S): Promise<ScallopClientFnReturnType<S>>;
|
|
190
|
+
/**
|
|
191
|
+
* Deposit collateral into the specific pool.
|
|
192
|
+
*
|
|
193
|
+
* @param collateralCoinName - Types of collateral coin.
|
|
194
|
+
* @param amount - The amount of coins would deposit.
|
|
195
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
196
|
+
* @param obligationId - The obligation object.
|
|
197
|
+
* @param walletAddress - The wallet address of the owner.
|
|
198
|
+
* @param isSponsoredTx - Whether the transaction is sponsored.
|
|
199
|
+
* @return Transaction block response or transaction block.
|
|
200
|
+
*/
|
|
201
|
+
depositCollateral(collateralCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
202
|
+
depositCollateral<S extends boolean>(collateralCoinName: string, amount: number, sign?: S, obligationId?: string, walletAddress?: string, isSponsoredTx?: boolean): Promise<ScallopClientFnReturnType<S>>;
|
|
203
|
+
/**
|
|
204
|
+
* Withdraw collateral from the specific pool.
|
|
205
|
+
*
|
|
206
|
+
* @param collateralCoinName - Types of collateral coin.
|
|
207
|
+
* @param amount - The amount of coins would deposit.
|
|
208
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
209
|
+
* @param obligationId - The obligation object.
|
|
210
|
+
* @param obligationKey - The obligation key object to verifying obligation authority.
|
|
211
|
+
* @param walletAddress - The wallet address of the owner.
|
|
212
|
+
* @param isSponsoredTx - Whether the transaction is sponsored.
|
|
213
|
+
* @return Transaction block response or transaction block.
|
|
214
|
+
*/
|
|
215
|
+
withdrawCollateral(collateralCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
216
|
+
withdrawCollateral<S extends boolean>(collateralCoinName: string, amount: number, sign?: S, obligationId?: string, obligationKey?: string, walletAddress?: string, isSponsoredTx?: boolean): Promise<ScallopClientFnReturnType<S>>;
|
|
217
|
+
/**
|
|
218
|
+
* Supply asset into the specific lending pool.
|
|
219
|
+
*
|
|
220
|
+
* @param poolCoinName - Types of pool coin.
|
|
221
|
+
* @param amount - The amount of coins would deposit.
|
|
222
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
223
|
+
* @param walletAddress - The wallet address of the owner.
|
|
224
|
+
* @return Transaction block response or transaction block.
|
|
225
|
+
*/
|
|
226
|
+
supply(poolCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
227
|
+
supply<S extends boolean>(poolCoinName: string, amount: number, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
228
|
+
/**
|
|
229
|
+
* Supply asset into the specific lending pool and stake market coin into the corresponding staking pool (spool).
|
|
230
|
+
*
|
|
231
|
+
* @param stakeCoinName - Types of stake coin.
|
|
232
|
+
* @param amount - The amount of coins would supply.
|
|
233
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
234
|
+
* @param stakeAccountId - The stake account object.
|
|
235
|
+
* @param walletAddress - The wallet address of the owner.
|
|
236
|
+
* @return Transaction block response or transaction block.
|
|
237
|
+
*/
|
|
238
|
+
supplyAndStake(stakeCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
239
|
+
supplyAndStake<S extends boolean>(stakeCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
240
|
+
/**
|
|
241
|
+
* Withdraw asset from the specific lending pool, must return market coin.
|
|
242
|
+
*
|
|
243
|
+
* @param poolCoinName - Specific support pool coin name.
|
|
244
|
+
* @param amount - The amount of coins would withdraw.
|
|
245
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
246
|
+
* @param walletAddress - The wallet address of the owner.
|
|
247
|
+
* @return Transaction block response or transaction block.
|
|
248
|
+
*/
|
|
249
|
+
withdraw(poolCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
250
|
+
withdraw<S extends boolean>(poolCoinName: string, amount: number, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
251
|
+
/**
|
|
252
|
+
* Borrow asset from the specific pool.
|
|
253
|
+
*
|
|
254
|
+
* @param poolCoinName - Specific support pool coin name.
|
|
255
|
+
* @param amount - The amount of coins would borrow.
|
|
256
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
257
|
+
* @param obligationId - The obligation object.
|
|
258
|
+
* @param obligationKey - The obligation key object to verifying obligation authority.
|
|
259
|
+
* @param walletAddress - The wallet address of the owner.
|
|
260
|
+
* @param isSponsoredTx - Whether the transaction is sponsored.
|
|
261
|
+
* @return Transaction block response or transaction block.
|
|
262
|
+
*/
|
|
263
|
+
borrow<S extends boolean>(poolCoinName: string, amount: number, sign: S | undefined, obligationId: string, obligationKey: string, walletAddress?: string, isSponsoredTx?: boolean): Promise<ScallopClientFnReturnType<S>>;
|
|
264
|
+
/**
|
|
265
|
+
* Repay asset into the specific pool.
|
|
266
|
+
*
|
|
267
|
+
* @param poolCoinName - Specific support pool coin name.
|
|
268
|
+
* @param amount - The amount of coins would repay.
|
|
269
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
270
|
+
* @param obligationId - The obligation object.
|
|
271
|
+
* @param walletAddress - The wallet address of the owner.
|
|
272
|
+
* @param isSponsoredTx - Whether the transaction is sponsored.
|
|
273
|
+
* @return Transaction block response or transaction block.
|
|
274
|
+
*/
|
|
275
|
+
repay<S extends boolean>(poolCoinName: string, amount: number, sign: S | undefined, obligationId: string, obligationKey: string, walletAddress?: string, isSponsoredTx?: boolean): Promise<ScallopClientFnReturnType<S>>;
|
|
276
|
+
/**
|
|
277
|
+
* FlashLoan asset from the specific pool.
|
|
278
|
+
*
|
|
279
|
+
* @param poolCoinName - Specific support pool coin name..
|
|
280
|
+
* @param amount - The amount of coins would repay.
|
|
281
|
+
* @param callback - The callback function to build transaction block and return coin argument.
|
|
282
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
283
|
+
* @return Transaction block response or transaction block.
|
|
284
|
+
*/
|
|
285
|
+
flashLoan(poolCoinName: string, amount: number, callback: (txBlock: ScallopTxBlock, coin: TransactionObjectArgument | string) => SuiObjectArg): Promise<SuiTransactionBlockResponse>;
|
|
286
|
+
flashLoan<S extends boolean>(poolCoinName: string, amount: number, callback: (txBlock: ScallopTxBlock, coin: TransactionObjectArgument | string) => SuiObjectArg, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
287
|
+
/**
|
|
288
|
+
* Create stake account.
|
|
289
|
+
*
|
|
290
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
291
|
+
* @param walletAddress - The wallet address of the owner.
|
|
292
|
+
* @return Transaction block response or transaction block.
|
|
293
|
+
*/
|
|
294
|
+
createStakeAccount(marketCoinName: string): Promise<SuiTransactionBlockResponse>;
|
|
295
|
+
createStakeAccount<S extends boolean>(marketCoinName: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
296
|
+
/**
|
|
297
|
+
* Stake market coin into the specific spool.
|
|
298
|
+
*
|
|
299
|
+
* @param marketCoinName - Types of market coin.
|
|
300
|
+
* @param amount - The amount of coins would deposit.
|
|
301
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
302
|
+
* @param stakeAccountId - The stake account object.
|
|
303
|
+
* @param walletAddress - The wallet address of the owner.
|
|
304
|
+
* @return Transaction block response or transaction block.
|
|
305
|
+
*/
|
|
306
|
+
stake(stakeMarketCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
307
|
+
stake<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
308
|
+
/**
|
|
309
|
+
* Unstake market coin from the specific spool.
|
|
310
|
+
*
|
|
311
|
+
* @param stakeMarketCoinName - Types of mak coin.
|
|
312
|
+
* @param amount - The amount of coins would deposit.
|
|
313
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
314
|
+
* @param accountId - The stake account object.
|
|
315
|
+
* @param walletAddress - The wallet address of the owner.
|
|
316
|
+
* @return Transaction block response or transaction block.
|
|
317
|
+
*/
|
|
318
|
+
unstake(stakeMarketCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
319
|
+
unstake<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
320
|
+
/**
|
|
321
|
+
* Unstake market coin from the specific spool and withdraw asset from the corresponding pool.
|
|
322
|
+
*
|
|
323
|
+
* @param marketCoinName - Types of mak coin.
|
|
324
|
+
* @param amount - The amount of coins would deposit.
|
|
325
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
326
|
+
* @param accountId - The stake account object.
|
|
327
|
+
* @param walletAddress - The wallet address of the owner.
|
|
328
|
+
* @return Transaction block response or transaction block.
|
|
329
|
+
*/
|
|
330
|
+
unstakeAndWithdraw(stakeMarketCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
331
|
+
unstakeAndWithdraw<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
332
|
+
/**
|
|
333
|
+
* Claim reward coin from the specific spool.
|
|
334
|
+
*
|
|
335
|
+
* @param stakeMarketCoinName - Types of mak coin.
|
|
336
|
+
* @param amount - The amount of coins would deposit.
|
|
337
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
338
|
+
* @param accountId - The stake account object.
|
|
339
|
+
* @param walletAddress - The wallet address of the owner.
|
|
340
|
+
* @return Transaction block response or transaction block.
|
|
341
|
+
*/
|
|
342
|
+
claim(stakeMarketCoinName: string): Promise<SuiTransactionBlockResponse>;
|
|
343
|
+
claim<S extends boolean>(stakeMarketCoinName: string, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
344
|
+
/**
|
|
345
|
+
* stake obligaion.
|
|
346
|
+
*
|
|
347
|
+
* @param obligationId - The obligation account object.
|
|
348
|
+
* @param obligationKeyId - The obligation key account object.
|
|
349
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
350
|
+
* @param walletAddress - The wallet address of the owner.
|
|
351
|
+
* @return Transaction block response or transaction block
|
|
352
|
+
*/
|
|
353
|
+
stakeObligation<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
354
|
+
/**
|
|
355
|
+
* unstake obligaion.
|
|
356
|
+
*
|
|
357
|
+
* @param obligationId - The obligation account object.
|
|
358
|
+
* @param obligationKeyId - The obligation key account object.
|
|
359
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
360
|
+
* @param walletAddress - The wallet address of the owner.
|
|
361
|
+
* @return Transaction block response or transaction block
|
|
362
|
+
*/
|
|
363
|
+
unstakeObligation<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
364
|
+
/**
|
|
365
|
+
* Claim borrow incentive reward.
|
|
366
|
+
*
|
|
367
|
+
* @param poolName
|
|
368
|
+
* @param amount - The amount of coins would deposit.
|
|
369
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
370
|
+
* @param accountId - The stake account object.
|
|
371
|
+
* @param walletAddress - The wallet address of the owner.
|
|
372
|
+
* @return Transaction block response or transaction block
|
|
373
|
+
*/
|
|
374
|
+
claimBorrowIncentive<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
375
|
+
/**
|
|
376
|
+
* Function to migrate all market coin in user wallet into sCoin
|
|
377
|
+
* @returns Transaction response
|
|
378
|
+
*/
|
|
379
|
+
migrateAllMarketCoin<S extends boolean>(includeStakePool?: boolean, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
380
|
+
/**
|
|
381
|
+
* Claim unlocked SCA from all veSCA accounts.
|
|
382
|
+
*/
|
|
383
|
+
claimAllUnlockedSca(): Promise<SuiTransactionBlockResponse>;
|
|
384
|
+
claimAllUnlockedSca<S extends boolean>(sign?: S, walletAddress?: string): Promise<ScallopClientVeScaReturnType<S>>;
|
|
385
|
+
/**
|
|
386
|
+
* Mint and get test coin.
|
|
387
|
+
*
|
|
388
|
+
* @remarks
|
|
389
|
+
* Only be used on the test network.
|
|
390
|
+
*
|
|
391
|
+
* @param assetCoinName - Specific asset coin name.
|
|
392
|
+
* @param amount - The amount of coins minted and received.
|
|
393
|
+
* @param receiveAddress - The wallet address that receives the coins.
|
|
394
|
+
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
395
|
+
* @return Transaction block response or transaction block.
|
|
396
|
+
*/
|
|
397
|
+
mintTestCoin(assetCoinName: Exclude<string, 'sui'>, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
398
|
+
mintTestCoin<S extends boolean>(assetCoinName: Exclude<string, 'sui'>, amount: number, sign?: S, receiveAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export { ScallopClient, type ScallopClientConstructorParams };
|