@switch-win/sdk 1.2.2 → 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 +15 -8
- package/ROBINHOOD.md +111 -47
- package/package.json +3 -2
- package/src/index.ts +25 -13
- package/src/limit-orders.ts +135 -19
- package/src/networks/index.ts +3 -2
- package/src/networks/robinhood.ts +66 -15
- package/src/types.ts +33 -11
|
@@ -163,13 +163,49 @@ export const ROBINHOOD_TOKENS = {
|
|
|
163
163
|
name: "4663",
|
|
164
164
|
decimals: 18,
|
|
165
165
|
},
|
|
166
|
-
MARIAN: {
|
|
166
|
+
MARIAN: {
|
|
167
167
|
address: "0x01637b14B7378B99dE75A64d50656d98488D9a4d",
|
|
168
168
|
symbol: "MARIAN",
|
|
169
169
|
name: "Lady Marian",
|
|
170
|
-
decimals: 18,
|
|
171
|
-
},
|
|
172
|
-
|
|
170
|
+
decimals: 18,
|
|
171
|
+
},
|
|
172
|
+
INDEX: {
|
|
173
|
+
address: "0x56910D4409F3a0C78C64DD8D0545FF0705389870",
|
|
174
|
+
symbol: "Index",
|
|
175
|
+
name: "The Index",
|
|
176
|
+
decimals: 18,
|
|
177
|
+
},
|
|
178
|
+
VEX: {
|
|
179
|
+
address: "0x8Ff92566f2e81BDd68EDfAa8cde73942A723796b",
|
|
180
|
+
symbol: "VEX",
|
|
181
|
+
name: "ProjectVex",
|
|
182
|
+
decimals: 18,
|
|
183
|
+
},
|
|
184
|
+
HOODIE: {
|
|
185
|
+
address: "0xC72c01AAB5f5678dc1d6f5C6d2B417d91D402Ba3",
|
|
186
|
+
symbol: "HOODIE",
|
|
187
|
+
name: "HOODIE",
|
|
188
|
+
decimals: 18,
|
|
189
|
+
},
|
|
190
|
+
WISHBONE: {
|
|
191
|
+
address: "0x77581054581B9c525E7dd7a0155DE43867532d03",
|
|
192
|
+
symbol: "WISHBONE",
|
|
193
|
+
name: "WISHBONE",
|
|
194
|
+
decimals: 18,
|
|
195
|
+
},
|
|
196
|
+
VLAD: {
|
|
197
|
+
address: "0x31BE8f7485e36928C9De86566c62da82d4B6BF81",
|
|
198
|
+
symbol: "VLAD",
|
|
199
|
+
name: "The Green Bull",
|
|
200
|
+
decimals: 18,
|
|
201
|
+
},
|
|
202
|
+
AEON: {
|
|
203
|
+
address: "0xd4c93eD1843606f92CccA078941f3d52A585982f",
|
|
204
|
+
symbol: "AEON",
|
|
205
|
+
name: "Aeon",
|
|
206
|
+
decimals: 18,
|
|
207
|
+
},
|
|
208
|
+
} as const satisfies Readonly<Record<string, RobinhoodToken>>;
|
|
173
209
|
|
|
174
210
|
/** Exact ERC-20 ordering used by the Switch Robinhood token dropdown. */
|
|
175
211
|
export const ROBINHOOD_FRONTEND_TOKEN_LIST = [
|
|
@@ -187,8 +223,14 @@ export const ROBINHOOD_FRONTEND_TOKEN_LIST = [
|
|
|
187
223
|
ROBINHOOD_TOKENS.REPE,
|
|
188
224
|
ROBINHOOD_TOKENS.TENDIES,
|
|
189
225
|
ROBINHOOD_TOKENS.GME,
|
|
190
|
-
ROBINHOOD_TOKENS.TOKEN_4663,
|
|
191
|
-
ROBINHOOD_TOKENS.MARIAN,
|
|
226
|
+
ROBINHOOD_TOKENS.TOKEN_4663,
|
|
227
|
+
ROBINHOOD_TOKENS.MARIAN,
|
|
228
|
+
ROBINHOOD_TOKENS.INDEX,
|
|
229
|
+
ROBINHOOD_TOKENS.VEX,
|
|
230
|
+
ROBINHOOD_TOKENS.HOODIE,
|
|
231
|
+
ROBINHOOD_TOKENS.WISHBONE,
|
|
232
|
+
ROBINHOOD_TOKENS.VLAD,
|
|
233
|
+
ROBINHOOD_TOKENS.AEON,
|
|
192
234
|
] as const satisfies readonly RobinhoodToken[];
|
|
193
235
|
|
|
194
236
|
/**
|
|
@@ -204,24 +246,33 @@ export const ROBINHOOD_FRONTEND_DEFAULT_TOKENS = [
|
|
|
204
246
|
name: "Ether",
|
|
205
247
|
decimals: 18,
|
|
206
248
|
},
|
|
207
|
-
ROBINHOOD_TOKENS.WETH,
|
|
208
|
-
ROBINHOOD_TOKENS.USDG,
|
|
249
|
+
ROBINHOOD_TOKENS.WETH,
|
|
250
|
+
ROBINHOOD_TOKENS.USDG,
|
|
251
|
+
ROBINHOOD_TOKENS.VIRTUAL,
|
|
252
|
+
ROBINHOOD_TOKENS.CASHCAT,
|
|
253
|
+
ROBINHOOD_TOKENS.INDEX,
|
|
209
254
|
] as const satisfies readonly RobinhoodToken[];
|
|
210
255
|
|
|
211
256
|
/**
|
|
212
257
|
* Production trusted-hop addresses, ordered by routing usefulness.
|
|
213
258
|
*
|
|
214
|
-
* The 2026-07-
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
259
|
+
* The 2026-07-16 audit combined Dexscreener pool connectivity with Switch tax
|
|
260
|
+
* simulation, then required multiple meaningful liquidity corridors. VEX is
|
|
261
|
+
* selectable but excluded because it is taxed; INDEX is excluded because its
|
|
262
|
+
* dominant liquidity currently depends on unsupported V4 hooks. Keep this
|
|
263
|
+
* list synchronized with the Robinhood backend and operator bot.
|
|
218
264
|
*/
|
|
219
265
|
export const ROBINHOOD_TRUSTED_INTERMEDIATES = [
|
|
220
266
|
ROBINHOOD_TOKENS.WETH.address,
|
|
221
267
|
ROBINHOOD_TOKENS.USDG.address,
|
|
222
|
-
ROBINHOOD_TOKENS.VIRTUAL.address,
|
|
223
|
-
ROBINHOOD_TOKENS.CASHCAT.address,
|
|
224
|
-
|
|
268
|
+
ROBINHOOD_TOKENS.VIRTUAL.address,
|
|
269
|
+
ROBINHOOD_TOKENS.CASHCAT.address,
|
|
270
|
+
ROBINHOOD_TOKENS.HOODRAT.address,
|
|
271
|
+
ROBINHOOD_TOKENS.TENDIES.address,
|
|
272
|
+
ROBINHOOD_TOKENS.JUGGERNAUT.address,
|
|
273
|
+
ROBINHOOD_TOKENS.MARIAN.address,
|
|
274
|
+
ROBINHOOD_TOKENS.WALLET.address,
|
|
275
|
+
] as const;
|
|
225
276
|
|
|
226
277
|
/** Preferred Robinhood fee tokens, from highest to lowest priority. */
|
|
227
278
|
export const ROBINHOOD_FEE_TOKEN_PRIORITY = [
|
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 =
|