@scallop-io/sui-scallop-sdk 2.0.11 → 2.0.13-merge-split-ve-sca-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,14 +5,14 @@ import {
5
5
  parseOriginMarketCollateralData,
6
6
  calculateMarketCollateralData,
7
7
  parseObjectAs,
8
- } from '../utils';
8
+ } from 'src/utils';
9
9
  import type {
10
10
  SuiObjectResponse,
11
11
  SuiObjectData,
12
12
  SuiParsedData,
13
13
  } from '@mysten/sui/client';
14
14
  import type { SuiObjectArg } from '@scallop-io/sui-kit';
15
- import type { ScallopAddress, ScallopCache, ScallopQuery } from '../models';
15
+ import type { ScallopAddress, ScallopCache, ScallopQuery } from 'src/models';
16
16
  import {
17
17
  Market,
18
18
  MarketPools,
@@ -32,7 +32,7 @@ import {
32
32
  BorrowFee,
33
33
  BorrowDynamic,
34
34
  OriginMarketCollateralData,
35
- } from '../types';
35
+ } from 'src/types';
36
36
  import BigNumber from 'bignumber.js';
37
37
  import { getSupplyLimit } from './supplyLimitQuery';
38
38
  import { isIsolatedAsset } from './isolatedAssetQuery';
@@ -219,158 +219,118 @@ const queryRequiredMarketObjects = async (
219
219
  query: ScallopQuery,
220
220
  poolCoinNames: string[]
221
221
  ) => {
222
- // Prepare all tasks for querying each object type
223
- const tasks = poolCoinNames.map((t) => ({
224
- poolCoinName: t,
225
- balanceSheet: query.constants.poolAddresses[t]?.lendingPoolAddress,
226
- collateralStat: query.constants.poolAddresses[t]?.collateralPoolAddress,
227
- borrowDynamic: query.constants.poolAddresses[t]?.borrowDynamic,
228
- interestModel: query.constants.poolAddresses[t]?.interestModel,
229
- riskModel: query.constants.poolAddresses[t]?.riskModel,
230
- borrowFeeKey: query.constants.poolAddresses[t]?.borrowFeeKey,
231
- supplyLimitKey: query.constants.poolAddresses[t]?.supplyLimitKey,
232
- borrowLimitKey: query.constants.poolAddresses[t]?.borrowLimitKey,
233
- }));
234
-
235
- // Query all objects for each key in parallel
236
- const [
237
- balanceSheetObjects,
238
- collateralStatObjects,
239
- borrowDynamicObjects,
240
- interestModelObjects,
241
- riskModelObjects,
242
- borrowFeeObjects,
243
- supplyLimitObjects,
244
- borrowLimitObjects,
245
- ] = await Promise.all([
246
- queryMultipleObjects(
247
- query.cache,
248
- tasks.map((task) => task.balanceSheet).filter((t): t is string => !!t)
249
- ),
250
- queryMultipleObjects(
251
- query.cache,
252
- tasks.map((task) => task.collateralStat).filter((t): t is string => !!t)
253
- ),
254
- queryMultipleObjects(
255
- query.cache,
256
- tasks.map((task) => task.borrowDynamic).filter((t): t is string => !!t)
257
- ),
258
- queryMultipleObjects(
259
- query.cache,
260
- tasks.map((task) => task.interestModel).filter((t): t is string => !!t)
261
- ),
262
- queryMultipleObjects(
263
- query.cache,
264
- tasks.map((task) => task.riskModel).filter((t): t is string => !!t)
265
- ),
266
- queryMultipleObjects(
267
- query.cache,
268
- tasks.map((task) => task.borrowFeeKey).filter((t): t is string => !!t)
269
- ),
270
- queryMultipleObjects(
271
- query.cache,
272
- tasks.map((task) => task.supplyLimitKey).filter((t): t is string => !!t)
273
- ),
274
- queryMultipleObjects(
275
- query.cache,
276
- tasks.map((task) => task.borrowLimitKey).filter((t): t is string => !!t)
277
- ),
278
- ]);
279
-
280
- // Map the results back to poolCoinNames
281
- const mapObjects = (
282
- tasks: {
283
- poolCoinName: string;
284
- [key: string]: string | undefined;
285
- }[],
286
- fetchedObjects: SuiObjectData[],
287
- keyValue: string
288
- ) => {
289
- const resultMap: Record<string, SuiObjectData> = {};
290
- const fetchedObjectMap = fetchedObjects.reduce(
291
- (acc, obj) => {
292
- acc[obj.objectId] = obj;
293
- return acc;
294
- },
295
- {} as Record<string, SuiObjectData>
296
- );
222
+ // Phase 1: Single-pass data preparation with proper typing
223
+ type KeyType = {
224
+ balanceSheet?: string;
225
+ collateralStat?: string;
226
+ borrowDynamic?: string;
227
+ interestModel?: string;
228
+ riskModel?: string;
229
+ borrowFeeKey?: string;
230
+ supplyLimitKey?: string;
231
+ borrowLimitKey?: string;
232
+ };
297
233
 
298
- for (const task of tasks) {
299
- if (task[keyValue]) {
300
- resultMap[task.poolCoinName] = fetchedObjectMap[task[keyValue]];
301
- }
302
- }
303
- return resultMap;
234
+ const keyCollections: Record<keyof KeyType, string[]> = {
235
+ balanceSheet: [],
236
+ collateralStat: [],
237
+ borrowDynamic: [],
238
+ interestModel: [],
239
+ riskModel: [],
240
+ borrowFeeKey: [],
241
+ supplyLimitKey: [],
242
+ borrowLimitKey: [],
304
243
  };
305
244
 
306
- const balanceSheetMap = mapObjects(
307
- tasks,
308
- balanceSheetObjects,
309
- 'balanceSheet'
310
- );
311
- const collateralStatMap = mapObjects(
312
- tasks,
313
- collateralStatObjects,
314
- 'collateralStat'
315
- );
316
- const borrowDynamicMap = mapObjects(
317
- tasks,
318
- borrowDynamicObjects,
319
- 'borrowDynamic'
320
- );
321
- const interestModelMap = mapObjects(
322
- tasks,
323
- interestModelObjects,
324
- 'interestModel'
325
- );
326
- const riskModelMap = mapObjects(tasks, riskModelObjects, 'riskModel');
327
- const borrowFeeMap = mapObjects(tasks, borrowFeeObjects, 'borrowFeeKey');
328
- const supplyLimitMap = mapObjects(
329
- tasks,
330
- supplyLimitObjects,
331
- 'supplyLimitKey'
332
- );
333
- const borrowLimitMap = mapObjects(
334
- tasks,
335
- borrowLimitObjects,
336
- 'borrowLimitKey'
337
- );
338
- // const isolatedAssetMap = mapObjects(
339
- // tasks,
340
- // isolatedAssetObjects,
341
- // 'isolatedAssetKey'
342
- // );
343
- // Construct the final requiredObjects result
344
- const result = poolCoinNames.reduce(
345
- (acc, name) => {
346
- acc[name] = {
347
- balanceSheet: balanceSheetMap[name],
348
- collateralStat: collateralStatMap[name],
349
- borrowDynamic: borrowDynamicMap[name],
350
- interestModel: interestModelMap[name],
351
- riskModel: riskModelMap[name],
352
- borrowFeeKey: borrowFeeMap[name],
353
- supplyLimitKey: supplyLimitMap[name],
354
- borrowLimitKey: borrowLimitMap[name],
355
- isIsolated: query.constants.poolAddresses[name]?.isIsolated ?? false,
356
- };
357
- return acc;
358
- },
359
- {} as Record<
360
- string,
361
- {
362
- balanceSheet: SuiObjectData;
363
- collateralStat?: SuiObjectData;
364
- riskModel?: SuiObjectData;
365
- borrowDynamic: SuiObjectData;
366
- interestModel: SuiObjectData;
367
- borrowFeeKey: SuiObjectData;
368
- supplyLimitKey: SuiObjectData;
369
- borrowLimitKey: SuiObjectData;
370
- isIsolated: boolean;
245
+ const taskMap = new Map<string, KeyType>();
246
+
247
+ // Single iteration to collect all keys and map tasks
248
+ for (const poolCoinName of poolCoinNames) {
249
+ const poolData = query.constants.poolAddresses[poolCoinName];
250
+ const task: KeyType = {
251
+ balanceSheet: poolData?.lendingPoolAddress,
252
+ collateralStat: poolData?.collateralPoolAddress,
253
+ borrowDynamic: poolData?.borrowDynamic,
254
+ interestModel: poolData?.interestModel,
255
+ riskModel: poolData?.riskModel,
256
+ borrowFeeKey: poolData?.borrowFeeKey,
257
+ supplyLimitKey: poolData?.supplyLimitKey,
258
+ borrowLimitKey: poolData?.borrowLimitKey,
259
+ };
260
+
261
+ // Add to key collections
262
+ (Object.entries(task) as [keyof KeyType, string | undefined][]).forEach(
263
+ ([key, value]) => {
264
+ if (value) keyCollections[key].push(value);
371
265
  }
372
- >
373
- );
266
+ );
267
+
268
+ taskMap.set(poolCoinName, task);
269
+ }
270
+
271
+ // Phase 2: Parallel queries with pre-collected keys
272
+ const queryResults = await Promise.all([
273
+ queryMultipleObjects(query.cache, keyCollections.balanceSheet),
274
+ queryMultipleObjects(query.cache, keyCollections.collateralStat),
275
+ queryMultipleObjects(query.cache, keyCollections.borrowDynamic),
276
+ queryMultipleObjects(query.cache, keyCollections.interestModel),
277
+ queryMultipleObjects(query.cache, keyCollections.riskModel),
278
+ queryMultipleObjects(query.cache, keyCollections.borrowFeeKey),
279
+ queryMultipleObjects(query.cache, keyCollections.supplyLimitKey),
280
+ queryMultipleObjects(query.cache, keyCollections.borrowLimitKey),
281
+ ]);
282
+
283
+ // Phase 3: Single-pass result mapping
284
+ const resultMaps = {
285
+ balanceSheet: new Map<string, SuiObjectData>(),
286
+ collateralStat: new Map<string, SuiObjectData>(),
287
+ borrowDynamic: new Map<string, SuiObjectData>(),
288
+ interestModel: new Map<string, SuiObjectData>(),
289
+ riskModel: new Map<string, SuiObjectData>(),
290
+ borrowFeeKey: new Map<string, SuiObjectData>(),
291
+ supplyLimitKey: new Map<string, SuiObjectData>(),
292
+ borrowLimitKey: new Map<string, SuiObjectData>(),
293
+ isIsolated: new Map<string, boolean>(),
294
+ } as Record<keyof KeyType, Map<string, SuiObjectData>>;
295
+
296
+ queryResults.forEach((objects, index) => {
297
+ const keyType = Object.keys(resultMaps)[index] as keyof KeyType;
298
+ objects.forEach((obj) => {
299
+ resultMaps[keyType].set(obj.objectId, obj);
300
+ });
301
+ });
302
+
303
+ // Phase 4: Efficient result construction
304
+ const result: Record<string, any> = {};
305
+ for (const [poolCoinName, task] of taskMap) {
306
+ result[poolCoinName] = {
307
+ balanceSheet: task.balanceSheet
308
+ ? resultMaps.balanceSheet.get(task.balanceSheet)
309
+ : undefined,
310
+ collateralStat: task.collateralStat
311
+ ? resultMaps.collateralStat.get(task.collateralStat)
312
+ : undefined,
313
+ borrowDynamic: task.borrowDynamic
314
+ ? resultMaps.borrowDynamic.get(task.borrowDynamic)
315
+ : undefined,
316
+ interestModel: task.interestModel
317
+ ? resultMaps.interestModel.get(task.interestModel)
318
+ : undefined,
319
+ riskModel: task.riskModel
320
+ ? resultMaps.riskModel.get(task.riskModel)
321
+ : undefined,
322
+ borrowFeeKey: task.borrowFeeKey
323
+ ? resultMaps.borrowFeeKey.get(task.borrowFeeKey)
324
+ : undefined,
325
+ supplyLimitKey: task.supplyLimitKey
326
+ ? resultMaps.supplyLimitKey.get(task.supplyLimitKey)
327
+ : undefined,
328
+ borrowLimitKey: task.borrowLimitKey
329
+ ? resultMaps.borrowLimitKey.get(task.borrowLimitKey)
330
+ : undefined,
331
+ isolatedAssetKey: query.constants.poolAddresses[poolCoinName]?.isIsolated,
332
+ };
333
+ }
374
334
 
375
335
  return result;
376
336
  };
@@ -473,10 +433,10 @@ const parseMarketPoolObjects = ({
473
433
  borrowLimitKey,
474
434
  isIsolated,
475
435
  }: {
476
- balanceSheet: SuiObjectData;
477
- borrowDynamic: SuiObjectData;
436
+ balanceSheet?: SuiObjectData;
437
+ borrowDynamic?: SuiObjectData;
478
438
  collateralStat?: SuiObjectData;
479
- interestModel: SuiObjectData;
439
+ interestModel?: SuiObjectData;
480
440
  riskModel?: SuiObjectData;
481
441
  borrowFeeKey?: SuiObjectData;
482
442
  supplyLimitKey?: SuiObjectData;
@@ -485,6 +445,9 @@ const parseMarketPoolObjects = ({
485
445
  }): OriginMarketPoolData & {
486
446
  parsedOriginMarketCollateral?: OriginMarketCollateralData;
487
447
  } => {
448
+ if (!balanceSheet || !borrowDynamic || !interestModel) {
449
+ throw new Error('Missing required market objects');
450
+ }
488
451
  const _balanceSheet = parseObjectAs<BalanceSheet>(balanceSheet);
489
452
  const _interestModel = parseObjectAs<InterestModel>(interestModel);
490
453
  const _borrowDynamic = parseObjectAs<BorrowDynamic>(borrowDynamic);
@@ -608,6 +571,10 @@ export const getMarketPool = async (
608
571
  poolCoinName
609
572
  ];
610
573
 
574
+ if (!requiredObjects)
575
+ throw new Error(
576
+ `Failed to fetch required market objects for ${poolCoinName}`
577
+ );
611
578
  const parsedMarketPoolObjects = parseMarketPoolObjects(requiredObjects);
612
579
  const parsedMarketPoolData = parseOriginMarketPoolData(
613
580
  parsedMarketPoolObjects
@@ -1,6 +1,6 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import { minBigNumber, estimatedFactor } from 'src/utils';
3
- import type { ScallopQuery } from '../models';
3
+ import type { ScallopQuery } from 'src/models';
4
4
  import type {
5
5
  Market,
6
6
  MarketPool,
@@ -16,7 +16,7 @@ import type {
16
16
  ObligationBorrowIncentiveReward,
17
17
  MarketPools,
18
18
  MarketCollaterals,
19
- } from '../types';
19
+ } from 'src/types';
20
20
  import { SuiObjectRef } from '@mysten/sui/client';
21
21
  import { queryMultipleObjects } from './objectsQuery';
22
22
  import { normalizeStructTag, SUI_TYPE_ARG } from '@scallop-io/sui-kit';
@@ -5,9 +5,9 @@ import {
5
5
  parseOriginSpoolRewardPoolData,
6
6
  calculateSpoolRewardPoolData,
7
7
  parseObjectAs,
8
- } from '../utils';
8
+ } from 'src/utils';
9
9
  import type { SuiObjectData, SuiObjectResponse } from '@mysten/sui/client';
10
- import type { ScallopQuery, ScallopUtils } from '../models';
10
+ import type { ScallopQuery, ScallopUtils } from 'src/models';
11
11
  import type {
12
12
  Spools,
13
13
  Spool,
@@ -19,97 +19,99 @@ import type {
19
19
  OriginSpoolRewardPoolData,
20
20
  SpoolData,
21
21
  OriginSpoolData,
22
- } from '../types';
22
+ } from 'src/types';
23
23
  import { queryMultipleObjects } from './objectsQuery';
24
24
 
25
25
  const queryRequiredSpoolObjects = async (
26
26
  query: ScallopQuery,
27
27
  stakePoolCoinNames: string[]
28
28
  ) => {
29
- // Prepare all tasks for querying each object type
30
- const tasks = stakePoolCoinNames.map((t, idx) => ({
31
- poolCoinName: stakePoolCoinNames[idx],
32
- spool: query.constants.poolAddresses[t]?.spool,
33
- spoolReward: query.constants.poolAddresses[t]?.spoolReward,
34
- sCoinTreasury: query.constants.poolAddresses[t]?.sCoinTreasury,
35
- }));
36
-
37
- // Query all objects for each key in parallel
29
+ // Phase 1: Single-pass data preparation
30
+ type KeyType = {
31
+ spool?: string;
32
+ spoolReward?: string;
33
+ sCoinTreasury?: string;
34
+ };
35
+
36
+ const keyCollections: Record<keyof KeyType, string[]> = {
37
+ spool: [],
38
+ spoolReward: [],
39
+ sCoinTreasury: [],
40
+ };
41
+
42
+ const taskMap = new Map<string, KeyType>();
43
+
44
+ // Single iteration to collect all keys
45
+ for (const poolCoinName of stakePoolCoinNames) {
46
+ const poolData = query.constants.poolAddresses[poolCoinName];
47
+ const task: KeyType = {
48
+ spool: poolData?.spool,
49
+ spoolReward: poolData?.spoolReward,
50
+ sCoinTreasury: poolData?.sCoinTreasury,
51
+ };
52
+
53
+ // Add to key collections
54
+ (Object.entries(task) as [keyof KeyType, string | undefined][]).forEach(
55
+ ([key, value]) => {
56
+ if (value) keyCollections[key].push(value);
57
+ }
58
+ );
59
+
60
+ taskMap.set(poolCoinName, task);
61
+ }
62
+
63
+ // Phase 2: Parallel queries with pre-collected keys
38
64
  const [spoolObjects, spoolRewardObjects, sCoinTreasuryObjects] =
39
65
  await Promise.all([
40
- queryMultipleObjects(
41
- query.cache,
42
- tasks.map((task) => task.spool).filter((t): t is string => !!t)
43
- ),
44
- queryMultipleObjects(
45
- query.cache,
46
- tasks.map((task) => task.spoolReward).filter((t): t is string => !!t)
47
- ),
48
- queryMultipleObjects(
49
- query.cache,
50
- tasks.map((task) => task.sCoinTreasury).filter((t): t is string => !!t)
51
- ),
66
+ queryMultipleObjects(query.cache, keyCollections.spool),
67
+ queryMultipleObjects(query.cache, keyCollections.spoolReward),
68
+ queryMultipleObjects(query.cache, keyCollections.sCoinTreasury),
52
69
  ]);
53
70
 
54
- // Map the results back to poolCoinNames
55
- const mapObjects = (
56
- tasks: { poolCoinName: string; [key: string]: string | undefined }[],
57
- fetchedObjects: SuiObjectData[],
58
- keyValue: string
59
- ) => {
60
- const resultMap: Record<string, SuiObjectData> = {};
61
- const fetchedObjectMap = fetchedObjects.reduce(
62
- (acc, obj) => {
63
- acc[obj.objectId] = obj;
64
- return acc;
65
- },
66
- {} as Record<string, SuiObjectData>
67
- );
71
+ // Phase 3: Create lookup maps
72
+ const createObjectMap = (objects: SuiObjectData[]) =>
73
+ new Map(objects.map((obj) => [obj.objectId, obj]));
68
74
 
69
- for (const task of tasks) {
70
- if (task[keyValue]) {
71
- resultMap[task.poolCoinName] = fetchedObjectMap[task[keyValue]];
72
- }
73
- }
74
- return resultMap;
75
+ const objectMaps = {
76
+ spool: createObjectMap(spoolObjects),
77
+ spoolReward: createObjectMap(spoolRewardObjects),
78
+ sCoinTreasury: createObjectMap(sCoinTreasuryObjects),
75
79
  };
76
80
 
77
- const spoolMap = mapObjects(tasks, spoolObjects, 'spool');
78
- const spoolRewardMap = mapObjects(tasks, spoolRewardObjects, 'spoolReward');
79
- const sCoinTreasuryMap = mapObjects(
80
- tasks,
81
- sCoinTreasuryObjects,
82
- 'sCoinTreasury'
83
- );
81
+ // Phase 4: Build result in single pass
82
+ const result: Record<string, any> = {};
83
+ for (const [poolCoinName, task] of taskMap) {
84
+ result[poolCoinName] = {
85
+ spool: task.spool ? objectMaps.spool.get(task.spool) : undefined,
86
+ spoolReward: task.spoolReward
87
+ ? objectMaps.spoolReward.get(task.spoolReward)
88
+ : undefined,
89
+ sCoinTreasury: task.sCoinTreasury
90
+ ? objectMaps.sCoinTreasury.get(task.sCoinTreasury)
91
+ : undefined,
92
+ };
93
+ }
84
94
 
85
- // Construct the final requiredObjects result
86
- return stakePoolCoinNames.reduce(
87
- (acc, name) => {
88
- acc[name] = {
89
- spool: spoolMap[name],
90
- spoolReward: spoolRewardMap[name],
91
- sCoinTreasury: sCoinTreasuryMap[name],
92
- };
93
- return acc;
94
- },
95
- {} as Record<
96
- string,
97
- {
98
- spool: SuiObjectData;
99
- spoolReward: SuiObjectData;
100
- sCoinTreasury: SuiObjectData;
101
- }
102
- >
103
- );
95
+ return result as Record<
96
+ string,
97
+ {
98
+ spool?: SuiObjectData;
99
+ spoolReward?: SuiObjectData;
100
+ sCoinTreasury?: SuiObjectData;
101
+ }
102
+ >;
104
103
  };
105
104
 
106
105
  const parseSpoolObjects = ({
107
106
  spool,
108
107
  spoolReward,
109
108
  }: {
110
- spool: SuiObjectData;
111
- spoolReward: SuiObjectData;
109
+ spool?: SuiObjectData;
110
+ spoolReward?: SuiObjectData;
112
111
  }): OriginSpoolData & OriginSpoolRewardPoolData => {
112
+ if (!spool || !spoolReward) {
113
+ throw new Error('spool or spoolReward is undefined');
114
+ }
113
115
  const _spool = parseObjectAs<SpoolData>(spool);
114
116
  const _spoolReward = parseObjectAs<OriginSpoolRewardPoolData>(spoolReward);
115
117
  return {
@@ -222,8 +224,8 @@ export const getSpool = async (
222
224
  indexer: boolean = false,
223
225
  coinPrices?: CoinPrices,
224
226
  requiredObjects?: {
225
- spool: SuiObjectData;
226
- spoolReward: SuiObjectData;
227
+ spool?: SuiObjectData;
228
+ spoolReward?: SuiObjectData;
227
229
  }
228
230
  ) => {
229
231
  const coinName = query.utils.parseCoinName<string>(marketCoinName);
@@ -1,11 +1,11 @@
1
1
  import BigNumber from 'bignumber.js';
2
- import { VeScaTreasuryFields, VeScaTreasuryInfo, Vesca } from '../types';
2
+ import { VeScaTreasuryFields, VeScaTreasuryInfo, Vesca } from 'src/types';
3
3
  import {
4
4
  type SuiObjectResponse,
5
5
  type SuiObjectData,
6
6
  DevInspectResults,
7
7
  } from '@mysten/sui/client';
8
- import type { ScallopUtils } from '../models';
8
+ import type { ScallopUtils } from 'src/models';
9
9
  import { MAX_LOCK_DURATION } from 'src/constants';
10
10
  import { SUI_CLOCK_OBJECT_ID, SuiTxBlock } from '@scallop-io/sui-kit';
11
11
  import { bcs } from '@mysten/sui/bcs';
@@ -108,6 +108,9 @@ export interface AddressesInterface {
108
108
  table: string;
109
109
  treasury: string;
110
110
  config: string;
111
+ subsTable: string;
112
+ subsTableId: string;
113
+ subsWhitelist: string;
111
114
  };
112
115
  referral: {
113
116
  id: string;
@@ -2,13 +2,6 @@ import { SuiTxBlock as SuiKitTxBlock, SuiObjectArg } from '@scallop-io/sui-kit';
2
2
  import type { TransactionResult } from '@mysten/sui/transactions';
3
3
  import { ScallopBuilder } from 'src/models';
4
4
 
5
- export type VescaIds = {
6
- pkgId: string;
7
- table: string;
8
- treasury: string;
9
- config: string;
10
- };
11
-
12
5
  export type VeScaNormalMethods = {
13
6
  lockSca: (
14
7
  scaCoin: SuiObjectArg,
@@ -26,9 +19,17 @@ export type VeScaNormalMethods = {
26
19
  ) => void;
27
20
  redeemSca: (veScaKey: SuiObjectArg) => TransactionResult;
28
21
  mintEmptyVeSca: () => TransactionResult;
22
+ splitVeSca: (
23
+ veScaKey: SuiObjectArg,
24
+ splitAmount: string
25
+ ) => TransactionResult;
26
+ mergeVeSca: (
27
+ targetVeScaKey: SuiObjectArg,
28
+ sourceVeScaKey: SuiObjectArg
29
+ ) => void;
29
30
  };
30
31
 
31
- export type RedeemScaQuickReturnType<T extends boolean> = T extends true
32
+ export type QuickMethodReturnType<T extends boolean> = T extends true
32
33
  ? void
33
34
  : TransactionResult | undefined;
34
35
 
@@ -71,9 +72,18 @@ export type VeScaQuickMethods = {
71
72
  autoCheck?: boolean
72
73
  ) => Promise<void>;
73
74
  redeemScaQuick: <T extends boolean>(
74
- veSCaKey?: SuiObjectArg,
75
+ veScaKey?: SuiObjectArg,
75
76
  transferSca?: T
76
- ) => Promise<RedeemScaQuickReturnType<T>>;
77
+ ) => Promise<QuickMethodReturnType<T>>;
78
+ splitVeScaQuick: <T extends boolean>(
79
+ splitAmount: string,
80
+ veScaKey: string,
81
+ transferVeScaKey?: T
82
+ ) => Promise<QuickMethodReturnType<T>>;
83
+ mergeVeScaQuick: (
84
+ targetVeScaKey: string,
85
+ sourceVeScaKey: string
86
+ ) => Promise<void>;
77
87
  };
78
88
 
79
89
  export type SuiTxBlockWithVeScaNormalMethods = SuiKitTxBlock &
@@ -7,7 +7,7 @@ import type {
7
7
  ScallopUtils,
8
8
  ScallopBuilder,
9
9
  ScallopIndexer,
10
- } from '../models';
10
+ } from 'src/models';
11
11
  import { ScallopCache } from 'src/models/scallopCache';
12
12
  import { AddressesInterface } from './address';
13
13
  import { QueryClient, QueryClientConfig } from '@tanstack/query-core';
@@ -74,6 +74,7 @@ export type ScallopCacheParams = {
74
74
  walletAddress?: string;
75
75
  cacheOptions?: QueryClientConfig;
76
76
  config?: ScallopCacheConfig;
77
+ tokensPerSecond?: number; // for rate limit
77
78
  } & Partial<SuiKitParams>;
78
79
 
79
80
  export type ScallopIndexerParams = ScallopCacheParams & {
@@ -5,7 +5,7 @@ import {
5
5
  MAX_LOCK_ROUNDS,
6
6
  MIN_INITIAL_LOCK_AMOUNT,
7
7
  MIN_TOP_UP_AMOUNT,
8
- } from '../constants';
8
+ } from 'src/constants';
9
9
  import type { SuiObjectArg } from '@scallop-io/sui-kit';
10
10
 
11
11
  /**