zo-sdk 0.0.36 → 0.0.38
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-mainnet.json +27 -183
- package/dist/data.cjs +78 -42
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.cts +16 -7
- package/dist/data.d.cts.map +1 -1
- package/dist/data.d.mts +16 -7
- package/dist/data.d.mts.map +1 -1
- package/dist/data.mjs +78 -42
- package/dist/data.mjs.map +1 -1
- package/package.json +1 -1
- package/src/consts/deployments-mainnet.json +28 -184
- package/src/data.ts +100 -43
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"zo_core": {
|
|
3
3
|
"package": "0xf7fade57462e56e2eff1d7adef32e4fd285b21fd81f983f407bb7110ca766cda",
|
|
4
|
-
"upgraded_package": "
|
|
4
|
+
"upgraded_package": "0x31b50470bdb46a7e465551a319059c1057479b24e23c5e6d4053d206c76d75c1",
|
|
5
5
|
"upgrade_cap": "0xcc96f78abe0b868afaab05954ccc6357afb5d379a21389d6eb88dda8b1f60052",
|
|
6
6
|
"admin_cap": "0xbc10f6481f2b5d6185c73ee680aa90a60fe3854d9f638e00f7e00d3b6a88e2b8",
|
|
7
7
|
"market": "0x35c667bd8c401036103992791a924f31df0d104256a9e2313acee5b1bcf05b7e",
|
|
@@ -36,288 +36,132 @@
|
|
|
36
36
|
},
|
|
37
37
|
"symbols": {
|
|
38
38
|
"long_btc": {
|
|
39
|
-
"supported_collaterals": [
|
|
40
|
-
"sui",
|
|
41
|
-
"deep",
|
|
42
|
-
"nusdc",
|
|
43
|
-
"wal",
|
|
44
|
-
"cetus"
|
|
45
|
-
],
|
|
39
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
46
40
|
"funding_fee_model": "0x116f08a986e360abe00dc936d363f94e32893af75fb1c3d294c97b8e915a7cdc",
|
|
47
41
|
"position_config": "0x9278d5af190ec9df19c2b9783b82cc8686acbf8bd79b3697d5f678d834f6f9cb"
|
|
48
42
|
},
|
|
49
43
|
"short_btc": {
|
|
50
|
-
"supported_collaterals": [
|
|
51
|
-
"sui",
|
|
52
|
-
"deep",
|
|
53
|
-
"nusdc",
|
|
54
|
-
"wal",
|
|
55
|
-
"cetus"
|
|
56
|
-
],
|
|
44
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
57
45
|
"funding_fee_model": "0xc31c0c54cb3611d4c79cd44946bdd3d37f3de56872d859f5af1babc669b70587",
|
|
58
46
|
"position_config": "0x5a50ce2dfc114794977d7543d1f4425082428165a561641ab34bd175e2d5080a"
|
|
59
47
|
},
|
|
60
48
|
"long_eth": {
|
|
61
|
-
"supported_collaterals": [
|
|
62
|
-
"sui",
|
|
63
|
-
"deep",
|
|
64
|
-
"nusdc",
|
|
65
|
-
"wal",
|
|
66
|
-
"cetus"
|
|
67
|
-
],
|
|
49
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
68
50
|
"funding_fee_model": "0x35e4c27e7a15cac296b7be32d3ba1361bd8415e8cf3fdd7bbdc2db349111399d",
|
|
69
51
|
"position_config": "0x27c55e0d778b130ce66d09e091793e78313a2c3133e6c0013dcab924db027bb3"
|
|
70
52
|
},
|
|
71
53
|
"short_eth": {
|
|
72
|
-
"supported_collaterals": [
|
|
73
|
-
"sui",
|
|
74
|
-
"deep",
|
|
75
|
-
"nusdc",
|
|
76
|
-
"wal",
|
|
77
|
-
"cetus"
|
|
78
|
-
],
|
|
54
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
79
55
|
"funding_fee_model": "0x393e3948cf57d15d14028d0c7ae5152d1d4af270f2532d1df92f32de40270cca",
|
|
80
56
|
"position_config": "0x29a12984ee68f250972bc81251ce9c59eba949eb0626421e92e248a4300476de"
|
|
81
57
|
},
|
|
82
58
|
"long_xrp": {
|
|
83
|
-
"supported_collaterals": [
|
|
84
|
-
"sui",
|
|
85
|
-
"deep",
|
|
86
|
-
"nusdc",
|
|
87
|
-
"wal",
|
|
88
|
-
"cetus"
|
|
89
|
-
],
|
|
59
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
90
60
|
"funding_fee_model": "0xa2e7bbc8e1857f6b11c47413c724065ff120cf185552ff263c063e1d4961f971",
|
|
91
61
|
"position_config": "0x7af35bf5e3bf4878913f9b298910bb6e05d5866e15fd82e8d99b78ae59d1fda7"
|
|
92
62
|
},
|
|
93
63
|
"short_xrp": {
|
|
94
|
-
"supported_collaterals": [
|
|
95
|
-
"sui",
|
|
96
|
-
"deep",
|
|
97
|
-
"nusdc",
|
|
98
|
-
"wal",
|
|
99
|
-
"cetus"
|
|
100
|
-
],
|
|
64
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
101
65
|
"funding_fee_model": "0x473c6cb03ed14425bd0efd315158929c340a09f44ec63539d84db49d383ad181",
|
|
102
66
|
"position_config": "0x8e777b8ccb5d9c61591bf36790b467ba65515727e39e08be79552bcc7e414f73"
|
|
103
67
|
},
|
|
104
68
|
"long_sol": {
|
|
105
|
-
"supported_collaterals": [
|
|
106
|
-
"sui",
|
|
107
|
-
"deep",
|
|
108
|
-
"nusdc",
|
|
109
|
-
"wal",
|
|
110
|
-
"cetus"
|
|
111
|
-
],
|
|
69
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
112
70
|
"funding_fee_model": "0x827c0d53e7260a6081c729c8010beb3532771310fcf1cd63b3fb04623da97d01",
|
|
113
71
|
"position_config": "0x1229fa25bafbf7b06d545e7aaf16166099a32b8a52f92da49a5f9faf38815e64"
|
|
114
72
|
},
|
|
115
73
|
"short_sol": {
|
|
116
|
-
"supported_collaterals": [
|
|
117
|
-
"sui",
|
|
118
|
-
"deep",
|
|
119
|
-
"nusdc",
|
|
120
|
-
"wal",
|
|
121
|
-
"cetus"
|
|
122
|
-
],
|
|
74
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
123
75
|
"funding_fee_model": "0x8011208fd49d17b14072f6e821ca185fb34aec3eba703cedaf1c39a96e441b77",
|
|
124
76
|
"position_config": "0x487e5b93dc6be50dd60d727e28924031d254b2426f029eed9d30573f2fb094da"
|
|
125
77
|
},
|
|
126
78
|
"long_doge": {
|
|
127
|
-
"supported_collaterals": [
|
|
128
|
-
"sui",
|
|
129
|
-
"deep",
|
|
130
|
-
"nusdc",
|
|
131
|
-
"wal",
|
|
132
|
-
"cetus"
|
|
133
|
-
],
|
|
79
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
134
80
|
"funding_fee_model": "0xab200af2bdb24d0950d3a3fe2952803a3f015f825a12a4f316cb079ac1c77e33",
|
|
135
81
|
"position_config": "0xa357de8967b287850ab5ebd123ab347065d6dae5eda02c356eb14e226589208c"
|
|
136
82
|
},
|
|
137
83
|
"short_doge": {
|
|
138
|
-
"supported_collaterals": [
|
|
139
|
-
"sui",
|
|
140
|
-
"deep",
|
|
141
|
-
"nusdc",
|
|
142
|
-
"wal",
|
|
143
|
-
"cetus"
|
|
144
|
-
],
|
|
84
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
145
85
|
"funding_fee_model": "0xfe142306e247a07a76dae73cb1b37e8d65be284e6ec7d3ec4926707eb16f7bac",
|
|
146
86
|
"position_config": "0x40a47914d658a2e757caa5b8ee6b2fb4e3bd48178f2f2ecc0f4cfd42ced26cb2"
|
|
147
87
|
},
|
|
148
88
|
"long_sui": {
|
|
149
|
-
"supported_collaterals": [
|
|
150
|
-
"sui",
|
|
151
|
-
"deep",
|
|
152
|
-
"nusdc",
|
|
153
|
-
"wal",
|
|
154
|
-
"cetus"
|
|
155
|
-
],
|
|
89
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
156
90
|
"funding_fee_model": "0xb79f8117573ede4c73be995dee65039ec0b649fa9d19526dedbea10c59a1901a",
|
|
157
91
|
"position_config": "0xc7c1b89b5afc7eb22ac86e24b4fb19821debeba1e9d6b607af25b90b30baf0ee"
|
|
158
92
|
},
|
|
159
93
|
"short_sui": {
|
|
160
|
-
"supported_collaterals": [
|
|
161
|
-
"sui",
|
|
162
|
-
"deep",
|
|
163
|
-
"nusdc",
|
|
164
|
-
"wal",
|
|
165
|
-
"cetus"
|
|
166
|
-
],
|
|
94
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
167
95
|
"funding_fee_model": "0x376cc5b1ae3797ceeda86a27f8ab13213aa38fc25437f634d57e41a3eb0e2467",
|
|
168
96
|
"position_config": "0x02802513d54807dc5c4682dac0c88c91e818e05b9aa8c02cff4ebb8372a09f5e"
|
|
169
97
|
},
|
|
170
98
|
"long_hype": {
|
|
171
|
-
"supported_collaterals": [
|
|
172
|
-
"sui",
|
|
173
|
-
"deep",
|
|
174
|
-
"nusdc",
|
|
175
|
-
"wal",
|
|
176
|
-
"cetus"
|
|
177
|
-
],
|
|
99
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
178
100
|
"funding_fee_model": "0x9b4739dd61dc4dedbcd3955ec6b1884f0ced71231579fbf413c9e12b7537abc6",
|
|
179
101
|
"position_config": "0x516d25119e72247fcae35c4340fc111b0db0ef8a6b9f375dd1787219f1b4c111"
|
|
180
102
|
},
|
|
181
103
|
"short_hype": {
|
|
182
|
-
"supported_collaterals": [
|
|
183
|
-
"sui",
|
|
184
|
-
"deep",
|
|
185
|
-
"nusdc",
|
|
186
|
-
"wal",
|
|
187
|
-
"cetus"
|
|
188
|
-
],
|
|
104
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
189
105
|
"funding_fee_model": "0xbd0376733e88e777299fe4b2c88564b02387c61048f786a92d4095247e9f2e0a",
|
|
190
106
|
"position_config": "0x9d6f721e2ba94f7cfaad8cb1d0aa506f39d52832a00d948b391847140be46785"
|
|
191
107
|
},
|
|
192
108
|
"long_ondo": {
|
|
193
|
-
"supported_collaterals": [
|
|
194
|
-
"sui",
|
|
195
|
-
"deep",
|
|
196
|
-
"nusdc",
|
|
197
|
-
"wal",
|
|
198
|
-
"cetus"
|
|
199
|
-
],
|
|
109
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
200
110
|
"funding_fee_model": "0xf6f1811b8ef8aa229f7dcdf141ef3e2c31a76276057d5573e35cd8173dac2f5a",
|
|
201
111
|
"position_config": "0xf14be1634990f37d26399652d0f3924aaa6147033a58c8386b9361634fc0c34a"
|
|
202
112
|
},
|
|
203
113
|
"short_ondo": {
|
|
204
|
-
"supported_collaterals": [
|
|
205
|
-
"sui",
|
|
206
|
-
"deep",
|
|
207
|
-
"nusdc",
|
|
208
|
-
"wal",
|
|
209
|
-
"cetus"
|
|
210
|
-
],
|
|
114
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
211
115
|
"funding_fee_model": "0x444c3fb015608cd5ee5fe92092eb2548bee162ce8171a04d5990ddfc37c6c0e1",
|
|
212
116
|
"position_config": "0x108c724e91712701ef8b74aa0572978c8027580272df865aeaf611450a24d368"
|
|
213
117
|
},
|
|
214
118
|
"long_trump": {
|
|
215
|
-
"supported_collaterals": [
|
|
216
|
-
"sui",
|
|
217
|
-
"deep",
|
|
218
|
-
"nusdc",
|
|
219
|
-
"wal",
|
|
220
|
-
"cetus"
|
|
221
|
-
],
|
|
119
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
222
120
|
"funding_fee_model": "0x505b0fe6918570738df0da62060ed2293ead107ba90eb0d467e7f84549ad95f8",
|
|
223
121
|
"position_config": "0x24f5c833f574a6abda8ec64c0ae0470904b7f213845623e542bf53744f47f924"
|
|
224
122
|
},
|
|
225
123
|
"short_trump": {
|
|
226
|
-
"supported_collaterals": [
|
|
227
|
-
"sui",
|
|
228
|
-
"deep",
|
|
229
|
-
"nusdc",
|
|
230
|
-
"wal",
|
|
231
|
-
"cetus"
|
|
232
|
-
],
|
|
124
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
233
125
|
"funding_fee_model": "0xf272d2d478c994b307638e8ca568d68f3669e6604076edf84666f7e41fa90925",
|
|
234
126
|
"position_config": "0xd41ccfb6f142ed275d49c62c685bd8eebf66ad884d72f3dceefa0fc45582a4f7"
|
|
235
127
|
},
|
|
236
128
|
"long_wal": {
|
|
237
|
-
"supported_collaterals": [
|
|
238
|
-
"sui",
|
|
239
|
-
"deep",
|
|
240
|
-
"nusdc",
|
|
241
|
-
"wal",
|
|
242
|
-
"cetus"
|
|
243
|
-
],
|
|
129
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
244
130
|
"funding_fee_model": "0x79d5c23b66049c5d2eee5000345184a68f161eca3a981107c30271f42d653379",
|
|
245
131
|
"position_config": "0x0f50c1b590ef898c1375a8d37ddeed8ff7b5be84683fb0f0eb56cbe8daf424be"
|
|
246
132
|
},
|
|
247
133
|
"short_wal": {
|
|
248
|
-
"supported_collaterals": [
|
|
249
|
-
"sui",
|
|
250
|
-
"deep",
|
|
251
|
-
"nusdc",
|
|
252
|
-
"wal",
|
|
253
|
-
"cetus"
|
|
254
|
-
],
|
|
134
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
255
135
|
"funding_fee_model": "0xd3f6a1b7a3bf8a1a914af5450ed97749ddd98852635602c376f8cf10f476d77e",
|
|
256
136
|
"position_config": "0x68c9e48a0d70940ee869e179b7fd0844027c5f295db7f91b0af20f12012723ea"
|
|
257
137
|
},
|
|
258
138
|
"long_deep": {
|
|
259
|
-
"supported_collaterals": [
|
|
260
|
-
"sui",
|
|
261
|
-
"deep",
|
|
262
|
-
"nusdc",
|
|
263
|
-
"wal",
|
|
264
|
-
"cetus"
|
|
265
|
-
],
|
|
139
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
266
140
|
"funding_fee_model": "0x2a5109e3623015887da852447fcbe18897a8226988cdc430de939f828e9b832d",
|
|
267
141
|
"position_config": "0xafb27095c591a52f835306e385bfbf9fbb8da0ad2ad5ab6f6b32bf41dc328edb"
|
|
268
142
|
},
|
|
269
143
|
"short_deep": {
|
|
270
|
-
"supported_collaterals": [
|
|
271
|
-
"sui",
|
|
272
|
-
"deep",
|
|
273
|
-
"nusdc",
|
|
274
|
-
"wal",
|
|
275
|
-
"cetus"
|
|
276
|
-
],
|
|
144
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
277
145
|
"funding_fee_model": "0x9685d898cffd81961ca85df6ad958fe4b93032572ce2b10e68e057a2bb6351c6",
|
|
278
146
|
"position_config": "0xc6c481ab3f090b52e672146887239ababc0815a5ec9bfc51bb9175b82e0eab53"
|
|
279
147
|
},
|
|
280
148
|
"long_cetus": {
|
|
281
|
-
"supported_collaterals": [
|
|
282
|
-
"sui",
|
|
283
|
-
"deep",
|
|
284
|
-
"nusdc",
|
|
285
|
-
"wal",
|
|
286
|
-
"cetus"
|
|
287
|
-
],
|
|
149
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
288
150
|
"funding_fee_model": "0x6e7986c5097c25bbf37ef8b1cecb7931197eb178345ca7c331a093f4bcddd3f4",
|
|
289
151
|
"position_config": "0x3c95ea8a01586fc09c569d9b65a501d5ea7dfe77cb407be8a148c1fdddac33e5"
|
|
290
152
|
},
|
|
291
153
|
"short_cetus": {
|
|
292
|
-
"supported_collaterals": [
|
|
293
|
-
"sui",
|
|
294
|
-
"deep",
|
|
295
|
-
"nusdc",
|
|
296
|
-
"wal",
|
|
297
|
-
"cetus"
|
|
298
|
-
],
|
|
154
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
299
155
|
"funding_fee_model": "0xc2382a61489000cb30ea947f763479890a6a187f7020e5c903ca43e39036c0cf",
|
|
300
156
|
"position_config": "0x1031e577256fc20f77638f952745455c5da907a58e75b3f9908da54f8608ae21"
|
|
301
157
|
},
|
|
302
158
|
"long_haedal": {
|
|
303
|
-
"supported_collaterals": [
|
|
304
|
-
"sui",
|
|
305
|
-
"deep",
|
|
306
|
-
"nusdc",
|
|
307
|
-
"wal",
|
|
308
|
-
"cetus"
|
|
309
|
-
],
|
|
159
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
310
160
|
"funding_fee_model": "0x7072672275d3c730d8d0c037a8929fd231b6ad250fedde712ea46cdaddebbcc9",
|
|
311
161
|
"position_config": "0x88760b9f404773ea607130908cfbd593a259f58a8297a64e7a82ade265d0a7ff"
|
|
312
162
|
},
|
|
313
163
|
"short_haedal": {
|
|
314
|
-
"supported_collaterals": [
|
|
315
|
-
"sui",
|
|
316
|
-
"deep",
|
|
317
|
-
"nusdc",
|
|
318
|
-
"wal",
|
|
319
|
-
"cetus"
|
|
320
|
-
],
|
|
164
|
+
"supported_collaterals": ["sui", "deep", "nusdc", "wal", "cetus"],
|
|
321
165
|
"funding_fee_model": "0x1fb7fdbfb005cfcd9c037e544b2ce00f80795b55cd8f4c43d2e659dc46062eef",
|
|
322
166
|
"position_config": "0x668eda955428fcc4375869bd77ff216d6f5d74741b2c3dbdf23709642cf5ca1a"
|
|
323
167
|
}
|
|
@@ -446,4 +290,4 @@
|
|
|
446
290
|
}
|
|
447
291
|
}
|
|
448
292
|
}
|
|
449
|
-
}
|
|
293
|
+
}
|
package/src/data.ts
CHANGED
|
@@ -199,6 +199,16 @@ export interface IStakePool {
|
|
|
199
199
|
lockDuration: number
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
export interface IMarketValidationResult {
|
|
203
|
+
handledVaults: Record<string, {
|
|
204
|
+
weight: number;
|
|
205
|
+
value: number;
|
|
206
|
+
}>;
|
|
207
|
+
totalWeight: number;
|
|
208
|
+
totalVaultsValue: number;
|
|
209
|
+
marketValue: number;
|
|
210
|
+
}
|
|
211
|
+
|
|
202
212
|
export class DataAPI extends OracleAPI {
|
|
203
213
|
provider: SuiClient
|
|
204
214
|
apiEndpoint: string
|
|
@@ -305,6 +315,30 @@ export class DataAPI extends OracleAPI {
|
|
|
305
315
|
}
|
|
306
316
|
}
|
|
307
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Validates the market valuation by calling the validate_market_valuation Move function
|
|
320
|
+
* @param tx Transaction object
|
|
321
|
+
* @returns An object containing handled vaults, total weight, total vaults value, and market value
|
|
322
|
+
*/
|
|
323
|
+
validateMarketValuation = (tx: Transaction) => {
|
|
324
|
+
// First, create the valuations using existing methods
|
|
325
|
+
const vaultsValuation = this.valuateVaults(tx);
|
|
326
|
+
const symbolsValuation = this.valuateSymbols(tx);
|
|
327
|
+
|
|
328
|
+
// Call the validate_market_valuation Move function
|
|
329
|
+
const result = tx.moveCall({
|
|
330
|
+
target: `${this.consts.zoCore.upgradedPackage}::market::validate_market_valuation`,
|
|
331
|
+
typeArguments: [`${this.consts.zoCore.package}::zlp::ZLP`],
|
|
332
|
+
arguments: [
|
|
333
|
+
tx.object(this.consts.zoCore.market),
|
|
334
|
+
vaultsValuation,
|
|
335
|
+
symbolsValuation,
|
|
336
|
+
],
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
return result;
|
|
340
|
+
}
|
|
341
|
+
|
|
308
342
|
#parseMarketInfo(raw: any): IMarketInfo {
|
|
309
343
|
const content = raw.data.content.fields
|
|
310
344
|
|
|
@@ -681,29 +715,41 @@ export class DataAPI extends OracleAPI {
|
|
|
681
715
|
}
|
|
682
716
|
|
|
683
717
|
public async getPositionCapInfoList(owner: string): Promise<IPositionCapInfo[]> {
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
718
|
+
const positionCapInfoList: IPositionCapInfo[] = [];
|
|
719
|
+
let cursor: string | undefined | null = undefined;
|
|
720
|
+
let hasNextPage = true;
|
|
721
|
+
|
|
722
|
+
while (hasNextPage) {
|
|
723
|
+
const positionCaps = await this.provider.getOwnedObjects({
|
|
724
|
+
owner,
|
|
725
|
+
filter: {
|
|
726
|
+
MoveModule: {
|
|
727
|
+
package: this.consts.zoCore.package,
|
|
728
|
+
module: 'market',
|
|
729
|
+
},
|
|
690
730
|
},
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
731
|
+
options: {
|
|
732
|
+
showType: true,
|
|
733
|
+
},
|
|
734
|
+
cursor,
|
|
735
|
+
})
|
|
736
|
+
|
|
737
|
+
for (const positionCap of positionCaps.data) {
|
|
738
|
+
if (positionCap.data?.type?.includes('PositionCap')) {
|
|
739
|
+
positionCapInfoList.push({
|
|
740
|
+
positionCapId: positionCap.data.objectId,
|
|
741
|
+
symbol0: positionCap.data.type.split('<')[1].split(',')[0].trim(),
|
|
742
|
+
symbol1: positionCap.data.type.split('<')[1].split(',')[1].split(',')[0].trim(),
|
|
743
|
+
long: positionCap.data.type.includes('LONG'),
|
|
744
|
+
})
|
|
745
|
+
}
|
|
705
746
|
}
|
|
747
|
+
|
|
748
|
+
// If we don't want to fetch all pages or there are no more pages, break the loop
|
|
749
|
+
hasNextPage = positionCaps.hasNextPage
|
|
750
|
+
cursor = positionCaps.nextCursor
|
|
706
751
|
}
|
|
752
|
+
|
|
707
753
|
return positionCapInfoList
|
|
708
754
|
}
|
|
709
755
|
|
|
@@ -738,32 +784,43 @@ export class DataAPI extends OracleAPI {
|
|
|
738
784
|
return positionInfoList.sort((a, b) => a.openTimestamp > b.openTimestamp ? 1 : -1)
|
|
739
785
|
}
|
|
740
786
|
|
|
741
|
-
public async getOrderCapInfoList(owner: string) {
|
|
742
|
-
const
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
787
|
+
public async getOrderCapInfoList(owner: string): Promise<IOrderCapInfo[]> {
|
|
788
|
+
const orderCapInfoList: IOrderCapInfo[] = [];
|
|
789
|
+
let cursor: string | undefined | null = undefined;
|
|
790
|
+
let hasNextPage = true;
|
|
791
|
+
|
|
792
|
+
while (hasNextPage) {
|
|
793
|
+
const orderCaps = await this.provider.getOwnedObjects({
|
|
794
|
+
owner,
|
|
795
|
+
filter: {
|
|
796
|
+
MoveModule: {
|
|
797
|
+
package: this.consts.zoCore.package,
|
|
798
|
+
module: 'market',
|
|
799
|
+
},
|
|
748
800
|
},
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
801
|
+
options: {
|
|
802
|
+
showType: true,
|
|
803
|
+
showContent: true,
|
|
804
|
+
},
|
|
805
|
+
cursor,
|
|
806
|
+
})
|
|
807
|
+
|
|
808
|
+
for (const orderCap of orderCaps.data) {
|
|
809
|
+
if (orderCap.data?.type?.includes('OrderCap')) {
|
|
810
|
+
orderCapInfoList.push({
|
|
811
|
+
orderCapId: orderCap.data.objectId,
|
|
812
|
+
symbol0: orderCap.data.type.split('<')[1].split(',')[0].trim(),
|
|
813
|
+
symbol1: orderCap.data.type.split('<')[1].split(',')[1].split(',')[0].trim(),
|
|
814
|
+
long: orderCap.data.type.includes('LONG'),
|
|
815
|
+
positionId: (orderCap.data.content as any)?.fields?.position_id,
|
|
816
|
+
})
|
|
817
|
+
}
|
|
765
818
|
}
|
|
819
|
+
|
|
820
|
+
hasNextPage = orderCaps.hasNextPage;
|
|
821
|
+
cursor = orderCaps.nextCursor;
|
|
766
822
|
}
|
|
823
|
+
|
|
767
824
|
return orderCapInfoList
|
|
768
825
|
}
|
|
769
826
|
|