@zofai/zo-sdk 0.2.10 → 0.2.12

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 (147) hide show
  1. package/dist/abstract/BaseAPI.cjs +29 -0
  2. package/dist/abstract/BaseAPI.cjs.map +1 -1
  3. package/dist/abstract/BaseAPI.d.cts +8 -3
  4. package/dist/abstract/BaseAPI.d.cts.map +1 -1
  5. package/dist/abstract/BaseAPI.d.mts +8 -3
  6. package/dist/abstract/BaseAPI.d.mts.map +1 -1
  7. package/dist/abstract/BaseAPI.mjs +29 -0
  8. package/dist/abstract/BaseAPI.mjs.map +1 -1
  9. package/dist/abstract/BaseDataAPI.d.cts +1 -1
  10. package/dist/abstract/BaseDataAPI.d.cts.map +1 -1
  11. package/dist/abstract/BaseDataAPI.d.mts +1 -1
  12. package/dist/abstract/BaseDataAPI.d.mts.map +1 -1
  13. package/dist/api.cjs +7 -7
  14. package/dist/api.cjs.map +1 -1
  15. package/dist/api.d.cts +1 -1
  16. package/dist/api.d.cts.map +1 -1
  17. package/dist/api.d.mts +1 -1
  18. package/dist/api.d.mts.map +1 -1
  19. package/dist/api.mjs +7 -7
  20. package/dist/api.mjs.map +1 -1
  21. package/dist/bcs.d.cts +41 -71
  22. package/dist/bcs.d.cts.map +1 -1
  23. package/dist/bcs.d.mts +41 -71
  24. package/dist/bcs.d.mts.map +1 -1
  25. package/dist/coins.cjs +6 -0
  26. package/dist/coins.cjs.map +1 -1
  27. package/dist/coins.d.cts +3 -1
  28. package/dist/coins.d.cts.map +1 -1
  29. package/dist/coins.d.mts +3 -1
  30. package/dist/coins.d.mts.map +1 -1
  31. package/dist/coins.mjs +5 -0
  32. package/dist/coins.mjs.map +1 -1
  33. package/dist/data.d.cts +6 -6
  34. package/dist/data.d.cts.map +1 -1
  35. package/dist/data.d.mts +6 -6
  36. package/dist/data.d.mts.map +1 -1
  37. package/dist/factory/SDKFactory.d.cts +1 -1
  38. package/dist/factory/SDKFactory.d.cts.map +1 -1
  39. package/dist/factory/SDKFactory.d.mts +1 -1
  40. package/dist/factory/SDKFactory.d.mts.map +1 -1
  41. package/dist/implementations/SLPAPI.cjs +6 -8
  42. package/dist/implementations/SLPAPI.cjs.map +1 -1
  43. package/dist/implementations/SLPAPI.d.cts +1 -1
  44. package/dist/implementations/SLPAPI.d.cts.map +1 -1
  45. package/dist/implementations/SLPAPI.d.mts +1 -1
  46. package/dist/implementations/SLPAPI.d.mts.map +1 -1
  47. package/dist/implementations/SLPAPI.mjs +6 -8
  48. package/dist/implementations/SLPAPI.mjs.map +1 -1
  49. package/dist/implementations/SLPDataAPI.cjs.map +1 -1
  50. package/dist/implementations/SLPDataAPI.d.cts +5 -5
  51. package/dist/implementations/SLPDataAPI.d.cts.map +1 -1
  52. package/dist/implementations/SLPDataAPI.d.mts +5 -5
  53. package/dist/implementations/SLPDataAPI.d.mts.map +1 -1
  54. package/dist/implementations/SLPDataAPI.mjs.map +1 -1
  55. package/dist/implementations/USDZAPI.cjs +6 -8
  56. package/dist/implementations/USDZAPI.cjs.map +1 -1
  57. package/dist/implementations/USDZAPI.d.cts +1 -1
  58. package/dist/implementations/USDZAPI.d.cts.map +1 -1
  59. package/dist/implementations/USDZAPI.d.mts +1 -1
  60. package/dist/implementations/USDZAPI.d.mts.map +1 -1
  61. package/dist/implementations/USDZAPI.mjs +6 -8
  62. package/dist/implementations/USDZAPI.mjs.map +1 -1
  63. package/dist/implementations/USDZDataAPI.d.cts +5 -5
  64. package/dist/implementations/USDZDataAPI.d.cts.map +1 -1
  65. package/dist/implementations/USDZDataAPI.d.mts +5 -5
  66. package/dist/implementations/USDZDataAPI.d.mts.map +1 -1
  67. package/dist/implementations/ZBTCVCAPI.cjs.map +1 -1
  68. package/dist/implementations/ZBTCVCAPI.d.cts +1 -1
  69. package/dist/implementations/ZBTCVCAPI.d.cts.map +1 -1
  70. package/dist/implementations/ZBTCVCAPI.d.mts +1 -1
  71. package/dist/implementations/ZBTCVCAPI.d.mts.map +1 -1
  72. package/dist/implementations/ZBTCVCAPI.mjs.map +1 -1
  73. package/dist/implementations/ZBTCVCDataAPI.cjs.map +1 -1
  74. package/dist/implementations/ZBTCVCDataAPI.d.cts +5 -5
  75. package/dist/implementations/ZBTCVCDataAPI.d.cts.map +1 -1
  76. package/dist/implementations/ZBTCVCDataAPI.d.mts +5 -5
  77. package/dist/implementations/ZBTCVCDataAPI.d.mts.map +1 -1
  78. package/dist/implementations/ZBTCVCDataAPI.mjs.map +1 -1
  79. package/dist/implementations/ZLPAPI.cjs +6 -8
  80. package/dist/implementations/ZLPAPI.cjs.map +1 -1
  81. package/dist/implementations/ZLPAPI.d.cts +1 -1
  82. package/dist/implementations/ZLPAPI.d.cts.map +1 -1
  83. package/dist/implementations/ZLPAPI.d.mts +1 -1
  84. package/dist/implementations/ZLPAPI.d.mts.map +1 -1
  85. package/dist/implementations/ZLPAPI.mjs +6 -8
  86. package/dist/implementations/ZLPAPI.mjs.map +1 -1
  87. package/dist/implementations/ZLPDataAPI.cjs.map +1 -1
  88. package/dist/implementations/ZLPDataAPI.d.cts +5 -5
  89. package/dist/implementations/ZLPDataAPI.d.cts.map +1 -1
  90. package/dist/implementations/ZLPDataAPI.d.mts +5 -5
  91. package/dist/implementations/ZLPDataAPI.d.mts.map +1 -1
  92. package/dist/implementations/ZLPDataAPI.mjs.map +1 -1
  93. package/dist/index.cjs +1 -0
  94. package/dist/index.cjs.map +1 -1
  95. package/dist/index.d.cts +2 -1
  96. package/dist/index.d.cts.map +1 -1
  97. package/dist/index.d.mts +2 -1
  98. package/dist/index.d.mts.map +1 -1
  99. package/dist/index.mjs +1 -0
  100. package/dist/index.mjs.map +1 -1
  101. package/dist/interfaces/base.d.cts +2 -2
  102. package/dist/interfaces/base.d.cts.map +1 -1
  103. package/dist/interfaces/base.d.mts +2 -2
  104. package/dist/interfaces/base.d.mts.map +1 -1
  105. package/dist/oracle.cjs.map +1 -1
  106. package/dist/oracle.d.cts +1 -1
  107. package/dist/oracle.d.cts.map +1 -1
  108. package/dist/oracle.d.mts +1 -1
  109. package/dist/oracle.d.mts.map +1 -1
  110. package/dist/oracle.mjs.map +1 -1
  111. package/dist/suiClient.cjs +8 -0
  112. package/dist/suiClient.cjs.map +1 -0
  113. package/dist/suiClient.d.cts +8 -0
  114. package/dist/suiClient.d.cts.map +1 -0
  115. package/dist/suiClient.d.mts +8 -0
  116. package/dist/suiClient.d.mts.map +1 -0
  117. package/dist/suiClient.mjs +2 -0
  118. package/dist/suiClient.mjs.map +1 -0
  119. package/dist/utils.cjs +7 -3
  120. package/dist/utils.cjs.map +1 -1
  121. package/dist/utils.d.cts +2 -2
  122. package/dist/utils.d.cts.map +1 -1
  123. package/dist/utils.d.mts +2 -2
  124. package/dist/utils.d.mts.map +1 -1
  125. package/dist/utils.mjs +7 -3
  126. package/dist/utils.mjs.map +1 -1
  127. package/package.json +4 -4
  128. package/src/abstract/BaseAPI.ts +52 -1
  129. package/src/abstract/BaseDataAPI.ts +1 -1
  130. package/src/api.ts +8 -12
  131. package/src/coins.ts +13 -1
  132. package/src/data.ts +1 -1
  133. package/src/factory/SDKFactory.ts +1 -1
  134. package/src/implementations/SLPAPI.ts +13 -13
  135. package/src/implementations/SLPDataAPI.ts +1 -1
  136. package/src/implementations/USDZAPI.ts +13 -13
  137. package/src/implementations/USDZDataAPI.ts +1 -1
  138. package/src/implementations/ZBTCVCAPI.ts +1 -1
  139. package/src/implementations/ZBTCVCDataAPI.ts +1 -1
  140. package/src/implementations/ZLPAPI.ts +13 -13
  141. package/src/implementations/ZLPDataAPI.ts +1 -1
  142. package/src/index.ts +2 -1
  143. package/src/interfaces/base.ts +2 -1
  144. package/src/oracle.ts +6 -2
  145. package/src/suiClient.ts +11 -0
  146. package/src/utils.ts +9 -3
  147. package/tsconfig.json +8 -1
@@ -5,7 +5,6 @@
5
5
 
6
6
  import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
7
7
  import { KioskTransaction } from '@mysten/kiosk'
8
- import type { SuiClient } from '@mysten/sui/client'
9
8
  import type { TransactionObjectArgument } from '@mysten/sui/transactions'
10
9
  import { Transaction } from '@mysten/sui/transactions'
11
10
  import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
@@ -18,6 +17,7 @@ import type {
18
17
  ISLPAPI,
19
18
  ISLPCredential,
20
19
  } from '../interfaces'
20
+ import type { SuiClient } from '../suiClient'
21
21
  import { joinSymbol } from '../utils'
22
22
  import { SLPDataAPI } from './SLPDataAPI'
23
23
 
@@ -1166,8 +1166,8 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1166
1166
  sponsoredTx?: boolean,
1167
1167
  sender?: string,
1168
1168
  ): Promise<Transaction> {
1169
- if (!coinObjects) {
1170
- throw new Error(`${this.constructor.name}: coinObjects is required`)
1169
+ if (!coinObjects?.length && !sender) {
1170
+ throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
1171
1171
  }
1172
1172
 
1173
1173
  let tx = new Transaction()
@@ -1198,14 +1198,14 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
1198
1198
  tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
1199
1199
  }
1200
1200
 
1201
- // Process coin splitting
1202
- const [feeObject] = this.processCoinSplitting(
1201
+ const feeObject = await this.resolveRelayerFeeObject(
1203
1202
  tx,
1204
1203
  collateralToken,
1205
- coinObjects,
1206
- [tx.pure.u64(relayerFee)],
1204
+ coinObjects ?? [],
1205
+ relayerFee,
1207
1206
  sponsoredTx,
1208
1207
  suiCoinObject,
1208
+ sender,
1209
1209
  )
1210
1210
 
1211
1211
  tx.moveCall({
@@ -2334,8 +2334,8 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
2334
2334
  sponsoredTx?: boolean,
2335
2335
  sender?: string,
2336
2336
  ): Promise<Transaction> {
2337
- if (!coinObjects) {
2338
- throw new Error(`${this.constructor.name}: coinObjects is required`)
2337
+ if (!coinObjects?.length && !sender) {
2338
+ throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
2339
2339
  }
2340
2340
 
2341
2341
  let tx = new Transaction()
@@ -2377,14 +2377,14 @@ export class SLPAPI extends BaseAPI implements ISLPAPI {
2377
2377
  tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
2378
2378
  }
2379
2379
 
2380
- // Process coin splitting
2381
- const [feeObject] = this.processCoinSplitting(
2380
+ const feeObject = await this.resolveRelayerFeeObject(
2382
2381
  tx,
2383
2382
  collateralToken,
2384
- coinObjects,
2385
- [tx.pure.u64(relayerFee)],
2383
+ coinObjects ?? [],
2384
+ relayerFee,
2386
2385
  sponsoredTx,
2387
2386
  suiCoinObject,
2387
+ sender,
2388
2388
  )
2389
2389
 
2390
2390
  tx.moveCall({
@@ -6,7 +6,6 @@
6
6
  * Implements SLP-specific data access methods for Sudo SDK
7
7
  */
8
8
 
9
- import type { DynamicFieldInfo, SuiClient } from '@mysten/sui/client'
10
9
  import { Transaction } from '@mysten/sui/transactions'
11
10
  import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
12
11
 
@@ -39,6 +38,7 @@ import type {
39
38
  ISLPVaultInfo,
40
39
  ISwapFeeBreakdown,
41
40
  } from '../interfaces'
41
+ import type { DynamicFieldInfo, SuiClient } from '../suiClient'
42
42
  import { joinSymbol, parseSymbolKey, parseValue, suiSymbolToSymbol } from '../utils'
43
43
 
44
44
  export interface GetCumulativeAprResponse {
@@ -5,7 +5,6 @@
5
5
 
6
6
  import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
7
7
  import { KioskTransaction } from '@mysten/kiosk'
8
- import type { SuiClient } from '@mysten/sui/client'
9
8
  import type { TransactionObjectArgument } from '@mysten/sui/transactions'
10
9
  import { Transaction } from '@mysten/sui/transactions'
11
10
  import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
@@ -18,6 +17,7 @@ import type {
18
17
  IUSDZAPI,
19
18
  IUSDZCredential,
20
19
  } from '../interfaces'
20
+ import type { SuiClient } from '../suiClient'
21
21
  import { joinSymbol } from '../utils'
22
22
  import { USDZDataAPI } from './USDZDataAPI'
23
23
 
@@ -828,8 +828,8 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
828
828
  sponsoredTx?: boolean,
829
829
  sender?: string,
830
830
  ): Promise<Transaction> {
831
- if (!coinObjects) {
832
- throw new Error(`${this.constructor.name}: coinObjects is required`)
831
+ if (!coinObjects?.length && !sender) {
832
+ throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
833
833
  }
834
834
 
835
835
  let tx = new Transaction()
@@ -871,14 +871,14 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
871
871
  tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
872
872
  }
873
873
 
874
- // Process coin splitting
875
- const [feeObject] = this.processCoinSplitting(
874
+ const feeObject = await this.resolveRelayerFeeObject(
876
875
  tx,
877
876
  collateralToken,
878
- coinObjects,
879
- [tx.pure.u64(relayerFee)],
877
+ coinObjects ?? [],
878
+ relayerFee,
880
879
  sponsoredTx,
881
880
  suiCoinObject,
881
+ sender,
882
882
  )
883
883
 
884
884
  tx.moveCall({
@@ -2022,8 +2022,8 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
2022
2022
  sponsoredTx?: boolean,
2023
2023
  sender?: string,
2024
2024
  ): Promise<Transaction> {
2025
- if (!coinObjects) {
2026
- throw new Error(`${this.constructor.name}: coinObjects is required`)
2025
+ if (!coinObjects?.length && !sender) {
2026
+ throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
2027
2027
  }
2028
2028
 
2029
2029
  let tx = new Transaction()
@@ -2054,14 +2054,14 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
2054
2054
  tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
2055
2055
  }
2056
2056
 
2057
- // Process coin splitting
2058
- const [feeObject] = this.processCoinSplitting(
2057
+ const feeObject = await this.resolveRelayerFeeObject(
2059
2058
  tx,
2060
2059
  collateralToken,
2061
- coinObjects,
2062
- [tx.pure.u64(relayerFee)],
2060
+ coinObjects ?? [],
2061
+ relayerFee,
2063
2062
  sponsoredTx,
2064
2063
  suiCoinObject,
2064
+ sender,
2065
2065
  )
2066
2066
 
2067
2067
  tx.moveCall({
@@ -4,7 +4,7 @@
4
4
  * Implements USDZ-specific data access methods
5
5
  */
6
6
 
7
- import type { DynamicFieldInfo, SuiClient } from '@mysten/sui/client'
7
+ import type { DynamicFieldInfo, SuiClient } from '../suiClient'
8
8
  import type { Transaction } from '@mysten/sui/transactions'
9
9
  import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
10
10
 
@@ -5,7 +5,6 @@
5
5
 
6
6
  import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
7
7
  import { KioskTransaction } from '@mysten/kiosk'
8
- import type { SuiClient } from '@mysten/sui/client'
9
8
  import { Transaction } from '@mysten/sui/transactions'
10
9
  import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
11
10
 
@@ -17,6 +16,7 @@ import type {
17
16
  IZBTCVCAPI,
18
17
  IZBTCVCCredential,
19
18
  } from '../interfaces'
19
+ import type { SuiClient } from '../suiClient'
20
20
  import { joinSymbol } from '../utils'
21
21
  import { ZBTCVCDataAPI } from './ZBTCVCDataAPI'
22
22
 
@@ -4,7 +4,6 @@
4
4
  * Implements ZBTCVC-specific data access methods
5
5
  */
6
6
 
7
- import type { DynamicFieldInfo, SuiClient } from '@mysten/sui/client'
8
7
  import type { Transaction } from '@mysten/sui/transactions'
9
8
  import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
10
9
 
@@ -31,6 +30,7 @@ import type {
31
30
  IZBTCVCSymbolInfo,
32
31
  IZBTCVCVaultInfo,
33
32
  } from '../interfaces'
33
+ import type { DynamicFieldInfo, SuiClient } from '../suiClient'
34
34
  import { joinSymbol, parseSymbolKey, parseValue, suiSymbolToSymbol } from '../utils'
35
35
 
36
36
  export class ZBTCVCDataAPI extends BaseDataAPI implements IZBTCVCDataAPI {
@@ -5,7 +5,6 @@
5
5
 
6
6
  import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
7
7
  import { KioskTransaction } from '@mysten/kiosk'
8
- import type { SuiClient } from '@mysten/sui/client'
9
8
  import type { TransactionObjectArgument } from '@mysten/sui/transactions'
10
9
  import { Transaction } from '@mysten/sui/transactions'
11
10
  import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
@@ -18,6 +17,7 @@ import type {
18
17
  IZLPAPI,
19
18
  IZLPCredential,
20
19
  } from '../interfaces'
20
+ import type { SuiClient } from '../suiClient'
21
21
  import { joinSymbol } from '../utils'
22
22
  import { ZLPDataAPI } from './ZLPDataAPI'
23
23
 
@@ -1147,8 +1147,8 @@ export class ZLPAPI extends BaseAPI implements IZLPAPI {
1147
1147
  sponsoredTx?: boolean,
1148
1148
  sender?: string,
1149
1149
  ): Promise<Transaction> {
1150
- if (!coinObjects) {
1151
- throw new Error(`${this.constructor.name}: coinObjects is required`)
1150
+ if (!coinObjects?.length && !sender) {
1151
+ throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
1152
1152
  }
1153
1153
 
1154
1154
  let tx = new Transaction()
@@ -1179,14 +1179,14 @@ export class ZLPAPI extends BaseAPI implements IZLPAPI {
1179
1179
  tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
1180
1180
  }
1181
1181
 
1182
- // Process coin splitting
1183
- const [feeObject] = this.processCoinSplitting(
1182
+ const feeObject = await this.resolveRelayerFeeObject(
1184
1183
  tx,
1185
1184
  collateralToken,
1186
- coinObjects,
1187
- [tx.pure.u64(relayerFee)],
1185
+ coinObjects ?? [],
1186
+ relayerFee,
1188
1187
  sponsoredTx,
1189
1188
  suiCoinObject,
1189
+ sender,
1190
1190
  )
1191
1191
 
1192
1192
  tx.moveCall({
@@ -1983,8 +1983,8 @@ export class ZLPAPI extends BaseAPI implements IZLPAPI {
1983
1983
  sponsoredTx?: boolean,
1984
1984
  sender?: string,
1985
1985
  ): Promise<Transaction> {
1986
- if (!coinObjects) {
1987
- throw new Error(`${this.constructor.name}: coinObjects is required`)
1986
+ if (!coinObjects?.length && !sender) {
1987
+ throw new Error(`${this.constructor.name}: coinObjects or sender is required`)
1988
1988
  }
1989
1989
 
1990
1990
  let tx = new Transaction()
@@ -2026,14 +2026,14 @@ export class ZLPAPI extends BaseAPI implements IZLPAPI {
2026
2026
  tx = (await this.initOracleTxb([collateralToken, indexToken], tx)).tx
2027
2027
  }
2028
2028
 
2029
- // Process coin splitting
2030
- const [feeObject] = this.processCoinSplitting(
2029
+ const feeObject = await this.resolveRelayerFeeObject(
2031
2030
  tx,
2032
2031
  collateralToken,
2033
- coinObjects,
2034
- [tx.pure.u64(relayerFee)],
2032
+ coinObjects ?? [],
2033
+ relayerFee,
2035
2034
  sponsoredTx,
2036
2035
  suiCoinObject,
2036
+ sender,
2037
2037
  )
2038
2038
 
2039
2039
  tx.moveCall({
@@ -4,7 +4,6 @@
4
4
  * Implements ZLP-specific data access methods
5
5
  */
6
6
 
7
- import type { DynamicFieldInfo, SuiClient } from '@mysten/sui/client'
8
7
  import type { Transaction } from '@mysten/sui/transactions'
9
8
  import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'
10
9
 
@@ -36,6 +35,7 @@ import type {
36
35
  IZLPSymbolInfo,
37
36
  IZLPVaultInfo,
38
37
  } from '../interfaces'
38
+ import type { DynamicFieldInfo, SuiClient } from '../suiClient'
39
39
  import { joinSymbol, parseSymbolKey, parseValue, suiSymbolToSymbol } from '../utils'
40
40
 
41
41
  interface SwapImpactConfig {
package/src/index.ts CHANGED
@@ -20,6 +20,7 @@ export * from './abstract'
20
20
  export * from './factory/SDKFactory'
21
21
  export * from './implementations'
22
22
  export * from './interfaces'
23
+ export * from './suiClient'
23
24
 
24
25
  // Export legacy components for backward compatibility
25
26
  export * from './api'
@@ -31,7 +32,7 @@ export * from './oracle'
31
32
  export * from './utils'
32
33
 
33
34
  // Re-export commonly used types from Sui SDK
34
- export type { SuiClient } from '@mysten/sui/client'
35
+ export type { SuiClient } from './suiClient'
35
36
  export type { Transaction } from '@mysten/sui/transactions'
36
37
 
37
38
  /**
@@ -4,12 +4,12 @@
4
4
  */
5
5
 
6
6
  import type { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
7
- import type { SuiClient } from '@mysten/sui/client'
8
7
  import type { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions'
9
8
  import type { PriceFeed } from '@pythnetwork/pyth-sui-js'
10
9
 
11
10
  import type { IConsts, LPToken, Network } from '../consts'
12
11
  import type { IInitOracleTxbResult } from '../oracle'
12
+ import type { SuiClient } from '../suiClient'
13
13
 
14
14
  // Common data interfaces
15
15
  export interface IBaseMarketValuationInfo {
@@ -757,6 +757,7 @@ export interface IBaseAPI {
757
757
  relayerFee?: bigint,
758
758
  coinObjects?: string[],
759
759
  sponsoredTx?: boolean,
760
+ sender?: string,
760
761
  ) => Promise<Transaction>
761
762
 
762
763
  decreaseMultiPositionsWithSCardV2?: (
package/src/oracle.ts CHANGED
@@ -1,4 +1,3 @@
1
- import type { SuiClient } from '@mysten/sui/client'
2
1
  import type { TransactionObjectArgument } from '@mysten/sui/transactions'
3
2
  import { Transaction } from '@mysten/sui/transactions'
4
3
  import type { PriceFeed } from '@pythnetwork/pyth-sui-js'
@@ -7,6 +6,7 @@ import { SuiPriceServiceConnection, SuiPythClient } from '@pythnetwork/pyth-sui-
7
6
  import { resolveSpendableSuiCoin } from './coins'
8
7
  import type { IConsts, Network } from './consts'
9
8
  import { getConsts, getPriceIdToPythFeeder, getPythFeederToId, getPythFeederToPriceId, getSharedConfig, LPToken } from './consts'
9
+ import type { SuiClient } from './suiClient'
10
10
  import { createJsonRpcProvider } from './utils'
11
11
 
12
12
  export interface IInitOracleSponsorOptions {
@@ -47,7 +47,11 @@ export class OracleAPI {
47
47
  this.PythFeederToPriceId = getPythFeederToPriceId(network)
48
48
  this.PythFeederToId = getPythFeederToId(network)
49
49
  this.provider = provider || createJsonRpcProvider(network)
50
- this.client = new SuiPythClient(this.provider, this.consts.pythFeeder.state, this.consts.pythFeeder.wormhole.state)
50
+ this.client = new SuiPythClient(
51
+ this.provider as ConstructorParameters<typeof SuiPythClient>[0],
52
+ this.consts.pythFeeder.state,
53
+ this.consts.pythFeeder.wormhole.state,
54
+ )
51
55
  }
52
56
 
53
57
  validateCache() {
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Sui v2 client re-exports.
3
+ * SuiJsonRpcClient is the JSON-RPC replacement for the removed SuiClient.
4
+ */
5
+ export type { ClientWithCoreApi } from '@mysten/sui/client'
6
+ export type { DynamicFieldInfo, SuiJsonRpcClient as SuiClient } from '@mysten/sui/jsonRpc'
7
+ export {
8
+ getJsonRpcFullnodeUrl,
9
+ JsonRpcHTTPTransport,
10
+ SuiJsonRpcClient,
11
+ } from '@mysten/sui/jsonRpc'
package/src/utils.ts CHANGED
@@ -1,8 +1,13 @@
1
- import { SuiClient, SuiHTTPTransport } from '@mysten/sui/client'
1
+ import type { SuiClientTypes } from '@mysten/sui/client'
2
+ import { JsonRpcHTTPTransport, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'
2
3
 
3
4
  import type { IConsts } from './consts'
4
5
  import { Network } from './consts'
5
6
 
7
+ function toSuiNetwork(network: Network): SuiClientTypes.Network {
8
+ return network
9
+ }
10
+
6
11
  export function createJsonRpcProvider(network: Network) {
7
12
  let url = ''
8
13
  switch (network) {
@@ -23,8 +28,9 @@ export function createJsonRpcProvider(network: Network) {
23
28
  }
24
29
  }
25
30
 
26
- return new SuiClient({
27
- transport: new SuiHTTPTransport({ url }),
31
+ return new SuiJsonRpcClient({
32
+ transport: new JsonRpcHTTPTransport({ url }),
33
+ network: toSuiNetwork(network),
28
34
  })
29
35
  }
30
36
 
package/tsconfig.json CHANGED
@@ -2,7 +2,14 @@
2
2
  "compilerOptions": {
3
3
  "target": "ES2020",
4
4
  "module": "ESNext",
5
- "moduleResolution": "node",
5
+ "moduleResolution": "bundler",
6
+ "baseUrl": ".",
7
+ "paths": {
8
+ "@mysten/sui/transactions": ["node_modules/@mysten/sui/dist/transactions/index.d.mts"],
9
+ "@mysten/sui/utils": ["node_modules/@mysten/sui/dist/utils/index.d.mts"],
10
+ "@mysten/sui/jsonRpc": ["node_modules/@mysten/sui/dist/jsonRpc/index.d.mts"],
11
+ "@mysten/sui/client": ["node_modules/@mysten/sui/dist/client/index.d.mts"]
12
+ },
6
13
  "esModuleInterop": true,
7
14
  "forceConsistentCasingInFileNames": true,
8
15
  "strict": true,