@scallop-io/sui-scallop-sdk 2.3.0-lst-x-oracle-alpha.1 → 2.3.0-lst-x-oracle-alpha.2

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.
@@ -1,395 +1,404 @@
1
1
  import * as _tanstack_query_core from '@tanstack/query-core';
2
2
  import { QueryClient, QueryClientConfig, QueryKey } from '@tanstack/query-core';
3
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';
4
+ import { NetworkType, SuiKit, Transaction, SuiTxBlock, DerivePathParams, SuiObjectArg, SuiKitParams, SuiTxArg, SuiAddressArg, TransactionResult as TransactionResult$1, SuiVecTxArg, SuiAmountsArg } from '@scallop-io/sui-kit';
5
+ import { A as AddressesInterface, l as AddressStringPath, e as xOracleRules } from './address-CW2IpaLn.js';
6
6
  import { AxiosInstance, AxiosResponse, AxiosRequestConfig } from 'axios';
7
7
  import * as _mysten_sui_dist_cjs_client from '@mysten/sui/dist/cjs/client';
8
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';
9
+ import { SuiObjectRef, SuiObjectDataOptions, SuiObjectResponse, SuiObjectData, GetOwnedObjectsParams, GetDynamicFieldsParams, DynamicFieldPage, GetDynamicFieldObjectParams, CoinBalance, GetBalanceParams, DevInspectResults, SuiTransactionBlockResponse } from '@mysten/sui/client';
10
10
  import { Argument, TransactionResult, Transaction as Transaction$1, TransactionObjectArgument } from '@mysten/sui/transactions';
11
11
 
12
- type CoreIds = {
13
- protocolPkg: string;
14
- market: string;
15
- version: string;
16
- coinDecimalsRegistry: string;
17
- xOracle: string;
18
- };
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;
12
+ type PoolAddress = {
13
+ coinName: string;
14
+ symbol: string;
15
+ coinType: string;
16
+ coinMetadataId: string;
17
+ decimals: number;
18
+ isIsolated: boolean;
19
+ pythFeed?: string;
20
+ pythFeedObjectId?: string;
21
+ lendingPoolAddress?: string;
22
+ borrowDynamic?: string;
23
+ interestModel?: string;
24
+ borrowFeeKey?: string;
25
+ flashloanFeeObject?: string;
26
+ coinGeckoId?: string;
27
+ collateralPoolAddress?: string;
28
+ riskModel?: string;
29
+ supplyLimitKey?: string;
30
+ borrowLimitKey?: string;
31
+ sCoinType?: string;
32
+ sCoinName?: string;
33
+ sCoinSymbol?: string;
34
+ sCoinMetadataId?: string;
35
+ sCoinTreasury?: string;
36
+ isolatedAssetKey: string;
37
+ spool?: string;
38
+ spoolReward?: string;
39
+ spoolName?: string;
41
40
  };
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>;
41
+ type Whitelist = {
42
+ lending: Set<string>;
43
+ borrowing: Set<string>;
44
+ collateral: Set<string>;
45
+ packages: Set<string>;
46
+ spool: Set<string>;
47
+ scoin: Set<string>;
48
+ suiBridge: Set<string>;
49
+ wormhole: Set<string>;
50
+ oracles: Set<string>;
51
+ borrowIncentiveRewards: Set<string>;
52
+ rewardsAsPoint: Set<string>;
53
+ pythEndpoints: Set<string>;
54
+ deprecated: Set<string>;
55
+ emerging: Set<string>;
51
56
  };
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;
57
+ type CoinWrappedType = {
58
+ from: string;
59
+ type: string;
60
+ } | undefined;
62
61
 
63
- type SpoolIds = {
64
- spoolPkg: string;
65
- };
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[]>;
62
+ type ScallopQueryClientParams = {
63
+ queryClient?: QueryClient;
64
+ queryClientConfig?: QueryClientConfig;
76
65
  };
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;
66
+ declare class ScallopQueryClient {
67
+ private _queryClient;
68
+ constructor(params?: ScallopQueryClientParams);
69
+ get queryClient(): QueryClient;
70
+ set queryClient(queryClient: QueryClient);
71
+ get defaultQueryClientConfig(): {
72
+ defaultOptions: {
73
+ queries: {
74
+ staleTime: number;
75
+ gcTime: number;
76
+ };
77
+ };
78
+ };
79
+ }
87
80
 
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;
81
+ type ScallopAxiosParams = {
82
+ baseUrl?: string;
83
+ axiosInstance?: AxiosInstance;
84
+ axiosTimeout?: number;
85
+ } & ScallopQueryClientParams;
86
+ declare class ScallopAxios extends ScallopQueryClient {
87
+ readonly axiosInstance: AxiosInstance;
88
+ constructor(params?: ScallopAxiosParams);
89
+ post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
90
+ post<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
91
+ get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
92
+ get<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, config?: AxiosRequestConfig<D>): Promise<R>;
93
+ put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
94
+ put<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
95
+ delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
96
+ delete<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, config?: AxiosRequestConfig<D>): Promise<R>;
97
+ }
119
98
 
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 = {
99
+ type ScallopAddressParams = {
100
+ addressId?: string;
101
+ urls?: {
102
+ addresses?: string[];
103
+ };
104
+ auth?: string;
105
+ network?: NetworkType;
106
+ forceAddressesInterface?: Partial<Record<NetworkType, AddressesInterface>>;
107
+ defaultValues?: {
108
+ addresses?: Partial<Record<NetworkType, AddressesInterface>>;
109
+ };
110
+ } & ScallopAxiosParams;
111
+ declare class ScallopAddress {
112
+ readonly params: ScallopAddressParams;
113
+ private currentAddresses?;
114
+ private addressId?;
115
+ private network;
116
+ private auth;
117
+ readonly scallopAxios: ScallopAxios;
118
+ private readonly addressMap;
119
+ private readonly defaultParamValues;
120
+ constructor(params?: ScallopAddressParams);
121
+ private initializeForcedAddresses;
122
+ get axiosClient(): ScallopAxios;
123
+ get queryClient(): _tanstack_query_core.QueryClient;
124
+ get defaultValues(): {
125
+ addresses?: Partial<Record<NetworkType, AddressesInterface>>;
126
+ } | undefined;
127
+ getId(): string | undefined;
132
128
  /**
133
- * Quick methods to automate
134
- * lock initial SCA, extend lock period, lock more SCA, renew expired VeSCA, and redeem SCA
129
+ * Get the address at the provided path.
135
130
  *
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
131
+ * @param path - The path of the address to get.
132
+ * @return The address at the provided path.
133
+ */
134
+ get(path: AddressStringPath): any;
135
+ /**
136
+ * Sets the address for the specified path, it does not interact with the API.
139
137
  *
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
138
+ * @param path - The path of the address to set.
139
+ * @param address - The address be setted to the tartget path.
140
+ * @return The addresses.
147
141
  */
148
- lockScaQuick(params: {
149
- amountOrCoin?: SuiObjectArg | number;
150
- lockPeriodInDays?: number;
151
- autoCheck?: boolean;
152
- veScaKey?: SuiObjectData | string;
153
- }): Promise<void>;
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;
194
-
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 = {
142
+ set(path: AddressStringPath, address: string): AddressesInterface | undefined;
230
143
  /**
231
- * Lock marketCoin and return sCoin
232
- * @param marketCoinName
233
- * @param marketCoin
234
- * @returns
144
+ * Synchronize the specified network addresses from the addresses map to the
145
+ * current addresses and change the default network to specified network.
146
+ *
147
+ * @param network - Specifies which network's addresses you want to get.
148
+ * @return Current addresses.
235
149
  */
236
- mintSCoin: (marketCoinName: string, marketCoin: SuiObjectArg) => TransactionResult$1;
150
+ switchCurrentAddresses(network: NetworkType): AddressesInterface | undefined;
237
151
  /**
238
- * Burn sCoin and return marketCoin
239
- * @param sCoinName
240
- * @param sCoin
241
- * @returns
152
+ * Get the addresses, If `network` is not provided, returns the current
153
+ * addresses or the default network addresses in the addresses map.
154
+ *
155
+ * @param network - Specifies which network's addresses you want to get.
242
156
  */
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;
259
-
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;
269
- };
270
-
271
- type PoolAddress = {
272
- coinName: string;
273
- symbol: string;
274
- coinType: string;
275
- coinMetadataId: string;
276
- decimals: number;
277
- isIsolated: boolean;
278
- pythFeed?: string;
279
- pythFeedObjectId?: string;
280
- lendingPoolAddress?: string;
281
- borrowDynamic?: string;
282
- interestModel?: string;
283
- borrowFeeKey?: string;
284
- flashloanFeeObject?: string;
285
- coinGeckoId?: string;
286
- collateralPoolAddress?: string;
287
- riskModel?: string;
288
- supplyLimitKey?: string;
289
- borrowLimitKey?: string;
290
- sCoinType?: string;
291
- sCoinName?: string;
292
- sCoinSymbol?: string;
293
- sCoinMetadataId?: string;
294
- sCoinTreasury?: string;
295
- isolatedAssetKey: string;
296
- spool?: string;
297
- spoolReward?: string;
298
- spoolName?: string;
299
- };
300
- type Whitelist = {
301
- lending: Set<string>;
302
- borrowing: Set<string>;
303
- collateral: Set<string>;
304
- packages: Set<string>;
305
- spool: Set<string>;
306
- scoin: Set<string>;
307
- suiBridge: Set<string>;
308
- wormhole: Set<string>;
309
- oracles: Set<string>;
310
- borrowIncentiveRewards: Set<string>;
311
- rewardsAsPoint: Set<string>;
312
- pythEndpoints: Set<string>;
313
- deprecated: Set<string>;
314
- emerging: Set<string>;
315
- };
316
- type CoinWrappedType = {
317
- from: string;
318
- type: string;
319
- } | undefined;
320
-
321
- interface BorrowIncentiveAccountKey {
322
- id: string;
323
- onwerId: string;
324
- }
325
- type OptionalKeys$4<T> = {
326
- [K in keyof T]?: T[K];
327
- };
328
- type BorrowIncentivePools = OptionalKeys$4<Record<string, BorrowIncentivePool>>;
329
- type BorrowIncentivePoolPoints = {
330
- symbol: string;
331
- coinName: string;
332
- coinType: string;
333
- coinDecimal: number;
334
- coinPrice: number;
335
- } & Required<Pick<ParsedBorrowIncentivePoolPointData, 'points' | 'distributedPoint' | 'weightedAmount'>> & CalculatedBorrowIncentivePoolPointData;
336
- type BorrowIncentivePool = {
337
- coinName: string;
338
- symbol: string;
339
- coinType: string;
340
- coinDecimal: number;
341
- coinPrice: number;
342
- stakedAmount: number;
343
- stakedCoin: number;
344
- stakedValue: number;
345
- points: OptionalKeys$4<Record<string, BorrowIncentivePoolPoints>>;
346
- };
347
- type OriginBorrowIncentivePoolPointData = {
348
- point_type: {
349
- name: string;
350
- };
351
- distributed_point_per_period: string;
352
- point_distribution_time: string;
353
- distributed_point: string;
354
- points: string;
355
- index: string;
356
- base_weight: string;
357
- weighted_amount: string;
358
- last_update: string;
359
- created_at: string;
360
- };
361
- type OriginBorrowIncentivePoolData = {
362
- pool_type: {
363
- name: string;
157
+ getAddresses(network?: NetworkType): AddressesInterface | undefined;
158
+ /**
159
+ * Set the addresses into addresses map. If the specified network is the same
160
+ * as the current network, the current addresses will be updated at the same time.
161
+ *
162
+ * @param addresses - The addresses be setted to the tartget network.
163
+ * @param network - Specifies which network's addresses you want to set.
164
+ * @return The addresses.
165
+ */
166
+ setAddresses(addresses: AddressesInterface, network?: NetworkType): void;
167
+ /**
168
+ * Get all addresses.
169
+ *
170
+ * @return All addresses.
171
+ */
172
+ getAllAddresses(): {
173
+ [k: string]: AddressesInterface;
364
174
  };
365
- points: OriginBorrowIncentivePoolPointData[];
366
- min_stakes: string;
367
- max_stakes: string;
368
- stakes: string;
369
- created_at: string;
370
- };
371
- type ParsedBorrowIncentivePoolPointData = {
372
- pointType: string;
373
- distributedPointPerPeriod: number;
374
- period: number;
375
- distributedPoint: number;
376
- points: number;
377
- index: number;
378
- baseWeight: number;
379
- weightedAmount: number;
380
- lastUpdate: number;
381
- createdAt: number;
382
- };
383
- type ParsedBorrowIncentivePoolData = {
384
- poolType: string;
385
- poolPoints: OptionalKeys$4<Record<string, ParsedBorrowIncentivePoolPointData>>;
386
- minStakes: number;
387
- maxStakes: number;
388
- staked: number;
389
- };
390
- type CalculatedBorrowIncentivePoolPointData = {
391
- baseWeight: number;
392
- weightedStakedAmount: number;
175
+ /**
176
+ * Create a new addresses through the API and synchronize it back to the
177
+ * instance.
178
+ *
179
+ * @description
180
+ * If the `network` is not specified, the mainnet is used by default.
181
+ * If no `addresses` from instance or parameter is provided, an addresses with
182
+ * all empty strings is created by default.
183
+ *
184
+ * This function only allows for one addresses to be input into a specific network
185
+ * at a time, and does not provide an addresses map for setting addresses
186
+ * across all networks at once.
187
+ *
188
+ * @param params.addresses - The addresses be setted to the tartget network.
189
+ * @param params.network - Specifies which network's addresses you want to set.
190
+ * @param params.auth - The authentication API key.
191
+ * @param params.memo - Add memo to the addresses created in the API.
192
+ * @return All addresses.
193
+ */
194
+ create(params?: {
195
+ addresses?: AddressesInterface | undefined;
196
+ network?: NetworkType | undefined;
197
+ auth?: string | undefined;
198
+ memo?: string | undefined;
199
+ }): Promise<{
200
+ [k: string]: AddressesInterface;
201
+ }>;
202
+ protected readApi<T>({ url, queryKey, config, }: {
203
+ url: string;
204
+ queryKey: QueryKey;
205
+ config?: AxiosRequestConfig;
206
+ }): Promise<T>;
207
+ /**
208
+ * Read and synchronizes all addresses from the API into instance.
209
+ *
210
+ * @param id - The id of the addresses to get.
211
+ * @return All addresses.
212
+ */
213
+ read(id?: string): Promise<{
214
+ [k: string]: AddressesInterface;
215
+ }>;
216
+ /**
217
+ * Update the addresses through the API and synchronize it back to the
218
+ * instance.
219
+ *
220
+ * @description
221
+ * If the `network` is not specified, the mainnet is used by default.
222
+ * If no `addresses` from instance or parameter is provided, an addresses with
223
+ * all empty strings is created by default.
224
+ *
225
+ * This function only allows for one addresses to be input into a specific network
226
+ * at a time, and does not provide an addresses map for setting addresses
227
+ * across all networks at once.
228
+ *
229
+ * @param params.id - The id of the addresses to update.
230
+ * @param params.addresses - The addresses be setted to the tartget network.
231
+ * @param params.network - Specifies which network's addresses you want to set.
232
+ * @param params.auth - The authentication api key.
233
+ * @param params.memo - Add memo to the addresses created in the API.
234
+ * @return All addresses.
235
+ */
236
+ update(params?: {
237
+ id?: string;
238
+ addresses?: AddressesInterface | undefined;
239
+ network?: NetworkType | undefined;
240
+ auth?: string | undefined;
241
+ memo?: string | undefined;
242
+ }): Promise<{
243
+ [k: string]: AddressesInterface;
244
+ }>;
245
+ /**
246
+ * Deletes all addresses of a specified id through the API and clear all
247
+ * addresses in the instance.
248
+ *
249
+ * @param id - The id of the addresses to delete.
250
+ * @param auth - The authentication API key.
251
+ */
252
+ delete(id?: string, auth?: string): Promise<void>;
253
+ }
254
+
255
+ type CoinName = string;
256
+ type CoinType = string;
257
+ type SCoinType = string;
258
+ type OldMarketCoinType = string;
259
+ /**
260
+ * @description `scallop_sui`, `scallop_usdt`, etc (parsed directly from coin type, ex: `0x...::scallop_sui::SCALLOP_SUI`)
261
+ */
262
+ type SCoinRawName = string;
263
+ /**
264
+ * @description `ssui`, `susdc`, etc..
265
+ */
266
+ type SCoinName = string;
267
+ type ScallopConstantsParams = {
268
+ urls?: {
269
+ poolAddresses?: string[];
270
+ whitelist?: string[];
271
+ };
272
+ forcePoolAddressInterface?: Record<string, PoolAddress>;
273
+ forceWhitelistInterface?: Whitelist | Record<string, any>;
274
+ defaultValues?: {
275
+ poolAddresses?: Record<string, PoolAddress>;
276
+ whitelist?: Whitelist | Record<string, any>;
277
+ };
278
+ } & ScallopAddressParams;
279
+ declare class ScallopConstants extends ScallopAddress {
280
+ readonly params: ScallopConstantsParams;
281
+ private _poolAddresses;
282
+ private _whitelist;
283
+ /**
284
+ * @description coin names to coin decimal map
285
+ */
286
+ coinDecimals: Record<CoinName, number | undefined>;
287
+ coinNameToOldMarketCoinTypeMap: Record<CoinName, OldMarketCoinType | undefined>;
288
+ scoinRawNameToSCoinNameMap: Record<SCoinRawName, SCoinName | undefined>;
289
+ scoinTypeToSCoinNameMap: Record<SCoinType, SCoinName | undefined>;
290
+ wormholeCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
291
+ voloCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
292
+ suiBridgeCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
293
+ /**
294
+ * @description coin names to coin types map
295
+ */
296
+ coinTypes: Record<CoinName, CoinType | undefined>;
297
+ /**
298
+ * @description scoin names to scoin types map
299
+ */
300
+ sCoinTypes: Record<SCoinName, SCoinType | undefined>;
301
+ coinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
302
+ /**
303
+ * @description Supported borrow incentive reward coin names
304
+ */
305
+ supportedBorrowIncentiveRewards: Set<CoinName>;
306
+ constructor(params?: ScallopConstantsParams);
307
+ get protocolObjectId(): string;
308
+ get isInitialized(): boolean;
309
+ get whitelist(): Whitelist;
310
+ get poolAddresses(): Record<string, PoolAddress | undefined>;
311
+ get defaultValues(): ({
312
+ poolAddresses?: Record<string, PoolAddress>;
313
+ whitelist?: Whitelist | Record<string, any>;
314
+ } & {
315
+ addresses?: Partial<Record<NetworkType, AddressesInterface>>;
316
+ }) | undefined;
317
+ private isAddressInitialized;
318
+ parseToOldMarketCoin(coinType: string): string;
319
+ init({ networkType, force, addressId, constantsParams, }?: {
320
+ networkType?: NetworkType;
321
+ force?: boolean;
322
+ addressId?: string;
323
+ constantsParams?: Partial<ScallopConstantsParams>;
324
+ }): Promise<void>;
325
+ private initConstants;
326
+ readWhiteList(): Promise<Whitelist>;
327
+ readPoolAddresses(): Promise<Record<string, PoolAddress>>;
328
+ }
329
+
330
+ interface BorrowIncentiveAccountKey {
331
+ id: string;
332
+ onwerId: string;
333
+ }
334
+ type OptionalKeys$4<T> = {
335
+ [K in keyof T]?: T[K];
336
+ };
337
+ type BorrowIncentivePools = OptionalKeys$4<Record<string, BorrowIncentivePool>>;
338
+ type BorrowIncentivePoolPoints = {
339
+ symbol: string;
340
+ coinName: string;
341
+ coinType: string;
342
+ coinDecimal: number;
343
+ coinPrice: number;
344
+ } & Required<Pick<ParsedBorrowIncentivePoolPointData, 'points' | 'distributedPoint' | 'weightedAmount'>> & CalculatedBorrowIncentivePoolPointData;
345
+ type BorrowIncentivePool = {
346
+ coinName: string;
347
+ symbol: string;
348
+ coinType: string;
349
+ coinDecimal: number;
350
+ coinPrice: number;
351
+ stakedAmount: number;
352
+ stakedCoin: number;
353
+ stakedValue: number;
354
+ points: OptionalKeys$4<Record<string, BorrowIncentivePoolPoints>>;
355
+ };
356
+ type OriginBorrowIncentivePoolPointData = {
357
+ point_type: {
358
+ name: string;
359
+ };
360
+ distributed_point_per_period: string;
361
+ point_distribution_time: string;
362
+ distributed_point: string;
363
+ points: string;
364
+ index: string;
365
+ base_weight: string;
366
+ weighted_amount: string;
367
+ last_update: string;
368
+ created_at: string;
369
+ };
370
+ type OriginBorrowIncentivePoolData = {
371
+ pool_type: {
372
+ name: string;
373
+ };
374
+ points: OriginBorrowIncentivePoolPointData[];
375
+ min_stakes: string;
376
+ max_stakes: string;
377
+ stakes: string;
378
+ created_at: string;
379
+ };
380
+ type ParsedBorrowIncentivePoolPointData = {
381
+ pointType: string;
382
+ distributedPointPerPeriod: number;
383
+ period: number;
384
+ distributedPoint: number;
385
+ points: number;
386
+ index: number;
387
+ baseWeight: number;
388
+ weightedAmount: number;
389
+ lastUpdate: number;
390
+ createdAt: number;
391
+ };
392
+ type ParsedBorrowIncentivePoolData = {
393
+ poolType: string;
394
+ poolPoints: OptionalKeys$4<Record<string, ParsedBorrowIncentivePoolPointData>>;
395
+ minStakes: number;
396
+ maxStakes: number;
397
+ staked: number;
398
+ };
399
+ type CalculatedBorrowIncentivePoolPointData = {
400
+ baseWeight: number;
401
+ weightedStakedAmount: number;
393
402
  weightedStakedCoin: number;
394
403
  weightedStakedValue: number;
395
404
  distributedPointPerSec: number;
@@ -726,7 +735,7 @@ type Market = {
726
735
  collaterals: MarketCollaterals;
727
736
  data?: MarketQueryInterface;
728
737
  };
729
- type Obligation = {
738
+ type Obligation$1 = {
730
739
  id: string;
731
740
  keyId: string;
732
741
  locked: boolean;
@@ -1063,331 +1072,58 @@ type ObligationBorrowIncentiveReward = {
1063
1072
  coinType: string;
1064
1073
  symbol: string;
1065
1074
  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;
1109
- };
1110
- };
1111
- };
1112
- type VeScaTreasuryInfo = {
1113
- totalLockedSca: number;
1114
- totalVeSca: number;
1115
- averageLockingPeriod: number;
1116
- averageLockingPeriodUnit: string;
1117
- };
1118
-
1119
- type OptionalKeys<T> = {
1120
- [K in keyof T]?: T[K];
1121
- };
1122
- type CoinPrices = OptionalKeys<Record<string, number>>;
1123
-
1124
- type ScallopQueryClientParams = {
1125
- queryClient?: QueryClient;
1126
- queryClientConfig?: QueryClientConfig;
1127
- };
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
- };
1141
- }
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>;
1159
- }
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>;
1315
- }
1316
-
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
- }
1075
+ coinPrice: number;
1076
+ weightedBorrowAmount: number;
1077
+ availableClaimCoin: number;
1078
+ availableClaimAmount: number;
1079
+ boostValue: number;
1080
+ };
1081
+ type ObligationBorrowIncentive = {
1082
+ coinName: string;
1083
+ coinType: string;
1084
+ symbol: string;
1085
+ coinDecimal: number;
1086
+ coinPrice: number;
1087
+ rewards: ObligationBorrowIncentiveReward[];
1088
+ };
1089
+ type TotalValueLocked = {
1090
+ supplyLendingValue: number;
1091
+ supplyCollateralValue: number;
1092
+ supplyValue: number;
1093
+ borrowValue: number;
1094
+ totalValue: number;
1095
+ supplyValueChangeRatio?: number;
1096
+ supplyLendingValueChangeRatio?: number;
1097
+ supplyCollateralValueChangeRatio?: number;
1098
+ borrowValueChangeRatio?: number;
1099
+ totalValueChangeRatio?: number;
1100
+ };
1101
+
1102
+ type Vesca = {
1103
+ id: string;
1104
+ keyId: string;
1105
+ keyObject?: SuiObjectRef;
1106
+ object: SuiObjectRef;
1107
+ lockedScaAmount: string;
1108
+ lockedScaCoin: number;
1109
+ currentVeScaBalance: number;
1110
+ unlockAt: number;
1111
+ };
1112
+ type VeScaTreasuryFields = {
1113
+ total_ve_sca_amount: string;
1114
+ sca_balance: string;
1115
+ unlock_schedule: {
1116
+ fields: {
1117
+ locked_sca_amount: string;
1118
+ };
1119
+ };
1120
+ };
1121
+ type VeScaTreasuryInfo = {
1122
+ totalLockedSca: number;
1123
+ totalVeSca: number;
1124
+ averageLockingPeriod: number;
1125
+ averageLockingPeriodUnit: string;
1126
+ };
1391
1127
 
1392
1128
  type ScallopIndexerParams = {
1393
1129
  indexerApiUrl?: string;
@@ -1467,6 +1203,11 @@ declare class ScallopIndexer extends ScallopAxios {
1467
1203
  getCoinPrices(): Promise<Record<string, number>>;
1468
1204
  }
1469
1205
 
1206
+ type OptionalKeys<T> = {
1207
+ [K in keyof T]?: T[K];
1208
+ };
1209
+ type CoinPrices = OptionalKeys<Record<string, number>>;
1210
+
1470
1211
  type QueryInspectTxnParams = {
1471
1212
  queryTarget: string;
1472
1213
  args: SuiObjectArg[];
@@ -1617,7 +1358,7 @@ declare class ScallopQuery implements ScallopQueryInterface {
1617
1358
  * @param ownerAddress - The owner address.
1618
1359
  * @return Obligations data.
1619
1360
  */
1620
- getObligations(ownerAddress?: string): Promise<Obligation[]>;
1361
+ getObligations(ownerAddress?: string): Promise<Obligation$1[]>;
1621
1362
  /**
1622
1363
  * Query obligation data.
1623
1364
  *
@@ -1963,112 +1704,371 @@ declare class ScallopQuery implements ScallopQueryInterface {
1963
1704
  */
1964
1705
  getCoinPricesByIndexer(): Promise<Record<string, number>>;
1965
1706
  /**
1966
- * Get all coin prices, including sCoin
1967
- * @returns prices data
1707
+ * Get all coin prices, including sCoin
1708
+ * @returns prices data
1709
+ */
1710
+ getAllCoinPrices(args?: {
1711
+ marketPools?: MarketPools;
1712
+ coinPrices?: CoinPrices;
1713
+ indexer?: boolean;
1714
+ }): Promise<{
1715
+ [x: string]: number | undefined;
1716
+ }>;
1717
+ /**
1718
+ * Query all address (lending pool, collateral pool, borrow dynamics, interest models, etc.) of all pool
1719
+ * @returns
1720
+ */
1721
+ getPoolAddresses(apiAddressId?: string | undefined): Promise<OptionalKeys<Record<string, PoolAddress>>>;
1722
+ /**
1723
+ * Get user portfolio
1724
+ */
1725
+ getUserPortfolio(args?: {
1726
+ walletAddress?: string;
1727
+ indexer?: boolean;
1728
+ }): Promise<{
1729
+ totalLockedScaValue: number;
1730
+ lendings: {
1731
+ suppliedCoin: number;
1732
+ suppliedValue: number;
1733
+ stakedCoin: number;
1734
+ coinName: string;
1735
+ symbol: string;
1736
+ coinType: string;
1737
+ coinPrice: number;
1738
+ coinDecimals: number;
1739
+ supplyApr: number;
1740
+ supplyApy: number;
1741
+ incentiveApr: number;
1742
+ }[];
1743
+ borrowings: {
1744
+ obligationId: string;
1745
+ totalDebtsInUsd: number;
1746
+ totalCollateralInUsd: number;
1747
+ riskLevel: number;
1748
+ availableCollateralInUsd: number;
1749
+ totalUnhealthyCollateralInUsd: number;
1750
+ collaterals: {
1751
+ coinName: string;
1752
+ symbol: string;
1753
+ coinDecimals: number;
1754
+ coinType: string;
1755
+ coinPrice: number;
1756
+ depositedCoin: number;
1757
+ depositedValueInUsd: number;
1758
+ }[];
1759
+ borrowedPools: {
1760
+ coinName: string;
1761
+ symbol: string;
1762
+ coinDecimals: number;
1763
+ coinType: string;
1764
+ coinPrice: number;
1765
+ borrowedCoin: number;
1766
+ borrowedValueInUsd: number;
1767
+ borrowApr: number | undefined;
1768
+ borrowApy: number | undefined;
1769
+ incentiveInfos: {
1770
+ coinName: string;
1771
+ symbol: string;
1772
+ coinType: string;
1773
+ incentiveApr: number;
1774
+ }[];
1775
+ }[];
1776
+ }[];
1777
+ pendingRewards: {
1778
+ lendings: any;
1779
+ borrowIncentives: any;
1780
+ };
1781
+ veScas: {
1782
+ veScaKey: string;
1783
+ coinPrice: number;
1784
+ lockedScaInCoin: number;
1785
+ lockedScaInUsd: number;
1786
+ currentVeScaBalance: number;
1787
+ remainingLockPeriodInDays: number;
1788
+ unlockAt: number;
1789
+ }[];
1790
+ totalDebtValue: number;
1791
+ totalCollateralValue: number;
1792
+ totalSupplyValue: number;
1793
+ }>;
1794
+ /**
1795
+ * Get both primary and secondary price update policy objects
1796
+ * @returns price update policies
1797
+ */
1798
+ getPriceUpdatePolicies(): Promise<{
1799
+ primary: _mysten_sui_dist_cjs_client.SuiObjectResponse | null;
1800
+ secondary: _mysten_sui_dist_cjs_client.SuiObjectResponse | null;
1801
+ }>;
1802
+ /**
1803
+ * Return the supported primary and secondary oracles for all supported pool assets
1804
+ */
1805
+ getAssetOracles(): Promise<Record<string, xOracleRules>>;
1806
+ /**
1807
+ * Get switchboard on-demand aggregator object id based on coinType
1808
+ * @param coinType
1809
+ * @returns
1810
+ */
1811
+ getSwitchboardOnDemandAggregatorObjectIds(coinName: string[]): Promise<string[]>;
1812
+ }
1813
+
1814
+ type CoreIds = {
1815
+ protocolPkg: string;
1816
+ market: string;
1817
+ version: string;
1818
+ coinDecimalsRegistry: string;
1819
+ xOracle: string;
1820
+ };
1821
+ type NestedResult = Extract<Argument, {
1822
+ $kind: 'NestedResult';
1823
+ }>;
1824
+ type Obligation = NestedResult;
1825
+ type ObligationKey = NestedResult;
1826
+ type ObligationHotPotato = NestedResult;
1827
+ type CoreNormalMethods = {
1828
+ openObligation: () => [Obligation, ObligationKey, ObligationHotPotato];
1829
+ returnObligation: (obligation: SuiObjectArg, obligationHotPotato: SuiObjectArg) => void;
1830
+ openObligationEntry: () => void;
1831
+ addCollateral: (obligation: SuiObjectArg, coin: SuiObjectArg, collateralCoinName: string) => void;
1832
+ takeCollateral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, collateralCoinName: string) => TransactionResult;
1833
+ deposit: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
1834
+ depositEntry: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
1835
+ withdraw: (marketCoin: SuiObjectArg, poolCoinName: string) => TransactionResult;
1836
+ withdrawEntry: (marketCoin: SuiObjectArg, poolCoinName: string) => TransactionResult;
1837
+ borrow: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: string) => TransactionResult;
1838
+ borrowWithReferral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, borrowReferral: SuiObjectArg, amount: number | SuiTxArg, poolCoinName: string) => TransactionResult;
1839
+ borrowEntry: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: string) => TransactionResult;
1840
+ repay: (obligation: SuiObjectArg, coin: SuiObjectArg, poolCoinName: string) => void;
1841
+ borrowFlashLoan: (amount: number | SuiTxArg, poolCoinName: string) => TransactionResult;
1842
+ repayFlashLoan: (coin: SuiObjectArg, loan: SuiObjectArg, poolCoinName: string) => void;
1843
+ };
1844
+ type CoreQuickMethods = {
1845
+ addCollateralQuick: (amount: number, collateralCoinName: string, obligationId?: SuiObjectArg) => Promise<void>;
1846
+ takeCollateralQuick: (amount: number, collateralCoinName: string, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
1847
+ borrowQuick: (amount: number, poolCoinName: string, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
1848
+ borrowWithReferralQuick: (amount: number, poolCoinName: string, borrowReferral: SuiObjectArg, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
1849
+ depositQuick: (amount: number, poolCoinName: string, returnSCoin?: boolean) => Promise<TransactionResult>;
1850
+ withdrawQuick: (amount: number, poolCoinName: string) => Promise<TransactionResult>;
1851
+ repayQuick: (amount: number, poolCoinName: string, obligationId?: SuiObjectArg) => Promise<void>;
1852
+ updateAssetPricesQuick: (assetCoinNames?: string[]) => Promise<void>;
1853
+ };
1854
+ type SuiTxBlockWithCoreNormalMethods = SuiTxBlock & SuiTxBlockWithSpool & CoreNormalMethods;
1855
+ type CoreTxBlock = SuiTxBlockWithCoreNormalMethods & CoreQuickMethods;
1856
+ type GenerateCoreNormalMethod = (params: {
1857
+ builder: ScallopBuilder;
1858
+ txBlock: SuiTxBlock;
1859
+ }) => CoreNormalMethods;
1860
+ type GenerateCoreQuickMethod = (params: {
1861
+ builder: ScallopBuilder;
1862
+ txBlock: SuiTxBlockWithCoreNormalMethods;
1863
+ }) => CoreQuickMethods;
1864
+
1865
+ type SpoolIds = {
1866
+ spoolPkg: string;
1867
+ };
1868
+ type SpoolNormalMethods = {
1869
+ createStakeAccount: (stakeMarketCoinName: string) => TransactionResult;
1870
+ stake: (stakeAccount: SuiAddressArg, coin: SuiObjectArg, stakeMarketCoinName: string) => void;
1871
+ unstake: (stakeAccount: SuiAddressArg, amount: number, stakeMarketCoinName: string) => TransactionResult;
1872
+ claim: (stakeAccount: SuiAddressArg, stakeMarketCoinName: string) => TransactionResult;
1873
+ };
1874
+ type SpoolQuickMethods = {
1875
+ stakeQuick(amountOrMarketCoin: SuiObjectArg | number, stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg): Promise<void>;
1876
+ unstakeQuick(amount: number, stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg, returnSCoin?: boolean): Promise<TransactionResult | undefined>;
1877
+ claimQuick(stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg): Promise<TransactionResult[]>;
1878
+ };
1879
+ type SuiTxBlockWithSpoolNormalMethods = SuiTxBlock & SuiTxBlockWithSCoin & SpoolNormalMethods;
1880
+ type SpoolTxBlock = SuiTxBlockWithSpoolNormalMethods & SpoolQuickMethods;
1881
+ type GenerateSpoolNormalMethod = (params: {
1882
+ builder: ScallopBuilder;
1883
+ txBlock: SuiTxBlock;
1884
+ }) => SpoolNormalMethods;
1885
+ type GenerateSpoolQuickMethod = (params: {
1886
+ builder: ScallopBuilder;
1887
+ txBlock: SuiTxBlockWithSpoolNormalMethods;
1888
+ }) => SpoolQuickMethods;
1889
+
1890
+ type BorrowIncentiveIds = {
1891
+ borrowIncentivePkg: string;
1892
+ query: string;
1893
+ config: string;
1894
+ incentivePools: string;
1895
+ incentiveAccounts: string;
1896
+ obligationAccessStore: string;
1897
+ };
1898
+ type BorrowIncentiveNormalMethods = {
1899
+ stakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
1900
+ stakeObligationWithVesca: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, veScaKey: SuiObjectArg) => void;
1901
+ unstakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
1902
+ claimBorrowIncentive: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, rewardType: string) => TransactionResult;
1903
+ deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => void;
1904
+ };
1905
+ type BorrowIncentiveQuickMethods = {
1906
+ stakeObligationQuick(obligation?: string, obligationKey?: string): Promise<void>;
1907
+ stakeObligationWithVeScaQuick(obligation?: string, obligationKey?: string, veScaKey?: string): Promise<void>;
1908
+ unstakeObligationQuick(obligation?: string, obligationKey?: string): Promise<void>;
1909
+ claimBorrowIncentiveQuick(rewardType: string, obligation?: string, obligationKey?: string): Promise<TransactionResult>;
1910
+ };
1911
+ type SuiTxBlockWithBorrowIncentiveNormalMethods = SuiTxBlock & BorrowIncentiveNormalMethods;
1912
+ type BorrowIncentiveTxBlock = SuiTxBlockWithBorrowIncentiveNormalMethods & BorrowIncentiveQuickMethods;
1913
+ type GenerateBorrowIncentiveNormalMethod = (params: {
1914
+ builder: ScallopBuilder;
1915
+ txBlock: SuiTxBlock;
1916
+ }) => BorrowIncentiveNormalMethods;
1917
+ type GenerateBorrowIncentiveQuickMethod = (params: {
1918
+ builder: ScallopBuilder;
1919
+ txBlock: SuiTxBlockWithBorrowIncentiveNormalMethods;
1920
+ }) => BorrowIncentiveQuickMethods;
1921
+
1922
+ type VeScaNormalMethods = {
1923
+ lockSca: (scaCoin: SuiObjectArg, unlockAtInSecondTimestamp: number) => TransactionResult;
1924
+ extendLockPeriod: (veScaKey: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
1925
+ extendLockAmount: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg) => void;
1926
+ renewExpiredVeSca: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
1927
+ redeemSca: (veScaKey: SuiObjectArg) => TransactionResult;
1928
+ mintEmptyVeSca: () => TransactionResult;
1929
+ splitVeSca: (veScaKey: SuiObjectArg, splitAmount: string) => TransactionResult;
1930
+ mergeVeSca: (targetVeScaKey: SuiObjectArg, sourceVeScaKey: SuiObjectArg) => void;
1931
+ };
1932
+ type QuickMethodReturnType<T extends boolean> = T extends true ? void : TransactionResult;
1933
+ type VeScaQuickMethods = {
1934
+ /**
1935
+ * Quick methods to automate
1936
+ * lock initial SCA, extend lock period, lock more SCA, renew expired VeSCA, and redeem SCA
1937
+ *
1938
+ * **Flow:**
1939
+ * - If only `amountOrCoin` is provided, it will lock the amount of existing not expired veSCA
1940
+ * - If only `lockPeriodInDays` is provided, it will extend the lock period of existing not expired veSCA
1941
+ *
1942
+ * **Note:**
1943
+ * - If one or both flow above is used on a expired veSCA, it will claim the unlocked SCA
1944
+ * and renew the veSCA first, and then flow continues
1945
+ * - If users has no veSCA yet, they need to provide both `amountOrCoin` and `lockPeriodInDays` for initial lock
1946
+ * @param amountOrCoin
1947
+ * @param lockPeriodInDays
1948
+ * @param autoCheck
1968
1949
  */
1969
- getAllCoinPrices(args?: {
1970
- marketPools?: MarketPools;
1971
- coinPrices?: CoinPrices;
1972
- indexer?: boolean;
1973
- }): Promise<{
1974
- [x: string]: number | undefined;
1975
- }>;
1950
+ lockScaQuick(params: {
1951
+ amountOrCoin?: SuiObjectArg | number;
1952
+ lockPeriodInDays?: number;
1953
+ autoCheck?: boolean;
1954
+ veScaKey?: SuiObjectData | string;
1955
+ }): Promise<void>;
1956
+ extendLockPeriodQuick: (params: {
1957
+ lockPeriodInDays: number;
1958
+ autoCheck?: boolean;
1959
+ veScaKey?: SuiObjectData | string;
1960
+ }) => Promise<void>;
1961
+ extendLockAmountQuick: (params: {
1962
+ scaAmount: number;
1963
+ autoCheck?: boolean;
1964
+ veScaKey?: SuiObjectData | string;
1965
+ }) => Promise<void>;
1966
+ renewExpiredVeScaQuick: (params: {
1967
+ scaAmount: number;
1968
+ lockPeriodInDays: number;
1969
+ autoCheck?: boolean;
1970
+ veScaKey?: SuiObjectData | string;
1971
+ }) => Promise<void>;
1972
+ redeemScaQuick: <T extends boolean>(params: {
1973
+ veScaKey?: SuiObjectData | string;
1974
+ transferSca?: T;
1975
+ }) => Promise<QuickMethodReturnType<T> | undefined>;
1976
+ splitVeScaQuick: <T extends boolean>(params: {
1977
+ splitAmount: string;
1978
+ veScaKey: string;
1979
+ transferVeScaKey?: T;
1980
+ }) => Promise<QuickMethodReturnType<T> | undefined>;
1981
+ mergeVeScaQuick: (params: {
1982
+ targetVeScaKey: string;
1983
+ sourceVeScaKey: string;
1984
+ }) => Promise<void>;
1985
+ };
1986
+ type SuiTxBlockWithVeScaNormalMethods = SuiTxBlock & VeScaNormalMethods;
1987
+ type VeScaTxBlock = SuiTxBlockWithVeScaNormalMethods & VeScaQuickMethods;
1988
+ type GenerateVeScaNormalMethod = (params: {
1989
+ builder: ScallopBuilder;
1990
+ txBlock: SuiTxBlock;
1991
+ }) => VeScaNormalMethods;
1992
+ type GenerateVeScaQuickMethod = (params: {
1993
+ builder: ScallopBuilder;
1994
+ txBlock: SuiTxBlockWithVeScaNormalMethods;
1995
+ }) => VeScaQuickMethods;
1996
+
1997
+ type ReferralNormalMethods = {
1998
+ bindToReferral: (veScaKeyId: string) => void;
1999
+ claimReferralTicket: (poolCoinName: string) => TransactionResult$1;
2000
+ burnReferralTicket: (ticket: SuiObjectArg, poolCoinName: string) => void;
2001
+ claimReferralRevenue: (veScaKey: SuiObjectArg, poolCoinName: string) => TransactionResult$1;
2002
+ };
2003
+ type ReferralQuickMethods = {
2004
+ claimReferralRevenueQuick: (veScaKey: SuiObjectArg, coinNames: string[]) => Promise<void>;
2005
+ };
2006
+ type SuiTxBlockWithReferralNormalMethods = SuiTxBlock & ReferralNormalMethods;
2007
+ type ReferralTxBlock = SuiTxBlockWithReferralNormalMethods & ReferralQuickMethods;
2008
+
2009
+ type LoyaltyProgramNormalMethods = {
2010
+ claimLoyaltyRevenue: (veScaKey: SuiObjectArg) => TransactionResult$1;
2011
+ claimVeScaLoyaltyReward: (veScaKey: SuiObjectArg) => TransactionResult$1;
2012
+ };
2013
+ type LoyaltyProgramQuickMethods = {
2014
+ claimLoyaltyRevenueQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
2015
+ claimVeScaLoyaltyRewardQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
2016
+ };
2017
+ type SuiTxBlockWithLoyaltyProgramNormalMethods = SuiTxBlock & LoyaltyProgramNormalMethods;
2018
+ type LoyaltyProgramTxBlock = SuiTxBlockWithLoyaltyProgramNormalMethods & LoyaltyProgramQuickMethods;
2019
+ type GenerateLoyaltyProgramNormalMethod = (params: {
2020
+ builder: ScallopBuilder;
2021
+ txBlock: SuiTxBlock;
2022
+ }) => LoyaltyProgramNormalMethods;
2023
+ type GenerateLoyaltyProgramQuickMethod = (params: {
2024
+ builder: ScallopBuilder;
2025
+ txBlock: SuiTxBlockWithLoyaltyProgramNormalMethods;
2026
+ }) => LoyaltyProgramQuickMethods;
2027
+
2028
+ type sCoinPkgIds = {
2029
+ pkgId: string;
2030
+ };
2031
+ type sCoinNormalMethods = {
1976
2032
  /**
1977
- * Query all address (lending pool, collateral pool, borrow dynamics, interest models, etc.) of all pool
2033
+ * Lock marketCoin and return sCoin
2034
+ * @param marketCoinName
2035
+ * @param marketCoin
1978
2036
  * @returns
1979
2037
  */
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;
1994
- symbol: string;
1995
- coinType: string;
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>>;
2038
+ mintSCoin: (marketCoinName: string, marketCoin: SuiObjectArg) => TransactionResult$1;
2065
2039
  /**
2066
- * Get switchboard on-demand aggregator object id based on coinType
2067
- * @param coinType
2040
+ * Burn sCoin and return marketCoin
2041
+ * @param sCoinName
2042
+ * @param sCoin
2068
2043
  * @returns
2069
2044
  */
2070
- getSwitchboardOnDemandAggregatorObjectIds(coinName: string[]): Promise<string[]>;
2071
- }
2045
+ burnSCoin: (sCoinName: string, sCoin: SuiObjectArg) => TransactionResult$1;
2046
+ };
2047
+ type sCoinQuickMethods = {
2048
+ mintSCoinQuick: (marketCoinName: string, amount: number) => Promise<TransactionResult$1>;
2049
+ burnSCoinQuick: (sCoinName: string, amount: number) => Promise<TransactionResult$1>;
2050
+ };
2051
+ type SuiTxBlockWithSCoinNormalMethods = SuiTxBlock & BaseScallopTxBlock & sCoinNormalMethods;
2052
+ type SCoinTxBlock = SuiTxBlockWithSCoinNormalMethods & sCoinQuickMethods;
2053
+ type GenerateSCoinNormalMethod = (params: {
2054
+ builder: ScallopBuilder;
2055
+ txBlock: SuiTxBlock;
2056
+ }) => sCoinNormalMethods;
2057
+ type GenerateSCoinQuickMethod = (params: {
2058
+ builder: ScallopBuilder;
2059
+ txBlock: SuiTxBlockWithSCoinNormalMethods;
2060
+ }) => sCoinQuickMethods;
2061
+
2062
+ type BaseScallopTxBlock = ReferralTxBlock & LoyaltyProgramTxBlock & BorrowIncentiveTxBlock & VeScaTxBlock;
2063
+ type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
2064
+ type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
2065
+ type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
2066
+ type SelectCoinReturnType<T extends string> = T extends 'sui' ? {
2067
+ takeCoin: NestedResult;
2068
+ } : {
2069
+ takeCoin: NestedResult;
2070
+ leftCoin: NestedResult;
2071
+ };
2072
2072
 
2073
2073
  type ScallopBuilderParams = {
2074
2074
  query?: ScallopQuery;
@@ -2401,4 +2401,4 @@ declare class ScallopUtils implements ScallopUtilsInterface {
2401
2401
  getSupportedPoolAddresses(): PoolAddress[];
2402
2402
  }
2403
2403
 
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 };
2404
+ export { type SCoinTxBlock as $, type BorrowIncentiveQuickMethods as A, type BaseScallopTxBlock as B, type CoreIds as C, type SuiTxBlockWithBorrowIncentiveNormalMethods as D, type BorrowIncentiveTxBlock as E, type GenerateBorrowIncentiveNormalMethod as F, type GenerateCoreNormalMethod as G, type GenerateBorrowIncentiveQuickMethod as H, type VeScaQuickMethods as I, type SuiTxBlockWithVeScaNormalMethods as J, type VeScaTxBlock as K, type GenerateVeScaNormalMethod as L, type GenerateVeScaQuickMethod as M, type NestedResult as N, type LoyaltyProgramNormalMethods as O, type LoyaltyProgramQuickMethods as P, type QuickMethodReturnType as Q, type SuiTxBlockWithLoyaltyProgramNormalMethods as R, ScallopBuilder as S, type LoyaltyProgramTxBlock as T, type GenerateLoyaltyProgramNormalMethod as U, type VeScaNormalMethods as V, type GenerateLoyaltyProgramQuickMethod as W, type sCoinPkgIds as X, type sCoinNormalMethods as Y, type sCoinQuickMethods as Z, type SuiTxBlockWithSCoinNormalMethods as _, ScallopAddress as a, type ParsedSpoolRewardPoolData as a$, type GenerateSCoinNormalMethod as a0, type GenerateSCoinQuickMethod as a1, type PoolAddress as a2, type Whitelist as a3, type CoinWrappedType as a4, type BorrowIncentiveAccountKey as a5, type BorrowIncentivePools as a6, type BorrowIncentivePoolPoints as a7, type BorrowIncentivePool as a8, type OriginBorrowIncentivePoolPointData as a9, type CalculatedMarketPoolData as aA, type OriginMarketCollateralData as aB, type ParsedMarketCollateralData as aC, type CalculatedMarketCollateralData as aD, type Market as aE, type Obligation$1 as aF, type MarketQueryInterface as aG, type ObligationQueryInterface as aH, type LoyaltyProgramInfo as aI, type VeScaLoyaltyProgramInfo as aJ, type Lendings as aK, type ObligationAccounts as aL, type Lending as aM, type ObligationAccount as aN, type ObligationCollateral as aO, type ObligationDebt as aP, type ObligationBorrowIncentiveReward as aQ, type ObligationBorrowIncentive as aR, type TotalValueLocked as aS, type Spools as aT, type Spool as aU, type OriginSpoolData as aV, type SpoolData as aW, type ParsedSpoolData as aX, type CalculatedSpoolData as aY, type SpoolRewardPool as aZ, type OriginSpoolRewardPoolData as a_, type OriginBorrowIncentivePoolData as aa, type ParsedBorrowIncentivePoolPointData as ab, type ParsedBorrowIncentivePoolData as ac, type CalculatedBorrowIncentivePoolPointData as ad, type BorrowIncentiveAccounts as ae, type OriginBorrowIncentiveAccountPoolData as af, type OriginBorrowIncentiveAccountData as ag, type ParsedBorrowIncentiveAccountPoolData as ah, type ParsedBorrowIncentiveAccountData as ai, type BorrowIncentivePoolsQueryInterface as aj, type BorrowIncentiveAccountsQueryInterface as ak, type MarketPools as al, type MarketCollaterals as am, type CoinAmounts as an, type MarketCoinAmounts as ao, type SCoinAmounts as ap, type BalanceSheet as aq, type BorrowDynamic as ar, type BorrowFee as as, type InterestModel as at, type RiskModel as au, type CollateralStat as av, type MarketPool as aw, type MarketCollateral as ax, type OriginMarketPoolData as ay, type ParsedMarketPoolData as az, ScallopAxios as b, type CalculatedSpoolRewardPoolData as b0, type StakePools as b1, type StakeRewardPools as b2, type StakeAccounts as b3, type StakeAccount as b4, type StakePool as b5, type StakeRewardPool as b6, type Vesca as b7, type VeScaTreasuryFields as b8, type VeScaTreasuryInfo as b9, type OptionalKeys as ba, type CoinPrices as bb, type ScallopClientInterface as bc, type ScallopBuilderParams as bd, ScallopConstants as c, ScallopIndexer as d, ScallopQuery as e, ScallopQueryClient as f, ScallopUtils as g, ScallopSuiKit as h, type SuiTxBlockWithSCoin as i, type SuiTxBlockWithSpool as j, type ScallopTxBlock as k, type SelectCoinReturnType as l, type CoreNormalMethods as m, type CoreQuickMethods as n, type SuiTxBlockWithCoreNormalMethods as o, type CoreTxBlock as p, type GenerateCoreQuickMethod as q, type SpoolIds as r, type SpoolNormalMethods as s, type SpoolQuickMethods as t, type SuiTxBlockWithSpoolNormalMethods as u, type SpoolTxBlock as v, type GenerateSpoolNormalMethod as w, type GenerateSpoolQuickMethod as x, type BorrowIncentiveIds as y, type BorrowIncentiveNormalMethods as z };