zo-sdk 0.1.22 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/consts/deployments-usdz-mainnet.json +25 -1
- package/dist/consts/deployments-zbtcvc-mainnet.json +180 -0
- package/dist/consts/deployments-zlp-mainnet.json +97 -1
- package/dist/consts/index.cjs +27 -20
- package/dist/consts/index.cjs.map +1 -1
- package/dist/consts/index.d.cts +5 -17
- package/dist/consts/index.d.cts.map +1 -1
- package/dist/consts/index.d.mts +5 -17
- package/dist/consts/index.d.mts.map +1 -1
- package/dist/consts/index.mjs +26 -19
- package/dist/consts/index.mjs.map +1 -1
- package/dist/consts/price_id_to_object_id.mainnet.json +5 -1
- package/dist/factory/SDKFactory.cjs +36 -0
- package/dist/factory/SDKFactory.cjs.map +1 -1
- package/dist/factory/SDKFactory.d.cts +11 -1
- package/dist/factory/SDKFactory.d.cts.map +1 -1
- package/dist/factory/SDKFactory.d.mts +11 -1
- package/dist/factory/SDKFactory.d.mts.map +1 -1
- package/dist/factory/SDKFactory.mjs +36 -0
- package/dist/factory/SDKFactory.mjs.map +1 -1
- package/dist/implementations/ZBTCVCAPI.cjs +984 -0
- package/dist/implementations/ZBTCVCAPI.cjs.map +1 -0
- package/dist/implementations/ZBTCVCAPI.d.cts +133 -0
- package/dist/implementations/ZBTCVCAPI.d.cts.map +1 -0
- package/dist/implementations/ZBTCVCAPI.d.mts +133 -0
- package/dist/implementations/ZBTCVCAPI.d.mts.map +1 -0
- package/dist/implementations/ZBTCVCAPI.mjs +980 -0
- package/dist/implementations/ZBTCVCAPI.mjs.map +1 -0
- package/dist/implementations/ZBTCVCDataAPI.cjs +824 -0
- package/dist/implementations/ZBTCVCDataAPI.cjs.map +1 -0
- package/dist/implementations/ZBTCVCDataAPI.d.cts +94 -0
- package/dist/implementations/ZBTCVCDataAPI.d.cts.map +1 -0
- package/dist/implementations/ZBTCVCDataAPI.d.mts +94 -0
- package/dist/implementations/ZBTCVCDataAPI.d.mts.map +1 -0
- package/dist/implementations/ZBTCVCDataAPI.mjs +820 -0
- package/dist/implementations/ZBTCVCDataAPI.mjs.map +1 -0
- package/dist/implementations/index.cjs +5 -1
- package/dist/implementations/index.cjs.map +1 -1
- package/dist/implementations/index.d.cts +2 -0
- package/dist/implementations/index.d.cts.map +1 -1
- package/dist/implementations/index.d.mts +2 -0
- package/dist/implementations/index.d.mts.map +1 -1
- package/dist/implementations/index.mjs +2 -0
- package/dist/implementations/index.mjs.map +1 -1
- package/dist/interfaces/index.cjs +2 -0
- package/dist/interfaces/index.cjs.map +1 -1
- package/dist/interfaces/index.d.cts +2 -0
- package/dist/interfaces/index.d.cts.map +1 -1
- package/dist/interfaces/index.d.mts +2 -0
- package/dist/interfaces/index.d.mts.map +1 -1
- package/dist/interfaces/index.mjs +2 -0
- package/dist/interfaces/index.mjs.map +1 -1
- package/dist/interfaces/zbtcvc.cjs +7 -0
- package/dist/interfaces/zbtcvc.cjs.map +1 -0
- package/dist/interfaces/zbtcvc.d.cts +64 -0
- package/dist/interfaces/zbtcvc.d.cts.map +1 -0
- package/dist/interfaces/zbtcvc.d.mts +64 -0
- package/dist/interfaces/zbtcvc.d.mts.map +1 -0
- package/dist/interfaces/zbtcvc.mjs +6 -0
- package/dist/interfaces/zbtcvc.mjs.map +1 -0
- package/dist/utils.cjs +7 -3
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts.map +1 -1
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +7 -3
- package/dist/utils.mjs.map +1 -1
- package/package.json +8 -8
- package/src/consts/deployments-usdz-mainnet.json +25 -1
- package/src/consts/deployments-zbtcvc-mainnet.json +180 -0
- package/src/consts/deployments-zlp-mainnet.json +98 -2
- package/src/consts/index.ts +28 -35
- package/src/consts/price_id_to_object_id.mainnet.json +6 -2
- package/src/factory/SDKFactory.ts +50 -0
- package/src/implementations/ZBTCVCAPI.ts +1453 -0
- package/src/implementations/ZBTCVCDataAPI.ts +985 -0
- package/src/implementations/index.ts +2 -0
- package/src/interfaces/index.ts +8 -0
- package/src/interfaces/zbtcvc.ts +115 -0
- package/src/utils.ts +12 -7
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
// Data API implementations
|
|
7
7
|
export { SLPDataAPI } from './SLPDataAPI'
|
|
8
8
|
export { USDZDataAPI } from './USDZDataAPI'
|
|
9
|
+
export { ZBTCVCDataAPI } from './ZBTCVCDataAPI'
|
|
9
10
|
export { ZLPDataAPI } from './ZLPDataAPI'
|
|
10
11
|
|
|
11
12
|
// API implementations
|
|
12
13
|
export { SLPAPI } from './SLPAPI'
|
|
13
14
|
export { USDZAPI } from './USDZAPI'
|
|
15
|
+
export { ZBTCVCAPI } from './ZBTCVCAPI'
|
|
14
16
|
export { ZLPAPI } from './ZLPAPI'
|
package/src/interfaces/index.ts
CHANGED
|
@@ -15,6 +15,9 @@ export * from './slp'
|
|
|
15
15
|
// USDZ interfaces
|
|
16
16
|
export * from './usdz'
|
|
17
17
|
|
|
18
|
+
// USDZ interfaces
|
|
19
|
+
export * from './zbtcvc'
|
|
20
|
+
|
|
18
21
|
// Re-export commonly used types for convenience
|
|
19
22
|
export type {
|
|
20
23
|
IBaseAPI,
|
|
@@ -35,6 +38,11 @@ export type {
|
|
|
35
38
|
IUSDZDataAPI,
|
|
36
39
|
IUSDZMarketValuationInfo,
|
|
37
40
|
} from './usdz'
|
|
41
|
+
export type {
|
|
42
|
+
IZBTCVCAPI,
|
|
43
|
+
IZBTCVCDataAPI,
|
|
44
|
+
IZBTCVCMarketValuationInfo,
|
|
45
|
+
} from './zbtcvc'
|
|
38
46
|
export type {
|
|
39
47
|
IZLPAPI,
|
|
40
48
|
IZLPDataAPI,
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* USDZ-specific interfaces and types
|
|
3
|
+
* Extends base interfaces with USDZ-specific implementations
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { Transaction } from '@mysten/sui/transactions'
|
|
7
|
+
|
|
8
|
+
import type {
|
|
9
|
+
IBaseAPI,
|
|
10
|
+
IBaseCredential,
|
|
11
|
+
IBaseDataAPI,
|
|
12
|
+
IBaseFundingFeeModel,
|
|
13
|
+
IBaseHistory,
|
|
14
|
+
IBaseMarketInfo,
|
|
15
|
+
IBaseMarketValuationInfo,
|
|
16
|
+
IBaseOrderCapInfo,
|
|
17
|
+
IBaseOrderInfo,
|
|
18
|
+
IBasePositionCapInfo,
|
|
19
|
+
IBasePositionConfig,
|
|
20
|
+
IBasePositionInfo,
|
|
21
|
+
IBaseRebaseFeeModel,
|
|
22
|
+
IBaseReservingFeeModel,
|
|
23
|
+
IBaseStakePool,
|
|
24
|
+
IBaseSymbolInfo,
|
|
25
|
+
IBaseVaultInfo,
|
|
26
|
+
} from './base'
|
|
27
|
+
|
|
28
|
+
// USDZ-specific interfaces
|
|
29
|
+
export interface IZBTCVCMarketValuationInfo extends IBaseMarketValuationInfo { }
|
|
30
|
+
|
|
31
|
+
export interface IZBTCVCVaultInfo extends IBaseVaultInfo { }
|
|
32
|
+
|
|
33
|
+
export interface IZBTCVCReservingFeeModel extends IBaseReservingFeeModel { }
|
|
34
|
+
|
|
35
|
+
export interface IZBTCVCFundingFeeModel extends IBaseFundingFeeModel { }
|
|
36
|
+
|
|
37
|
+
export interface IZBTCVCRebaseFeeModel extends IBaseRebaseFeeModel { }
|
|
38
|
+
|
|
39
|
+
export interface IZBTCVCSymbolInfo extends IBaseSymbolInfo { }
|
|
40
|
+
|
|
41
|
+
export interface IZBTCVCMarketInfo extends IBaseMarketInfo {
|
|
42
|
+
// USDZ-specific market info fields can be added here
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface IZBTCVCPositionInfo extends IBasePositionInfo {
|
|
46
|
+
// USDZ-specific position fields can be added here
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface IZBTCVCPositionConfig extends IBasePositionConfig { }
|
|
50
|
+
|
|
51
|
+
export interface IZBTCVCPositionCapInfo extends IBasePositionCapInfo { }
|
|
52
|
+
|
|
53
|
+
export interface IZBTCVCOrderInfo extends IBaseOrderInfo { }
|
|
54
|
+
|
|
55
|
+
export interface IZBTCVCOrderCapInfo extends IBaseOrderCapInfo { }
|
|
56
|
+
|
|
57
|
+
export interface IZBTCVCHistory extends IBaseHistory {
|
|
58
|
+
// USDZ-specific history fields can be added here
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface IZBTCVCStakePool extends IBaseStakePool {
|
|
62
|
+
// USDZ-specific stake pool fields can be added here
|
|
63
|
+
rewardRate: bigint
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface IZBTCVCCredential extends IBaseCredential {
|
|
67
|
+
// USDZ-specific credential fields can be added here
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// USDZ Symbol Config interfaces
|
|
71
|
+
export interface IZBTCVCPositionInstantExitFeeConfig {
|
|
72
|
+
instant_exit_tier_1_duration_threshold: number
|
|
73
|
+
instant_exit_tier_1_fee_bps: number
|
|
74
|
+
instant_exit_tier_1_fee_enabled: boolean
|
|
75
|
+
instant_exit_tier_2_duration_threshold: number
|
|
76
|
+
instant_exit_tier_2_fee_bps: number
|
|
77
|
+
instant_exit_tier_2_fee_enabled: boolean
|
|
78
|
+
instant_exit_tier_3_duration_threshold: number
|
|
79
|
+
instant_exit_tier_3_fee_bps: number
|
|
80
|
+
instant_exit_tier_3_fee_enabled: boolean
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface IZBTCVCSymbolConfig {
|
|
84
|
+
id: string
|
|
85
|
+
max_opening_size: number
|
|
86
|
+
max_opening_size_enabled: boolean
|
|
87
|
+
max_opening_size_per_position: number
|
|
88
|
+
max_opening_size_per_position_enabled: boolean
|
|
89
|
+
instant_exit_fee_config: IZBTCVCPositionInstantExitFeeConfig
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// USDZ-specific data API interface
|
|
93
|
+
export interface IZBTCVCDataAPI extends IBaseDataAPI {
|
|
94
|
+
getSymbolConfig: (indexToken: string, long: boolean) => Promise<IZBTCVCSymbolConfig | null>
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// USDZ-specific API interface
|
|
98
|
+
export interface IZBTCVCAPI extends IBaseAPI {
|
|
99
|
+
depositPtb: (
|
|
100
|
+
coin: string,
|
|
101
|
+
coinObjects: string[],
|
|
102
|
+
amount: number,
|
|
103
|
+
minAmountOut?: number,
|
|
104
|
+
referralAddress?: string,
|
|
105
|
+
sender?: string,
|
|
106
|
+
tx?: Transaction,
|
|
107
|
+
sponsoredTx?: boolean,
|
|
108
|
+
suiCoinObjectsForPythUpdate?: string[],
|
|
109
|
+
) => Promise<any>
|
|
110
|
+
stakeCoinObject: (
|
|
111
|
+
coinObject: any,
|
|
112
|
+
pool: string,
|
|
113
|
+
tx?: Transaction,
|
|
114
|
+
) => any
|
|
115
|
+
}
|
package/src/utils.ts
CHANGED
|
@@ -87,10 +87,10 @@ export function parseValue(field: any): number {
|
|
|
87
87
|
|
|
88
88
|
export type ReversedKeyValue<T extends object> = {
|
|
89
89
|
[K in keyof T]: T[K] extends keyof T
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
? keyof T
|
|
91
|
+
: T[K] extends keyof T | infer V
|
|
92
|
+
? V
|
|
93
|
+
: never;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export function reverseKeyValue<T extends object>(obj: T): ReversedKeyValue<T> {
|
|
@@ -107,8 +107,8 @@ export function reverseKeyValue<T extends object>(obj: T): ReversedKeyValue<T> {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
export function parseSymbolKey(input: string): string[] {
|
|
110
|
-
// This regex will match uppercase letters
|
|
111
|
-
const regex = /[A-
|
|
110
|
+
// This regex will match uppercase letters and numeric letters
|
|
111
|
+
const regex = /[A-Z0-9]/
|
|
112
112
|
let result: string[] = []
|
|
113
113
|
let wordStart = 0
|
|
114
114
|
|
|
@@ -133,8 +133,13 @@ export function upperFirstCharacter(word: string): string {
|
|
|
133
133
|
return word.charAt(0).toUpperCase() + word.slice(1)
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
function isLetter(char: string): boolean {
|
|
137
|
+
return /^[a-z]$/i.test(char)
|
|
138
|
+
}
|
|
139
|
+
|
|
136
140
|
export function joinSymbol(direction: string, token: string): string {
|
|
137
|
-
|
|
141
|
+
const firstChar = token.charAt(0)
|
|
142
|
+
return `${direction}${isLetter(firstChar) ? upperFirstCharacter(token) : `_${token}`}`
|
|
138
143
|
}
|
|
139
144
|
|
|
140
145
|
export function suiSymbolToSymbol(symbol: string, consts: IConsts): string {
|