@scallop-io/sui-scallop-sdk 2.2.3-pyth-sponsored-transaction-alpha.1 → 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 +5 -14
- package/src/builders/index.ts +2 -2
- package/src/builders/oracles/error.ts +29 -0
- package/src/builders/oracles/index.ts +114 -365
- 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/builder/core.ts +2 -4
- 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 -52
- 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
|
@@ -1,2034 +1,271 @@
|
|
|
1
|
-
import * as _mysten_sui_dist_cjs_client from '@mysten/sui/dist/cjs/client';
|
|
2
|
-
import { SuiObjectDataOptions, GetOwnedObjectsParams, GetDynamicFieldsParams, GetDynamicFieldObjectParams, SuiObjectData, SuiObjectRef } from '@mysten/sui/dist/cjs/client';
|
|
3
|
-
import * as _scallop_io_sui_kit from '@scallop-io/sui-kit';
|
|
4
|
-
import { SuiObjectArg, SuiTxArg, NetworkType, SuiKit, Transaction, SuiTxBlock, DerivePathParams, SuiKitParams, SuiVecTxArg, SuiAmountsArg, SuiAddressArg, TransactionResult as TransactionResult$1 } from '@scallop-io/sui-kit';
|
|
5
1
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
6
2
|
import { QueryClient, QueryClientConfig, QueryKey } from '@tanstack/query-core';
|
|
3
|
+
import * as _scallop_io_sui_kit from '@scallop-io/sui-kit';
|
|
4
|
+
import { SuiObjectArg, SuiTxArg, SuiTxBlock, SuiAddressArg, TransactionResult as TransactionResult$1, NetworkType, SuiKit, Transaction, DerivePathParams, SuiKitParams, SuiVecTxArg, SuiAmountsArg } from '@scallop-io/sui-kit';
|
|
5
|
+
import { A as AddressesInterface, g as AddressStringPath, a as xOracleRules } from './address-Bp_gAUMw.js';
|
|
7
6
|
import { AxiosInstance, AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
7
|
+
import * as _mysten_sui_dist_cjs_client from '@mysten/sui/dist/cjs/client';
|
|
8
|
+
import { SuiObjectRef as SuiObjectRef$1, SuiObjectData as SuiObjectData$1 } from '@mysten/sui/dist/cjs/client';
|
|
9
|
+
import { SuiObjectData, SuiObjectRef, SuiObjectDataOptions, SuiObjectResponse, GetOwnedObjectsParams, GetDynamicFieldsParams, DynamicFieldPage, GetDynamicFieldObjectParams, CoinBalance, GetBalanceParams, DevInspectResults, SuiTransactionBlockResponse } from '@mysten/sui/client';
|
|
10
|
+
import { Argument, TransactionResult, Transaction as Transaction$1, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
declare const DEFAULT_CACHE_OPTIONS: {
|
|
18
|
-
defaultOptions: {
|
|
19
|
-
queries: {
|
|
20
|
-
staleTime: number;
|
|
21
|
-
gcTime: number;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
12
|
+
type CoreIds = {
|
|
13
|
+
protocolPkg: string;
|
|
14
|
+
market: string;
|
|
15
|
+
version: string;
|
|
16
|
+
coinDecimalsRegistry: string;
|
|
17
|
+
xOracle: string;
|
|
24
18
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
export type GetObject = BaseType & {
|
|
49
|
-
objectId?: string;
|
|
50
|
-
options?: SuiObjectDataOptions;
|
|
51
|
-
};
|
|
52
|
-
export type GetObjects = BaseType & {
|
|
53
|
-
objectIds?: string[];
|
|
54
|
-
};
|
|
55
|
-
export type GetOwnedObjects = BaseType & Partial<GetOwnedObjectsParams>;
|
|
56
|
-
export type GetDynamicFields = BaseType & Partial<GetDynamicFieldsParams>;
|
|
57
|
-
export type GetDynamicFieldObject = BaseType & Partial<GetDynamicFieldObjectParams>;
|
|
58
|
-
export type getTotalVeScaTreasuryAmount = BaseType & {
|
|
59
|
-
refreshArgs?: any[];
|
|
60
|
-
vescaAmountArgs?: (string | SuiObjectData | SuiTxArg)[];
|
|
61
|
-
};
|
|
62
|
-
export type GetAllCoinBalances = BaseType & {
|
|
63
|
-
activeAddress?: string;
|
|
64
|
-
};
|
|
65
|
-
export type GetNormalizedMoveFunction = BaseType & {
|
|
66
|
-
target?: string;
|
|
67
|
-
};
|
|
68
|
-
export { };
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
declare const queryKeys: {
|
|
73
|
-
api: {
|
|
74
|
-
getAddresses: (props?: QueryKeys.API.GetAddresses) => (string | QueryKeys.API.GetAddresses | undefined)[];
|
|
75
|
-
getWhiteList: () => string[];
|
|
76
|
-
getPoolAddresses: () => string[];
|
|
77
|
-
getMarket: () => string[];
|
|
78
|
-
getSpools: () => string[];
|
|
79
|
-
getBorrowIncentivePool: () => string[];
|
|
80
|
-
getTotalValueLocked: () => string[];
|
|
81
|
-
};
|
|
82
|
-
rpc: {
|
|
83
|
-
getInspectTxn: (props?: QueryKeys.RPC.GetInspectTxn) => (string | QueryKeys.RPC.GetInspectTxn | undefined)[];
|
|
84
|
-
getObject: (props?: QueryKeys.RPC.GetObject) => (string | QueryKeys.RPC.GetObject | undefined)[];
|
|
85
|
-
getObjects: (props?: QueryKeys.RPC.GetObjects) => (string | QueryKeys.RPC.GetObjects | undefined)[];
|
|
86
|
-
getOwnedObjects: (props?: QueryKeys.RPC.GetOwnedObjects) => (string | {
|
|
87
|
-
filter: string;
|
|
88
|
-
node?: string;
|
|
89
|
-
owner?: string | undefined;
|
|
90
|
-
cursor?: string | null | undefined;
|
|
91
|
-
limit?: number | null | undefined;
|
|
92
|
-
signal?: AbortSignal;
|
|
93
|
-
options?: _mysten_sui_dist_cjs_client.SuiObjectDataOptions | null;
|
|
94
|
-
})[];
|
|
95
|
-
getDynamicFields: (props?: QueryKeys.RPC.GetDynamicFields) => (string | QueryKeys.RPC.GetDynamicFields | undefined)[];
|
|
96
|
-
getDynamicFieldObject: (props?: QueryKeys.RPC.GetDynamicFieldObject) => (string | QueryKeys.RPC.GetDynamicFieldObject | undefined)[];
|
|
97
|
-
getTotalVeScaTreasuryAmount: (props?: QueryKeys.RPC.getTotalVeScaTreasuryAmount) => (string | {
|
|
98
|
-
refreshArgs: string | undefined;
|
|
99
|
-
vescaAmountArgs: string | undefined;
|
|
100
|
-
node?: string;
|
|
101
|
-
})[];
|
|
102
|
-
getAllCoinBalances: (props?: QueryKeys.RPC.GetAllCoinBalances) => (string | QueryKeys.RPC.GetAllCoinBalances | undefined)[];
|
|
103
|
-
getNormalizedMoveFunction: (props?: QueryKeys.RPC.GetNormalizedMoveFunction) => (string | QueryKeys.RPC.GetNormalizedMoveFunction | undefined)[];
|
|
104
|
-
};
|
|
105
|
-
oracle: {
|
|
106
|
-
getPythLatestPriceFeeds: () => string[];
|
|
107
|
-
};
|
|
19
|
+
type NestedResult = Extract<Argument, {
|
|
20
|
+
$kind: 'NestedResult';
|
|
21
|
+
}>;
|
|
22
|
+
type Obligation$1 = NestedResult;
|
|
23
|
+
type ObligationKey = NestedResult;
|
|
24
|
+
type ObligationHotPotato = NestedResult;
|
|
25
|
+
type CoreNormalMethods = {
|
|
26
|
+
openObligation: () => [Obligation$1, ObligationKey, ObligationHotPotato];
|
|
27
|
+
returnObligation: (obligation: SuiObjectArg, obligationHotPotato: SuiObjectArg) => void;
|
|
28
|
+
openObligationEntry: () => void;
|
|
29
|
+
addCollateral: (obligation: SuiObjectArg, coin: SuiObjectArg, collateralCoinName: string) => void;
|
|
30
|
+
takeCollateral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, collateralCoinName: string) => TransactionResult;
|
|
31
|
+
deposit: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
32
|
+
depositEntry: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
33
|
+
withdraw: (marketCoin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
34
|
+
withdrawEntry: (marketCoin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
35
|
+
borrow: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: string) => TransactionResult;
|
|
36
|
+
borrowWithReferral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, borrowReferral: SuiObjectArg, amount: number | SuiTxArg, poolCoinName: string) => TransactionResult;
|
|
37
|
+
borrowEntry: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: string) => TransactionResult;
|
|
38
|
+
repay: (obligation: SuiObjectArg, coin: SuiObjectArg, poolCoinName: string) => void;
|
|
39
|
+
borrowFlashLoan: (amount: number | SuiTxArg, poolCoinName: string) => TransactionResult;
|
|
40
|
+
repayFlashLoan: (coin: SuiObjectArg, loan: SuiObjectArg, poolCoinName: string) => void;
|
|
108
41
|
};
|
|
42
|
+
type CoreQuickMethods = {
|
|
43
|
+
addCollateralQuick: (amount: number, collateralCoinName: string, obligationId?: SuiObjectArg) => Promise<void>;
|
|
44
|
+
takeCollateralQuick: (amount: number, collateralCoinName: string, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
|
|
45
|
+
borrowQuick: (amount: number, poolCoinName: string, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
|
|
46
|
+
borrowWithReferralQuick: (amount: number, poolCoinName: string, borrowReferral: SuiObjectArg, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
|
|
47
|
+
depositQuick: (amount: number, poolCoinName: string, returnSCoin?: boolean) => Promise<TransactionResult>;
|
|
48
|
+
withdrawQuick: (amount: number, poolCoinName: string) => Promise<TransactionResult>;
|
|
49
|
+
repayQuick: (amount: number, poolCoinName: string, obligationId?: SuiObjectArg) => Promise<void>;
|
|
50
|
+
updateAssetPricesQuick: (assetCoinNames?: string[]) => Promise<void>;
|
|
51
|
+
};
|
|
52
|
+
type SuiTxBlockWithCoreNormalMethods = SuiTxBlock & SuiTxBlockWithSpool & CoreNormalMethods;
|
|
53
|
+
type CoreTxBlock = SuiTxBlockWithCoreNormalMethods & CoreQuickMethods;
|
|
54
|
+
type GenerateCoreNormalMethod = (params: {
|
|
55
|
+
builder: ScallopBuilder;
|
|
56
|
+
txBlock: SuiTxBlock;
|
|
57
|
+
}) => CoreNormalMethods;
|
|
58
|
+
type GenerateCoreQuickMethod = (params: {
|
|
59
|
+
builder: ScallopBuilder;
|
|
60
|
+
txBlock: SuiTxBlockWithCoreNormalMethods;
|
|
61
|
+
}) => CoreQuickMethods;
|
|
109
62
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
type ScallopQueryClientParams = {
|
|
113
|
-
queryClient?: QueryClient;
|
|
114
|
-
queryClientConfig?: QueryClientConfig;
|
|
63
|
+
type SpoolIds = {
|
|
64
|
+
spoolPkg: string;
|
|
115
65
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
66
|
+
type SpoolNormalMethods = {
|
|
67
|
+
createStakeAccount: (stakeMarketCoinName: string) => TransactionResult;
|
|
68
|
+
stake: (stakeAccount: SuiAddressArg, coin: SuiObjectArg, stakeMarketCoinName: string) => void;
|
|
69
|
+
unstake: (stakeAccount: SuiAddressArg, amount: number, stakeMarketCoinName: string) => TransactionResult;
|
|
70
|
+
claim: (stakeAccount: SuiAddressArg, stakeMarketCoinName: string) => TransactionResult;
|
|
71
|
+
};
|
|
72
|
+
type SpoolQuickMethods = {
|
|
73
|
+
stakeQuick(amountOrMarketCoin: SuiObjectArg | number, stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg): Promise<void>;
|
|
74
|
+
unstakeQuick(amount: number, stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg, returnSCoin?: boolean): Promise<TransactionResult | undefined>;
|
|
75
|
+
claimQuick(stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg): Promise<TransactionResult[]>;
|
|
76
|
+
};
|
|
77
|
+
type SuiTxBlockWithSpoolNormalMethods = SuiTxBlock & SuiTxBlockWithSCoin & SpoolNormalMethods;
|
|
78
|
+
type SpoolTxBlock = SuiTxBlockWithSpoolNormalMethods & SpoolQuickMethods;
|
|
79
|
+
type GenerateSpoolNormalMethod = (params: {
|
|
80
|
+
builder: ScallopBuilder;
|
|
81
|
+
txBlock: SuiTxBlock;
|
|
82
|
+
}) => SpoolNormalMethods;
|
|
83
|
+
type GenerateSpoolQuickMethod = (params: {
|
|
84
|
+
builder: ScallopBuilder;
|
|
85
|
+
txBlock: SuiTxBlockWithSpoolNormalMethods;
|
|
86
|
+
}) => SpoolQuickMethods;
|
|
130
87
|
|
|
131
|
-
type
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
88
|
+
type BorrowIncentiveIds = {
|
|
89
|
+
borrowIncentivePkg: string;
|
|
90
|
+
query: string;
|
|
91
|
+
config: string;
|
|
92
|
+
incentivePools: string;
|
|
93
|
+
incentiveAccounts: string;
|
|
94
|
+
obligationAccessStore: string;
|
|
95
|
+
};
|
|
96
|
+
type BorrowIncentiveNormalMethods = {
|
|
97
|
+
stakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
|
|
98
|
+
stakeObligationWithVesca: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, veScaKey: SuiObjectArg) => void;
|
|
99
|
+
unstakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
|
|
100
|
+
claimBorrowIncentive: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, rewardType: string) => TransactionResult;
|
|
101
|
+
deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => void;
|
|
102
|
+
};
|
|
103
|
+
type BorrowIncentiveQuickMethods = {
|
|
104
|
+
stakeObligationQuick(obligation?: string, obligationKey?: string): Promise<void>;
|
|
105
|
+
stakeObligationWithVeScaQuick(obligation?: string, obligationKey?: string, veScaKey?: string): Promise<void>;
|
|
106
|
+
unstakeObligationQuick(obligation?: string, obligationKey?: string): Promise<void>;
|
|
107
|
+
claimBorrowIncentiveQuick(rewardType: string, obligation?: string, obligationKey?: string): Promise<TransactionResult>;
|
|
108
|
+
};
|
|
109
|
+
type SuiTxBlockWithBorrowIncentiveNormalMethods = SuiTxBlock & BorrowIncentiveNormalMethods;
|
|
110
|
+
type BorrowIncentiveTxBlock = SuiTxBlockWithBorrowIncentiveNormalMethods & BorrowIncentiveQuickMethods;
|
|
111
|
+
type GenerateBorrowIncentiveNormalMethod = (params: {
|
|
112
|
+
builder: ScallopBuilder;
|
|
113
|
+
txBlock: SuiTxBlock;
|
|
114
|
+
}) => BorrowIncentiveNormalMethods;
|
|
115
|
+
type GenerateBorrowIncentiveQuickMethod = (params: {
|
|
116
|
+
builder: ScallopBuilder;
|
|
117
|
+
txBlock: SuiTxBlockWithBorrowIncentiveNormalMethods;
|
|
118
|
+
}) => BorrowIncentiveQuickMethods;
|
|
148
119
|
|
|
149
|
-
type
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
declare class ScallopAddress {
|
|
162
|
-
readonly params: ScallopAddressParams;
|
|
163
|
-
private currentAddresses?;
|
|
164
|
-
private addressId?;
|
|
165
|
-
private network;
|
|
166
|
-
private auth;
|
|
167
|
-
readonly scallopAxios: ScallopAxios;
|
|
168
|
-
private readonly addressMap;
|
|
169
|
-
private readonly defaultParamValues;
|
|
170
|
-
constructor(params?: ScallopAddressParams);
|
|
171
|
-
private initializeForcedAddresses;
|
|
172
|
-
get axiosClient(): ScallopAxios;
|
|
173
|
-
get queryClient(): _tanstack_query_core.QueryClient;
|
|
174
|
-
get defaultValues(): {
|
|
175
|
-
addresses?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
176
|
-
} | undefined;
|
|
177
|
-
getId(): string | undefined;
|
|
178
|
-
/**
|
|
179
|
-
* Get the address at the provided path.
|
|
180
|
-
*
|
|
181
|
-
* @param path - The path of the address to get.
|
|
182
|
-
* @return The address at the provided path.
|
|
183
|
-
*/
|
|
184
|
-
get(path: AddressStringPath): any;
|
|
185
|
-
/**
|
|
186
|
-
* Sets the address for the specified path, it does not interact with the API.
|
|
187
|
-
*
|
|
188
|
-
* @param path - The path of the address to set.
|
|
189
|
-
* @param address - The address be setted to the tartget path.
|
|
190
|
-
* @return The addresses.
|
|
191
|
-
*/
|
|
192
|
-
set(path: AddressStringPath, address: string): AddressesInterface | undefined;
|
|
193
|
-
/**
|
|
194
|
-
* Synchronize the specified network addresses from the addresses map to the
|
|
195
|
-
* current addresses and change the default network to specified network.
|
|
196
|
-
*
|
|
197
|
-
* @param network - Specifies which network's addresses you want to get.
|
|
198
|
-
* @return Current addresses.
|
|
199
|
-
*/
|
|
200
|
-
switchCurrentAddresses(network: NetworkType): AddressesInterface | undefined;
|
|
201
|
-
/**
|
|
202
|
-
* Get the addresses, If `network` is not provided, returns the current
|
|
203
|
-
* addresses or the default network addresses in the addresses map.
|
|
204
|
-
*
|
|
205
|
-
* @param network - Specifies which network's addresses you want to get.
|
|
206
|
-
*/
|
|
207
|
-
getAddresses(network?: NetworkType): AddressesInterface | undefined;
|
|
120
|
+
type VeScaNormalMethods = {
|
|
121
|
+
lockSca: (scaCoin: SuiObjectArg, unlockAtInSecondTimestamp: number) => TransactionResult;
|
|
122
|
+
extendLockPeriod: (veScaKey: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
|
|
123
|
+
extendLockAmount: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg) => void;
|
|
124
|
+
renewExpiredVeSca: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
|
|
125
|
+
redeemSca: (veScaKey: SuiObjectArg) => TransactionResult;
|
|
126
|
+
mintEmptyVeSca: () => TransactionResult;
|
|
127
|
+
splitVeSca: (veScaKey: SuiObjectArg, splitAmount: string) => TransactionResult;
|
|
128
|
+
mergeVeSca: (targetVeScaKey: SuiObjectArg, sourceVeScaKey: SuiObjectArg) => void;
|
|
129
|
+
};
|
|
130
|
+
type QuickMethodReturnType<T extends boolean> = T extends true ? void : TransactionResult;
|
|
131
|
+
type VeScaQuickMethods = {
|
|
208
132
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
133
|
+
* Quick methods to automate
|
|
134
|
+
* lock initial SCA, extend lock period, lock more SCA, renew expired VeSCA, and redeem SCA
|
|
211
135
|
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*/
|
|
216
|
-
setAddresses(addresses: AddressesInterface, network?: NetworkType): void;
|
|
217
|
-
/**
|
|
218
|
-
* Get all addresses.
|
|
136
|
+
* **Flow:**
|
|
137
|
+
* - If only `amountOrCoin` is provided, it will lock the amount of existing not expired veSCA
|
|
138
|
+
* - If only `lockPeriodInDays` is provided, it will extend the lock period of existing not expired veSCA
|
|
219
139
|
*
|
|
220
|
-
*
|
|
140
|
+
* **Note:**
|
|
141
|
+
* - If one or both flow above is used on a expired veSCA, it will claim the unlocked SCA
|
|
142
|
+
* and renew the veSCA first, and then flow continues
|
|
143
|
+
* - If users has no veSCA yet, they need to provide both `amountOrCoin` and `lockPeriodInDays` for initial lock
|
|
144
|
+
* @param amountOrCoin
|
|
145
|
+
* @param lockPeriodInDays
|
|
146
|
+
* @param autoCheck
|
|
221
147
|
*/
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
* instance.
|
|
228
|
-
*
|
|
229
|
-
* @description
|
|
230
|
-
* If the `network` is not specified, the mainnet is used by default.
|
|
231
|
-
* If no `addresses` from instance or parameter is provided, an addresses with
|
|
232
|
-
* all empty strings is created by default.
|
|
233
|
-
*
|
|
234
|
-
* This function only allows for one addresses to be input into a specific network
|
|
235
|
-
* at a time, and does not provide an addresses map for setting addresses
|
|
236
|
-
* across all networks at once.
|
|
237
|
-
*
|
|
238
|
-
* @param params.addresses - The addresses be setted to the tartget network.
|
|
239
|
-
* @param params.network - Specifies which network's addresses you want to set.
|
|
240
|
-
* @param params.auth - The authentication API key.
|
|
241
|
-
* @param params.memo - Add memo to the addresses created in the API.
|
|
242
|
-
* @return All addresses.
|
|
243
|
-
*/
|
|
244
|
-
create(params?: {
|
|
245
|
-
addresses?: AddressesInterface | undefined;
|
|
246
|
-
network?: NetworkType | undefined;
|
|
247
|
-
auth?: string | undefined;
|
|
248
|
-
memo?: string | undefined;
|
|
249
|
-
}): Promise<{
|
|
250
|
-
[k: string]: AddressesInterface;
|
|
251
|
-
}>;
|
|
252
|
-
protected readApi<T>({ url, queryKey, config, }: {
|
|
253
|
-
url: string;
|
|
254
|
-
queryKey: QueryKey;
|
|
255
|
-
config?: AxiosRequestConfig;
|
|
256
|
-
}): Promise<T>;
|
|
257
|
-
/**
|
|
258
|
-
* Read and synchronizes all addresses from the API into instance.
|
|
259
|
-
*
|
|
260
|
-
* @param id - The id of the addresses to get.
|
|
261
|
-
* @return All addresses.
|
|
262
|
-
*/
|
|
263
|
-
read(id?: string): Promise<{
|
|
264
|
-
[k: string]: AddressesInterface;
|
|
265
|
-
}>;
|
|
266
|
-
/**
|
|
267
|
-
* Update the addresses through the API and synchronize it back to the
|
|
268
|
-
* instance.
|
|
269
|
-
*
|
|
270
|
-
* @description
|
|
271
|
-
* If the `network` is not specified, the mainnet is used by default.
|
|
272
|
-
* If no `addresses` from instance or parameter is provided, an addresses with
|
|
273
|
-
* all empty strings is created by default.
|
|
274
|
-
*
|
|
275
|
-
* This function only allows for one addresses to be input into a specific network
|
|
276
|
-
* at a time, and does not provide an addresses map for setting addresses
|
|
277
|
-
* across all networks at once.
|
|
278
|
-
*
|
|
279
|
-
* @param params.id - The id of the addresses to update.
|
|
280
|
-
* @param params.addresses - The addresses be setted to the tartget network.
|
|
281
|
-
* @param params.network - Specifies which network's addresses you want to set.
|
|
282
|
-
* @param params.auth - The authentication api key.
|
|
283
|
-
* @param params.memo - Add memo to the addresses created in the API.
|
|
284
|
-
* @return All addresses.
|
|
285
|
-
*/
|
|
286
|
-
update(params?: {
|
|
287
|
-
id?: string;
|
|
288
|
-
addresses?: AddressesInterface | undefined;
|
|
289
|
-
network?: NetworkType | undefined;
|
|
290
|
-
auth?: string | undefined;
|
|
291
|
-
memo?: string | undefined;
|
|
292
|
-
}): Promise<{
|
|
293
|
-
[k: string]: AddressesInterface;
|
|
294
|
-
}>;
|
|
295
|
-
/**
|
|
296
|
-
* Deletes all addresses of a specified id through the API and clear all
|
|
297
|
-
* addresses in the instance.
|
|
298
|
-
*
|
|
299
|
-
* @param id - The id of the addresses to delete.
|
|
300
|
-
* @param auth - The authentication API key.
|
|
301
|
-
*/
|
|
302
|
-
delete(id?: string, auth?: string): Promise<void>;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
type CoinName = string;
|
|
306
|
-
type CoinType = string;
|
|
307
|
-
type SCoinType = string;
|
|
308
|
-
type OldMarketCoinType = string;
|
|
309
|
-
/**
|
|
310
|
-
* @description `scallop_sui`, `scallop_usdt`, etc (parsed directly from coin type, ex: `0x...::scallop_sui::SCALLOP_SUI`)
|
|
311
|
-
*/
|
|
312
|
-
type SCoinRawName = string;
|
|
313
|
-
/**
|
|
314
|
-
* @description `ssui`, `susdc`, etc..
|
|
315
|
-
*/
|
|
316
|
-
type SCoinName = string;
|
|
317
|
-
type ScallopConstantsParams = {
|
|
318
|
-
urls?: {
|
|
319
|
-
poolAddresses?: string[];
|
|
320
|
-
whitelist?: string[];
|
|
321
|
-
};
|
|
322
|
-
forcePoolAddressInterface?: Record<string, PoolAddress>;
|
|
323
|
-
forceWhitelistInterface?: Whitelist | Record<string, any>;
|
|
324
|
-
defaultValues?: {
|
|
325
|
-
poolAddresses?: Record<string, PoolAddress>;
|
|
326
|
-
whitelist?: Whitelist | Record<string, any>;
|
|
327
|
-
};
|
|
328
|
-
} & ScallopAddressParams;
|
|
329
|
-
declare class ScallopConstants extends ScallopAddress {
|
|
330
|
-
readonly params: ScallopConstantsParams;
|
|
331
|
-
private _poolAddresses;
|
|
332
|
-
private _whitelist;
|
|
333
|
-
/**
|
|
334
|
-
* @description coin names to coin decimal map
|
|
335
|
-
*/
|
|
336
|
-
coinDecimals: Record<CoinName, number | undefined>;
|
|
337
|
-
coinNameToOldMarketCoinTypeMap: Record<CoinName, OldMarketCoinType | undefined>;
|
|
338
|
-
scoinRawNameToSCoinNameMap: Record<SCoinRawName, SCoinName | undefined>;
|
|
339
|
-
scoinTypeToSCoinNameMap: Record<SCoinType, SCoinName | undefined>;
|
|
340
|
-
wormholeCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
341
|
-
voloCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
342
|
-
suiBridgeCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
343
|
-
/**
|
|
344
|
-
* @description coin names to coin types map
|
|
345
|
-
*/
|
|
346
|
-
coinTypes: Record<CoinName, CoinType | undefined>;
|
|
347
|
-
/**
|
|
348
|
-
* @description scoin names to scoin types map
|
|
349
|
-
*/
|
|
350
|
-
sCoinTypes: Record<SCoinName, SCoinType | undefined>;
|
|
351
|
-
coinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
352
|
-
/**
|
|
353
|
-
* @description Supported borrow incentive reward coin names
|
|
354
|
-
*/
|
|
355
|
-
supportedBorrowIncentiveRewards: Set<CoinName>;
|
|
356
|
-
constructor(params?: ScallopConstantsParams);
|
|
357
|
-
get protocolObjectId(): string;
|
|
358
|
-
get isInitialized(): boolean;
|
|
359
|
-
get whitelist(): Whitelist;
|
|
360
|
-
get poolAddresses(): Record<string, PoolAddress | undefined>;
|
|
361
|
-
get defaultValues(): ({
|
|
362
|
-
poolAddresses?: Record<string, PoolAddress>;
|
|
363
|
-
whitelist?: Whitelist | Record<string, any>;
|
|
364
|
-
} & {
|
|
365
|
-
addresses?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
366
|
-
}) | undefined;
|
|
367
|
-
private isAddressInitialized;
|
|
368
|
-
parseToOldMarketCoin(coinType: string): string;
|
|
369
|
-
init({ networkType, force, addressId, constantsParams, }?: {
|
|
370
|
-
networkType?: NetworkType;
|
|
371
|
-
force?: boolean;
|
|
372
|
-
addressId?: string;
|
|
373
|
-
constantsParams?: Partial<ScallopConstantsParams>;
|
|
148
|
+
lockScaQuick(params: {
|
|
149
|
+
amountOrCoin?: SuiObjectArg | number;
|
|
150
|
+
lockPeriodInDays?: number;
|
|
151
|
+
autoCheck?: boolean;
|
|
152
|
+
veScaKey?: SuiObjectData | string;
|
|
374
153
|
}): Promise<void>;
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
154
|
+
extendLockPeriodQuick: (params: {
|
|
155
|
+
lockPeriodInDays: number;
|
|
156
|
+
autoCheck?: boolean;
|
|
157
|
+
veScaKey?: SuiObjectData | string;
|
|
158
|
+
}) => Promise<void>;
|
|
159
|
+
extendLockAmountQuick: (params: {
|
|
160
|
+
scaAmount: number;
|
|
161
|
+
autoCheck?: boolean;
|
|
162
|
+
veScaKey?: SuiObjectData | string;
|
|
163
|
+
}) => Promise<void>;
|
|
164
|
+
renewExpiredVeScaQuick: (params: {
|
|
165
|
+
scaAmount: number;
|
|
166
|
+
lockPeriodInDays: number;
|
|
167
|
+
autoCheck?: boolean;
|
|
168
|
+
veScaKey?: SuiObjectData | string;
|
|
169
|
+
}) => Promise<void>;
|
|
170
|
+
redeemScaQuick: <T extends boolean>(params: {
|
|
171
|
+
veScaKey?: SuiObjectData | string;
|
|
172
|
+
transferSca?: T;
|
|
173
|
+
}) => Promise<QuickMethodReturnType<T> | undefined>;
|
|
174
|
+
splitVeScaQuick: <T extends boolean>(params: {
|
|
175
|
+
splitAmount: string;
|
|
176
|
+
veScaKey: string;
|
|
177
|
+
transferVeScaKey?: T;
|
|
178
|
+
}) => Promise<QuickMethodReturnType<T> | undefined>;
|
|
179
|
+
mergeVeScaQuick: (params: {
|
|
180
|
+
targetVeScaKey: string;
|
|
181
|
+
sourceVeScaKey: string;
|
|
182
|
+
}) => Promise<void>;
|
|
183
|
+
};
|
|
184
|
+
type SuiTxBlockWithVeScaNormalMethods = SuiTxBlock & VeScaNormalMethods;
|
|
185
|
+
type VeScaTxBlock = SuiTxBlockWithVeScaNormalMethods & VeScaQuickMethods;
|
|
186
|
+
type GenerateVeScaNormalMethod = (params: {
|
|
187
|
+
builder: ScallopBuilder;
|
|
188
|
+
txBlock: SuiTxBlock;
|
|
189
|
+
}) => VeScaNormalMethods;
|
|
190
|
+
type GenerateVeScaQuickMethod = (params: {
|
|
191
|
+
builder: ScallopBuilder;
|
|
192
|
+
txBlock: SuiTxBlockWithVeScaNormalMethods;
|
|
193
|
+
}) => VeScaQuickMethods;
|
|
379
194
|
|
|
380
|
-
type
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
195
|
+
type ReferralNormalMethods = {
|
|
196
|
+
bindToReferral: (veScaKeyId: string) => void;
|
|
197
|
+
claimReferralTicket: (poolCoinName: string) => TransactionResult$1;
|
|
198
|
+
burnReferralTicket: (ticket: SuiObjectArg, poolCoinName: string) => void;
|
|
199
|
+
claimReferralRevenue: (veScaKey: SuiObjectArg, poolCoinName: string) => TransactionResult$1;
|
|
200
|
+
};
|
|
201
|
+
type ReferralQuickMethods = {
|
|
202
|
+
claimReferralRevenueQuick: (veScaKey: SuiObjectArg, coinNames: string[]) => Promise<void>;
|
|
203
|
+
};
|
|
204
|
+
type SuiTxBlockWithReferralNormalMethods = SuiTxBlock & ReferralNormalMethods;
|
|
205
|
+
type ReferralTxBlock = SuiTxBlockWithReferralNormalMethods & ReferralQuickMethods;
|
|
206
|
+
|
|
207
|
+
type LoyaltyProgramNormalMethods = {
|
|
208
|
+
claimLoyaltyRevenue: (veScaKey: SuiObjectArg) => TransactionResult$1;
|
|
209
|
+
claimVeScaLoyaltyReward: (veScaKey: SuiObjectArg) => TransactionResult$1;
|
|
210
|
+
};
|
|
211
|
+
type LoyaltyProgramQuickMethods = {
|
|
212
|
+
claimLoyaltyRevenueQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
|
|
213
|
+
claimVeScaLoyaltyRewardQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
|
|
214
|
+
};
|
|
215
|
+
type SuiTxBlockWithLoyaltyProgramNormalMethods = SuiTxBlock & LoyaltyProgramNormalMethods;
|
|
216
|
+
type LoyaltyProgramTxBlock = SuiTxBlockWithLoyaltyProgramNormalMethods & LoyaltyProgramQuickMethods;
|
|
217
|
+
type GenerateLoyaltyProgramNormalMethod = (params: {
|
|
218
|
+
builder: ScallopBuilder;
|
|
219
|
+
txBlock: SuiTxBlock;
|
|
220
|
+
}) => LoyaltyProgramNormalMethods;
|
|
221
|
+
type GenerateLoyaltyProgramQuickMethod = (params: {
|
|
222
|
+
builder: ScallopBuilder;
|
|
223
|
+
txBlock: SuiTxBlockWithLoyaltyProgramNormalMethods;
|
|
224
|
+
}) => LoyaltyProgramQuickMethods;
|
|
225
|
+
|
|
226
|
+
type sCoinPkgIds = {
|
|
227
|
+
pkgId: string;
|
|
228
|
+
};
|
|
229
|
+
type sCoinNormalMethods = {
|
|
391
230
|
/**
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
* @
|
|
231
|
+
* Lock marketCoin and return sCoin
|
|
232
|
+
* @param marketCoinName
|
|
233
|
+
* @param marketCoin
|
|
234
|
+
* @returns
|
|
395
235
|
*/
|
|
396
|
-
|
|
236
|
+
mintSCoin: (marketCoinName: string, marketCoin: SuiObjectArg) => TransactionResult$1;
|
|
397
237
|
/**
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
* @
|
|
238
|
+
* Burn sCoin and return marketCoin
|
|
239
|
+
* @param sCoinName
|
|
240
|
+
* @param sCoin
|
|
241
|
+
* @returns
|
|
401
242
|
*/
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
* @return Spools data.
|
|
419
|
-
*/
|
|
420
|
-
getSpools(): Promise<Required<Spools>>;
|
|
421
|
-
/**
|
|
422
|
-
* Get spool index data.
|
|
423
|
-
*
|
|
424
|
-
* @return Spool data.
|
|
425
|
-
*/
|
|
426
|
-
getSpool(marketCoinName: string): Promise<Spool>;
|
|
427
|
-
/**
|
|
428
|
-
* Get borrow incentive pools index data.
|
|
429
|
-
*
|
|
430
|
-
* @return Borrow incentive pools data.
|
|
431
|
-
*/
|
|
432
|
-
getBorrowIncentivePools(): Promise<Required<BorrowIncentivePools>>;
|
|
433
|
-
/**
|
|
434
|
-
* Get borrow incentive pool index data.
|
|
435
|
-
*
|
|
436
|
-
* @return Borrow incentive pool data.
|
|
437
|
-
*/
|
|
438
|
-
getBorrowIncentivePool(borrowIncentiveCoinName: string): Promise<BorrowIncentivePool>;
|
|
439
|
-
/**
|
|
440
|
-
* Get total value locked index data.
|
|
441
|
-
*
|
|
442
|
-
* @return Total value locked.
|
|
443
|
-
*/
|
|
444
|
-
getTotalValueLocked(): Promise<TotalValueLocked & {
|
|
445
|
-
totalValueChangeRatio: number;
|
|
446
|
-
borrowValueChangeRatio: number;
|
|
447
|
-
supplyValueChangeRatio: number;
|
|
448
|
-
}>;
|
|
449
|
-
/**
|
|
450
|
-
* Get coin price index data.
|
|
451
|
-
*
|
|
452
|
-
* @return price data.
|
|
453
|
-
*/
|
|
454
|
-
getCoinPrice(poolCoinName: string): Promise<number>;
|
|
455
|
-
getCoinPrices(): Promise<Record<string, number>>;
|
|
456
|
-
}
|
|
243
|
+
burnSCoin: (sCoinName: string, sCoin: SuiObjectArg) => TransactionResult$1;
|
|
244
|
+
};
|
|
245
|
+
type sCoinQuickMethods = {
|
|
246
|
+
mintSCoinQuick: (marketCoinName: string, amount: number) => Promise<TransactionResult$1>;
|
|
247
|
+
burnSCoinQuick: (sCoinName: string, amount: number) => Promise<TransactionResult$1>;
|
|
248
|
+
};
|
|
249
|
+
type SuiTxBlockWithSCoinNormalMethods = SuiTxBlock & BaseScallopTxBlock & sCoinNormalMethods;
|
|
250
|
+
type SCoinTxBlock = SuiTxBlockWithSCoinNormalMethods & sCoinQuickMethods;
|
|
251
|
+
type GenerateSCoinNormalMethod = (params: {
|
|
252
|
+
builder: ScallopBuilder;
|
|
253
|
+
txBlock: SuiTxBlock;
|
|
254
|
+
}) => sCoinNormalMethods;
|
|
255
|
+
type GenerateSCoinQuickMethod = (params: {
|
|
256
|
+
builder: ScallopBuilder;
|
|
257
|
+
txBlock: SuiTxBlockWithSCoinNormalMethods;
|
|
258
|
+
}) => sCoinQuickMethods;
|
|
457
259
|
|
|
458
|
-
type
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
} & SuiKitParams & ScallopQueryClientParams;
|
|
468
|
-
declare class ScallopSuiKit extends ScallopQueryClient {
|
|
469
|
-
readonly suiKit: SuiKit;
|
|
470
|
-
private _walletAddress;
|
|
471
|
-
private _tokensPerSecond;
|
|
472
|
-
private rateLimiter;
|
|
473
|
-
constructor(params?: ScallopSuiKitParams);
|
|
474
|
-
switchFullNodes(fullNodes: string[]): void;
|
|
475
|
-
get client(): _mysten_sui_dist_cjs_client.SuiClient;
|
|
476
|
-
get walletAddress(): string;
|
|
477
|
-
set walletAddress(value: string);
|
|
478
|
-
get tokensPerSecond(): number;
|
|
479
|
-
set tokensPerSecond(value: number);
|
|
480
|
-
get currentFullNode(): string;
|
|
481
|
-
signAndSendTxn(tx: Uint8Array | Transaction | SuiTxBlock, derivePathParams?: DerivePathParams): Promise<_mysten_sui_dist_cjs_client.SuiTransactionBlockResponse>;
|
|
482
|
-
private callWithRateLimiter;
|
|
483
|
-
private queryGetNormalizedMoveFunction;
|
|
484
|
-
/**
|
|
485
|
-
* @description Provides cache for getObject of the SuiKit.
|
|
486
|
-
* @param objectId
|
|
487
|
-
* @param QueryObjectParams
|
|
488
|
-
* @returns Promise<SuiObjectResponse>
|
|
489
|
-
*/
|
|
490
|
-
queryGetObject(objectId: string, options?: SuiObjectDataOptions$1): Promise<SuiObjectResponse>;
|
|
491
|
-
/**
|
|
492
|
-
* @description Provides cache for getObjects of the SuiKit.
|
|
493
|
-
* @param objectIds
|
|
494
|
-
* @returns Promise<SuiObjectData[]>
|
|
495
|
-
*/
|
|
496
|
-
queryGetObjects(objectIds: string[], options?: SuiObjectDataOptions$1): Promise<SuiObjectData$1[]>;
|
|
497
|
-
/**
|
|
498
|
-
* @description Provides cache for getOwnedObjects of the SuiKit.
|
|
499
|
-
* @param input
|
|
500
|
-
* @returns Promise<PaginatedObjectsResponse>
|
|
501
|
-
*/
|
|
502
|
-
queryGetOwnedObjects(input: GetOwnedObjectsParams$1): Promise<_mysten_sui_dist_cjs_client.PaginatedObjectsResponse>;
|
|
503
|
-
queryGetDynamicFields(input: GetDynamicFieldsParams$1): Promise<DynamicFieldPage | null>;
|
|
504
|
-
queryGetDynamicFieldObject(input: GetDynamicFieldObjectParams$1): Promise<SuiObjectResponse | null>;
|
|
505
|
-
queryGetAllCoinBalances(owner: string): Promise<{
|
|
506
|
-
[k: string]: CoinBalance;
|
|
507
|
-
}>;
|
|
508
|
-
queryGetCoinBalance(input: GetBalanceParams): Promise<CoinBalance | null>;
|
|
509
|
-
/**
|
|
510
|
-
* @description Provides cache for inspectTxn of the SuiKit.
|
|
511
|
-
* @param QueryInspectTxnParams
|
|
512
|
-
* @param txBlock
|
|
513
|
-
* @returns Promise<DevInspectResults>
|
|
514
|
-
*/
|
|
515
|
-
queryInspectTxn({ queryTarget, args, typeArgs, }: QueryInspectTxnParams): Promise<DevInspectResults | null>;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
type ScallopQueryParams = {
|
|
519
|
-
indexer?: ScallopIndexer;
|
|
520
|
-
utils?: ScallopUtils;
|
|
521
|
-
} & ScallopUtilsParams & ScallopIndexerParams;
|
|
522
|
-
declare class ScallopQuery implements ScallopQueryInterface {
|
|
523
|
-
readonly indexer: ScallopIndexer;
|
|
524
|
-
readonly utils: ScallopUtils;
|
|
525
|
-
constructor(params: ScallopQueryParams);
|
|
526
|
-
initIndexerFallback(): void;
|
|
527
|
-
/**
|
|
528
|
-
* Request the scallop API to initialize data.
|
|
529
|
-
*
|
|
530
|
-
* @param force - Whether to force initialization.
|
|
531
|
-
*/
|
|
532
|
-
init(force?: boolean): Promise<void>;
|
|
533
|
-
get constants(): ScallopConstants;
|
|
534
|
-
get walletAddress(): string;
|
|
535
|
-
get scallopSuiKit(): ScallopSuiKit;
|
|
536
|
-
get address(): ScallopConstants;
|
|
537
|
-
/**
|
|
538
|
-
* @deprecated use getMarketPools
|
|
539
|
-
* Query market data.
|
|
540
|
-
* @param indexer - Whether to use indexer.
|
|
541
|
-
* @return Market data.
|
|
542
|
-
*/
|
|
543
|
-
queryMarket(args?: {
|
|
544
|
-
coinPrices?: CoinPrices;
|
|
545
|
-
indexer?: boolean;
|
|
546
|
-
}): Promise<Market>;
|
|
547
|
-
/**
|
|
548
|
-
* Get market pools.
|
|
549
|
-
*
|
|
550
|
-
* @description
|
|
551
|
-
* To obtain all market pools at once, it is recommended to use
|
|
552
|
-
* the `queryMarket` method to reduce time consumption.
|
|
553
|
-
*
|
|
554
|
-
* @param poolCoinNames - Specific an array of support pool coin name.
|
|
555
|
-
* @param indexer - Whether to use indexer.
|
|
556
|
-
* @return Market pools data.
|
|
557
|
-
*/
|
|
558
|
-
getMarketPools(poolCoinNames?: string[], args?: {
|
|
559
|
-
coinPrices?: CoinPrices;
|
|
560
|
-
indexer?: boolean;
|
|
561
|
-
}): Promise<{
|
|
562
|
-
pools: MarketPools;
|
|
563
|
-
collaterals: MarketCollaterals;
|
|
564
|
-
}>;
|
|
565
|
-
/**
|
|
566
|
-
* Get market pool
|
|
567
|
-
*
|
|
568
|
-
* @param poolCoinName - Specific support pool coin name.
|
|
569
|
-
* @param indexer - Whether to use indexer.
|
|
570
|
-
* @return Market pool data.
|
|
571
|
-
*/
|
|
572
|
-
getMarketPool(poolCoinName: string, args?: {
|
|
573
|
-
coinPrice?: number;
|
|
574
|
-
indexer?: boolean;
|
|
575
|
-
}): Promise<MarketPool | undefined>;
|
|
576
|
-
/**
|
|
577
|
-
* Get market collaterals.
|
|
578
|
-
*
|
|
579
|
-
* @description
|
|
580
|
-
* To obtain all market collaterals at once, it is recommended to use
|
|
581
|
-
* the `queryMarket` method to reduce time consumption.
|
|
582
|
-
*
|
|
583
|
-
* @param collateralCoinNames - Specific an array of support collateral coin name.
|
|
584
|
-
* @param indexer - Whether to use indexer.
|
|
585
|
-
* @return Market collaterals data.
|
|
586
|
-
*/
|
|
587
|
-
getMarketCollaterals(collateralCoinNames?: string[], args?: {
|
|
588
|
-
indexer?: boolean;
|
|
589
|
-
}): Promise<{
|
|
590
|
-
[x: string]: MarketCollateral | undefined;
|
|
591
|
-
}>;
|
|
592
|
-
/**
|
|
593
|
-
* Get market collateral
|
|
594
|
-
*
|
|
595
|
-
* @param collateralCoinName - Specific support collateral coin name.
|
|
596
|
-
* @param indexer - Whether to use indexer.
|
|
597
|
-
* @return Market collateral data.
|
|
598
|
-
*/
|
|
599
|
-
getMarketCollateral(collateralCoinName: string, args?: {
|
|
600
|
-
indexer?: boolean;
|
|
601
|
-
}): Promise<MarketCollateral | undefined>;
|
|
602
|
-
/**
|
|
603
|
-
* Get obligations data.
|
|
604
|
-
*
|
|
605
|
-
* @param ownerAddress - The owner address.
|
|
606
|
-
* @return Obligations data.
|
|
607
|
-
*/
|
|
608
|
-
getObligations(ownerAddress?: string): Promise<Obligation[]>;
|
|
609
|
-
/**
|
|
610
|
-
* Query obligation data.
|
|
611
|
-
*
|
|
612
|
-
* @param obligationId - The obligation id.
|
|
613
|
-
* @return Obligation data.
|
|
614
|
-
*/
|
|
615
|
-
queryObligation(obligationId: SuiObjectArg): Promise<ObligationQueryInterface | undefined>;
|
|
616
|
-
/**
|
|
617
|
-
* Get all asset coin amounts.
|
|
618
|
-
*
|
|
619
|
-
* @param assetCoinNames - Specific an array of support asset coin name.
|
|
620
|
-
* @param ownerAddress - The owner address.
|
|
621
|
-
* @return All coin amounts.
|
|
622
|
-
*/
|
|
623
|
-
getCoinAmounts(assetCoinNames?: string[], ownerAddress?: string): Promise<OptionalKeys<Record<string, number>>>;
|
|
624
|
-
/**
|
|
625
|
-
* Get asset coin amount.
|
|
626
|
-
*
|
|
627
|
-
* @param assetCoinName - Specific support asset coin name.
|
|
628
|
-
* @param ownerAddress - The owner address.
|
|
629
|
-
* @return Coin amount.
|
|
630
|
-
*/
|
|
631
|
-
getCoinAmount(assetCoinName: string, ownerAddress?: string): Promise<number>;
|
|
632
|
-
/**
|
|
633
|
-
* Get all market coin amounts.
|
|
634
|
-
*
|
|
635
|
-
* @param coinNames - Specific an array of support market coin name.
|
|
636
|
-
* @param ownerAddress - The owner address.
|
|
637
|
-
* @return All market market coin amounts.
|
|
638
|
-
*/
|
|
639
|
-
getMarketCoinAmounts(marketCoinNames?: string[], ownerAddress?: string): Promise<OptionalKeys<Record<string, number>>>;
|
|
640
|
-
/**
|
|
641
|
-
* Get market coin amount.
|
|
642
|
-
*
|
|
643
|
-
* @param coinNames - Specific support market coin name.
|
|
644
|
-
* @param ownerAddress - The owner address.
|
|
645
|
-
* @return Market market coin amount.
|
|
646
|
-
*/
|
|
647
|
-
getMarketCoinAmount(marketCoinName: string, ownerAddress?: string): Promise<number>;
|
|
648
|
-
/**
|
|
649
|
-
* Get price from pyth fee object.
|
|
650
|
-
*
|
|
651
|
-
* @param assetCoinName - Specific support asset coin name.
|
|
652
|
-
* @return Asset coin price.
|
|
653
|
-
*/
|
|
654
|
-
getPriceFromPyth(assetCoinName: string): Promise<number>;
|
|
655
|
-
/**
|
|
656
|
-
* Get prices from pyth fee object.
|
|
657
|
-
*
|
|
658
|
-
* @param assetCoinNames - Array of supported asset coin names.
|
|
659
|
-
* @return Array of asset coin prices.
|
|
660
|
-
*/
|
|
661
|
-
getPricesFromPyth(assetCoinNames: string[]): Promise<Record<string, number>>;
|
|
662
|
-
/**
|
|
663
|
-
* Get spools data.
|
|
664
|
-
*
|
|
665
|
-
* @param stakeMarketCoinNames - Specific an array of support stake market coin name.
|
|
666
|
-
* @param indexer - Whether to use indexer.
|
|
667
|
-
* @return Spools data.
|
|
668
|
-
*/
|
|
669
|
-
getSpools(stakeMarketCoinNames?: string[], args?: {
|
|
670
|
-
marketPools?: MarketPools;
|
|
671
|
-
coinPrices?: CoinPrices;
|
|
672
|
-
indexer?: boolean;
|
|
673
|
-
}): Promise<{
|
|
674
|
-
[x: string]: Spool | undefined;
|
|
675
|
-
}>;
|
|
676
|
-
/**
|
|
677
|
-
* Get spool data.
|
|
678
|
-
*
|
|
679
|
-
* @param stakeMarketCoinName - Specific support stake market coin name.
|
|
680
|
-
* @param indexer - Whether to use indexer.
|
|
681
|
-
* @return Spool data.
|
|
682
|
-
*/
|
|
683
|
-
getSpool(stakeMarketCoinName: string, args?: {
|
|
684
|
-
marketPool?: MarketPool;
|
|
685
|
-
coinPrices?: CoinPrices;
|
|
686
|
-
indexer?: boolean;
|
|
687
|
-
}): Promise<Spool | undefined>;
|
|
688
|
-
/**
|
|
689
|
-
* Get stake accounts data for all stake pools (spools).
|
|
690
|
-
*
|
|
691
|
-
* @param ownerAddress - The owner address.
|
|
692
|
-
* @return All Stake accounts data.
|
|
693
|
-
*/
|
|
694
|
-
getAllStakeAccounts(ownerAddress?: string): Promise<StakeAccounts>;
|
|
695
|
-
/**
|
|
696
|
-
* Get stake accounts data for specific stake pool (spool).
|
|
697
|
-
*
|
|
698
|
-
* @param stakeMarketCoinName - Specific support stake market coin name.
|
|
699
|
-
* @param ownerAddress - The owner address.
|
|
700
|
-
* @return Stake accounts data.
|
|
701
|
-
*/
|
|
702
|
-
getStakeAccounts(stakeMarketCoinName: string, ownerAddress?: string): Promise<StakeAccount[]>;
|
|
703
|
-
/**
|
|
704
|
-
* Get stake pools (spools) data.
|
|
705
|
-
*
|
|
706
|
-
* @description
|
|
707
|
-
* For backward compatible, it is recommended to use `getSpools` method
|
|
708
|
-
* to get all spools data.
|
|
709
|
-
*
|
|
710
|
-
* @param stakeMarketCoinNames - Specific an array of support stake market coin name.
|
|
711
|
-
* @return Stake pools data.
|
|
712
|
-
*/
|
|
713
|
-
getStakePools(stakeMarketCoinNames?: string[]): Promise<{
|
|
714
|
-
[x: string]: StakePool | undefined;
|
|
715
|
-
}>;
|
|
716
|
-
/**
|
|
717
|
-
* Get stake pool (spool) data.
|
|
718
|
-
*
|
|
719
|
-
* @description
|
|
720
|
-
* For backward compatible, it is recommended to use `getSpool` method
|
|
721
|
-
* to get all spool data.
|
|
722
|
-
*
|
|
723
|
-
* @param stakeMarketCoinName - Specific support stake market coin name.
|
|
724
|
-
* @return Stake pool data.
|
|
725
|
-
*/
|
|
726
|
-
getStakePool(stakeMarketCoinName: string): Promise<StakePool | undefined>;
|
|
727
|
-
/**
|
|
728
|
-
* Get stake reward pools data.
|
|
729
|
-
*
|
|
730
|
-
* @description
|
|
731
|
-
* For backward compatible, it is recommended to use `getSpools` method
|
|
732
|
-
* to get all spools data.
|
|
733
|
-
*
|
|
734
|
-
* @param stakeMarketCoinNames - Specific an array of stake market coin name.
|
|
735
|
-
* @return Stake reward pools data.
|
|
736
|
-
*/
|
|
737
|
-
getStakeRewardPools(stakeMarketCoinNames?: string[]): Promise<{
|
|
738
|
-
[x: string]: StakeRewardPool | undefined;
|
|
739
|
-
}>;
|
|
740
|
-
/**
|
|
741
|
-
* Get stake reward pool data.
|
|
742
|
-
*
|
|
743
|
-
* @description
|
|
744
|
-
* For backward compatible, it is recommended to use `getSpool` method
|
|
745
|
-
* to get spool data.
|
|
746
|
-
*
|
|
747
|
-
* @param marketCoinName - Specific support stake market coin name.
|
|
748
|
-
* @return Stake reward pool data.
|
|
749
|
-
*/
|
|
750
|
-
getStakeRewardPool(stakeMarketCoinName: string): Promise<StakeRewardPool | undefined>;
|
|
751
|
-
/**
|
|
752
|
-
* Get borrow incentive pools data.
|
|
753
|
-
*
|
|
754
|
-
* @param coinNames - Specific an array of support borrow incentive coin name.
|
|
755
|
-
* @param indexer - Whether to use indexer.
|
|
756
|
-
* @return Borrow incentive pools data.
|
|
757
|
-
*/
|
|
758
|
-
getBorrowIncentivePools(coinNames?: string[], args?: {
|
|
759
|
-
coinPrices?: CoinPrices;
|
|
760
|
-
indexer?: boolean;
|
|
761
|
-
marketPools?: MarketPools;
|
|
762
|
-
}): Promise<{
|
|
763
|
-
[x: string]: BorrowIncentivePool | undefined;
|
|
764
|
-
}>;
|
|
765
|
-
/**
|
|
766
|
-
* Get borrow incentive accounts data.
|
|
767
|
-
*
|
|
768
|
-
* @param coinNames - Specific support borrow incentive coin name.
|
|
769
|
-
* @param ownerAddress - The owner address.
|
|
770
|
-
* @return Borrow incentive accounts data.
|
|
771
|
-
*/
|
|
772
|
-
getBorrowIncentiveAccounts(obligationId: string | SuiObjectRef, coinNames?: string[]): Promise<{
|
|
773
|
-
[x: string]: ParsedBorrowIncentiveAccountData | undefined;
|
|
774
|
-
}>;
|
|
775
|
-
/**
|
|
776
|
-
* Get user lending and spool infomation for specific pools.
|
|
777
|
-
*
|
|
778
|
-
* @param poolCoinNames - Specific an array of support pool coin name.
|
|
779
|
-
* @param ownerAddress - The owner address.
|
|
780
|
-
* @param indexer - Whether to use indexer.
|
|
781
|
-
* @return All lending and spool infomation.
|
|
782
|
-
*/
|
|
783
|
-
getLendings(poolCoinNames?: string[], ownerAddress?: string, args?: {
|
|
784
|
-
indexer?: boolean;
|
|
785
|
-
marketPools?: MarketPools;
|
|
786
|
-
coinPrices?: CoinPrices;
|
|
787
|
-
}): Promise<{
|
|
788
|
-
[x: string]: Lending | undefined;
|
|
789
|
-
}>;
|
|
790
|
-
/**
|
|
791
|
-
* Get user lending and spool information for specific pool.
|
|
792
|
-
*
|
|
793
|
-
* @param poolCoinName - Specific support pool coin name.
|
|
794
|
-
* @param ownerAddress - The owner address.
|
|
795
|
-
* @param indexer - Whether to use indexer.
|
|
796
|
-
* @return Lending pool data.
|
|
797
|
-
*/
|
|
798
|
-
getLending(poolCoinName: string, ownerAddress?: string, args?: {
|
|
799
|
-
indexer?: boolean;
|
|
800
|
-
}): Promise<Lending>;
|
|
801
|
-
/**
|
|
802
|
-
* Get user all obligation accounts information.
|
|
803
|
-
*
|
|
804
|
-
* @description
|
|
805
|
-
* All collateral and borrowing information in all obligation accounts owned by the user.
|
|
806
|
-
*
|
|
807
|
-
* @param ownerAddress - The owner address.
|
|
808
|
-
* @param indexer - Whether to use indexer.
|
|
809
|
-
* @return All obligation accounts information.
|
|
810
|
-
*/
|
|
811
|
-
getObligationAccounts(ownerAddress?: string, args?: {
|
|
812
|
-
indexer?: boolean;
|
|
813
|
-
market?: {
|
|
814
|
-
collaterals: MarketCollaterals;
|
|
815
|
-
pools: MarketPools;
|
|
816
|
-
};
|
|
817
|
-
coinPrices?: CoinPrices;
|
|
818
|
-
}): Promise<{
|
|
819
|
-
[x: string]: ObligationAccount | undefined;
|
|
820
|
-
}>;
|
|
821
|
-
/**
|
|
822
|
-
* Get obligation account information for specific id.
|
|
823
|
-
*
|
|
824
|
-
* @description
|
|
825
|
-
* borrowing and obligation information for specific pool.
|
|
826
|
-
*
|
|
827
|
-
* @param obligationId - The obligation id.
|
|
828
|
-
* @param ownerAddress - The owner address.
|
|
829
|
-
* @param indexer - Whether to use indexer.
|
|
830
|
-
* @return Borrowing and collateral information.
|
|
831
|
-
*/
|
|
832
|
-
getObligationAccount(obligationId: string, ownerAddress?: string, args?: {
|
|
833
|
-
indexer?: boolean;
|
|
834
|
-
}): Promise<ObligationAccount | undefined>;
|
|
835
|
-
/**
|
|
836
|
-
* Get total value locked.
|
|
837
|
-
*
|
|
838
|
-
* @param indexer - Whether to use indexer.
|
|
839
|
-
* @description
|
|
840
|
-
* Include total supplied value and total borrowed value.
|
|
841
|
-
*
|
|
842
|
-
* @return Total value locked.
|
|
843
|
-
*/
|
|
844
|
-
getTvl(args?: {
|
|
845
|
-
indexer?: boolean;
|
|
846
|
-
}): Promise<TotalValueLocked>;
|
|
847
|
-
/**
|
|
848
|
-
* Get veSca data.
|
|
849
|
-
* @param veScaKey
|
|
850
|
-
* @returns veSca
|
|
851
|
-
*/
|
|
852
|
-
getVeSca(veScaKey: string | SuiObjectData): Promise<Vesca | undefined>;
|
|
853
|
-
/**
|
|
854
|
-
* Get all veSca from walletAdddress
|
|
855
|
-
* @param walletAddress
|
|
856
|
-
* @returns array of veSca
|
|
857
|
-
*/
|
|
858
|
-
getVeScas({ walletAddress, excludeEmpty, }?: {
|
|
859
|
-
walletAddress?: string;
|
|
860
|
-
excludeEmpty?: boolean;
|
|
861
|
-
}): Promise<Vesca[]>;
|
|
862
|
-
/**
|
|
863
|
-
* Get total vesca treasury with movecall
|
|
864
|
-
* @returns Promise<string | undefined>
|
|
865
|
-
*/
|
|
866
|
-
getVeScaTreasuryInfo(): Promise<VeScaTreasuryInfo | null>;
|
|
867
|
-
/**
|
|
868
|
-
* Return binded referrer veScaKeyId of referee walletAddress if exist
|
|
869
|
-
* @param walletAddress
|
|
870
|
-
* @returns veScaKeyId
|
|
871
|
-
*/
|
|
872
|
-
getVeScaKeyIdFromReferralBindings(walletAddress?: string): Promise<string | null>;
|
|
873
|
-
/**
|
|
874
|
-
* Get binded obligationId from a veScaKey if it exists.
|
|
875
|
-
* @param veScaKey
|
|
876
|
-
* @returns obligationId
|
|
877
|
-
*/
|
|
878
|
-
getBindedObligationId(veScaKey: string): Promise<string | null>;
|
|
879
|
-
/**
|
|
880
|
-
* Get binded veSCA key from a obligationId if it exists.
|
|
881
|
-
* @param obligationId
|
|
882
|
-
* @returns veScaKey
|
|
883
|
-
*/
|
|
884
|
-
getBindedVeScaKey(obligationId: string): Promise<string | null>;
|
|
885
|
-
/**
|
|
886
|
-
* Get user's veSCA loyalty program informations
|
|
887
|
-
* @param veScaKey
|
|
888
|
-
* @returns Loyalty program information
|
|
889
|
-
*/
|
|
890
|
-
getLoyaltyProgramInfos(veScaKey?: string | SuiObjectData): Promise<LoyaltyProgramInfo | null>;
|
|
891
|
-
/**
|
|
892
|
-
* Get user's veSCA rewards informations from loyalty program
|
|
893
|
-
* @param veScaKey
|
|
894
|
-
* @returns Loyalty program information
|
|
895
|
-
*/
|
|
896
|
-
getVeScaLoyaltyProgramInfos(veScaKey?: string | SuiObjectData): Promise<VeScaLoyaltyProgramInfo | null>;
|
|
897
|
-
/**
|
|
898
|
-
* Get total supply of sCoin
|
|
899
|
-
* @param sCoinName - Supported sCoin name
|
|
900
|
-
* @returns Total Supply
|
|
901
|
-
*/
|
|
902
|
-
getSCoinTotalSupply(sCoinName: string): Promise<number>;
|
|
903
|
-
/**
|
|
904
|
-
* Get all sCoin amounts.
|
|
905
|
-
*
|
|
906
|
-
* @param sCoinNames - Specific an array of support sCoin name.
|
|
907
|
-
* @param ownerAddress - The owner address.
|
|
908
|
-
* @return All market sCoin amounts.
|
|
909
|
-
*/
|
|
910
|
-
getSCoinAmounts(sCoinNames?: string[], ownerAddress?: string): Promise<OptionalKeys<Record<string, number>>>;
|
|
911
|
-
/**
|
|
912
|
-
* Get sCoin amount.
|
|
913
|
-
*
|
|
914
|
-
* @param coinNames - Specific support sCoin name.
|
|
915
|
-
* @param ownerAddress - The owner address.
|
|
916
|
-
* @return sCoin amount.
|
|
917
|
-
*/
|
|
918
|
-
getSCoinAmount(sCoinName: string | string, ownerAddress?: string): Promise<number>;
|
|
919
|
-
/**
|
|
920
|
-
* Get swap rate from sCoin A to sCoin B
|
|
921
|
-
* @param assetCoinNames
|
|
922
|
-
* @returns
|
|
923
|
-
*/
|
|
924
|
-
getSCoinSwapRate(fromSCoin: string, toSCoin: string): Promise<number>;
|
|
925
|
-
getFlashLoanFees(assetCoinNames?: string[]): Promise<Record<string, number>>;
|
|
926
|
-
/**
|
|
927
|
-
* Get supply limit of lending pool
|
|
928
|
-
*/
|
|
929
|
-
getPoolSupplyLimit(poolName: string): Promise<string | null>;
|
|
930
|
-
/**
|
|
931
|
-
* Get borrow limit of borrow pool
|
|
932
|
-
*/
|
|
933
|
-
getPoolBorrowLimit(poolName: string): Promise<string | null>;
|
|
934
|
-
/**
|
|
935
|
-
* Get list of isolated assets
|
|
936
|
-
*/
|
|
937
|
-
getIsolatedAssets(useOnChainQuery?: boolean): Promise<string[]>;
|
|
938
|
-
/**
|
|
939
|
-
* Check if asset is an isolated asset
|
|
940
|
-
*/
|
|
941
|
-
isIsolatedAsset(assetCoinName: string): Promise<boolean>;
|
|
942
|
-
/**
|
|
943
|
-
* Get pool coin price from indexer
|
|
944
|
-
* @param coinName
|
|
945
|
-
* @returns price data
|
|
946
|
-
*/
|
|
947
|
-
getCoinPriceByIndexer(poolName: string): Promise<number>;
|
|
948
|
-
/**
|
|
949
|
-
* Get all supported pool price from indexer
|
|
950
|
-
* @returns prices data
|
|
951
|
-
*/
|
|
952
|
-
getCoinPricesByIndexer(): Promise<Record<string, number>>;
|
|
953
|
-
/**
|
|
954
|
-
* Get all coin prices, including sCoin
|
|
955
|
-
* @returns prices data
|
|
956
|
-
*/
|
|
957
|
-
getAllCoinPrices(args?: {
|
|
958
|
-
marketPools?: MarketPools;
|
|
959
|
-
coinPrices?: CoinPrices;
|
|
960
|
-
indexer?: boolean;
|
|
961
|
-
}): Promise<{
|
|
962
|
-
[x: string]: number | undefined;
|
|
963
|
-
}>;
|
|
964
|
-
/**
|
|
965
|
-
* Query all address (lending pool, collateral pool, borrow dynamics, interest models, etc.) of all pool
|
|
966
|
-
* @returns
|
|
967
|
-
*/
|
|
968
|
-
getPoolAddresses(apiAddressId?: string | undefined): Promise<OptionalKeys<Record<string, PoolAddress>>>;
|
|
969
|
-
/**
|
|
970
|
-
* Get user portfolio
|
|
971
|
-
*/
|
|
972
|
-
getUserPortfolio(args?: {
|
|
973
|
-
walletAddress?: string;
|
|
974
|
-
indexer?: boolean;
|
|
975
|
-
}): Promise<{
|
|
976
|
-
totalLockedScaValue: number;
|
|
977
|
-
lendings: {
|
|
978
|
-
suppliedCoin: number;
|
|
979
|
-
suppliedValue: number;
|
|
980
|
-
stakedCoin: number;
|
|
981
|
-
coinName: string;
|
|
982
|
-
symbol: string;
|
|
983
|
-
coinType: string;
|
|
984
|
-
coinPrice: number;
|
|
985
|
-
coinDecimals: number;
|
|
986
|
-
supplyApr: number;
|
|
987
|
-
supplyApy: number;
|
|
988
|
-
incentiveApr: number;
|
|
989
|
-
}[];
|
|
990
|
-
borrowings: {
|
|
991
|
-
obligationId: string;
|
|
992
|
-
totalDebtsInUsd: number;
|
|
993
|
-
totalCollateralInUsd: number;
|
|
994
|
-
riskLevel: number;
|
|
995
|
-
availableCollateralInUsd: number;
|
|
996
|
-
totalUnhealthyCollateralInUsd: number;
|
|
997
|
-
collaterals: {
|
|
998
|
-
coinName: string;
|
|
999
|
-
symbol: string;
|
|
1000
|
-
coinDecimals: number;
|
|
1001
|
-
coinType: string;
|
|
1002
|
-
coinPrice: number;
|
|
1003
|
-
depositedCoin: number;
|
|
1004
|
-
depositedValueInUsd: number;
|
|
1005
|
-
}[];
|
|
1006
|
-
borrowedPools: {
|
|
1007
|
-
coinName: string;
|
|
1008
|
-
symbol: string;
|
|
1009
|
-
coinDecimals: number;
|
|
1010
|
-
coinType: string;
|
|
1011
|
-
coinPrice: number;
|
|
1012
|
-
borrowedCoin: number;
|
|
1013
|
-
borrowedValueInUsd: number;
|
|
1014
|
-
borrowApr: number | undefined;
|
|
1015
|
-
borrowApy: number | undefined;
|
|
1016
|
-
incentiveInfos: {
|
|
1017
|
-
coinName: string;
|
|
1018
|
-
symbol: string;
|
|
1019
|
-
coinType: string;
|
|
1020
|
-
incentiveApr: number;
|
|
1021
|
-
}[];
|
|
1022
|
-
}[];
|
|
1023
|
-
}[];
|
|
1024
|
-
pendingRewards: {
|
|
1025
|
-
lendings: any;
|
|
1026
|
-
borrowIncentives: any;
|
|
1027
|
-
};
|
|
1028
|
-
veScas: {
|
|
1029
|
-
veScaKey: string;
|
|
1030
|
-
coinPrice: number;
|
|
1031
|
-
lockedScaInCoin: number;
|
|
1032
|
-
lockedScaInUsd: number;
|
|
1033
|
-
currentVeScaBalance: number;
|
|
1034
|
-
remainingLockPeriodInDays: number;
|
|
1035
|
-
unlockAt: number;
|
|
1036
|
-
}[];
|
|
1037
|
-
totalDebtValue: number;
|
|
1038
|
-
totalCollateralValue: number;
|
|
1039
|
-
totalSupplyValue: number;
|
|
1040
|
-
}>;
|
|
1041
|
-
/**
|
|
1042
|
-
* Get both primary and secondary price update policy objects
|
|
1043
|
-
* @returns price update policies
|
|
1044
|
-
*/
|
|
1045
|
-
getPriceUpdatePolicies(): Promise<{
|
|
1046
|
-
primary: _mysten_sui_dist_cjs_client.SuiObjectResponse | null;
|
|
1047
|
-
secondary: _mysten_sui_dist_cjs_client.SuiObjectResponse | null;
|
|
1048
|
-
}>;
|
|
1049
|
-
/**
|
|
1050
|
-
* Return the supported primary and secondary oracles for all supported pool assets
|
|
1051
|
-
* @returns
|
|
1052
|
-
*/
|
|
1053
|
-
getAssetOracles(): Promise<Record<string, xOracleRules>>;
|
|
1054
|
-
/**
|
|
1055
|
-
* Get switchboard on-demand aggregator object id based on coinType
|
|
1056
|
-
* @param coinType
|
|
1057
|
-
* @returns
|
|
1058
|
-
*/
|
|
1059
|
-
getSwitchboardOnDemandAggregatorObjectIds(coinName: string[]): Promise<string[]>;
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
type ScallopBuilderParams = {
|
|
1063
|
-
query?: ScallopQuery;
|
|
1064
|
-
usePythPullModel?: boolean;
|
|
1065
|
-
sponsoredFeeds?: string[];
|
|
1066
|
-
useOnChainXOracleList?: boolean;
|
|
1067
|
-
} & ScallopQueryParams;
|
|
1068
|
-
/**
|
|
1069
|
-
* @description
|
|
1070
|
-
* It provides methods for operating the transaction block, making it more convenient to organize transaction combinations.
|
|
1071
|
-
*
|
|
1072
|
-
* @example
|
|
1073
|
-
* ```typescript
|
|
1074
|
-
* const scallopBuilder = new ScallopBuilder(<parameters>);
|
|
1075
|
-
* await scallopBuilder.init();
|
|
1076
|
-
* const txBlock = scallopBuilder.<builder functions>();
|
|
1077
|
-
* ```
|
|
1078
|
-
*/
|
|
1079
|
-
declare class ScallopBuilder implements ScallopBuilderInterface {
|
|
1080
|
-
readonly query: ScallopQuery;
|
|
1081
|
-
readonly usePythPullModel: boolean;
|
|
1082
|
-
readonly useOnChainXOracleList: boolean;
|
|
1083
|
-
readonly sponsoredFeeds: string[];
|
|
1084
|
-
constructor(params: ScallopBuilderParams);
|
|
1085
|
-
get utils(): ScallopUtils;
|
|
1086
|
-
get constants(): ScallopConstants;
|
|
1087
|
-
get walletAddress(): string;
|
|
1088
|
-
get scallopSuiKit(): ScallopSuiKit;
|
|
1089
|
-
get suiKit(): _scallop_io_sui_kit.SuiKit;
|
|
1090
|
-
get address(): ScallopConstants;
|
|
1091
|
-
/**
|
|
1092
|
-
* Request the scallop API to initialize data.
|
|
1093
|
-
*
|
|
1094
|
-
* @param force - Whether to force initialization.
|
|
1095
|
-
*/
|
|
1096
|
-
init(force?: boolean): Promise<void>;
|
|
1097
|
-
/**
|
|
1098
|
-
* Create a scallop txBlock instance that enhances transaction block.
|
|
1099
|
-
*
|
|
1100
|
-
* @param txBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
1101
|
-
* @return Scallop txBlock.
|
|
1102
|
-
*/
|
|
1103
|
-
createTxBlock(txBlock?: ScallopTxBlock | SuiTxBlock | Transaction$1): ScallopTxBlock;
|
|
1104
|
-
/**
|
|
1105
|
-
* Specifying the sender's amount of coins to get coins args from transaction result.
|
|
1106
|
-
*
|
|
1107
|
-
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
1108
|
-
* @param assetCoinName - Specific support asset coin name.
|
|
1109
|
-
* @param amount - Amount of coins to be selected.
|
|
1110
|
-
* @param sender - Sender address.
|
|
1111
|
-
* @return Take coin and left coin.
|
|
1112
|
-
*/
|
|
1113
|
-
selectCoin<T extends string>(txBlock: ScallopTxBlock | SuiTxBlock, assetCoinName: T, amount: number, sender?: string): Promise<SelectCoinReturnType<T>>;
|
|
1114
|
-
/**
|
|
1115
|
-
* Specifying the sender's amount of market coins to get coins args from transaction result.
|
|
1116
|
-
*
|
|
1117
|
-
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
1118
|
-
* @param marketCoinName - Specific support market coin name.
|
|
1119
|
-
* @param amount - Amount of coins to be selected.
|
|
1120
|
-
* @param sender - Sender address.
|
|
1121
|
-
* @return Take coin and left coin.
|
|
1122
|
-
*/
|
|
1123
|
-
selectMarketCoin(txBlock: ScallopTxBlock | SuiTxBlock, marketCoinName: string, amount: number, sender?: string): Promise<{
|
|
1124
|
-
takeCoin: TransactionObjectArgument;
|
|
1125
|
-
leftCoin: TransactionObjectArgument;
|
|
1126
|
-
totalAmount: number;
|
|
1127
|
-
}>;
|
|
1128
|
-
/**
|
|
1129
|
-
* Specifying the sender's amount of sCoins to get coins args from transaction result.
|
|
1130
|
-
*
|
|
1131
|
-
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
1132
|
-
* @param marketCoinName - Specific support sCoin name.
|
|
1133
|
-
* @param amount - Amount of coins to be selected.
|
|
1134
|
-
* @param sender - Sender address.
|
|
1135
|
-
* @return Take coin and left coin.
|
|
1136
|
-
*/
|
|
1137
|
-
selectSCoin(txBlock: ScallopTxBlock | SuiTxBlock, sCoinName: string, amount: number, sender?: string): Promise<{
|
|
1138
|
-
takeCoin: TransactionObjectArgument;
|
|
1139
|
-
leftCoin: TransactionObjectArgument;
|
|
1140
|
-
totalAmount: number;
|
|
1141
|
-
}>;
|
|
1142
|
-
/**
|
|
1143
|
-
* Select sCoin or market coin automatically. Prioritize sCoin first
|
|
1144
|
-
*/
|
|
1145
|
-
selectSCoinOrMarketCoin(txBlock: ScallopTxBlock | SuiTxBlock, sCoinName: string, amount: number, sender?: string): Promise<{
|
|
1146
|
-
sCoin: TransactionObjectArgument | undefined;
|
|
1147
|
-
marketCoin: TransactionObjectArgument | undefined;
|
|
1148
|
-
}>;
|
|
1149
|
-
/**
|
|
1150
|
-
* Execute Scallop txBlock using the `signAndSendTxn` methods in suikit.
|
|
1151
|
-
*
|
|
1152
|
-
* @param txBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
1153
|
-
*/
|
|
1154
|
-
signAndSendTxBlock(txBlock: ScallopTxBlock | SuiTxBlock | Transaction$1): Promise<SuiTransactionBlockResponse>;
|
|
1155
|
-
moveCall(txb: ScallopTxBlock | SuiTxBlock, target: string, args?: (SuiTxArg | SuiVecTxArg | SuiObjectArg | SuiAmountsArg)[], typeArgs?: string[]): _scallop_io_sui_kit.TransactionResult;
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
interface ScallopBaseInterface {
|
|
1159
|
-
scallopSuiKit: ScallopSuiKit;
|
|
1160
|
-
constants: ScallopConstants;
|
|
1161
|
-
walletAddress: string;
|
|
1162
|
-
init: () => Promise<void>;
|
|
1163
|
-
}
|
|
1164
|
-
interface ScallopUtilsInterface extends ScallopBaseInterface {
|
|
1165
|
-
address: ScallopAddress;
|
|
1166
|
-
}
|
|
1167
|
-
interface ScallopQueryInterface extends ScallopUtilsInterface {
|
|
1168
|
-
utils: ScallopUtils;
|
|
1169
|
-
}
|
|
1170
|
-
interface ScallopBuilderInterface extends ScallopQueryInterface {
|
|
1171
|
-
query: ScallopQuery;
|
|
1172
|
-
}
|
|
1173
|
-
interface ScallopClientInterface extends ScallopBaseInterface {
|
|
1174
|
-
builder: ScallopBuilder;
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
type ScallopUtilsParams = {
|
|
1178
|
-
pythEndpoints?: string[];
|
|
1179
|
-
scallopSuiKit?: ScallopSuiKit;
|
|
1180
|
-
scallopConstants?: ScallopConstants;
|
|
1181
|
-
} & ScallopSuiKitParams & ScallopConstantsParams;
|
|
1182
|
-
declare class ScallopUtils implements ScallopUtilsInterface {
|
|
1183
|
-
pythEndpoints: string[];
|
|
1184
|
-
readonly scallopSuiKit: ScallopSuiKit;
|
|
1185
|
-
readonly constants: ScallopConstants;
|
|
1186
|
-
constructor(params?: ScallopUtilsParams);
|
|
1187
|
-
get walletAddress(): string;
|
|
1188
|
-
get suiKit(): _scallop_io_sui_kit.SuiKit;
|
|
1189
|
-
get queryClient(): _tanstack_query_core.QueryClient;
|
|
1190
|
-
get address(): ScallopConstants;
|
|
1191
|
-
isSuiBridgeAsset(coinName: any): boolean;
|
|
1192
|
-
isWormholeAsset(coinName: any): boolean;
|
|
1193
|
-
isMarketCoin(coinName: string): boolean;
|
|
1194
|
-
init({ force }?: {
|
|
1195
|
-
force?: boolean;
|
|
1196
|
-
}): Promise<void>;
|
|
1197
|
-
/**
|
|
1198
|
-
* Convert market coin name to coin name.
|
|
1199
|
-
*
|
|
1200
|
-
* @param marketCoinName - Specific support market coin name.
|
|
1201
|
-
* @return Coin Name.
|
|
1202
|
-
*/
|
|
1203
|
-
parseCoinName<T extends string>(marketCoinName: string): T;
|
|
1204
|
-
/**
|
|
1205
|
-
* Convert coin name to symbol.
|
|
1206
|
-
*
|
|
1207
|
-
* @param coinName - Specific support coin name.
|
|
1208
|
-
* @return Symbol string.
|
|
1209
|
-
*/
|
|
1210
|
-
parseSymbol(coinName: string): string;
|
|
1211
|
-
/**
|
|
1212
|
-
* Convert coin name to coin type.
|
|
1213
|
-
*
|
|
1214
|
-
* @description
|
|
1215
|
-
* The Coin type of wormhole is fixed `coin:Coin`. Here using package id
|
|
1216
|
-
* to determine and return the type.
|
|
1217
|
-
*
|
|
1218
|
-
* @param coinPackageId - Package id of coin.
|
|
1219
|
-
* @param coinName - Specific support coin name.
|
|
1220
|
-
* @return Coin type.
|
|
1221
|
-
*/
|
|
1222
|
-
parseCoinType(coinName: string, useOldMarketCoin?: boolean): string;
|
|
1223
|
-
/**
|
|
1224
|
-
* Convert coin name to sCoin name.
|
|
1225
|
-
*
|
|
1226
|
-
* @param coinName - Specific support coin name.
|
|
1227
|
-
* @return sCoin name.
|
|
1228
|
-
*/
|
|
1229
|
-
parseSCoinName<T extends string>(coinName: string): T | undefined;
|
|
1230
|
-
/**
|
|
1231
|
-
* Convert sCoin name to market coin name.
|
|
1232
|
-
* This function will parse new sCoin name `scallop_...` to its old market coin name which is shorter
|
|
1233
|
-
* e.g: `scallop_sui -> ssui
|
|
1234
|
-
* if no `scallop_...` is encountered, return coinName
|
|
1235
|
-
* @return sCoin name
|
|
1236
|
-
*/
|
|
1237
|
-
parseSCoinTypeNameToMarketCoinName(coinName: string): string;
|
|
1238
|
-
/**
|
|
1239
|
-
* Convert sCoin name into sCoin type
|
|
1240
|
-
* @param sCoinName
|
|
1241
|
-
* @returns sCoin type
|
|
1242
|
-
*/
|
|
1243
|
-
parseSCoinType(sCoinName: string): string;
|
|
1244
|
-
/**
|
|
1245
|
-
* Convert sCoinType into sCoin name
|
|
1246
|
-
* @param sCoinType
|
|
1247
|
-
* @returns sCoin name
|
|
1248
|
-
*/
|
|
1249
|
-
parseSCoinNameFromType(sCoinType: string): string | undefined;
|
|
1250
|
-
/**
|
|
1251
|
-
* Convert sCoin name into its underlying coin type
|
|
1252
|
-
* @param sCoinName
|
|
1253
|
-
* @returns coin type
|
|
1254
|
-
*/
|
|
1255
|
-
parseUnderlyingSCoinType(sCoinName: string): string;
|
|
1256
|
-
/**
|
|
1257
|
-
* Get sCoin treasury id from sCoin name
|
|
1258
|
-
* @param sCoinName
|
|
1259
|
-
* @returns sCoin treasury id
|
|
1260
|
-
*/
|
|
1261
|
-
getSCoinTreasury(sCoinName: string): any;
|
|
1262
|
-
/**
|
|
1263
|
-
* Convert coin name to market coin type.
|
|
1264
|
-
*
|
|
1265
|
-
* @param coinPackageId - Package id of coin.
|
|
1266
|
-
* @param coinName - Specific support coin name.
|
|
1267
|
-
* @return Market coin type.
|
|
1268
|
-
*/
|
|
1269
|
-
parseMarketCoinType(coinName: string): string;
|
|
1270
|
-
/**
|
|
1271
|
-
* Convert coin name to market coin name.
|
|
1272
|
-
*
|
|
1273
|
-
* @param coinName - Specific support coin name.
|
|
1274
|
-
* @return Market coin name.
|
|
1275
|
-
*/
|
|
1276
|
-
parseMarketCoinName<T extends string>(coinName: string): T;
|
|
1277
|
-
/**
|
|
1278
|
-
* Get reward type of spool.
|
|
1279
|
-
*
|
|
1280
|
-
* @param stakeMarketCoinName - Support stake market coin.
|
|
1281
|
-
* @return Spool reward coin name.
|
|
1282
|
-
*/
|
|
1283
|
-
getSpoolRewardCoinName: () => string;
|
|
1284
|
-
/**
|
|
1285
|
-
* Get coin decimal.
|
|
1286
|
-
*
|
|
1287
|
-
* return Coin decimal.
|
|
1288
|
-
*/
|
|
1289
|
-
getCoinDecimal(coinName: string): number;
|
|
1290
|
-
/**
|
|
1291
|
-
* Get coin wrapped type.
|
|
1292
|
-
*
|
|
1293
|
-
* return Coin wrapped type.
|
|
1294
|
-
*/
|
|
1295
|
-
getCoinWrappedType(assetCoinName: string): CoinWrappedType;
|
|
1296
|
-
/**
|
|
1297
|
-
* Convert coin type to coin name.
|
|
1298
|
-
*
|
|
1299
|
-
* @description
|
|
1300
|
-
* The coin name cannot be obtained directly from the wormhole type. Here
|
|
1301
|
-
* the package id is used to determine and return a specific name.
|
|
1302
|
-
*
|
|
1303
|
-
* @param coinType - Specific support coin type.
|
|
1304
|
-
* @return Coin Name.
|
|
1305
|
-
*/
|
|
1306
|
-
parseCoinNameFromType(coinType: string): string;
|
|
1307
|
-
/**
|
|
1308
|
-
* Select coin id that add up to the given amount as transaction arguments.
|
|
1309
|
-
*
|
|
1310
|
-
* @param ownerAddress - The address of the owner.
|
|
1311
|
-
* @param amount - The amount that including coin decimals.
|
|
1312
|
-
* @param coinType - The coin type, default is 0x2::SUI::SUI.
|
|
1313
|
-
* @return The selected transaction coin arguments.
|
|
1314
|
-
*/
|
|
1315
|
-
selectCoins(amount: number, coinType?: string, ownerAddress?: string): Promise<{
|
|
1316
|
-
objectId: string;
|
|
1317
|
-
digest: string;
|
|
1318
|
-
version: string;
|
|
1319
|
-
balance: string;
|
|
1320
|
-
}[]>;
|
|
1321
|
-
/**
|
|
1322
|
-
* Merge coins with type `coinType` to dest
|
|
1323
|
-
* @param txBlock
|
|
1324
|
-
* @param dest
|
|
1325
|
-
* @param coinType
|
|
1326
|
-
* @param sender
|
|
1327
|
-
*/
|
|
1328
|
-
mergeSimilarCoins(txBlock: SuiTxBlock | Transaction, dest: SuiObjectArg, coinType: string, sender?: string): Promise<void>;
|
|
1329
|
-
/**
|
|
1330
|
-
* Get all asset coin names in the obligation record by obligation id.
|
|
1331
|
-
*
|
|
1332
|
-
* @description
|
|
1333
|
-
* This can often be used to determine which assets in an obligation require
|
|
1334
|
-
* price updates before interacting with specific instructions of the Scallop contract.
|
|
1335
|
-
*
|
|
1336
|
-
* @param obligationId - The obligation id.
|
|
1337
|
-
* @return Asset coin Names.
|
|
1338
|
-
*/
|
|
1339
|
-
getObligationCoinNames(obligationId: SuiObjectArg): Promise<string[] | undefined>;
|
|
1340
|
-
private parseDataFromPythPriceFeed;
|
|
1341
|
-
getPythPrice(assetCoinName: string, priceFeedObject?: SuiObjectData | null): Promise<number>;
|
|
1342
|
-
getPythPrices(assetCoinNames: string[]): Promise<Record<string, number>>;
|
|
1343
|
-
/**
|
|
1344
|
-
* Get asset coin price.
|
|
1345
|
-
*
|
|
1346
|
-
* @description
|
|
1347
|
-
* The strategy for obtaining the price is to get it through API first,
|
|
1348
|
-
* and then on-chain data if API cannot be retrieved.
|
|
1349
|
-
* Currently, we only support obtaining from pyth protocol, other
|
|
1350
|
-
* oracles will be supported in the future.
|
|
1351
|
-
*
|
|
1352
|
-
* @param assetCoinNames - Specific an array of support asset coin name.
|
|
1353
|
-
* @return Asset coin price.
|
|
1354
|
-
*/
|
|
1355
|
-
getCoinPrices(coinNames?: string[]): Promise<OptionalKeys<Record<string, number>>>;
|
|
1356
|
-
/**
|
|
1357
|
-
* Convert apr to apy.
|
|
1358
|
-
*
|
|
1359
|
-
* @param apr The annual percentage rate (APR).
|
|
1360
|
-
* @param compoundFrequency How often interest is compounded per year. Default is daily (365 times a year).
|
|
1361
|
-
* @return The equivalent annual percentage yield (APY) for the given APR and compounding frequency.
|
|
1362
|
-
*/
|
|
1363
|
-
parseAprToApy(apr: number, compoundFrequency?: number): number;
|
|
1364
|
-
/**
|
|
1365
|
-
* Convert apy to apr.
|
|
1366
|
-
*
|
|
1367
|
-
* @param apr The equivalent annual percentage yield (APY).
|
|
1368
|
-
* @param compoundFrequency How often interest is compounded per year. Default is daily (365 times a year).
|
|
1369
|
-
* @return The equivalent annual percentage rate (APR) for the given APY and compounding frequency.
|
|
1370
|
-
*/
|
|
1371
|
-
parseApyToApr(apy: number, compoundFrequency?: number): number;
|
|
1372
|
-
/**
|
|
1373
|
-
* Give extend lock period to get unlock at in seconds timestamp.
|
|
1374
|
-
*
|
|
1375
|
-
* @description
|
|
1376
|
-
* - When the user without remaining unlock period, If the extended unlock day is not specified,
|
|
1377
|
-
* the unlock period will be increased by one day by default.
|
|
1378
|
-
* - When the given extended day plus the user's remaining unlock period exceeds the maximum
|
|
1379
|
-
* unlock period, the maximum unlock period is used as unlock period.
|
|
1380
|
-
*
|
|
1381
|
-
* @param extendLockPeriodInDay The extend lock period in day.
|
|
1382
|
-
* @param unlockAtInSecondTimestamp The unlock timestamp from veSca object.
|
|
1383
|
-
* @return New unlock at in seconds timestamp.
|
|
1384
|
-
*/
|
|
1385
|
-
getUnlockAt(extendLockPeriodInDay?: number, unlockAtInMillisTimestamp?: number): number;
|
|
1386
|
-
/**
|
|
1387
|
-
* Get detailed contract address and price id information for supported pool in Scallop
|
|
1388
|
-
* @returns Supported pool informations
|
|
1389
|
-
*/
|
|
1390
|
-
getSupportedPoolAddresses(): PoolAddress[];
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
type ScallopClientParams = {
|
|
1394
|
-
networkType?: NetworkType;
|
|
1395
|
-
builder?: ScallopBuilder;
|
|
1396
|
-
} & ScallopBuilderParams;
|
|
1397
|
-
type ScallopClientFnReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : Transaction$1;
|
|
1398
|
-
type ScallopClientVeScaReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : {
|
|
1399
|
-
tx: Transaction$1;
|
|
1400
|
-
scaCoin: TransactionResult;
|
|
1401
|
-
};
|
|
1402
|
-
/**
|
|
1403
|
-
* @description
|
|
1404
|
-
* It provides contract interaction operations for general users.
|
|
1405
|
-
*
|
|
1406
|
-
* @example
|
|
1407
|
-
* ```typescript
|
|
1408
|
-
* const scallopClient = new ScallopClient(<parameters>);
|
|
1409
|
-
* await scallopClient.init();
|
|
1410
|
-
* scallopClient.<client functions>();
|
|
1411
|
-
* await scallopClient.<client async functions>();
|
|
1412
|
-
* ```
|
|
1413
|
-
*/
|
|
1414
|
-
declare class ScallopClient implements ScallopClientInterface {
|
|
1415
|
-
readonly builder: ScallopBuilder;
|
|
1416
|
-
networkType: NetworkType;
|
|
1417
|
-
constructor(params: ScallopClientParams);
|
|
1418
|
-
get query(): ScallopQuery;
|
|
1419
|
-
get utils(): ScallopUtils;
|
|
1420
|
-
get constants(): ScallopConstants;
|
|
1421
|
-
get walletAddress(): string;
|
|
1422
|
-
get scallopSuiKit(): ScallopSuiKit;
|
|
1423
|
-
get address(): ScallopConstants;
|
|
1424
|
-
/**
|
|
1425
|
-
* Request the scallop API to initialize data.
|
|
1426
|
-
*
|
|
1427
|
-
* @param force - Whether to force initialization.
|
|
1428
|
-
*/
|
|
1429
|
-
init(force?: boolean): Promise<void>;
|
|
1430
|
-
/**
|
|
1431
|
-
* Query market data.
|
|
1432
|
-
*
|
|
1433
|
-
* @description
|
|
1434
|
-
* This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
|
|
1435
|
-
*
|
|
1436
|
-
* @return Market data.
|
|
1437
|
-
*/
|
|
1438
|
-
queryMarket(): Promise<Market>;
|
|
1439
|
-
/**
|
|
1440
|
-
* Get obligations data.
|
|
1441
|
-
*
|
|
1442
|
-
* @description
|
|
1443
|
-
* This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
|
|
1444
|
-
*
|
|
1445
|
-
* @param ownerAddress - The owner address.
|
|
1446
|
-
* @return Obligations data.
|
|
1447
|
-
*/
|
|
1448
|
-
getObligations(ownerAddress?: string): Promise<Obligation[]>;
|
|
1449
|
-
/**
|
|
1450
|
-
* Query obligation data.
|
|
1451
|
-
*
|
|
1452
|
-
* @description
|
|
1453
|
-
* This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
|
|
1454
|
-
*
|
|
1455
|
-
* @param obligationId - The obligation id.
|
|
1456
|
-
* @return Obligation data.
|
|
1457
|
-
*/
|
|
1458
|
-
queryObligation(obligationId: string): Promise<ObligationQueryInterface | undefined>;
|
|
1459
|
-
/**
|
|
1460
|
-
* Query all stake accounts data.
|
|
1461
|
-
*
|
|
1462
|
-
* @description
|
|
1463
|
-
* This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
|
|
1464
|
-
*
|
|
1465
|
-
* @param ownerAddress - The owner address.
|
|
1466
|
-
* @return All stake accounts data.
|
|
1467
|
-
*/
|
|
1468
|
-
getAllStakeAccounts(ownerAddress?: string): Promise<StakeAccounts>;
|
|
1469
|
-
/**
|
|
1470
|
-
* Query stake account data.
|
|
1471
|
-
*
|
|
1472
|
-
* @description
|
|
1473
|
-
* This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
|
|
1474
|
-
*
|
|
1475
|
-
* @param stakeMarketCoinName - Support stake market coin.
|
|
1476
|
-
* @param ownerAddress - The owner address.
|
|
1477
|
-
* @return Stake accounts data.
|
|
1478
|
-
*/
|
|
1479
|
-
getStakeAccounts(stakeMarketCoinName: string, ownerAddress?: string): Promise<StakeAccount[]>;
|
|
1480
|
-
/**
|
|
1481
|
-
* Query stake pool data.
|
|
1482
|
-
*
|
|
1483
|
-
* @description
|
|
1484
|
-
* This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
|
|
1485
|
-
*
|
|
1486
|
-
* @param stakeMarketCoinName - Support stake market coin.
|
|
1487
|
-
* @return Stake pool data.
|
|
1488
|
-
*/
|
|
1489
|
-
getStakePool(stakeMarketCoinName: string): Promise<StakePool | undefined>;
|
|
1490
|
-
/**
|
|
1491
|
-
* Query reward pool data.
|
|
1492
|
-
*
|
|
1493
|
-
* @description
|
|
1494
|
-
* This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
|
|
1495
|
-
*
|
|
1496
|
-
* @param stakeMarketCoinName - Support stake market coin.
|
|
1497
|
-
* @return Reward pool data.
|
|
1498
|
-
*/
|
|
1499
|
-
getStakeRewardPool(stakeMarketCoinName: string): Promise<StakeRewardPool | undefined>;
|
|
1500
|
-
/**
|
|
1501
|
-
* Open obligation.
|
|
1502
|
-
*
|
|
1503
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1504
|
-
* @return Transaction block response or transaction block.
|
|
1505
|
-
*/
|
|
1506
|
-
openObligation(): Promise<SuiTransactionBlockResponse>;
|
|
1507
|
-
openObligation<S extends boolean>(sign?: S): Promise<ScallopClientFnReturnType<S>>;
|
|
1508
|
-
/**
|
|
1509
|
-
* Deposit collateral into the specific pool.
|
|
1510
|
-
*
|
|
1511
|
-
* @param collateralCoinName - Types of collateral coin.
|
|
1512
|
-
* @param amount - The amount of coins would deposit.
|
|
1513
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1514
|
-
* @param obligationId - The obligation object.
|
|
1515
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1516
|
-
* @return Transaction block response or transaction block.
|
|
1517
|
-
*/
|
|
1518
|
-
depositCollateral(collateralCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1519
|
-
depositCollateral<S extends boolean>(collateralCoinName: string, amount: number, sign?: S, obligationId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1520
|
-
/**
|
|
1521
|
-
* Withdraw collateral from the specific pool.
|
|
1522
|
-
*
|
|
1523
|
-
* @param collateralCoinName - Types of collateral coin.
|
|
1524
|
-
* @param amount - The amount of coins would deposit.
|
|
1525
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1526
|
-
* @param obligationId - The obligation object.
|
|
1527
|
-
* @param obligationKey - The obligation key object to verifying obligation authority.
|
|
1528
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1529
|
-
* @return Transaction block response or transaction block.
|
|
1530
|
-
*/
|
|
1531
|
-
withdrawCollateral<S extends boolean>(collateralCoinName: string, amount: number, sign: S | undefined, obligationId: string, obligationKey: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1532
|
-
/**
|
|
1533
|
-
* Deposit asset into the specific pool.
|
|
1534
|
-
*
|
|
1535
|
-
* @param poolCoinName - Types of pool coin.
|
|
1536
|
-
* @param amount - The amount of coins would deposit.
|
|
1537
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1538
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1539
|
-
* @return Transaction block response or transaction block.
|
|
1540
|
-
*/
|
|
1541
|
-
deposit(poolCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1542
|
-
deposit<S extends boolean>(poolCoinName: string, amount: number, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1543
|
-
/**
|
|
1544
|
-
* Deposit asset into the specific pool and Stake market coin into the corresponding spool.
|
|
1545
|
-
*
|
|
1546
|
-
* @param stakeCoinName - Types of stake coin.
|
|
1547
|
-
* @param amount - The amount of coins would deposit.
|
|
1548
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1549
|
-
* @param stakeAccountId - The stake account object.
|
|
1550
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1551
|
-
* @return Transaction block response or transaction block.
|
|
1552
|
-
*/
|
|
1553
|
-
depositAndStake(stakeCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1554
|
-
depositAndStake<S extends boolean>(stakeCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1555
|
-
/**
|
|
1556
|
-
* Withdraw asset from the specific pool, must return market coin.
|
|
1557
|
-
*
|
|
1558
|
-
* @param poolCoinName - Specific support pool coin name.
|
|
1559
|
-
* @param amount - The amount of coins would withdraw.
|
|
1560
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1561
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1562
|
-
* @return Transaction block response or transaction block.
|
|
1563
|
-
*/
|
|
1564
|
-
withdraw(poolCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1565
|
-
withdraw<S extends boolean>(poolCoinName: string, amount: number, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1566
|
-
/**
|
|
1567
|
-
* Borrow asset from the specific pool.
|
|
1568
|
-
*
|
|
1569
|
-
* @param poolCoinName - Specific support pool coin name.
|
|
1570
|
-
* @param amount - The amount of coins would borrow.
|
|
1571
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1572
|
-
* @param obligationId - The obligation object.
|
|
1573
|
-
* @param obligationKey - The obligation key object to verifying obligation authority.
|
|
1574
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1575
|
-
* @return Transaction block response or transaction block.
|
|
1576
|
-
*/
|
|
1577
|
-
borrow<S extends boolean>(poolCoinName: string, amount: number, sign: S | undefined, obligationId: string, obligationKey: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1578
|
-
/**
|
|
1579
|
-
* Repay asset into the specific pool.
|
|
1580
|
-
*
|
|
1581
|
-
* @param poolCoinName - Specific support pool coin name.
|
|
1582
|
-
* @param amount - The amount of coins would repay.
|
|
1583
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1584
|
-
* @param obligationId - The obligation object.
|
|
1585
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1586
|
-
* @return Transaction block response or transaction block.
|
|
1587
|
-
*/
|
|
1588
|
-
repay<S extends boolean>(poolCoinName: string, amount: number, sign: S | undefined, obligationId: string, obligationKey: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1589
|
-
/**
|
|
1590
|
-
* FlashLoan asset from the specific pool.
|
|
1591
|
-
*
|
|
1592
|
-
* @param poolCoinName - Specific support pool coin name..
|
|
1593
|
-
* @param amount - The amount of coins would repay.
|
|
1594
|
-
* @param callback - The callback function to build transaction block and return coin argument.
|
|
1595
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1596
|
-
* @return Transaction block response or transaction block.
|
|
1597
|
-
*/
|
|
1598
|
-
flashLoan(poolCoinName: string, amount: number, callback: (txBlock: ScallopTxBlock, coin: TransactionObjectArgument | string) => SuiObjectArg): Promise<SuiTransactionBlockResponse>;
|
|
1599
|
-
flashLoan<S extends boolean>(poolCoinName: string, amount: number, callback: (txBlock: ScallopTxBlock, coin: TransactionObjectArgument | string) => SuiObjectArg, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1600
|
-
/**
|
|
1601
|
-
* Create stake account.
|
|
1602
|
-
*
|
|
1603
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1604
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1605
|
-
* @return Transaction block response or transaction block.
|
|
1606
|
-
*/
|
|
1607
|
-
createStakeAccount(marketCoinName: string): Promise<SuiTransactionBlockResponse>;
|
|
1608
|
-
createStakeAccount<S extends boolean>(marketCoinName: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1609
|
-
/**
|
|
1610
|
-
* Stake market coin into the specific spool.
|
|
1611
|
-
*
|
|
1612
|
-
* @param marketCoinName - Types of market coin.
|
|
1613
|
-
* @param amount - The amount of coins would deposit.
|
|
1614
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1615
|
-
* @param stakeAccountId - The stake account object.
|
|
1616
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1617
|
-
* @return Transaction block response or transaction block.
|
|
1618
|
-
*/
|
|
1619
|
-
stake(stakeMarketCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1620
|
-
stake<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1621
|
-
/**
|
|
1622
|
-
* Unstake market coin from the specific spool.
|
|
1623
|
-
*
|
|
1624
|
-
* @param stakeMarketCoinName - Types of mak coin.
|
|
1625
|
-
* @param amount - The amount of coins would deposit.
|
|
1626
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1627
|
-
* @param accountId - The stake account object.
|
|
1628
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1629
|
-
* @return Transaction block response or transaction block.
|
|
1630
|
-
*/
|
|
1631
|
-
unstake(stakeMarketCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1632
|
-
unstake<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1633
|
-
/**
|
|
1634
|
-
* Unstake market coin from the specific spool and withdraw asset from the corresponding pool.
|
|
1635
|
-
*
|
|
1636
|
-
* @param marketCoinName - Types of mak coin.
|
|
1637
|
-
* @param amount - The amount of coins would deposit.
|
|
1638
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1639
|
-
* @param accountId - The stake account object.
|
|
1640
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1641
|
-
* @return Transaction block response or transaction block.
|
|
1642
|
-
*/
|
|
1643
|
-
unstakeAndWithdraw(stakeMarketCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1644
|
-
unstakeAndWithdraw<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1645
|
-
/**
|
|
1646
|
-
* Claim reward coin from the specific spool.
|
|
1647
|
-
*
|
|
1648
|
-
* @param stakeMarketCoinName - Types of mak coin.
|
|
1649
|
-
* @param amount - The amount of coins would deposit.
|
|
1650
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1651
|
-
* @param accountId - The stake account object.
|
|
1652
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1653
|
-
* @return Transaction block response or transaction block.
|
|
1654
|
-
*/
|
|
1655
|
-
claim(stakeMarketCoinName: string): Promise<SuiTransactionBlockResponse>;
|
|
1656
|
-
claim<S extends boolean>(stakeMarketCoinName: string, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1657
|
-
/**
|
|
1658
|
-
* stake obligaion.
|
|
1659
|
-
*
|
|
1660
|
-
* @param obligationId - The obligation account object.
|
|
1661
|
-
* @param obligationKeyId - The obligation key account object.
|
|
1662
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1663
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1664
|
-
* @return Transaction block response or transaction block
|
|
1665
|
-
*/
|
|
1666
|
-
stakeObligation<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1667
|
-
/**
|
|
1668
|
-
* unstake obligaion.
|
|
1669
|
-
*
|
|
1670
|
-
* @param obligationId - The obligation account object.
|
|
1671
|
-
* @param obligationKeyId - The obligation key account object.
|
|
1672
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1673
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1674
|
-
* @return Transaction block response or transaction block
|
|
1675
|
-
*/
|
|
1676
|
-
unstakeObligation<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1677
|
-
/**
|
|
1678
|
-
* Claim borrow incentive reward.
|
|
1679
|
-
*
|
|
1680
|
-
* @param poolName
|
|
1681
|
-
* @param amount - The amount of coins would deposit.
|
|
1682
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1683
|
-
* @param accountId - The stake account object.
|
|
1684
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1685
|
-
* @return Transaction block response or transaction block
|
|
1686
|
-
*/
|
|
1687
|
-
claimBorrowIncentive<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1688
|
-
/**
|
|
1689
|
-
* Function to migrate all market coin in user wallet into sCoin
|
|
1690
|
-
* @returns Transaction response
|
|
1691
|
-
*/
|
|
1692
|
-
migrateAllMarketCoin<S extends boolean>(includeStakePool?: boolean, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1693
|
-
/**
|
|
1694
|
-
* Claim unlocked SCA from all veSCA accounts.
|
|
1695
|
-
*/
|
|
1696
|
-
claimAllUnlockedSca(): Promise<SuiTransactionBlockResponse>;
|
|
1697
|
-
claimAllUnlockedSca<S extends boolean>(sign?: S, walletAddress?: string): Promise<ScallopClientVeScaReturnType<S>>;
|
|
1698
|
-
/**
|
|
1699
|
-
* Mint and get test coin.
|
|
1700
|
-
*
|
|
1701
|
-
* @remarks
|
|
1702
|
-
* Only be used on the test network.
|
|
1703
|
-
*
|
|
1704
|
-
* @param assetCoinName - Specific asset coin name.
|
|
1705
|
-
* @param amount - The amount of coins minted and received.
|
|
1706
|
-
* @param receiveAddress - The wallet address that receives the coins.
|
|
1707
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1708
|
-
* @return Transaction block response or transaction block.
|
|
1709
|
-
*/
|
|
1710
|
-
mintTestCoin(assetCoinName: Exclude<string, 'sui'>, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1711
|
-
mintTestCoin<S extends boolean>(assetCoinName: Exclude<string, 'sui'>, amount: number, sign?: S, receiveAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1712
|
-
}
|
|
1713
|
-
|
|
1714
|
-
/**
|
|
1715
|
-
* @argument params - The parameters for the Scallop instance.
|
|
1716
|
-
* @argument cacheOptions - The cache options for the QueryClient.
|
|
1717
|
-
*
|
|
1718
|
-
* @description
|
|
1719
|
-
* The main instance that controls interaction with the Scallop contract.
|
|
1720
|
-
*
|
|
1721
|
-
* @example
|
|
1722
|
-
* ```typescript
|
|
1723
|
-
* const sdk = new Scallop(<parameters>);
|
|
1724
|
-
* const scallopAddress = await sdk.getScallopAddress();
|
|
1725
|
-
* const scallopBuilder = await sdk.createScallopBuilder();
|
|
1726
|
-
* const scallopClient = await sdk.createScallopClient();
|
|
1727
|
-
* const scallopIndexer= await sdk.createScallopIndexer();
|
|
1728
|
-
* const scallopUtils= await sdk.createScallopUtils();
|
|
1729
|
-
* ```
|
|
1730
|
-
*/
|
|
1731
|
-
type ScallopParams = {
|
|
1732
|
-
client?: ScallopClient;
|
|
1733
|
-
} & ScallopClientParams;
|
|
1734
|
-
declare class Scallop {
|
|
1735
|
-
readonly client: ScallopClient;
|
|
1736
|
-
constructor(params: ScallopParams);
|
|
1737
|
-
init(force?: boolean): Promise<void>;
|
|
1738
|
-
/**
|
|
1739
|
-
* Create a scallop client instance that already has initial data.
|
|
1740
|
-
*
|
|
1741
|
-
* @return Scallop Client.
|
|
1742
|
-
*/
|
|
1743
|
-
createScallopClient(): Promise<ScallopClient>;
|
|
1744
|
-
/**
|
|
1745
|
-
* Create a scallop builder instance that already has initial data.
|
|
1746
|
-
*
|
|
1747
|
-
* @return Scallop Builder.
|
|
1748
|
-
*/
|
|
1749
|
-
createScallopBuilder(): Promise<ScallopBuilder>;
|
|
1750
|
-
/**
|
|
1751
|
-
* Create a scallop query instance.
|
|
1752
|
-
*
|
|
1753
|
-
* @return Scallop Query.
|
|
1754
|
-
*/
|
|
1755
|
-
createScallopQuery(): Promise<ScallopQuery>;
|
|
1756
|
-
/**
|
|
1757
|
-
* Create a scallop utils instance.
|
|
1758
|
-
*
|
|
1759
|
-
* @return Scallop Utils.
|
|
1760
|
-
*/
|
|
1761
|
-
createScallopUtils(): Promise<ScallopUtils>;
|
|
1762
|
-
/**
|
|
1763
|
-
* Create a scallop indexer instance.
|
|
1764
|
-
*
|
|
1765
|
-
* @return Scallop Indexer.
|
|
1766
|
-
*/
|
|
1767
|
-
createScallopIndexer(): Promise<ScallopIndexer>;
|
|
1768
|
-
/**
|
|
1769
|
-
* Get a scallop constants instance that already has initial data.
|
|
1770
|
-
* @returns Scallop Constants
|
|
1771
|
-
*/
|
|
1772
|
-
getScallopConstants(): Promise<ScallopConstants>;
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1775
|
-
type CoreIds = {
|
|
1776
|
-
protocolPkg: string;
|
|
1777
|
-
market: string;
|
|
1778
|
-
version: string;
|
|
1779
|
-
coinDecimalsRegistry: string;
|
|
1780
|
-
xOracle: string;
|
|
1781
|
-
};
|
|
1782
|
-
type NestedResult = Extract<Argument, {
|
|
1783
|
-
$kind: 'NestedResult';
|
|
1784
|
-
}>;
|
|
1785
|
-
type Obligation$1 = NestedResult;
|
|
1786
|
-
type ObligationKey = NestedResult;
|
|
1787
|
-
type ObligationHotPotato = NestedResult;
|
|
1788
|
-
type CoreNormalMethods = {
|
|
1789
|
-
openObligation: () => [Obligation$1, ObligationKey, ObligationHotPotato];
|
|
1790
|
-
returnObligation: (obligation: SuiObjectArg, obligationHotPotato: SuiObjectArg) => void;
|
|
1791
|
-
openObligationEntry: () => void;
|
|
1792
|
-
addCollateral: (obligation: SuiObjectArg, coin: SuiObjectArg, collateralCoinName: string) => void;
|
|
1793
|
-
takeCollateral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, collateralCoinName: string) => TransactionResult;
|
|
1794
|
-
deposit: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1795
|
-
depositEntry: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1796
|
-
withdraw: (marketCoin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1797
|
-
withdrawEntry: (marketCoin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1798
|
-
borrow: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: string) => TransactionResult;
|
|
1799
|
-
borrowWithReferral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, borrowReferral: SuiObjectArg, amount: number | SuiTxArg, poolCoinName: string) => TransactionResult;
|
|
1800
|
-
borrowEntry: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: string) => TransactionResult;
|
|
1801
|
-
repay: (obligation: SuiObjectArg, coin: SuiObjectArg, poolCoinName: string) => void;
|
|
1802
|
-
borrowFlashLoan: (amount: number | SuiTxArg, poolCoinName: string) => TransactionResult;
|
|
1803
|
-
repayFlashLoan: (coin: SuiObjectArg, loan: SuiObjectArg, poolCoinName: string) => void;
|
|
1804
|
-
};
|
|
1805
|
-
type CoreQuickMethods = {
|
|
1806
|
-
addCollateralQuick: (amount: number, collateralCoinName: string, obligationId?: SuiObjectArg) => Promise<void>;
|
|
1807
|
-
takeCollateralQuick: (amount: number, collateralCoinName: string, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
|
|
1808
|
-
borrowQuick: (amount: number, poolCoinName: string, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg, isSponsoredTx?: boolean) => Promise<TransactionResult>;
|
|
1809
|
-
borrowWithReferralQuick: (amount: number, poolCoinName: string, borrowReferral: SuiObjectArg, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg, isSponsoredTx?: boolean) => Promise<TransactionResult>;
|
|
1810
|
-
depositQuick: (amount: number, poolCoinName: string, returnSCoin?: boolean) => Promise<TransactionResult>;
|
|
1811
|
-
withdrawQuick: (amount: number, poolCoinName: string) => Promise<TransactionResult>;
|
|
1812
|
-
repayQuick: (amount: number, poolCoinName: string, obligationId?: SuiObjectArg) => Promise<void>;
|
|
1813
|
-
updateAssetPricesQuick: (assetCoinNames?: string[]) => Promise<void>;
|
|
1814
|
-
};
|
|
1815
|
-
type SuiTxBlockWithCoreNormalMethods = SuiTxBlock & SuiTxBlockWithSpool & CoreNormalMethods;
|
|
1816
|
-
type CoreTxBlock = SuiTxBlockWithCoreNormalMethods & CoreQuickMethods;
|
|
1817
|
-
type GenerateCoreNormalMethod = (params: {
|
|
1818
|
-
builder: ScallopBuilder;
|
|
1819
|
-
txBlock: SuiTxBlock;
|
|
1820
|
-
}) => CoreNormalMethods;
|
|
1821
|
-
type GenerateCoreQuickMethod = (params: {
|
|
1822
|
-
builder: ScallopBuilder;
|
|
1823
|
-
txBlock: SuiTxBlockWithCoreNormalMethods;
|
|
1824
|
-
}) => CoreQuickMethods;
|
|
1825
|
-
|
|
1826
|
-
type SpoolIds = {
|
|
1827
|
-
spoolPkg: string;
|
|
1828
|
-
};
|
|
1829
|
-
type SpoolNormalMethods = {
|
|
1830
|
-
createStakeAccount: (stakeMarketCoinName: string) => TransactionResult;
|
|
1831
|
-
stake: (stakeAccount: SuiAddressArg, coin: SuiObjectArg, stakeMarketCoinName: string) => void;
|
|
1832
|
-
unstake: (stakeAccount: SuiAddressArg, amount: number, stakeMarketCoinName: string) => TransactionResult;
|
|
1833
|
-
claim: (stakeAccount: SuiAddressArg, stakeMarketCoinName: string) => TransactionResult;
|
|
1834
|
-
};
|
|
1835
|
-
type SpoolQuickMethods = {
|
|
1836
|
-
stakeQuick(amountOrMarketCoin: SuiObjectArg | number, stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg): Promise<void>;
|
|
1837
|
-
unstakeQuick(amount: number, stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg, returnSCoin?: boolean): Promise<TransactionResult | undefined>;
|
|
1838
|
-
claimQuick(stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg): Promise<TransactionResult[]>;
|
|
1839
|
-
};
|
|
1840
|
-
type SuiTxBlockWithSpoolNormalMethods = SuiTxBlock & SuiTxBlockWithSCoin & SpoolNormalMethods;
|
|
1841
|
-
type SpoolTxBlock = SuiTxBlockWithSpoolNormalMethods & SpoolQuickMethods;
|
|
1842
|
-
type GenerateSpoolNormalMethod = (params: {
|
|
1843
|
-
builder: ScallopBuilder;
|
|
1844
|
-
txBlock: SuiTxBlock;
|
|
1845
|
-
}) => SpoolNormalMethods;
|
|
1846
|
-
type GenerateSpoolQuickMethod = (params: {
|
|
1847
|
-
builder: ScallopBuilder;
|
|
1848
|
-
txBlock: SuiTxBlockWithSpoolNormalMethods;
|
|
1849
|
-
}) => SpoolQuickMethods;
|
|
1850
|
-
|
|
1851
|
-
type BorrowIncentiveIds = {
|
|
1852
|
-
borrowIncentivePkg: string;
|
|
1853
|
-
query: string;
|
|
1854
|
-
config: string;
|
|
1855
|
-
incentivePools: string;
|
|
1856
|
-
incentiveAccounts: string;
|
|
1857
|
-
obligationAccessStore: string;
|
|
1858
|
-
};
|
|
1859
|
-
type BorrowIncentiveNormalMethods = {
|
|
1860
|
-
stakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
|
|
1861
|
-
stakeObligationWithVesca: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, veScaKey: SuiObjectArg) => void;
|
|
1862
|
-
unstakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
|
|
1863
|
-
claimBorrowIncentive: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, rewardType: string) => TransactionResult;
|
|
1864
|
-
deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => void;
|
|
1865
|
-
};
|
|
1866
|
-
type BorrowIncentiveQuickMethods = {
|
|
1867
|
-
stakeObligationQuick(obligation?: string, obligationKey?: string): Promise<void>;
|
|
1868
|
-
stakeObligationWithVeScaQuick(obligation?: string, obligationKey?: string, veScaKey?: string): Promise<void>;
|
|
1869
|
-
unstakeObligationQuick(obligation?: string, obligationKey?: string): Promise<void>;
|
|
1870
|
-
claimBorrowIncentiveQuick(rewardType: string, obligation?: string, obligationKey?: string): Promise<TransactionResult>;
|
|
1871
|
-
};
|
|
1872
|
-
type SuiTxBlockWithBorrowIncentiveNormalMethods = SuiTxBlock & BorrowIncentiveNormalMethods;
|
|
1873
|
-
type BorrowIncentiveTxBlock = SuiTxBlockWithBorrowIncentiveNormalMethods & BorrowIncentiveQuickMethods;
|
|
1874
|
-
type GenerateBorrowIncentiveNormalMethod = (params: {
|
|
1875
|
-
builder: ScallopBuilder;
|
|
1876
|
-
txBlock: SuiTxBlock;
|
|
1877
|
-
}) => BorrowIncentiveNormalMethods;
|
|
1878
|
-
type GenerateBorrowIncentiveQuickMethod = (params: {
|
|
1879
|
-
builder: ScallopBuilder;
|
|
1880
|
-
txBlock: SuiTxBlockWithBorrowIncentiveNormalMethods;
|
|
1881
|
-
}) => BorrowIncentiveQuickMethods;
|
|
1882
|
-
|
|
1883
|
-
type VeScaNormalMethods = {
|
|
1884
|
-
lockSca: (scaCoin: SuiObjectArg, unlockAtInSecondTimestamp: number) => TransactionResult;
|
|
1885
|
-
extendLockPeriod: (veScaKey: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
|
|
1886
|
-
extendLockAmount: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg) => void;
|
|
1887
|
-
renewExpiredVeSca: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
|
|
1888
|
-
redeemSca: (veScaKey: SuiObjectArg) => TransactionResult;
|
|
1889
|
-
mintEmptyVeSca: () => TransactionResult;
|
|
1890
|
-
splitVeSca: (veScaKey: SuiObjectArg, splitAmount: string) => TransactionResult;
|
|
1891
|
-
mergeVeSca: (targetVeScaKey: SuiObjectArg, sourceVeScaKey: SuiObjectArg) => void;
|
|
1892
|
-
};
|
|
1893
|
-
type QuickMethodReturnType<T extends boolean> = T extends true ? void : TransactionResult;
|
|
1894
|
-
type VeScaQuickMethods = {
|
|
1895
|
-
/**
|
|
1896
|
-
* Quick methods to automate
|
|
1897
|
-
* lock initial SCA, extend lock period, lock more SCA, renew expired VeSCA, and redeem SCA
|
|
1898
|
-
*
|
|
1899
|
-
* **Flow:**
|
|
1900
|
-
* - If only `amountOrCoin` is provided, it will lock the amount of existing not expired veSCA
|
|
1901
|
-
* - If only `lockPeriodInDays` is provided, it will extend the lock period of existing not expired veSCA
|
|
1902
|
-
*
|
|
1903
|
-
* **Note:**
|
|
1904
|
-
* - If one or both flow above is used on a expired veSCA, it will claim the unlocked SCA
|
|
1905
|
-
* and renew the veSCA first, and then flow continues
|
|
1906
|
-
* - If users has no veSCA yet, they need to provide both `amountOrCoin` and `lockPeriodInDays` for initial lock
|
|
1907
|
-
* @param amountOrCoin
|
|
1908
|
-
* @param lockPeriodInDays
|
|
1909
|
-
* @param autoCheck
|
|
1910
|
-
*/
|
|
1911
|
-
lockScaQuick(params: {
|
|
1912
|
-
amountOrCoin?: SuiObjectArg | number;
|
|
1913
|
-
lockPeriodInDays?: number;
|
|
1914
|
-
autoCheck?: boolean;
|
|
1915
|
-
veScaKey?: SuiObjectData$1 | string;
|
|
1916
|
-
}): Promise<void>;
|
|
1917
|
-
extendLockPeriodQuick: (params: {
|
|
1918
|
-
lockPeriodInDays: number;
|
|
1919
|
-
autoCheck?: boolean;
|
|
1920
|
-
veScaKey?: SuiObjectData$1 | string;
|
|
1921
|
-
}) => Promise<void>;
|
|
1922
|
-
extendLockAmountQuick: (params: {
|
|
1923
|
-
scaAmount: number;
|
|
1924
|
-
autoCheck?: boolean;
|
|
1925
|
-
veScaKey?: SuiObjectData$1 | string;
|
|
1926
|
-
}) => Promise<void>;
|
|
1927
|
-
renewExpiredVeScaQuick: (params: {
|
|
1928
|
-
scaAmount: number;
|
|
1929
|
-
lockPeriodInDays: number;
|
|
1930
|
-
autoCheck?: boolean;
|
|
1931
|
-
veScaKey?: SuiObjectData$1 | string;
|
|
1932
|
-
}) => Promise<void>;
|
|
1933
|
-
redeemScaQuick: <T extends boolean>(params: {
|
|
1934
|
-
veScaKey?: SuiObjectData$1 | string;
|
|
1935
|
-
transferSca?: T;
|
|
1936
|
-
}) => Promise<QuickMethodReturnType<T> | undefined>;
|
|
1937
|
-
splitVeScaQuick: <T extends boolean>(params: {
|
|
1938
|
-
splitAmount: string;
|
|
1939
|
-
veScaKey: string;
|
|
1940
|
-
transferVeScaKey?: T;
|
|
1941
|
-
}) => Promise<QuickMethodReturnType<T> | undefined>;
|
|
1942
|
-
mergeVeScaQuick: (params: {
|
|
1943
|
-
targetVeScaKey: string;
|
|
1944
|
-
sourceVeScaKey: string;
|
|
1945
|
-
}) => Promise<void>;
|
|
1946
|
-
};
|
|
1947
|
-
type SuiTxBlockWithVeScaNormalMethods = SuiTxBlock & VeScaNormalMethods;
|
|
1948
|
-
type VeScaTxBlock = SuiTxBlockWithVeScaNormalMethods & VeScaQuickMethods;
|
|
1949
|
-
type GenerateVeScaNormalMethod = (params: {
|
|
1950
|
-
builder: ScallopBuilder;
|
|
1951
|
-
txBlock: SuiTxBlock;
|
|
1952
|
-
}) => VeScaNormalMethods;
|
|
1953
|
-
type GenerateVeScaQuickMethod = (params: {
|
|
1954
|
-
builder: ScallopBuilder;
|
|
1955
|
-
txBlock: SuiTxBlockWithVeScaNormalMethods;
|
|
1956
|
-
}) => VeScaQuickMethods;
|
|
1957
|
-
|
|
1958
|
-
type ReferralNormalMethods = {
|
|
1959
|
-
bindToReferral: (veScaKeyId: string) => void;
|
|
1960
|
-
claimReferralTicket: (poolCoinName: string) => TransactionResult$1;
|
|
1961
|
-
burnReferralTicket: (ticket: SuiObjectArg, poolCoinName: string) => void;
|
|
1962
|
-
claimReferralRevenue: (veScaKey: SuiObjectArg, poolCoinName: string) => TransactionResult$1;
|
|
1963
|
-
};
|
|
1964
|
-
type ReferralQuickMethods = {
|
|
1965
|
-
claimReferralRevenueQuick: (veScaKey: SuiObjectArg, coinNames: string[]) => Promise<void>;
|
|
1966
|
-
};
|
|
1967
|
-
type SuiTxBlockWithReferralNormalMethods = SuiTxBlock & ReferralNormalMethods;
|
|
1968
|
-
type ReferralTxBlock = SuiTxBlockWithReferralNormalMethods & ReferralQuickMethods;
|
|
1969
|
-
|
|
1970
|
-
type LoyaltyProgramNormalMethods = {
|
|
1971
|
-
claimLoyaltyRevenue: (veScaKey: SuiObjectArg) => TransactionResult$1;
|
|
1972
|
-
claimVeScaLoyaltyReward: (veScaKey: SuiObjectArg) => TransactionResult$1;
|
|
1973
|
-
};
|
|
1974
|
-
type LoyaltyProgramQuickMethods = {
|
|
1975
|
-
claimLoyaltyRevenueQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
|
|
1976
|
-
claimVeScaLoyaltyRewardQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
|
|
1977
|
-
};
|
|
1978
|
-
type SuiTxBlockWithLoyaltyProgramNormalMethods = SuiTxBlock & LoyaltyProgramNormalMethods;
|
|
1979
|
-
type LoyaltyProgramTxBlock = SuiTxBlockWithLoyaltyProgramNormalMethods & LoyaltyProgramQuickMethods;
|
|
1980
|
-
type GenerateLoyaltyProgramNormalMethod = (params: {
|
|
1981
|
-
builder: ScallopBuilder;
|
|
1982
|
-
txBlock: SuiTxBlock;
|
|
1983
|
-
}) => LoyaltyProgramNormalMethods;
|
|
1984
|
-
type GenerateLoyaltyProgramQuickMethod = (params: {
|
|
1985
|
-
builder: ScallopBuilder;
|
|
1986
|
-
txBlock: SuiTxBlockWithLoyaltyProgramNormalMethods;
|
|
1987
|
-
}) => LoyaltyProgramQuickMethods;
|
|
1988
|
-
|
|
1989
|
-
type sCoinPkgIds = {
|
|
1990
|
-
pkgId: string;
|
|
1991
|
-
};
|
|
1992
|
-
type sCoinNormalMethods = {
|
|
1993
|
-
/**
|
|
1994
|
-
* Lock marketCoin and return sCoin
|
|
1995
|
-
* @param marketCoinName
|
|
1996
|
-
* @param marketCoin
|
|
1997
|
-
* @returns
|
|
1998
|
-
*/
|
|
1999
|
-
mintSCoin: (marketCoinName: string, marketCoin: SuiObjectArg) => TransactionResult$1;
|
|
2000
|
-
/**
|
|
2001
|
-
* Burn sCoin and return marketCoin
|
|
2002
|
-
* @param sCoinName
|
|
2003
|
-
* @param sCoin
|
|
2004
|
-
* @returns
|
|
2005
|
-
*/
|
|
2006
|
-
burnSCoin: (sCoinName: string, sCoin: SuiObjectArg) => TransactionResult$1;
|
|
2007
|
-
};
|
|
2008
|
-
type sCoinQuickMethods = {
|
|
2009
|
-
mintSCoinQuick: (marketCoinName: string, amount: number) => Promise<TransactionResult$1>;
|
|
2010
|
-
burnSCoinQuick: (sCoinName: string, amount: number) => Promise<TransactionResult$1>;
|
|
2011
|
-
};
|
|
2012
|
-
type SuiTxBlockWithSCoinNormalMethods = SuiTxBlock & BaseScallopTxBlock & sCoinNormalMethods;
|
|
2013
|
-
type SCoinTxBlock = SuiTxBlockWithSCoinNormalMethods & sCoinQuickMethods;
|
|
2014
|
-
type GenerateSCoinNormalMethod = (params: {
|
|
2015
|
-
builder: ScallopBuilder;
|
|
2016
|
-
txBlock: SuiTxBlock;
|
|
2017
|
-
}) => sCoinNormalMethods;
|
|
2018
|
-
type GenerateSCoinQuickMethod = (params: {
|
|
2019
|
-
builder: ScallopBuilder;
|
|
2020
|
-
txBlock: SuiTxBlockWithSCoinNormalMethods;
|
|
2021
|
-
}) => sCoinQuickMethods;
|
|
2022
|
-
|
|
2023
|
-
type BaseScallopTxBlock = ReferralTxBlock & LoyaltyProgramTxBlock & BorrowIncentiveTxBlock & VeScaTxBlock;
|
|
2024
|
-
type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
|
|
2025
|
-
type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
|
|
2026
|
-
type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
|
|
2027
|
-
type SelectCoinReturnType<T extends string> = T extends 'sui' ? {
|
|
2028
|
-
takeCoin: NestedResult;
|
|
2029
|
-
} : {
|
|
2030
|
-
takeCoin: NestedResult;
|
|
2031
|
-
leftCoin: NestedResult;
|
|
260
|
+
type BaseScallopTxBlock = ReferralTxBlock & LoyaltyProgramTxBlock & BorrowIncentiveTxBlock & VeScaTxBlock;
|
|
261
|
+
type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
|
|
262
|
+
type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
|
|
263
|
+
type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
|
|
264
|
+
type SelectCoinReturnType<T extends string> = T extends 'sui' ? {
|
|
265
|
+
takeCoin: NestedResult;
|
|
266
|
+
} : {
|
|
267
|
+
takeCoin: NestedResult;
|
|
268
|
+
leftCoin: NestedResult;
|
|
2032
269
|
};
|
|
2033
270
|
|
|
2034
271
|
type PoolAddress = {
|
|
@@ -2081,64 +318,6 @@ type CoinWrappedType = {
|
|
|
2081
318
|
type: string;
|
|
2082
319
|
} | undefined;
|
|
2083
320
|
|
|
2084
|
-
type Coins = {
|
|
2085
|
-
[K in string]: K;
|
|
2086
|
-
};
|
|
2087
|
-
type AssetCoins = {
|
|
2088
|
-
[K in string]: K;
|
|
2089
|
-
};
|
|
2090
|
-
type MarketCoins = {
|
|
2091
|
-
[K in string]: K;
|
|
2092
|
-
};
|
|
2093
|
-
type SCoins = {
|
|
2094
|
-
[K in string]: K;
|
|
2095
|
-
};
|
|
2096
|
-
type StakeMarketCoins = {
|
|
2097
|
-
[K in string]: K;
|
|
2098
|
-
};
|
|
2099
|
-
type StakeRewardCoins = {
|
|
2100
|
-
[key in string]: string;
|
|
2101
|
-
};
|
|
2102
|
-
type SuiBridgeCoins = {
|
|
2103
|
-
[K in string]: K;
|
|
2104
|
-
};
|
|
2105
|
-
type BorrowIncentiveRewardCoins = {
|
|
2106
|
-
[key in string]: string[];
|
|
2107
|
-
};
|
|
2108
|
-
type AssetCoinIds = {
|
|
2109
|
-
[key in string]: string;
|
|
2110
|
-
};
|
|
2111
|
-
type SCoinIds = {
|
|
2112
|
-
[key in string]: string;
|
|
2113
|
-
};
|
|
2114
|
-
type SCoinTreasuryCaps = {
|
|
2115
|
-
[key in string]: string;
|
|
2116
|
-
};
|
|
2117
|
-
type SCoinConverterTreasury = {
|
|
2118
|
-
[key in string]: string;
|
|
2119
|
-
};
|
|
2120
|
-
type PickFromUnion<T, K extends string> = K extends T ? K : never;
|
|
2121
|
-
type WormholeCoinIds = {
|
|
2122
|
-
[key in PickFromUnion<string, 'weth' | 'wbtc' | 'wusdc' | 'wusdt' | 'wapt' | 'wsol'>]: string;
|
|
2123
|
-
};
|
|
2124
|
-
type VoloCoinIds = {
|
|
2125
|
-
[key in PickFromUnion<string, 'vsui'>]: string;
|
|
2126
|
-
};
|
|
2127
|
-
type SuiBridgedCoinPackageIds = {
|
|
2128
|
-
[key in string]: string;
|
|
2129
|
-
};
|
|
2130
|
-
|
|
2131
|
-
declare const _SUPPORT_ORACLES: readonly ["supra", "switchboard", "pyth"];
|
|
2132
|
-
type SupportOracleType = (typeof _SUPPORT_ORACLES)[number];
|
|
2133
|
-
type xOracleRules = {
|
|
2134
|
-
primary: SupportOracleType[];
|
|
2135
|
-
secondary: SupportOracleType[];
|
|
2136
|
-
};
|
|
2137
|
-
type xOracleRuleType = keyof xOracleRules;
|
|
2138
|
-
type xOracleListType = {
|
|
2139
|
-
[key in string]: xOracleRules;
|
|
2140
|
-
};
|
|
2141
|
-
|
|
2142
321
|
interface BorrowIncentiveAccountKey {
|
|
2143
322
|
id: string;
|
|
2144
323
|
onwerId: string;
|
|
@@ -2701,542 +880,1525 @@ type SpoolData = {
|
|
|
2701
880
|
stake_type: {
|
|
2702
881
|
type: string;
|
|
2703
882
|
fields: {
|
|
2704
|
-
name: string;
|
|
883
|
+
name: string;
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
stakes: string;
|
|
887
|
+
};
|
|
888
|
+
type ParsedSpoolData = {
|
|
889
|
+
stakeType: string;
|
|
890
|
+
maxPoint: number;
|
|
891
|
+
distributedPoint: number;
|
|
892
|
+
pointPerPeriod: number;
|
|
893
|
+
period: number;
|
|
894
|
+
maxStake: number;
|
|
895
|
+
staked: number;
|
|
896
|
+
index: number;
|
|
897
|
+
createdAt: number;
|
|
898
|
+
lastUpdate: number;
|
|
899
|
+
};
|
|
900
|
+
type CalculatedSpoolData = {
|
|
901
|
+
stakedAmount: number;
|
|
902
|
+
stakedCoin: number;
|
|
903
|
+
stakedValue: number;
|
|
904
|
+
distributedPointPerSec: number;
|
|
905
|
+
accumulatedPoints: number;
|
|
906
|
+
currentPointIndex: number;
|
|
907
|
+
currentTotalDistributedPoint: number;
|
|
908
|
+
startDate: Date;
|
|
909
|
+
endDate: Date;
|
|
910
|
+
};
|
|
911
|
+
type SpoolRewardPool = Required<Pick<ParsedSpoolRewardPoolData, 'exchangeRateNumerator' | 'exchangeRateDenominator'>> & CalculatedSpoolRewardPoolData;
|
|
912
|
+
type OriginSpoolRewardPoolData = {
|
|
913
|
+
claimed_rewards: string;
|
|
914
|
+
exchange_rate_denominator: string;
|
|
915
|
+
exchange_rate_numerator: string;
|
|
916
|
+
rewards: string;
|
|
917
|
+
spool_id: string;
|
|
918
|
+
};
|
|
919
|
+
type ParsedSpoolRewardPoolData = {
|
|
920
|
+
claimedRewards: number;
|
|
921
|
+
exchangeRateDenominator: number;
|
|
922
|
+
exchangeRateNumerator: number;
|
|
923
|
+
rewards: number;
|
|
924
|
+
spoolId: string;
|
|
925
|
+
};
|
|
926
|
+
type CalculatedSpoolRewardPoolData = {
|
|
927
|
+
rewardApr: number;
|
|
928
|
+
totalRewardAmount: number;
|
|
929
|
+
totalRewardCoin: number;
|
|
930
|
+
totalRewardValue: number;
|
|
931
|
+
remaindRewardAmount: number;
|
|
932
|
+
remaindRewardCoin: number;
|
|
933
|
+
remaindRewardValue: number;
|
|
934
|
+
claimedRewardAmount: number;
|
|
935
|
+
claimedRewardCoin: number;
|
|
936
|
+
claimedRewardValue: number;
|
|
937
|
+
rewardPerSec: number;
|
|
938
|
+
};
|
|
939
|
+
type StakePools = OptionalKeys$2<Record<string, StakePool>>;
|
|
940
|
+
type StakeRewardPools = OptionalKeys$2<Record<string, StakeRewardPool>>;
|
|
941
|
+
type StakeAccounts = Record<string, StakeAccount[]>;
|
|
942
|
+
interface StakeAccount {
|
|
943
|
+
id: string;
|
|
944
|
+
type: string;
|
|
945
|
+
stakePoolId: string;
|
|
946
|
+
stakeType: string;
|
|
947
|
+
staked: number;
|
|
948
|
+
index: number;
|
|
949
|
+
points: number;
|
|
950
|
+
totalPoints: number;
|
|
951
|
+
}
|
|
952
|
+
interface StakePool {
|
|
953
|
+
id: string;
|
|
954
|
+
type: string;
|
|
955
|
+
maxPoint: number;
|
|
956
|
+
distributedPoint: number;
|
|
957
|
+
pointPerPeriod: number;
|
|
958
|
+
period: number;
|
|
959
|
+
maxStake: number;
|
|
960
|
+
stakeType: string;
|
|
961
|
+
totalStaked: number;
|
|
962
|
+
index: number;
|
|
963
|
+
createdAt: number;
|
|
964
|
+
lastUpdate: number;
|
|
965
|
+
}
|
|
966
|
+
interface StakeRewardPool {
|
|
967
|
+
id: string;
|
|
968
|
+
type: string;
|
|
969
|
+
stakePoolId: string;
|
|
970
|
+
ratioDenominator: number;
|
|
971
|
+
ratioNumerator: number;
|
|
972
|
+
rewards: number;
|
|
973
|
+
claimedRewards: number;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
type OptionalKeys$1<T> = {
|
|
977
|
+
[K in keyof T]?: T[K];
|
|
978
|
+
};
|
|
979
|
+
type Lendings = OptionalKeys$1<Record<string, Lending>>;
|
|
980
|
+
type ObligationAccounts = OptionalKeys$1<Record<string, ObligationAccount>>;
|
|
981
|
+
type Lending = Required<Pick<MarketPool, 'coinName' | 'symbol' | 'coinType' | 'marketCoinType' | 'sCoinType' | 'coinDecimal' | 'coinPrice' | 'conversionRate' | 'isIsolated'> & Pick<Spool, 'marketCoinPrice'>> & {
|
|
982
|
+
supplyApr: number;
|
|
983
|
+
supplyApy: number;
|
|
984
|
+
rewardApr: number;
|
|
985
|
+
suppliedAmount: number;
|
|
986
|
+
suppliedCoin: number;
|
|
987
|
+
suppliedValue: number;
|
|
988
|
+
stakedMarketAmount: number;
|
|
989
|
+
stakedMarketCoin: number;
|
|
990
|
+
stakedAmount: number;
|
|
991
|
+
stakedCoin: number;
|
|
992
|
+
stakedValue: number;
|
|
993
|
+
unstakedMarketAmount: number;
|
|
994
|
+
unstakedMarketCoin: number;
|
|
995
|
+
unstakedAmount: number;
|
|
996
|
+
unstakedCoin: number;
|
|
997
|
+
unstakedValue: number;
|
|
998
|
+
availableSupplyAmount: number;
|
|
999
|
+
availableSupplyCoin: number;
|
|
1000
|
+
availableWithdrawAmount: number;
|
|
1001
|
+
availableWithdrawCoin: number;
|
|
1002
|
+
availableStakeAmount: number;
|
|
1003
|
+
availableStakeCoin: number;
|
|
1004
|
+
availableUnstakeAmount: number;
|
|
1005
|
+
availableUnstakeCoin: number;
|
|
1006
|
+
availableClaimAmount: number;
|
|
1007
|
+
availableClaimCoin: number;
|
|
1008
|
+
};
|
|
1009
|
+
type ObligationAccount = {
|
|
1010
|
+
obligationId: string;
|
|
1011
|
+
totalDepositedValue: number;
|
|
1012
|
+
totalBorrowedValue: number;
|
|
1013
|
+
totalBalanceValue: number;
|
|
1014
|
+
totalBorrowCapacityValue: number;
|
|
1015
|
+
totalAvailableCollateralValue: number;
|
|
1016
|
+
totalBorrowedValueWithWeight: number;
|
|
1017
|
+
totalRequiredCollateralValue: number;
|
|
1018
|
+
totalUnhealthyCollateralValue: number;
|
|
1019
|
+
totalRiskLevel: number;
|
|
1020
|
+
totalDepositedPools: number;
|
|
1021
|
+
totalBorrowedPools: number;
|
|
1022
|
+
totalRewardedPools: number;
|
|
1023
|
+
collaterals: OptionalKeys$1<Record<string, ObligationCollateral>>;
|
|
1024
|
+
debts: OptionalKeys$1<Record<string, ObligationDebt>>;
|
|
1025
|
+
borrowIncentives: OptionalKeys$1<Record<string, ObligationBorrowIncentive>>;
|
|
1026
|
+
};
|
|
1027
|
+
type ObligationCollateral = {
|
|
1028
|
+
coinName: string;
|
|
1029
|
+
coinType: string;
|
|
1030
|
+
symbol: string;
|
|
1031
|
+
coinDecimal: number;
|
|
1032
|
+
coinPrice: number;
|
|
1033
|
+
depositedAmount: number;
|
|
1034
|
+
depositedCoin: number;
|
|
1035
|
+
depositedValue: number;
|
|
1036
|
+
borrowCapacityValue: number;
|
|
1037
|
+
requiredCollateralValue: number;
|
|
1038
|
+
availableDepositAmount: number;
|
|
1039
|
+
availableDepositCoin: number;
|
|
1040
|
+
availableWithdrawAmount: number;
|
|
1041
|
+
availableWithdrawCoin: number;
|
|
1042
|
+
};
|
|
1043
|
+
type ObligationDebt = {
|
|
1044
|
+
coinName: string;
|
|
1045
|
+
coinType: string;
|
|
1046
|
+
symbol: string;
|
|
1047
|
+
coinDecimal: number;
|
|
1048
|
+
coinPrice: number;
|
|
1049
|
+
borrowedAmount: number;
|
|
1050
|
+
borrowedCoin: number;
|
|
1051
|
+
borrowedValue: number;
|
|
1052
|
+
borrowedValueWithWeight: number;
|
|
1053
|
+
borrowIndex: number;
|
|
1054
|
+
requiredRepayAmount: number;
|
|
1055
|
+
requiredRepayCoin: number;
|
|
1056
|
+
availableBorrowAmount: number;
|
|
1057
|
+
availableBorrowCoin: number;
|
|
1058
|
+
availableRepayAmount: number;
|
|
1059
|
+
availableRepayCoin: number;
|
|
1060
|
+
};
|
|
1061
|
+
type ObligationBorrowIncentiveReward = {
|
|
1062
|
+
coinName: string;
|
|
1063
|
+
coinType: string;
|
|
1064
|
+
symbol: string;
|
|
1065
|
+
coinDecimal: number;
|
|
1066
|
+
coinPrice: number;
|
|
1067
|
+
weightedBorrowAmount: number;
|
|
1068
|
+
availableClaimCoin: number;
|
|
1069
|
+
availableClaimAmount: number;
|
|
1070
|
+
boostValue: number;
|
|
1071
|
+
};
|
|
1072
|
+
type ObligationBorrowIncentive = {
|
|
1073
|
+
coinName: string;
|
|
1074
|
+
coinType: string;
|
|
1075
|
+
symbol: string;
|
|
1076
|
+
coinDecimal: number;
|
|
1077
|
+
coinPrice: number;
|
|
1078
|
+
rewards: ObligationBorrowIncentiveReward[];
|
|
1079
|
+
};
|
|
1080
|
+
type TotalValueLocked = {
|
|
1081
|
+
supplyLendingValue: number;
|
|
1082
|
+
supplyCollateralValue: number;
|
|
1083
|
+
supplyValue: number;
|
|
1084
|
+
borrowValue: number;
|
|
1085
|
+
totalValue: number;
|
|
1086
|
+
supplyValueChangeRatio?: number;
|
|
1087
|
+
supplyLendingValueChangeRatio?: number;
|
|
1088
|
+
supplyCollateralValueChangeRatio?: number;
|
|
1089
|
+
borrowValueChangeRatio?: number;
|
|
1090
|
+
totalValueChangeRatio?: number;
|
|
1091
|
+
};
|
|
1092
|
+
|
|
1093
|
+
type Vesca = {
|
|
1094
|
+
id: string;
|
|
1095
|
+
keyId: string;
|
|
1096
|
+
keyObject?: SuiObjectRef;
|
|
1097
|
+
object: SuiObjectRef;
|
|
1098
|
+
lockedScaAmount: string;
|
|
1099
|
+
lockedScaCoin: number;
|
|
1100
|
+
currentVeScaBalance: number;
|
|
1101
|
+
unlockAt: number;
|
|
1102
|
+
};
|
|
1103
|
+
type VeScaTreasuryFields = {
|
|
1104
|
+
total_ve_sca_amount: string;
|
|
1105
|
+
sca_balance: string;
|
|
1106
|
+
unlock_schedule: {
|
|
1107
|
+
fields: {
|
|
1108
|
+
locked_sca_amount: string;
|
|
2705
1109
|
};
|
|
2706
1110
|
};
|
|
2707
|
-
stakes: string;
|
|
2708
|
-
};
|
|
2709
|
-
type ParsedSpoolData = {
|
|
2710
|
-
stakeType: string;
|
|
2711
|
-
maxPoint: number;
|
|
2712
|
-
distributedPoint: number;
|
|
2713
|
-
pointPerPeriod: number;
|
|
2714
|
-
period: number;
|
|
2715
|
-
maxStake: number;
|
|
2716
|
-
staked: number;
|
|
2717
|
-
index: number;
|
|
2718
|
-
createdAt: number;
|
|
2719
|
-
lastUpdate: number;
|
|
2720
|
-
};
|
|
2721
|
-
type CalculatedSpoolData = {
|
|
2722
|
-
stakedAmount: number;
|
|
2723
|
-
stakedCoin: number;
|
|
2724
|
-
stakedValue: number;
|
|
2725
|
-
distributedPointPerSec: number;
|
|
2726
|
-
accumulatedPoints: number;
|
|
2727
|
-
currentPointIndex: number;
|
|
2728
|
-
currentTotalDistributedPoint: number;
|
|
2729
|
-
startDate: Date;
|
|
2730
|
-
endDate: Date;
|
|
2731
1111
|
};
|
|
2732
|
-
type
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
rewards: string;
|
|
2738
|
-
spool_id: string;
|
|
1112
|
+
type VeScaTreasuryInfo = {
|
|
1113
|
+
totalLockedSca: number;
|
|
1114
|
+
totalVeSca: number;
|
|
1115
|
+
averageLockingPeriod: number;
|
|
1116
|
+
averageLockingPeriodUnit: string;
|
|
2739
1117
|
};
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
exchangeRateNumerator: number;
|
|
2744
|
-
rewards: number;
|
|
2745
|
-
spoolId: string;
|
|
1118
|
+
|
|
1119
|
+
type OptionalKeys<T> = {
|
|
1120
|
+
[K in keyof T]?: T[K];
|
|
2746
1121
|
};
|
|
2747
|
-
type
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
remaindRewardAmount: number;
|
|
2753
|
-
remaindRewardCoin: number;
|
|
2754
|
-
remaindRewardValue: number;
|
|
2755
|
-
claimedRewardAmount: number;
|
|
2756
|
-
claimedRewardCoin: number;
|
|
2757
|
-
claimedRewardValue: number;
|
|
2758
|
-
rewardPerSec: number;
|
|
1122
|
+
type CoinPrices = OptionalKeys<Record<string, number>>;
|
|
1123
|
+
|
|
1124
|
+
type ScallopQueryClientParams = {
|
|
1125
|
+
queryClient?: QueryClient;
|
|
1126
|
+
queryClientConfig?: QueryClientConfig;
|
|
2759
1127
|
};
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
1128
|
+
declare class ScallopQueryClient {
|
|
1129
|
+
private _queryClient;
|
|
1130
|
+
constructor(params?: ScallopQueryClientParams);
|
|
1131
|
+
get queryClient(): QueryClient;
|
|
1132
|
+
set queryClient(queryClient: QueryClient);
|
|
1133
|
+
get defaultQueryClientConfig(): {
|
|
1134
|
+
defaultOptions: {
|
|
1135
|
+
queries: {
|
|
1136
|
+
staleTime: number;
|
|
1137
|
+
gcTime: number;
|
|
1138
|
+
};
|
|
1139
|
+
};
|
|
1140
|
+
};
|
|
2772
1141
|
}
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
1142
|
+
|
|
1143
|
+
type ScallopAxiosParams = {
|
|
1144
|
+
baseUrl?: string;
|
|
1145
|
+
axiosInstance?: AxiosInstance;
|
|
1146
|
+
axiosTimeout?: number;
|
|
1147
|
+
} & ScallopQueryClientParams;
|
|
1148
|
+
declare class ScallopAxios extends ScallopQueryClient {
|
|
1149
|
+
readonly axiosInstance: AxiosInstance;
|
|
1150
|
+
constructor(params?: ScallopAxiosParams);
|
|
1151
|
+
post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
1152
|
+
post<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
1153
|
+
get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
1154
|
+
get<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
1155
|
+
put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
1156
|
+
put<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
1157
|
+
delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
1158
|
+
delete<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
2786
1159
|
}
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
1160
|
+
|
|
1161
|
+
type ScallopAddressParams = {
|
|
1162
|
+
addressId?: string;
|
|
1163
|
+
urls?: {
|
|
1164
|
+
addresses?: string[];
|
|
1165
|
+
};
|
|
1166
|
+
auth?: string;
|
|
1167
|
+
network?: NetworkType;
|
|
1168
|
+
forceAddressesInterface?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
1169
|
+
defaultValues?: {
|
|
1170
|
+
addresses?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
1171
|
+
};
|
|
1172
|
+
} & ScallopAxiosParams;
|
|
1173
|
+
declare class ScallopAddress {
|
|
1174
|
+
readonly params: ScallopAddressParams;
|
|
1175
|
+
private currentAddresses?;
|
|
1176
|
+
private addressId?;
|
|
1177
|
+
private network;
|
|
1178
|
+
private auth;
|
|
1179
|
+
readonly scallopAxios: ScallopAxios;
|
|
1180
|
+
private readonly addressMap;
|
|
1181
|
+
private readonly defaultParamValues;
|
|
1182
|
+
constructor(params?: ScallopAddressParams);
|
|
1183
|
+
private initializeForcedAddresses;
|
|
1184
|
+
get axiosClient(): ScallopAxios;
|
|
1185
|
+
get queryClient(): _tanstack_query_core.QueryClient;
|
|
1186
|
+
get defaultValues(): {
|
|
1187
|
+
addresses?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
1188
|
+
} | undefined;
|
|
1189
|
+
getId(): string | undefined;
|
|
1190
|
+
/**
|
|
1191
|
+
* Get the address at the provided path.
|
|
1192
|
+
*
|
|
1193
|
+
* @param path - The path of the address to get.
|
|
1194
|
+
* @return The address at the provided path.
|
|
1195
|
+
*/
|
|
1196
|
+
get(path: AddressStringPath): any;
|
|
1197
|
+
/**
|
|
1198
|
+
* Sets the address for the specified path, it does not interact with the API.
|
|
1199
|
+
*
|
|
1200
|
+
* @param path - The path of the address to set.
|
|
1201
|
+
* @param address - The address be setted to the tartget path.
|
|
1202
|
+
* @return The addresses.
|
|
1203
|
+
*/
|
|
1204
|
+
set(path: AddressStringPath, address: string): AddressesInterface | undefined;
|
|
1205
|
+
/**
|
|
1206
|
+
* Synchronize the specified network addresses from the addresses map to the
|
|
1207
|
+
* current addresses and change the default network to specified network.
|
|
1208
|
+
*
|
|
1209
|
+
* @param network - Specifies which network's addresses you want to get.
|
|
1210
|
+
* @return Current addresses.
|
|
1211
|
+
*/
|
|
1212
|
+
switchCurrentAddresses(network: NetworkType): AddressesInterface | undefined;
|
|
1213
|
+
/**
|
|
1214
|
+
* Get the addresses, If `network` is not provided, returns the current
|
|
1215
|
+
* addresses or the default network addresses in the addresses map.
|
|
1216
|
+
*
|
|
1217
|
+
* @param network - Specifies which network's addresses you want to get.
|
|
1218
|
+
*/
|
|
1219
|
+
getAddresses(network?: NetworkType): AddressesInterface | undefined;
|
|
1220
|
+
/**
|
|
1221
|
+
* Set the addresses into addresses map. If the specified network is the same
|
|
1222
|
+
* as the current network, the current addresses will be updated at the same time.
|
|
1223
|
+
*
|
|
1224
|
+
* @param addresses - The addresses be setted to the tartget network.
|
|
1225
|
+
* @param network - Specifies which network's addresses you want to set.
|
|
1226
|
+
* @return The addresses.
|
|
1227
|
+
*/
|
|
1228
|
+
setAddresses(addresses: AddressesInterface, network?: NetworkType): void;
|
|
1229
|
+
/**
|
|
1230
|
+
* Get all addresses.
|
|
1231
|
+
*
|
|
1232
|
+
* @return All addresses.
|
|
1233
|
+
*/
|
|
1234
|
+
getAllAddresses(): {
|
|
1235
|
+
[k: string]: AddressesInterface;
|
|
1236
|
+
};
|
|
1237
|
+
/**
|
|
1238
|
+
* Create a new addresses through the API and synchronize it back to the
|
|
1239
|
+
* instance.
|
|
1240
|
+
*
|
|
1241
|
+
* @description
|
|
1242
|
+
* If the `network` is not specified, the mainnet is used by default.
|
|
1243
|
+
* If no `addresses` from instance or parameter is provided, an addresses with
|
|
1244
|
+
* all empty strings is created by default.
|
|
1245
|
+
*
|
|
1246
|
+
* This function only allows for one addresses to be input into a specific network
|
|
1247
|
+
* at a time, and does not provide an addresses map for setting addresses
|
|
1248
|
+
* across all networks at once.
|
|
1249
|
+
*
|
|
1250
|
+
* @param params.addresses - The addresses be setted to the tartget network.
|
|
1251
|
+
* @param params.network - Specifies which network's addresses you want to set.
|
|
1252
|
+
* @param params.auth - The authentication API key.
|
|
1253
|
+
* @param params.memo - Add memo to the addresses created in the API.
|
|
1254
|
+
* @return All addresses.
|
|
1255
|
+
*/
|
|
1256
|
+
create(params?: {
|
|
1257
|
+
addresses?: AddressesInterface | undefined;
|
|
1258
|
+
network?: NetworkType | undefined;
|
|
1259
|
+
auth?: string | undefined;
|
|
1260
|
+
memo?: string | undefined;
|
|
1261
|
+
}): Promise<{
|
|
1262
|
+
[k: string]: AddressesInterface;
|
|
1263
|
+
}>;
|
|
1264
|
+
protected readApi<T>({ url, queryKey, config, }: {
|
|
1265
|
+
url: string;
|
|
1266
|
+
queryKey: QueryKey;
|
|
1267
|
+
config?: AxiosRequestConfig;
|
|
1268
|
+
}): Promise<T>;
|
|
1269
|
+
/**
|
|
1270
|
+
* Read and synchronizes all addresses from the API into instance.
|
|
1271
|
+
*
|
|
1272
|
+
* @param id - The id of the addresses to get.
|
|
1273
|
+
* @return All addresses.
|
|
1274
|
+
*/
|
|
1275
|
+
read(id?: string): Promise<{
|
|
1276
|
+
[k: string]: AddressesInterface;
|
|
1277
|
+
}>;
|
|
1278
|
+
/**
|
|
1279
|
+
* Update the addresses through the API and synchronize it back to the
|
|
1280
|
+
* instance.
|
|
1281
|
+
*
|
|
1282
|
+
* @description
|
|
1283
|
+
* If the `network` is not specified, the mainnet is used by default.
|
|
1284
|
+
* If no `addresses` from instance or parameter is provided, an addresses with
|
|
1285
|
+
* all empty strings is created by default.
|
|
1286
|
+
*
|
|
1287
|
+
* This function only allows for one addresses to be input into a specific network
|
|
1288
|
+
* at a time, and does not provide an addresses map for setting addresses
|
|
1289
|
+
* across all networks at once.
|
|
1290
|
+
*
|
|
1291
|
+
* @param params.id - The id of the addresses to update.
|
|
1292
|
+
* @param params.addresses - The addresses be setted to the tartget network.
|
|
1293
|
+
* @param params.network - Specifies which network's addresses you want to set.
|
|
1294
|
+
* @param params.auth - The authentication api key.
|
|
1295
|
+
* @param params.memo - Add memo to the addresses created in the API.
|
|
1296
|
+
* @return All addresses.
|
|
1297
|
+
*/
|
|
1298
|
+
update(params?: {
|
|
1299
|
+
id?: string;
|
|
1300
|
+
addresses?: AddressesInterface | undefined;
|
|
1301
|
+
network?: NetworkType | undefined;
|
|
1302
|
+
auth?: string | undefined;
|
|
1303
|
+
memo?: string | undefined;
|
|
1304
|
+
}): Promise<{
|
|
1305
|
+
[k: string]: AddressesInterface;
|
|
1306
|
+
}>;
|
|
1307
|
+
/**
|
|
1308
|
+
* Deletes all addresses of a specified id through the API and clear all
|
|
1309
|
+
* addresses in the instance.
|
|
1310
|
+
*
|
|
1311
|
+
* @param id - The id of the addresses to delete.
|
|
1312
|
+
* @param auth - The authentication API key.
|
|
1313
|
+
*/
|
|
1314
|
+
delete(id?: string, auth?: string): Promise<void>;
|
|
2795
1315
|
}
|
|
2796
1316
|
|
|
2797
|
-
type
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
type
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
borrowedCoin: number;
|
|
2872
|
-
borrowedValue: number;
|
|
2873
|
-
borrowedValueWithWeight: number;
|
|
2874
|
-
borrowIndex: number;
|
|
2875
|
-
requiredRepayAmount: number;
|
|
2876
|
-
requiredRepayCoin: number;
|
|
2877
|
-
availableBorrowAmount: number;
|
|
2878
|
-
availableBorrowCoin: number;
|
|
2879
|
-
availableRepayAmount: number;
|
|
2880
|
-
availableRepayCoin: number;
|
|
2881
|
-
};
|
|
2882
|
-
type ObligationBorrowIncentiveReward = {
|
|
2883
|
-
coinName: string;
|
|
2884
|
-
coinType: string;
|
|
2885
|
-
symbol: string;
|
|
2886
|
-
coinDecimal: number;
|
|
2887
|
-
coinPrice: number;
|
|
2888
|
-
weightedBorrowAmount: number;
|
|
2889
|
-
availableClaimCoin: number;
|
|
2890
|
-
availableClaimAmount: number;
|
|
2891
|
-
boostValue: number;
|
|
2892
|
-
};
|
|
2893
|
-
type ObligationBorrowIncentive = {
|
|
2894
|
-
coinName: string;
|
|
2895
|
-
coinType: string;
|
|
2896
|
-
symbol: string;
|
|
2897
|
-
coinDecimal: number;
|
|
2898
|
-
coinPrice: number;
|
|
2899
|
-
rewards: ObligationBorrowIncentiveReward[];
|
|
2900
|
-
};
|
|
2901
|
-
type TotalValueLocked = {
|
|
2902
|
-
supplyLendingValue: number;
|
|
2903
|
-
supplyCollateralValue: number;
|
|
2904
|
-
supplyValue: number;
|
|
2905
|
-
borrowValue: number;
|
|
2906
|
-
totalValue: number;
|
|
2907
|
-
supplyValueChangeRatio?: number;
|
|
2908
|
-
supplyLendingValueChangeRatio?: number;
|
|
2909
|
-
supplyCollateralValueChangeRatio?: number;
|
|
2910
|
-
borrowValueChangeRatio?: number;
|
|
2911
|
-
totalValueChangeRatio?: number;
|
|
2912
|
-
};
|
|
1317
|
+
type CoinName = string;
|
|
1318
|
+
type CoinType = string;
|
|
1319
|
+
type SCoinType = string;
|
|
1320
|
+
type OldMarketCoinType = string;
|
|
1321
|
+
/**
|
|
1322
|
+
* @description `scallop_sui`, `scallop_usdt`, etc (parsed directly from coin type, ex: `0x...::scallop_sui::SCALLOP_SUI`)
|
|
1323
|
+
*/
|
|
1324
|
+
type SCoinRawName = string;
|
|
1325
|
+
/**
|
|
1326
|
+
* @description `ssui`, `susdc`, etc..
|
|
1327
|
+
*/
|
|
1328
|
+
type SCoinName = string;
|
|
1329
|
+
type ScallopConstantsParams = {
|
|
1330
|
+
urls?: {
|
|
1331
|
+
poolAddresses?: string[];
|
|
1332
|
+
whitelist?: string[];
|
|
1333
|
+
};
|
|
1334
|
+
forcePoolAddressInterface?: Record<string, PoolAddress>;
|
|
1335
|
+
forceWhitelistInterface?: Whitelist | Record<string, any>;
|
|
1336
|
+
defaultValues?: {
|
|
1337
|
+
poolAddresses?: Record<string, PoolAddress>;
|
|
1338
|
+
whitelist?: Whitelist | Record<string, any>;
|
|
1339
|
+
};
|
|
1340
|
+
} & ScallopAddressParams;
|
|
1341
|
+
declare class ScallopConstants extends ScallopAddress {
|
|
1342
|
+
readonly params: ScallopConstantsParams;
|
|
1343
|
+
private _poolAddresses;
|
|
1344
|
+
private _whitelist;
|
|
1345
|
+
/**
|
|
1346
|
+
* @description coin names to coin decimal map
|
|
1347
|
+
*/
|
|
1348
|
+
coinDecimals: Record<CoinName, number | undefined>;
|
|
1349
|
+
coinNameToOldMarketCoinTypeMap: Record<CoinName, OldMarketCoinType | undefined>;
|
|
1350
|
+
scoinRawNameToSCoinNameMap: Record<SCoinRawName, SCoinName | undefined>;
|
|
1351
|
+
scoinTypeToSCoinNameMap: Record<SCoinType, SCoinName | undefined>;
|
|
1352
|
+
wormholeCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
1353
|
+
voloCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
1354
|
+
suiBridgeCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
1355
|
+
/**
|
|
1356
|
+
* @description coin names to coin types map
|
|
1357
|
+
*/
|
|
1358
|
+
coinTypes: Record<CoinName, CoinType | undefined>;
|
|
1359
|
+
/**
|
|
1360
|
+
* @description scoin names to scoin types map
|
|
1361
|
+
*/
|
|
1362
|
+
sCoinTypes: Record<SCoinName, SCoinType | undefined>;
|
|
1363
|
+
coinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
1364
|
+
/**
|
|
1365
|
+
* @description Supported borrow incentive reward coin names
|
|
1366
|
+
*/
|
|
1367
|
+
supportedBorrowIncentiveRewards: Set<CoinName>;
|
|
1368
|
+
constructor(params?: ScallopConstantsParams);
|
|
1369
|
+
get protocolObjectId(): string;
|
|
1370
|
+
get isInitialized(): boolean;
|
|
1371
|
+
get whitelist(): Whitelist;
|
|
1372
|
+
get poolAddresses(): Record<string, PoolAddress | undefined>;
|
|
1373
|
+
get defaultValues(): ({
|
|
1374
|
+
poolAddresses?: Record<string, PoolAddress>;
|
|
1375
|
+
whitelist?: Whitelist | Record<string, any>;
|
|
1376
|
+
} & {
|
|
1377
|
+
addresses?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
1378
|
+
}) | undefined;
|
|
1379
|
+
private isAddressInitialized;
|
|
1380
|
+
parseToOldMarketCoin(coinType: string): string;
|
|
1381
|
+
init({ networkType, force, addressId, constantsParams, }?: {
|
|
1382
|
+
networkType?: NetworkType;
|
|
1383
|
+
force?: boolean;
|
|
1384
|
+
addressId?: string;
|
|
1385
|
+
constantsParams?: Partial<ScallopConstantsParams>;
|
|
1386
|
+
}): Promise<void>;
|
|
1387
|
+
private initConstants;
|
|
1388
|
+
readWhiteList(): Promise<Whitelist>;
|
|
1389
|
+
readPoolAddresses(): Promise<Record<string, PoolAddress>>;
|
|
1390
|
+
}
|
|
2913
1391
|
|
|
2914
|
-
type
|
|
1392
|
+
type ScallopIndexerParams = {
|
|
1393
|
+
indexerApiUrl?: string;
|
|
1394
|
+
} & ScallopAxiosParams;
|
|
1395
|
+
declare class ScallopIndexer extends ScallopAxios {
|
|
1396
|
+
constructor(params?: ScallopIndexerParams);
|
|
1397
|
+
/**
|
|
1398
|
+
* Get market index data.
|
|
1399
|
+
*
|
|
1400
|
+
* @return Market data.
|
|
1401
|
+
*/
|
|
1402
|
+
getMarket(): Promise<Pick<Market, 'pools' | 'collaterals'>>;
|
|
1403
|
+
/**
|
|
1404
|
+
* Get market pools index data.
|
|
1405
|
+
*
|
|
1406
|
+
* @return Market pools data.
|
|
1407
|
+
*/
|
|
1408
|
+
getMarketPools(): Promise<Required<MarketPools>>;
|
|
1409
|
+
/**
|
|
1410
|
+
* Get market pool index data.
|
|
1411
|
+
*
|
|
1412
|
+
* @return Market pool data.
|
|
1413
|
+
*/
|
|
1414
|
+
getMarketPool(poolCoinName: string): Promise<MarketPool>;
|
|
1415
|
+
/**
|
|
1416
|
+
* Get market collaterals index data.
|
|
1417
|
+
*
|
|
1418
|
+
* @return Market collaterals data.
|
|
1419
|
+
*/
|
|
1420
|
+
getMarketCollaterals(): Promise<Required<MarketCollaterals>>;
|
|
1421
|
+
/**
|
|
1422
|
+
* Get market collateral index data.
|
|
1423
|
+
*
|
|
1424
|
+
* @return Market collateral data.
|
|
1425
|
+
*/
|
|
1426
|
+
getMarketCollateral(collateralCoinName: string): Promise<MarketCollateral>;
|
|
1427
|
+
/**
|
|
1428
|
+
* Get spools index data.
|
|
1429
|
+
*
|
|
1430
|
+
* @return Spools data.
|
|
1431
|
+
*/
|
|
1432
|
+
getSpools(): Promise<Required<Spools>>;
|
|
1433
|
+
/**
|
|
1434
|
+
* Get spool index data.
|
|
1435
|
+
*
|
|
1436
|
+
* @return Spool data.
|
|
1437
|
+
*/
|
|
1438
|
+
getSpool(marketCoinName: string): Promise<Spool>;
|
|
1439
|
+
/**
|
|
1440
|
+
* Get borrow incentive pools index data.
|
|
1441
|
+
*
|
|
1442
|
+
* @return Borrow incentive pools data.
|
|
1443
|
+
*/
|
|
1444
|
+
getBorrowIncentivePools(): Promise<Required<BorrowIncentivePools>>;
|
|
1445
|
+
/**
|
|
1446
|
+
* Get borrow incentive pool index data.
|
|
1447
|
+
*
|
|
1448
|
+
* @return Borrow incentive pool data.
|
|
1449
|
+
*/
|
|
1450
|
+
getBorrowIncentivePool(borrowIncentiveCoinName: string): Promise<BorrowIncentivePool>;
|
|
1451
|
+
/**
|
|
1452
|
+
* Get total value locked index data.
|
|
1453
|
+
*
|
|
1454
|
+
* @return Total value locked.
|
|
1455
|
+
*/
|
|
1456
|
+
getTotalValueLocked(): Promise<TotalValueLocked & {
|
|
1457
|
+
totalValueChangeRatio: number;
|
|
1458
|
+
borrowValueChangeRatio: number;
|
|
1459
|
+
supplyValueChangeRatio: number;
|
|
1460
|
+
}>;
|
|
1461
|
+
/**
|
|
1462
|
+
* Get coin price index data.
|
|
1463
|
+
*
|
|
1464
|
+
* @return price data.
|
|
1465
|
+
*/
|
|
1466
|
+
getCoinPrice(poolCoinName: string): Promise<number>;
|
|
1467
|
+
getCoinPrices(): Promise<Record<string, number>>;
|
|
1468
|
+
}
|
|
2915
1469
|
|
|
2916
|
-
type
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
object: SuiObjectRef$1;
|
|
2921
|
-
lockedScaAmount: string;
|
|
2922
|
-
lockedScaCoin: number;
|
|
2923
|
-
currentVeScaBalance: number;
|
|
2924
|
-
unlockAt: number;
|
|
1470
|
+
type QueryInspectTxnParams = {
|
|
1471
|
+
queryTarget: string;
|
|
1472
|
+
args: SuiObjectArg[];
|
|
1473
|
+
typeArgs?: any[];
|
|
2925
1474
|
};
|
|
2926
|
-
type
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
1475
|
+
type ScallopSuiKitParams = {
|
|
1476
|
+
suiKit?: SuiKit;
|
|
1477
|
+
tokensPerSecond?: number;
|
|
1478
|
+
walletAddress?: string;
|
|
1479
|
+
} & SuiKitParams & ScallopQueryClientParams;
|
|
1480
|
+
declare class ScallopSuiKit extends ScallopQueryClient {
|
|
1481
|
+
readonly suiKit: SuiKit;
|
|
1482
|
+
private _walletAddress;
|
|
1483
|
+
private _tokensPerSecond;
|
|
1484
|
+
private rateLimiter;
|
|
1485
|
+
constructor(params?: ScallopSuiKitParams);
|
|
1486
|
+
switchFullNodes(fullNodes: string[]): void;
|
|
1487
|
+
get client(): _mysten_sui_dist_cjs_client.SuiClient;
|
|
1488
|
+
get walletAddress(): string;
|
|
1489
|
+
set walletAddress(value: string);
|
|
1490
|
+
get tokensPerSecond(): number;
|
|
1491
|
+
set tokensPerSecond(value: number);
|
|
1492
|
+
get currentFullNode(): string;
|
|
1493
|
+
signAndSendTxn(tx: Uint8Array | Transaction | SuiTxBlock, derivePathParams?: DerivePathParams): Promise<_mysten_sui_dist_cjs_client.SuiTransactionBlockResponse>;
|
|
1494
|
+
private callWithRateLimiter;
|
|
1495
|
+
private queryGetNormalizedMoveFunction;
|
|
1496
|
+
/**
|
|
1497
|
+
* @description Provides cache for getObject of the SuiKit.
|
|
1498
|
+
* @param objectId
|
|
1499
|
+
* @param QueryObjectParams
|
|
1500
|
+
* @returns Promise<SuiObjectResponse>
|
|
1501
|
+
*/
|
|
1502
|
+
queryGetObject(objectId: string, options?: SuiObjectDataOptions): Promise<SuiObjectResponse>;
|
|
1503
|
+
/**
|
|
1504
|
+
* @description Provides cache for getObjects of the SuiKit.
|
|
1505
|
+
* @param objectIds
|
|
1506
|
+
* @returns Promise<SuiObjectData[]>
|
|
1507
|
+
*/
|
|
1508
|
+
queryGetObjects(objectIds: string[], options?: SuiObjectDataOptions): Promise<SuiObjectData[]>;
|
|
1509
|
+
/**
|
|
1510
|
+
* @description Provides cache for getOwnedObjects of the SuiKit.
|
|
1511
|
+
* @param input
|
|
1512
|
+
* @returns Promise<PaginatedObjectsResponse>
|
|
1513
|
+
*/
|
|
1514
|
+
queryGetOwnedObjects(input: GetOwnedObjectsParams): Promise<_mysten_sui_dist_cjs_client.PaginatedObjectsResponse>;
|
|
1515
|
+
queryGetDynamicFields(input: GetDynamicFieldsParams): Promise<DynamicFieldPage | null>;
|
|
1516
|
+
queryGetDynamicFieldObject(input: GetDynamicFieldObjectParams): Promise<SuiObjectResponse | null>;
|
|
1517
|
+
queryGetAllCoinBalances(owner: string): Promise<{
|
|
1518
|
+
[k: string]: CoinBalance;
|
|
1519
|
+
}>;
|
|
1520
|
+
queryGetCoinBalance(input: GetBalanceParams): Promise<CoinBalance | null>;
|
|
1521
|
+
/**
|
|
1522
|
+
* @description Provides cache for inspectTxn of the SuiKit.
|
|
1523
|
+
* @param QueryInspectTxnParams
|
|
1524
|
+
* @param txBlock
|
|
1525
|
+
* @returns Promise<DevInspectResults>
|
|
1526
|
+
*/
|
|
1527
|
+
queryInspectTxn({ queryTarget, args, typeArgs, }: QueryInspectTxnParams): Promise<DevInspectResults | null>;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
type ScallopQueryParams = {
|
|
1531
|
+
indexer?: ScallopIndexer;
|
|
1532
|
+
utils?: ScallopUtils;
|
|
1533
|
+
} & ScallopUtilsParams & ScallopIndexerParams;
|
|
1534
|
+
declare class ScallopQuery implements ScallopQueryInterface {
|
|
1535
|
+
readonly indexer: ScallopIndexer;
|
|
1536
|
+
readonly utils: ScallopUtils;
|
|
1537
|
+
constructor(params: ScallopQueryParams);
|
|
1538
|
+
initIndexerFallback(): void;
|
|
1539
|
+
/**
|
|
1540
|
+
* Request the scallop API to initialize data.
|
|
1541
|
+
*
|
|
1542
|
+
* @param force - Whether to force initialization.
|
|
1543
|
+
*/
|
|
1544
|
+
init(force?: boolean): Promise<void>;
|
|
1545
|
+
get constants(): ScallopConstants;
|
|
1546
|
+
get walletAddress(): string;
|
|
1547
|
+
get scallopSuiKit(): ScallopSuiKit;
|
|
1548
|
+
get address(): ScallopConstants;
|
|
1549
|
+
/**
|
|
1550
|
+
* @deprecated use getMarketPools
|
|
1551
|
+
* Query market data.
|
|
1552
|
+
* @param indexer - Whether to use indexer.
|
|
1553
|
+
* @return Market data.
|
|
1554
|
+
*/
|
|
1555
|
+
queryMarket(args?: {
|
|
1556
|
+
coinPrices?: CoinPrices;
|
|
1557
|
+
indexer?: boolean;
|
|
1558
|
+
}): Promise<Market>;
|
|
1559
|
+
/**
|
|
1560
|
+
* Get market pools.
|
|
1561
|
+
*
|
|
1562
|
+
* @description
|
|
1563
|
+
* To obtain all market pools at once, it is recommended to use
|
|
1564
|
+
* the `queryMarket` method to reduce time consumption.
|
|
1565
|
+
*
|
|
1566
|
+
* @param poolCoinNames - Specific an array of support pool coin name.
|
|
1567
|
+
* @param indexer - Whether to use indexer.
|
|
1568
|
+
* @return Market pools data.
|
|
1569
|
+
*/
|
|
1570
|
+
getMarketPools(poolCoinNames?: string[], args?: {
|
|
1571
|
+
coinPrices?: CoinPrices;
|
|
1572
|
+
indexer?: boolean;
|
|
1573
|
+
}): Promise<{
|
|
1574
|
+
pools: MarketPools;
|
|
1575
|
+
collaterals: MarketCollaterals;
|
|
1576
|
+
}>;
|
|
1577
|
+
/**
|
|
1578
|
+
* Get market pool
|
|
1579
|
+
*
|
|
1580
|
+
* @param poolCoinName - Specific support pool coin name.
|
|
1581
|
+
* @param indexer - Whether to use indexer.
|
|
1582
|
+
* @return Market pool data.
|
|
1583
|
+
*/
|
|
1584
|
+
getMarketPool(poolCoinName: string, args?: {
|
|
1585
|
+
coinPrice?: number;
|
|
1586
|
+
indexer?: boolean;
|
|
1587
|
+
}): Promise<MarketPool | undefined>;
|
|
1588
|
+
/**
|
|
1589
|
+
* Get market collaterals.
|
|
1590
|
+
*
|
|
1591
|
+
* @description
|
|
1592
|
+
* To obtain all market collaterals at once, it is recommended to use
|
|
1593
|
+
* the `queryMarket` method to reduce time consumption.
|
|
1594
|
+
*
|
|
1595
|
+
* @param collateralCoinNames - Specific an array of support collateral coin name.
|
|
1596
|
+
* @param indexer - Whether to use indexer.
|
|
1597
|
+
* @return Market collaterals data.
|
|
1598
|
+
*/
|
|
1599
|
+
getMarketCollaterals(collateralCoinNames?: string[], args?: {
|
|
1600
|
+
indexer?: boolean;
|
|
1601
|
+
}): Promise<{
|
|
1602
|
+
[x: string]: MarketCollateral | undefined;
|
|
1603
|
+
}>;
|
|
1604
|
+
/**
|
|
1605
|
+
* Get market collateral
|
|
1606
|
+
*
|
|
1607
|
+
* @param collateralCoinName - Specific support collateral coin name.
|
|
1608
|
+
* @param indexer - Whether to use indexer.
|
|
1609
|
+
* @return Market collateral data.
|
|
1610
|
+
*/
|
|
1611
|
+
getMarketCollateral(collateralCoinName: string, args?: {
|
|
1612
|
+
indexer?: boolean;
|
|
1613
|
+
}): Promise<MarketCollateral | undefined>;
|
|
1614
|
+
/**
|
|
1615
|
+
* Get obligations data.
|
|
1616
|
+
*
|
|
1617
|
+
* @param ownerAddress - The owner address.
|
|
1618
|
+
* @return Obligations data.
|
|
1619
|
+
*/
|
|
1620
|
+
getObligations(ownerAddress?: string): Promise<Obligation[]>;
|
|
1621
|
+
/**
|
|
1622
|
+
* Query obligation data.
|
|
1623
|
+
*
|
|
1624
|
+
* @param obligationId - The obligation id.
|
|
1625
|
+
* @return Obligation data.
|
|
1626
|
+
*/
|
|
1627
|
+
queryObligation(obligationId: SuiObjectArg): Promise<ObligationQueryInterface | undefined>;
|
|
1628
|
+
/**
|
|
1629
|
+
* Get all asset coin amounts.
|
|
1630
|
+
*
|
|
1631
|
+
* @param assetCoinNames - Specific an array of support asset coin name.
|
|
1632
|
+
* @param ownerAddress - The owner address.
|
|
1633
|
+
* @return All coin amounts.
|
|
1634
|
+
*/
|
|
1635
|
+
getCoinAmounts(assetCoinNames?: string[], ownerAddress?: string): Promise<OptionalKeys<Record<string, number>>>;
|
|
1636
|
+
/**
|
|
1637
|
+
* Get asset coin amount.
|
|
1638
|
+
*
|
|
1639
|
+
* @param assetCoinName - Specific support asset coin name.
|
|
1640
|
+
* @param ownerAddress - The owner address.
|
|
1641
|
+
* @return Coin amount.
|
|
1642
|
+
*/
|
|
1643
|
+
getCoinAmount(assetCoinName: string, ownerAddress?: string): Promise<number>;
|
|
1644
|
+
/**
|
|
1645
|
+
* Get all market coin amounts.
|
|
1646
|
+
*
|
|
1647
|
+
* @param coinNames - Specific an array of support market coin name.
|
|
1648
|
+
* @param ownerAddress - The owner address.
|
|
1649
|
+
* @return All market market coin amounts.
|
|
1650
|
+
*/
|
|
1651
|
+
getMarketCoinAmounts(marketCoinNames?: string[], ownerAddress?: string): Promise<OptionalKeys<Record<string, number>>>;
|
|
1652
|
+
/**
|
|
1653
|
+
* Get market coin amount.
|
|
1654
|
+
*
|
|
1655
|
+
* @param coinNames - Specific support market coin name.
|
|
1656
|
+
* @param ownerAddress - The owner address.
|
|
1657
|
+
* @return Market market coin amount.
|
|
1658
|
+
*/
|
|
1659
|
+
getMarketCoinAmount(marketCoinName: string, ownerAddress?: string): Promise<number>;
|
|
1660
|
+
/**
|
|
1661
|
+
* Get price from pyth fee object.
|
|
1662
|
+
*
|
|
1663
|
+
* @param assetCoinName - Specific support asset coin name.
|
|
1664
|
+
* @return Asset coin price.
|
|
1665
|
+
*/
|
|
1666
|
+
getPriceFromPyth(assetCoinName: string): Promise<number>;
|
|
1667
|
+
/**
|
|
1668
|
+
* Get prices from pyth fee object.
|
|
1669
|
+
*
|
|
1670
|
+
* @param assetCoinNames - Array of supported asset coin names.
|
|
1671
|
+
* @return Array of asset coin prices.
|
|
1672
|
+
*/
|
|
1673
|
+
getPricesFromPyth(assetCoinNames: string[]): Promise<Record<string, number>>;
|
|
1674
|
+
/**
|
|
1675
|
+
* Get spools data.
|
|
1676
|
+
*
|
|
1677
|
+
* @param stakeMarketCoinNames - Specific an array of support stake market coin name.
|
|
1678
|
+
* @param indexer - Whether to use indexer.
|
|
1679
|
+
* @return Spools data.
|
|
1680
|
+
*/
|
|
1681
|
+
getSpools(stakeMarketCoinNames?: string[], args?: {
|
|
1682
|
+
marketPools?: MarketPools;
|
|
1683
|
+
coinPrices?: CoinPrices;
|
|
1684
|
+
indexer?: boolean;
|
|
1685
|
+
}): Promise<{
|
|
1686
|
+
[x: string]: Spool | undefined;
|
|
1687
|
+
}>;
|
|
1688
|
+
/**
|
|
1689
|
+
* Get spool data.
|
|
1690
|
+
*
|
|
1691
|
+
* @param stakeMarketCoinName - Specific support stake market coin name.
|
|
1692
|
+
* @param indexer - Whether to use indexer.
|
|
1693
|
+
* @return Spool data.
|
|
1694
|
+
*/
|
|
1695
|
+
getSpool(stakeMarketCoinName: string, args?: {
|
|
1696
|
+
marketPool?: MarketPool;
|
|
1697
|
+
coinPrices?: CoinPrices;
|
|
1698
|
+
indexer?: boolean;
|
|
1699
|
+
}): Promise<Spool | undefined>;
|
|
1700
|
+
/**
|
|
1701
|
+
* Get stake accounts data for all stake pools (spools).
|
|
1702
|
+
*
|
|
1703
|
+
* @param ownerAddress - The owner address.
|
|
1704
|
+
* @return All Stake accounts data.
|
|
1705
|
+
*/
|
|
1706
|
+
getAllStakeAccounts(ownerAddress?: string): Promise<StakeAccounts>;
|
|
1707
|
+
/**
|
|
1708
|
+
* Get stake accounts data for specific stake pool (spool).
|
|
1709
|
+
*
|
|
1710
|
+
* @param stakeMarketCoinName - Specific support stake market coin name.
|
|
1711
|
+
* @param ownerAddress - The owner address.
|
|
1712
|
+
* @return Stake accounts data.
|
|
1713
|
+
*/
|
|
1714
|
+
getStakeAccounts(stakeMarketCoinName: string, ownerAddress?: string): Promise<StakeAccount[]>;
|
|
1715
|
+
/**
|
|
1716
|
+
* Get stake pools (spools) data.
|
|
1717
|
+
*
|
|
1718
|
+
* @description
|
|
1719
|
+
* For backward compatible, it is recommended to use `getSpools` method
|
|
1720
|
+
* to get all spools data.
|
|
1721
|
+
*
|
|
1722
|
+
* @param stakeMarketCoinNames - Specific an array of support stake market coin name.
|
|
1723
|
+
* @return Stake pools data.
|
|
1724
|
+
*/
|
|
1725
|
+
getStakePools(stakeMarketCoinNames?: string[]): Promise<{
|
|
1726
|
+
[x: string]: StakePool | undefined;
|
|
1727
|
+
}>;
|
|
1728
|
+
/**
|
|
1729
|
+
* Get stake pool (spool) data.
|
|
1730
|
+
*
|
|
1731
|
+
* @description
|
|
1732
|
+
* For backward compatible, it is recommended to use `getSpool` method
|
|
1733
|
+
* to get all spool data.
|
|
1734
|
+
*
|
|
1735
|
+
* @param stakeMarketCoinName - Specific support stake market coin name.
|
|
1736
|
+
* @return Stake pool data.
|
|
1737
|
+
*/
|
|
1738
|
+
getStakePool(stakeMarketCoinName: string): Promise<StakePool | undefined>;
|
|
1739
|
+
/**
|
|
1740
|
+
* Get stake reward pools data.
|
|
1741
|
+
*
|
|
1742
|
+
* @description
|
|
1743
|
+
* For backward compatible, it is recommended to use `getSpools` method
|
|
1744
|
+
* to get all spools data.
|
|
1745
|
+
*
|
|
1746
|
+
* @param stakeMarketCoinNames - Specific an array of stake market coin name.
|
|
1747
|
+
* @return Stake reward pools data.
|
|
1748
|
+
*/
|
|
1749
|
+
getStakeRewardPools(stakeMarketCoinNames?: string[]): Promise<{
|
|
1750
|
+
[x: string]: StakeRewardPool | undefined;
|
|
1751
|
+
}>;
|
|
1752
|
+
/**
|
|
1753
|
+
* Get stake reward pool data.
|
|
1754
|
+
*
|
|
1755
|
+
* @description
|
|
1756
|
+
* For backward compatible, it is recommended to use `getSpool` method
|
|
1757
|
+
* to get spool data.
|
|
1758
|
+
*
|
|
1759
|
+
* @param marketCoinName - Specific support stake market coin name.
|
|
1760
|
+
* @return Stake reward pool data.
|
|
1761
|
+
*/
|
|
1762
|
+
getStakeRewardPool(stakeMarketCoinName: string): Promise<StakeRewardPool | undefined>;
|
|
1763
|
+
/**
|
|
1764
|
+
* Get borrow incentive pools data.
|
|
1765
|
+
*
|
|
1766
|
+
* @param coinNames - Specific an array of support borrow incentive coin name.
|
|
1767
|
+
* @param indexer - Whether to use indexer.
|
|
1768
|
+
* @return Borrow incentive pools data.
|
|
1769
|
+
*/
|
|
1770
|
+
getBorrowIncentivePools(coinNames?: string[], args?: {
|
|
1771
|
+
coinPrices?: CoinPrices;
|
|
1772
|
+
indexer?: boolean;
|
|
1773
|
+
marketPools?: MarketPools;
|
|
1774
|
+
}): Promise<{
|
|
1775
|
+
[x: string]: BorrowIncentivePool | undefined;
|
|
1776
|
+
}>;
|
|
1777
|
+
/**
|
|
1778
|
+
* Get borrow incentive accounts data.
|
|
1779
|
+
*
|
|
1780
|
+
* @param coinNames - Specific support borrow incentive coin name.
|
|
1781
|
+
* @param ownerAddress - The owner address.
|
|
1782
|
+
* @return Borrow incentive accounts data.
|
|
1783
|
+
*/
|
|
1784
|
+
getBorrowIncentiveAccounts(obligationId: string | SuiObjectRef$1, coinNames?: string[]): Promise<{
|
|
1785
|
+
[x: string]: ParsedBorrowIncentiveAccountData | undefined;
|
|
1786
|
+
}>;
|
|
1787
|
+
/**
|
|
1788
|
+
* Get user lending and spool infomation for specific pools.
|
|
1789
|
+
*
|
|
1790
|
+
* @param poolCoinNames - Specific an array of support pool coin name.
|
|
1791
|
+
* @param ownerAddress - The owner address.
|
|
1792
|
+
* @param indexer - Whether to use indexer.
|
|
1793
|
+
* @return All lending and spool infomation.
|
|
1794
|
+
*/
|
|
1795
|
+
getLendings(poolCoinNames?: string[], ownerAddress?: string, args?: {
|
|
1796
|
+
indexer?: boolean;
|
|
1797
|
+
marketPools?: MarketPools;
|
|
1798
|
+
coinPrices?: CoinPrices;
|
|
1799
|
+
}): Promise<{
|
|
1800
|
+
[x: string]: Lending | undefined;
|
|
1801
|
+
}>;
|
|
1802
|
+
/**
|
|
1803
|
+
* Get user lending and spool information for specific pool.
|
|
1804
|
+
*
|
|
1805
|
+
* @param poolCoinName - Specific support pool coin name.
|
|
1806
|
+
* @param ownerAddress - The owner address.
|
|
1807
|
+
* @param indexer - Whether to use indexer.
|
|
1808
|
+
* @return Lending pool data.
|
|
1809
|
+
*/
|
|
1810
|
+
getLending(poolCoinName: string, ownerAddress?: string, args?: {
|
|
1811
|
+
indexer?: boolean;
|
|
1812
|
+
}): Promise<Lending>;
|
|
1813
|
+
/**
|
|
1814
|
+
* Get user all obligation accounts information.
|
|
1815
|
+
*
|
|
1816
|
+
* @description
|
|
1817
|
+
* All collateral and borrowing information in all obligation accounts owned by the user.
|
|
1818
|
+
*
|
|
1819
|
+
* @param ownerAddress - The owner address.
|
|
1820
|
+
* @param indexer - Whether to use indexer.
|
|
1821
|
+
* @return All obligation accounts information.
|
|
1822
|
+
*/
|
|
1823
|
+
getObligationAccounts(ownerAddress?: string, args?: {
|
|
1824
|
+
indexer?: boolean;
|
|
1825
|
+
market?: {
|
|
1826
|
+
collaterals: MarketCollaterals;
|
|
1827
|
+
pools: MarketPools;
|
|
2932
1828
|
};
|
|
2933
|
-
|
|
2934
|
-
}
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
1829
|
+
coinPrices?: CoinPrices;
|
|
1830
|
+
}): Promise<{
|
|
1831
|
+
[x: string]: ObligationAccount | undefined;
|
|
1832
|
+
}>;
|
|
1833
|
+
/**
|
|
1834
|
+
* Get obligation account information for specific id.
|
|
1835
|
+
*
|
|
1836
|
+
* @description
|
|
1837
|
+
* borrowing and obligation information for specific pool.
|
|
1838
|
+
*
|
|
1839
|
+
* @param obligationId - The obligation id.
|
|
1840
|
+
* @param ownerAddress - The owner address.
|
|
1841
|
+
* @param indexer - Whether to use indexer.
|
|
1842
|
+
* @return Borrowing and collateral information.
|
|
1843
|
+
*/
|
|
1844
|
+
getObligationAccount(obligationId: string, ownerAddress?: string, args?: {
|
|
1845
|
+
indexer?: boolean;
|
|
1846
|
+
}): Promise<ObligationAccount | undefined>;
|
|
1847
|
+
/**
|
|
1848
|
+
* Get total value locked.
|
|
1849
|
+
*
|
|
1850
|
+
* @param indexer - Whether to use indexer.
|
|
1851
|
+
* @description
|
|
1852
|
+
* Include total supplied value and total borrowed value.
|
|
1853
|
+
*
|
|
1854
|
+
* @return Total value locked.
|
|
1855
|
+
*/
|
|
1856
|
+
getTvl(args?: {
|
|
1857
|
+
indexer?: boolean;
|
|
1858
|
+
}): Promise<TotalValueLocked>;
|
|
1859
|
+
/**
|
|
1860
|
+
* Get veSca data.
|
|
1861
|
+
* @param veScaKey
|
|
1862
|
+
* @returns veSca
|
|
1863
|
+
*/
|
|
1864
|
+
getVeSca(veScaKey: string | SuiObjectData$1): Promise<Vesca | undefined>;
|
|
1865
|
+
/**
|
|
1866
|
+
* Get all veSca from walletAdddress
|
|
1867
|
+
* @param walletAddress
|
|
1868
|
+
* @returns array of veSca
|
|
1869
|
+
*/
|
|
1870
|
+
getVeScas({ walletAddress, excludeEmpty, }?: {
|
|
1871
|
+
walletAddress?: string;
|
|
1872
|
+
excludeEmpty?: boolean;
|
|
1873
|
+
}): Promise<Vesca[]>;
|
|
1874
|
+
/**
|
|
1875
|
+
* Get total vesca treasury with movecall
|
|
1876
|
+
* @returns Promise<string | undefined>
|
|
1877
|
+
*/
|
|
1878
|
+
getVeScaTreasuryInfo(): Promise<VeScaTreasuryInfo | null>;
|
|
1879
|
+
/**
|
|
1880
|
+
* Return binded referrer veScaKeyId of referee walletAddress if exist
|
|
1881
|
+
* @param walletAddress
|
|
1882
|
+
* @returns veScaKeyId
|
|
1883
|
+
*/
|
|
1884
|
+
getVeScaKeyIdFromReferralBindings(walletAddress?: string): Promise<string | null>;
|
|
1885
|
+
/**
|
|
1886
|
+
* Get binded obligationId from a veScaKey if it exists.
|
|
1887
|
+
* @param veScaKey
|
|
1888
|
+
* @returns obligationId
|
|
1889
|
+
*/
|
|
1890
|
+
getBindedObligationId(veScaKey: string): Promise<string | null>;
|
|
1891
|
+
/**
|
|
1892
|
+
* Get binded veSCA key from a obligationId if it exists.
|
|
1893
|
+
* @param obligationId
|
|
1894
|
+
* @returns veScaKey
|
|
1895
|
+
*/
|
|
1896
|
+
getBindedVeScaKey(obligationId: string): Promise<string | null>;
|
|
1897
|
+
/**
|
|
1898
|
+
* Get user's veSCA loyalty program informations
|
|
1899
|
+
* @param veScaKey
|
|
1900
|
+
* @returns Loyalty program information
|
|
1901
|
+
*/
|
|
1902
|
+
getLoyaltyProgramInfos(veScaKey?: string | SuiObjectData$1): Promise<LoyaltyProgramInfo | null>;
|
|
1903
|
+
/**
|
|
1904
|
+
* Get user's veSCA rewards informations from loyalty program
|
|
1905
|
+
* @param veScaKey
|
|
1906
|
+
* @returns Loyalty program information
|
|
1907
|
+
*/
|
|
1908
|
+
getVeScaLoyaltyProgramInfos(veScaKey?: string | SuiObjectData$1): Promise<VeScaLoyaltyProgramInfo | null>;
|
|
1909
|
+
/**
|
|
1910
|
+
* Get total supply of sCoin
|
|
1911
|
+
* @param sCoinName - Supported sCoin name
|
|
1912
|
+
* @returns Total Supply
|
|
1913
|
+
*/
|
|
1914
|
+
getSCoinTotalSupply(sCoinName: string): Promise<number>;
|
|
1915
|
+
/**
|
|
1916
|
+
* Get all sCoin amounts.
|
|
1917
|
+
*
|
|
1918
|
+
* @param sCoinNames - Specific an array of support sCoin name.
|
|
1919
|
+
* @param ownerAddress - The owner address.
|
|
1920
|
+
* @return All market sCoin amounts.
|
|
1921
|
+
*/
|
|
1922
|
+
getSCoinAmounts(sCoinNames?: string[], ownerAddress?: string): Promise<OptionalKeys<Record<string, number>>>;
|
|
1923
|
+
/**
|
|
1924
|
+
* Get sCoin amount.
|
|
1925
|
+
*
|
|
1926
|
+
* @param coinNames - Specific support sCoin name.
|
|
1927
|
+
* @param ownerAddress - The owner address.
|
|
1928
|
+
* @return sCoin amount.
|
|
1929
|
+
*/
|
|
1930
|
+
getSCoinAmount(sCoinName: string | string, ownerAddress?: string): Promise<number>;
|
|
1931
|
+
/**
|
|
1932
|
+
* Get swap rate from sCoin A to sCoin B
|
|
1933
|
+
* @param assetCoinNames
|
|
1934
|
+
* @returns
|
|
1935
|
+
*/
|
|
1936
|
+
getSCoinSwapRate(fromSCoin: string, toSCoin: string): Promise<number>;
|
|
1937
|
+
getFlashLoanFees(assetCoinNames?: string[]): Promise<Record<string, number>>;
|
|
1938
|
+
/**
|
|
1939
|
+
* Get supply limit of lending pool
|
|
1940
|
+
*/
|
|
1941
|
+
getPoolSupplyLimit(poolName: string): Promise<string | null>;
|
|
1942
|
+
/**
|
|
1943
|
+
* Get borrow limit of borrow pool
|
|
1944
|
+
*/
|
|
1945
|
+
getPoolBorrowLimit(poolName: string): Promise<string | null>;
|
|
1946
|
+
/**
|
|
1947
|
+
* Get list of isolated assets
|
|
1948
|
+
*/
|
|
1949
|
+
getIsolatedAssets(useOnChainQuery?: boolean): Promise<string[]>;
|
|
1950
|
+
/**
|
|
1951
|
+
* Check if asset is an isolated asset
|
|
1952
|
+
*/
|
|
1953
|
+
isIsolatedAsset(assetCoinName: string): Promise<boolean>;
|
|
1954
|
+
/**
|
|
1955
|
+
* Get pool coin price from indexer
|
|
1956
|
+
* @param coinName
|
|
1957
|
+
* @returns price data
|
|
1958
|
+
*/
|
|
1959
|
+
getCoinPriceByIndexer(poolName: string): Promise<number>;
|
|
1960
|
+
/**
|
|
1961
|
+
* Get all supported pool price from indexer
|
|
1962
|
+
* @returns prices data
|
|
1963
|
+
*/
|
|
1964
|
+
getCoinPricesByIndexer(): Promise<Record<string, number>>;
|
|
1965
|
+
/**
|
|
1966
|
+
* Get all coin prices, including sCoin
|
|
1967
|
+
* @returns prices data
|
|
1968
|
+
*/
|
|
1969
|
+
getAllCoinPrices(args?: {
|
|
1970
|
+
marketPools?: MarketPools;
|
|
1971
|
+
coinPrices?: CoinPrices;
|
|
1972
|
+
indexer?: boolean;
|
|
1973
|
+
}): Promise<{
|
|
1974
|
+
[x: string]: number | undefined;
|
|
1975
|
+
}>;
|
|
1976
|
+
/**
|
|
1977
|
+
* Query all address (lending pool, collateral pool, borrow dynamics, interest models, etc.) of all pool
|
|
1978
|
+
* @returns
|
|
1979
|
+
*/
|
|
1980
|
+
getPoolAddresses(apiAddressId?: string | undefined): Promise<OptionalKeys<Record<string, PoolAddress>>>;
|
|
1981
|
+
/**
|
|
1982
|
+
* Get user portfolio
|
|
1983
|
+
*/
|
|
1984
|
+
getUserPortfolio(args?: {
|
|
1985
|
+
walletAddress?: string;
|
|
1986
|
+
indexer?: boolean;
|
|
1987
|
+
}): Promise<{
|
|
1988
|
+
totalLockedScaValue: number;
|
|
1989
|
+
lendings: {
|
|
1990
|
+
suppliedCoin: number;
|
|
1991
|
+
suppliedValue: number;
|
|
1992
|
+
stakedCoin: number;
|
|
1993
|
+
coinName: string;
|
|
2957
1994
|
symbol: string;
|
|
2958
|
-
decimals: number;
|
|
2959
|
-
oracle: {
|
|
2960
|
-
[K in SupportOracleType]: K extends (typeof _SUPPORT_ORACLES)[0] ? string : K extends (typeof _SUPPORT_ORACLES)[1] ? string : K extends (typeof _SUPPORT_ORACLES)[2] ? {
|
|
2961
|
-
feed: string;
|
|
2962
|
-
feedObject: string;
|
|
2963
|
-
} : never;
|
|
2964
|
-
};
|
|
2965
|
-
}>>;
|
|
2966
|
-
oracles: {
|
|
2967
|
-
[K in SupportOracleType]: K extends (typeof _SUPPORT_ORACLES)[0] ? {
|
|
2968
|
-
registry: string;
|
|
2969
|
-
registryCap: string;
|
|
2970
|
-
holder: string;
|
|
2971
|
-
} : K extends (typeof _SUPPORT_ORACLES)[1] ? {
|
|
2972
|
-
registry: string;
|
|
2973
|
-
registryCap: string;
|
|
2974
|
-
registryTableId: string;
|
|
2975
|
-
state: string;
|
|
2976
|
-
} : K extends (typeof _SUPPORT_ORACLES)[2] ? {
|
|
2977
|
-
registry: string;
|
|
2978
|
-
registryCap: string;
|
|
2979
|
-
state: string;
|
|
2980
|
-
wormhole: string;
|
|
2981
|
-
wormholeState: string;
|
|
2982
|
-
} : never;
|
|
2983
|
-
} & {
|
|
2984
|
-
xOracle: string;
|
|
2985
|
-
xOracleCap: string;
|
|
2986
|
-
primaryPriceUpdatePolicyObject: string;
|
|
2987
|
-
secondaryPriceUpdatePolicyObject: string;
|
|
2988
|
-
primaryPriceUpdatePolicyVecsetId: string;
|
|
2989
|
-
secondaryPriceUpdatePolicyVecsetId: string;
|
|
2990
|
-
};
|
|
2991
|
-
packages: Partial<Record<string, {
|
|
2992
|
-
id: string;
|
|
2993
|
-
object?: string;
|
|
2994
|
-
upgradeCap: string;
|
|
2995
|
-
}>>;
|
|
2996
|
-
};
|
|
2997
|
-
spool: {
|
|
2998
|
-
id: string;
|
|
2999
|
-
adminCap: string;
|
|
3000
|
-
object: string;
|
|
3001
|
-
config: string;
|
|
3002
|
-
pools: Partial<Record<string, {
|
|
3003
|
-
id: string;
|
|
3004
|
-
rewardPoolId: string;
|
|
3005
|
-
}>>;
|
|
3006
|
-
};
|
|
3007
|
-
borrowIncentive: {
|
|
3008
|
-
id: string;
|
|
3009
|
-
adminCap: string;
|
|
3010
|
-
object: string;
|
|
3011
|
-
query: string;
|
|
3012
|
-
config: string;
|
|
3013
|
-
incentivePools: string;
|
|
3014
|
-
incentiveAccounts: string;
|
|
3015
|
-
};
|
|
3016
|
-
vesca: {
|
|
3017
|
-
id: string;
|
|
3018
|
-
object: string;
|
|
3019
|
-
adminCap: string;
|
|
3020
|
-
tableId: string;
|
|
3021
|
-
table: string;
|
|
3022
|
-
treasury: string;
|
|
3023
|
-
config: string;
|
|
3024
|
-
subsTable: string;
|
|
3025
|
-
subsTableId: string;
|
|
3026
|
-
subsWhitelist: string;
|
|
3027
|
-
};
|
|
3028
|
-
referral: {
|
|
3029
|
-
id: string;
|
|
3030
|
-
version: string;
|
|
3031
|
-
object: string;
|
|
3032
|
-
adminCap: string;
|
|
3033
|
-
referralBindings: string;
|
|
3034
|
-
bindingTableId: string;
|
|
3035
|
-
referralRevenuePool: string;
|
|
3036
|
-
revenueTableId: string;
|
|
3037
|
-
referralTiers: string;
|
|
3038
|
-
tiersTableId: string;
|
|
3039
|
-
authorizedWitnessList: string;
|
|
3040
|
-
};
|
|
3041
|
-
loyaltyProgram: {
|
|
3042
|
-
id: string;
|
|
3043
|
-
adminCap?: string;
|
|
3044
|
-
object: string;
|
|
3045
|
-
rewardPool: string;
|
|
3046
|
-
userRewardTableId: string;
|
|
3047
|
-
};
|
|
3048
|
-
veScaLoyaltyProgram: {
|
|
3049
|
-
id: string;
|
|
3050
|
-
adminCap?: string;
|
|
3051
|
-
object: string;
|
|
3052
|
-
veScaRewardPool: string;
|
|
3053
|
-
veScaRewardTableId: string;
|
|
3054
|
-
};
|
|
3055
|
-
scoin: {
|
|
3056
|
-
id: string;
|
|
3057
|
-
coins: Partial<Record<string, {
|
|
3058
1995
|
coinType: string;
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
1996
|
+
coinPrice: number;
|
|
1997
|
+
coinDecimals: number;
|
|
1998
|
+
supplyApr: number;
|
|
1999
|
+
supplyApy: number;
|
|
2000
|
+
incentiveApr: number;
|
|
2001
|
+
}[];
|
|
2002
|
+
borrowings: {
|
|
2003
|
+
obligationId: string;
|
|
2004
|
+
totalDebtsInUsd: number;
|
|
2005
|
+
totalCollateralInUsd: number;
|
|
2006
|
+
riskLevel: number;
|
|
2007
|
+
availableCollateralInUsd: number;
|
|
2008
|
+
totalUnhealthyCollateralInUsd: number;
|
|
2009
|
+
collaterals: {
|
|
2010
|
+
coinName: string;
|
|
2011
|
+
symbol: string;
|
|
2012
|
+
coinDecimals: number;
|
|
2013
|
+
coinType: string;
|
|
2014
|
+
coinPrice: number;
|
|
2015
|
+
depositedCoin: number;
|
|
2016
|
+
depositedValueInUsd: number;
|
|
2017
|
+
}[];
|
|
2018
|
+
borrowedPools: {
|
|
2019
|
+
coinName: string;
|
|
2020
|
+
symbol: string;
|
|
2021
|
+
coinDecimals: number;
|
|
2022
|
+
coinType: string;
|
|
2023
|
+
coinPrice: number;
|
|
2024
|
+
borrowedCoin: number;
|
|
2025
|
+
borrowedValueInUsd: number;
|
|
2026
|
+
borrowApr: number | undefined;
|
|
2027
|
+
borrowApy: number | undefined;
|
|
2028
|
+
incentiveInfos: {
|
|
2029
|
+
coinName: string;
|
|
2030
|
+
symbol: string;
|
|
2031
|
+
coinType: string;
|
|
2032
|
+
incentiveApr: number;
|
|
2033
|
+
}[];
|
|
2034
|
+
}[];
|
|
2035
|
+
}[];
|
|
2036
|
+
pendingRewards: {
|
|
2037
|
+
lendings: any;
|
|
2038
|
+
borrowIncentives: any;
|
|
2039
|
+
};
|
|
2040
|
+
veScas: {
|
|
2041
|
+
veScaKey: string;
|
|
2042
|
+
coinPrice: number;
|
|
2043
|
+
lockedScaInCoin: number;
|
|
2044
|
+
lockedScaInUsd: number;
|
|
2045
|
+
currentVeScaBalance: number;
|
|
2046
|
+
remainingLockPeriodInDays: number;
|
|
2047
|
+
unlockAt: number;
|
|
2048
|
+
}[];
|
|
2049
|
+
totalDebtValue: number;
|
|
2050
|
+
totalCollateralValue: number;
|
|
2051
|
+
totalSupplyValue: number;
|
|
2052
|
+
}>;
|
|
2053
|
+
/**
|
|
2054
|
+
* Get both primary and secondary price update policy objects
|
|
2055
|
+
* @returns price update policies
|
|
2056
|
+
*/
|
|
2057
|
+
getPriceUpdatePolicies(): Promise<{
|
|
2058
|
+
primary: _mysten_sui_dist_cjs_client.SuiObjectResponse | null;
|
|
2059
|
+
secondary: _mysten_sui_dist_cjs_client.SuiObjectResponse | null;
|
|
2060
|
+
}>;
|
|
2061
|
+
/**
|
|
2062
|
+
* Return the supported primary and secondary oracles for all supported pool assets
|
|
2063
|
+
*/
|
|
2064
|
+
getAssetOracles(): Promise<Record<string, xOracleRules>>;
|
|
2065
|
+
/**
|
|
2066
|
+
* Get switchboard on-demand aggregator object id based on coinType
|
|
2067
|
+
* @param coinType
|
|
2068
|
+
* @returns
|
|
2069
|
+
*/
|
|
2070
|
+
getSwitchboardOnDemandAggregatorObjectIds(coinName: string[]): Promise<string[]>;
|
|
3064
2071
|
}
|
|
3065
|
-
type AddressPathsProps<T> = T extends string ? [] : {
|
|
3066
|
-
[K in Extract<keyof T, string>]: [K, ...AddressPathsProps<T[K]>];
|
|
3067
|
-
}[Extract<keyof T, string>];
|
|
3068
|
-
type Join<T extends string[], D extends string> = T extends [] ? never : T extends [infer F] ? F : T extends [infer F, ...infer R] ? F extends string ? `${F}${D}${Join<Extract<R, string[]>, D>}` : never : string;
|
|
3069
|
-
type AddressStringPath = Join<AddressPathsProps<AddressesInterface>, '.'>;
|
|
3070
|
-
|
|
3071
|
-
type OptionalKeys<T> = {
|
|
3072
|
-
[K in keyof T]?: T[K];
|
|
3073
|
-
};
|
|
3074
|
-
type CoinPrices = OptionalKeys<Record<string, number>>;
|
|
3075
2072
|
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
declare
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
coinType: string;
|
|
3172
|
-
spoolName: string;
|
|
3173
|
-
decimals: number;
|
|
3174
|
-
pythFeed: string;
|
|
3175
|
-
pythFeedObjectId: string;
|
|
3176
|
-
flashloanFeeObject: string;
|
|
3177
|
-
};
|
|
3178
|
-
fud: {
|
|
3179
|
-
coinName: string;
|
|
3180
|
-
symbol: string;
|
|
3181
|
-
lendingPoolAddress: string;
|
|
3182
|
-
collateralPoolAddress: string;
|
|
3183
|
-
borrowDynamic: string;
|
|
3184
|
-
interestModel: string;
|
|
3185
|
-
borrowFeeKey: string;
|
|
3186
|
-
supplyLimitKey: string;
|
|
3187
|
-
borrowLimitKey: string;
|
|
3188
|
-
isolatedAssetKey: string;
|
|
3189
|
-
isIsolated: boolean;
|
|
3190
|
-
spool: string;
|
|
3191
|
-
spoolReward: string;
|
|
3192
|
-
sCoinType: string;
|
|
3193
|
-
sCoinTreasury: string;
|
|
3194
|
-
sCoinMetadataId: string;
|
|
3195
|
-
sCoinSymbol: string;
|
|
3196
|
-
sCoinName: string;
|
|
3197
|
-
coinMetadataId: string;
|
|
3198
|
-
coinType: string;
|
|
3199
|
-
spoolName: string;
|
|
3200
|
-
decimals: number;
|
|
3201
|
-
pythFeed: string;
|
|
3202
|
-
pythFeedObjectId: string;
|
|
3203
|
-
flashloanFeeObject: string;
|
|
3204
|
-
};
|
|
3205
|
-
deep: {
|
|
3206
|
-
coinName: string;
|
|
3207
|
-
symbol: string;
|
|
3208
|
-
lendingPoolAddress: string;
|
|
3209
|
-
collateralPoolAddress: string;
|
|
3210
|
-
borrowDynamic: string;
|
|
3211
|
-
interestModel: string;
|
|
3212
|
-
borrowFeeKey: string;
|
|
3213
|
-
supplyLimitKey: string;
|
|
3214
|
-
borrowLimitKey: string;
|
|
3215
|
-
isolatedAssetKey: string;
|
|
3216
|
-
isIsolated: boolean;
|
|
3217
|
-
spool: string;
|
|
3218
|
-
spoolReward: string;
|
|
3219
|
-
sCoinType: string;
|
|
3220
|
-
sCoinTreasury: string;
|
|
3221
|
-
sCoinMetadataId: string;
|
|
3222
|
-
sCoinSymbol: string;
|
|
3223
|
-
sCoinName: string;
|
|
3224
|
-
coinMetadataId: string;
|
|
3225
|
-
coinType: string;
|
|
3226
|
-
spoolName: string;
|
|
3227
|
-
decimals: number;
|
|
3228
|
-
pythFeed: string;
|
|
3229
|
-
pythFeedObjectId: string;
|
|
3230
|
-
flashloanFeeObject: string;
|
|
3231
|
-
};
|
|
3232
|
-
};
|
|
2073
|
+
type ScallopBuilderParams = {
|
|
2074
|
+
query?: ScallopQuery;
|
|
2075
|
+
usePythPullModel?: boolean;
|
|
2076
|
+
pythSponsoredFeeds?: string[];
|
|
2077
|
+
useOnChainXOracleList?: boolean;
|
|
2078
|
+
} & ScallopQueryParams;
|
|
2079
|
+
/**
|
|
2080
|
+
* @description
|
|
2081
|
+
* It provides methods for operating the transaction block, making it more convenient to organize transaction combinations.
|
|
2082
|
+
*
|
|
2083
|
+
* @example
|
|
2084
|
+
* ```typescript
|
|
2085
|
+
* const scallopBuilder = new ScallopBuilder(<parameters>);
|
|
2086
|
+
* await scallopBuilder.init();
|
|
2087
|
+
* const txBlock = scallopBuilder.<builder functions>();
|
|
2088
|
+
* ```
|
|
2089
|
+
*/
|
|
2090
|
+
declare class ScallopBuilder implements ScallopBuilderInterface {
|
|
2091
|
+
readonly query: ScallopQuery;
|
|
2092
|
+
readonly usePythPullModel: boolean;
|
|
2093
|
+
readonly useOnChainXOracleList: boolean;
|
|
2094
|
+
readonly pythSponsoredFeeds: string[];
|
|
2095
|
+
constructor(params: ScallopBuilderParams);
|
|
2096
|
+
get utils(): ScallopUtils;
|
|
2097
|
+
get constants(): ScallopConstants;
|
|
2098
|
+
get walletAddress(): string;
|
|
2099
|
+
get scallopSuiKit(): ScallopSuiKit;
|
|
2100
|
+
get suiKit(): _scallop_io_sui_kit.SuiKit;
|
|
2101
|
+
get address(): ScallopConstants;
|
|
2102
|
+
/**
|
|
2103
|
+
* Request the scallop API to initialize data.
|
|
2104
|
+
*
|
|
2105
|
+
* @param force - Whether to force initialization.
|
|
2106
|
+
*/
|
|
2107
|
+
init(force?: boolean): Promise<void>;
|
|
2108
|
+
/**
|
|
2109
|
+
* Create a scallop txBlock instance that enhances transaction block.
|
|
2110
|
+
*
|
|
2111
|
+
* @param txBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
2112
|
+
* @return Scallop txBlock.
|
|
2113
|
+
*/
|
|
2114
|
+
createTxBlock(txBlock?: ScallopTxBlock | SuiTxBlock | Transaction$1): ScallopTxBlock;
|
|
2115
|
+
/**
|
|
2116
|
+
* Specifying the sender's amount of coins to get coins args from transaction result.
|
|
2117
|
+
*
|
|
2118
|
+
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
2119
|
+
* @param assetCoinName - Specific support asset coin name.
|
|
2120
|
+
* @param amount - Amount of coins to be selected.
|
|
2121
|
+
* @param sender - Sender address.
|
|
2122
|
+
* @return Take coin and left coin.
|
|
2123
|
+
*/
|
|
2124
|
+
selectCoin<T extends string>(txBlock: ScallopTxBlock | SuiTxBlock, assetCoinName: T, amount: number, sender?: string): Promise<SelectCoinReturnType<T>>;
|
|
2125
|
+
/**
|
|
2126
|
+
* Specifying the sender's amount of market coins to get coins args from transaction result.
|
|
2127
|
+
*
|
|
2128
|
+
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
2129
|
+
* @param marketCoinName - Specific support market coin name.
|
|
2130
|
+
* @param amount - Amount of coins to be selected.
|
|
2131
|
+
* @param sender - Sender address.
|
|
2132
|
+
* @return Take coin and left coin.
|
|
2133
|
+
*/
|
|
2134
|
+
selectMarketCoin(txBlock: ScallopTxBlock | SuiTxBlock, marketCoinName: string, amount: number, sender?: string): Promise<{
|
|
2135
|
+
takeCoin: TransactionObjectArgument;
|
|
2136
|
+
leftCoin: TransactionObjectArgument;
|
|
2137
|
+
totalAmount: number;
|
|
2138
|
+
}>;
|
|
2139
|
+
/**
|
|
2140
|
+
* Specifying the sender's amount of sCoins to get coins args from transaction result.
|
|
2141
|
+
*
|
|
2142
|
+
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
2143
|
+
* @param marketCoinName - Specific support sCoin name.
|
|
2144
|
+
* @param amount - Amount of coins to be selected.
|
|
2145
|
+
* @param sender - Sender address.
|
|
2146
|
+
* @return Take coin and left coin.
|
|
2147
|
+
*/
|
|
2148
|
+
selectSCoin(txBlock: ScallopTxBlock | SuiTxBlock, sCoinName: string, amount: number, sender?: string): Promise<{
|
|
2149
|
+
takeCoin: TransactionObjectArgument;
|
|
2150
|
+
leftCoin: TransactionObjectArgument;
|
|
2151
|
+
totalAmount: number;
|
|
2152
|
+
}>;
|
|
2153
|
+
/**
|
|
2154
|
+
* Select sCoin or market coin automatically. Prioritize sCoin first
|
|
2155
|
+
*/
|
|
2156
|
+
selectSCoinOrMarketCoin(txBlock: ScallopTxBlock | SuiTxBlock, sCoinName: string, amount: number, sender?: string): Promise<{
|
|
2157
|
+
sCoin: TransactionObjectArgument | undefined;
|
|
2158
|
+
marketCoin: TransactionObjectArgument | undefined;
|
|
2159
|
+
}>;
|
|
2160
|
+
/**
|
|
2161
|
+
* Execute Scallop txBlock using the `signAndSendTxn` methods in suikit.
|
|
2162
|
+
*
|
|
2163
|
+
* @param txBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
2164
|
+
*/
|
|
2165
|
+
signAndSendTxBlock(txBlock: ScallopTxBlock | SuiTxBlock | Transaction$1): Promise<SuiTransactionBlockResponse>;
|
|
2166
|
+
moveCall(txb: ScallopTxBlock | SuiTxBlock, target: string, args?: (SuiTxArg | SuiVecTxArg | SuiObjectArg | SuiAmountsArg)[], typeArgs?: string[]): _scallop_io_sui_kit.TransactionResult;
|
|
2167
|
+
}
|
|
3233
2168
|
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
2169
|
+
interface ScallopBaseInterface {
|
|
2170
|
+
scallopSuiKit: ScallopSuiKit;
|
|
2171
|
+
constants: ScallopConstants;
|
|
2172
|
+
walletAddress: string;
|
|
2173
|
+
init: () => Promise<void>;
|
|
2174
|
+
}
|
|
2175
|
+
interface ScallopUtilsInterface extends ScallopBaseInterface {
|
|
2176
|
+
address: ScallopAddress;
|
|
2177
|
+
}
|
|
2178
|
+
interface ScallopQueryInterface extends ScallopUtilsInterface {
|
|
2179
|
+
utils: ScallopUtils;
|
|
2180
|
+
}
|
|
2181
|
+
interface ScallopBuilderInterface extends ScallopQueryInterface {
|
|
2182
|
+
query: ScallopQuery;
|
|
2183
|
+
}
|
|
2184
|
+
interface ScallopClientInterface extends ScallopBaseInterface {
|
|
2185
|
+
builder: ScallopBuilder;
|
|
2186
|
+
}
|
|
3239
2187
|
|
|
3240
|
-
|
|
2188
|
+
type ScallopUtilsParams = {
|
|
2189
|
+
pythEndpoints?: string[];
|
|
2190
|
+
scallopSuiKit?: ScallopSuiKit;
|
|
2191
|
+
scallopConstants?: ScallopConstants;
|
|
2192
|
+
} & ScallopSuiKitParams & ScallopConstantsParams;
|
|
2193
|
+
declare class ScallopUtils implements ScallopUtilsInterface {
|
|
2194
|
+
pythEndpoints: string[];
|
|
2195
|
+
readonly scallopSuiKit: ScallopSuiKit;
|
|
2196
|
+
readonly constants: ScallopConstants;
|
|
2197
|
+
constructor(params?: ScallopUtilsParams);
|
|
2198
|
+
get walletAddress(): string;
|
|
2199
|
+
get suiKit(): _scallop_io_sui_kit.SuiKit;
|
|
2200
|
+
get queryClient(): _tanstack_query_core.QueryClient;
|
|
2201
|
+
get address(): ScallopConstants;
|
|
2202
|
+
isSuiBridgeAsset(coinName: any): boolean;
|
|
2203
|
+
isWormholeAsset(coinName: any): boolean;
|
|
2204
|
+
isMarketCoin(coinName: string): boolean;
|
|
2205
|
+
init({ force }?: {
|
|
2206
|
+
force?: boolean;
|
|
2207
|
+
}): Promise<void>;
|
|
2208
|
+
/**
|
|
2209
|
+
* Convert market coin name to coin name.
|
|
2210
|
+
*
|
|
2211
|
+
* @param marketCoinName - Specific support market coin name.
|
|
2212
|
+
* @return Coin Name.
|
|
2213
|
+
*/
|
|
2214
|
+
parseCoinName<T extends string>(marketCoinName: string): T;
|
|
2215
|
+
/**
|
|
2216
|
+
* Convert coin name to symbol.
|
|
2217
|
+
*
|
|
2218
|
+
* @param coinName - Specific support coin name.
|
|
2219
|
+
* @return Symbol string.
|
|
2220
|
+
*/
|
|
2221
|
+
parseSymbol(coinName: string): string;
|
|
2222
|
+
/**
|
|
2223
|
+
* Convert coin name to coin type.
|
|
2224
|
+
*
|
|
2225
|
+
* @description
|
|
2226
|
+
* The Coin type of wormhole is fixed `coin:Coin`. Here using package id
|
|
2227
|
+
* to determine and return the type.
|
|
2228
|
+
*
|
|
2229
|
+
* @param coinPackageId - Package id of coin.
|
|
2230
|
+
* @param coinName - Specific support coin name.
|
|
2231
|
+
* @return Coin type.
|
|
2232
|
+
*/
|
|
2233
|
+
parseCoinType(coinName: string, useOldMarketCoin?: boolean): string;
|
|
2234
|
+
/**
|
|
2235
|
+
* Convert coin name to sCoin name.
|
|
2236
|
+
*
|
|
2237
|
+
* @param coinName - Specific support coin name.
|
|
2238
|
+
* @return sCoin name.
|
|
2239
|
+
*/
|
|
2240
|
+
parseSCoinName<T extends string>(coinName: string): T | undefined;
|
|
2241
|
+
/**
|
|
2242
|
+
* Convert sCoin name to market coin name.
|
|
2243
|
+
* This function will parse new sCoin name `scallop_...` to its old market coin name which is shorter
|
|
2244
|
+
* e.g: `scallop_sui -> ssui
|
|
2245
|
+
* if no `scallop_...` is encountered, return coinName
|
|
2246
|
+
* @return sCoin name
|
|
2247
|
+
*/
|
|
2248
|
+
parseSCoinTypeNameToMarketCoinName(coinName: string): string;
|
|
2249
|
+
/**
|
|
2250
|
+
* Convert sCoin name into sCoin type
|
|
2251
|
+
* @param sCoinName
|
|
2252
|
+
* @returns sCoin type
|
|
2253
|
+
*/
|
|
2254
|
+
parseSCoinType(sCoinName: string): string;
|
|
2255
|
+
/**
|
|
2256
|
+
* Convert sCoinType into sCoin name
|
|
2257
|
+
* @param sCoinType
|
|
2258
|
+
* @returns sCoin name
|
|
2259
|
+
*/
|
|
2260
|
+
parseSCoinNameFromType(sCoinType: string): string | undefined;
|
|
2261
|
+
/**
|
|
2262
|
+
* Convert sCoin name into its underlying coin type
|
|
2263
|
+
* @param sCoinName
|
|
2264
|
+
* @returns coin type
|
|
2265
|
+
*/
|
|
2266
|
+
parseUnderlyingSCoinType(sCoinName: string): string;
|
|
2267
|
+
/**
|
|
2268
|
+
* Get sCoin treasury id from sCoin name
|
|
2269
|
+
* @param sCoinName
|
|
2270
|
+
* @returns sCoin treasury id
|
|
2271
|
+
*/
|
|
2272
|
+
getSCoinTreasury(sCoinName: string): any;
|
|
2273
|
+
/**
|
|
2274
|
+
* Convert coin name to market coin type.
|
|
2275
|
+
*
|
|
2276
|
+
* @param coinPackageId - Package id of coin.
|
|
2277
|
+
* @param coinName - Specific support coin name.
|
|
2278
|
+
* @return Market coin type.
|
|
2279
|
+
*/
|
|
2280
|
+
parseMarketCoinType(coinName: string): string;
|
|
2281
|
+
/**
|
|
2282
|
+
* Convert coin name to market coin name.
|
|
2283
|
+
*
|
|
2284
|
+
* @param coinName - Specific support coin name.
|
|
2285
|
+
* @return Market coin name.
|
|
2286
|
+
*/
|
|
2287
|
+
parseMarketCoinName<T extends string>(coinName: string): T;
|
|
2288
|
+
/**
|
|
2289
|
+
* Get reward type of spool.
|
|
2290
|
+
*
|
|
2291
|
+
* @param stakeMarketCoinName - Support stake market coin.
|
|
2292
|
+
* @return Spool reward coin name.
|
|
2293
|
+
*/
|
|
2294
|
+
getSpoolRewardCoinName: () => string;
|
|
2295
|
+
/**
|
|
2296
|
+
* Get coin decimal.
|
|
2297
|
+
*
|
|
2298
|
+
* return Coin decimal.
|
|
2299
|
+
*/
|
|
2300
|
+
getCoinDecimal(coinName: string): number;
|
|
2301
|
+
/**
|
|
2302
|
+
* Get coin wrapped type.
|
|
2303
|
+
*
|
|
2304
|
+
* return Coin wrapped type.
|
|
2305
|
+
*/
|
|
2306
|
+
getCoinWrappedType(assetCoinName: string): CoinWrappedType;
|
|
2307
|
+
/**
|
|
2308
|
+
* Convert coin type to coin name.
|
|
2309
|
+
*
|
|
2310
|
+
* @description
|
|
2311
|
+
* The coin name cannot be obtained directly from the wormhole type. Here
|
|
2312
|
+
* the package id is used to determine and return a specific name.
|
|
2313
|
+
*
|
|
2314
|
+
* @param coinType - Specific support coin type.
|
|
2315
|
+
* @return Coin Name.
|
|
2316
|
+
*/
|
|
2317
|
+
parseCoinNameFromType(coinType: string): string;
|
|
2318
|
+
/**
|
|
2319
|
+
* Select coin id that add up to the given amount as transaction arguments.
|
|
2320
|
+
*
|
|
2321
|
+
* @param ownerAddress - The address of the owner.
|
|
2322
|
+
* @param amount - The amount that including coin decimals.
|
|
2323
|
+
* @param coinType - The coin type, default is 0x2::SUI::SUI.
|
|
2324
|
+
* @return The selected transaction coin arguments.
|
|
2325
|
+
*/
|
|
2326
|
+
selectCoins(amount: number, coinType?: string, ownerAddress?: string): Promise<{
|
|
2327
|
+
objectId: string;
|
|
2328
|
+
digest: string;
|
|
2329
|
+
version: string;
|
|
2330
|
+
balance: string;
|
|
2331
|
+
}[]>;
|
|
2332
|
+
/**
|
|
2333
|
+
* Merge coins with type `coinType` to dest
|
|
2334
|
+
* @param txBlock
|
|
2335
|
+
* @param dest
|
|
2336
|
+
* @param coinType
|
|
2337
|
+
* @param sender
|
|
2338
|
+
*/
|
|
2339
|
+
mergeSimilarCoins(txBlock: SuiTxBlock | Transaction, dest: SuiObjectArg, coinType: string, sender?: string): Promise<void>;
|
|
2340
|
+
/**
|
|
2341
|
+
* Get all asset coin names in the obligation record by obligation id.
|
|
2342
|
+
*
|
|
2343
|
+
* @description
|
|
2344
|
+
* This can often be used to determine which assets in an obligation require
|
|
2345
|
+
* price updates before interacting with specific instructions of the Scallop contract.
|
|
2346
|
+
*
|
|
2347
|
+
* @param obligationId - The obligation id.
|
|
2348
|
+
* @return Asset coin Names.
|
|
2349
|
+
*/
|
|
2350
|
+
getObligationCoinNames(obligationId: SuiObjectArg): Promise<string[] | undefined>;
|
|
2351
|
+
private parseDataFromPythPriceFeed;
|
|
2352
|
+
getPythPrice(assetCoinName: string, priceFeedObject?: SuiObjectData$1 | null): Promise<number>;
|
|
2353
|
+
getPythPrices(assetCoinNames: string[]): Promise<Record<string, number>>;
|
|
2354
|
+
/**
|
|
2355
|
+
* Get asset coin price.
|
|
2356
|
+
*
|
|
2357
|
+
* @description
|
|
2358
|
+
* The strategy for obtaining the price is to get it through API first,
|
|
2359
|
+
* and then on-chain data if API cannot be retrieved.
|
|
2360
|
+
* Currently, we only support obtaining from pyth protocol, other
|
|
2361
|
+
* oracles will be supported in the future.
|
|
2362
|
+
*
|
|
2363
|
+
* @param assetCoinNames - Specific an array of support asset coin name.
|
|
2364
|
+
* @return Asset coin price.
|
|
2365
|
+
*/
|
|
2366
|
+
getCoinPrices(coinNames?: string[]): Promise<OptionalKeys<Record<string, number>>>;
|
|
2367
|
+
/**
|
|
2368
|
+
* Convert apr to apy.
|
|
2369
|
+
*
|
|
2370
|
+
* @param apr The annual percentage rate (APR).
|
|
2371
|
+
* @param compoundFrequency How often interest is compounded per year. Default is daily (365 times a year).
|
|
2372
|
+
* @return The equivalent annual percentage yield (APY) for the given APR and compounding frequency.
|
|
2373
|
+
*/
|
|
2374
|
+
parseAprToApy(apr: number, compoundFrequency?: number): number;
|
|
2375
|
+
/**
|
|
2376
|
+
* Convert apy to apr.
|
|
2377
|
+
*
|
|
2378
|
+
* @param apr The equivalent annual percentage yield (APY).
|
|
2379
|
+
* @param compoundFrequency How often interest is compounded per year. Default is daily (365 times a year).
|
|
2380
|
+
* @return The equivalent annual percentage rate (APR) for the given APY and compounding frequency.
|
|
2381
|
+
*/
|
|
2382
|
+
parseApyToApr(apy: number, compoundFrequency?: number): number;
|
|
2383
|
+
/**
|
|
2384
|
+
* Give extend lock period to get unlock at in seconds timestamp.
|
|
2385
|
+
*
|
|
2386
|
+
* @description
|
|
2387
|
+
* - When the user without remaining unlock period, If the extended unlock day is not specified,
|
|
2388
|
+
* the unlock period will be increased by one day by default.
|
|
2389
|
+
* - When the given extended day plus the user's remaining unlock period exceeds the maximum
|
|
2390
|
+
* unlock period, the maximum unlock period is used as unlock period.
|
|
2391
|
+
*
|
|
2392
|
+
* @param extendLockPeriodInDay The extend lock period in day.
|
|
2393
|
+
* @param unlockAtInSecondTimestamp The unlock timestamp from veSca object.
|
|
2394
|
+
* @return New unlock at in seconds timestamp.
|
|
2395
|
+
*/
|
|
2396
|
+
getUnlockAt(extendLockPeriodInDay?: number, unlockAtInMillisTimestamp?: number): number;
|
|
2397
|
+
/**
|
|
2398
|
+
* Get detailed contract address and price id information for supported pool in Scallop
|
|
2399
|
+
* @returns Supported pool informations
|
|
2400
|
+
*/
|
|
2401
|
+
getSupportedPoolAddresses(): PoolAddress[];
|
|
2402
|
+
}
|
|
3241
2403
|
|
|
3242
|
-
export {
|
|
2404
|
+
export { type BorrowIncentivePool as $, type GenerateVeScaQuickMethod as A, type BaseScallopTxBlock as B, type CoreIds as C, type LoyaltyProgramQuickMethods as D, type SuiTxBlockWithLoyaltyProgramNormalMethods as E, type LoyaltyProgramTxBlock as F, type GenerateCoreNormalMethod as G, type GenerateLoyaltyProgramNormalMethod as H, type GenerateLoyaltyProgramQuickMethod as I, type sCoinPkgIds as J, type sCoinNormalMethods as K, type LoyaltyProgramNormalMethods as L, type sCoinQuickMethods as M, type NestedResult as N, type SuiTxBlockWithSCoinNormalMethods as O, type SCoinTxBlock as P, type QuickMethodReturnType as Q, type GenerateSCoinNormalMethod as R, type SuiTxBlockWithSCoin as S, type GenerateSCoinQuickMethod as T, type PoolAddress as U, type VeScaNormalMethods as V, type Whitelist as W, type CoinWrappedType as X, type BorrowIncentiveAccountKey as Y, type BorrowIncentivePools as Z, type BorrowIncentivePoolPoints as _, type SuiTxBlockWithSpool as a, type VeScaTreasuryFields as a$, type OriginBorrowIncentivePoolPointData as a0, type OriginBorrowIncentivePoolData as a1, type ParsedBorrowIncentivePoolPointData as a2, type ParsedBorrowIncentivePoolData as a3, type CalculatedBorrowIncentivePoolPointData as a4, type BorrowIncentiveAccounts as a5, type OriginBorrowIncentiveAccountPoolData as a6, type OriginBorrowIncentiveAccountData as a7, type ParsedBorrowIncentiveAccountPoolData as a8, type ParsedBorrowIncentiveAccountData as a9, type VeScaLoyaltyProgramInfo as aA, type Lendings as aB, type ObligationAccounts as aC, type Lending as aD, type ObligationAccount as aE, type ObligationCollateral as aF, type ObligationDebt as aG, type ObligationBorrowIncentiveReward as aH, type ObligationBorrowIncentive as aI, type TotalValueLocked as aJ, type Spools as aK, type Spool as aL, type OriginSpoolData as aM, type SpoolData as aN, type ParsedSpoolData as aO, type CalculatedSpoolData as aP, type SpoolRewardPool as aQ, type OriginSpoolRewardPoolData as aR, type ParsedSpoolRewardPoolData as aS, type CalculatedSpoolRewardPoolData as aT, type StakePools as aU, type StakeRewardPools as aV, type StakeAccounts as aW, type StakeAccount as aX, type StakePool as aY, type StakeRewardPool as aZ, type Vesca as a_, type BorrowIncentivePoolsQueryInterface as aa, type BorrowIncentiveAccountsQueryInterface as ab, type MarketPools as ac, type MarketCollaterals as ad, type CoinAmounts as ae, type MarketCoinAmounts as af, type SCoinAmounts as ag, type BalanceSheet as ah, type BorrowDynamic as ai, type BorrowFee as aj, type InterestModel as ak, type RiskModel as al, type CollateralStat as am, type MarketPool as an, type MarketCollateral as ao, type OriginMarketPoolData as ap, type ParsedMarketPoolData as aq, type CalculatedMarketPoolData as ar, type OriginMarketCollateralData as as, type ParsedMarketCollateralData as at, type CalculatedMarketCollateralData as au, type Market as av, type Obligation as aw, type MarketQueryInterface as ax, type ObligationQueryInterface as ay, type LoyaltyProgramInfo as az, type ScallopTxBlock as b, type VeScaTreasuryInfo as b0, type OptionalKeys as b1, type CoinPrices as b2, type ScallopClientInterface as b3, ScallopBuilder as b4, ScallopQuery as b5, ScallopUtils as b6, ScallopConstants as b7, ScallopSuiKit as b8, type ScallopBuilderParams as b9, ScallopIndexer as ba, ScallopAddress as bb, ScallopAxios as bc, ScallopQueryClient as bd, type SelectCoinReturnType as c, type CoreNormalMethods as d, type CoreQuickMethods as e, type SuiTxBlockWithCoreNormalMethods as f, type CoreTxBlock as g, type GenerateCoreQuickMethod as h, type SpoolIds as i, type SpoolNormalMethods as j, type SpoolQuickMethods as k, type SuiTxBlockWithSpoolNormalMethods as l, type SpoolTxBlock as m, type GenerateSpoolNormalMethod as n, type GenerateSpoolQuickMethod as o, type BorrowIncentiveIds as p, type BorrowIncentiveNormalMethods as q, type BorrowIncentiveQuickMethods as r, type SuiTxBlockWithBorrowIncentiveNormalMethods as s, type BorrowIncentiveTxBlock as t, type GenerateBorrowIncentiveNormalMethod as u, type GenerateBorrowIncentiveQuickMethod as v, type VeScaQuickMethods as w, type SuiTxBlockWithVeScaNormalMethods as x, type VeScaTxBlock as y, type GenerateVeScaNormalMethod as z };
|