@switch-win/sdk 1.2.1 → 1.2.3
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/LIMIT-ORDERS.md +737 -0
- package/README.md +91 -83
- package/ROBINHOOD.md +676 -580
- package/package.json +3 -2
- package/src/index.ts +41 -29
- package/src/limit-orders.ts +193 -47
- package/src/networks/index.ts +19 -18
- package/src/networks/robinhood.ts +355 -292
- package/src/types.ts +33 -11
package/src/types.ts
CHANGED
|
@@ -312,18 +312,24 @@ export interface LimitOrderParams {
|
|
|
312
312
|
* A signed limit order — the order parameters plus the EIP-712 signature.
|
|
313
313
|
* This is what gets submitted to the Switch backend via `POST /limit-orders`.
|
|
314
314
|
*/
|
|
315
|
-
export interface SignedLimitOrder extends LimitOrderParams {
|
|
316
|
-
/** EIP-712 signature of the order struct, produced by the maker's wallet */
|
|
317
|
-
signature: string;
|
|
318
|
-
|
|
315
|
+
export interface SignedLimitOrder extends LimitOrderParams {
|
|
316
|
+
/** EIP-712 signature of the order struct, produced by the maker's wallet */
|
|
317
|
+
signature: string;
|
|
318
|
+
/**
|
|
319
|
+
* SwitchLimitOrder deployment used in the EIP-712 domain.
|
|
320
|
+
* Include this when submitting Robinhood orders or orders signed against an
|
|
321
|
+
* older supported deployment so the backend verifies the correct domain.
|
|
322
|
+
*/
|
|
323
|
+
limitOrderContract?: string;
|
|
324
|
+
}
|
|
319
325
|
|
|
320
326
|
// -- API request/response types --
|
|
321
327
|
|
|
322
328
|
/** Body for `POST /limit-orders` */
|
|
323
329
|
export type CreateLimitOrderRequest = SignedLimitOrder;
|
|
324
330
|
|
|
325
|
-
/**
|
|
326
|
-
export interface CancelLimitOrderRequest {
|
|
331
|
+
/** @deprecated Current hosted API cancellation is on-chain only. */
|
|
332
|
+
export interface CancelLimitOrderRequest {
|
|
327
333
|
/** Maker address */
|
|
328
334
|
maker: string;
|
|
329
335
|
/** Nonce of the order to cancel */
|
|
@@ -359,7 +365,7 @@ export interface LimitOrderRecord {
|
|
|
359
365
|
nonce: number;
|
|
360
366
|
/** Fee mode flag */
|
|
361
367
|
feeOnOutput: boolean;
|
|
362
|
-
/** Unwrap output to
|
|
368
|
+
/** Unwrap wrapped-native output to PLS/ETH on the selected network */
|
|
363
369
|
unwrapOutput: boolean;
|
|
364
370
|
/** Partner address for fee sharing */
|
|
365
371
|
partnerAddress: string;
|
|
@@ -399,8 +405,8 @@ export interface CreateLimitOrderResponse {
|
|
|
399
405
|
order: LimitOrderRecord;
|
|
400
406
|
}
|
|
401
407
|
|
|
402
|
-
/**
|
|
403
|
-
export interface CancelLimitOrderResponse {
|
|
408
|
+
/** @deprecated Current hosted API cancellation is on-chain only. */
|
|
409
|
+
export interface CancelLimitOrderResponse {
|
|
404
410
|
success: true;
|
|
405
411
|
}
|
|
406
412
|
|
|
@@ -429,13 +435,29 @@ export interface LimitOrderPair {
|
|
|
429
435
|
}
|
|
430
436
|
|
|
431
437
|
/** Response from `GET /limit-orders/stats` */
|
|
432
|
-
export interface LimitOrderStats {
|
|
438
|
+
export interface LimitOrderStats {
|
|
433
439
|
active: number;
|
|
434
440
|
filled: number;
|
|
435
441
|
cancelled: number;
|
|
436
442
|
expired: number;
|
|
437
443
|
total: number;
|
|
438
|
-
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/** Response from `GET /limit-orders/config`. */
|
|
447
|
+
export interface LimitOrderConfigResponse {
|
|
448
|
+
limitOrderContract: string;
|
|
449
|
+
allLimitOrderContracts: string[];
|
|
450
|
+
plsFlowContract: string | null;
|
|
451
|
+
allPlsFlowContracts: string[];
|
|
452
|
+
limitOrderContractVersions: Record<string, string>;
|
|
453
|
+
plsFlowContractVersions: Record<string, string>;
|
|
454
|
+
eip712Domain: {
|
|
455
|
+
name: "SwitchLimitOrder";
|
|
456
|
+
version: "2";
|
|
457
|
+
chainId: number;
|
|
458
|
+
verifyingContract: string;
|
|
459
|
+
};
|
|
460
|
+
}
|
|
439
461
|
|
|
440
462
|
/** Union type for limit order mutation responses */
|
|
441
463
|
export type LimitOrderMutationResponse =
|