zo-sdk 0.1.30 → 0.1.31

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 (38) hide show
  1. package/dist/consts/deployments-slp-mainnet.json +1 -1
  2. package/dist/implementations/SLPAPI.cjs +36 -47
  3. package/dist/implementations/SLPAPI.cjs.map +1 -1
  4. package/dist/implementations/SLPAPI.d.cts +5 -4
  5. package/dist/implementations/SLPAPI.d.cts.map +1 -1
  6. package/dist/implementations/SLPAPI.d.mts +5 -4
  7. package/dist/implementations/SLPAPI.d.mts.map +1 -1
  8. package/dist/implementations/SLPAPI.mjs +36 -47
  9. package/dist/implementations/SLPAPI.mjs.map +1 -1
  10. package/dist/implementations/SLPDataAPI.cjs +50 -3
  11. package/dist/implementations/SLPDataAPI.cjs.map +1 -1
  12. package/dist/implementations/SLPDataAPI.d.cts +6 -1
  13. package/dist/implementations/SLPDataAPI.d.cts.map +1 -1
  14. package/dist/implementations/SLPDataAPI.d.mts +6 -1
  15. package/dist/implementations/SLPDataAPI.d.mts.map +1 -1
  16. package/dist/implementations/SLPDataAPI.mjs +50 -3
  17. package/dist/implementations/SLPDataAPI.mjs.map +1 -1
  18. package/dist/implementations/ZLPAPI.cjs.map +1 -1
  19. package/dist/implementations/ZLPAPI.d.cts +2 -1
  20. package/dist/implementations/ZLPAPI.d.cts.map +1 -1
  21. package/dist/implementations/ZLPAPI.d.mts +2 -1
  22. package/dist/implementations/ZLPAPI.d.mts.map +1 -1
  23. package/dist/implementations/ZLPAPI.mjs.map +1 -1
  24. package/dist/interfaces/base.d.cts +4 -3
  25. package/dist/interfaces/base.d.cts.map +1 -1
  26. package/dist/interfaces/base.d.mts +4 -3
  27. package/dist/interfaces/base.d.mts.map +1 -1
  28. package/dist/interfaces/slp.d.cts +21 -0
  29. package/dist/interfaces/slp.d.cts.map +1 -1
  30. package/dist/interfaces/slp.d.mts +21 -0
  31. package/dist/interfaces/slp.d.mts.map +1 -1
  32. package/package.json +1 -1
  33. package/src/consts/deployments-slp-mainnet.json +1 -1
  34. package/src/implementations/SLPAPI.ts +58 -47
  35. package/src/implementations/SLPDataAPI.ts +57 -6
  36. package/src/implementations/ZLPAPI.ts +2 -2
  37. package/src/interfaces/base.ts +10 -3
  38. package/src/interfaces/slp.ts +26 -1
@@ -6,7 +6,8 @@
6
6
  import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
7
7
  import { KioskTransaction } from '@mysten/kiosk'
8
8
  import type { SuiClient } from '@mysten/sui/client'
9
- import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions'
9
+ import type { TransactionObjectArgument } from '@mysten/sui/transactions'
10
+ import { Transaction } from '@mysten/sui/transactions'
10
11
  import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
11
12
 
12
13
  import { BaseAPI } from '../abstract'
@@ -638,35 +639,32 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
638
639
 
639
640
  // Handle oracle initialization and coin processing
640
641
  let suiCoinObject
641
- let feeObject
642
642
  if (sponsoredTx) {
643
643
  suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
644
- feeObject = tx.splitCoins(suiCoinObject, [tx.pure.u64(relayerFee)]) // Sudo contract requires SUI as fee
645
644
  tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject)
646
645
  }
647
646
  else {
648
- feeObject = tx.splitCoins(tx.gas, [tx.pure.u64(relayerFee)]) // Sudo contract requires SUI as fee
649
647
  tx = await this.initOracleTxb([collateralToken, indexToken], tx)
650
648
  }
651
649
 
652
650
  // Process coin splitting
653
- const [depositObject] = this.processCoinSplitting(
651
+ const [depositObject, feeObject] = this.processCoinSplitting(
654
652
  tx,
655
653
  collateralToken,
656
654
  coinObjects,
657
- [tx.pure.u64(collateralAmount)],
655
+ [tx.pure.u64(collateralAmount), tx.pure.u64(relayerFee)],
658
656
  sponsoredTx,
659
657
  suiCoinObject,
660
658
  )
661
659
 
662
660
  tx.moveCall({
663
- target: `${this.consts.sudoCore.upgradedPackage}::market::open_position_v1_2`,
661
+ target: `${this.consts.sudoCore.upgradedPackage}::market::open_position_v2_1`,
664
662
  typeArguments: [
665
663
  `${this.consts.sudoCore.package}::slp::SLP`,
666
664
  this.consts.coins[collateralToken].module,
667
665
  this.consts.coins[indexToken].module,
668
666
  `${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
669
- this.consts.coins.sui.module,
667
+ this.consts.coins[collateralToken].module,
670
668
  ],
671
669
  arguments: [
672
670
  tx.object(SUI_CLOCK_OBJECT_ID),
@@ -685,7 +683,6 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
685
683
  tx.pure.u64(reserveAmount),
686
684
  tx.pure.u256(adjustCollateralPrice),
687
685
  tx.pure.u256(adjustPrice),
688
- tx.pure.bool(isLimitOrder),
689
686
  ],
690
687
  })
691
688
  return tx
@@ -712,6 +709,10 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
712
709
  sponsoredTx?: boolean,
713
710
  suiCoinObjectsForPythUpdate?: string[],
714
711
  ): Promise<Transaction> {
712
+ if (!coinObjects) {
713
+ throw new Error(`${this.constructor.name}: coinObjects is required`)
714
+ }
715
+
715
716
  let tx = new Transaction()
716
717
  const symbol = joinSymbol(long ? 'long' : 'short', indexToken)
717
718
 
@@ -736,25 +737,31 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
736
737
 
737
738
  // Handle oracle initialization and coin processing
738
739
  let suiCoinObject
739
- let feeObject
740
+ const [feeObject] = this.processCoinSplitting(
741
+ tx,
742
+ collateralToken,
743
+ coinObjects,
744
+ [tx.pure.u64(relayerFee)],
745
+ sponsoredTx,
746
+ suiCoinObject,
747
+ )
748
+
740
749
  if (sponsoredTx) {
741
750
  suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
742
- feeObject = tx.splitCoins(suiCoinObject, [tx.pure.u64(relayerFee)]) // Sudo contract requires SUI as fee
743
751
  tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject)
744
752
  }
745
753
  else {
746
- feeObject = tx.splitCoins(tx.gas, [tx.pure.u64(relayerFee)]) // Sudo contract requires SUI as fee
747
754
  tx = await this.initOracleTxb([collateralToken, indexToken], tx)
748
755
  }
749
756
 
750
757
  tx.moveCall({
751
- target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_v1_2`,
758
+ target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_v2_1`,
752
759
  typeArguments: [
753
760
  `${this.consts.sudoCore.package}::slp::SLP`,
754
761
  this.consts.coins[collateralToken].module,
755
762
  this.consts.coins[indexToken].module,
756
763
  `${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
757
- this.consts.coins.sui.module,
764
+ this.consts.coins[collateralToken].module,
758
765
  ],
759
766
  arguments: [
760
767
  tx.object(SUI_CLOCK_OBJECT_ID),
@@ -772,7 +779,6 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
772
779
  tx.pure.u64(amount),
773
780
  tx.pure.u256(adjustCollateralPrice),
774
781
  tx.pure.u256(adjustPrice),
775
- tx.pure.bool(isTriggerOrder),
776
782
  ],
777
783
  })
778
784
 
@@ -856,13 +862,13 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
856
862
  )
857
863
 
858
864
  tx.moveCall({
859
- target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_v1_2`,
865
+ target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_v2_1`,
860
866
  typeArguments: [
861
867
  `${this.consts.sudoCore.package}::slp::SLP`,
862
868
  this.consts.coins[collateralToken].module,
863
869
  this.consts.coins[indexToken].module,
864
870
  `${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
865
- this.consts.coins.sui.module,
871
+ this.consts.coins[collateralToken].module,
866
872
  ],
867
873
  arguments: [
868
874
  tx.object(SUI_CLOCK_OBJECT_ID),
@@ -880,7 +886,6 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
880
886
  tx.pure.u64(amount),
881
887
  tx.pure.u256(adjustCollateralPrice),
882
888
  tx.pure.u256(adjustPrice),
883
- tx.pure.bool(isTriggerOrder),
884
889
  ],
885
890
  })
886
891
  }
@@ -988,16 +993,17 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
988
993
  indexToken: string,
989
994
  long: boolean,
990
995
  type: string,
996
+ isV11Order?: boolean,
991
997
  ): Transaction {
992
998
  const tx = new Transaction()
993
999
  let functionName = ''
994
1000
  switch (type) {
995
1001
  case 'OPEN_POSITION': {
996
- functionName = 'clear_open_position_order_v1_1'
1002
+ functionName = 'clear_open_position_order_unified'
997
1003
  break
998
1004
  }
999
1005
  case 'DECREASE_POSITION': {
1000
- functionName = 'clear_decrease_position_order_v1_1'
1006
+ functionName = 'clear_decrease_position_order_unified'
1001
1007
  break
1002
1008
  }
1003
1009
  default: {
@@ -1011,7 +1017,7 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1011
1017
  this.consts.coins[collateralToken].module,
1012
1018
  this.consts.coins[indexToken].module,
1013
1019
  `${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
1014
- this.consts.coins.sui.module,
1020
+ isV11Order ? this.consts.coins.sui.module : this.consts.coins[collateralToken].module,
1015
1021
  ],
1016
1022
  arguments: [
1017
1023
  tx.object(this.consts.sudoCore.market),
@@ -1037,17 +1043,15 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1037
1043
  }
1038
1044
 
1039
1045
  for (const order of orders) {
1040
- const { orderCapId, collateralToken, indexToken, long, type, isV11Order } = order
1046
+ const { orderCapId, collateralToken, indexToken, long, type } = order
1041
1047
  let functionName = ''
1042
1048
  switch (type) {
1043
1049
  case 'OPEN_POSITION': {
1044
- functionName = isV11Order ? 'clear_open_position_order_v1_1' : 'clear_open_position_order_v1_1'
1050
+ functionName = 'clear_open_position_order_unified'
1045
1051
  break
1046
1052
  }
1047
1053
  case 'DECREASE_POSITION': {
1048
- functionName = isV11Order
1049
- ? 'clear_decrease_position_order_v1_1'
1050
- : 'clear_decrease_position_order_v1_1'
1054
+ functionName = 'clear_decrease_position_order_unified'
1051
1055
  break
1052
1056
  }
1053
1057
  default: {
@@ -1095,15 +1099,16 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1095
1099
  indexToken: string,
1096
1100
  long: boolean,
1097
1101
  tx: Transaction,
1102
+ isV11Order = true,
1098
1103
  ): void {
1099
1104
  tx.moveCall({
1100
- target: `${this.consts.sudoCore.upgradedPackage}::market::clear_open_position_order_v1_1`,
1105
+ target: `${this.consts.sudoCore.upgradedPackage}::market::clear_open_position_order_unified`,
1101
1106
  typeArguments: [
1102
1107
  `${this.consts.sudoCore.package}::slp::SLP`,
1103
1108
  this.consts.coins[collateralToken].module,
1104
1109
  this.consts.coins[indexToken].module,
1105
1110
  `${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
1106
- this.consts.coins.sui.module,
1111
+ isV11Order ? this.consts.coins.sui.module : this.consts.coins[collateralToken].module,
1107
1112
  ],
1108
1113
  arguments: [
1109
1114
  tx.object(this.consts.sudoCore.market),
@@ -1118,15 +1123,16 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1118
1123
  indexToken: string,
1119
1124
  long: boolean,
1120
1125
  tx: Transaction,
1126
+ isV11Order = true,
1121
1127
  ): void {
1122
1128
  tx.moveCall({
1123
- target: `${this.consts.sudoCore.upgradedPackage}::market::clear_decrease_position_order_v1_1`,
1129
+ target: `${this.consts.sudoCore.upgradedPackage}::market::clear_decrease_position_order_unified`,
1124
1130
  typeArguments: [
1125
1131
  `${this.consts.sudoCore.package}::slp::SLP`,
1126
1132
  this.consts.coins[collateralToken].module,
1127
1133
  this.consts.coins[indexToken].module,
1128
1134
  `${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
1129
- this.consts.coins.sui.module,
1135
+ isV11Order ? this.consts.coins.sui.module : this.consts.coins[collateralToken].module,
1130
1136
  ],
1131
1137
  arguments: [
1132
1138
  tx.object(this.consts.sudoCore.market),
@@ -1185,35 +1191,32 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1185
1191
 
1186
1192
  // Handle oracle initialization and coin processing
1187
1193
  let suiCoinObject
1188
- let feeObject
1189
1194
  if (sponsoredTx) {
1190
1195
  suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
1191
- feeObject = tx.splitCoins(suiCoinObject, [tx.pure.u64(relayerFee)]) // Sudo contract requires SUI as fee
1192
1196
  tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject)
1193
1197
  }
1194
1198
  else {
1195
- feeObject = tx.splitCoins(tx.gas, [tx.pure.u64(relayerFee)]) // Sudo contract requires SUI as fee
1196
1199
  tx = await this.initOracleTxb([collateralToken, indexToken], tx)
1197
1200
  }
1198
1201
 
1199
1202
  // Process coin splitting
1200
- const [depositObject] = this.processCoinSplitting(
1203
+ const [depositObject, feeObject] = this.processCoinSplitting(
1201
1204
  tx,
1202
1205
  collateralToken,
1203
1206
  coinObjects,
1204
- [tx.pure.u64(collateralAmount)],
1207
+ [tx.pure.u64(collateralAmount), tx.pure.u64(relayerFee)],
1205
1208
  sponsoredTx,
1206
1209
  suiCoinObject,
1207
1210
  )
1208
1211
 
1209
1212
  tx.moveCall({
1210
- target: `${this.consts.sudoCore.upgradedPackage}::market::open_position_v1_3`,
1213
+ target: `${this.consts.sudoCore.upgradedPackage}::market::open_position_with_scard_v1`,
1211
1214
  typeArguments: [
1212
1215
  `${this.consts.sudoCore.package}::slp::SLP`,
1213
1216
  this.consts.coins[collateralToken].module,
1214
1217
  this.consts.coins[indexToken].module,
1215
1218
  `${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
1216
- this.consts.coins.sui.module,
1219
+ this.consts.coins[collateralToken].module,
1217
1220
  ],
1218
1221
  arguments: [
1219
1222
  tx.object(SUI_CLOCK_OBJECT_ID),
@@ -1232,7 +1235,6 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1232
1235
  tx.pure.u64(reserveAmount),
1233
1236
  tx.pure.u256(adjustCollateralPrice),
1234
1237
  tx.pure.u256(adjustPrice),
1235
- tx.pure.bool(isLimitOrder),
1236
1238
  sudoCard,
1237
1239
  ],
1238
1240
  })
@@ -1268,6 +1270,10 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1268
1270
  sponsoredTx?: boolean,
1269
1271
  suiCoinObjectsForPythUpdate?: string[],
1270
1272
  ): Promise<Transaction> {
1273
+ if (!coinObjects) {
1274
+ throw new Error(`${this.constructor.name}: coinObjects is required`)
1275
+ }
1276
+
1271
1277
  let tx = new Transaction()
1272
1278
  const symbol = joinSymbol(long ? 'long' : 'short', indexToken)
1273
1279
 
@@ -1303,25 +1309,32 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1303
1309
 
1304
1310
  // Handle oracle initialization and coin processing
1305
1311
  let suiCoinObject
1306
- let feeObject
1307
1312
  if (sponsoredTx) {
1308
1313
  suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
1309
- feeObject = tx.splitCoins(suiCoinObject, [tx.pure.u64(relayerFee)]) // Sudo contract requires SUI as fee
1310
1314
  tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject)
1311
1315
  }
1312
1316
  else {
1313
- feeObject = tx.splitCoins(tx.gas, [tx.pure.u64(relayerFee)]) // Sudo contract requires SUI as fee
1314
1317
  tx = await this.initOracleTxb([collateralToken, indexToken], tx)
1315
1318
  }
1316
1319
 
1320
+ // Process coin splitting
1321
+ const [feeObject] = this.processCoinSplitting(
1322
+ tx,
1323
+ collateralToken,
1324
+ coinObjects,
1325
+ [tx.pure.u64(relayerFee)],
1326
+ sponsoredTx,
1327
+ suiCoinObject,
1328
+ )
1329
+
1317
1330
  tx.moveCall({
1318
- target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_v1_3`,
1331
+ target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_with_scard_v1`,
1319
1332
  typeArguments: [
1320
1333
  `${this.consts.sudoCore.package}::slp::SLP`,
1321
1334
  this.consts.coins[collateralToken].module,
1322
1335
  this.consts.coins[indexToken].module,
1323
1336
  `${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
1324
- this.consts.coins.sui.module,
1337
+ this.consts.coins[collateralToken].module,
1325
1338
  ],
1326
1339
  arguments: [
1327
1340
  tx.object(SUI_CLOCK_OBJECT_ID),
@@ -1339,7 +1352,6 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1339
1352
  tx.pure.u64(amount),
1340
1353
  tx.pure.u256(adjustCollateralPrice),
1341
1354
  tx.pure.u256(adjustPrice),
1342
- tx.pure.bool(isTriggerOrder),
1343
1355
  sudoCard,
1344
1356
  ],
1345
1357
  })
@@ -1445,13 +1457,13 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1445
1457
  )
1446
1458
 
1447
1459
  tx.moveCall({
1448
- target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_v1_3`,
1460
+ target: `${this.consts.sudoCore.upgradedPackage}::market::decrease_position_with_scard_v1`,
1449
1461
  typeArguments: [
1450
1462
  `${this.consts.sudoCore.package}::slp::SLP`,
1451
1463
  this.consts.coins[collateralToken].module,
1452
1464
  this.consts.coins[indexToken].module,
1453
1465
  `${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}`,
1454
- this.consts.coins.sui.module,
1466
+ this.consts.coins[collateralToken].module,
1455
1467
  ],
1456
1468
  arguments: [
1457
1469
  tx.object(SUI_CLOCK_OBJECT_ID),
@@ -1469,7 +1481,6 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1469
1481
  tx.pure.u64(amount),
1470
1482
  tx.pure.u256(adjustCollateralPrice),
1471
1483
  tx.pure.u256(adjustPrice),
1472
- tx.pure.bool(isTriggerOrder),
1473
1484
  sudoCard,
1474
1485
  ],
1475
1486
  })
@@ -30,6 +30,7 @@ import type {
30
30
  ISLPReservingFeeModel,
31
31
  ISLPStaked,
32
32
  ISLPStakePool,
33
+ ISLPSymbolConfig,
33
34
  ISLPSymbolInfo,
34
35
  ISLPVaultInfo,
35
36
  } from '../interfaces'
@@ -323,6 +324,28 @@ export class SLPDataAPI extends BaseDataAPI implements ISLPDataAPI {
323
324
  return await this.parseSymbolInfo(rawData, long)
324
325
  }
325
326
 
327
+ /**
328
+ * Gets SLP symbol configuration
329
+ */
330
+ public async getSymbolConfig(indexToken: string, long: boolean): Promise<ISLPSymbolConfig | null> {
331
+ this.validateCache()
332
+ try {
333
+ const rawData = await this.provider.getDynamicFieldObject({
334
+ parentId: this.consts.sudoCore.market,
335
+ name: {
336
+ type: `${this.consts.sudoCore.package}::market::SymbolName<${this.consts.coins[indexToken].module}, ${this.consts.sudoCore.package}::market::${long ? 'LONG' : 'SHORT'}>`,
337
+ value: { dummy_field: false },
338
+ },
339
+ })
340
+ return SLPDataAPI.parseSymbolConfig(rawData)
341
+ }
342
+ catch {
343
+ // If the dynamic field doesn't exist, return null
344
+ console.error('Symbol Config Not Found')
345
+ return null
346
+ }
347
+ }
348
+
326
349
  public async getPositionInfoList(
327
350
  positionCapInfoList: ISLPPositionCapInfo[],
328
351
  owner: string,
@@ -520,9 +543,10 @@ export class SLPDataAPI extends BaseDataAPI implements ISLPDataAPI {
520
543
  const credentials = rawCredentialsData
521
544
  .filter(
522
545
  (item: any) =>
523
- item.data.type ===
524
- `${this.sharedConfig.zoStaking.package}::pool::Credential<${this.consts.sudoCore.package}::slp::SLP, ${this.consts.sudoCore.package}::slp::SLP>`
525
- ).map((item: any) =>
546
+ item.data.type
547
+ === `${this.sharedConfig.zoStaking.package}::pool::Credential<${this.consts.sudoCore.package}::slp::SLP, ${this.consts.sudoCore.package}::slp::SLP>`,
548
+ )
549
+ .map((item: any) =>
526
550
  SLPDataAPI.parseCredential(item, pool),
527
551
  )
528
552
  return {
@@ -902,8 +926,7 @@ export class SLPDataAPI extends BaseDataAPI implements ISLPDataAPI {
902
926
  name: {
903
927
  type: `${this.consts.sudoCore.package}::market::OrderName<${orderCapInfo.symbol0
904
928
  }, ${orderCapInfo.symbol1}, ${this.consts.sudoCore.package
905
- }::market::${orderCapInfo.long ? 'LONG' : 'SHORT'}, ${this.consts.coins.sui.module
906
- }>`,
929
+ }::market::${orderCapInfo.long ? 'LONG' : 'SHORT'}, ${orderCapInfo.symbol0}>`,
907
930
  value: {
908
931
  owner,
909
932
  id: orderCapInfo.orderCapId,
@@ -1030,6 +1053,29 @@ export class SLPDataAPI extends BaseDataAPI implements ISLPDataAPI {
1030
1053
  }
1031
1054
  }
1032
1055
 
1056
+ private static parseSymbolConfig(raw: any): ISLPSymbolConfig {
1057
+ const { fields } = raw.data.content
1058
+
1059
+ return {
1060
+ id: fields.id.id,
1061
+ max_opening_size: parseValue(fields.max_opening_size),
1062
+ max_opening_size_enabled: fields.max_opening_size_enabled,
1063
+ max_opening_size_per_position: parseValue(fields.max_opening_size_per_position),
1064
+ max_opening_size_per_position_enabled: fields.max_opening_size_per_position_enabled,
1065
+ instant_exit_fee_config: {
1066
+ instant_exit_tier_1_duration_threshold: parseValue(fields.instant_exit_fee_config.fields.instant_exit_tier_1_duration_threshold),
1067
+ instant_exit_tier_1_fee_bps: parseValue(fields.instant_exit_fee_config.fields.instant_exit_tier_1_fee_bps.fields.value),
1068
+ instant_exit_tier_1_fee_enabled: fields.instant_exit_fee_config.fields.instant_exit_tier_1_fee_enabled,
1069
+ instant_exit_tier_2_duration_threshold: parseValue(fields.instant_exit_fee_config.fields.instant_exit_tier_2_duration_threshold),
1070
+ instant_exit_tier_2_fee_bps: parseValue(fields.instant_exit_fee_config.fields.instant_exit_tier_2_fee_bps.fields.value),
1071
+ instant_exit_tier_2_fee_enabled: fields.instant_exit_fee_config.fields.instant_exit_tier_2_fee_enabled,
1072
+ instant_exit_tier_3_duration_threshold: parseValue(fields.instant_exit_fee_config.fields.instant_exit_tier_3_duration_threshold),
1073
+ instant_exit_tier_3_fee_bps: parseValue(fields.instant_exit_fee_config.fields.instant_exit_tier_3_fee_bps.fields.value),
1074
+ instant_exit_tier_3_fee_enabled: fields.instant_exit_fee_config.fields.instant_exit_tier_3_fee_enabled,
1075
+ },
1076
+ }
1077
+ }
1078
+
1033
1079
  private static parseRebaseFeeModel(raw: any): ISLPRebaseFeeModel {
1034
1080
  const { fields } = raw.data.content
1035
1081
 
@@ -1201,6 +1247,9 @@ export class SLPDataAPI extends BaseDataAPI implements ISLPDataAPI {
1201
1247
  const orderType = content.fields.value.type.includes('OpenPositionOrder')
1202
1248
  ? 'OPEN_POSITION'
1203
1249
  : 'DECREASE_POSITION'
1250
+ const orderVersion = content.fields.value.type.includes('V2')
1251
+ ? 'V2'
1252
+ : 'V1_1'
1204
1253
 
1205
1254
  const ret: ISLPOrderInfo = {
1206
1255
  id: content.fields.id.id,
@@ -1221,6 +1270,7 @@ export class SLPDataAPI extends BaseDataAPI implements ISLPDataAPI {
1221
1270
  feeAmount: BigInt(fields.fee),
1222
1271
  long: dataType.includes('::market::LONG'),
1223
1272
  orderType,
1273
+ orderVersion,
1224
1274
  createdAt: parseValue(fields.created_at),
1225
1275
  }
1226
1276
 
@@ -1281,7 +1331,8 @@ export class SLPDataAPI extends BaseDataAPI implements ISLPDataAPI {
1281
1331
  // Use appropriate refresh method based on version
1282
1332
  if (isNewVersion) {
1283
1333
  SLPDataAPI.refreshPoolV2(pool, Math.floor(Date.now() / 1000))
1284
- } else {
1334
+ }
1335
+ else {
1285
1336
  SLPDataAPI.refreshPool(pool, Math.floor(Date.now() / 1000))
1286
1337
  }
1287
1338
 
@@ -6,14 +6,14 @@
6
6
  import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
7
7
  import { KioskTransaction } from '@mysten/kiosk'
8
8
  import type { SuiClient } from '@mysten/sui/client'
9
- import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions'
9
+ import type { TransactionObjectArgument } from '@mysten/sui/transactions'
10
+ import { Transaction } from '@mysten/sui/transactions'
10
11
  import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
11
12
 
12
13
  import { BaseAPI } from '../abstract'
13
14
  import type { Network } from '../consts'
14
15
  import { ALLOW_TRADE_CAN_TRADE, ALLOW_TRADE_MUST_TRADE, ALLOW_TRADE_NO_TRADE, LPToken } from '../consts'
15
16
  import type {
16
- IBaseCredential,
17
17
  IBaseHistoryResponse,
18
18
  IBaseMarketInfo,
19
19
  IBaseMarketValuationInfo,
@@ -125,6 +125,7 @@ export interface IBaseOrderInfo {
125
125
  orderType: 'OPEN_POSITION' | 'DECREASE_POSITION'
126
126
  createdAt: number
127
127
  v11Order?: boolean
128
+ orderVersion?: string
128
129
  }
129
130
 
130
131
  export interface IBasePositionConfig {
@@ -363,7 +364,9 @@ export interface IBaseAPI {
363
364
  relayerFee?: bigint
364
365
  coinObjects?: string[]
365
366
  }>,
366
- tx?: Transaction
367
+ tx?: Transaction,
368
+ sponsoredTx?: boolean,
369
+ suiCoinObjectsForPythUpdate?: string[],
367
370
  ) => Promise<Transaction>
368
371
 
369
372
  pledgeInPosition: (
@@ -476,7 +479,9 @@ export interface IBaseAPI {
476
479
  pricesSlippage?: number,
477
480
  collateralSlippage?: number,
478
481
  relayerFee?: bigint,
479
- coinObjects?: string[]
482
+ coinObjects?: string[],
483
+ sponsoredTx?: boolean,
484
+ suiCoinObjectsForPythUpdate?: string[],
480
485
  ) => Promise<Transaction>
481
486
 
482
487
  decreaseMultiPositionsWithSCard: (
@@ -499,7 +504,9 @@ export interface IBaseAPI {
499
504
  kioskClient: KioskClient,
500
505
  kioskCap: KioskOwnerCap,
501
506
  scard: string,
502
- tx?: Transaction
507
+ tx?: Transaction,
508
+ sponsoredTx?: boolean,
509
+ suiCoinObjectsForPythUpdate?: string[],
503
510
  ) => Promise<Transaction>
504
511
 
505
512
  claimTokenFromSCard: (
@@ -48,7 +48,9 @@ export interface ISLPPositionConfig extends IBasePositionConfig { }
48
48
 
49
49
  export interface ISLPPositionCapInfo extends IBasePositionCapInfo { }
50
50
 
51
- export interface ISLPOrderInfo extends IBaseOrderInfo { }
51
+ export interface ISLPOrderInfo extends IBaseOrderInfo {
52
+ orderVersion: string
53
+ }
52
54
 
53
55
  export interface ISLPOrderCapInfo extends IBaseOrderCapInfo { }
54
56
 
@@ -63,6 +65,28 @@ export interface ISLPStakePool extends IBaseStakePool {
63
65
 
64
66
  export interface ISLPCredential extends IBaseCredential { }
65
67
 
68
+ // ZLP Symbol Config interfaces
69
+ export interface ISLPPositionInstantExitFeeConfig {
70
+ instant_exit_tier_1_duration_threshold: number
71
+ instant_exit_tier_1_fee_bps: number
72
+ instant_exit_tier_1_fee_enabled: boolean
73
+ instant_exit_tier_2_duration_threshold: number
74
+ instant_exit_tier_2_fee_bps: number
75
+ instant_exit_tier_2_fee_enabled: boolean
76
+ instant_exit_tier_3_duration_threshold: number
77
+ instant_exit_tier_3_fee_bps: number
78
+ instant_exit_tier_3_fee_enabled: boolean
79
+ }
80
+
81
+ export interface ISLPSymbolConfig {
82
+ id: string
83
+ max_opening_size: number
84
+ max_opening_size_enabled: boolean
85
+ max_opening_size_per_position: number
86
+ max_opening_size_per_position_enabled: boolean
87
+ instant_exit_fee_config: ISLPPositionInstantExitFeeConfig
88
+ }
89
+
66
90
  // Sudo SDK specific data structures
67
91
  export interface ISudoMarket {
68
92
  lpSupply: bigint
@@ -145,6 +169,7 @@ export interface ISudoStakeCredential {
145
169
  export interface ISLPDataAPI extends IBaseDataAPI {
146
170
  // SLP-specific data api methods can be added here
147
171
  getCumulativeApr: () => Promise<number>
172
+ getSymbolConfig: (indexToken: string, long: boolean) => Promise<ISLPSymbolConfig | null>
148
173
  }
149
174
 
150
175
  // SLP-specific API interface