zo-sdk 0.1.21 → 0.1.23
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/abstract/BaseDataAPI.d.cts +2 -2
- package/dist/abstract/BaseDataAPI.d.cts.map +1 -1
- package/dist/abstract/BaseDataAPI.d.mts +2 -2
- package/dist/abstract/BaseDataAPI.d.mts.map +1 -1
- package/dist/consts/deployments-zbtcvc-mainnet.json +180 -0
- 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/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/SLPDataAPI.cjs +54 -32
- package/dist/implementations/SLPDataAPI.cjs.map +1 -1
- package/dist/implementations/SLPDataAPI.d.cts +2 -2
- package/dist/implementations/SLPDataAPI.d.cts.map +1 -1
- package/dist/implementations/SLPDataAPI.d.mts +2 -2
- package/dist/implementations/SLPDataAPI.d.mts.map +1 -1
- package/dist/implementations/SLPDataAPI.mjs +54 -32
- package/dist/implementations/SLPDataAPI.mjs.map +1 -1
- package/dist/implementations/USDZAPI.cjs +1 -1
- package/dist/implementations/USDZAPI.cjs.map +1 -1
- package/dist/implementations/USDZAPI.d.cts +1 -1
- package/dist/implementations/USDZAPI.d.cts.map +1 -1
- package/dist/implementations/USDZAPI.d.mts +1 -1
- package/dist/implementations/USDZAPI.d.mts.map +1 -1
- package/dist/implementations/USDZAPI.mjs +1 -1
- package/dist/implementations/USDZAPI.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/base.d.cts +2 -2
- package/dist/interfaces/base.d.cts.map +1 -1
- package/dist/interfaces/base.d.mts +2 -2
- package/dist/interfaces/base.d.mts.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/package.json +8 -8
- package/src/abstract/BaseDataAPI.ts +2 -2
- package/src/consts/deployments-zbtcvc-mainnet.json +180 -0
- package/src/consts/index.ts +28 -35
- package/src/factory/SDKFactory.ts +50 -0
- package/src/implementations/SLPDataAPI.ts +71 -41
- package/src/implementations/USDZAPI.ts +1 -1
- package/src/implementations/ZBTCVCAPI.ts +1453 -0
- package/src/implementations/ZBTCVCDataAPI.ts +985 -0
- package/src/implementations/index.ts +2 -0
- package/src/interfaces/base.ts +2 -2
- package/src/interfaces/index.ts +8 -0
- package/src/interfaces/zbtcvc.ts +115 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
{
|
|
2
|
+
"zo_core": {
|
|
3
|
+
"package": "0xace81f8a3bcaeea116ff3af06453f422d85f08e809ddf28d1a68742a180f6daf",
|
|
4
|
+
"upgraded_package": "0xace81f8a3bcaeea116ff3af06453f422d85f08e809ddf28d1a68742a180f6daf",
|
|
5
|
+
"upgrade_cap": "0xdff7d7d8f63d3b8e4124cf450a88a467c7b2bcec2ab4b368de9541e7b75e25ad",
|
|
6
|
+
"admin_cap": "0x3e84ce42736482e6582025fa317a8ae8bc3f98fd381ff1c86273115c332267dd",
|
|
7
|
+
"market": "0x85802ae3a5bed6dfd47889a02495235c16ee7629dc5ffacce17cae8367f22e96",
|
|
8
|
+
"zbtcvc_metadata": "0x456e147d296b5010dbae31b5067649d78c125d7f22459b2586fbf336124144eb",
|
|
9
|
+
"rebase_fee_model": "0x68989cfe05f2a2ae03614e6614c9e56c353e156eb0ed2939985a0e4bd0028afa",
|
|
10
|
+
"referrals_parent": "0x407d8f6dd41efa088d608229a6fa1f8752bd37aa2300f469d280f7b6d39b8809",
|
|
11
|
+
"vaults_parent": "0xb2a69be9dae2a7bf93487003d2d42574287eeb6134e42b0879eb04e8e1f66230",
|
|
12
|
+
"symbols_parent": "0x04ac055f5522ac3e0d231c3d8dec50c514017951f9962aac260830a1387e8296",
|
|
13
|
+
"positions_parent": "0x35e9356bde384fe881a8e81644cb57924cb6e856985c3b8f48bbce0e6a6108a8",
|
|
14
|
+
"orders_parent": "0x2d74d4fdc53bd4525001ba7d0ab9049d30316c34d3c22ef8e4480af598911df6",
|
|
15
|
+
"vaults": {
|
|
16
|
+
"btcvc": {
|
|
17
|
+
"weight": "1000000000000000000",
|
|
18
|
+
"reserving_fee_model": "0x9b08feed06abf25886e503f0845343d593a8a43f366a544e9fd4954bed2948e1"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"symbols": {}
|
|
22
|
+
},
|
|
23
|
+
"pyth_feeder": {
|
|
24
|
+
"package": "0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e",
|
|
25
|
+
"package_v2": "0x04e20ddf36af412a4096f9014f4a565af9e812db9a05cc40254846cf6ed0ad91",
|
|
26
|
+
"state": "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8",
|
|
27
|
+
"wormhole": {
|
|
28
|
+
"package": "0x5306f64e312b581766351c07af79c72fcb1cd25147157fdc2f8ad76de9a3fb6a",
|
|
29
|
+
"state": "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c"
|
|
30
|
+
},
|
|
31
|
+
"feeder": {
|
|
32
|
+
"sui": "0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37",
|
|
33
|
+
"btc": "0x9a62b4863bdeaabdc9500fce769cf7e72d5585eeb28a6d26e4cafadc13f76ab2",
|
|
34
|
+
"btcvc": "0x9a62b4863bdeaabdc9500fce769cf7e72d5585eeb28a6d26e4cafadc13f76ab2",
|
|
35
|
+
"eth": "0x9193fd47f9a0ab99b6e365a464c8a9ae30e6150fc37ed2a89c1586631f6fc4ab",
|
|
36
|
+
"nusdc": "0x5dec622733a204ca27f5a90d8c2fad453cc6665186fd5dff13a83d0b6c9027ab",
|
|
37
|
+
"usdt": "0x985e3db9f93f76ee8bace7c3dd5cc676a096accd5d9e09e9ae0fb6e492b14572",
|
|
38
|
+
"deep": "0x8c7f3a322b94cc69db2a2ac575cbd94bf5766113324c3a3eceac91e3e88a51ed",
|
|
39
|
+
"wal": "0xeb7e669f74d976c0b99b6ef9801e3a77716a95f1a15754e0f1399ce3fb60973d",
|
|
40
|
+
"xrp": "0x93bfda25cb6b1653a9c769e8216014bd2c06997f3edb479566761fbf2abf6ac2",
|
|
41
|
+
"sol": "0x9d0d275efbd37d8a8855f6f2c761fa5983293dd8ce202ee5196626de8fcd4469",
|
|
42
|
+
"doge": "0xd59a5f5173424ba725a7d033d86f2eadf2745f87a908bd27e1d27339eff598ce",
|
|
43
|
+
"hype": "0x1c047be615eaa5a87afa0e111b20a512dd6c0f4a1f0f691693cf852c1768f35d",
|
|
44
|
+
"ondo": "0xa64a406662db4ecde675fde111033e80629397715afc7fff53064f41dabab42f",
|
|
45
|
+
"trump": "0xd0835474be8cfcc7be4e02fc1bcd85dbdf11a54d061edc302e611ca304f57b14",
|
|
46
|
+
"cetus": "0x24c0247fb22457a719efac7f670cdc79be321b521460bd6bd2ccfa9f80713b14",
|
|
47
|
+
"haedal": "0xbc98681c15de1ca1b80a8e26500d43c77f7113368b024de1bf490afcb0387109",
|
|
48
|
+
"avax": "0x29e37978cb1c9501bda5d7c105f24f0058bc1668637e307fbc290dba48cb918d",
|
|
49
|
+
"bnb": "0x9c6e77f0ecfc46aac395e21c52ccb96518f85acacae743c5b47f4ca5e29826c3",
|
|
50
|
+
"ada": "0xf28e4e40a96948a19805fe76a4da373a262daac47588bac78d73033bce7b5a38",
|
|
51
|
+
"paxg": "0x78394446b806dcd3b26011b1c7fcfab104f95b718299bc98ff730983105bf943",
|
|
52
|
+
"jup": "0xb804ada6f77feb30a73fbed7fc53dc66ff25133dee0815109d4267e43b2e6bdd",
|
|
53
|
+
"aave": "0x4d1862d9ca2ad1f054f606220c22e0bcf37330d57bb82baa2063fd8193fc24ae",
|
|
54
|
+
"fartcoin": "0x330c38d9af008421306242945f9308dc80c0c6a3e30b289a079fbff5ceeb4696",
|
|
55
|
+
"spx": "0xbfa0e395413d94a7c45a9b987431a313a6e9da2e1b892f1924f64a0aff21e59f"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"coins": {
|
|
59
|
+
"sui": {
|
|
60
|
+
"decimals": 9,
|
|
61
|
+
"module": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
62
|
+
"metadata": "0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3"
|
|
63
|
+
},
|
|
64
|
+
"btc": {
|
|
65
|
+
"decimals": 8,
|
|
66
|
+
"module": "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN",
|
|
67
|
+
"metadata": "0x5d3c6e60eeff8a05b693b481539e7847dfe33013e7070cdcb387f5c0cac05dfd"
|
|
68
|
+
},
|
|
69
|
+
"btcvc": {
|
|
70
|
+
"decimals": 8,
|
|
71
|
+
"module": "0x647ac1a9d158fed6fe4cba5bf42c51eceb2638518d1a9e71343f8e92ba7349fe::btcvc::BTCVC",
|
|
72
|
+
"metadata": "0x030dab1f9d1dacde257a109baef6f9d7b99820d087e075f7f736b169e8e89b94"
|
|
73
|
+
},
|
|
74
|
+
"eth": {
|
|
75
|
+
"decimals": 8,
|
|
76
|
+
"module": "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN",
|
|
77
|
+
"metadata": "0x8900e4ceede3363bef086d6b50ca89d816d0e90bf6bc46efefe1f8455e08f50f"
|
|
78
|
+
},
|
|
79
|
+
"nusdc": {
|
|
80
|
+
"decimals": 6,
|
|
81
|
+
"module": "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
82
|
+
"metadata": "0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6"
|
|
83
|
+
},
|
|
84
|
+
"usdt": {
|
|
85
|
+
"decimals": 6,
|
|
86
|
+
"module": "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN",
|
|
87
|
+
"metadata": "0xfb0e3eb97dd158a5ae979dddfa24348063843c5b20eb8381dd5fa7c93699e45c"
|
|
88
|
+
},
|
|
89
|
+
"deep": {
|
|
90
|
+
"decimals": 6,
|
|
91
|
+
"module": "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP",
|
|
92
|
+
"metadata": "0x6e60b051a08fa836f5a7acd7c464c8d9825bc29c44657fe170fe9b8e1e4770c0"
|
|
93
|
+
},
|
|
94
|
+
"wal": {
|
|
95
|
+
"decimals": 9,
|
|
96
|
+
"module": "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
|
|
97
|
+
"metadata": "0xcf8a31804ae40cb3e7183fe57320f87467a7750d4fa701bca1ffbb1edd37781e"
|
|
98
|
+
},
|
|
99
|
+
"xrp": {
|
|
100
|
+
"decimals": 6,
|
|
101
|
+
"module": "0x8592d41b28815030c40cae43bf30a3f75657e57e6028a05c1b56e5f236b1416e::xrp::XRP",
|
|
102
|
+
"metadata": "0x69004e9f9a4981fdee2f3050cf99c7d2f2a7e45b871da2cc056a850e6bf818b3"
|
|
103
|
+
},
|
|
104
|
+
"sol": {
|
|
105
|
+
"decimals": 8,
|
|
106
|
+
"module": "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN",
|
|
107
|
+
"metadata": "0x4d2c39082b4477e3e79dc4562d939147ab90c42fc5f3e4acf03b94383cd69b6e"
|
|
108
|
+
},
|
|
109
|
+
"doge": {
|
|
110
|
+
"decimals": 8,
|
|
111
|
+
"module": "0xe364a361406e7ab4ea4ec17cc4840b18737dd20bd7124a82130aa21422b8fc20::doge::DOGE",
|
|
112
|
+
"metadata": "0xf3da270f549dd26d1d2dd251961d46919d3abb3044a98ef0fd7dd914d3cc9159"
|
|
113
|
+
},
|
|
114
|
+
"hype": {
|
|
115
|
+
"decimals": 8,
|
|
116
|
+
"module": "0xea2748c16bb45cac2d2602d6ad25089d24a814abc9495c0210b8b856617c4e66::hype::HYPE",
|
|
117
|
+
"metadata": "0xc23c06733cab74bd55febf4f7f8a26234385974b048b95a254d2cbd7fde256b2"
|
|
118
|
+
},
|
|
119
|
+
"ondo": {
|
|
120
|
+
"decimals": 8,
|
|
121
|
+
"module": "0xfe7d492e5c3fd9c88ac859d4d37179e301ce78104da40e44ea7bb38911d4ae0a::ondo::ONDO",
|
|
122
|
+
"metadata": "0xa340ffa4f80fc2b4df43f469fb5088b396c20624ee6b54024052977f49be9f82"
|
|
123
|
+
},
|
|
124
|
+
"trump": {
|
|
125
|
+
"decimals": 6,
|
|
126
|
+
"module": "0xbac9a286efdb3520c76c2cbff789ad42c0834c857c3a249915b10d8b5bf8afac::trump::TRUMP",
|
|
127
|
+
"metadata": "0xdea3d7c4b12833a89edd5f04921e800a6e34f9e8256dc514979855d5084212ba"
|
|
128
|
+
},
|
|
129
|
+
"cetus": {
|
|
130
|
+
"decimals": 9,
|
|
131
|
+
"module": "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS",
|
|
132
|
+
"metadata": "0x4c0dce55eff2db5419bbd2d239d1aa22b4a400c01bbb648b058a9883989025da"
|
|
133
|
+
},
|
|
134
|
+
"haedal": {
|
|
135
|
+
"decimals": 9,
|
|
136
|
+
"module": "0x3a304c7feba2d819ea57c3542d68439ca2c386ba02159c740f7b406e592c62ea::haedal::HAEDAL",
|
|
137
|
+
"metadata": "0xcc89fcc22f0d13de3688b94fa16d64a22079186a941914280c67101ff754263c"
|
|
138
|
+
},
|
|
139
|
+
"aave": {
|
|
140
|
+
"decimals": 8,
|
|
141
|
+
"module": "0x398e363d2b93ecb615ca36687657d71bd5cb590b5ebd6c3033ad6956a62b1ca4::aave::AAVE",
|
|
142
|
+
"metadata": "0x0d9fbea2ed02fffc738a5c0bb61ec09cfd5388ac3095a1f0abc99b30a64cb45e"
|
|
143
|
+
},
|
|
144
|
+
"ada": {
|
|
145
|
+
"decimals": 8,
|
|
146
|
+
"module": "0xe0195a3d560e332aba28b4a3aa91c9430c76cc4be0cc43a46015879597b6d338::ada::ADA",
|
|
147
|
+
"metadata": "0x8a87d822e41044f8285127674c0fff2c0598d473dc75f6695ef729bf4caeef27"
|
|
148
|
+
},
|
|
149
|
+
"avax": {
|
|
150
|
+
"decimals": 8,
|
|
151
|
+
"module": "0xdbb90a6e799340738f9a500f955d9053eb54c1011691e27f58cb98762b290c81::avax::AVAX",
|
|
152
|
+
"metadata": "0x33dfac0409b0c134ef11e76f0e71839cb43f957315c69e678398abadc21e3160"
|
|
153
|
+
},
|
|
154
|
+
"fartcoin": {
|
|
155
|
+
"decimals": 9,
|
|
156
|
+
"module": "0xebda4656236c29b3a4472f35ae6a4a27e17b65259611d549b5b260e2f8e5abe2::fartcoin::FARTCOIN",
|
|
157
|
+
"metadata": "0x7a5a0e1dd1d9d8776b5312fd3f14e91d36ee02e97874df768b3b2cd16794ea17"
|
|
158
|
+
},
|
|
159
|
+
"jup": {
|
|
160
|
+
"decimals": 8,
|
|
161
|
+
"module": "0x31095ed9f80427b69635cde750237c3bd98aa806efd31306e13c50ae0b12a500::jup::JUP",
|
|
162
|
+
"metadata": "0x487f2f60529f8dbc41cff75e2f5cf8ebafb86e09f97c5c6df6a8cf7cbbdc04e6"
|
|
163
|
+
},
|
|
164
|
+
"paxg": {
|
|
165
|
+
"decimals": 8,
|
|
166
|
+
"module": "0xa613dcbd506ac7c0f5fd5574e26eaa53c2279bfcbae7e4541af98d697ef9a786::paxg::PAXG",
|
|
167
|
+
"metadata": "0x9ae44fdc2ddd13581c26d913d9fa43e47dd66a347cb7bb6f93036efd2eec9ab4"
|
|
168
|
+
},
|
|
169
|
+
"spx": {
|
|
170
|
+
"decimals": 9,
|
|
171
|
+
"module": "0x9f08c77e89af768d7ee5accf8b66b07d606a84b5939e6896a1ae92d519523eac::spx::SPX",
|
|
172
|
+
"metadata": "0x0400c0f644c94372c3784eba220402cba968659b7e16d640e455b4c72c5cc02c"
|
|
173
|
+
},
|
|
174
|
+
"bnb": {
|
|
175
|
+
"decimals": 8,
|
|
176
|
+
"module": "0x10cb719b69a7f529600e7238460944c3932f98a2a95b48a0728ac3bbb9c95534::bnb::BNB",
|
|
177
|
+
"metadata": "0xcfa4b4e79c836c7c278b7a8675e6fcc8356d6701871371b364fc4af01ac7fba7"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
package/src/consts/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import slpMainnetJson from './deployments-slp-mainnet.json'
|
|
|
3
3
|
import slpTestnetJson from './deployments-slp-testnet.json'
|
|
4
4
|
import usdzMainnetJson from './deployments-usdz-mainnet.json'
|
|
5
5
|
import usdzTestnetJson from './deployments-usdz-testnet.json'
|
|
6
|
+
import zbtcvcMainnetJson from './deployments-zbtcvc-mainnet.json'
|
|
6
7
|
import zlpMainnetJson from './deployments-zlp-mainnet.json'
|
|
7
8
|
import zlpTestnetJson from './deployments-zlp-testnet.json'
|
|
8
9
|
import PriceIdToObjectIdMainnet from './price_id_to_object_id.mainnet.json'
|
|
@@ -43,6 +44,8 @@ export interface IConsts {
|
|
|
43
44
|
adminCap: string
|
|
44
45
|
market: IVersionedContract
|
|
45
46
|
zlpMetadata: IVersionedContract
|
|
47
|
+
usdzMetadata: IVersionedContract
|
|
48
|
+
zbtcvcMetadata: IVersionedContract
|
|
46
49
|
rebaseFeeModel: IVersionedContract
|
|
47
50
|
vaultsParent: string
|
|
48
51
|
symbolsParent: string
|
|
@@ -68,22 +71,6 @@ export interface IConsts {
|
|
|
68
71
|
referralsParent: string
|
|
69
72
|
ordersParent: string
|
|
70
73
|
}
|
|
71
|
-
usdzCore: {
|
|
72
|
-
package: string
|
|
73
|
-
upgradedPackage: string
|
|
74
|
-
upgradeCap: string
|
|
75
|
-
adminCap: string
|
|
76
|
-
market: IVersionedContract
|
|
77
|
-
usdzMetadata: IVersionedContract
|
|
78
|
-
rebaseFeeModel: IVersionedContract
|
|
79
|
-
vaultsParent: string
|
|
80
|
-
symbolsParent: string
|
|
81
|
-
positionsParent: string
|
|
82
|
-
vaults: Record<string, IVault>
|
|
83
|
-
symbols: Record<string, ISymbol>
|
|
84
|
-
referralsParent: string
|
|
85
|
-
ordersParent: string
|
|
86
|
-
}
|
|
87
74
|
zoStaking: {
|
|
88
75
|
package: string
|
|
89
76
|
upgradedPackage: string
|
|
@@ -190,6 +177,7 @@ export enum LPToken {
|
|
|
190
177
|
ZLP = 'ZLP',
|
|
191
178
|
USDZ = 'USDZ',
|
|
192
179
|
SLP = 'SLP',
|
|
180
|
+
ZBTCVC = 'ZBTCVC',
|
|
193
181
|
}
|
|
194
182
|
|
|
195
183
|
function throwNetworkError(network: string): never {
|
|
@@ -198,46 +186,51 @@ function throwNetworkError(network: string): never {
|
|
|
198
186
|
|
|
199
187
|
export function getConsts(network: string, lpToken: LPToken = LPToken.ZLP): IConsts {
|
|
200
188
|
switch (network) {
|
|
201
|
-
case Network.
|
|
202
|
-
let testnetDeployment
|
|
189
|
+
case Network.MAINNET: {
|
|
203
190
|
switch (lpToken) {
|
|
204
|
-
case LPToken.
|
|
205
|
-
|
|
206
|
-
break
|
|
191
|
+
case LPToken.ZLP: {
|
|
192
|
+
return parse(zlpMainnetJson)
|
|
207
193
|
}
|
|
208
194
|
case LPToken.SLP: {
|
|
209
|
-
|
|
210
|
-
|
|
195
|
+
return parse(slpMainnetJson)
|
|
196
|
+
}
|
|
197
|
+
case LPToken.USDZ: {
|
|
198
|
+
return parse(usdzMainnetJson)
|
|
199
|
+
}
|
|
200
|
+
case LPToken.ZBTCVC: {
|
|
201
|
+
return parse(zbtcvcMainnetJson)
|
|
211
202
|
}
|
|
212
203
|
default: {
|
|
213
|
-
|
|
204
|
+
throw new Error(`Unsupported LP token: ${lpToken}`)
|
|
214
205
|
}
|
|
215
206
|
}
|
|
216
|
-
return { ...parse(testnetDeployment) }
|
|
217
207
|
}
|
|
218
|
-
case Network.
|
|
219
|
-
let mainnetDeployment
|
|
208
|
+
case Network.TESTNET: {
|
|
220
209
|
switch (lpToken) {
|
|
221
|
-
case LPToken.
|
|
222
|
-
|
|
223
|
-
break
|
|
210
|
+
case LPToken.ZLP: {
|
|
211
|
+
return parse(zlpTestnetJson)
|
|
224
212
|
}
|
|
225
213
|
case LPToken.SLP: {
|
|
226
|
-
|
|
227
|
-
|
|
214
|
+
return parse(slpTestnetJson)
|
|
215
|
+
}
|
|
216
|
+
case LPToken.USDZ: {
|
|
217
|
+
return parse(usdzTestnetJson)
|
|
218
|
+
}
|
|
219
|
+
case LPToken.ZBTCVC: {
|
|
220
|
+
throw new Error(`ZBTCVC testnet configuration not available`)
|
|
228
221
|
}
|
|
229
222
|
default: {
|
|
230
|
-
|
|
223
|
+
throw new Error(`Unsupported LP token: ${lpToken}`)
|
|
231
224
|
}
|
|
232
225
|
}
|
|
233
|
-
return { ...parse(mainnetDeployment) }
|
|
234
226
|
}
|
|
235
227
|
default: {
|
|
236
|
-
|
|
228
|
+
throwNetworkError(network)
|
|
237
229
|
}
|
|
238
230
|
}
|
|
239
231
|
}
|
|
240
232
|
|
|
233
|
+
export const ZBTCVC_TOKEN_DECIMALS = 8
|
|
241
234
|
export const ZLP_TOKEN_DECIMALS = 6
|
|
242
235
|
export const SLP_TOKEN_DECIMALS = 6
|
|
243
236
|
export const USDZ_TOKEN_DECIMALS = 6
|
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
ZLPAPI,
|
|
18
18
|
ZLPDataAPI,
|
|
19
19
|
} from '../implementations'
|
|
20
|
+
import { ZBTCVCAPI } from '../implementations/ZBTCVCAPI'
|
|
21
|
+
import { ZBTCVCDataAPI } from '../implementations/ZBTCVCDataAPI'
|
|
20
22
|
import type {
|
|
21
23
|
IBaseAPI,
|
|
22
24
|
IBaseDataAPI,
|
|
@@ -25,6 +27,8 @@ import type {
|
|
|
25
27
|
ISLPDataAPI,
|
|
26
28
|
IUSDZAPI,
|
|
27
29
|
IUSDZDataAPI,
|
|
30
|
+
IZBTCVCAPI,
|
|
31
|
+
IZBTCVCDataAPI,
|
|
28
32
|
IZLPAPI,
|
|
29
33
|
IZLPDataAPI,
|
|
30
34
|
} from '../interfaces'
|
|
@@ -36,11 +40,13 @@ export class SDKFactory implements ISDKFactory {
|
|
|
36
40
|
private zlpDataAPIInstance: IZLPDataAPI | null = null
|
|
37
41
|
private slpDataAPIInstance: ISLPDataAPI | null = null
|
|
38
42
|
private usdzDataAPIInstance: IUSDZDataAPI | null = null
|
|
43
|
+
private zbtcvcDataAPIInstance: IZBTCVCDataAPI | null = null
|
|
39
44
|
|
|
40
45
|
// Singleton instances for API
|
|
41
46
|
private zlpAPIInstance: IZLPAPI | null = null
|
|
42
47
|
private slpAPIInstance: ISLPAPI | null = null
|
|
43
48
|
private usdzAPIInstance: IUSDZAPI | null = null
|
|
49
|
+
private zbtcvcAPIInstance: IZBTCVCAPI | null = null
|
|
44
50
|
|
|
45
51
|
private constructor() { }
|
|
46
52
|
|
|
@@ -83,6 +89,12 @@ export class SDKFactory implements ISDKFactory {
|
|
|
83
89
|
}
|
|
84
90
|
return this.usdzDataAPIInstance
|
|
85
91
|
}
|
|
92
|
+
case LPTokenEnum.ZBTCVC: {
|
|
93
|
+
if (!this.zbtcvcDataAPIInstance) {
|
|
94
|
+
this.zbtcvcDataAPIInstance = new ZBTCVCDataAPI(network, provider, apiEndpoint, connectionURL)
|
|
95
|
+
}
|
|
96
|
+
return this.zbtcvcDataAPIInstance
|
|
97
|
+
}
|
|
86
98
|
default: {
|
|
87
99
|
throw new Error(`Unsupported LP token type: ${lpToken}`)
|
|
88
100
|
}
|
|
@@ -118,6 +130,12 @@ export class SDKFactory implements ISDKFactory {
|
|
|
118
130
|
}
|
|
119
131
|
return this.usdzAPIInstance
|
|
120
132
|
}
|
|
133
|
+
case LPTokenEnum.ZBTCVC: {
|
|
134
|
+
if (!this.zbtcvcAPIInstance) {
|
|
135
|
+
this.zbtcvcAPIInstance = new ZBTCVCAPI(network, provider, apiEndpoint, connectionURL)
|
|
136
|
+
}
|
|
137
|
+
return this.zbtcvcAPIInstance
|
|
138
|
+
}
|
|
121
139
|
default: {
|
|
122
140
|
throw new Error(`Unsupported LP token type: ${lpToken}`)
|
|
123
141
|
}
|
|
@@ -214,6 +232,36 @@ export class SDKFactory implements ISDKFactory {
|
|
|
214
232
|
return this.usdzAPIInstance
|
|
215
233
|
}
|
|
216
234
|
|
|
235
|
+
/**
|
|
236
|
+
* Creates a typed DataAPI instance for USDZ (returns singleton)
|
|
237
|
+
*/
|
|
238
|
+
public createZBTCVCDataAPI(
|
|
239
|
+
network: Network,
|
|
240
|
+
provider: SuiClient,
|
|
241
|
+
apiEndpoint: string,
|
|
242
|
+
connectionURL: string,
|
|
243
|
+
): IZBTCVCDataAPI {
|
|
244
|
+
if (!this.zbtcvcDataAPIInstance) {
|
|
245
|
+
this.zbtcvcDataAPIInstance = new ZBTCVCDataAPI(network, provider, apiEndpoint, connectionURL)
|
|
246
|
+
}
|
|
247
|
+
return this.zbtcvcDataAPIInstance
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Creates a typed API instance for USDZ (returns singleton)
|
|
252
|
+
*/
|
|
253
|
+
public createZBTCVCAPI(
|
|
254
|
+
network: Network,
|
|
255
|
+
provider: SuiClient,
|
|
256
|
+
apiEndpoint: string,
|
|
257
|
+
connectionURL: string,
|
|
258
|
+
): IZBTCVCAPI {
|
|
259
|
+
if (!this.zbtcvcAPIInstance) {
|
|
260
|
+
this.zbtcvcAPIInstance = new ZBTCVCAPI(network, provider, apiEndpoint, connectionURL)
|
|
261
|
+
}
|
|
262
|
+
return this.zbtcvcAPIInstance
|
|
263
|
+
}
|
|
264
|
+
|
|
217
265
|
/**
|
|
218
266
|
* Validates if a given LP token is supported
|
|
219
267
|
*/
|
|
@@ -235,9 +283,11 @@ export class SDKFactory implements ISDKFactory {
|
|
|
235
283
|
this.zlpDataAPIInstance = null
|
|
236
284
|
this.slpDataAPIInstance = null
|
|
237
285
|
this.usdzDataAPIInstance = null
|
|
286
|
+
this.zbtcvcAPIInstance = null
|
|
238
287
|
this.zlpAPIInstance = null
|
|
239
288
|
this.slpAPIInstance = null
|
|
240
289
|
this.usdzAPIInstance = null
|
|
290
|
+
this.zbtcvcAPIInstance = null
|
|
241
291
|
}
|
|
242
292
|
|
|
243
293
|
/**
|
|
@@ -326,33 +326,47 @@ export class SLPDataAPI extends BaseDataAPI implements ISLPDataAPI {
|
|
|
326
326
|
public async getPositionInfoList(
|
|
327
327
|
positionCapInfoList: ISLPPositionCapInfo[],
|
|
328
328
|
owner: string,
|
|
329
|
+
batchSize = 10,
|
|
329
330
|
): Promise<ISLPPositionInfo[]> {
|
|
330
331
|
const positionInfoList: ISLPPositionInfo[] = []
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
332
|
+
|
|
333
|
+
// Process in batches of 10
|
|
334
|
+
for (let i = 0; i < positionCapInfoList.length; i += batchSize) {
|
|
335
|
+
const batch = positionCapInfoList.slice(i, i + batchSize)
|
|
336
|
+
|
|
337
|
+
await Promise.all(batch.map(async (positionCapInfo) => {
|
|
338
|
+
try {
|
|
339
|
+
const positionRaw = await this.provider.getDynamicFieldObject({
|
|
340
|
+
parentId: this.consts.sudoCore.positionsParent,
|
|
341
|
+
name: {
|
|
342
|
+
type: `${this.consts.sudoCore.package}::market::PositionName<${
|
|
343
|
+
positionCapInfo.symbol0
|
|
344
|
+
}, ${positionCapInfo.symbol1}, ${
|
|
345
|
+
this.consts.sudoCore.package
|
|
338
346
|
}::market::${positionCapInfo.long ? 'LONG' : 'SHORT'}>`,
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
347
|
+
value: {
|
|
348
|
+
owner,
|
|
349
|
+
id: positionCapInfo.positionCapId,
|
|
350
|
+
},
|
|
342
351
|
},
|
|
343
|
-
}
|
|
344
|
-
})
|
|
352
|
+
})
|
|
345
353
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
354
|
+
if (positionRaw?.data?.content) {
|
|
355
|
+
positionInfoList.push(
|
|
356
|
+
await this.parsePositionInfo(
|
|
357
|
+
positionRaw,
|
|
358
|
+
positionCapInfo.positionCapId,
|
|
359
|
+
),
|
|
360
|
+
)
|
|
361
|
+
}
|
|
353
362
|
}
|
|
354
|
-
|
|
355
|
-
|
|
363
|
+
catch (error) {
|
|
364
|
+
// Position might have been deleted after force settlement
|
|
365
|
+
console.warn(`Failed to parse position info for position cap ID ${positionCapInfo.positionCapId}: ${error}`)
|
|
366
|
+
// Continue with next position without adding this one to the list
|
|
367
|
+
}
|
|
368
|
+
}))
|
|
369
|
+
}
|
|
356
370
|
|
|
357
371
|
return positionInfoList.sort((a, b) =>
|
|
358
372
|
a.openTimestamp > b.openTimestamp ? 1 : -1,
|
|
@@ -808,31 +822,47 @@ export class SLPDataAPI extends BaseDataAPI implements ISLPDataAPI {
|
|
|
808
822
|
public async getOrderInfoList(
|
|
809
823
|
orderCapInfoList: ISLPOrderCapInfo[],
|
|
810
824
|
owner: string,
|
|
825
|
+
batchSize = 10,
|
|
811
826
|
): Promise<ISLPOrderInfo[]> {
|
|
812
827
|
const orderInfoList: ISLPOrderInfo[] = []
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
828
|
+
|
|
829
|
+
// Process in batches of 10
|
|
830
|
+
for (let i = 0; i < orderCapInfoList.length; i += batchSize) {
|
|
831
|
+
const batch = orderCapInfoList.slice(i, i + batchSize)
|
|
832
|
+
|
|
833
|
+
await Promise.all(batch.map(async (orderCapInfo) => {
|
|
834
|
+
try {
|
|
835
|
+
const orderRaw = await this.provider.getDynamicFieldObject({
|
|
836
|
+
parentId: this.consts.sudoCore.ordersParent,
|
|
837
|
+
name: {
|
|
838
|
+
type: `${this.consts.sudoCore.package}::market::OrderName<${
|
|
839
|
+
orderCapInfo.symbol0
|
|
840
|
+
}, ${orderCapInfo.symbol1}, ${
|
|
841
|
+
this.consts.sudoCore.package
|
|
842
|
+
}::market::${orderCapInfo.long ? 'LONG' : 'SHORT'}, ${
|
|
843
|
+
this.consts.coins.sui.module
|
|
821
844
|
}>`,
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
845
|
+
value: {
|
|
846
|
+
owner,
|
|
847
|
+
id: orderCapInfo.orderCapId,
|
|
848
|
+
position_id: {
|
|
849
|
+
vec: orderCapInfo.positionId ? [orderCapInfo.positionId] : [],
|
|
850
|
+
},
|
|
827
851
|
},
|
|
828
852
|
},
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
853
|
+
})
|
|
854
|
+
orderInfoList.push(
|
|
855
|
+
this.parseOrderInfo(orderRaw, orderCapInfo.orderCapId),
|
|
856
|
+
)
|
|
857
|
+
}
|
|
858
|
+
catch (error) {
|
|
859
|
+
// Order might have been deleted
|
|
860
|
+
console.warn(`Failed to parse order info for order cap ID ${orderCapInfo.orderCapId}: ${error}`)
|
|
861
|
+
// Continue with next order without adding this one to the list
|
|
862
|
+
}
|
|
863
|
+
}))
|
|
864
|
+
}
|
|
865
|
+
|
|
836
866
|
return orderInfoList.sort((a, b) => (a.createdAt > b.createdAt ? 1 : -1))
|
|
837
867
|
}
|
|
838
868
|
|
|
@@ -113,7 +113,7 @@ export class USDZAPI extends BaseAPI implements IUSDZAPI {
|
|
|
113
113
|
throw new Error(`Method not implemented in ${this.constructor.name}.`)
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
public getPositionInfoList(_positionCapInfoList: IBasePositionCapInfo[], _owner: string): Promise<IBasePositionInfo[]> {
|
|
116
|
+
public getPositionInfoList(_positionCapInfoList: IBasePositionCapInfo[], _owner: string, _batchSize?: number): Promise<IBasePositionInfo[]> {
|
|
117
117
|
throw new Error(`Method not implemented in ${this.constructor.name}.`)
|
|
118
118
|
}
|
|
119
119
|
|