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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "2.1.1-merge-split-ve-sca-alpha.1",
3
+ "version": "2.1.1",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -3,8 +3,8 @@ import {
3
3
  SuiTxBlock as SuiKitTxBlock,
4
4
  SUI_CLOCK_OBJECT_ID,
5
5
  } from '@scallop-io/sui-kit';
6
- import { getObligations, getObligationLocked } from 'src/queries';
7
- import { requireSender } from 'src/utils';
6
+ import { getObligations, getObligationLocked } from '../queries';
7
+ import { requireSender } from '../utils';
8
8
  import type { SuiObjectArg } from '@scallop-io/sui-kit';
9
9
  import type { ScallopBuilder } from 'src/models';
10
10
  import type {
@@ -14,7 +14,8 @@ import type {
14
14
  SuiTxBlockWithBorrowIncentiveNormalMethods,
15
15
  BorrowIncentiveTxBlock,
16
16
  ScallopTxBlock,
17
- } from 'src/types';
17
+ VescaIds,
18
+ } from '../types';
18
19
  import { OLD_BORROW_INCENTIVE_PROTOCOL_ID } from 'src/constants';
19
20
 
20
21
  /**
@@ -88,7 +89,7 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
88
89
  obligationAccessStore: builder.address.get('core.obligationAccessStore'),
89
90
  };
90
91
 
91
- const veScaIds = {
92
+ const veScaIds: Omit<VescaIds, 'pkgId'> = {
92
93
  table: builder.address.get('vesca.table'),
93
94
  treasury: builder.address.get('vesca.treasury'),
94
95
  config: builder.address.get('vesca.config'),
@@ -119,7 +120,7 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
119
120
  stakeObligationWithVesca: (obligationId, obligationKey, veScaKey) => {
120
121
  builder.moveCall(
121
122
  txBlock,
122
- `${borrowIncentiveIds.borrowIncentivePkg}::user::stake_with_ve_sca_v2`,
123
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::stake_with_ve_sca`,
123
124
  [
124
125
  borrowIncentiveIds.config,
125
126
  borrowIncentiveIds.incentivePools,
@@ -131,8 +132,6 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
131
132
  veScaIds.treasury,
132
133
  veScaIds.table,
133
134
  veScaKey,
134
- builder.address.get('vesca.subsTable'),
135
- builder.address.get('vesca.subsWhitelist'),
136
135
  clockObjectRef,
137
136
  ],
138
137
  []
@@ -141,15 +140,13 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
141
140
  unstakeObligation: (obligationId, obligationKey) => {
142
141
  builder.moveCall(
143
142
  txBlock,
144
- `${borrowIncentiveIds.borrowIncentivePkg}::user::unstake_v2`,
143
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::unstake`,
145
144
  [
146
145
  borrowIncentiveIds.config,
147
146
  borrowIncentiveIds.incentivePools,
148
147
  borrowIncentiveIds.incentiveAccounts,
149
148
  obligationKey,
150
149
  obligationId,
151
- builder.address.get('vesca.subsTable'),
152
- builder.address.get('vesca.subsWhitelist'),
153
150
  clockObjectRef,
154
151
  ]
155
152
  );
@@ -173,15 +170,13 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
173
170
  deactivateBoost: (obligation, veScaKey) => {
174
171
  builder.moveCall(
175
172
  txBlock,
176
- `${borrowIncentiveIds.borrowIncentivePkg}::user::deactivate_boost_v2`,
173
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::deactivate_boost`,
177
174
  [
178
175
  borrowIncentiveIds.config,
179
176
  borrowIncentiveIds.incentivePools,
180
177
  borrowIncentiveIds.incentiveAccounts,
181
178
  obligation,
182
179
  veScaKey,
183
- builder.address.get('vesca.subsTable'),
184
- builder.address.get('vesca.subsWhitelist'),
185
180
  clockObjectRef,
186
181
  ]
187
182
  );
@@ -222,8 +217,6 @@ const generateBorrowIncentiveQuickMethod: GenerateBorrowIncentiveQuickMethod =
222
217
  txn.kind === 'MoveCall' &&
223
218
  (txn.target ===
224
219
  `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` ||
225
- txn.target ===
226
- `${builder.address.get('borrowIncentive.id')}::user::unstake_v2` ||
227
220
  txn.target ===
228
221
  `${builder.address.get('borrowIncentive.id')}::user::unstake`)
229
222
  );
@@ -254,8 +247,6 @@ const generateBorrowIncentiveQuickMethod: GenerateBorrowIncentiveQuickMethod =
254
247
  txn.kind === 'MoveCall' &&
255
248
  (txn.target ===
256
249
  `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` ||
257
- txn.target ===
258
- `${builder.address.get('borrowIncentive.id')}::user::unstake_v2` ||
259
250
  txn.target ===
260
251
  `${builder.address.get('borrowIncentive.id')}::user::unstake`)
261
252
  );
@@ -5,7 +5,7 @@ import { getObligations } from '../queries';
5
5
  import { updateOracles } from './oracles';
6
6
  import { requireSender } from '../utils';
7
7
  import type { SuiObjectArg, TransactionResult } from '@scallop-io/sui-kit';
8
- import type { ScallopBuilder } from 'src/models';
8
+ import type { ScallopBuilder } from '../models';
9
9
  import type {
10
10
  CoreIds,
11
11
  GenerateCoreNormalMethod,
@@ -15,7 +15,7 @@ import type {
15
15
  ScallopTxBlock,
16
16
  NestedResult,
17
17
  SuiTxBlockWithSpool,
18
- } from 'src/types';
18
+ } from '../types';
19
19
 
20
20
  /**
21
21
  * Check and get Obligation information from transaction block.
@@ -4,8 +4,8 @@ import { newCoreTxBlock } from './coreBuilder';
4
4
  import { newSpoolTxBlock } from './spoolBuilder';
5
5
  import { newBorrowIncentiveTxBlock } from './borrowIncentiveBuilder';
6
6
  import { newVeScaTxBlock } from './vescaBuilder';
7
- import type { ScallopBuilder } from 'src/models';
8
- import type { ScallopTxBlock } from 'src/types';
7
+ import type { ScallopBuilder } from '../models';
8
+ import type { ScallopTxBlock } from '../types';
9
9
  import { newReferralTxBlock } from './referralBuilder';
10
10
  import { newLoyaltyProgramTxBlock } from './loyaltyProgramBuilder';
11
11
  import { newSCoinTxBlock } from './sCoinBuilder';
@@ -5,7 +5,7 @@ import { getStakeAccounts } from '../queries/spoolQuery';
5
5
  import { requireSender } from '../utils';
6
6
  import type { SuiAddressArg } from '@scallop-io/sui-kit';
7
7
  import type { TransactionResult } from '@mysten/sui/transactions';
8
- import type { ScallopBuilder } from 'src/models';
8
+ import type { ScallopBuilder } from '../models';
9
9
  import type {
10
10
  SpoolIds,
11
11
  GenerateSpoolNormalMethod,
@@ -14,7 +14,7 @@ import type {
14
14
  SpoolTxBlock,
15
15
  ScallopTxBlock,
16
16
  SuiTxBlockWithSCoin,
17
- } from 'src/types';
17
+ } from '../types';
18
18
 
19
19
  /**
20
20
  * Check and get stake account id from transaction block.
@@ -5,8 +5,8 @@ import {
5
5
  SuiTxBlock as SuiKitTxBlock,
6
6
  } from '@scallop-io/sui-kit';
7
7
  import { SCA_COIN_TYPE } from 'src/constants';
8
- import { ScallopBuilder } from 'src/models';
9
- import { getVeSca, getVeScas } from 'src/queries';
8
+ import { ScallopBuilder } from '../models';
9
+ import { getVeSca, getVeScas } from '../queries';
10
10
  import {
11
11
  requireSender,
12
12
  checkLockSca,
@@ -14,19 +14,19 @@ import {
14
14
  checkExtendLockAmount,
15
15
  checkRenewExpiredVeSca,
16
16
  checkVesca,
17
- } from 'src/utils';
17
+ } from '../utils';
18
18
  import type {
19
19
  TransactionObjectArgument,
20
20
  SuiObjectArg,
21
21
  } from '@scallop-io/sui-kit';
22
22
  import type {
23
- AddressesInterface,
24
23
  GenerateVeScaNormalMethod,
25
24
  GenerateVeScaQuickMethod,
26
- QuickMethodReturnType,
25
+ RedeemScaQuickReturnType,
27
26
  ScallopTxBlock,
28
27
  SuiTxBlockWithVeScaNormalMethods,
29
28
  VeScaTxBlock,
29
+ VescaIds,
30
30
  } from 'src/types';
31
31
 
32
32
  /**
@@ -70,27 +70,6 @@ export const requireVeSca = async (
70
70
  return veScaKey ? veScas.find(({ keyId }) => veScaKey === keyId) : veScas[0];
71
71
  };
72
72
 
73
- export const isInSubsTable = async (
74
- ...params: [builder: ScallopBuilder, veScaKey: string, tableId: string]
75
- ) => {
76
- const [builder, veScaKey, tableId] = params;
77
- try {
78
- const resp = await builder.scallopSuiKit.queryGetDynamicFieldObject({
79
- parentId: tableId,
80
- name: {
81
- type: '0x2::object::ID',
82
- value: veScaKey,
83
- },
84
- });
85
- return !!resp?.data;
86
- } catch (e) {
87
- console.error(e);
88
- return false;
89
- }
90
- };
91
-
92
- type VeScaProps = 'id' | 'table' | 'treasury' | 'config' | 'subsTable';
93
-
94
73
  /**
95
74
  * Generate veSCA normal methods.
96
75
  *
@@ -102,14 +81,12 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
102
81
  builder,
103
82
  txBlock,
104
83
  }) => {
105
- const veScaIds: Pick<AddressesInterface['vesca'], VeScaProps> = {
106
- id: builder.address.get('vesca.id'),
84
+ const veScaIds: VescaIds = {
85
+ pkgId: builder.address.get('vesca.id'),
107
86
  table: builder.address.get('vesca.table'),
108
87
  treasury: builder.address.get('vesca.treasury'),
109
88
  config: builder.address.get('vesca.config'),
110
- subsTable: builder.address.get('vesca.subsTable'),
111
89
  };
112
-
113
90
  const clockObjectRef = txBlock.sharedObjectRef({
114
91
  objectId: SUI_CLOCK_OBJECT_ID,
115
92
  mutable: false,
@@ -120,7 +97,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
120
97
  lockSca: (scaCoin, unlockAtInSecondTimestamp) => {
121
98
  return builder.moveCall(
122
99
  txBlock,
123
- `${veScaIds.id}::ve_sca::mint_ve_sca_key`,
100
+ `${veScaIds.pkgId}::ve_sca::mint_ve_sca_key`,
124
101
  [
125
102
  veScaIds.config,
126
103
  veScaIds.table,
@@ -135,7 +112,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
135
112
  extendLockPeriod: (veScaKey, newUnlockAtInSecondTimestamp) => {
136
113
  builder.moveCall(
137
114
  txBlock,
138
- `${veScaIds.id}::ve_sca::extend_lock_period`,
115
+ `${veScaIds.pkgId}::ve_sca::extend_lock_period`,
139
116
  [
140
117
  veScaIds.config,
141
118
  veScaKey,
@@ -150,7 +127,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
150
127
  extendLockAmount: (veScaKey, scaCoin) => {
151
128
  builder.moveCall(
152
129
  txBlock,
153
- `${veScaIds.id}::ve_sca::lock_more_sca`,
130
+ `${veScaIds.pkgId}::ve_sca::lock_more_sca`,
154
131
  [
155
132
  veScaIds.config,
156
133
  veScaKey,
@@ -165,7 +142,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
165
142
  renewExpiredVeSca: (veScaKey, scaCoin, newUnlockAtInSecondTimestamp) => {
166
143
  builder.moveCall(
167
144
  txBlock,
168
- `${veScaIds.id}::ve_sca::renew_expired_ve_sca`,
145
+ `${veScaIds.pkgId}::ve_sca::renew_expired_ve_sca`,
169
146
  [
170
147
  veScaIds.config,
171
148
  veScaKey,
@@ -181,7 +158,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
181
158
  redeemSca: (veScaKey) => {
182
159
  return builder.moveCall(
183
160
  txBlock,
184
- `${veScaIds.id}::ve_sca::redeem`,
161
+ `${veScaIds.pkgId}::ve_sca::redeem`,
185
162
  [
186
163
  veScaIds.config,
187
164
  veScaKey,
@@ -195,39 +172,11 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
195
172
  mintEmptyVeSca: () => {
196
173
  return builder.moveCall(
197
174
  txBlock,
198
- `${veScaIds.id}::ve_sca::mint_ve_sca_placeholder_key`,
175
+ `${veScaIds.pkgId}::ve_sca::mint_ve_sca_placeholder_key`,
199
176
  [veScaIds.config, veScaIds.table],
200
177
  []
201
178
  );
202
179
  },
203
- splitVeSca: (veScaKey, splitAmount) => {
204
- return builder.moveCall(txBlock, `${veScaIds.id}::ve_sca::split`, [
205
- veScaIds.config,
206
- veScaKey,
207
- veScaIds.table,
208
- veScaIds.subsTable,
209
- txBlock.pure.u64(splitAmount),
210
- ]);
211
- },
212
- mergeVeSca: (targetKey, sourceKey) => {
213
- return builder.moveCall(
214
- txBlock,
215
- `${veScaIds.id}::ve_sca::merge`,
216
- [
217
- veScaIds.config,
218
- targetKey,
219
- sourceKey,
220
- veScaIds.table,
221
- veScaIds.subsTable,
222
- txBlock.sharedObjectRef({
223
- objectId: SUI_CLOCK_OBJECT_ID,
224
- mutable: false,
225
- initialSharedVersion: '1',
226
- }),
227
- ],
228
- []
229
- );
230
- },
231
180
  };
232
181
  };
233
182
 
@@ -413,75 +362,8 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
413
362
  txBlock.transferObjects([sca], sender);
414
363
  return;
415
364
  }
416
- return sca as QuickMethodReturnType<S>;
417
- }
418
- },
419
- splitVeScaQuick: async <S extends boolean>(
420
- splitAmount: string,
421
- veScaKey: string,
422
- transferVeScaKey: S = true as S
423
- ) => {
424
- const isKeyInSubTable = await isInSubsTable(
425
- builder,
426
- veScaKey,
427
- builder.address.get('vesca.subsTable')
428
- );
429
-
430
- const unstakeObligationBeforeStake =
431
- !!txBlock.txBlock.blockData.transactions.find(
432
- (txn) =>
433
- txn.kind === 'MoveCall' &&
434
- txn.target ===
435
- `${builder.address.get('borrowIncentive.id')}::user::unstake_v2`
436
- );
437
-
438
- if (isKeyInSubTable && !unstakeObligationBeforeStake) {
439
- throw new Error(
440
- 'Key cannot be in the subs table, please call unsubscribe vesca or unstake obligation first'
441
- );
365
+ return sca as RedeemScaQuickReturnType<S>;
442
366
  }
443
-
444
- const newVeScaKey = txBlock.splitVeSca(veScaKey, splitAmount);
445
- if (transferVeScaKey) {
446
- txBlock.transferObjects([newVeScaKey], requireSender(txBlock));
447
- return;
448
- } else {
449
- return newVeScaKey as QuickMethodReturnType<S>;
450
- }
451
- },
452
- mergeVeScaQuick: async (targetKey: string, sourceKey: string) => {
453
- // check targetKey and sourceKey
454
- const [isTargetInSubTable, isSourceInSubTable] = await Promise.all([
455
- isInSubsTable(
456
- builder,
457
- targetKey,
458
- builder.address.get('vesca.subsTableId')
459
- ),
460
- isInSubsTable(
461
- builder,
462
- sourceKey,
463
- builder.address.get('vesca.subsTableId')
464
- ),
465
- ]);
466
-
467
- const unstakeObligationBeforeStake =
468
- !!txBlock.txBlock.blockData.transactions.find(
469
- (txn) =>
470
- txn.kind === 'MoveCall' &&
471
- txn.target ===
472
- `${builder.address.get('borrowIncentive.id')}::user::unstake_v2`
473
- );
474
-
475
- if (
476
- (isTargetInSubTable || isSourceInSubTable) &&
477
- !unstakeObligationBeforeStake
478
- ) {
479
- throw new Error(
480
- 'Both target and source cannot be in the subs table. Please call unsubscribe vesca or unstake obligation first'
481
- );
482
- }
483
-
484
- return txBlock.mergeVeSca(targetKey, sourceKey);
485
367
  },
486
368
  };
487
369
  };
@@ -256,24 +256,18 @@ export const TEST_ADDRESSES: AddressesInterface = {
256
256
  '0x9636e7b947b806b9fe438d037f02bb24026c5b2691d2f6bad349c2e117f77cc3',
257
257
  },
258
258
  vesca: {
259
- id: '0x0c7f5568dbd69488437ee95f2d9a028724e1de12432965ff8acca7c67310ba46',
259
+ id: '0x1158813b32962c2d22888fae257d5f2365b03631f0cd5d5b912ccdf51ff4e2f2',
260
260
  object:
261
- '0x0c7f5568dbd69488437ee95f2d9a028724e1de12432965ff8acca7c67310ba46',
261
+ '0xcfe2d87aa5712b67cad2732edb6a2201bfdf592377e5c0968b7cb02099bd8e21',
262
262
  adminCap:
263
263
  '0x4d105b16467acca81d18c132cdd1a3cee159920a86c1ef4bdbf2e8d7878500c5',
264
264
  tableId:
265
- '0x06f763060ea5da3d639fb56df70674490a8354511cfe61584062aafd83b1940d',
266
- table: '0x06f763060ea5da3d639fb56df70674490a8354511cfe61584062aafd83b1940d',
265
+ '0x0a0b7f749baeb61e3dfee2b42245e32d0e6b484063f0a536b33e771d573d7246',
266
+ table: '0xd3a4632b1080f7d96e1c2487d4dabf2c1196916937c505a69954ac9f393be8d0',
267
267
  treasury:
268
- '0x934919cc31fa89b67578039bb10d5518fa23c50bc8f78500f1d1a718407a0a71',
268
+ '0xafa4b6231e49c15a22d641ce33fda761baaf650fa21899dfa2eb1716146e7306',
269
269
  config:
270
- '0x38d3f7a1fa5071226535d4d8bfca8ccab3d24871402df1be669d7d5e9e3e9cb4',
271
- subsTable:
272
- '0x4756b716670ff62760b22bebed73c6eb2c2cb118674a2eea3a56ebea9e27ae76',
273
- subsTableId:
274
- '0x924b56d383b45445984a80002185b670aa2e72cd7df496d345f45f9407a12c07',
275
- subsWhitelist:
276
- '0xfc72adae643da4f2fe080adc1e2cca981eadcb518facb02324eeaab169752ffb',
270
+ '0x7cbcb0a342179577a117dfdff974cf1ab765d3b571067bf22ddf5f9e3a667922',
277
271
  },
278
272
  referral: {
279
273
  id: '0x1bf5a8ce77050d8052549d743e16b469f15aa6b81b752b78b6ebb65179665f5a',
@@ -335,9 +335,6 @@ const EMPTY_ADDRESSES: AddressesInterface = {
335
335
  table: '',
336
336
  treasury: '',
337
337
  config: '',
338
- subsTable: '',
339
- subsTableId: '',
340
- subsWhitelist: '',
341
338
  },
342
339
  referral: {
343
340
  id: '',
@@ -28,7 +28,7 @@ export type ScallopConstantsParams = {
28
28
  poolAddressesApiUrl?: string;
29
29
  whitelistApiUrl?: string;
30
30
  forcePoolAddressInterface?: Record<string, PoolAddress>;
31
- forceWhitelistInterface?: Whitelist;
31
+ forceWhitelistInterface?: Whitelist | Record<string, any>;
32
32
  } & ScallopAddressParams;
33
33
 
34
34
  const DEFAULT_WHITELIST = {
@@ -48,6 +48,18 @@ const DEFAULT_WHITELIST = {
48
48
  emerging: new Set(),
49
49
  } as Whitelist;
50
50
 
51
+ const parseWhitelistParams = (params: Record<string, any> | Whitelist) => {
52
+ return Object.entries(params)
53
+ .filter(
54
+ ([_, value]) => !!value && (Array.isArray(value) || value instanceof Set)
55
+ )
56
+ .reduce((acc, [key, value]) => {
57
+ acc[key as keyof typeof DEFAULT_WHITELIST] =
58
+ value instanceof Set ? value : new Set(value);
59
+ return acc;
60
+ }, {} as Whitelist);
61
+ };
62
+
51
63
  class ScallopConstants extends ScallopAddress {
52
64
  private _poolAddresses: Record<string, PoolAddress | undefined> = {};
53
65
  private _whitelist: Whitelist = DEFAULT_WHITELIST;
@@ -144,7 +156,7 @@ class ScallopConstants extends ScallopAddress {
144
156
  networkType?: NetworkType;
145
157
  } = {}) {
146
158
  const addresses = this.getAddresses(networkType);
147
- return !addresses || isEmptyObject(addresses);
159
+ return !!addresses && !isEmptyObject(addresses);
148
160
  }
149
161
 
150
162
  parseToOldMarketCoin(coinType: string) {
@@ -174,10 +186,13 @@ class ScallopConstants extends ScallopAddress {
174
186
  }
175
187
 
176
188
  if (constantsParams.forceWhitelistInterface) {
177
- this._whitelist = constantsParams.forceWhitelistInterface;
189
+ this._whitelist = parseWhitelistParams(
190
+ constantsParams.forceWhitelistInterface
191
+ );
178
192
  }
179
193
 
180
194
  if (this.isInitialized && !force) {
195
+ this.initConstants();
181
196
  return;
182
197
  }
183
198
 
@@ -5,7 +5,7 @@ import {
5
5
  parseOriginMarketCollateralData,
6
6
  calculateMarketCollateralData,
7
7
  parseObjectAs,
8
- } from 'src/utils';
8
+ } from '../utils';
9
9
  import type {
10
10
  SuiObjectResponse,
11
11
  SuiObjectData,
@@ -32,7 +32,7 @@ import {
32
32
  BorrowFee,
33
33
  BorrowDynamic,
34
34
  OriginMarketCollateralData,
35
- } from 'src/types';
35
+ } from '../types';
36
36
  import BigNumber from 'bignumber.js';
37
37
  import { getSupplyLimit } from './supplyLimitQuery';
38
38
  import { isIsolatedAsset } from './isolatedAssetQuery';
@@ -1,6 +1,6 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import { minBigNumber, estimatedFactor } from 'src/utils';
3
- import type { ScallopQuery } from 'src/models';
3
+ import type { ScallopQuery } from '../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 'src/types';
19
+ } from '../types';
20
20
  import { SuiObjectRef } from '@mysten/sui/client';
21
21
  import { normalizeStructTag, SUI_TYPE_ARG } from '@scallop-io/sui-kit';
22
22
 
@@ -821,7 +821,6 @@ export const getTotalValueLocked = async (
821
821
  );
822
822
  }
823
823
 
824
- // console.dir(market.collaterals, { depth: null });
825
824
  for (const collateral of Object.values(market.collaterals)) {
826
825
  if (!collateral) continue;
827
826
  supplyCollateralValue = supplyCollateralValue.plus(
@@ -5,9 +5,9 @@ import {
5
5
  parseOriginSpoolRewardPoolData,
6
6
  calculateSpoolRewardPoolData,
7
7
  parseObjectAs,
8
- } from 'src/utils';
8
+ } from '../utils';
9
9
  import type { SuiObjectData, SuiObjectResponse } from '@mysten/sui/client';
10
- import type { ScallopQuery, ScallopUtils } from 'src/models';
10
+ import type { ScallopQuery, ScallopUtils } from '../models';
11
11
  import type {
12
12
  Spools,
13
13
  Spool,
@@ -1,11 +1,11 @@
1
1
  import BigNumber from 'bignumber.js';
2
- import { VeScaTreasuryFields, VeScaTreasuryInfo, Vesca } from 'src/types';
2
+ import { VeScaTreasuryFields, VeScaTreasuryInfo, Vesca } from '../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 'src/models';
8
+ import type { ScallopUtils } from '../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,9 +108,6 @@ export interface AddressesInterface {
108
108
  table: string;
109
109
  treasury: string;
110
110
  config: string;
111
- subsTable: string;
112
- subsTableId: string;
113
- subsWhitelist: string;
114
111
  };
115
112
  referral: {
116
113
  id: string;
@@ -2,6 +2,13 @@ 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
+
5
12
  export type VeScaNormalMethods = {
6
13
  lockSca: (
7
14
  scaCoin: SuiObjectArg,
@@ -19,17 +26,9 @@ export type VeScaNormalMethods = {
19
26
  ) => void;
20
27
  redeemSca: (veScaKey: SuiObjectArg) => TransactionResult;
21
28
  mintEmptyVeSca: () => TransactionResult;
22
- splitVeSca: (
23
- veScaKey: SuiObjectArg,
24
- splitAmount: string
25
- ) => TransactionResult;
26
- mergeVeSca: (
27
- targetVeScaKey: SuiObjectArg,
28
- sourceVeScaKey: SuiObjectArg
29
- ) => void;
30
29
  };
31
30
 
32
- export type QuickMethodReturnType<T extends boolean> = T extends true
31
+ export type RedeemScaQuickReturnType<T extends boolean> = T extends true
33
32
  ? void
34
33
  : TransactionResult | undefined;
35
34
 
@@ -72,18 +71,9 @@ export type VeScaQuickMethods = {
72
71
  autoCheck?: boolean
73
72
  ) => Promise<void>;
74
73
  redeemScaQuick: <T extends boolean>(
75
- veScaKey?: SuiObjectArg,
74
+ veSCaKey?: SuiObjectArg,
76
75
  transferSca?: 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>;
76
+ ) => Promise<RedeemScaQuickReturnType<T>>;
87
77
  };
88
78
 
89
79
  export type SuiTxBlockWithVeScaNormalMethods = SuiKitTxBlock &
@@ -5,7 +5,7 @@ import {
5
5
  MAX_LOCK_ROUNDS,
6
6
  MIN_INITIAL_LOCK_AMOUNT,
7
7
  MIN_TOP_UP_AMOUNT,
8
- } from 'src/constants';
8
+ } from '../constants';
9
9
  import type { SuiObjectArg } from '@scallop-io/sui-kit';
10
10
 
11
11
  /**