@derivexyz/derive-ts 3.0.4

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.
@@ -0,0 +1,1463 @@
1
+ import { R as RegisterDepositAddressResult, a as DepositHistoryResult, I as InstrumentPublicResponse, P as PublicAssetType, G as GetAllInstrumentsResponse, T as TickerSlimSnapshot, b as GetTickersResponse, C as CurrencyResponse, c as GetLatestSignedFeedsResponse, O as OptionSettlementPricesResult, d as GetTransactionResult, e as GetReferralPerformanceResult, f as IndexCandle, g as InterestRateHistoryResult, M as MarginWatchResult, h as TriggerType, i as TriggerPriceType, j as OrderCreatedWireResponse, k as OrderQuoteEdgeRpcResponse, l as OrderWireResponse, m as CancelAllResponse, n as CancelByLabelWireResponse, o as PaginatedOrdersResult, S as SetMmpConfigResponse, p as ResetMmpResponse, D as Direction, q as TransferPositionsWireResponse, r as RFQPrivateWireResponse, Q as QuotePollWireResponse, s as RfqGetBestQuoteWireResponse, t as QuoteResultPublic, u as QuoteExecuteWireResponse, v as QuoteExecuteDebugResult, w as CancelRfqResponse, x as RFQPollWireResponse, y as QuotePrivateWireResponse, z as QuoteSendDebugResult, A as CancelBatchResult, B as CancelBatchRfqsWireResponse, E as QuoteGetWireResponse, F as QuoteReplaceWireResponse, H as PrivateCreateSessionKeyEdgeRPCResponse, J as SessionKeyResponse, K as PrivateTransferSpotEdgeRpcResponse, U as UpdateWhitelistedRecipientsEdgeRpcResponse, L as PrivateTransferSpotExternalEdgeRpcResponse, N as PrivateGetSubaccountRPCResponseFor_OrderWireResponseAnd_VaultDepositHoldResponse, V as PrivateGetAccountEdgeRPCResponse, W as PrivateGetPositionsRPCResponse, X as PrivateChangeSubaccountLabelRPCResponse, Y as PaginatedTradesResult, Z as InterestHistoryResult, _ as TransferHistoryResult, $ as OptionSettlementHistoryResponse, a0 as PaginationInfo, a1 as VaultRequestId, a2 as VaultIdsWireResponse, a3 as VaultCreateWireResponse, a4 as VaultSettleWireResponse, a5 as OffchainAckWireResponse, a6 as MultipleVaultRequestsWireResponse, a7 as VaultRequestAckWireResponse, a8 as VaultForceBurnWireResponse, a9 as VaultSharesWireResponse, aa as PaginatedVaultActionsResult, ab as VaultCancelWireResponse, ac as VaultWireResponse, ad as VaultsWireResponse, ae as PaginatedVaultActionsResult2, af as PerformanceResolution, ag as VaultPerformanceHistoryResult, ah as PrivateWithdrawEdgeRpcResponse, ai as WithdrawalHistoryResult, aj as ChannelSchemaMap } from './generated-DwMaydIF.cjs';
2
+ export { ak as EndpointMap } from './generated-DwMaydIF.cjs';
3
+ import { BaseWallet, Signer } from 'ethers';
4
+ import { D as DecimalLike, P as ProtocolScopeCode, O as OffchainScope } from './scopes-RzGb3xH6.cjs';
5
+ export { a as ProtocolScopeWireString, e as expiresIn, r as randomNonce, t as toE18, b as toScaled } from './scopes-RzGb3xH6.cjs';
6
+ import { R as RpcMethod, P as ParamsOf, a as ResultFor, C as ChannelParamsOf, b as ChannelDataOf } from './endpointMap-BBTkarIm.cjs';
7
+ import { ChannelTemplate } from './types/index.cjs';
8
+
9
+ declare const SDK_VERSION = "3.0.0";
10
+
11
+ /**
12
+ * The minimal signer the auth flow needs: anything that can EIP-191
13
+ * `signMessage` (an ethers Wallet, an HD wallet, a provider-backed
14
+ * signer, a hardware-wallet adapter…). Kept structural so any
15
+ * ethers-compatible signer works, not just this SDK's `ethers` instance.
16
+ */
17
+ interface AuthSigner {
18
+ signMessage(message: string): Promise<string>;
19
+ }
20
+ /**
21
+ * Who a request acts as: the account owner's address plus the wallet
22
+ * that actually signs (the owner itself, or a registered session key).
23
+ */
24
+ interface AuthCredentials {
25
+ ownerAddress: string;
26
+ signer: BaseWallet;
27
+ }
28
+ /**
29
+ * The exchange authenticates requests with an EIP-191 personal_sign
30
+ * over the current unix-millisecond timestamp as a decimal string.
31
+ * Owner-wallet signatures must be fresh; session-key signatures skip
32
+ * the freshness window but the key must be registered and unexpired.
33
+ *
34
+ * Note: header names are `X-Lyra*` — the live wire format predates the
35
+ * Derive rebrand.
36
+ */
37
+ declare function authHeaders(credentials: {
38
+ ownerAddress: string;
39
+ signer: AuthSigner;
40
+ }): Promise<Record<string, string>>;
41
+ /** `public/login` takes the same wallet/timestamp/signature triple as the REST headers. */
42
+ declare function loginParams(credentials: {
43
+ ownerAddress: string;
44
+ signer: AuthSigner;
45
+ }): Promise<{
46
+ wallet: string;
47
+ timestamp: string;
48
+ signature: string;
49
+ }>;
50
+
51
+ /** The subset of the WebSocket interface the SDK relies on; satisfied by both `ws` and the browser WebSocket. */
52
+ interface WebSocketLike {
53
+ readonly readyState: number;
54
+ send(data: string): void;
55
+ close(code?: number, reason?: string): void;
56
+ onopen: ((event?: unknown) => void) | null;
57
+ onmessage: ((event: {
58
+ data: unknown;
59
+ }) => void) | null;
60
+ onclose: ((event: {
61
+ code?: number;
62
+ reason?: unknown;
63
+ }) => void) | null;
64
+ onerror: ((event: unknown) => void) | null;
65
+ }
66
+ type WebSocketFactory = (url: string) => WebSocketLike | Promise<WebSocketLike>;
67
+ interface WsTransportOptions {
68
+ url: string;
69
+ timeoutMs: number;
70
+ logger: Logger;
71
+ wsFactory?: WebSocketFactory;
72
+ }
73
+ /**
74
+ * WebSocket transport with id-correlated request/response handling and
75
+ * automatic reconnect. On an unexpected close every in-flight request is
76
+ * rejected (mutating requests are never silently replayed); after the
77
+ * socket is re-established `onReconnected` lets the client re-login and
78
+ * re-subscribe.
79
+ */
80
+ declare class WsTransport {
81
+ private readonly options;
82
+ /** Set by the subscriptions layer; receives every pub/sub notification. */
83
+ onNotification?: (channel: string, data: unknown) => void;
84
+ /** Set by the client; runs after an automatic reconnect succeeds. */
85
+ onReconnected?: () => Promise<void>;
86
+ private socket?;
87
+ private nextId;
88
+ private readonly pending;
89
+ private intentionallyClosed;
90
+ private connecting?;
91
+ constructor(options: WsTransportOptions);
92
+ get connected(): boolean;
93
+ connect(): Promise<void>;
94
+ private open;
95
+ send<M extends RpcMethod>(method: M, params: ParamsOf<M>): Promise<ResultFor<M>>;
96
+ close(): Promise<void>;
97
+ private handleMessage;
98
+ private handleClose;
99
+ private rejectAllPending;
100
+ private reconnect;
101
+ }
102
+
103
+ /**
104
+ * Protocol contracts the SDK references. (The EIP-712 verifying contract
105
+ * is not here — v3 uses a constant Matching address on every network;
106
+ * see MATCHING_VERIFYING_CONTRACT in signing/eip712.ts.)
107
+ */
108
+ interface ContractAddresses {
109
+ actionManager?: string;
110
+ usdc?: string;
111
+ cash?: string;
112
+ }
113
+ /**
114
+ * Addresses of the protocol's action-verification modules. Every signed
115
+ * action commits to the module that verifies it, so a wrong module
116
+ * address means a rejected signature. All v3 networks share the
117
+ * canonical set in signing/modules.ts.
118
+ */
119
+ interface ModuleAddresses {
120
+ trade: string;
121
+ transfer: string;
122
+ withdrawal: string;
123
+ rfq: string;
124
+ externalTransfer: string;
125
+ whitelistedRecipient: string;
126
+ vault: string;
127
+ liquidation: string;
128
+ createSessionKey: string;
129
+ deposit?: string;
130
+ }
131
+ /**
132
+ * Everything network-specific the SDK needs. The EIP-712 domain
133
+ * separator is not stored — it is computed the canonical part-wise way
134
+ * from `chainId` + `contracts.matching` (see signing/eip712.ts).
135
+ */
136
+ interface NetworkConfig {
137
+ name: string;
138
+ httpUrl: string;
139
+ wsUrl: string;
140
+ /** The chain the protocol verifies signatures for (mainnet: Ethereum L1, testnet: Sepolia, local: anvil). */
141
+ chainId: number;
142
+ modules: ModuleAddresses;
143
+ contracts: ContractAddresses;
144
+ }
145
+ type NetworkName = 'mainnet' | 'testnet' | 'local';
146
+ /** A logging hook; the SDK never logs to console directly and never logs key material. */
147
+ type Logger = (level: 'debug' | 'info' | 'warn' | 'error', message: string, data?: unknown) => void;
148
+ interface DeriveClientOptions {
149
+ /** Preset name or a full custom config. */
150
+ network: NetworkName | NetworkConfig;
151
+ /**
152
+ * The account owner wallet: a raw private key or an ethers wallet
153
+ * with a local signing key. Optional when only public endpoints or a
154
+ * session key are used.
155
+ */
156
+ wallet?: string | BaseWallet;
157
+ /**
158
+ * A registered session key used for login and request signing in
159
+ * place of the owner wallet. Recommended for bots and frontends:
160
+ * scope it narrowly and set an expiry.
161
+ */
162
+ sessionKey?: string | BaseWallet;
163
+ /** The account owner's address; required when a session key is used without the owner wallet. */
164
+ ownerAddress?: string;
165
+ logger?: Logger;
166
+ /** WebSocket constructor override (defaults to `ws` in Node, the global WebSocket in browsers). */
167
+ wsFactory?: WebSocketFactory;
168
+ /** Per-request timeout in milliseconds. Default 20_000. */
169
+ requestTimeoutMs?: number;
170
+ }
171
+
172
+ /**
173
+ * What every API namespace needs from the client: the network config,
174
+ * a typed RPC pipe, and the signing identities. Kept as an interface so
175
+ * namespaces stay independently testable.
176
+ */
177
+ interface ClientContext {
178
+ network: NetworkConfig;
179
+ logger: Logger;
180
+ send<M extends RpcMethod>(method: M, params: ParamsOf<M>): Promise<ResultFor<M>>;
181
+ /**
182
+ * The acting identity: the account owner's address (the `owner` field
183
+ * of every signed action) plus the wallet that signs requests and
184
+ * actions — the session key when configured, otherwise the owner.
185
+ */
186
+ credentials(): AuthCredentials;
187
+ }
188
+
189
+ /**
190
+ * Deposits are NOT signed actions in v3. Funds enter through one of two
191
+ * deliberately distinct flows — pick explicitly:
192
+ *
193
+ * - `deposits.contractCall.*` — self-custody: YOUR wallet sends the
194
+ * on-chain ActionManager transaction (approve + deposit); you provide
195
+ * an ethers Signer connected to the chain RPC.
196
+ * - `deposits.depositAddress.*` — CEX-style: register a deterministic
197
+ * deposit address, send funds to it from anywhere, and the exchange
198
+ * sweeps and credits them asynchronously.
199
+ *
200
+ * `getHistory` and `awaitCredited` cover both flows.
201
+ */
202
+ declare class DepositsApi {
203
+ private readonly ctx;
204
+ readonly contractCall: ContractCallDeposits;
205
+ readonly depositAddress: DepositAddressDeposits;
206
+ constructor(ctx: ClientContext);
207
+ /**
208
+ * Deposit history rows (up to 1000), regardless of which flow funded
209
+ * them. Scoped to one subaccount when `subaccountId` is given,
210
+ * otherwise to the whole owner wallet. Timestamps are unix milliseconds.
211
+ */
212
+ getHistory(options?: {
213
+ subaccountId?: number;
214
+ startTimestampMs?: number;
215
+ endTimestampMs?: number;
216
+ }): Promise<DepositHistoryResult>;
217
+ /**
218
+ * Polls `private/get_subaccounts` until a subaccount id outside
219
+ * `knownSubaccountIds` appears — the signal that a deposit creating a
220
+ * new subaccount (either flow) was credited — and returns the new id.
221
+ * Snapshot the ids BEFORE initiating the deposit.
222
+ */
223
+ awaitCredited(params: {
224
+ knownSubaccountIds: number[];
225
+ timeoutMs?: number;
226
+ pollIntervalMs?: number;
227
+ }): Promise<number>;
228
+ }
229
+ interface ContractCallDepositBase {
230
+ /** Caller-provided ethers signer connected to the chain RPC (the SDK holds no provider). */
231
+ signer: Signer;
232
+ /** Protocol asset label the deposit credits (see abis/actionManager.ts), NOT the ERC-20. */
233
+ asset: string;
234
+ /** Underlying ERC-20 to approve and pull funds from. Defaults to the network's USDC. */
235
+ erc20?: string;
236
+ /**
237
+ * Amount in human units — scaled by the ERC-20's on-chain `decimals()`
238
+ * (USDC = 6) — or a bigint of already-raw token units.
239
+ */
240
+ amount: DecimalLike;
241
+ }
242
+ /**
243
+ * Self-custody deposits: the caller's wallet signs on-chain
244
+ * ActionManager transactions directly.
245
+ */
246
+ declare class ContractCallDeposits {
247
+ private readonly ctx;
248
+ constructor(ctx: ClientContext);
249
+ /**
250
+ * Approves (if needed) and deposits into an existing subaccount.
251
+ * `fallbackRecipient` (default: the signer) receives the funds into
252
+ * its fallback subaccount if the deposit cannot be applied.
253
+ * Resolves once the transaction is mined — crediting happens
254
+ * asynchronously once the deposit is observed on-chain.
255
+ */
256
+ deposit(params: ContractCallDepositBase & {
257
+ subaccountId: number;
258
+ fallbackRecipient?: string;
259
+ }): Promise<{
260
+ txHash: string;
261
+ }>;
262
+ /**
263
+ * Approves (if needed) and deposits into a NEW subaccount under
264
+ * `managerId`, owned by `owner` (default: the signer). The exchange
265
+ * assigns the subaccount id asynchronously — discover it with
266
+ * `deposits.awaitCredited` against a pre-deposit snapshot of the
267
+ * owner's ids.
268
+ */
269
+ depositToNewSubaccount(params: ContractCallDepositBase & {
270
+ managerId: number;
271
+ owner?: string;
272
+ }): Promise<{
273
+ txHash: string;
274
+ }>;
275
+ /** Scales the amount, then ensures the ActionManager may pull it from the ERC-20. */
276
+ private approveForDeposit;
277
+ }
278
+ /**
279
+ * CEX-style deposits: send funds to a registered deterministic address
280
+ * from any wallet or exchange; they are credited asynchronously.
281
+ */
282
+ declare class DepositAddressDeposits {
283
+ private readonly ctx;
284
+ constructor(ctx: ClientContext);
285
+ /**
286
+ * Registers (or re-fetches — the address is deterministic per wallet/
287
+ * subaccount/manager) the deposit address the exchange watches and
288
+ * sweeps, routing funds to an existing subaccount or, with
289
+ * `managerId`, a new one. `wallet` defaults to the client's owner.
290
+ */
291
+ register(options?: {
292
+ wallet?: string;
293
+ subaccountId?: number;
294
+ managerId?: number;
295
+ }): Promise<RegisterDepositAddressResult>;
296
+ }
297
+
298
+ interface InstrumentsQuery {
299
+ instrumentType: PublicAssetType;
300
+ currency?: string;
301
+ /** Include expired instruments. Default false. */
302
+ expired?: boolean;
303
+ page?: number;
304
+ pageSize?: number;
305
+ }
306
+ /** One collateral leg of a `simulateMargin` portfolio; `amount` is a decimal string. */
307
+ interface SimulatedCollateral {
308
+ assetName: string;
309
+ amount: string;
310
+ }
311
+ /** One position leg of a `simulateMargin` portfolio; `amount` is a decimal string. */
312
+ interface SimulatedPosition {
313
+ instrumentName: string;
314
+ amount: string;
315
+ /** Perps only — entry price to simulate against; defaults to mark price. */
316
+ entryPrice?: string;
317
+ }
318
+ interface SimulateMarginParams {
319
+ marginType: 'PM' | 'PM2' | 'SM';
320
+ /** Required for portfolio margin. */
321
+ market?: string;
322
+ simulatedCollaterals: SimulatedCollateral[];
323
+ simulatedPositions: SimulatedPosition[];
324
+ /** Deltas layered on top of `simulatedCollaterals` to model a deposit/withdrawal/spot trade. */
325
+ simulatedCollateralChanges?: SimulatedCollateral[];
326
+ /** Deltas layered on top of `simulatedPositions` to model a perp/option trade. */
327
+ simulatedPositionChanges?: SimulatedPosition[];
328
+ }
329
+ /** Public market data endpoints — no authentication or signing. */
330
+ declare class MarketDataApi {
331
+ private readonly ctx;
332
+ constructor(ctx: ClientContext);
333
+ getInstrument(instrumentName: string): Promise<InstrumentPublicResponse>;
334
+ /** One page of instruments; the response carries pagination info. */
335
+ getInstruments(query: InstrumentsQuery): Promise<GetAllInstrumentsResponse>;
336
+ /** Every currently tradeable instrument name across all currencies. */
337
+ getAllLiveInstruments(): Promise<string[]>;
338
+ /**
339
+ * Latest ticker snapshot: top of book (`b`/`a` prices, `B`/`A`
340
+ * amounts), mark (`M`) and index (`I`) prices, and match bounds.
341
+ */
342
+ getTicker(instrumentName: string): Promise<TickerSlimSnapshot>;
343
+ /** Ticker snapshots for every instrument of a type, keyed by instrument name. */
344
+ getTickers(params: {
345
+ instrumentType: PublicAssetType;
346
+ currency?: string;
347
+ expiryDate?: number;
348
+ }): Promise<GetTickersResponse>;
349
+ getAllCurrencies(): Promise<CurrencyResponse[]>;
350
+ getCurrency(currency: string): Promise<CurrencyResponse>;
351
+ /** Latest signed oracle feeds (spot/perp/option/forward), optionally filtered by currency/expiry. */
352
+ getLatestSignedFeeds(params?: {
353
+ currency?: string;
354
+ expiry?: number;
355
+ }): Promise<GetLatestSignedFeedsResponse>;
356
+ /** Settlement prices per expiry for the currency's options. */
357
+ getOptionSettlementPrices(currency: string): Promise<OptionSettlementPricesResult>;
358
+ /** On-chain settlement status and hash for a single op by its uuid. */
359
+ getTransaction(opUuid: string): Promise<GetTransactionResult>;
360
+ /** Referral fee-share and reward breakdown over a millisecond window. */
361
+ getReferralPerformance(params: {
362
+ startMs: number;
363
+ endMs: number;
364
+ referralCode?: string;
365
+ wallet?: string;
366
+ }): Promise<GetReferralPerformanceResult>;
367
+ /** Spot index OHLC candles for a currency over a UTC-seconds window; `period` is the bucket size in seconds. */
368
+ getIndexChartData(params: {
369
+ currency: string;
370
+ startTimestamp: number;
371
+ endTimestamp: number;
372
+ period: number;
373
+ }): Promise<IndexCandle[]>;
374
+ /** Interest-rate candles for a currency's lending pools, optionally scoped to one risk universe. */
375
+ getInterestRateHistory(params: {
376
+ currency: string;
377
+ startTimestamp?: number;
378
+ endTimestamp?: number;
379
+ period?: number;
380
+ riskUniverseId?: number;
381
+ }): Promise<InterestRateHistoryResult>;
382
+ /** 24h and lifetime volume/fee/trade statistics for an instrument name or type (`ALL`/`OPTION`/`PERP`/`SPOT`). */
383
+ getStatistics(params: {
384
+ instrumentName: string;
385
+ currency?: string;
386
+ endTime?: number;
387
+ }): Promise<unknown>;
388
+ /** All maker programs, including past/historical epochs. */
389
+ getMakerPrograms(): Promise<unknown>;
390
+ /** Per-maker score breakdown for one program epoch. */
391
+ getMakerProgramScores(params: {
392
+ programName: string;
393
+ epochStartTimestamp: number;
394
+ }): Promise<unknown>;
395
+ /** Paginated liquidation-auction history across all subaccounts (or one, if `subaccountId` is given). */
396
+ getLiquidationHistory(params?: {
397
+ subaccountId?: number;
398
+ fromTimestamp?: number;
399
+ toTimestamp?: number;
400
+ page?: number;
401
+ pageSize?: number;
402
+ }): Promise<unknown>;
403
+ /** Mark-to-market value and maintenance margin for a subaccount. */
404
+ marginWatch(params: {
405
+ subaccountId: number;
406
+ forceOnchain?: boolean;
407
+ isDelayedLiquidation?: boolean;
408
+ }): Promise<MarginWatchResult>;
409
+ /** Margin requirement for a simulated portfolio and optional trade deltas; ignores open-order margin. */
410
+ simulateMargin(params: SimulateMarginParams): Promise<unknown>;
411
+ }
412
+
413
+ interface PlaceOrderParams {
414
+ subaccountId: number;
415
+ instrumentName: string;
416
+ direction: 'buy' | 'sell';
417
+ amount: DecimalLike;
418
+ limitPrice: DecimalLike;
419
+ /**
420
+ * Highest fee per unit the signature allows (the exchange charges its
421
+ * normal fee regardless — this only caps it). Defaults to 3x the
422
+ * instrument's current taker cost; pass explicitly for market makers.
423
+ */
424
+ maxFee?: DecimalLike;
425
+ orderType?: 'limit' | 'market';
426
+ timeInForce?: 'gtc' | 'post_only' | 'fok' | 'ioc';
427
+ label?: string;
428
+ /** Count this order against the market-maker-protection limits. */
429
+ mmp?: boolean;
430
+ reduceOnly?: boolean;
431
+ nonce?: string;
432
+ signatureExpirySec?: number;
433
+ /** Conditional-order trigger: fires the order when the price condition is met. */
434
+ triggerType?: TriggerType;
435
+ triggerPrice?: DecimalLike;
436
+ triggerPriceType?: TriggerPriceType;
437
+ /** Referral code recorded against the order's fees. */
438
+ referralCode?: string;
439
+ /** Reject (rather than downgrade) a post-only order that would cross. */
440
+ rejectPostOnly?: boolean;
441
+ /** Marks the order for the atomic-signing flow. */
442
+ isAtomicSigning?: boolean;
443
+ /** Caller-supplied order tag (wire field `client`). */
444
+ clientOrderId?: string;
445
+ /** Additional per-unit fee the caller opts to pay (wire field `extra_fee`). */
446
+ extraFee?: DecimalLike;
447
+ /** Reject the order if the server clock is past this unix-seconds deadline. */
448
+ rejectTimestamp?: number;
449
+ /** Algo-order parameters (e.g. TWAP). */
450
+ algoType?: string;
451
+ algoDurationSec?: number;
452
+ algoNumSlices?: number;
453
+ }
454
+ interface OrderHistoryQuery {
455
+ subaccountId?: number;
456
+ fromTimestamp?: number;
457
+ toTimestamp?: number;
458
+ page?: number;
459
+ pageSize?: number;
460
+ }
461
+ interface SetMmpConfigParams {
462
+ subaccountId: number;
463
+ currency: string;
464
+ /** Freeze duration (ms) once tripped; 0 requires a manual `resetMmp`. */
465
+ mmpFrozenTime: number;
466
+ /** Rolling protection window (ms) over which fills accumulate. */
467
+ mmpInterval: number;
468
+ /** Filled-amount limit within the window (decimal string); omit or 0 for unlimited. */
469
+ mmpAmountLimit?: DecimalLike;
470
+ /** Net-delta limit within the window (decimal string); omit or 0 for unlimited. */
471
+ mmpDeltaLimit?: DecimalLike;
472
+ }
473
+ /** Order placement (signed trade actions) and management. */
474
+ declare class OrdersApi {
475
+ private readonly ctx;
476
+ private readonly marketData;
477
+ /** Asset address/subId per instrument name are immutable — cache the lookups. */
478
+ private readonly instruments;
479
+ constructor(ctx: ClientContext, marketData: MarketDataApi);
480
+ /**
481
+ * Builds the signed wire payload shared by `place` and `quote`. The trade
482
+ * action commits only to asset/price/amount/fee/recipient — trigger,
483
+ * referral, algo and the other flags below are wire-only and never signed.
484
+ */
485
+ private buildOrderPayload;
486
+ place(params: PlaceOrderParams): Promise<OrderCreatedWireResponse>;
487
+ /**
488
+ * Prices an order without placing it. Signs like `place` (pass
489
+ * `{ public: true }` to hit the unauthenticated public estimate instead).
490
+ */
491
+ getOrderQuote(params: PlaceOrderParams, options?: {
492
+ public?: boolean;
493
+ }): Promise<OrderQuoteEdgeRpcResponse>;
494
+ /** Cancels one order. Needs only authentication, not a signature. */
495
+ cancel(params: {
496
+ subaccountId: number;
497
+ orderId: string;
498
+ instrumentName: string;
499
+ }): Promise<OrderWireResponse>;
500
+ cancelAll(subaccountId: number, options?: {
501
+ cancelTriggerOrders?: boolean;
502
+ cancelAlgoOrders?: boolean;
503
+ }): Promise<CancelAllResponse>;
504
+ cancelByLabel(params: {
505
+ subaccountId: number;
506
+ label: string;
507
+ instrumentName?: string;
508
+ }): Promise<CancelByLabelWireResponse>;
509
+ getOrder(params: {
510
+ subaccountId: number;
511
+ orderId: string;
512
+ }): Promise<OrderWireResponse>;
513
+ getOpenOrders(subaccountId: number): Promise<OrderWireResponse[]>;
514
+ /** Paginated closed/open order history; defaults to all of the wallet's subaccounts. */
515
+ getOrderHistory(query?: OrderHistoryQuery): Promise<PaginatedOrdersResult>;
516
+ /** Sets the market-maker-protection limits for a currency; overwrites any existing config. */
517
+ setMmpConfig(params: SetMmpConfigParams): Promise<SetMmpConfigResponse>;
518
+ /** Clears a tripped market-maker-protection freeze; scoped to one currency, or all when omitted. */
519
+ resetMmp(params: {
520
+ subaccountId: number;
521
+ currency?: string;
522
+ }): Promise<ResetMmpResponse>;
523
+ private instrument;
524
+ /**
525
+ * The signed max fee must cover whatever the exchange charges at match
526
+ * time or the order is rejected. The exchange bounds the per-unit fee at
527
+ * `2 x taker_fee_rate x max(index, limit) + base_fee`, where `index` is
528
+ * the underlying SPOT feed (`ticker.I`) — NOT the option mark
529
+ * (`ticker.M`). We mirror that and apply a 3x headroom for feed moves
530
+ * between signing and matching.
531
+ */
532
+ private defaultMaxFee;
533
+ }
534
+
535
+ /** One priced position leg shared by both sides of a position transfer. */
536
+ interface PositionTransferLeg {
537
+ instrumentName: string;
538
+ amount: DecimalLike;
539
+ price: DecimalLike;
540
+ direction: Direction;
541
+ }
542
+ interface TransferPositionsParams {
543
+ /** Subaccount signing the maker quote. Must differ from `takerSubaccountId`. */
544
+ makerSubaccountId: number;
545
+ /** Subaccount signing the taker execute. Must differ from `makerSubaccountId`. */
546
+ takerSubaccountId: number;
547
+ /** Maker quote direction. The SDK derives the taker's opposite direction. */
548
+ makerDirection: Direction;
549
+ /** The exact priced package both sides authorize. */
550
+ legs: PositionTransferLeg[];
551
+ makerNonce?: string;
552
+ takerNonce?: string;
553
+ /** Shared signature expiry for both sides. Defaults to 700 seconds from now. */
554
+ signatureExpirySec?: number;
555
+ }
556
+ /**
557
+ * Transfers perp/option positions between two subaccounts owned by the same
558
+ * wallet. The route executes an RFQ internally, so the SDK signs a zero-fee
559
+ * maker quote and the matching opposite-direction taker execute.
560
+ */
561
+ declare class PositionTransfersApi {
562
+ private readonly ctx;
563
+ private readonly instruments;
564
+ constructor(ctx: ClientContext);
565
+ transferPositions(params: TransferPositionsParams): Promise<TransferPositionsWireResponse>;
566
+ private resolveLegs;
567
+ private instrument;
568
+ private signAction;
569
+ }
570
+
571
+ /** A leg of an RFQ as requested by the taker — unpriced; makers quote the price. */
572
+ interface RfqLeg {
573
+ instrumentName: string;
574
+ amount: DecimalLike;
575
+ direction: Direction;
576
+ }
577
+ /** A priced leg as signed by the maker (`sendQuote`). */
578
+ interface PricedRfqLeg extends RfqLeg {
579
+ price: DecimalLike;
580
+ }
581
+ /** Maker quote against an open RFQ — see `sendQuote` / `sendQuoteDebug`. */
582
+ interface SendQuoteParams {
583
+ /** The maker's subaccount. */
584
+ subaccountId: number;
585
+ rfqId: string;
586
+ direction: Direction;
587
+ legs: PricedRfqLeg[];
588
+ /** Worst execution fee the maker accepts, in USD. */
589
+ maxFee: DecimalLike;
590
+ mmp?: boolean;
591
+ label?: string;
592
+ nonce?: string;
593
+ signatureExpirySec?: number;
594
+ }
595
+ /** Taker execution of a maker quote — see `executeQuote` / `executeQuoteDebug`. */
596
+ interface ExecuteQuoteParams {
597
+ /** The taker's subaccount. */
598
+ subaccountId: number;
599
+ quote: Pick<QuoteResultPublic, 'rfq_id' | 'quote_id' | 'direction' | 'legs'>;
600
+ /** Worst execution fee the taker accepts, in USD. */
601
+ maxFee: DecimalLike;
602
+ /** Reject the fill if the quote is no longer the best available price. */
603
+ enableTakerProtection?: boolean;
604
+ label?: string;
605
+ nonce?: string;
606
+ signatureExpirySec?: number;
607
+ }
608
+ /**
609
+ * RFQ trading: takers request quotes on multi-leg packages, makers answer
610
+ * with signed quotes, and the taker executes one — the only two signed
611
+ * operations are `sendQuote` (maker) and `executeQuote` (taker), both
612
+ * against the RFQ module. Requesting, polling and cancelling are auth-only.
613
+ */
614
+ declare class RfqApi {
615
+ private readonly ctx;
616
+ /** Asset address/subId per instrument name are immutable — cache the lookups. */
617
+ private readonly instruments;
618
+ constructor(ctx: ClientContext);
619
+ /** Requests quotes for a package of legs. Unsigned — only the eventual execute is. */
620
+ sendRfq(params: {
621
+ subaccountId: number;
622
+ legs: RfqLeg[];
623
+ label?: string;
624
+ /** Reject fills costing the taker more than this (buy-side cap). */
625
+ maxTotalCost?: DecimalLike;
626
+ /** Reject fills earning the taker less than this (sell-side floor). */
627
+ minTotalCost?: DecimalLike;
628
+ /** Restrict quoting to these maker wallets. */
629
+ counterparties?: string[];
630
+ partialFillStep?: DecimalLike;
631
+ }): Promise<RFQPrivateWireResponse>;
632
+ /** Polls quotes received for the taker's RFQs (e.g. `status: 'open'`). */
633
+ pollQuotes(params: {
634
+ subaccountId: number;
635
+ rfqId?: string;
636
+ quoteId?: string;
637
+ status?: string;
638
+ fromTimestamp?: number;
639
+ toTimestamp?: number;
640
+ page?: number;
641
+ pageSize?: number;
642
+ }): Promise<QuotePollWireResponse>;
643
+ /** The exchange's pick of the best open quote for an RFQ, with margin/cost estimates. */
644
+ getBestQuote(params: {
645
+ subaccountId: number;
646
+ /** The open RFQ whose quotes should be evaluated. */
647
+ rfqId: string;
648
+ /** The direction the taker wants to trade. */
649
+ direction: Direction;
650
+ legs: RfqLeg[];
651
+ }): Promise<RfqGetBestQuoteWireResponse>;
652
+ /**
653
+ * Executes a maker quote (from `pollQuotes` / `getBestQuote`). The taker
654
+ * trades opposite the quote's direction and signs a commitment to the
655
+ * maker's exact leg bundle, so legs and prices come from the quote itself.
656
+ */
657
+ executeQuote(params: ExecuteQuoteParams): Promise<QuoteExecuteWireResponse>;
658
+ /**
659
+ * Debug helper: signs the execute exactly like `executeQuote` but submits it
660
+ * to `public/execute_quote_debug`, returning the server-computed encoded data
661
+ * and hashes instead of filling. Use it to verify your client-side signing.
662
+ */
663
+ executeQuoteDebug(params: ExecuteQuoteParams): Promise<QuoteExecuteDebugResult>;
664
+ private buildExecutePayload;
665
+ cancelRfq(params: {
666
+ subaccountId: number;
667
+ rfqId: string;
668
+ }): Promise<CancelRfqResponse>;
669
+ /** Polls RFQs open for quoting (e.g. `status: 'open'`). */
670
+ pollRfqs(params: {
671
+ subaccountId: number;
672
+ rfqId?: string;
673
+ status?: string;
674
+ fromTimestamp?: number;
675
+ toTimestamp?: number;
676
+ page?: number;
677
+ pageSize?: number;
678
+ }): Promise<RFQPollWireResponse>;
679
+ /**
680
+ * Signs and sends a quote against an open RFQ. Legs must match the RFQ's
681
+ * legs with prices added; `direction: 'sell'` quotes the package to a
682
+ * buying taker.
683
+ */
684
+ sendQuote(params: SendQuoteParams): Promise<QuotePrivateWireResponse>;
685
+ /**
686
+ * Debug helper: signs the quote exactly like `sendQuote` but submits it to
687
+ * `public/send_quote_debug`, returning the server-computed encoded data and
688
+ * hashes instead of posting. Use it to verify your client-side signing.
689
+ */
690
+ sendQuoteDebug(params: SendQuoteParams): Promise<QuoteSendDebugResult>;
691
+ private buildSendQuotePayload;
692
+ cancelQuote(params: {
693
+ subaccountId: number;
694
+ quoteId: string;
695
+ rfqId?: string;
696
+ }): Promise<QuotePrivateWireResponse>;
697
+ /** Cancels all the subaccount's open quotes, optionally scoped to one RFQ. */
698
+ cancelBatchQuotes(params: {
699
+ subaccountId: number;
700
+ rfqId?: string;
701
+ }): Promise<CancelBatchResult>;
702
+ /** Cancels all the subaccount's open RFQs, optionally scoped to one RFQ id. */
703
+ cancelBatchRfqs(params: {
704
+ subaccountId: number;
705
+ rfqId?: string;
706
+ }): Promise<CancelBatchRfqsWireResponse>;
707
+ /** Paginated quote history/read for the subaccount, filterable by rfq/quote/status. */
708
+ getQuotes(params: {
709
+ subaccountId: number;
710
+ rfqId?: string;
711
+ quoteId?: string;
712
+ status?: string;
713
+ page?: number;
714
+ pageSize?: number;
715
+ fromTimestamp?: number;
716
+ toTimestamp?: number;
717
+ }): Promise<QuoteGetWireResponse>;
718
+ /**
719
+ * Atomically cancels an existing quote and signs+sends a replacement on the
720
+ * same RFQ. Legs/price/maxFee sign the new quote exactly like `sendQuote`;
721
+ * identify the quote to cancel by `quoteIdToCancel` or `nonceToCancel`.
722
+ */
723
+ replaceQuote(params: {
724
+ subaccountId: number;
725
+ rfqId: string;
726
+ direction: Direction;
727
+ legs: PricedRfqLeg[];
728
+ maxFee: DecimalLike;
729
+ quoteIdToCancel?: string;
730
+ nonceToCancel?: string;
731
+ mmp?: boolean;
732
+ label?: string;
733
+ nonce?: string;
734
+ signatureExpirySec?: number;
735
+ }): Promise<QuoteReplaceWireResponse>;
736
+ /** Attaches each leg's protocol asset address + sub id and sorts into the canonical signed order. */
737
+ private resolveLegs;
738
+ private instrument;
739
+ private signRfqAction;
740
+ }
741
+
742
+ interface CreateSessionKeyParams {
743
+ /** The key being authorized: an address, or an ethers wallet (e.g. `Wallet.createRandom()`). */
744
+ publicSessionKey: string | BaseWallet;
745
+ /**
746
+ * The KEY's lifetime as a unix-seconds timestamp, committed in the signed
747
+ * data — not to be confused with `signatureExpirySec`, which only bounds
748
+ * how long this registration request itself stays valid.
749
+ */
750
+ expirySec: number;
751
+ /**
752
+ * Protocol scopes granted (numeric codes; the wire strings are derived).
753
+ * Defaults to NONE — the key can then only authenticate and use its
754
+ * offchain scopes. Grant `ProtocolScopeCode.Admin` deliberately, never
755
+ * by default.
756
+ */
757
+ protocolScopes?: ProtocolScopeCode[];
758
+ /** Off-chain scopes, e.g. `[OffchainScope.AccountInfo]`. Defaults to account_info. */
759
+ offchainScopes?: OffchainScope[];
760
+ /** Subaccounts the key may act on. Omit for ALL current and future subaccounts. */
761
+ subaccountIds?: number[];
762
+ label?: string;
763
+ /** Source IPs the key may be used from; omit for no restriction. */
764
+ ipWhitelist?: string[];
765
+ /** Envelope expiry of the registration signature. Defaults to 10 minutes. */
766
+ signatureExpirySec?: number;
767
+ nonce?: string;
768
+ }
769
+ interface EditSessionKeyParams {
770
+ publicSessionKey: string;
771
+ /** Omitted fields are left unchanged (the endpoint is a patch). */
772
+ label?: string;
773
+ /** Requires the request to be authorized by the owner or an admin-scoped key. */
774
+ ipWhitelist?: string[];
775
+ /** Requires the request to be authorized by the owner or an admin-scoped key. */
776
+ offchainScopes?: OffchainScope[];
777
+ }
778
+ /**
779
+ * Session-key registration and management. Keys are wallet-level: actions
780
+ * are signed on subaccount 0 and the granted subaccount list lives inside
781
+ * the signed data, not the envelope.
782
+ */
783
+ declare class SessionKeysApi {
784
+ private readonly ctx;
785
+ constructor(ctx: ClientContext);
786
+ /**
787
+ * Registers a scoped session key. The action must be authorized by the
788
+ * account owner or by a registered session key holding the
789
+ * `create_session_key` scope — a child key must then be a subset of its
790
+ * creator (scopes, subaccounts, and expiry no later than the creator's).
791
+ * Signs with the client's action signer, so a client configured with an
792
+ * unscoped session key will be rejected server-side.
793
+ */
794
+ create(params: CreateSessionKeyParams): Promise<PrivateCreateSessionKeyEdgeRPCResponse>;
795
+ /** All registered session keys of the owner wallet. */
796
+ list(): Promise<SessionKeyResponse[]>;
797
+ /**
798
+ * Patches a key's OFF-CHAIN attributes. Protocol scopes, subaccounts,
799
+ * and expiry are committed in the signed registration and cannot be
800
+ * edited — register a replacement key instead. The public API has no
801
+ * revoke endpoint: a key stops working at its signed `expiry_sec`.
802
+ */
803
+ edit(params: EditSessionKeyParams): Promise<SessionKeyResponse>;
804
+ }
805
+
806
+ /**
807
+ * A spot asset as the exchange resolves it: `name` is what the wire takes
808
+ * as `asset_name`, `address` is what signatures commit to, `decimals` is
809
+ * the underlying ERC-20 scale withdrawal amounts are signed at.
810
+ */
811
+ interface SpotAssetInfo {
812
+ name: string;
813
+ address: string;
814
+ decimals: number;
815
+ }
816
+ interface InternalSpotTransferParams {
817
+ /** Sender subaccount. */
818
+ subaccountId: number;
819
+ /** Existing destination subaccount; omit (or 0) when creating one via `newSubaccountManager`. */
820
+ toSubaccountId?: number;
821
+ /** Set to a manager id to create a new subaccount as the destination instead of `toSubaccountId`. */
822
+ newSubaccountManager?: number;
823
+ /** Currency name (e.g. "USDC") or protocol spot-asset address. */
824
+ asset: string;
825
+ subId?: number;
826
+ amount: DecimalLike;
827
+ /**
828
+ * Fee cap in USD, default "0": transfers between existing subaccounts
829
+ * are free. Creating a subaccount charges a transfer fee (1 USD
830
+ * standard), so raise the cap when `newSubaccountManager` is set.
831
+ */
832
+ maxFeeUsd?: DecimalLike;
833
+ nonce?: string;
834
+ signatureExpirySec?: number;
835
+ }
836
+ interface ExternalSpotTransferParams {
837
+ /** Sender subaccount. */
838
+ subaccountId: number;
839
+ /** Destination owner wallet. Must be on the sender's whitelist of recipients. */
840
+ recipient: string;
841
+ /** Recipient's existing subaccount; omit (or 0) to create one for them via `newSubaccountManager`. */
842
+ toSubaccountId?: number;
843
+ /** Manager id for the recipient's new subaccount when `toSubaccountId` is omitted. */
844
+ newSubaccountManager?: number;
845
+ /** Currency name (e.g. "USDC") or protocol spot-asset address. */
846
+ asset: string;
847
+ subId?: number;
848
+ amount: DecimalLike;
849
+ /**
850
+ * Fee cap in USD. Required: external transfers always charge a transfer
851
+ * fee (1 USD standard) plus, when a subaccount is created, the
852
+ * protocol's subaccount-creation fee on top.
853
+ */
854
+ maxFeeUsd: DecimalLike;
855
+ nonce?: string;
856
+ signatureExpirySec?: number;
857
+ }
858
+ /**
859
+ * Spot transfers between subaccounts and to other wallets. Position
860
+ * transfers are not covered here: `private/transfer_positions` takes a
861
+ * maker and a taker RFQ-style signed quote, i.e. two signatures over the
862
+ * RFQ leg encoding.
863
+ */
864
+ declare class SpotTransfersApi {
865
+ private readonly ctx;
866
+ constructor(ctx: ClientContext);
867
+ /**
868
+ * Moves a spot balance between the owner's OWN subaccounts
869
+ * (`private/transfer_spot`). Destination is either an existing
870
+ * `toSubaccountId` or, when `newSubaccountManager` is set, a freshly
871
+ * created sender-owned subaccount under that manager. For a transfer
872
+ * to another wallet use `transferExternal`.
873
+ */
874
+ transferInternal(params: InternalSpotTransferParams): Promise<PrivateTransferSpotEdgeRpcResponse>;
875
+ /**
876
+ * Adds/removes recipient wallets on the owner's external-transfer
877
+ * whitelist (`private/update_whitelisted_recipients`). The resulting
878
+ * list is `(current ∪ add) \ remove`. Required before `transferExternal`
879
+ * can send to a given wallet.
880
+ */
881
+ updateWhitelistedRecipients(params: {
882
+ add?: string[];
883
+ remove?: string[];
884
+ nonce?: string;
885
+ signatureExpirySec?: number;
886
+ }): Promise<UpdateWhitelistedRecipientsEdgeRpcResponse>;
887
+ /**
888
+ * Moves a spot balance to another owner's wallet
889
+ * (`private/transfer_spot_external`). The recipient must already be on
890
+ * the sender's whitelist — call `updateWhitelistedRecipients` first;
891
+ * otherwise the exchange rejects with RPC error 11033 "Transfer
892
+ * recipient not whitelisted".
893
+ */
894
+ transferExternal(params: ExternalSpotTransferParams): Promise<PrivateTransferSpotExternalEdgeRpcResponse>;
895
+ private signAction;
896
+ }
897
+
898
+ interface TradeHistoryQuery {
899
+ subaccountId?: number;
900
+ instrumentName?: string;
901
+ orderId?: string;
902
+ quoteId?: string;
903
+ /** UTC-millisecond bounds. */
904
+ fromTimestamp?: number;
905
+ toTimestamp?: number;
906
+ page?: number;
907
+ pageSize?: number;
908
+ }
909
+ /**
910
+ * Window over a wallet's history. Omit `subaccountId` to query the whole
911
+ * authenticated wallet; set it to scope to one subaccount.
912
+ */
913
+ interface WalletHistoryQuery {
914
+ subaccountId?: number;
915
+ /** UTC-millisecond bounds. */
916
+ startTimestamp?: number;
917
+ endTimestamp?: number;
918
+ }
919
+ interface LiquidatorHistoryQuery {
920
+ subaccountId: number;
921
+ /** UTC-millisecond bounds. */
922
+ startTimestamp?: number;
923
+ endTimestamp?: number;
924
+ page?: number;
925
+ pageSize?: number;
926
+ }
927
+ /** A single simulated perp/option position change for `getMargin`. Amounts are decimal strings. */
928
+ interface SimulatedPositionChange {
929
+ instrumentName: string;
930
+ amount: string;
931
+ /** Perps only; mark price is used when omitted. */
932
+ entryPrice?: string;
933
+ }
934
+ /** A single simulated collateral (ERC-20) change for `getMargin`. Amount is a decimal string. */
935
+ interface SimulatedCollateralChange {
936
+ assetName: string;
937
+ amount: string;
938
+ }
939
+ interface MarginQuery {
940
+ subaccountId: number;
941
+ simulatedPositionChanges?: SimulatedPositionChange[];
942
+ simulatedCollateralChanges?: SimulatedCollateralChange[];
943
+ }
944
+ /** Margin figures before and after the (optionally simulated) trade. All figures are decimal strings. */
945
+ interface MarginResult {
946
+ is_valid_trade: boolean;
947
+ post_initial_margin: string;
948
+ post_maintenance_margin: string;
949
+ pre_initial_margin: string;
950
+ pre_maintenance_margin: string;
951
+ subaccount_id: number;
952
+ }
953
+ /** One liquidator bid within an auction. Amounts/PnL are decimal strings keyed by asset. */
954
+ interface AuctionBidEvent {
955
+ amounts_liquidated: Record<string, string>;
956
+ cash_received: string;
957
+ discount_pnl: string;
958
+ percent_liquidated: string;
959
+ positions_realized_pnl: Record<string, string>;
960
+ positions_realized_pnl_excl_fees: Record<string, string>;
961
+ realized_pnl: string;
962
+ realized_pnl_excl_fees: string;
963
+ timestamp: number;
964
+ tx_hash: string;
965
+ }
966
+ /** One auction a subaccount was liquidated in, with the bids that filled it. */
967
+ interface AuctionHistory {
968
+ auction_id: string;
969
+ auction_type: 'solvent' | 'insolvent';
970
+ bids: AuctionBidEvent[];
971
+ /** Auction end, UTC milliseconds; `null` while still live. */
972
+ end_timestamp: number | null;
973
+ fee: string;
974
+ start_timestamp: number;
975
+ subaccount_id: number;
976
+ tx_hash: string;
977
+ }
978
+ interface LiquidatorHistoryResult {
979
+ bids: AuctionBidEvent[];
980
+ pagination: PaginationInfo;
981
+ }
982
+ /** Subaccount portfolio and history endpoints — authenticated, no signing. */
983
+ declare class SubaccountsApi {
984
+ private readonly ctx;
985
+ constructor(ctx: ClientContext);
986
+ /** Ids of all subaccounts owned by the authenticated wallet. */
987
+ list(): Promise<number[]>;
988
+ /**
989
+ * Full portfolio snapshot: collaterals, positions, open orders, and
990
+ * the margin figures (there is no separate margin endpoint).
991
+ */
992
+ get(subaccountId: number): Promise<PrivateGetSubaccountRPCResponseFor_OrderWireResponseAnd_VaultDepositHoldResponse>;
993
+ /** Account-level info for the authenticated wallet: fee tiers, subaccount ids, and rate limits. */
994
+ getAccount(): Promise<PrivateGetAccountEdgeRPCResponse>;
995
+ /** Full portfolio snapshot for every subaccount owned by the authenticated wallet. */
996
+ getAllPortfolios(): Promise<PrivateGetSubaccountRPCResponseFor_OrderWireResponseAnd_VaultDepositHoldResponse[]>;
997
+ /** Open positions for a subaccount. */
998
+ getPositions(subaccountId: number): Promise<PrivateGetPositionsRPCResponse>;
999
+ /** Rename a subaccount. */
1000
+ changeLabel(params: {
1001
+ subaccountId: number;
1002
+ label: string;
1003
+ }): Promise<PrivateChangeSubaccountLabelRPCResponse>;
1004
+ /** Filtered and paginated fills; defaults to all of the wallet's subaccounts. */
1005
+ getTradeHistory(query?: TradeHistoryQuery): Promise<PaginatedTradesResult>;
1006
+ /** Realized interest settlements, newest first; defaults to the whole wallet. Capped at 1000 rows. */
1007
+ getInterestHistory(query?: WalletHistoryQuery): Promise<InterestHistoryResult>;
1008
+ /** Internal ERC-20 transfers touching the wallet's subaccounts; defaults to the whole wallet. Capped at 1000 rows. */
1009
+ getErc20TransferHistory(query?: WalletHistoryQuery): Promise<TransferHistoryResult>;
1010
+ /** Settled option positions; defaults to the whole wallet, pass `subaccountId` to scope to one. */
1011
+ getOptionSettlementHistory(query?: {
1012
+ subaccountId?: number;
1013
+ }): Promise<OptionSettlementHistoryResponse>;
1014
+ /**
1015
+ * Margin figures for a subaccount, optionally under simulated position/collateral changes.
1016
+ * Predates the schema, so it is absent from the generated EndpointMap and sent untyped.
1017
+ */
1018
+ getMargin(query: MarginQuery): Promise<MarginResult>;
1019
+ /**
1020
+ * Auctions in which a subaccount (or the whole wallet) was liquidated.
1021
+ * Predates the schema, so it is absent from the generated EndpointMap and sent untyped.
1022
+ */
1023
+ getLiquidationHistory(query?: WalletHistoryQuery): Promise<AuctionHistory[]>;
1024
+ /**
1025
+ * Paginated auctions a subaccount participated in as the liquidator.
1026
+ * Predates the schema, so it is absent from the generated EndpointMap and sent untyped.
1027
+ */
1028
+ getLiquidatorHistory(query: LiquidatorHistoryQuery): Promise<LiquidatorHistoryResult>;
1029
+ }
1030
+
1031
+ /** Caller overrides for the signed-action envelope. */
1032
+ interface VaultActionOverrides {
1033
+ nonce?: string;
1034
+ signatureExpirySec?: number;
1035
+ }
1036
+ interface VaultDepositRequest extends VaultActionOverrides {
1037
+ /** The user's source subaccount the deposited funds leave (the action is signed on it). */
1038
+ subaccountId: number;
1039
+ vaultSubaccountId: number;
1040
+ /** Must equal the vault's configured deposit asset (protocol spot-asset address). */
1041
+ depositSpotAsset: string;
1042
+ /** Amount of the deposit asset; max 12 decimal places. */
1043
+ amount: DecimalLike;
1044
+ }
1045
+ interface VaultWithdrawRequest extends VaultActionOverrides {
1046
+ /** The user's destination subaccount that receives the redeemed funds. */
1047
+ subaccountId: number;
1048
+ vaultSubaccountId: number;
1049
+ /** Vault shares to redeem; max 12 decimal places. */
1050
+ sharesToBurn: DecimalLike;
1051
+ }
1052
+ interface VaultCancelRequest extends VaultActionOverrides {
1053
+ /** Any subaccount the caller owns (the action is signed on it). */
1054
+ subaccountId: number;
1055
+ vaultSubaccountId: number;
1056
+ }
1057
+ interface CreateVaultRequest extends VaultActionOverrides {
1058
+ /** The curator's funding subaccount the initial deposit is signed from. */
1059
+ subaccountId: number;
1060
+ managerId: number;
1061
+ depositSpotAsset: string;
1062
+ /** Initial deposit in the vault's deposit asset; max 12 decimal places. */
1063
+ initialDeposit: DecimalLike;
1064
+ managementFeeBps: number;
1065
+ performanceFeeBps: number;
1066
+ maxSlippageBps: number;
1067
+ cooldownSec: number;
1068
+ /** Maximum settlement fee authorised, in USD; max 12 decimal places. */
1069
+ maxFeeUsd: DecimalLike;
1070
+ /** Share price the vault is seeded at, in USD; must lie within the protocol's permitted range. */
1071
+ initialSharePriceUsd: DecimalLike;
1072
+ /** Spot asset to denominate the high-water mark in; omit for the feed-less USD default. */
1073
+ benchmarkAsset?: string;
1074
+ }
1075
+ interface MintVaultSharesRequest extends VaultActionOverrides {
1076
+ /** The vault subaccount the curator signs the approval on. */
1077
+ vaultSubaccountId: number;
1078
+ /** Quoted share price in USD per share; max 12 decimal places. */
1079
+ sharePrice: DecimalLike;
1080
+ /** keccak256 of the user's exact encoded deposit action (0x hex, 32 bytes). */
1081
+ depositHash: string;
1082
+ /** The queued request being settled, as returned by the vault request reads. */
1083
+ requestId: VaultRequestId;
1084
+ }
1085
+ interface BurnVaultSharesRequest extends VaultActionOverrides {
1086
+ /** The vault subaccount the curator signs the approval on. */
1087
+ vaultSubaccountId: number;
1088
+ /** Quoted share price in USD per share; max 12 decimal places. */
1089
+ sharePrice: DecimalLike;
1090
+ /** keccak256 of the user's exact encoded withdraw action (0x hex, 32 bytes). */
1091
+ withdrawHash: string;
1092
+ /** The queued request being settled, as returned by the vault request reads. */
1093
+ requestId: VaultRequestId;
1094
+ }
1095
+ interface UpdateVaultInfoRequest {
1096
+ vaultSubaccountId: number;
1097
+ name?: string;
1098
+ description?: string;
1099
+ /** Advisory mark-to-market cap in USD. */
1100
+ mtmCap?: DecimalLike;
1101
+ whitelistOnly?: boolean;
1102
+ }
1103
+ /** The share-holding side: queued deposit/withdraw intents plus the wallet's vault reads. */
1104
+ declare class ShareholderVaultsApi {
1105
+ private readonly ctx;
1106
+ constructor(ctx: ClientContext);
1107
+ /** The vault subaccount ids the wallet holds shares in. */
1108
+ getShareholderVaults(): Promise<VaultIdsWireResponse>;
1109
+ /** The wallet's share balance plus the full vault row for every vault it holds shares in. */
1110
+ getShares(): Promise<VaultSharesWireResponse>;
1111
+ /** The wallet's queued deposit/withdraw intents still awaiting curator settlement. */
1112
+ getLiveRequests(): Promise<MultipleVaultRequestsWireResponse>;
1113
+ /** The wallet's full vault action history (every lifecycle status). */
1114
+ getRequestHistory(options?: {
1115
+ page?: number;
1116
+ pageSize?: number;
1117
+ }): Promise<PaginatedVaultActionsResult>;
1118
+ /**
1119
+ * Queues a deposit into a vault. The curator later mints shares at a
1120
+ * quoted price committed to this exact signed payload; funds are held
1121
+ * from the source subaccount until then (or until cancelled).
1122
+ */
1123
+ requestDeposit(request: VaultDepositRequest): Promise<VaultRequestAckWireResponse>;
1124
+ /** Queues a share redemption; the curator later burns the shares at a quoted price. */
1125
+ requestWithdraw(request: VaultWithdrawRequest): Promise<VaultRequestAckWireResponse>;
1126
+ /** Cancels ALL of the wallet's pending intents for a vault (deposits and withdrawals). */
1127
+ cancelAllRequests(request: VaultCancelRequest): Promise<VaultCancelWireResponse>;
1128
+ }
1129
+ /**
1130
+ * The curating side — open to any wallet in v3 (curating is not a
1131
+ * privileged role): vault creation, metadata updates, and the settle
1132
+ * approvals that execute queued shareholder intents at a quoted price.
1133
+ */
1134
+ declare class CuratorVaultsApi {
1135
+ private readonly ctx;
1136
+ constructor(ctx: ClientContext);
1137
+ /** The vault subaccount ids this wallet curates. */
1138
+ getCuratedVaults(): Promise<VaultIdsWireResponse>;
1139
+ /**
1140
+ * Creates a vault funded from the signer's subaccount; the signer
1141
+ * becomes its curator. Fee rates and max slippage are immutable
1142
+ * afterwards.
1143
+ */
1144
+ createVault(request: CreateVaultRequest): Promise<VaultCreateWireResponse>;
1145
+ /** Settles one queued shareholder deposit, minting shares at the quoted price. */
1146
+ mintShares(request: MintVaultSharesRequest): Promise<VaultSettleWireResponse>;
1147
+ /** Settles one queued shareholder withdrawal, burning shares at the quoted price. */
1148
+ burnShares(request: BurnVaultSharesRequest): Promise<VaultSettleWireResponse>;
1149
+ /** Updates the vault's advisory metadata (unsigned; an ownership check gates it to the curator). */
1150
+ updateInfo(request: UpdateVaultInfoRequest): Promise<OffchainAckWireResponse>;
1151
+ /** The vault's queued deposit intents awaiting a `mintShares` settlement, FIFO-ordered with the queue total. */
1152
+ getLiveMintRequests(vaultSubaccountId: number, limit?: number): Promise<MultipleVaultRequestsWireResponse>;
1153
+ /** The vault's queued withdraw intents awaiting a `burnShares` settlement, FIFO-ordered with the queue total. */
1154
+ getLiveBurnRequests(vaultSubaccountId: number, limit?: number): Promise<MultipleVaultRequestsWireResponse>;
1155
+ /** Rejects a queued deposit intent, releasing the holder's funds without minting shares. */
1156
+ rejectDepositRequest(requestId: VaultRequestId, reason?: string): Promise<VaultRequestAckWireResponse>;
1157
+ /**
1158
+ * Force-exits a holder at mark-to-market with no curator price quote (unsigned;
1159
+ * an ownership check gates it to the curator of `vaultSubaccountId`).
1160
+ */
1161
+ forceBurn(vaultSubaccountId: number, holder: string): Promise<VaultForceBurnWireResponse>;
1162
+ }
1163
+ /** Vault discovery and stats, plus the role-scoped `shareholder` and `curator` flows. */
1164
+ declare class VaultsApi {
1165
+ private readonly ctx;
1166
+ readonly shareholder: ShareholderVaultsApi;
1167
+ readonly curator: CuratorVaultsApi;
1168
+ constructor(ctx: ClientContext);
1169
+ getVault(vaultSubaccountId: number): Promise<VaultWireResponse>;
1170
+ listVaults(options?: {
1171
+ page?: number;
1172
+ pageSize?: number;
1173
+ }): Promise<VaultsWireResponse>;
1174
+ getActionHistory(vaultSubaccountId: number, options?: {
1175
+ eventType?: string;
1176
+ page?: number;
1177
+ pageSize?: number;
1178
+ }): Promise<PaginatedVaultActionsResult2>;
1179
+ getPerformanceHistory(vaultSubaccountId: number, resolution: PerformanceResolution, options?: {
1180
+ from?: number;
1181
+ to?: number;
1182
+ limit?: number;
1183
+ }): Promise<VaultPerformanceHistoryResult>;
1184
+ }
1185
+
1186
+ interface WithdrawParams {
1187
+ subaccountId: number;
1188
+ /** Currency name (e.g. "USDC") or protocol spot-asset address. */
1189
+ asset: string;
1190
+ /** Amount in human units. Signed at the ERC-20's native decimals — the protocol's only non-e18 amount. */
1191
+ amount: DecimalLike;
1192
+ /**
1193
+ * Guard for the ERC-20's decimals. The exchange scales the signed amount
1194
+ * with its own asset metadata, so a value differing from the exchange's
1195
+ * is rejected client-side rather than producing a doomed signature.
1196
+ */
1197
+ decimals?: number;
1198
+ /** Fee cap in USD. Defaults to the standard withdrawal fee: 1 USD, or 10 USD with `forceBatch`. */
1199
+ maxFeeUsd?: DecimalLike;
1200
+ /**
1201
+ * Guard for the L1 payout address. The exchange always pays out to the
1202
+ * action signer, so any other value is rejected client-side.
1203
+ */
1204
+ recipient?: string;
1205
+ /** Pay the higher fee to have the batch proven immediately. */
1206
+ forceBatch?: boolean;
1207
+ nonce?: string;
1208
+ signatureExpirySec?: number;
1209
+ }
1210
+ /**
1211
+ * Withdrawals to L1 (`private/withdraw`).
1212
+ *
1213
+ * The exchange reconstructs the signed payload with the payout recipient
1214
+ * fixed to the action signer's address — withdrawals always pay out to
1215
+ * the key that signs them. NOTE: when a session key signs, funds go to
1216
+ * the session key's address, not the owner's.
1217
+ */
1218
+ declare class WithdrawalsApi {
1219
+ private readonly ctx;
1220
+ constructor(ctx: ClientContext);
1221
+ /** Builds the signed wire payload shared by `withdraw` and `withdrawDebug`. */
1222
+ private buildWithdrawPayload;
1223
+ withdraw(params: WithdrawParams): Promise<PrivateWithdrawEdgeRpcResponse>;
1224
+ /**
1225
+ * Debug helper: signs the withdrawal exactly like `withdraw` but submits it
1226
+ * to `public/withdraw_debug`, which returns the server-computed encoded data
1227
+ * and action/typed-data hashes instead of executing. Use it to verify your
1228
+ * client-side signing matches the exchange's.
1229
+ */
1230
+ withdrawDebug(params: WithdrawParams): Promise<unknown>;
1231
+ /**
1232
+ * Withdrawal history rows (up to 1000). Scoped to one subaccount when
1233
+ * `subaccountId` is given, otherwise to the whole owner wallet.
1234
+ * Timestamps are unix milliseconds.
1235
+ */
1236
+ getHistory(options?: {
1237
+ subaccountId?: number;
1238
+ startTimestampMs?: number;
1239
+ endTimestampMs?: number;
1240
+ }): Promise<WithdrawalHistoryResult>;
1241
+ }
1242
+
1243
+ /**
1244
+ * A concrete channel name carrying its notification payload type as a
1245
+ * phantom parameter, so `Subscriptions.subscribe`/`stream` can type the
1246
+ * data without the caller restating it.
1247
+ */
1248
+ interface TypedChannel<Data> {
1249
+ name: string;
1250
+ /** Phantom type marker — never present at runtime. */
1251
+ readonly __data?: Data;
1252
+ }
1253
+ /**
1254
+ * Builds a concrete channel name from a template in the generated
1255
+ * `ChannelSchemaMap`, e.g.
1256
+ * `channel('orderbook.{instrument_name}.{group}.{depth}', { instrument_name: 'ETH-PERP', group: '1', depth: '10' })`
1257
+ * → `orderbook.ETH-PERP.1.10`. Channel address params are always
1258
+ * strings on the wire, so values are stringified even when numeric.
1259
+ * Missing, empty, and unknown params are rejected.
1260
+ */
1261
+ declare function channel<T extends ChannelTemplate>(template: T, params: ChannelParamsOf<ChannelSchemaMap[T]>): TypedChannel<ChannelDataOf<ChannelSchemaMap[T]>>;
1262
+
1263
+ /** A live channel subscription; `unsubscribe` is idempotent. */
1264
+ interface Subscription {
1265
+ channel: string;
1266
+ unsubscribe(): Promise<void>;
1267
+ }
1268
+ /**
1269
+ * Pub/sub over the websocket transport. Owns notification routing:
1270
+ * every `subscription` message the transport receives is dispatched to
1271
+ * the handlers registered for its channel. The exchange keys
1272
+ * subscriptions to the connection, so the client calls `resubscribeAll`
1273
+ * from its reconnect hook to restore them on a fresh socket.
1274
+ */
1275
+ declare class Subscriptions {
1276
+ private readonly ctx;
1277
+ private readonly ws;
1278
+ private readonly handlers;
1279
+ constructor(ctx: ClientContext, ws: WsTransport);
1280
+ /**
1281
+ * Subscribes to a channel and registers `handler` for its
1282
+ * notifications. Multiple handlers share one wire subscription per
1283
+ * channel: the `subscribe` RPC is sent only for the first handler on a
1284
+ * channel, and `unsubscribe` only when the last is removed.
1285
+ */
1286
+ subscribe<D>(ch: TypedChannel<D>, handler: (data: D) => void): Promise<Subscription>;
1287
+ /**
1288
+ * The channel as an async iterator: subscribes on the first `next()`,
1289
+ * buffers notifications the consumer has not yet read (dropping the
1290
+ * oldest beyond `STREAM_BUFFER_LIMIT`), and unsubscribes when the
1291
+ * loop ends (`break` / `return()` / `throw()`).
1292
+ */
1293
+ stream<D>(ch: TypedChannel<D>): AsyncIterableIterator<D>;
1294
+ /** Re-sends `subscribe` for every active channel; the client calls this after a websocket reconnect. */
1295
+ resubscribeAll(): Promise<void>;
1296
+ /**
1297
+ * `subscribe`/`unsubscribe` exist only over the websocket, so they go
1298
+ * straight to the ws transport (never the client's HTTP fallback). A
1299
+ * per-channel `status` other than 'ok'/'already subscribed' throws.
1300
+ */
1301
+ private sendChannelRpc;
1302
+ private dispatch;
1303
+ }
1304
+
1305
+ interface HttpTransportOptions {
1306
+ baseUrl: string;
1307
+ timeoutMs: number;
1308
+ logger: Logger;
1309
+ /** Produces auth headers for private methods; absent for public-only clients. */
1310
+ authHeaders?: () => Promise<Record<string, string>>;
1311
+ }
1312
+ /**
1313
+ * REST transport: each method is POSTed to `<baseUrl>/<method>` with the
1314
+ * params object as the JSON body; the response body is the JSON-RPC
1315
+ * response envelope. Private methods carry signed auth headers.
1316
+ */
1317
+ declare class HttpTransport {
1318
+ private readonly options;
1319
+ constructor(options: HttpTransportOptions);
1320
+ send<M extends RpcMethod>(method: M, params: ParamsOf<M>): Promise<ResultFor<M>>;
1321
+ }
1322
+
1323
+ declare class DeriveClient {
1324
+ readonly network: NetworkConfig;
1325
+ readonly ws: WsTransport;
1326
+ readonly http: HttpTransport;
1327
+ readonly marketData: MarketDataApi;
1328
+ readonly subaccounts: SubaccountsApi;
1329
+ readonly orders: OrdersApi;
1330
+ readonly rfq: RfqApi;
1331
+ readonly spotTransfers: SpotTransfersApi;
1332
+ readonly positionTransfers: PositionTransfersApi;
1333
+ readonly withdrawals: WithdrawalsApi;
1334
+ readonly deposits: DepositsApi;
1335
+ readonly vaults: VaultsApi;
1336
+ readonly sessionKeys: SessionKeysApi;
1337
+ readonly subscriptions: Subscriptions;
1338
+ readonly logger: Logger;
1339
+ private readonly owner?;
1340
+ private readonly sessionKey?;
1341
+ private readonly accountOwner?;
1342
+ private loggedIn;
1343
+ constructor(options: DeriveClientOptions);
1344
+ /**
1345
+ * The identity requests act as: the owner address plus whichever
1346
+ * wallet signs (session key when configured, otherwise the owner).
1347
+ */
1348
+ credentials(): AuthCredentials;
1349
+ /** Opens the websocket. REST-only usage can skip this. */
1350
+ connect(): Promise<void>;
1351
+ /**
1352
+ * Authenticates the websocket connection (REST requests instead carry
1353
+ * signed headers per request). Re-runs automatically after reconnects.
1354
+ */
1355
+ login(): Promise<ResultFor<'public/login'>>;
1356
+ close(): Promise<void>;
1357
+ /**
1358
+ * Typed escape hatch for any public RPC method: uses the websocket
1359
+ * when connected, REST otherwise.
1360
+ */
1361
+ send<M extends RpcMethod>(method: M, params: ParamsOf<M>): Promise<ResultFor<M>>;
1362
+ }
1363
+
1364
+ /**
1365
+ * Network presets for the v3 API. chainId + contracts.matching are the
1366
+ * inputs to the computed EIP-712 domain separator; the values here
1367
+ * reproduce the separators the deployed contracts accept (unit-tested in
1368
+ * test/unit/eip712.test.ts).
1369
+ *
1370
+ * The EIP-712 domain separator is computed from `chainId` and the
1371
+ * constant Matching verifying contract (signing/eip712.ts).
1372
+ */
1373
+ declare const NETWORKS: Record<NetworkName, NetworkConfig>;
1374
+ declare function resolveNetwork(network: NetworkName | NetworkConfig): NetworkConfig;
1375
+
1376
+ /** An error response returned by the exchange for a JSON-RPC request. */
1377
+ declare class DeriveRpcError extends Error {
1378
+ readonly code: number;
1379
+ readonly data: unknown;
1380
+ readonly method: string;
1381
+ constructor(method: string, error: {
1382
+ code: number;
1383
+ message: string;
1384
+ data?: unknown;
1385
+ });
1386
+ }
1387
+ /** A request that received no response within the transport timeout, or was in flight when the connection dropped. */
1388
+ declare class DeriveTimeoutError extends Error {
1389
+ constructor(message: string);
1390
+ }
1391
+ /** A websocket connection failure (initial connect or reconnect exhaustion). */
1392
+ declare class DeriveConnectionError extends Error {
1393
+ constructor(message: string, options?: {
1394
+ cause?: unknown;
1395
+ });
1396
+ }
1397
+
1398
+ interface ActionFields {
1399
+ subaccountId: number | bigint;
1400
+ /** UTC-nanosecond timestamp as a decimal string; see `randomNonce()`. */
1401
+ nonce: string;
1402
+ /** Address of the protocol module that verifies this action. */
1403
+ module: string;
1404
+ /** ABI-encoded action payload produced by one of the codecs. */
1405
+ data: string;
1406
+ /** Unix-seconds signature expiry. */
1407
+ expirySec: number;
1408
+ owner: string;
1409
+ signer: string;
1410
+ }
1411
+ /**
1412
+ * The signed-action envelope shared by every protocol operation
1413
+ * (orders, transfers, withdrawals, RFQs, session keys, vault actions).
1414
+ *
1415
+ * The digest is
1416
+ * keccak256(0x1901 ‖ domainSeparator ‖ structHash) where structHash
1417
+ * commits to ACTION_TYPEHASH, the envelope fields, and keccak256(data).
1418
+ * The domain separator comes from `domainSeparator(network)`.
1419
+ */
1420
+ declare class SignedAction {
1421
+ readonly fields: Readonly<ActionFields>;
1422
+ private readonly domainSeparator;
1423
+ signature?: string;
1424
+ constructor(fields: ActionFields, domainSeparator: string);
1425
+ actionHash(): string;
1426
+ digest(): string;
1427
+ /**
1428
+ * Signs the digest with a raw signing key. The wallet must be the
1429
+ * declared `signer` (the owner itself, or a registered session key).
1430
+ */
1431
+ sign(wallet: BaseWallet): this;
1432
+ }
1433
+
1434
+ /**
1435
+ * keccak256("Action(uint256 subaccountId,uint256 nonce,address module,bytes data,uint256 expiry,address owner,address signer)").
1436
+ * Chain-independent protocol constant.
1437
+ */
1438
+ declare const ACTION_TYPEHASH = "0x4d7a9f27c403ff9c0f19bce61d76d82f9aa29f8d6d4b0c5474607d9770d1af17";
1439
+ /**
1440
+ * The EIP-712 domain separator actions sign under — a standard 4-field
1441
+ * `EIP712Domain` (name "Matching", version "1.0", no salt) computed from
1442
+ * the network's chain id and the constant Matching verifying contract.
1443
+ */
1444
+ declare function domainSeparator(network: Pick<NetworkConfig, 'chainId'>): string;
1445
+
1446
+ /**
1447
+ * Canonical EIP-712 action module addresses. Every signed action's
1448
+ * `module` field commits to one of these — the same set on every
1449
+ * network (mainnet, testnet, local).
1450
+ */
1451
+ declare const V3_MODULE_ADDRESSES: {
1452
+ readonly trade: "0xB8D20c2B7a1Ad2EE33Bc50eF10876eD3035b5e7b";
1453
+ readonly transfer: "0x01259207A40925b794C8ac320456F7F6c8FE2636";
1454
+ readonly withdrawal: "0x9d0E8f5b25384C7310CB8C6aE32C8fbeb645d083";
1455
+ readonly rfq: "0x9371352CCef6f5b36EfDFE90942fFE622Ab77F1D";
1456
+ readonly externalTransfer: "0x8F9B8f12ddA05FB1F0DDDDe8f5af8cECF54f8aC9";
1457
+ readonly whitelistedRecipient: "0xB86D6DE1b76c9839e4BA860848CD98A1dABd6B54";
1458
+ readonly vault: "0x2885c174ebf5524aED9c721d60c12b1537685186";
1459
+ readonly liquidation: "0x66d23e59DaEEF13904eFA2D4B8658aeD05f59a92";
1460
+ readonly createSessionKey: "0xe330CF64ff6EbF41699aad344Cb21d78db1D2bb6";
1461
+ };
1462
+
1463
+ export { ACTION_TYPEHASH, type ActionFields, type AuthCredentials, type AuthSigner, type BurnVaultSharesRequest, ChannelSchemaMap, ChannelTemplate, type ClientContext, type ContractAddresses, ContractCallDeposits, type CreateSessionKeyParams, type CreateVaultRequest, CuratorVaultsApi, DecimalLike, DepositAddressDeposits, DepositsApi, DeriveClient, type DeriveClientOptions, DeriveConnectionError, DeriveRpcError, DeriveTimeoutError, type ExecuteQuoteParams, type ExternalSpotTransferParams, type InternalSpotTransferParams, type Logger, MarketDataApi, type MintVaultSharesRequest, type ModuleAddresses, NETWORKS, type NetworkConfig, type NetworkName, OffchainScope, OrdersApi, ParamsOf, type PlaceOrderParams, type PositionTransferLeg, PositionTransfersApi, type PricedRfqLeg, ProtocolScopeCode, ResultFor, RfqApi, type RfqLeg, RpcMethod, SDK_VERSION, type SendQuoteParams, SessionKeysApi, ShareholderVaultsApi, SignedAction, type SpotAssetInfo, SpotTransfersApi, SubaccountsApi, type Subscription, Subscriptions, type TransferPositionsParams, type TypedChannel, type UpdateVaultInfoRequest, V3_MODULE_ADDRESSES, type VaultCancelRequest, type VaultDepositRequest, type VaultWithdrawRequest, VaultsApi, type WebSocketFactory, type WebSocketLike, WithdrawalsApi, authHeaders, channel, domainSeparator, loginParams, resolveNetwork };