@zofai/zo-sdk 0.2.8 → 0.2.10

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 (112) hide show
  1. package/dist/abstract/BaseAPI.cjs +7 -1
  2. package/dist/abstract/BaseAPI.cjs.map +1 -1
  3. package/dist/abstract/BaseAPI.d.cts +8 -7
  4. package/dist/abstract/BaseAPI.d.cts.map +1 -1
  5. package/dist/abstract/BaseAPI.d.mts +8 -7
  6. package/dist/abstract/BaseAPI.d.mts.map +1 -1
  7. package/dist/abstract/BaseAPI.mjs +7 -1
  8. package/dist/abstract/BaseAPI.mjs.map +1 -1
  9. package/dist/api.cjs +12 -12
  10. package/dist/api.cjs.map +1 -1
  11. package/dist/api.d.cts.map +1 -1
  12. package/dist/api.d.mts.map +1 -1
  13. package/dist/api.mjs +12 -12
  14. package/dist/api.mjs.map +1 -1
  15. package/dist/coins.cjs +74 -0
  16. package/dist/coins.cjs.map +1 -0
  17. package/dist/coins.d.cts +37 -0
  18. package/dist/coins.d.cts.map +1 -0
  19. package/dist/coins.d.mts +37 -0
  20. package/dist/coins.d.mts.map +1 -0
  21. package/dist/coins.mjs +67 -0
  22. package/dist/coins.mjs.map +1 -0
  23. package/dist/consts/deployments-usdz-mainnet.json +1 -1
  24. package/dist/implementations/SLPAPI.cjs +192 -100
  25. package/dist/implementations/SLPAPI.cjs.map +1 -1
  26. package/dist/implementations/SLPAPI.d.cts +23 -23
  27. package/dist/implementations/SLPAPI.d.cts.map +1 -1
  28. package/dist/implementations/SLPAPI.d.mts +23 -23
  29. package/dist/implementations/SLPAPI.d.mts.map +1 -1
  30. package/dist/implementations/SLPAPI.mjs +192 -100
  31. package/dist/implementations/SLPAPI.mjs.map +1 -1
  32. package/dist/implementations/SLPDataAPI.cjs +2 -2
  33. package/dist/implementations/SLPDataAPI.cjs.map +1 -1
  34. package/dist/implementations/SLPDataAPI.mjs +2 -2
  35. package/dist/implementations/SLPDataAPI.mjs.map +1 -1
  36. package/dist/implementations/USDZAPI.cjs +176 -92
  37. package/dist/implementations/USDZAPI.cjs.map +1 -1
  38. package/dist/implementations/USDZAPI.d.cts +21 -21
  39. package/dist/implementations/USDZAPI.d.cts.map +1 -1
  40. package/dist/implementations/USDZAPI.d.mts +21 -21
  41. package/dist/implementations/USDZAPI.d.mts.map +1 -1
  42. package/dist/implementations/USDZAPI.mjs +176 -92
  43. package/dist/implementations/USDZAPI.mjs.map +1 -1
  44. package/dist/implementations/ZBTCVCAPI.cjs +84 -46
  45. package/dist/implementations/ZBTCVCAPI.cjs.map +1 -1
  46. package/dist/implementations/ZBTCVCAPI.d.cts +11 -11
  47. package/dist/implementations/ZBTCVCAPI.d.cts.map +1 -1
  48. package/dist/implementations/ZBTCVCAPI.d.mts +11 -11
  49. package/dist/implementations/ZBTCVCAPI.d.mts.map +1 -1
  50. package/dist/implementations/ZBTCVCAPI.mjs +84 -46
  51. package/dist/implementations/ZBTCVCAPI.mjs.map +1 -1
  52. package/dist/implementations/ZLPAPI.cjs +192 -100
  53. package/dist/implementations/ZLPAPI.cjs.map +1 -1
  54. package/dist/implementations/ZLPAPI.d.cts +23 -23
  55. package/dist/implementations/ZLPAPI.d.cts.map +1 -1
  56. package/dist/implementations/ZLPAPI.d.mts +23 -23
  57. package/dist/implementations/ZLPAPI.d.mts.map +1 -1
  58. package/dist/implementations/ZLPAPI.mjs +192 -100
  59. package/dist/implementations/ZLPAPI.mjs.map +1 -1
  60. package/dist/index.cjs +1 -0
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.d.cts +1 -0
  63. package/dist/index.d.cts.map +1 -1
  64. package/dist/index.d.mts +1 -0
  65. package/dist/index.d.mts.map +1 -1
  66. package/dist/index.mjs +1 -0
  67. package/dist/index.mjs.map +1 -1
  68. package/dist/interfaces/base.d.cts +25 -21
  69. package/dist/interfaces/base.d.cts.map +1 -1
  70. package/dist/interfaces/base.d.mts +25 -21
  71. package/dist/interfaces/base.d.mts.map +1 -1
  72. package/dist/interfaces/slp.d.cts +1 -1
  73. package/dist/interfaces/slp.d.cts.map +1 -1
  74. package/dist/interfaces/slp.d.mts +1 -1
  75. package/dist/interfaces/slp.d.mts.map +1 -1
  76. package/dist/interfaces/usdz.d.cts +1 -1
  77. package/dist/interfaces/usdz.d.cts.map +1 -1
  78. package/dist/interfaces/usdz.d.mts +1 -1
  79. package/dist/interfaces/usdz.d.mts.map +1 -1
  80. package/dist/interfaces/zbtcvc.d.cts +1 -1
  81. package/dist/interfaces/zbtcvc.d.cts.map +1 -1
  82. package/dist/interfaces/zbtcvc.d.mts +1 -1
  83. package/dist/interfaces/zbtcvc.d.mts.map +1 -1
  84. package/dist/interfaces/zlp.d.cts +1 -1
  85. package/dist/interfaces/zlp.d.cts.map +1 -1
  86. package/dist/interfaces/zlp.d.mts +1 -1
  87. package/dist/interfaces/zlp.d.mts.map +1 -1
  88. package/dist/oracle.cjs +27 -22
  89. package/dist/oracle.cjs.map +1 -1
  90. package/dist/oracle.d.cts +13 -1
  91. package/dist/oracle.d.cts.map +1 -1
  92. package/dist/oracle.d.mts +13 -1
  93. package/dist/oracle.d.mts.map +1 -1
  94. package/dist/oracle.mjs +27 -22
  95. package/dist/oracle.mjs.map +1 -1
  96. package/package.json +1 -1
  97. package/src/abstract/BaseAPI.ts +10 -8
  98. package/src/api.ts +17 -13
  99. package/src/coins.ts +115 -0
  100. package/src/consts/deployments-usdz-mainnet.json +1 -1
  101. package/src/implementations/SLPAPI.ts +201 -117
  102. package/src/implementations/SLPDataAPI.ts +2 -2
  103. package/src/implementations/USDZAPI.ts +184 -94
  104. package/src/implementations/ZBTCVCAPI.ts +98 -48
  105. package/src/implementations/ZLPAPI.ts +199 -102
  106. package/src/index.ts +1 -0
  107. package/src/interfaces/base.ts +13 -21
  108. package/src/interfaces/slp.ts +0 -1
  109. package/src/interfaces/usdz.ts +0 -1
  110. package/src/interfaces/zbtcvc.ts +0 -1
  111. package/src/interfaces/zlp.ts +0 -1
  112. package/src/oracle.ts +64 -28
@@ -105,7 +105,6 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
105
105
  referralAddress?: string,
106
106
  sender?: string,
107
107
  sponsoredTx?: boolean,
108
- suiCoinObjectsForPythUpdate?: string[],
109
108
  ): Promise<Transaction> {
110
109
  let tx = new Transaction()
111
110
  if (referralAddress && !(await this.dataAPI.hasReferral(sender || ''))) {
@@ -135,11 +134,15 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
135
134
  // Handle oracle initialization and coin processing
136
135
  let suiCoinObject
137
136
  if (sponsoredTx) {
138
- suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
139
- tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject)
137
+ const oracle = await this.initOracleTxb([collateralToken, indexToken], tx, true, {
138
+ sender: this.requireSenderForSponsored(sender),
139
+ additionalSuiAmount: collateralToken === 'sui' ? collateralAmount + relayerFee : 0n,
140
+ })
141
+ tx = oracle.tx
142
+ suiCoinObject = oracle.suiCoinObject
140
143
  }
141
144
  else {
142
- tx = await this.initOracleTxb([collateralToken, indexToken], tx)
145
+ tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
143
146
  }
144
147
 
145
148
  // Process coin splitting
@@ -209,7 +212,7 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
209
212
  relayerFee = BigInt(0.5),
210
213
  coinObjects?: string[],
211
214
  sponsoredTx?: boolean,
212
- suiCoinObjectsForPythUpdate?: string[],
215
+ sender?: string,
213
216
  ): Promise<Transaction> {
214
217
  if (!coinObjects) {
215
218
  throw new Error(`${this.constructor.name}: coinObjects is required`)
@@ -244,11 +247,15 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
244
247
  // Handle oracle initialization and coin processing
245
248
  let suiCoinObject
246
249
  if (sponsoredTx) {
247
- suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
248
- tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject)
250
+ const oracle = await this.initOracleTxb([collateralToken, indexToken], tx, true, {
251
+ sender: this.requireSenderForSponsored(sender),
252
+ additionalSuiAmount: collateralToken === 'sui' ? relayerFee : 0n,
253
+ })
254
+ tx = oracle.tx
255
+ suiCoinObject = oracle.suiCoinObject
249
256
  }
250
257
  else {
251
- tx = await this.initOracleTxb([collateralToken, indexToken], tx)
258
+ tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
252
259
  }
253
260
 
254
261
  // Process coin splitting
@@ -320,7 +327,7 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
320
327
  scard: string,
321
328
  tx?: Transaction,
322
329
  sponsoredTx?: boolean,
323
- suiCoinObjectsForPythUpdate?: string[],
330
+ sender?: string,
324
331
  ): Promise<Transaction> {
325
332
  if (!tx) {
326
333
  tx = new Transaction()
@@ -329,11 +336,20 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
329
336
  // Handle oracle initialization and coin processing
330
337
  let suiCoinObject
331
338
  if (sponsoredTx) {
332
- suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
333
- tx = await this.initOracleTxb(positions.flatMap(position => [position.collateralToken, position.indexToken]), tx, true, suiCoinObject)
339
+ const oracle = await this.initOracleTxb(
340
+ positions.flatMap(position => [position.collateralToken, position.indexToken]),
341
+ tx,
342
+ true,
343
+ { sender: this.requireSenderForSponsored(sender) },
344
+ )
345
+ tx = oracle.tx
346
+ suiCoinObject = oracle.suiCoinObject
334
347
  }
335
348
  else {
336
- tx = await this.initOracleTxb(positions.flatMap(position => [position.collateralToken, position.indexToken]), tx)
349
+ tx = (await this.initOracleTxb(
350
+ positions.flatMap(position => [position.collateralToken, position.indexToken]),
351
+ tx,
352
+ )).tx
337
353
  }
338
354
 
339
355
  const kioskTx = new KioskTransaction({
@@ -437,7 +453,6 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
437
453
  referralAddress?: string,
438
454
  sender?: string,
439
455
  sponsoredTx?: boolean,
440
- suiCoinObjectsForPythUpdate?: string[],
441
456
  ): Promise<Transaction> {
442
457
  let tx = new Transaction()
443
458
 
@@ -451,12 +466,16 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
451
466
 
452
467
  // Handle sponsored transaction case
453
468
  if (sponsoredTx) {
454
- const suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
455
- tx = await this.initOracleTxb(pythFeederKeys, tx, true, suiCoinObject)
469
+ const oracle = await this.initOracleTxb(pythFeederKeys, tx, true, {
470
+ sender: this.requireSenderForSponsored(sender),
471
+ additionalSuiAmount: coin === 'sui' ? BigInt(amount) : 0n,
472
+ })
473
+ tx = oracle.tx
474
+ const { suiCoinObject } = oracle
456
475
 
457
476
  // Process deposit coins
458
477
  const depositObject = coin === 'sui'
459
- ? tx.splitCoins(suiCoinObject, [tx.pure.u64(amount)])[0]
478
+ ? tx.splitCoins(suiCoinObject!, [tx.pure.u64(amount)])[0]
460
479
  : tx.splitCoins(this.processCoins(tx, coin, coinObjects, true), [tx.pure.u64(amount)])[0]
461
480
 
462
481
  const { vaultsValuation, symbolsValuation } = this.dataAPI.valuate(tx)
@@ -477,7 +496,7 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
477
496
  }
478
497
 
479
498
  // Handle non-sponsored transaction case
480
- tx = await this.initOracleTxb(pythFeederKeys, tx)
499
+ tx = (await this.initOracleTxb(pythFeederKeys, tx)).tx
481
500
  const depositObject = tx.splitCoins(
482
501
  this.processCoins(tx, coin, coinObjects, false),
483
502
  [tx.pure.u64(amount)],
@@ -515,7 +534,6 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
515
534
  sender?: string,
516
535
  tx?: Transaction,
517
536
  sponsoredTx?: boolean,
518
- suiCoinObjectsForPythUpdate?: string[],
519
537
  ): Promise<any> {
520
538
  if (!tx) {
521
539
  tx = new Transaction()
@@ -531,12 +549,16 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
531
549
 
532
550
  // Handle sponsored transaction case
533
551
  if (sponsoredTx) {
534
- const suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
535
- tx = await this.initOracleTxb(pythFeederKeys, tx, true, suiCoinObject)
552
+ const oracle = await this.initOracleTxb(pythFeederKeys, tx, true, {
553
+ sender: this.requireSenderForSponsored(sender),
554
+ additionalSuiAmount: coin === 'sui' ? BigInt(amount) : 0n,
555
+ })
556
+ tx = oracle.tx
557
+ const { suiCoinObject } = oracle
536
558
 
537
559
  // Process deposit coins
538
560
  const depositObject = coin === 'sui'
539
- ? tx.splitCoins(suiCoinObject, [tx.pure.u64(amount)])[0]
561
+ ? tx.splitCoins(suiCoinObject!, [tx.pure.u64(amount)])[0]
540
562
  : tx.splitCoins(this.processCoins(tx, coin, coinObjects, true), [tx.pure.u64(amount)])[0]
541
563
 
542
564
  const { vaultsValuation, symbolsValuation } = this.dataAPI.valuate(tx)
@@ -557,7 +579,7 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
557
579
  }
558
580
 
559
581
  // Handle non-sponsored transaction case
560
- tx = await this.initOracleTxb(pythFeederKeys, tx)
582
+ tx = (await this.initOracleTxb(pythFeederKeys, tx)).tx
561
583
  const depositObject = tx.splitCoins(
562
584
  this.processCoins(tx, coin, coinObjects, false),
563
585
  [tx.pure.u64(amount)],
@@ -593,7 +615,7 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
593
615
  amount: number,
594
616
  minAmountOut = 0,
595
617
  sponsoredTx?: boolean,
596
- suiCoinObjectsForPythUpdate?: string[],
618
+ sender?: string,
597
619
  ): Promise<Transaction> {
598
620
  let tx = new Transaction()
599
621
 
@@ -601,11 +623,15 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
601
623
  const pythFeederKeys = Object.keys(this.consts.pythFeeder.feeder)
602
624
 
603
625
  if (sponsoredTx) {
604
- const suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
605
- tx = await this.initOracleTxb(pythFeederKeys, tx, true, suiCoinObject)
626
+ const oracle = await this.initOracleTxb(pythFeederKeys, tx, true, {
627
+ sender: this.requireSenderForSponsored(sender),
628
+ additionalSuiAmount: 0n,
629
+ })
630
+ tx = oracle.tx
631
+ const { suiCoinObject } = oracle
606
632
  }
607
633
  else {
608
- tx = await this.initOracleTxb(pythFeederKeys, tx)
634
+ tx = (await this.initOracleTxb(pythFeederKeys, tx)).tx
609
635
  }
610
636
  const zbtcvcCoinObject = this.processCoins(tx, 'zbtcvc', lpCoinObjects, false)
611
637
  const [withdrawObject] = tx.splitCoins(zbtcvcCoinObject, [tx.pure.u64(amount)])
@@ -740,7 +766,7 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
740
766
  fromCoinObjects: string[],
741
767
  minAmountOut?: number,
742
768
  ): Promise<Transaction> {
743
- const tx = await this.initOracleTxb(Object.keys(this.consts.zoCore.vaults))
769
+ const { tx } = await this.initOracleTxb(Object.keys(this.consts.zoCore.vaults))
744
770
  const fromCoinObject = this.processCoins(tx, fromToken, fromCoinObjects)
745
771
  const [fromDepositObject] = tx.splitCoins(fromCoinObject, [tx.pure.u64(fromAmount)])
746
772
  const vaultsValuation = this.dataAPI.valuateVaults(tx)
@@ -784,7 +810,6 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
784
810
  referralAddress?: string,
785
811
  sender?: string,
786
812
  sponsoredTx?: boolean,
787
- suiCoinObjectsForPythUpdate?: string[],
788
813
  ): Promise<Transaction> {
789
814
  let tx = new Transaction()
790
815
  if (referralAddress && !(await this.dataAPI.hasReferral(sender || ''))) {
@@ -803,11 +828,15 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
803
828
  // Handle oracle initialization and coin processing
804
829
  let suiCoinObject
805
830
  if (sponsoredTx) {
806
- suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
807
- tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject)
831
+ const oracle = await this.initOracleTxb([collateralToken, indexToken], tx, true, {
832
+ sender: this.requireSenderForSponsored(sender),
833
+ additionalSuiAmount: collateralToken === 'sui' ? relayerFee : 0n,
834
+ })
835
+ tx = oracle.tx
836
+ suiCoinObject = oracle.suiCoinObject
808
837
  }
809
838
  else {
810
- tx = await this.initOracleTxb([collateralToken, indexToken], tx)
839
+ tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
811
840
  }
812
841
 
813
842
  // Process coin splitting
@@ -868,7 +897,7 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
868
897
  relayerFee = BigInt(0.5),
869
898
  coinObjects?: string[],
870
899
  sponsoredTx?: boolean,
871
- suiCoinObjectsForPythUpdate?: string[],
900
+ sender?: string,
872
901
  ): Promise<Transaction> {
873
902
  if (!coinObjects) {
874
903
  throw new Error(`${this.constructor.name}: coinObjects is required`)
@@ -890,11 +919,15 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
890
919
  // Handle oracle initialization and coin processing
891
920
  let suiCoinObject
892
921
  if (sponsoredTx) {
893
- suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
894
- tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject)
922
+ const oracle = await this.initOracleTxb([collateralToken, indexToken], tx, true, {
923
+ sender: this.requireSenderForSponsored(sender),
924
+ additionalSuiAmount: collateralToken === 'sui' ? relayerFee : 0n,
925
+ })
926
+ tx = oracle.tx
927
+ suiCoinObject = oracle.suiCoinObject
895
928
  }
896
929
  else {
897
- tx = await this.initOracleTxb([collateralToken, indexToken], tx)
930
+ tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
898
931
  }
899
932
 
900
933
  // Process coin splitting
@@ -951,7 +984,7 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
951
984
  collateralSlippage?: number
952
985
  relayerFee?: bigint
953
986
  coinObjects?: string[]
954
- }>, tx?: Transaction, sponsoredTx?: boolean, suiCoinObjectsForPythUpdate?: string[]): Promise<Transaction> {
987
+ }>, tx?: Transaction, sponsoredTx?: boolean, sender?: string): Promise<Transaction> {
955
988
  if (!tx) {
956
989
  tx = new Transaction()
957
990
  }
@@ -959,11 +992,20 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
959
992
  // Handle oracle initialization and coin processing
960
993
  let suiCoinObject
961
994
  if (sponsoredTx) {
962
- suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
963
- tx = await this.initOracleTxb(positions.flatMap(position => [position.collateralToken, position.indexToken]), tx, true, suiCoinObject)
995
+ const oracle = await this.initOracleTxb(
996
+ positions.flatMap(position => [position.collateralToken, position.indexToken]),
997
+ tx,
998
+ true,
999
+ { sender: this.requireSenderForSponsored(sender) },
1000
+ )
1001
+ tx = oracle.tx
1002
+ suiCoinObject = oracle.suiCoinObject
964
1003
  }
965
1004
  else {
966
- tx = await this.initOracleTxb(positions.flatMap(position => [position.collateralToken, position.indexToken]), tx)
1005
+ tx = (await this.initOracleTxb(
1006
+ positions.flatMap(position => [position.collateralToken, position.indexToken]),
1007
+ tx,
1008
+ )).tx
967
1009
  }
968
1010
 
969
1011
  for (const position of positions) {
@@ -1047,17 +1089,21 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
1047
1089
  coinObjects: string[],
1048
1090
  long: boolean,
1049
1091
  sponsoredTx?: boolean,
1050
- suiCoinObjectsForPythUpdate?: string[],
1092
+ sender?: string,
1051
1093
  ): Promise<Transaction> {
1052
1094
  let tx = new Transaction()
1053
1095
  // Handle oracle initialization and coin processing
1054
1096
  let suiCoinObject
1055
1097
  if (sponsoredTx) {
1056
- suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
1057
- tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject)
1098
+ const oracle = await this.initOracleTxb([collateralToken, indexToken], tx, true, {
1099
+ sender: this.requireSenderForSponsored(sender),
1100
+ additionalSuiAmount: collateralToken === 'sui' ? BigInt(amount) : 0n,
1101
+ })
1102
+ tx = oracle.tx
1103
+ suiCoinObject = oracle.suiCoinObject
1058
1104
  }
1059
1105
  else {
1060
- tx = await this.initOracleTxb([collateralToken, indexToken], tx)
1106
+ tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
1061
1107
  }
1062
1108
 
1063
1109
  // Process coin splitting
@@ -1090,17 +1136,21 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
1090
1136
  amount: number,
1091
1137
  long: boolean,
1092
1138
  sponsoredTx?: boolean,
1093
- suiCoinObjectsForPythUpdate?: string[],
1139
+ sender?: string,
1094
1140
  ): Promise<Transaction> {
1095
1141
  let tx = new Transaction()
1096
1142
  // Handle oracle initialization and coin processing
1097
1143
  let suiCoinObject
1098
1144
  if (sponsoredTx) {
1099
- suiCoinObject = this.processCoins(tx, 'sui', suiCoinObjectsForPythUpdate || [], true)
1100
- tx = await this.initOracleTxb([collateralToken, indexToken], tx, true, suiCoinObject)
1145
+ const oracle = await this.initOracleTxb([collateralToken, indexToken], tx, true, {
1146
+ sender: this.requireSenderForSponsored(sender),
1147
+ additionalSuiAmount: 0n,
1148
+ })
1149
+ tx = oracle.tx
1150
+ suiCoinObject = oracle.suiCoinObject
1101
1151
  }
1102
1152
  else {
1103
- tx = await this.initOracleTxb([collateralToken, indexToken], tx)
1153
+ tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
1104
1154
  }
1105
1155
  const symbol = joinSymbol(long ? 'long' : 'short', indexToken)
1106
1156
 
@@ -1235,7 +1285,7 @@ export class ZBTCVCAPI extends BaseAPI implements IZBTCVCAPI {
1235
1285
  collateralToken: string,
1236
1286
  indexToken: string,
1237
1287
  ): Promise<Transaction> {
1238
- const tx = await this.initOracleTxb([collateralToken, indexToken])
1288
+ const { tx } = await this.initOracleTxb([collateralToken, indexToken])
1239
1289
  return tx
1240
1290
  }
1241
1291