@scallop-io/sui-scallop-sdk 2.3.0-lst-x-oracle-alpha.4 → 2.3.0-lst-x-oracle-alpha.5

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.
Files changed (56) hide show
  1. package/dist/index.d.mts +2838 -11
  2. package/dist/index.d.ts +2838 -11
  3. package/dist/index.js +2 -2
  4. package/dist/index.mjs +2 -1
  5. package/package.json +6 -35
  6. package/src/builders/borrowIncentiveBuilder.ts +1 -1
  7. package/src/builders/coreBuilder.ts +1 -1
  8. package/src/builders/loyaltyProgramBuilder.ts +1 -1
  9. package/src/builders/referralBuilder.ts +1 -1
  10. package/src/builders/sCoinBuilder.ts +1 -1
  11. package/src/builders/spoolBuilder.ts +1 -1
  12. package/src/builders/vescaBuilder.ts +1 -1
  13. package/src/constants/index.ts +0 -1
  14. package/src/constants/testAddress.ts +2 -2
  15. package/src/index.ts +12 -3
  16. package/src/models/scallop.ts +1 -1
  17. package/src/models/scallopAddress.ts +1 -1
  18. package/src/models/scallopBuilder.ts +1 -1
  19. package/src/models/scallopClient.ts +1 -1
  20. package/src/models/scallopConstants.ts +1 -1
  21. package/src/models/scallopQuery.ts +2 -2
  22. package/src/models/scallopUtils.ts +2 -2
  23. package/src/models/utils.ts +97 -0
  24. package/src/queries/borrowIncentiveQuery.ts +2 -2
  25. package/src/queries/coreQuery.ts +1 -1
  26. package/src/queries/portfolioQuery.ts +2 -2
  27. package/src/queries/spoolQuery.ts +1 -1
  28. package/src/{utils/query.ts → queries/utils.ts} +19 -1
  29. package/src/types/builder/index.ts +1 -26
  30. package/src/types/builder/type.ts +25 -0
  31. package/src/types/constant/package.ts +15 -2
  32. package/dist/address-CW2IpaLn.d.ts +0 -165
  33. package/dist/chunk-E3URAUAC.js +0 -25
  34. package/dist/chunk-YA77R5GT.mjs +0 -5
  35. package/dist/constants/index.d.mts +0 -262
  36. package/dist/constants/index.d.ts +0 -262
  37. package/dist/constants/index.js +0 -86
  38. package/dist/constants/index.mjs +0 -5
  39. package/dist/models/index.d.mts +0 -393
  40. package/dist/models/index.d.ts +0 -393
  41. package/dist/models/index.js +0 -34
  42. package/dist/models/index.mjs +0 -16
  43. package/dist/queryKeys-AaZqDYle.d.ts +0 -43
  44. package/dist/scallopUtils-BZLZd2z8.d.ts +0 -2404
  45. package/dist/types/index.d.mts +0 -9
  46. package/dist/types/index.d.ts +0 -9
  47. package/dist/types/index.js +0 -2
  48. package/dist/types/index.mjs +0 -1
  49. package/src/constants/package.ts +0 -14
  50. package/src/types/index.ts +0 -5
  51. package/src/utils/core.ts +0 -18
  52. package/src/utils/index.ts +0 -5
  53. package/src/utils/indexer.ts +0 -47
  54. package/src/utils/util.ts +0 -42
  55. /package/src/{utils/builder.ts → builders/utils.ts} +0 -0
  56. /package/src/types/{utils.ts → util.ts} +0 -0
@@ -1,393 +0,0 @@
1
- import { bc as ScallopClientInterface, S as ScallopBuilder, e as ScallopQuery, g as ScallopUtils, c as ScallopConstants, h as ScallopSuiKit, aE as Market, aF as Obligation, aH as ObligationQueryInterface, b3 as StakeAccounts, b4 as StakeAccount, b5 as StakePool, b6 as StakeRewardPool, k as ScallopTxBlock, bd as ScallopBuilderParams, d as ScallopIndexer } from '../scallopUtils-BZLZd2z8.js';
2
- export { a as ScallopAddress, b as ScallopAxios, f as ScallopQueryClient } from '../scallopUtils-BZLZd2z8.js';
3
- import { NetworkType, SuiObjectArg } from '@scallop-io/sui-kit';
4
- import { SuiTransactionBlockResponse } from '@mysten/sui/client';
5
- import { TransactionObjectArgument, Transaction, TransactionResult } from '@mysten/sui/transactions';
6
- import '@tanstack/query-core';
7
- import '../address-CW2IpaLn.js';
8
- import 'axios';
9
- import '@mysten/sui/dist/cjs/client';
10
-
11
- type ScallopClientParams = {
12
- networkType?: NetworkType;
13
- builder?: ScallopBuilder;
14
- } & ScallopBuilderParams;
15
- type ScallopClientFnReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : Transaction;
16
- type ScallopClientVeScaReturnType<T extends boolean> = T extends true ? SuiTransactionBlockResponse : {
17
- tx: Transaction;
18
- scaCoin: TransactionResult;
19
- };
20
- /**
21
- * @description
22
- * It provides contract interaction operations for general users.
23
- *
24
- * @example
25
- * ```typescript
26
- * const scallopClient = new ScallopClient(<parameters>);
27
- * await scallopClient.init();
28
- * scallopClient.<client functions>();
29
- * await scallopClient.<client async functions>();
30
- * ```
31
- */
32
- declare class ScallopClient implements ScallopClientInterface {
33
- readonly builder: ScallopBuilder;
34
- networkType: NetworkType;
35
- constructor(params: ScallopClientParams);
36
- get query(): ScallopQuery;
37
- get utils(): ScallopUtils;
38
- get constants(): ScallopConstants;
39
- get walletAddress(): string;
40
- get scallopSuiKit(): ScallopSuiKit;
41
- get address(): ScallopConstants;
42
- /**
43
- * Request the scallop API to initialize data.
44
- *
45
- * @param force - Whether to force initialization.
46
- */
47
- init(force?: boolean): Promise<void>;
48
- /**
49
- * Query market data.
50
- *
51
- * @description
52
- * This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
53
- *
54
- * @return Market data.
55
- */
56
- queryMarket(): Promise<Market>;
57
- /**
58
- * Get obligations data.
59
- *
60
- * @description
61
- * This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
62
- *
63
- * @param ownerAddress - The owner address.
64
- * @return Obligations data.
65
- */
66
- getObligations(ownerAddress?: string): Promise<Obligation[]>;
67
- /**
68
- * Query obligation data.
69
- *
70
- * @description
71
- * This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
72
- *
73
- * @param obligationId - The obligation id.
74
- * @return Obligation data.
75
- */
76
- queryObligation(obligationId: string): Promise<ObligationQueryInterface | undefined>;
77
- /**
78
- * Query all stake accounts data.
79
- *
80
- * @description
81
- * This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
82
- *
83
- * @param ownerAddress - The owner address.
84
- * @return All stake accounts data.
85
- */
86
- getAllStakeAccounts(ownerAddress?: string): Promise<StakeAccounts>;
87
- /**
88
- * Query stake account data.
89
- *
90
- * @description
91
- * This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
92
- *
93
- * @param stakeMarketCoinName - Support stake market coin.
94
- * @param ownerAddress - The owner address.
95
- * @return Stake accounts data.
96
- */
97
- getStakeAccounts(stakeMarketCoinName: string, ownerAddress?: string): Promise<StakeAccount[]>;
98
- /**
99
- * Query stake pool data.
100
- *
101
- * @description
102
- * This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
103
- *
104
- * @param stakeMarketCoinName - Support stake market coin.
105
- * @return Stake pool data.
106
- */
107
- getStakePool(stakeMarketCoinName: string): Promise<StakePool | undefined>;
108
- /**
109
- * Query reward pool data.
110
- *
111
- * @description
112
- * This method might be @deprecated in the future, please use the {@link ScallopQuery} query instance instead.
113
- *
114
- * @param stakeMarketCoinName - Support stake market coin.
115
- * @return Reward pool data.
116
- */
117
- getStakeRewardPool(stakeMarketCoinName: string): Promise<StakeRewardPool | undefined>;
118
- /**
119
- * Open obligation.
120
- *
121
- * @param sign - Decide to directly sign the transaction or return the transaction block.
122
- * @return Transaction block response or transaction block.
123
- */
124
- openObligation(): Promise<SuiTransactionBlockResponse>;
125
- openObligation<S extends boolean>(sign?: S): Promise<ScallopClientFnReturnType<S>>;
126
- /**
127
- * Deposit collateral into the specific pool.
128
- *
129
- * @param collateralCoinName - Types of collateral coin.
130
- * @param amount - The amount of coins would deposit.
131
- * @param sign - Decide to directly sign the transaction or return the transaction block.
132
- * @param obligationId - The obligation object.
133
- * @param walletAddress - The wallet address of the owner.
134
- * @return Transaction block response or transaction block.
135
- */
136
- depositCollateral(collateralCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
137
- depositCollateral<S extends boolean>(collateralCoinName: string, amount: number, sign?: S, obligationId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
138
- /**
139
- * Withdraw collateral from the specific pool.
140
- *
141
- * @param collateralCoinName - Types of collateral coin.
142
- * @param amount - The amount of coins would deposit.
143
- * @param sign - Decide to directly sign the transaction or return the transaction block.
144
- * @param obligationId - The obligation object.
145
- * @param obligationKey - The obligation key object to verifying obligation authority.
146
- * @param walletAddress - The wallet address of the owner.
147
- * @return Transaction block response or transaction block.
148
- */
149
- withdrawCollateral<S extends boolean>(collateralCoinName: string, amount: number, sign: S | undefined, obligationId: string, obligationKey: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
150
- /**
151
- * Deposit asset into the specific pool.
152
- *
153
- * @param poolCoinName - Types of pool coin.
154
- * @param amount - The amount of coins would deposit.
155
- * @param sign - Decide to directly sign the transaction or return the transaction block.
156
- * @param walletAddress - The wallet address of the owner.
157
- * @return Transaction block response or transaction block.
158
- */
159
- deposit(poolCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
160
- deposit<S extends boolean>(poolCoinName: string, amount: number, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
161
- /**
162
- * Deposit asset into the specific pool and Stake market coin into the corresponding spool.
163
- *
164
- * @param stakeCoinName - Types of stake coin.
165
- * @param amount - The amount of coins would deposit.
166
- * @param sign - Decide to directly sign the transaction or return the transaction block.
167
- * @param stakeAccountId - The stake account object.
168
- * @param walletAddress - The wallet address of the owner.
169
- * @return Transaction block response or transaction block.
170
- */
171
- depositAndStake(stakeCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
172
- depositAndStake<S extends boolean>(stakeCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
173
- /**
174
- * Withdraw asset from the specific pool, must return market coin.
175
- *
176
- * @param poolCoinName - Specific support pool coin name.
177
- * @param amount - The amount of coins would withdraw.
178
- * @param sign - Decide to directly sign the transaction or return the transaction block.
179
- * @param walletAddress - The wallet address of the owner.
180
- * @return Transaction block response or transaction block.
181
- */
182
- withdraw(poolCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
183
- withdraw<S extends boolean>(poolCoinName: string, amount: number, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
184
- /**
185
- * Borrow asset from the specific pool.
186
- *
187
- * @param poolCoinName - Specific support pool coin name.
188
- * @param amount - The amount of coins would borrow.
189
- * @param sign - Decide to directly sign the transaction or return the transaction block.
190
- * @param obligationId - The obligation object.
191
- * @param obligationKey - The obligation key object to verifying obligation authority.
192
- * @param walletAddress - The wallet address of the owner.
193
- * @return Transaction block response or transaction block.
194
- */
195
- borrow<S extends boolean>(poolCoinName: string, amount: number, sign: S | undefined, obligationId: string, obligationKey: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
196
- /**
197
- * Repay asset into the specific pool.
198
- *
199
- * @param poolCoinName - Specific support pool coin name.
200
- * @param amount - The amount of coins would repay.
201
- * @param sign - Decide to directly sign the transaction or return the transaction block.
202
- * @param obligationId - The obligation object.
203
- * @param walletAddress - The wallet address of the owner.
204
- * @return Transaction block response or transaction block.
205
- */
206
- repay<S extends boolean>(poolCoinName: string, amount: number, sign: S | undefined, obligationId: string, obligationKey: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
207
- /**
208
- * FlashLoan asset from the specific pool.
209
- *
210
- * @param poolCoinName - Specific support pool coin name..
211
- * @param amount - The amount of coins would repay.
212
- * @param callback - The callback function to build transaction block and return coin argument.
213
- * @param sign - Decide to directly sign the transaction or return the transaction block.
214
- * @return Transaction block response or transaction block.
215
- */
216
- flashLoan(poolCoinName: string, amount: number, callback: (txBlock: ScallopTxBlock, coin: TransactionObjectArgument | string) => SuiObjectArg): Promise<SuiTransactionBlockResponse>;
217
- flashLoan<S extends boolean>(poolCoinName: string, amount: number, callback: (txBlock: ScallopTxBlock, coin: TransactionObjectArgument | string) => SuiObjectArg, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
218
- /**
219
- * Create stake account.
220
- *
221
- * @param sign - Decide to directly sign the transaction or return the transaction block.
222
- * @param walletAddress - The wallet address of the owner.
223
- * @return Transaction block response or transaction block.
224
- */
225
- createStakeAccount(marketCoinName: string): Promise<SuiTransactionBlockResponse>;
226
- createStakeAccount<S extends boolean>(marketCoinName: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
227
- /**
228
- * Stake market coin into the specific spool.
229
- *
230
- * @param marketCoinName - Types of market coin.
231
- * @param amount - The amount of coins would deposit.
232
- * @param sign - Decide to directly sign the transaction or return the transaction block.
233
- * @param stakeAccountId - The stake account object.
234
- * @param walletAddress - The wallet address of the owner.
235
- * @return Transaction block response or transaction block.
236
- */
237
- stake(stakeMarketCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
238
- stake<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
239
- /**
240
- * Unstake market coin from the specific spool.
241
- *
242
- * @param stakeMarketCoinName - Types of mak coin.
243
- * @param amount - The amount of coins would deposit.
244
- * @param sign - Decide to directly sign the transaction or return the transaction block.
245
- * @param accountId - The stake account object.
246
- * @param walletAddress - The wallet address of the owner.
247
- * @return Transaction block response or transaction block.
248
- */
249
- unstake(stakeMarketCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
250
- unstake<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
251
- /**
252
- * Unstake market coin from the specific spool and withdraw asset from the corresponding pool.
253
- *
254
- * @param marketCoinName - Types of mak coin.
255
- * @param amount - The amount of coins would deposit.
256
- * @param sign - Decide to directly sign the transaction or return the transaction block.
257
- * @param accountId - The stake account object.
258
- * @param walletAddress - The wallet address of the owner.
259
- * @return Transaction block response or transaction block.
260
- */
261
- unstakeAndWithdraw(stakeMarketCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
262
- unstakeAndWithdraw<S extends boolean>(stakeMarketCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
263
- /**
264
- * Claim reward coin from the specific spool.
265
- *
266
- * @param stakeMarketCoinName - Types of mak coin.
267
- * @param amount - The amount of coins would deposit.
268
- * @param sign - Decide to directly sign the transaction or return the transaction block.
269
- * @param accountId - The stake account object.
270
- * @param walletAddress - The wallet address of the owner.
271
- * @return Transaction block response or transaction block.
272
- */
273
- claim(stakeMarketCoinName: string): Promise<SuiTransactionBlockResponse>;
274
- claim<S extends boolean>(stakeMarketCoinName: string, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
275
- /**
276
- * stake obligaion.
277
- *
278
- * @param obligationId - The obligation account object.
279
- * @param obligationKeyId - The obligation key account object.
280
- * @param sign - Decide to directly sign the transaction or return the transaction block.
281
- * @param walletAddress - The wallet address of the owner.
282
- * @return Transaction block response or transaction block
283
- */
284
- stakeObligation<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
285
- /**
286
- * unstake obligaion.
287
- *
288
- * @param obligationId - The obligation account object.
289
- * @param obligationKeyId - The obligation key account object.
290
- * @param sign - Decide to directly sign the transaction or return the transaction block.
291
- * @param walletAddress - The wallet address of the owner.
292
- * @return Transaction block response or transaction block
293
- */
294
- unstakeObligation<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
295
- /**
296
- * Claim borrow incentive reward.
297
- *
298
- * @param poolName
299
- * @param amount - The amount of coins would deposit.
300
- * @param sign - Decide to directly sign the transaction or return the transaction block.
301
- * @param accountId - The stake account object.
302
- * @param walletAddress - The wallet address of the owner.
303
- * @return Transaction block response or transaction block
304
- */
305
- claimBorrowIncentive<S extends boolean>(obligationId: string, obligationKeyId: string, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
306
- /**
307
- * Function to migrate all market coin in user wallet into sCoin
308
- * @returns Transaction response
309
- */
310
- migrateAllMarketCoin<S extends boolean>(includeStakePool?: boolean, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
311
- /**
312
- * Claim unlocked SCA from all veSCA accounts.
313
- */
314
- claimAllUnlockedSca(): Promise<SuiTransactionBlockResponse>;
315
- claimAllUnlockedSca<S extends boolean>(sign?: S, walletAddress?: string): Promise<ScallopClientVeScaReturnType<S>>;
316
- /**
317
- * Mint and get test coin.
318
- *
319
- * @remarks
320
- * Only be used on the test network.
321
- *
322
- * @param assetCoinName - Specific asset coin name.
323
- * @param amount - The amount of coins minted and received.
324
- * @param receiveAddress - The wallet address that receives the coins.
325
- * @param sign - Decide to directly sign the transaction or return the transaction block.
326
- * @return Transaction block response or transaction block.
327
- */
328
- mintTestCoin(assetCoinName: Exclude<string, 'sui'>, amount: number): Promise<SuiTransactionBlockResponse>;
329
- mintTestCoin<S extends boolean>(assetCoinName: Exclude<string, 'sui'>, amount: number, sign?: S, receiveAddress?: string): Promise<ScallopClientFnReturnType<S>>;
330
- }
331
-
332
- /**
333
- * @argument params - The parameters for the Scallop instance.
334
- * @argument cacheOptions - The cache options for the QueryClient.
335
- *
336
- * @description
337
- * The main instance that controls interaction with the Scallop contract.
338
- *
339
- * @example
340
- * ```typescript
341
- * const sdk = new Scallop(<parameters>);
342
- * const scallopAddress = await sdk.getScallopAddress();
343
- * const scallopBuilder = await sdk.createScallopBuilder();
344
- * const scallopClient = await sdk.createScallopClient();
345
- * const scallopIndexer= await sdk.createScallopIndexer();
346
- * const scallopUtils= await sdk.createScallopUtils();
347
- * ```
348
- */
349
- type ScallopParams = {
350
- client?: ScallopClient;
351
- } & ScallopClientParams;
352
- declare class Scallop {
353
- readonly client: ScallopClient;
354
- constructor(params: ScallopParams);
355
- init(force?: boolean): Promise<void>;
356
- /**
357
- * Create a scallop client instance that already has initial data.
358
- *
359
- * @return Scallop Client.
360
- */
361
- createScallopClient(): Promise<ScallopClient>;
362
- /**
363
- * Create a scallop builder instance that already has initial data.
364
- *
365
- * @return Scallop Builder.
366
- */
367
- createScallopBuilder(): Promise<ScallopBuilder>;
368
- /**
369
- * Create a scallop query instance.
370
- *
371
- * @return Scallop Query.
372
- */
373
- createScallopQuery(): Promise<ScallopQuery>;
374
- /**
375
- * Create a scallop utils instance.
376
- *
377
- * @return Scallop Utils.
378
- */
379
- createScallopUtils(): Promise<ScallopUtils>;
380
- /**
381
- * Create a scallop indexer instance.
382
- *
383
- * @return Scallop Indexer.
384
- */
385
- createScallopIndexer(): Promise<ScallopIndexer>;
386
- /**
387
- * Get a scallop constants instance that already has initial data.
388
- * @returns Scallop Constants
389
- */
390
- getScallopConstants(): Promise<ScallopConstants>;
391
- }
392
-
393
- export { Scallop, ScallopBuilder, ScallopClient, ScallopConstants, ScallopIndexer, ScallopQuery, ScallopSuiKit, ScallopUtils };