@metaflux-dex/client 0.0.5 → 0.1.0
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/client.d.ts +33 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +74 -3
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/native/actions.d.ts +7 -1
- package/dist/native/actions.d.ts.map +1 -1
- package/dist/native/actions.js +113 -1
- package/dist/native/actions.js.map +1 -1
- package/dist/native/digest.d.ts +1 -0
- package/dist/native/digest.d.ts.map +1 -1
- package/dist/native/digest.js +11 -0
- package/dist/native/digest.js.map +1 -1
- package/dist/types/cross-chain.d.ts +8 -0
- package/dist/types/cross-chain.d.ts.map +1 -0
- package/dist/types/cross-chain.js +9 -0
- package/dist/types/cross-chain.js.map +1 -0
- package/dist/types/encrypted.d.ts +5 -0
- package/dist/types/encrypted.d.ts.map +1 -1
- package/dist/types/fba.d.ts +9 -0
- package/dist/types/fba.d.ts.map +1 -0
- package/dist/types/fba.js +8 -0
- package/dist/types/fba.js.map +1 -0
- package/dist/types/index.d.ts +5 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/info/core.d.ts +5 -1
- package/dist/types/info/core.d.ts.map +1 -1
- package/dist/types/info/index.d.ts +1 -1
- package/dist/types/info/index.d.ts.map +1 -1
- package/dist/types/info/reads.d.ts.map +1 -1
- package/dist/types/rfq.d.ts +15 -0
- package/dist/types/rfq.d.ts.map +1 -0
- package/dist/types/rfq.js +9 -0
- package/dist/types/rfq.js.map +1 -0
- package/dist/types/vault.d.ts +4 -0
- package/dist/types/vault.d.ts.map +1 -1
- package/dist/ws/ws.d.ts +46 -2
- package/dist/ws/ws.d.ts.map +1 -1
- package/dist/ws/ws.js +237 -7
- package/dist/ws/ws.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +120 -2
- package/src/index.ts +19 -0
- package/src/native/actions.ts +135 -0
- package/src/native/digest.ts +12 -0
- package/src/types/cross-chain.ts +32 -0
- package/src/types/encrypted.ts +23 -0
- package/src/types/fba.ts +32 -0
- package/src/types/index.ts +5 -1
- package/src/types/info/core.ts +28 -13
- package/src/types/info/index.ts +1 -0
- package/src/types/info/reads.ts +17 -5
- package/src/types/rfq.ts +55 -0
- package/src/types/vault.ts +21 -0
- package/src/ws/ws.ts +372 -14
package/dist/ws/ws.js
CHANGED
|
@@ -20,25 +20,42 @@
|
|
|
20
20
|
// Transport: the standard `WebSocket` global (browser-native; Node ≥ 22 ships
|
|
21
21
|
// it globally, which is the SDK's floor). No `ws` npm dependency — keeping the
|
|
22
22
|
// SDK dependency-free for both runtimes.
|
|
23
|
-
|
|
23
|
+
import { buildNativeCancelAction, buildNativeOrderAction, } from '../native/actions.js';
|
|
24
|
+
import { nextNonce, recoverNativeSigner, signNativeAction } from '../native/digest.js';
|
|
25
|
+
/// All known channels — handy for callers that want to subscribe broadly. The
|
|
26
|
+
/// exact 17 native gateway channels.
|
|
24
27
|
export const WS_CHANNELS = [
|
|
25
28
|
'l2_book',
|
|
26
|
-
'trades',
|
|
27
29
|
'bbo',
|
|
28
|
-
'
|
|
30
|
+
'trades',
|
|
31
|
+
'active_asset_ctx',
|
|
32
|
+
'all_mids',
|
|
29
33
|
'candles',
|
|
34
|
+
'fills',
|
|
30
35
|
'user_events',
|
|
36
|
+
'order_updates',
|
|
37
|
+
'notifications',
|
|
38
|
+
'ledger_updates',
|
|
39
|
+
'user_fundings',
|
|
40
|
+
'user_twap_slice_fills',
|
|
41
|
+
'user_twap_history',
|
|
42
|
+
'account_state',
|
|
43
|
+
'spot_state',
|
|
44
|
+
'active_asset_data',
|
|
31
45
|
];
|
|
32
46
|
const DEFAULT_CONFIG = {
|
|
33
47
|
pingIntervalMs: 30_000,
|
|
34
48
|
initialBackoffMs: 250,
|
|
35
49
|
maxBackoffMs: 30_000,
|
|
36
50
|
autoReconnect: true,
|
|
51
|
+
postTimeoutMs: 10_000,
|
|
37
52
|
};
|
|
38
|
-
/// Subscription set equality key — `(channel, coin)` is the
|
|
39
|
-
/// key, so two subscriptions are identical iff
|
|
53
|
+
/// Subscription set equality key — `(channel, coin, user, interval)` is the
|
|
54
|
+
/// server's routing key, so two subscriptions are identical iff all match
|
|
55
|
+
/// (e.g. `candles` `1m` vs `5m`, or `fills` for two different users, are
|
|
56
|
+
/// distinct subscriptions).
|
|
40
57
|
function subKey(s) {
|
|
41
|
-
return `${s.type}:${s.coin ?? ''}`;
|
|
58
|
+
return `${s.type}:${s.coin ?? ''}:${s.user ?? ''}:${s.interval ?? ''}`;
|
|
42
59
|
}
|
|
43
60
|
/// MTF-native WebSocket client.
|
|
44
61
|
///
|
|
@@ -57,6 +74,7 @@ function subKey(s) {
|
|
|
57
74
|
export class WsClient {
|
|
58
75
|
url;
|
|
59
76
|
config;
|
|
77
|
+
signer;
|
|
60
78
|
socket;
|
|
61
79
|
/// Active subscriptions, replayed on (re)connect. Keyed for dedupe.
|
|
62
80
|
active = new Map();
|
|
@@ -66,12 +84,23 @@ export class WsClient {
|
|
|
66
84
|
backoffMs;
|
|
67
85
|
/// True once `close()` is called — suppresses auto-reconnect.
|
|
68
86
|
closed = false;
|
|
69
|
-
|
|
87
|
+
/// Monotonic id source for `post` request/response correlation.
|
|
88
|
+
postIdSeq = 1;
|
|
89
|
+
/// In-flight `post` requests keyed by correlation id. Resolved when the
|
|
90
|
+
/// `{channel:"post"}` frame with the matching `data.id` arrives, or rejected
|
|
91
|
+
/// on timeout. A connection drop leaves them pending; the per-request timeout
|
|
92
|
+
/// is the backstop (a signed action is one-shot, so we never auto-retry).
|
|
93
|
+
pendingPosts = new Map();
|
|
94
|
+
constructor(url, config = {}, signer) {
|
|
70
95
|
if (url.length === 0) {
|
|
71
96
|
throw new RangeError('WsClient url must be non-empty');
|
|
72
97
|
}
|
|
98
|
+
if (signer !== undefined && signer.privateKey.length !== 32) {
|
|
99
|
+
throw new RangeError('WsClient signer privateKey must be exactly 32 bytes');
|
|
100
|
+
}
|
|
73
101
|
this.url = url;
|
|
74
102
|
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
103
|
+
this.signer = signer;
|
|
75
104
|
this.backoffMs = this.config.initialBackoffMs;
|
|
76
105
|
}
|
|
77
106
|
/// Register an inbound-frame handler. Multiple handlers fan out; each
|
|
@@ -106,6 +135,176 @@ export class WsClient {
|
|
|
106
135
|
this.active.delete(subKey(sub));
|
|
107
136
|
this.send({ method: 'unsubscribe', subscription: sub });
|
|
108
137
|
}
|
|
138
|
+
// ── convenience subscribe helpers ─────────────────────────────────────────
|
|
139
|
+
//
|
|
140
|
+
// Format a numeric market id into the `coin` decimal-string the node parses
|
|
141
|
+
// (`str::parse::<u32>`), so callers never accidentally send a JSON number that
|
|
142
|
+
// the node drops as "unknown market". Mirrors the Rust `subscribe_*` helpers.
|
|
143
|
+
/// Subscribe to L2 book updates for a market id.
|
|
144
|
+
async subscribeL2Book(marketId) {
|
|
145
|
+
return this.subscribe({ type: 'l2_book', coin: `${marketId}` });
|
|
146
|
+
}
|
|
147
|
+
/// Subscribe to public trades for a market id.
|
|
148
|
+
async subscribeTrades(marketId) {
|
|
149
|
+
return this.subscribe({ type: 'trades', coin: `${marketId}` });
|
|
150
|
+
}
|
|
151
|
+
/// Subscribe to best-bid-best-offer ticks for a market id.
|
|
152
|
+
async subscribeBbo(marketId) {
|
|
153
|
+
return this.subscribe({ type: 'bbo', coin: `${marketId}` });
|
|
154
|
+
}
|
|
155
|
+
/// Subscribe to per-market mark / oracle / funding / OI context.
|
|
156
|
+
async subscribeActiveAssetCtx(marketId) {
|
|
157
|
+
return this.subscribe({ type: 'active_asset_ctx', coin: `${marketId}` });
|
|
158
|
+
}
|
|
159
|
+
/// Subscribe to OHLCV candles for a market id + interval token.
|
|
160
|
+
async subscribeCandles(marketId, interval) {
|
|
161
|
+
return this.subscribe({ type: 'candles', coin: `${marketId}`, interval });
|
|
162
|
+
}
|
|
163
|
+
/// Subscribe to the global all-market mids stream.
|
|
164
|
+
async subscribeAllMids() {
|
|
165
|
+
return this.subscribe({ type: 'all_mids' });
|
|
166
|
+
}
|
|
167
|
+
/// Subscribe to per-user fills (0x address).
|
|
168
|
+
async subscribeFills(user) {
|
|
169
|
+
return this.subscribe({ type: 'fills', user });
|
|
170
|
+
}
|
|
171
|
+
/// Subscribe to per-user order lifecycle updates (0x address).
|
|
172
|
+
async subscribeOrderUpdates(user) {
|
|
173
|
+
return this.subscribe({ type: 'order_updates', user });
|
|
174
|
+
}
|
|
175
|
+
/// Subscribe to per-user account / margin events (0x address).
|
|
176
|
+
async subscribeUserEvents(user) {
|
|
177
|
+
return this.subscribe({ type: 'user_events', user });
|
|
178
|
+
}
|
|
179
|
+
/// Subscribe to the per-user live PERP account-state stream (0x address).
|
|
180
|
+
async subscribeAccountState(user) {
|
|
181
|
+
return this.subscribe({ type: 'account_state', user });
|
|
182
|
+
}
|
|
183
|
+
/// Subscribe to the per-user live SPOT clearinghouse-state stream (0x address).
|
|
184
|
+
async subscribeSpotState(user) {
|
|
185
|
+
return this.subscribe({ type: 'spot_state', user });
|
|
186
|
+
}
|
|
187
|
+
/// Subscribe to per-(user, market) leverage / margin-mode context.
|
|
188
|
+
async subscribeActiveAssetData(user, marketId) {
|
|
189
|
+
return this.subscribe({
|
|
190
|
+
type: 'active_asset_data',
|
|
191
|
+
coin: `${marketId}`,
|
|
192
|
+
user,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
// ── `post` request/response (signed exchange actions + info reads) ─────────
|
|
196
|
+
//
|
|
197
|
+
// The WS analogue of `POST /exchange` and `POST /info`: multiplex one-off
|
|
198
|
+
// writes / reads over the existing socket instead of opening a REST request.
|
|
199
|
+
//
|
|
200
|
+
// client → server:
|
|
201
|
+
// {"method":"post","id":N,"request":{"type":"action"|"info","payload":{...}}}
|
|
202
|
+
// server → client:
|
|
203
|
+
// {"channel":"post","data":{"id":N,"response":{"type":...,"payload":{...}}}}
|
|
204
|
+
//
|
|
205
|
+
// For an `action`, payload is the signed envelope `{signature, nonce, action}`
|
|
206
|
+
// — signed with the SAME EIP-712 digest the REST `/exchange` path uses (the
|
|
207
|
+
// node recovers the signer over the raw `action` bytes). Correlated by `id`;
|
|
208
|
+
// a `{type:"error"}` response surfaces as an error; each request has a timeout.
|
|
209
|
+
/// Issue a signed exchange action over the WS `post` channel, returning the
|
|
210
|
+
/// node's action response payload. Requires a `WsSigner` (passed to the
|
|
211
|
+
/// constructor, or via `Client.connectWs` with a keyed client).
|
|
212
|
+
async postAction(actionJson) {
|
|
213
|
+
if (this.signer === undefined) {
|
|
214
|
+
throw new Error('postAction requires a WsSigner (this WsClient was opened read-only)');
|
|
215
|
+
}
|
|
216
|
+
const nonce = nextNonce();
|
|
217
|
+
const signed = await signNativeAction(this.signer.privateKey, actionJson, nonce, this.signer.chainId);
|
|
218
|
+
// The signed envelope mirrors the REST body shape, but the `action` rides as
|
|
219
|
+
// a parsed object inside the JSON `request.payload`. The server still
|
|
220
|
+
// verifies over the raw `action` bytes; since the bytes we signed are valid
|
|
221
|
+
// JSON, re-embedding them as `JSON.parse(actionJson)` is byte-equivalent to
|
|
222
|
+
// the canonical form the server re-serializes for the digest.
|
|
223
|
+
const payload = {
|
|
224
|
+
signature: signed.signature,
|
|
225
|
+
nonce: Number(signed.nonce),
|
|
226
|
+
action: JSON.parse(actionJson),
|
|
227
|
+
};
|
|
228
|
+
return this.postRequest('action', payload);
|
|
229
|
+
}
|
|
230
|
+
/// Issue an `info` read over the WS `post` channel, returning the info response
|
|
231
|
+
/// payload. `payload` is the usual `{"type":"<info>",...}` body. No signing.
|
|
232
|
+
async postInfo(payload) {
|
|
233
|
+
return this.postRequest('info', payload);
|
|
234
|
+
}
|
|
235
|
+
/// Submit a limit / market / trigger order over the WS `post` channel.
|
|
236
|
+
/// Mirrors `Client.submitOrderNative`: `order.owner` MUST equal the signing
|
|
237
|
+
/// wallet (recovered locally and rejected on mismatch).
|
|
238
|
+
async submitOrder(order) {
|
|
239
|
+
if (this.signer === undefined) {
|
|
240
|
+
throw new Error('submitOrder requires a WsSigner (read-only WsClient)');
|
|
241
|
+
}
|
|
242
|
+
const actionJson = buildNativeOrderAction(order);
|
|
243
|
+
await this.assertOwner(actionJson, order.owner, 'order.owner');
|
|
244
|
+
return (await this.postAction(actionJson));
|
|
245
|
+
}
|
|
246
|
+
/// Cancel an order over the WS `post` channel. Mirrors
|
|
247
|
+
/// `Client.cancelOrderNative`: `cancel.owner` MUST equal the signing wallet.
|
|
248
|
+
async cancelOrder(cancel) {
|
|
249
|
+
if (this.signer === undefined) {
|
|
250
|
+
throw new Error('cancelOrder requires a WsSigner (read-only WsClient)');
|
|
251
|
+
}
|
|
252
|
+
const actionJson = buildNativeCancelAction(cancel);
|
|
253
|
+
await this.assertOwner(actionJson, cancel.owner, 'cancel.owner');
|
|
254
|
+
return (await this.postAction(actionJson));
|
|
255
|
+
}
|
|
256
|
+
/// Recover the signer over the action's own digest and reject unless it equals
|
|
257
|
+
/// `owner`. Saves a round-trip on an obvious key/owner mismatch (the server
|
|
258
|
+
/// enforces the same). Shares the nonce-agnostic recover path with the REST
|
|
259
|
+
/// client.
|
|
260
|
+
async assertOwner(actionJson, owner, field) {
|
|
261
|
+
// recoverNativeSigner is nonce-agnostic for the address it yields; use a
|
|
262
|
+
// throwaway nonce of 0 just to drive the digest+recover.
|
|
263
|
+
const signed = await signNativeAction(this.signer.privateKey, actionJson, 0n, this.signer.chainId);
|
|
264
|
+
const signer = await recoverNativeSigner(signed, this.signer.chainId);
|
|
265
|
+
if (signer.toLowerCase() !== owner.toLowerCase()) {
|
|
266
|
+
throw new Error(`${field} ${owner} != recovered signer ${signer}`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/// Core `post` machinery: assign a correlation id, ship the frame, and await
|
|
270
|
+
/// the matching response. Rejects on a `{type:"error"}` response, on timeout,
|
|
271
|
+
/// or if the socket is not open. Returns the inner `payload` on success.
|
|
272
|
+
postRequest(requestType, payload) {
|
|
273
|
+
if (this.socket?.readyState !== 1) {
|
|
274
|
+
return Promise.reject(new Error('ws post: socket is not open'));
|
|
275
|
+
}
|
|
276
|
+
const id = this.postIdSeq++;
|
|
277
|
+
return new Promise((resolve, reject) => {
|
|
278
|
+
const timer = setTimeout(() => {
|
|
279
|
+
this.pendingPosts.delete(id);
|
|
280
|
+
reject(new Error('ws post: timed out'));
|
|
281
|
+
}, this.config.postTimeoutMs);
|
|
282
|
+
this.pendingPosts.set(id, {
|
|
283
|
+
resolve: (response) => {
|
|
284
|
+
// The node wraps every reply as `{type, payload}`; an error reply
|
|
285
|
+
// carries the message as a string `payload`.
|
|
286
|
+
if (response !== null &&
|
|
287
|
+
typeof response === 'object' &&
|
|
288
|
+
response.type === 'error') {
|
|
289
|
+
const msg = response.payload;
|
|
290
|
+
reject(new Error(`ws post error: ${typeof msg === 'string' ? msg : 'unknown post error'}`));
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const inner = response !== null && typeof response === 'object'
|
|
294
|
+
? response.payload
|
|
295
|
+
: undefined;
|
|
296
|
+
resolve(inner);
|
|
297
|
+
},
|
|
298
|
+
reject,
|
|
299
|
+
timer,
|
|
300
|
+
});
|
|
301
|
+
this.send({
|
|
302
|
+
method: 'post',
|
|
303
|
+
id,
|
|
304
|
+
request: { type: requestType, payload },
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
}
|
|
109
308
|
/// Whether the socket is currently OPEN.
|
|
110
309
|
get isOpen() {
|
|
111
310
|
return this.socket?.readyState === 1; // WebSocket.OPEN
|
|
@@ -115,6 +314,13 @@ export class WsClient {
|
|
|
115
314
|
close() {
|
|
116
315
|
this.closed = true;
|
|
117
316
|
this.clearTimers();
|
|
317
|
+
// Fail any in-flight `post` so a caller awaiting a response on a socket we
|
|
318
|
+
// just closed unblocks with an error rather than hanging until timeout.
|
|
319
|
+
for (const [, pending] of this.pendingPosts) {
|
|
320
|
+
clearTimeout(pending.timer);
|
|
321
|
+
pending.reject(new Error('ws post: client closed'));
|
|
322
|
+
}
|
|
323
|
+
this.pendingPosts.clear();
|
|
118
324
|
if (this.socket !== undefined) {
|
|
119
325
|
try {
|
|
120
326
|
this.socket.close();
|
|
@@ -201,10 +407,34 @@ export class WsClient {
|
|
|
201
407
|
catch {
|
|
202
408
|
return; // ignore non-JSON frames
|
|
203
409
|
}
|
|
410
|
+
// A `{channel:"post"}` frame correlates by id back to the waiting caller and
|
|
411
|
+
// is consumed here — it does NOT fan out to subscription handlers. Every
|
|
412
|
+
// other frame (data channels, subscriptionResponse ack, error, bare pong)
|
|
413
|
+
// is passed through to the registered handlers unchanged.
|
|
414
|
+
if (frame.channel === 'post') {
|
|
415
|
+
this.resolvePost(frame.data);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
204
418
|
for (const h of this.handlers) {
|
|
205
419
|
h(frame);
|
|
206
420
|
}
|
|
207
421
|
}
|
|
422
|
+
/// Resolve the pending `post` whose id matches the frame's `data.id`. The node
|
|
423
|
+
/// wraps every reply as `data.response = {type, payload}`; a `{type:"error"}`
|
|
424
|
+
/// response surfaces as a rejection.
|
|
425
|
+
resolvePost(data) {
|
|
426
|
+
if (data === null || typeof data !== 'object')
|
|
427
|
+
return;
|
|
428
|
+
const { id, response } = data;
|
|
429
|
+
if (typeof id !== 'number')
|
|
430
|
+
return;
|
|
431
|
+
const pending = this.pendingPosts.get(id);
|
|
432
|
+
if (pending === undefined)
|
|
433
|
+
return;
|
|
434
|
+
this.pendingPosts.delete(id);
|
|
435
|
+
clearTimeout(pending.timer);
|
|
436
|
+
pending.resolve(response);
|
|
437
|
+
}
|
|
208
438
|
clearTimers() {
|
|
209
439
|
this.clearPing();
|
|
210
440
|
if (this.reconnectTimer !== undefined) {
|
package/dist/ws/ws.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.js","sourceRoot":"","sources":["../../src/ws/ws.ts"],"names":[],"mappings":"AAAA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AC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC7B,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAEO,WAAW;QACjB,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;YACtC,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAClC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAClC,CAAC;IACH,CAAC;IAEO,SAAS;QACf,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC9B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC7B,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -30,14 +30,19 @@ import {
|
|
|
30
30
|
buildNativeClaimRewardsAction,
|
|
31
31
|
buildNativeConvertToMultiSigUserAction,
|
|
32
32
|
buildNativeCreateVaultAction,
|
|
33
|
+
buildNativeCrossChainSendAction,
|
|
33
34
|
buildNativeEarnDepositAction,
|
|
34
35
|
buildNativeEarnWithdrawAction,
|
|
36
|
+
buildNativeEncryptedOrderSubmitAction,
|
|
37
|
+
buildNativeFbaSubmitAction,
|
|
35
38
|
buildNativeLinkStakingUserAction,
|
|
36
39
|
buildNativeMbWithdrawAction,
|
|
37
40
|
buildNativeModifyAction,
|
|
38
41
|
buildNativeOrderAction,
|
|
39
42
|
buildNativePriorityBidAction,
|
|
40
43
|
buildNativeRegisterMetaliquidityOperatorAction,
|
|
44
|
+
buildNativeRfqAcceptAction,
|
|
45
|
+
buildNativeRfqRequestAction,
|
|
41
46
|
buildNativeScheduleCancelAction,
|
|
42
47
|
buildNativeSetDisplayNameAction,
|
|
43
48
|
buildNativeSetMetaliquidityWhitelistAction,
|
|
@@ -59,6 +64,7 @@ import {
|
|
|
59
64
|
buildNativeUserDexAbstractionAction,
|
|
60
65
|
buildNativeUserPortfolioMarginAction,
|
|
61
66
|
buildNativeUserSetAbstractionAction,
|
|
67
|
+
buildNativeVaultDistributeAction,
|
|
62
68
|
buildNativeVaultModifyAction,
|
|
63
69
|
buildNativeVaultTransferAction,
|
|
64
70
|
buildNativeVaultWithdrawAction,
|
|
@@ -83,6 +89,9 @@ import type {
|
|
|
83
89
|
ClaimRewards,
|
|
84
90
|
ConvertToMultiSigUser,
|
|
85
91
|
CreateVault,
|
|
92
|
+
CrossChainSend,
|
|
93
|
+
EncryptedOrderSubmit,
|
|
94
|
+
FbaSubmit,
|
|
86
95
|
LinkStakingUser,
|
|
87
96
|
Market,
|
|
88
97
|
MbWithdraw,
|
|
@@ -104,6 +113,8 @@ import type {
|
|
|
104
113
|
Position,
|
|
105
114
|
PriorityBid,
|
|
106
115
|
RegisterMetaliquidityOperator,
|
|
116
|
+
RfqAccept,
|
|
117
|
+
RfqRequest,
|
|
107
118
|
ScheduleCancel,
|
|
108
119
|
SetDisplayName,
|
|
109
120
|
SetMetaliquidityWhitelist,
|
|
@@ -119,6 +130,7 @@ import type {
|
|
|
119
130
|
UserDexAbstraction,
|
|
120
131
|
UserPortfolioMargin,
|
|
121
132
|
UserSetAbstraction,
|
|
133
|
+
VaultDistribute,
|
|
122
134
|
VaultModify,
|
|
123
135
|
VaultTransfer,
|
|
124
136
|
VaultWithdraw,
|
|
@@ -689,6 +701,28 @@ export class Client {
|
|
|
689
701
|
);
|
|
690
702
|
}
|
|
691
703
|
|
|
704
|
+
/// Enroll the signing account into portfolio margin via `POST /exchange`.
|
|
705
|
+
///
|
|
706
|
+
/// Convenience wrapper over `userPortfolioMargin({ enroll: true })`. The node's
|
|
707
|
+
/// `pm_enroll` action tag is an unmapped stub, so this deliberately emits the
|
|
708
|
+
/// bridged `user_portfolio_margin` action (NOT a `pm_enroll` tag).
|
|
709
|
+
async pmEnroll(
|
|
710
|
+
opts: { nonce?: bigint; chainId?: number } = {},
|
|
711
|
+
): Promise<NativeExchangeAck> {
|
|
712
|
+
return this.userPortfolioMargin({ enroll: true }, opts);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/// Unenroll the signing account from portfolio margin via `POST /exchange`.
|
|
716
|
+
///
|
|
717
|
+
/// Convenience wrapper over `userPortfolioMargin({ enroll: false })`. The
|
|
718
|
+
/// node's `pm_unenroll` action tag is an unmapped stub, so this deliberately
|
|
719
|
+
/// emits the bridged `user_portfolio_margin` action (NOT a `pm_unenroll` tag).
|
|
720
|
+
async pmUnenroll(
|
|
721
|
+
opts: { nonce?: bigint; chainId?: number } = {},
|
|
722
|
+
): Promise<NativeExchangeAck> {
|
|
723
|
+
return this.userPortfolioMargin({ enroll: false }, opts);
|
|
724
|
+
}
|
|
725
|
+
|
|
692
726
|
// ── account & agent settings ───────────────────
|
|
693
727
|
|
|
694
728
|
/// Set the account display name via `POST /exchange`.
|
|
@@ -853,6 +887,20 @@ export class Client {
|
|
|
853
887
|
return this.postSenderAuthorized(buildNativeVaultWithdrawAction(params), opts);
|
|
854
888
|
}
|
|
855
889
|
|
|
890
|
+
/// Follower deposits USD into a vault, minting shares at the current NAV, via
|
|
891
|
+
/// `POST /exchange` (`vault_distribute`). The deposit rides the `pnl` field
|
|
892
|
+
/// (legacy node name) as a positive decimal string. SENDER-AUTHORIZED.
|
|
893
|
+
///
|
|
894
|
+
/// Forward-compat: the node currently returns `UnsupportedAction` for this tag
|
|
895
|
+
/// on `/exchange` until it bridges the handler; the SDK emits the byte-correct
|
|
896
|
+
/// wire shape so it goes live the moment the bridge lands.
|
|
897
|
+
async vaultDistribute(
|
|
898
|
+
params: VaultDistribute,
|
|
899
|
+
opts: { nonce?: bigint; chainId?: number } = {},
|
|
900
|
+
): Promise<NativeExchangeAck> {
|
|
901
|
+
return this.postSenderAuthorized(buildNativeVaultDistributeAction(params), opts);
|
|
902
|
+
}
|
|
903
|
+
|
|
856
904
|
// ── MetaBridge ───────────────────────────────
|
|
857
905
|
|
|
858
906
|
/// Withdraw cross-collateral to a destination chain via `POST /exchange`.
|
|
@@ -889,6 +937,67 @@ export class Client {
|
|
|
889
937
|
);
|
|
890
938
|
}
|
|
891
939
|
|
|
940
|
+
// ── RFQ / FBA / cross-chain / encrypted (forward-compat) ──────────────────
|
|
941
|
+
//
|
|
942
|
+
// The node recognizes these action tags but currently lowers them to
|
|
943
|
+
// `UnsupportedAction` on the public `/exchange` path (the real handlers run
|
|
944
|
+
// on the EVM core-writer path). The SDK emits the byte-correct wire shape each
|
|
945
|
+
// core param struct expects, so these become live the moment the node bridges
|
|
946
|
+
// them — no SDK change required. All SENDER-AUTHORIZED (the recovered signer
|
|
947
|
+
// is the taker / submitter).
|
|
948
|
+
|
|
949
|
+
/// Open an RFQ session as a taker (`rfq_request`) via `POST /exchange`.
|
|
950
|
+
/// Wrapper key is `rfq`; `side` is PascalCase; the `limit_px` / `stp_group`
|
|
951
|
+
/// keys are always present (`null` when absent).
|
|
952
|
+
async rfqRequest(
|
|
953
|
+
params: RfqRequest,
|
|
954
|
+
opts: { nonce?: bigint; chainId?: number } = {},
|
|
955
|
+
): Promise<NativeExchangeAck> {
|
|
956
|
+
return this.postSenderAuthorized(buildNativeRfqRequestAction(params), opts);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/// Cross against a specific resting RFQ quote (`rfq_accept`) via
|
|
960
|
+
/// `POST /exchange`. Wrapper key is `accept`.
|
|
961
|
+
async rfqAccept(
|
|
962
|
+
params: RfqAccept,
|
|
963
|
+
opts: { nonce?: bigint; chainId?: number } = {},
|
|
964
|
+
): Promise<NativeExchangeAck> {
|
|
965
|
+
return this.postSenderAuthorized(buildNativeRfqAcceptAction(params), opts);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
/// Submit an order into a market's frequent-batch-auction pool (`fba_submit`)
|
|
969
|
+
/// via `POST /exchange`. Wrapper key is `submit`; the price field is `price`
|
|
970
|
+
/// (NOT `limit_px`); `side` is PascalCase; `stp_group` key is always present.
|
|
971
|
+
async fbaSubmit(
|
|
972
|
+
params: FbaSubmit,
|
|
973
|
+
opts: { nonce?: bigint; chainId?: number } = {},
|
|
974
|
+
): Promise<NativeExchangeAck> {
|
|
975
|
+
return this.postSenderAuthorized(buildNativeFbaSubmitAction(params), opts);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
/// Initiate a chain-agnostic cross-chain transfer (`cross_chain_send`) via
|
|
979
|
+
/// `POST /exchange`. Wrapper key is `msg`; `recipient` is a 32-byte array and
|
|
980
|
+
/// `amount` is a bare number (NOT hex).
|
|
981
|
+
async crossChainSend(
|
|
982
|
+
params: CrossChainSend,
|
|
983
|
+
opts: { nonce?: bigint; chainId?: number } = {},
|
|
984
|
+
): Promise<NativeExchangeAck> {
|
|
985
|
+
return this.postSenderAuthorized(buildNativeCrossChainSendAction(params), opts);
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/// Submit a threshold-encrypted order via the `encrypted_order_submit` tag
|
|
989
|
+
/// (`POST /exchange`). Wrapper key is `encrypted`; only 3 fields — DISTINCT
|
|
990
|
+
/// from `submitEncryptedOrder` (5 fields, key `params`, a different handler).
|
|
991
|
+
async encryptedOrderSubmit(
|
|
992
|
+
params: EncryptedOrderSubmit,
|
|
993
|
+
opts: { nonce?: bigint; chainId?: number } = {},
|
|
994
|
+
): Promise<NativeExchangeAck> {
|
|
995
|
+
return this.postSenderAuthorized(
|
|
996
|
+
buildNativeEncryptedOrderSubmitAction(params),
|
|
997
|
+
opts,
|
|
998
|
+
);
|
|
999
|
+
}
|
|
1000
|
+
|
|
892
1001
|
/// Sign a pre-built sender-authorized action JSON and POST it to `/exchange`.
|
|
893
1002
|
///
|
|
894
1003
|
/// Shared by the actions where the recovered signer IS the actor (no `owner`
|
|
@@ -956,9 +1065,18 @@ export class Client {
|
|
|
956
1065
|
/// Derives the `ws(s)://` URL from the client's `http(s)://` base, mounts the
|
|
957
1066
|
/// `/ws` path (the node's upgrade route), and returns a connected
|
|
958
1067
|
/// [`WsClient`]. Register handlers via `ws.onMessage` and subscribe with
|
|
959
|
-
/// `ws.subscribe({ type: 'l2_book', coin: '
|
|
1068
|
+
/// `ws.subscribe({ type: 'l2_book', coin: '1' })`.
|
|
1069
|
+
///
|
|
1070
|
+
/// If this client holds a private key, the returned `WsClient` is seeded with
|
|
1071
|
+
/// a signer so it can POST signed exchange actions over the socket
|
|
1072
|
+
/// (`ws.submitOrder` / `ws.cancelOrder` / `ws.postAction`) — signed against
|
|
1073
|
+
/// the MTF-native chain id (`MTF_CHAIN_ID`), the same domain the REST
|
|
1074
|
+
/// `/exchange` path uses. A read-only client yields a WS client that can still
|
|
1075
|
+
/// subscribe and `postInfo`, but not `postAction`.
|
|
960
1076
|
async connectWs(config: Partial<WsConfig> = {}): Promise<WsClient> {
|
|
961
|
-
const
|
|
1077
|
+
const signer =
|
|
1078
|
+
this.privateKey !== undefined ? { privateKey: this.privateKey } : undefined;
|
|
1079
|
+
const ws = new WsClient(httpToWsUrl(this.baseUrl), config, signer);
|
|
962
1080
|
await ws.connect();
|
|
963
1081
|
return ws;
|
|
964
1082
|
}
|
package/src/index.ts
CHANGED
|
@@ -56,9 +56,16 @@ export {
|
|
|
56
56
|
buildNativeVaultTransferAction,
|
|
57
57
|
buildNativeVaultModifyAction,
|
|
58
58
|
buildNativeVaultWithdrawAction,
|
|
59
|
+
buildNativeVaultDistributeAction,
|
|
59
60
|
buildNativeMbWithdrawAction,
|
|
60
61
|
buildNativeSetMetaliquidityWhitelistAction,
|
|
61
62
|
buildNativeRegisterMetaliquidityOperatorAction,
|
|
63
|
+
// RFQ / FBA / cross-chain / encrypted (forward-compat) builders.
|
|
64
|
+
buildNativeRfqRequestAction,
|
|
65
|
+
buildNativeRfqAcceptAction,
|
|
66
|
+
buildNativeFbaSubmitAction,
|
|
67
|
+
buildNativeCrossChainSendAction,
|
|
68
|
+
buildNativeEncryptedOrderSubmitAction,
|
|
62
69
|
// Spot CLOB + spot margin (leveraged spot) + Earn (lending pool).
|
|
63
70
|
buildNativeSpotOrderAction,
|
|
64
71
|
buildNativeSpotCancelAction,
|
|
@@ -85,6 +92,7 @@ export type {
|
|
|
85
92
|
Tier,
|
|
86
93
|
MarginMode,
|
|
87
94
|
MarketInfo,
|
|
95
|
+
MarketKind,
|
|
88
96
|
Funding,
|
|
89
97
|
VaultState,
|
|
90
98
|
StakingState,
|
|
@@ -156,6 +164,9 @@ export {
|
|
|
156
164
|
type WsFrame,
|
|
157
165
|
type WsMessageHandler,
|
|
158
166
|
type WsConfig,
|
|
167
|
+
type WsSigner,
|
|
168
|
+
type AllMids,
|
|
169
|
+
type ActiveAssetCtx,
|
|
159
170
|
} from './ws/ws.js';
|
|
160
171
|
export {
|
|
161
172
|
WasmNotBuiltError,
|
|
@@ -232,16 +243,24 @@ export type {
|
|
|
232
243
|
LinkStakingUser,
|
|
233
244
|
// Encrypted orders.
|
|
234
245
|
SubmitEncryptedOrder,
|
|
246
|
+
EncryptedOrderSubmit,
|
|
235
247
|
// Vaults.
|
|
236
248
|
VaultKind,
|
|
237
249
|
CreateVault,
|
|
238
250
|
VaultTransfer,
|
|
239
251
|
VaultModify,
|
|
240
252
|
VaultWithdraw,
|
|
253
|
+
VaultDistribute,
|
|
241
254
|
// MetaBridge.
|
|
242
255
|
MbChain,
|
|
243
256
|
MbWithdraw,
|
|
244
257
|
// Governance / operator.
|
|
245
258
|
SetMetaliquidityWhitelist,
|
|
246
259
|
RegisterMetaliquidityOperator,
|
|
260
|
+
// RFQ / FBA / cross-chain (forward-compat).
|
|
261
|
+
CoreSide,
|
|
262
|
+
RfqRequest,
|
|
263
|
+
RfqAccept,
|
|
264
|
+
FbaSubmit,
|
|
265
|
+
CrossChainSend,
|
|
247
266
|
} from './types/index.js';
|