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.
Files changed (79) hide show
  1. package/dist/consts/deployments-usdz-mainnet.json +25 -1
  2. package/dist/consts/deployments-zbtcvc-mainnet.json +180 -0
  3. package/dist/consts/deployments-zlp-mainnet.json +97 -1
  4. package/dist/consts/index.cjs +27 -20
  5. package/dist/consts/index.cjs.map +1 -1
  6. package/dist/consts/index.d.cts +5 -17
  7. package/dist/consts/index.d.cts.map +1 -1
  8. package/dist/consts/index.d.mts +5 -17
  9. package/dist/consts/index.d.mts.map +1 -1
  10. package/dist/consts/index.mjs +26 -19
  11. package/dist/consts/index.mjs.map +1 -1
  12. package/dist/consts/price_id_to_object_id.mainnet.json +5 -1
  13. package/dist/factory/SDKFactory.cjs +36 -0
  14. package/dist/factory/SDKFactory.cjs.map +1 -1
  15. package/dist/factory/SDKFactory.d.cts +11 -1
  16. package/dist/factory/SDKFactory.d.cts.map +1 -1
  17. package/dist/factory/SDKFactory.d.mts +11 -1
  18. package/dist/factory/SDKFactory.d.mts.map +1 -1
  19. package/dist/factory/SDKFactory.mjs +36 -0
  20. package/dist/factory/SDKFactory.mjs.map +1 -1
  21. package/dist/implementations/ZBTCVCAPI.cjs +984 -0
  22. package/dist/implementations/ZBTCVCAPI.cjs.map +1 -0
  23. package/dist/implementations/ZBTCVCAPI.d.cts +133 -0
  24. package/dist/implementations/ZBTCVCAPI.d.cts.map +1 -0
  25. package/dist/implementations/ZBTCVCAPI.d.mts +133 -0
  26. package/dist/implementations/ZBTCVCAPI.d.mts.map +1 -0
  27. package/dist/implementations/ZBTCVCAPI.mjs +980 -0
  28. package/dist/implementations/ZBTCVCAPI.mjs.map +1 -0
  29. package/dist/implementations/ZBTCVCDataAPI.cjs +824 -0
  30. package/dist/implementations/ZBTCVCDataAPI.cjs.map +1 -0
  31. package/dist/implementations/ZBTCVCDataAPI.d.cts +94 -0
  32. package/dist/implementations/ZBTCVCDataAPI.d.cts.map +1 -0
  33. package/dist/implementations/ZBTCVCDataAPI.d.mts +94 -0
  34. package/dist/implementations/ZBTCVCDataAPI.d.mts.map +1 -0
  35. package/dist/implementations/ZBTCVCDataAPI.mjs +820 -0
  36. package/dist/implementations/ZBTCVCDataAPI.mjs.map +1 -0
  37. package/dist/implementations/index.cjs +5 -1
  38. package/dist/implementations/index.cjs.map +1 -1
  39. package/dist/implementations/index.d.cts +2 -0
  40. package/dist/implementations/index.d.cts.map +1 -1
  41. package/dist/implementations/index.d.mts +2 -0
  42. package/dist/implementations/index.d.mts.map +1 -1
  43. package/dist/implementations/index.mjs +2 -0
  44. package/dist/implementations/index.mjs.map +1 -1
  45. package/dist/interfaces/index.cjs +2 -0
  46. package/dist/interfaces/index.cjs.map +1 -1
  47. package/dist/interfaces/index.d.cts +2 -0
  48. package/dist/interfaces/index.d.cts.map +1 -1
  49. package/dist/interfaces/index.d.mts +2 -0
  50. package/dist/interfaces/index.d.mts.map +1 -1
  51. package/dist/interfaces/index.mjs +2 -0
  52. package/dist/interfaces/index.mjs.map +1 -1
  53. package/dist/interfaces/zbtcvc.cjs +7 -0
  54. package/dist/interfaces/zbtcvc.cjs.map +1 -0
  55. package/dist/interfaces/zbtcvc.d.cts +64 -0
  56. package/dist/interfaces/zbtcvc.d.cts.map +1 -0
  57. package/dist/interfaces/zbtcvc.d.mts +64 -0
  58. package/dist/interfaces/zbtcvc.d.mts.map +1 -0
  59. package/dist/interfaces/zbtcvc.mjs +6 -0
  60. package/dist/interfaces/zbtcvc.mjs.map +1 -0
  61. package/dist/utils.cjs +7 -3
  62. package/dist/utils.cjs.map +1 -1
  63. package/dist/utils.d.cts.map +1 -1
  64. package/dist/utils.d.mts.map +1 -1
  65. package/dist/utils.mjs +7 -3
  66. package/dist/utils.mjs.map +1 -1
  67. package/package.json +8 -8
  68. package/src/consts/deployments-usdz-mainnet.json +25 -1
  69. package/src/consts/deployments-zbtcvc-mainnet.json +180 -0
  70. package/src/consts/deployments-zlp-mainnet.json +98 -2
  71. package/src/consts/index.ts +28 -35
  72. package/src/consts/price_id_to_object_id.mainnet.json +6 -2
  73. package/src/factory/SDKFactory.ts +50 -0
  74. package/src/implementations/ZBTCVCAPI.ts +1453 -0
  75. package/src/implementations/ZBTCVCDataAPI.ts +985 -0
  76. package/src/implementations/index.ts +2 -0
  77. package/src/interfaces/index.ts +8 -0
  78. package/src/interfaces/zbtcvc.ts +115 -0
  79. 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'
@@ -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
- ? keyof T
91
- : T[K] extends keyof T | infer V
92
- ? V
93
- : never;
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-Z]/
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
- return `${direction}${upperFirstCharacter(token)}`
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 {