zo-sdk 0.0.51 → 0.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.
Files changed (201) hide show
  1. package/README.md +272 -20
  2. package/dist/abstract/BaseAPI.cjs +117 -0
  3. package/dist/abstract/BaseAPI.cjs.map +1 -0
  4. package/dist/abstract/BaseAPI.d.cts +131 -0
  5. package/dist/abstract/BaseAPI.d.cts.map +1 -0
  6. package/dist/abstract/BaseAPI.d.mts +131 -0
  7. package/dist/abstract/BaseAPI.d.mts.map +1 -0
  8. package/dist/abstract/BaseAPI.mjs +113 -0
  9. package/dist/abstract/BaseAPI.mjs.map +1 -0
  10. package/dist/abstract/BaseDataAPI.cjs +139 -0
  11. package/dist/abstract/BaseDataAPI.cjs.map +1 -0
  12. package/dist/abstract/BaseDataAPI.d.cts +89 -0
  13. package/dist/abstract/BaseDataAPI.d.cts.map +1 -0
  14. package/dist/abstract/BaseDataAPI.d.mts +89 -0
  15. package/dist/abstract/BaseDataAPI.d.mts.map +1 -0
  16. package/dist/abstract/BaseDataAPI.mjs +135 -0
  17. package/dist/abstract/BaseDataAPI.mjs.map +1 -0
  18. package/dist/abstract/index.cjs +12 -0
  19. package/dist/abstract/index.cjs.map +1 -0
  20. package/dist/abstract/index.d.cts +7 -0
  21. package/dist/abstract/index.d.cts.map +1 -0
  22. package/dist/abstract/index.d.mts +7 -0
  23. package/dist/abstract/index.d.mts.map +1 -0
  24. package/dist/abstract/index.mjs +7 -0
  25. package/dist/abstract/index.mjs.map +1 -0
  26. package/dist/bcs.cjs +42 -0
  27. package/dist/bcs.cjs.map +1 -0
  28. package/dist/bcs.d.cts +91 -0
  29. package/dist/bcs.d.cts.map +1 -0
  30. package/dist/bcs.d.mts +91 -0
  31. package/dist/bcs.d.mts.map +1 -0
  32. package/dist/bcs.mjs +39 -0
  33. package/dist/bcs.mjs.map +1 -0
  34. package/dist/consts/deployments-slp-mainnet.json +710 -0
  35. package/dist/consts/deployments-slp-testnet.json +109 -0
  36. package/dist/consts/deployments-usdz-mainnet.json +180 -0
  37. package/dist/consts/deployments-usdz-testnet.json +98 -0
  38. package/dist/consts/{deployments-mainnet.json → deployments-zlp-mainnet.json} +278 -42
  39. package/dist/consts/index.cjs +49 -13
  40. package/dist/consts/index.cjs.map +1 -1
  41. package/dist/consts/index.d.cts +81 -11
  42. package/dist/consts/index.d.cts.map +1 -1
  43. package/dist/consts/index.d.mts +81 -11
  44. package/dist/consts/index.d.mts.map +1 -1
  45. package/dist/consts/index.mjs +48 -12
  46. package/dist/consts/index.mjs.map +1 -1
  47. package/dist/consts/price_id_to_object_id.mainnet.json +9 -1
  48. package/dist/factory/SDKFactory.cjs +185 -0
  49. package/dist/factory/SDKFactory.cjs.map +1 -0
  50. package/dist/factory/SDKFactory.d.cts +74 -0
  51. package/dist/factory/SDKFactory.d.cts.map +1 -0
  52. package/dist/factory/SDKFactory.d.mts +74 -0
  53. package/dist/factory/SDKFactory.d.mts.map +1 -0
  54. package/dist/factory/SDKFactory.mjs +179 -0
  55. package/dist/factory/SDKFactory.mjs.map +1 -0
  56. package/dist/implementations/SLPAPI.cjs +829 -0
  57. package/dist/implementations/SLPAPI.cjs.map +1 -0
  58. package/dist/implementations/SLPAPI.d.cts +120 -0
  59. package/dist/implementations/SLPAPI.d.cts.map +1 -0
  60. package/dist/implementations/SLPAPI.d.mts +120 -0
  61. package/dist/implementations/SLPAPI.d.mts.map +1 -0
  62. package/dist/implementations/SLPAPI.mjs +825 -0
  63. package/dist/implementations/SLPAPI.mjs.map +1 -0
  64. package/dist/implementations/SLPDataAPI.cjs +916 -0
  65. package/dist/implementations/SLPDataAPI.cjs.map +1 -0
  66. package/dist/implementations/SLPDataAPI.d.cts +102 -0
  67. package/dist/implementations/SLPDataAPI.d.cts.map +1 -0
  68. package/dist/implementations/SLPDataAPI.d.mts +102 -0
  69. package/dist/implementations/SLPDataAPI.d.mts.map +1 -0
  70. package/dist/implementations/SLPDataAPI.mjs +912 -0
  71. package/dist/implementations/SLPDataAPI.mjs.map +1 -0
  72. package/dist/implementations/USDZAPI.cjs +522 -0
  73. package/dist/implementations/USDZAPI.cjs.map +1 -0
  74. package/dist/implementations/USDZAPI.d.cts +118 -0
  75. package/dist/implementations/USDZAPI.d.cts.map +1 -0
  76. package/dist/implementations/USDZAPI.d.mts +118 -0
  77. package/dist/implementations/USDZAPI.d.mts.map +1 -0
  78. package/dist/implementations/USDZAPI.mjs +518 -0
  79. package/dist/implementations/USDZAPI.mjs.map +1 -0
  80. package/dist/implementations/USDZDataAPI.cjs +697 -0
  81. package/dist/implementations/USDZDataAPI.cjs.map +1 -0
  82. package/dist/implementations/USDZDataAPI.d.cts +86 -0
  83. package/dist/implementations/USDZDataAPI.d.cts.map +1 -0
  84. package/dist/implementations/USDZDataAPI.d.mts +86 -0
  85. package/dist/implementations/USDZDataAPI.d.mts.map +1 -0
  86. package/dist/implementations/USDZDataAPI.mjs +693 -0
  87. package/dist/implementations/USDZDataAPI.mjs.map +1 -0
  88. package/dist/implementations/ZLPAPI.cjs +809 -0
  89. package/dist/implementations/ZLPAPI.cjs.map +1 -0
  90. package/dist/implementations/ZLPAPI.d.cts +121 -0
  91. package/dist/implementations/ZLPAPI.d.cts.map +1 -0
  92. package/dist/implementations/ZLPAPI.d.mts +121 -0
  93. package/dist/implementations/ZLPAPI.d.mts.map +1 -0
  94. package/dist/implementations/ZLPAPI.mjs +805 -0
  95. package/dist/implementations/ZLPAPI.mjs.map +1 -0
  96. package/dist/implementations/ZLPDataAPI.cjs +724 -0
  97. package/dist/implementations/ZLPDataAPI.cjs.map +1 -0
  98. package/dist/implementations/ZLPDataAPI.d.cts +83 -0
  99. package/dist/implementations/ZLPDataAPI.d.cts.map +1 -0
  100. package/dist/implementations/ZLPDataAPI.d.mts +83 -0
  101. package/dist/implementations/ZLPDataAPI.d.mts.map +1 -0
  102. package/dist/implementations/ZLPDataAPI.mjs +720 -0
  103. package/dist/implementations/ZLPDataAPI.mjs.map +1 -0
  104. package/dist/implementations/index.cjs +22 -0
  105. package/dist/implementations/index.cjs.map +1 -0
  106. package/dist/implementations/index.d.cts +11 -0
  107. package/dist/implementations/index.d.cts.map +1 -0
  108. package/dist/implementations/index.d.mts +11 -0
  109. package/dist/implementations/index.d.mts.map +1 -0
  110. package/dist/implementations/index.mjs +13 -0
  111. package/dist/implementations/index.mjs.map +1 -0
  112. package/dist/index.cjs +47 -0
  113. package/dist/index.cjs.map +1 -1
  114. package/dist/index.d.cts +45 -0
  115. package/dist/index.d.cts.map +1 -1
  116. package/dist/index.d.mts +45 -0
  117. package/dist/index.d.mts.map +1 -1
  118. package/dist/index.mjs +45 -0
  119. package/dist/index.mjs.map +1 -1
  120. package/dist/interfaces/base.cjs +8 -0
  121. package/dist/interfaces/base.cjs.map +1 -0
  122. package/dist/interfaces/base.d.cts +293 -0
  123. package/dist/interfaces/base.d.cts.map +1 -0
  124. package/dist/interfaces/base.d.mts +293 -0
  125. package/dist/interfaces/base.d.mts.map +1 -0
  126. package/dist/interfaces/base.mjs +6 -0
  127. package/dist/interfaces/base.mjs.map +1 -0
  128. package/dist/interfaces/index.cjs +29 -0
  129. package/dist/interfaces/index.cjs.map +1 -0
  130. package/dist/interfaces/index.d.cts +13 -0
  131. package/dist/interfaces/index.d.cts.map +1 -0
  132. package/dist/interfaces/index.d.mts +13 -0
  133. package/dist/interfaces/index.d.mts.map +1 -0
  134. package/dist/interfaces/index.mjs +13 -0
  135. package/dist/interfaces/index.mjs.map +1 -0
  136. package/dist/interfaces/slp.cjs +9 -0
  137. package/dist/interfaces/slp.cjs.map +1 -0
  138. package/dist/interfaces/slp.d.cts +115 -0
  139. package/dist/interfaces/slp.d.cts.map +1 -0
  140. package/dist/interfaces/slp.d.mts +115 -0
  141. package/dist/interfaces/slp.d.mts.map +1 -0
  142. package/dist/interfaces/slp.mjs +7 -0
  143. package/dist/interfaces/slp.mjs.map +1 -0
  144. package/dist/interfaces/usdz.cjs +7 -0
  145. package/dist/interfaces/usdz.cjs.map +1 -0
  146. package/dist/interfaces/usdz.d.cts +40 -0
  147. package/dist/interfaces/usdz.d.cts.map +1 -0
  148. package/dist/interfaces/usdz.d.mts +40 -0
  149. package/dist/interfaces/usdz.d.mts.map +1 -0
  150. package/dist/interfaces/usdz.mjs +6 -0
  151. package/dist/interfaces/usdz.mjs.map +1 -0
  152. package/dist/interfaces/zlp.cjs +7 -0
  153. package/dist/interfaces/zlp.cjs.map +1 -0
  154. package/dist/interfaces/zlp.d.cts +45 -0
  155. package/dist/interfaces/zlp.d.cts.map +1 -0
  156. package/dist/interfaces/zlp.d.mts +45 -0
  157. package/dist/interfaces/zlp.d.mts.map +1 -0
  158. package/dist/interfaces/zlp.mjs +6 -0
  159. package/dist/interfaces/zlp.mjs.map +1 -0
  160. package/dist/oracle.cjs +7 -35
  161. package/dist/oracle.cjs.map +1 -1
  162. package/dist/oracle.d.cts +3 -4
  163. package/dist/oracle.d.cts.map +1 -1
  164. package/dist/oracle.d.mts +3 -4
  165. package/dist/oracle.d.mts.map +1 -1
  166. package/dist/oracle.mjs +8 -32
  167. package/dist/oracle.mjs.map +1 -1
  168. package/package.json +1 -1
  169. package/src/abstract/BaseAPI.ts +429 -0
  170. package/src/abstract/BaseDataAPI.ts +204 -0
  171. package/src/abstract/index.ts +7 -0
  172. package/src/bcs.ts +45 -0
  173. package/src/consts/deployments-slp-mainnet.json +710 -0
  174. package/src/consts/deployments-slp-testnet.json +109 -0
  175. package/src/consts/deployments-usdz-mainnet.json +180 -0
  176. package/src/consts/deployments-usdz-testnet.json +98 -0
  177. package/src/consts/{deployments-mainnet.json → deployments-zlp-mainnet.json} +279 -43
  178. package/src/consts/index.ts +143 -41
  179. package/src/consts/price_id_to_object_id.mainnet.json +10 -2
  180. package/src/factory/SDKFactory.ts +282 -0
  181. package/src/implementations/SLPAPI.ts +1207 -0
  182. package/src/implementations/SLPDataAPI.ts +1188 -0
  183. package/src/implementations/USDZAPI.ts +715 -0
  184. package/src/implementations/USDZDataAPI.ts +826 -0
  185. package/src/implementations/ZLPAPI.ts +1130 -0
  186. package/src/implementations/ZLPDataAPI.ts +856 -0
  187. package/src/implementations/index.ts +14 -0
  188. package/src/index.ts +53 -0
  189. package/src/interfaces/base.ts +556 -0
  190. package/src/interfaces/index.ts +45 -0
  191. package/src/interfaces/slp.ts +156 -0
  192. package/src/interfaces/usdz.ts +71 -0
  193. package/src/interfaces/zlp.ts +96 -0
  194. package/src/oracle.ts +12 -42
  195. package/tsconfig.json +4 -2
  196. package/dist/consts/staking/deployments-mainnet.json +0 -12
  197. package/dist/consts/staking/deployments-testnet.json +0 -11
  198. package/src/consts/staking/deployments-mainnet.json +0 -12
  199. package/src/consts/staking/deployments-testnet.json +0 -11
  200. /package/dist/consts/{deployments-testnet.json → deployments-zlp-testnet.json} +0 -0
  201. /package/src/consts/{deployments-testnet.json → deployments-zlp-testnet.json} +0 -0
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Implementation exports
3
+ * Exports all SDK implementations for easy importing
4
+ */
5
+
6
+ // Data API implementations
7
+ export { ZLPDataAPI } from './ZLPDataAPI'
8
+ export { SLPDataAPI } from './SLPDataAPI'
9
+ export { USDZDataAPI } from './USDZDataAPI'
10
+
11
+ // API implementations
12
+ export { ZLPAPI } from './ZLPAPI'
13
+ export { SLPAPI } from './SLPAPI'
14
+ export { USDZAPI } from './USDZAPI'
package/src/index.ts CHANGED
@@ -1,5 +1,58 @@
1
+ /**
2
+ * ZO SDK - Re-architected Multi-LP Token SDK
3
+ *
4
+ * This SDK provides a unified interface for interacting with multiple LP tokens:
5
+ * - ZLP (ZO Liquidity Provider)
6
+ * - SLP (Sudo Liquidity Provider)
7
+ * - USDZ (USD Stablecoin)
8
+ *
9
+ * The architecture follows a common interface pattern with specific implementations
10
+ * for each LP token type, allowing for easy extension to support future LP tokens.
11
+ */
12
+
13
+ // Export new re-architected interfaces and implementations
14
+ export * from './interfaces'
15
+ export * from './abstract'
16
+ export * from './implementations'
17
+ export * from './factory/SDKFactory'
18
+
19
+ // Export legacy components for backward compatibility
1
20
  export * from './api'
21
+ export * from './bcs'
2
22
  export * from './consts'
3
23
  export * from './data'
4
24
  export * from './oracle'
5
25
  export * from './utils'
26
+
27
+ // Re-export commonly used types from Sui SDK
28
+ export type { SuiClient } from '@mysten/sui/client'
29
+ export type { Transaction } from '@mysten/sui/transactions'
30
+
31
+ /**
32
+ * Main SDK Factory instance for convenient access
33
+ *
34
+ * Usage examples:
35
+ *
36
+ * ```typescript
37
+ * import { SDK, LPToken } from '@zo/sdk'
38
+ *
39
+ * // Create ZLP API instance
40
+ * const zlpAPI = SDK.createZLPAPI(network, provider, apiEndpoint, connectionURL)
41
+ *
42
+ * // Create SLP API instance
43
+ * const slpAPI = SDK.createSLPAPI(network, provider, apiEndpoint, connectionURL)
44
+ *
45
+ * // Create USDZ API instance
46
+ * const usdzAPI = SDK.createUSDZAPI(network, provider, apiEndpoint, connectionURL)
47
+ *
48
+ * // Or use the generic factory method
49
+ * const api = SDK.createAPI(LPToken.ZLP, network, provider, apiEndpoint, connectionURL)
50
+ * ```
51
+ */
52
+ export { SDKFactory as SDK } from './factory/SDKFactory'
53
+
54
+ /**
55
+ * Default SDK instance for backward compatibility and convenience
56
+ */
57
+ import { SDKFactory } from './factory/SDKFactory'
58
+ export const defaultSDK = SDKFactory.getInstance()
@@ -0,0 +1,556 @@
1
+ /**
2
+ * Base interfaces for all SDK implementations
3
+ * This file defines the common contracts that all LP token SDKs must implement
4
+ */
5
+
6
+ import type { SuiClient } from '@mysten/sui/client'
7
+ import type { Transaction } from '@mysten/sui/transactions'
8
+ import type { PriceFeed } from '@pythnetwork/pyth-sui-js'
9
+
10
+ import type { IConsts, Network, LPToken } from '../consts'
11
+ import { KioskClient, KioskOwnerCap } from '@mysten/kiosk'
12
+
13
+ // Common data interfaces
14
+ export interface IBaseMarketValuationInfo {
15
+ marketCap: number
16
+ price: number
17
+ supply: number
18
+ apr?: number
19
+ }
20
+
21
+ export interface IBaseMarketInfo {
22
+ lpSupply: string
23
+ positionId: string
24
+ vaultId: string
25
+ symbolId: string
26
+ lpSupplyWithDecimals: number
27
+ referralId?: string
28
+ orderId?: string
29
+ rebaseFeeModel?: string
30
+ apr?: string
31
+ }
32
+
33
+ export interface IBaseVaultInfo {
34
+ liquidity: number
35
+ reservedAmount: number
36
+ unrealisedReservingFeeAmount: number
37
+ accReservingRate: number
38
+ enabled: boolean
39
+ weight: number
40
+ lastUpdate: number
41
+ reservingFeeModel: IBaseReservingFeeModel
42
+ priceConfig: {
43
+ maxInterval: number
44
+ maxConfidence: number
45
+ precision: number
46
+ feeder: string
47
+ }
48
+ }
49
+
50
+ export interface IBaseReservingFeeModel {
51
+ multiplier: number
52
+ }
53
+
54
+ export interface IBaseFundingFeeModel {
55
+ multiplier: number
56
+ max: number
57
+ }
58
+
59
+ export interface IBaseRebaseFeeModel {
60
+ base: number
61
+ multiplier: number
62
+ }
63
+
64
+ export interface IBaseSymbolInfo {
65
+ openingSize: number
66
+ openingAmount: number
67
+ accFundingRate: number
68
+ realisedPnl: number
69
+ unrealisedFundingFeeValue: number
70
+ openEnabled: boolean
71
+ liquidateEnabled: boolean
72
+ decreaseEnabled: boolean
73
+ lastUpdate: number
74
+ fundingFeeModel: IBaseFundingFeeModel
75
+ long: boolean
76
+ priceConfig: {
77
+ maxInterval: number
78
+ maxConfidence: number
79
+ precision: number
80
+ feeder: string
81
+ }
82
+ }
83
+
84
+ export interface IBasePositionInfo {
85
+ id: string
86
+ long: boolean
87
+ owner: string
88
+ version: number
89
+ collateralToken: string
90
+ indexToken: string
91
+ collateralAmount: number
92
+ positionAmount: number
93
+ reservedAmount: number
94
+ positionSize: number
95
+ lastFundingRate: number
96
+ lastReservingRate: number
97
+ reservingFeeAmount: number
98
+ fundingFeeValue: number
99
+ closed: boolean
100
+ openTimestamp: number
101
+ }
102
+
103
+ export interface IBaseOrderInfo {
104
+ id: string
105
+ capId: string
106
+ executed: boolean
107
+ owner: string
108
+ collateralToken: string
109
+ indexToken: string
110
+ feeToken: string
111
+ collateralPriceThreshold: number
112
+ feeAmount: bigint
113
+ long: boolean
114
+ indexPrice: number
115
+ openOrder?: {
116
+ reserveAmount: bigint
117
+ collateralAmount: bigint
118
+ openAmount: bigint
119
+ }
120
+ decreaseOrder?: {
121
+ decreaseAmount: bigint
122
+ takeProfit: boolean
123
+ }
124
+ orderType: 'OPEN_POSITION' | 'DECREASE_POSITION'
125
+ createdAt: number
126
+ v11Order?: boolean
127
+ }
128
+
129
+ export interface IBasePositionConfig {
130
+ decreaseFeeBps: number
131
+ liquidationBonus: number
132
+ liquidationThreshold: number
133
+ maxLeverage: number
134
+ minHoldingDuration: number
135
+ openFeeBps: number
136
+ maxReservedMultiplier: number
137
+ minCollateralValue: number
138
+ }
139
+
140
+ export interface IBasePositionCapInfo {
141
+ positionCapId: string
142
+ symbol0: string
143
+ symbol1: string
144
+ long: boolean
145
+ }
146
+
147
+ export interface IBaseOrderCapInfo {
148
+ orderCapId: string
149
+ symbol0: string
150
+ symbol1: string
151
+ long: boolean
152
+ positionId: string | null
153
+ }
154
+
155
+ export interface IBaseHistory {
156
+ owner: string
157
+ txid: string
158
+ id: string
159
+ created: number
160
+ eventName: string
161
+ indexToken: string
162
+ direction: string
163
+ collateralAmount: number
164
+ collateralPrice: number
165
+ indexPrice: number
166
+ pnl: number
167
+ positionId: string
168
+ volume: number
169
+ fee: number
170
+ network: string
171
+ }
172
+
173
+ export interface IBasePagination {
174
+ total: number
175
+ page: number
176
+ limit: number
177
+ pages: number
178
+ }
179
+
180
+ export interface IBaseHistoryResponse {
181
+ histories: IBaseHistory[]
182
+ pagination: IBasePagination
183
+ }
184
+
185
+ export interface IBaseStaked {
186
+ credentials: IBaseCredential[]
187
+ amount: bigint
188
+ claimable: bigint
189
+ }
190
+
191
+ export interface IBaseStakePool {
192
+ id: string
193
+ enabled: boolean
194
+ lastUpdatedTime: number
195
+ stakedAmount: bigint
196
+ reward: bigint
197
+ startTime: number
198
+ endTime: number
199
+ accRewardPerShare: bigint
200
+ lockDuration: number
201
+ }
202
+
203
+ export interface IBaseCredential {
204
+ id: string
205
+ lockUntil: number
206
+ accRewardPerShare: bigint
207
+ amount: bigint
208
+ claimable: bigint
209
+ }
210
+
211
+ // Abstract base interfaces for SDK implementations
212
+ export interface IBaseDataAPI {
213
+ readonly network: Network
214
+ readonly provider: SuiClient
215
+ readonly apiEndpoint: string
216
+ readonly connectionURL: string
217
+ readonly lpToken: LPToken
218
+ readonly consts: IConsts
219
+
220
+ // Core valuation methods
221
+ valuateVaults(tx: Transaction): any
222
+ valuateSymbols(tx: Transaction): any
223
+ valuate(tx: Transaction): { vaultsValuation: any; symbolsValuation: any }
224
+ valuateMarket(): Promise<IBaseMarketValuationInfo>
225
+
226
+ // Fee methods
227
+ fundingFeeRate(indexToken: string, long: boolean, sender?: string): Promise<number>
228
+ rebaseFeeRate(collateralToken: string, increase: boolean, amount: number, sender?: string): Promise<number>
229
+ reservingFeeRate(collateralToken: string, amount: number, sender?: string): Promise<number>
230
+
231
+ // Market data methods
232
+ getMarketInfo(): Promise<IBaseMarketInfo>
233
+ getVaultInfo(vault: string): Promise<IBaseVaultInfo>
234
+ getSymbolInfo(tokenId: string, long: boolean): Promise<IBaseSymbolInfo>
235
+ getPositionConfig(indexToken: string, long: boolean): Promise<IBasePositionConfig>
236
+ getOpenPositions(batchSize: number, symbol: string): Promise<IBasePositionInfo[]>
237
+
238
+ // User data methods
239
+ getPositionCapInfoList(owner: string): Promise<IBasePositionCapInfo[]>
240
+ getPositionInfoList(positionCapInfoList: IBasePositionCapInfo[], owner: string): Promise<IBasePositionInfo[]>
241
+ getOrderCapInfoList(owner: string): Promise<IBaseOrderCapInfo[]>
242
+ getOrderInfoList(orderCapInfoList: IBaseOrderCapInfo[], owner: string): Promise<IBaseOrderInfo[]>
243
+ getHistory(trader: string, page: number, limit: number, orderType?: string, symbol?: string): Promise<IBaseHistoryResponse>
244
+
245
+ // Staking methods
246
+ getStaked(owner: string): Promise<IBaseStaked>
247
+ getStakePool(): Promise<IBaseStakePool>
248
+
249
+ // Referral methods
250
+ hasReferral(referree: string): Promise<boolean>
251
+ getReferralData(referree: string): Promise<any>
252
+
253
+ // Oracle methods
254
+ getOraclePrice(tokenId: string): Promise<PriceFeed>
255
+ getOraclePrices(tokens: string[]): Promise<PriceFeed[]>
256
+ subOraclePrices(tokens: string[], callback: (price: PriceFeed) => void): Promise<() => void>
257
+ initOracleTxb(tokens: string[], tx?: Transaction): Promise<Transaction>
258
+
259
+ // Utility methods
260
+ validateCache(): void
261
+ }
262
+
263
+ export interface IBaseAPI {
264
+ // LP operations
265
+ deposit(
266
+ coin: string,
267
+ coinObjects: string[],
268
+ amount: number,
269
+ minAmountOut?: number,
270
+ referralAddress?: string,
271
+ sender?: string
272
+ ): Promise<Transaction>
273
+
274
+ withdraw(
275
+ coin: string,
276
+ lpCoinObjects: string[],
277
+ amount: number,
278
+ minAmountOut?: number
279
+ ): Promise<Transaction>
280
+
281
+ swap(
282
+ fromToken: string,
283
+ toToken: string,
284
+ fromAmount: bigint,
285
+ fromCoinObjects: string[],
286
+ ): Promise<Transaction>
287
+
288
+ // Staking
289
+ stake(
290
+ lpCoinObjects: string[],
291
+ amount: bigint,
292
+ pool: string,
293
+ tx?: Transaction
294
+ ): Promise<Transaction>
295
+
296
+ unstake(
297
+ credentials: IBaseCredential[],
298
+ amount: bigint,
299
+ pool: string,
300
+ tx?: Transaction
301
+ ): Promise<Transaction>
302
+
303
+ // Trading operations
304
+ openPosition(
305
+ collateralToken: string,
306
+ indexToken: string,
307
+ size: bigint,
308
+ collateralAmount: bigint,
309
+ coinObjects: string[],
310
+ long: boolean,
311
+ reserveAmount: bigint,
312
+ indexPrice: number,
313
+ collateralPrice: number,
314
+ isLimitOrder?: boolean,
315
+ isIocOrder?: boolean,
316
+ pricesSlippage?: number,
317
+ collateralSlippage?: number,
318
+ relayerFee?: bigint,
319
+ referralAddress?: string,
320
+ sender?: string
321
+ ): Promise<Transaction>
322
+
323
+ decreasePosition(
324
+ pcpId: string,
325
+ collateralToken: string,
326
+ indexToken: string,
327
+ amount: bigint,
328
+ long: boolean,
329
+ indexPrice: number,
330
+ collateralPrice: number,
331
+ isTriggerOrder?: boolean,
332
+ isTakeProfitOrder?: boolean,
333
+ isIocOrder?: boolean,
334
+ pricesSlippage?: number,
335
+ collateralSlippage?: number,
336
+ relayerFee?: bigint,
337
+ coinObjects?: string[]
338
+ ): Promise<Transaction>
339
+
340
+ decreaseMultiPositions(
341
+ positions: Array<{
342
+ pcpId: string,
343
+ collateralToken: string,
344
+ indexToken: string,
345
+ amount: bigint,
346
+ long: boolean,
347
+ indexPrice: number,
348
+ collateralPrice: number,
349
+ isTriggerOrder?: boolean,
350
+ isTakeProfitOrder?: boolean,
351
+ isIocOrder?: boolean,
352
+ pricesSlippage?: number,
353
+ collateralSlippage?: number,
354
+ relayerFee?: bigint,
355
+ coinObjects?: string[]
356
+ }>, tx?: Transaction
357
+ ): Promise<Transaction>
358
+
359
+ pledgeInPosition(
360
+ pcpId: string,
361
+ collateralToken: string,
362
+ indexToken: string,
363
+ amount: number,
364
+ coinObjects: string[],
365
+ long: boolean
366
+ ): Promise<Transaction>
367
+
368
+ redeemFromPosition(
369
+ pcpId: string,
370
+ collateralToken: string,
371
+ indexToken: string,
372
+ amount: number,
373
+ long: boolean
374
+ ): Promise<Transaction>
375
+
376
+ cancelOrder(
377
+ orderCapId: string,
378
+ collateralToken: string,
379
+ indexToken: string,
380
+ long: boolean,
381
+ type: string,
382
+ isV11Order?: boolean
383
+ ): Promise<Transaction>
384
+
385
+ cancelMultiOrders(
386
+ orders: Array<{
387
+ orderCapId: string,
388
+ collateralToken: string,
389
+ indexToken: string,
390
+ long: boolean,
391
+ type: string,
392
+ isV11Order?: boolean
393
+ }>, tx?: Transaction
394
+ ): Promise<Transaction>
395
+
396
+ clearClosedPosition(
397
+ pcpId: string,
398
+ collateralToken: string,
399
+ indexToken: string,
400
+ long: boolean,
401
+ tx: Transaction,
402
+ ): void
403
+
404
+ clearOpenPositionOrder(
405
+ orderCapId: string,
406
+ collateralToken: string,
407
+ indexToken: string,
408
+ long: boolean,
409
+ tx: Transaction,
410
+ isV11Order?: boolean
411
+ ): void
412
+
413
+ clearDecreasePositionOrder(
414
+ orderCapId: string,
415
+ collateralToken: string,
416
+ indexToken: string,
417
+ long: boolean,
418
+ tx: Transaction,
419
+ isV11Order?: boolean
420
+ ): void
421
+
422
+ // S Card operations
423
+ openPositionWithSCard(
424
+ collateralToken: string,
425
+ indexToken: string,
426
+ size: bigint,
427
+ collateralAmount: bigint,
428
+ coinObjects: string[],
429
+ long: boolean,
430
+ reserveAmount: bigint,
431
+ indexPrice: number,
432
+ collateralPrice: number,
433
+ kioskClient: KioskClient,
434
+ kioskCap: KioskOwnerCap,
435
+ scard: string,
436
+ isLimitOrder?: boolean,
437
+ isIocOrder?: boolean,
438
+ pricesSlippage?: number,
439
+ collateralSlippage?: number,
440
+ relayerFee?: bigint,
441
+ referralAddress?: string,
442
+ sender?: string,
443
+ ): Promise<Transaction>
444
+
445
+ decreasePositionWithSCard(
446
+ pcpId: string,
447
+ collateralToken: string,
448
+ indexToken: string,
449
+ amount: bigint,
450
+ long: boolean,
451
+ indexPrice: number,
452
+ collateralPrice: number,
453
+ kioskClient: KioskClient,
454
+ kioskCap: KioskOwnerCap,
455
+ scard: string,
456
+ isTriggerOrder?: boolean,
457
+ isTakeProfitOrder?: boolean,
458
+ isIocOrder?: boolean,
459
+ pricesSlippage?: number,
460
+ collateralSlippage?: number,
461
+ relayerFee?: bigint,
462
+ coinObjects?: string[]
463
+ ): Promise<Transaction>
464
+
465
+ decreaseMultiPositionsWithSCard(
466
+ positions: Array<{
467
+ pcpId: string,
468
+ collateralToken: string,
469
+ indexToken: string,
470
+ amount: bigint,
471
+ long: boolean,
472
+ indexPrice: number,
473
+ collateralPrice: number,
474
+ isTriggerOrder?: boolean,
475
+ isTakeProfitOrder?: boolean,
476
+ isIocOrder?: boolean,
477
+ pricesSlippage?: number,
478
+ collateralSlippage?: number,
479
+ relayerFee?: bigint,
480
+ coinObjects?: string[]
481
+ }>,
482
+ kioskClient: KioskClient,
483
+ kioskCap: KioskOwnerCap,
484
+ scard: string,
485
+ tx?: Transaction
486
+ ): Promise<Transaction>
487
+
488
+ claimTokenFromSCard(
489
+ token: string,
490
+ coinObjects: string[],
491
+ kioskClient: KioskClient,
492
+ kioskCap: KioskOwnerCap,
493
+ scard: string,
494
+ ): Promise<Transaction>
495
+
496
+ // Miscellaneous
497
+ addReferral(
498
+ referrer: string,
499
+ tx?: Transaction
500
+ ): Transaction
501
+
502
+ // Admin operations
503
+ adminUpdatePriceFeed(
504
+ collateralToken: string,
505
+ indexToken: string
506
+ ): Promise<Transaction>
507
+
508
+ adminSettlePosition(
509
+ positionId: string,
510
+ owner: string,
511
+ collateralToken: string,
512
+ indexToken: string,
513
+ long: boolean,
514
+ ): Promise<Transaction>
515
+
516
+ adminDecreasePosition(
517
+ positionId: string,
518
+ owner: string,
519
+ collateralToken: string,
520
+ indexToken: string,
521
+ positionAmount: number,
522
+ amount: bigint,
523
+ long: boolean,
524
+ collateralPrice?: number,
525
+ collateralSlippage?: number,
526
+ relayerFee?: bigint
527
+ ): Promise<Transaction>
528
+
529
+ adminClearClosedPosition(
530
+ positionId: string,
531
+ owner: string,
532
+ collateralToken: string,
533
+ indexToken: string,
534
+ long: boolean,
535
+ tx: Transaction
536
+ ): Promise<void>
537
+ }
538
+
539
+ // Factory interface for creating SDK instances
540
+ export interface ISDKFactory {
541
+ createDataAPI(
542
+ network: Network,
543
+ provider: SuiClient,
544
+ apiEndpoint: string,
545
+ connectionURL: string,
546
+ lpToken: LPToken
547
+ ): IBaseDataAPI
548
+
549
+ createAPI(
550
+ network: Network,
551
+ provider: SuiClient,
552
+ apiEndpoint: string,
553
+ connectionURL: string,
554
+ lpToken: LPToken
555
+ ): IBaseAPI
556
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Interface exports for all LP token types
3
+ * Provides a centralized export point for all SDK interfaces
4
+ */
5
+
6
+ // Base interfaces
7
+ export * from './base'
8
+
9
+ // ZLP interfaces
10
+ export * from './zlp'
11
+
12
+ // SLP interfaces
13
+ export * from './slp'
14
+
15
+ // USDZ interfaces
16
+ export * from './usdz'
17
+
18
+ // Re-export commonly used types for convenience
19
+ export type {
20
+ IBaseMarketValuationInfo,
21
+ IBaseDataAPI,
22
+ IBaseAPI,
23
+ ISDKFactory
24
+ } from './base'
25
+
26
+ export type {
27
+ IZLPMarketValuationInfo,
28
+ IZLPDataAPI,
29
+ IZLPAPI
30
+ } from './zlp'
31
+
32
+ export type {
33
+ ISLPMarketValuationInfo,
34
+ ISLPDataAPI,
35
+ ISLPAPI,
36
+ ISudoMarket,
37
+ ISudoVault,
38
+ ISudoSymbol
39
+ } from './slp'
40
+
41
+ export type {
42
+ IUSDZMarketValuationInfo,
43
+ IUSDZDataAPI,
44
+ IUSDZAPI
45
+ } from './usdz'