superstack-wallet-sdk 0.5.7 → 0.5.9

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.
@@ -3,7 +3,7 @@ import { WalletClient } from "./client";
3
3
  export type SupportedTransactionVersions = ReadonlySet<TransactionVersion> | null | undefined;
4
4
  export type TransactionOrVersionedTransaction<S extends SupportedTransactionVersions> = S extends null | undefined ? Transaction : Transaction | VersionedTransaction;
5
5
  export declare function isVersionedTransaction(transaction: Transaction | VersionedTransaction): transaction is VersionedTransaction;
6
- export type LoginType = "TwitterOAuth" | "GoogleOAuth" | "Phantom" | "Okx" | "Email" | "Phone" | "Telegram" | "TelegramOAuth" | "MetaMask" | "Rabby" | "Coinbase" | "WalletConnect";
6
+ export type LoginType = "Email" | "Phone" | "TwitterOAuth" | "GoogleOAuth" | "Telegram" | "TelegramOAuth" | "Apple" | "Phantom" | "Okx" | "MetaMask" | "Rabby" | "Coinbase" | "WalletConnect";
7
7
  export declare enum Network {
8
8
  Solana = "Solana",
9
9
  Ethereum = "Ethereum"
@@ -13,12 +13,10 @@ export declare enum WalletType {
13
13
  Embedded = "Embedded"
14
14
  }
15
15
  export declare enum SocialType {
16
- Email = "Email",
17
16
  Google = "Google",
18
17
  Twitter = "Twitter",
19
- Phantom = "Phantom",
20
- Phone = "Phone",
21
- Okx = "Okx"
18
+ Telegram = "Telegram",
19
+ Apple = "Apple"
22
20
  }
23
21
  export type Social = {
24
22
  [key in SocialType]: string;
@@ -39,36 +37,72 @@ export interface Wallet {
39
37
  address: string;
40
38
  network: Network;
41
39
  wallet_type: WalletType;
42
- wallet_set: "Main" | "Forward-0" | string;
40
+ wallet_set: "Main" | `Forward-${number}` | `Secondary-${number}` | `SecondaryForward-${number}-${number}`;
41
+ account_index: number;
42
+ is_enabled: boolean;
43
43
  }
44
44
  export interface WalletInfo {
45
- account_info: AccountInfo;
46
45
  id: string;
47
- is_exported: boolean;
48
46
  wallets: Wallet[];
49
47
  social_links: Social[];
50
48
  social_infos: SocialInfo[];
49
+ account_info: AccountInfo;
50
+ created_at: number;
51
+ is_exported: boolean;
51
52
  access_token?: string;
52
53
  }
54
+ export interface SubAccountInfo {
55
+ account_index: number;
56
+ secondary_index: number;
57
+ name?: string;
58
+ created_at: number;
59
+ is_exported: boolean;
60
+ is_enabled: boolean;
61
+ }
53
62
  export interface AccountInfo {
54
63
  name: string | null;
64
+ sub_accounts: SubAccountInfo[];
55
65
  }
66
+ export type MultiAccountRequest = {
67
+ type: "Create";
68
+ data: {
69
+ name?: string | null;
70
+ };
71
+ } | {
72
+ type: "Enable";
73
+ data: {
74
+ index: number;
75
+ };
76
+ } | {
77
+ type: "Disable";
78
+ data: {
79
+ index: number;
80
+ };
81
+ };
56
82
  export interface SignRequestV1 {
83
+ user_id: string;
84
+ network: string;
57
85
  address: string;
58
- userId: string;
59
86
  message: string;
60
- network: string;
61
- requestId: string;
62
87
  }
63
- export interface UnsignedTx {
88
+ export interface UnsignedTxV2 {
64
89
  Solana?: string;
65
90
  EthereumEip712?: Record<string, unknown>;
66
91
  }
67
92
  export interface SignRequestV2 {
93
+ user_id: string;
94
+ network: string;
68
95
  address: string;
96
+ tx: UnsignedTxV2;
97
+ }
98
+ export interface UnsignedTxV3 {
99
+ Solana?: string;
100
+ }
101
+ export interface SignRequestV3 {
69
102
  user_id: string;
70
103
  network: string;
71
- tx: UnsignedTx;
104
+ address: string;
105
+ tx: UnsignedTxV3;
72
106
  }
73
107
  export interface UserSession {
74
108
  id: string;
@@ -134,13 +168,13 @@ export interface OrderState {
134
168
  }
135
169
  export interface TransferRequest {
136
170
  user_id: string;
171
+ network: Network;
172
+ chain_id: number;
137
173
  from: string;
138
174
  to: string;
139
175
  amount: string;
140
176
  decimals: number;
141
177
  token?: string;
142
- network: Network;
143
- chain_id: number;
144
178
  }
145
179
  export declare enum VaultId {
146
180
  HyperbeatUltraHype = "HyperbeatUltraHype",
@@ -185,6 +219,8 @@ export interface DeBridgeDlnCreateTxRequest {
185
219
  srcChainPriorityLevel?: string | null;
186
220
  }
187
221
  export type BuildTransactionRequest = {
222
+ wallet_address?: string | null;
223
+ } & ({
188
224
  type: "HyperbeatVaultApprove";
189
225
  data: {
190
226
  vault_id: VaultId;
@@ -229,140 +265,245 @@ export type BuildTransactionRequest = {
229
265
  data: {
230
266
  request: DeBridgeDlnCreateTxRequest;
231
267
  };
232
- };
268
+ });
233
269
  export interface BuildTransactionResponse {
234
270
  raw_transaction: string;
235
271
  metadata?: any;
236
272
  }
237
- export type BigDecimalString = string;
238
- export declare enum BorrowedAsset {
239
- HypercorePerpsUSDC = "HypercorePerpsUSDC"
240
- }
241
- export declare enum CollateralAsset {
242
- HypercoreSpotBTC = "HypercoreSpotBTC"
243
- }
244
- export declare enum CrossMarginPositionStatus {
245
- Open = "Open",
246
- Closed = "Closed",
247
- PartiallyLiquidated = "PartiallyLiquidated",
248
- AllLiquidated = "AllLiquidated"
249
- }
250
- export declare enum CrossMarginOperationType {
251
- Borrow = "Borrow",
252
- Repay = "Repay",
253
- AddMargin = "AddMargin",
254
- RemoveMargin = "RemoveMargin",
255
- Liquidation = "Liquidation"
256
- }
257
- export interface CollateralAssetInfo {
258
- amount: BigDecimalString;
259
- contribution?: number;
260
- liquidation_price?: number;
261
- }
262
- export interface CrossMarginBorrowQuoteRequest {
263
- collateral_assets: Partial<Record<CollateralAsset, BigDecimalString>>;
264
- }
265
- export interface CrossMarginBorrowQuoteResponse {
266
- quote_id: string;
267
- collateral_asset_infos: Record<CollateralAsset, CollateralAssetInfo>;
268
- total_collateral_value: number;
269
- borrowed_asset: BorrowedAsset;
270
- max_borrowed_amount: BigDecimalString;
271
- max_borrowed_value: number;
272
- created_at: number;
273
+ export declare enum LighterOrderSide {
274
+ Buy = "buy",
275
+ Sell = "sell"
276
+ }
277
+ export declare enum LighterOrderType {
278
+ Limit = "limit",
279
+ Market = "market",
280
+ StopLoss = "stop_loss",
281
+ StopLossLimit = "stop_loss_limit",
282
+ TakeProfit = "take_profit",
283
+ TakeProfitLimit = "take_profit_limit",
284
+ Twap = "twap",
285
+ TwapSub = "twap_sub"
286
+ }
287
+ export declare enum LighterTimeInForce {
288
+ ImmediateOrCancel = "immediate_or_cancel",
289
+ GoodTillTime = "good_till_time",
290
+ PostOnly = "post_only"
291
+ }
292
+ export declare enum LighterMarginMode {
293
+ Cross = "cross",
294
+ Isolated = "isolated"
295
+ }
296
+ export declare enum LighterGroupingType {
297
+ Default = "default",
298
+ OneTriggersTheOther = "one_triggers_the_other",
299
+ OneCancelsTheOther = "one_cancels_the_other",
300
+ OneTriggersAOneCancelsTheOther = "one_triggers_a_one_cancels_the_other"
301
+ }
302
+ export interface LighterTxContext {
303
+ account_index: number;
304
+ from_account_index: number;
305
+ api_key_index: number;
306
+ expired_at: number;
307
+ nonce: number;
308
+ }
309
+ export interface LighterOrderParams {
310
+ account_index: number;
311
+ from_account_index: number;
312
+ api_key_index: number;
313
+ expired_at: number;
314
+ nonce: number;
315
+ market_index: number;
316
+ client_order_index?: number | null;
317
+ base_amount: number;
318
+ price?: number | null;
319
+ side: LighterOrderSide;
320
+ order_type: LighterOrderType;
321
+ time_in_force?: LighterTimeInForce | null;
322
+ reduce_only?: boolean;
323
+ trigger_price?: number | null;
324
+ order_expiry_ms?: number | null;
325
+ }
326
+ export interface LighterLeverageParams {
327
+ account_index: number;
328
+ from_account_index: number;
329
+ api_key_index: number;
330
+ expired_at: number;
331
+ nonce: number;
332
+ market_index: number;
333
+ leverage: number;
334
+ margin_mode: LighterMarginMode;
335
+ }
336
+ export interface LighterWithdrawParams {
337
+ account_index: number;
338
+ from_account_index: number;
339
+ api_key_index: number;
340
+ expired_at: number;
341
+ nonce: number;
342
+ usdc_amount: number;
343
+ }
344
+ export interface LighterCreateSubAccountParams {
345
+ account_index: number;
346
+ from_account_index: number;
347
+ api_key_index: number;
348
+ expired_at: number;
349
+ nonce: number;
350
+ }
351
+ export interface LighterGroupedOrderEntry {
352
+ market_index: number;
353
+ client_order_index?: number | null;
354
+ base_amount: number;
355
+ price?: number | null;
356
+ side: LighterOrderSide;
357
+ order_type: LighterOrderType;
358
+ time_in_force?: LighterTimeInForce | null;
359
+ reduce_only?: boolean;
360
+ trigger_price?: number | null;
361
+ order_expiry_ms?: number | null;
362
+ }
363
+ export interface LighterGroupedOrdersParams {
364
+ account_index: number;
365
+ from_account_index: number;
366
+ api_key_index: number;
367
+ expired_at: number;
368
+ nonce: number;
369
+ grouping_type: LighterGroupingType;
370
+ orders: LighterGroupedOrderEntry[];
371
+ }
372
+ export interface LighterGeneralTransferParams {
373
+ account_index: number;
374
+ from_account_index: number;
375
+ api_key_index: number;
376
+ expired_at: number;
377
+ nonce: number;
378
+ to_account_index: number;
379
+ usdc_amount: number;
380
+ fee?: number;
381
+ memo_hex?: string | null;
382
+ }
383
+ export interface LighterCancelOrderParams {
384
+ account_index: number;
385
+ from_account_index: number;
386
+ api_key_index: number;
387
+ expired_at: number;
388
+ nonce: number;
389
+ market_index: number;
390
+ index: number;
391
+ }
392
+ export interface LighterCancelAllOrdersParams {
393
+ account_index: number;
394
+ from_account_index: number;
395
+ api_key_index: number;
396
+ expired_at: number;
397
+ nonce: number;
398
+ time_in_force: LighterTimeInForce;
399
+ time: number;
400
+ }
401
+ export type LighterBuildTransactionRequest = {
402
+ wallet_address?: string | null;
403
+ } & ({
404
+ type: "Order";
405
+ data: LighterOrderParams;
406
+ } | {
407
+ type: "UpdateLeverage";
408
+ data: LighterLeverageParams;
409
+ } | {
410
+ type: "Withdraw";
411
+ data: LighterWithdrawParams;
412
+ } | {
413
+ type: "CreateSubAccount";
414
+ data: LighterCreateSubAccountParams;
415
+ } | {
416
+ type: "Transfer";
417
+ data: LighterGeneralTransferParams;
418
+ } | {
419
+ type: "GroupedOrders";
420
+ data: LighterGroupedOrdersParams;
421
+ } | {
422
+ type: "CancelOrder";
423
+ data: LighterCancelOrderParams;
424
+ } | {
425
+ type: "CancelAllOrders";
426
+ data: LighterCancelAllOrdersParams;
427
+ });
428
+ export interface LighterBuildTransactionResponse {
429
+ tx_type: number;
430
+ tx_info: string;
431
+ tx_hash?: string | null;
432
+ hash: string;
433
+ }
434
+ export interface LighterAuthRequest {
435
+ wallet_address?: string | null;
436
+ expires_in_ms?: number | null;
437
+ account_index: number;
438
+ }
439
+ export interface LighterAuthResponse {
440
+ auth: string;
273
441
  expires_at: number;
274
442
  }
275
- export interface CrossMarginBorrowRequest {
443
+ export interface LighterChangeKeyRequest {
444
+ wallet_address?: string | null;
445
+ account_index: number;
446
+ }
447
+ export interface LighterChangeKeyResponse {
448
+ account_index: number;
449
+ public_key: string;
450
+ }
451
+ export interface ExchangeSignature {
452
+ r: string;
453
+ s: string;
454
+ v: number;
455
+ }
456
+ export interface ExchangePayload {
457
+ action: any;
458
+ nonce: number;
459
+ signature: ExchangeSignature;
460
+ vaultAddress?: string | null;
461
+ expiresAfter?: number | null;
462
+ }
463
+ export interface ExchangeResponse {
464
+ payload: ExchangePayload;
465
+ }
466
+ export interface ExchangeRequest {
467
+ action: any;
468
+ vaultAddress?: string | null;
469
+ expiresAfter?: number | null;
470
+ isMainnet?: boolean | null;
471
+ walletAddress?: string | null;
472
+ }
473
+ export interface ExportInitRequest {
474
+ user_nonce: string;
475
+ account_index?: number;
476
+ }
477
+ export interface ExportInitResponse {
478
+ server_nonce: string;
479
+ }
480
+ export interface ExportFinishRequest {
481
+ user_nonce?: string;
482
+ server_nonce?: string;
483
+ account_index?: number;
484
+ is_export: boolean;
485
+ }
486
+ export interface ExportWallet {
276
487
  network: Network;
488
+ wallet_set: string;
277
489
  address: string;
278
- quote_id: string;
279
- collateral_assets: Partial<Record<CollateralAsset, BigDecimalString>>;
280
- borrowed_asset: BorrowedAsset;
281
- borrowed_amount: BigDecimalString;
282
- }
283
- export interface CrossMarginBorrowResponse {
284
- position_id: string;
285
- }
286
- export interface CrossMarginRepayQuoteRequest {
287
- position_id: string;
288
- }
289
- export interface CrossMarginRepayQuoteResponse {
290
- quote_id: string;
291
- repay_asset: BorrowedAsset;
292
- borrowed_amount: BigDecimalString;
293
- interest_cost: BigDecimalString;
294
- repay_amount: BigDecimalString;
295
- created_at: number;
296
- expires_at: number;
490
+ private_key: string;
297
491
  }
298
- export interface CrossMarginRepayRequest {
299
- position_id: string;
300
- quote_id: string;
301
- repay_asset: BorrowedAsset;
302
- repay_amount: BigDecimalString;
303
- }
304
- export interface CrossMarginRepayResponse {
305
- position_id: string;
306
- }
307
- export interface CrossMarginAdjustMarginRequest {
308
- position_id: string;
309
- is_add_margin: boolean;
310
- collateral_assets: Partial<Record<CollateralAsset, BigDecimalString>>;
311
- }
312
- export interface CrossMarginAdjustMarginResponse {
313
- position_id: string;
314
- }
315
- export interface BorrowedAssetGeneralInfo {
316
- interest_rate_hourly: number;
317
- interest_rate_annual: number;
318
- available_amount: number;
319
- max_borrowable_amount: number;
320
- }
321
- export interface CollateralAssetGeneralInfo {
322
- liquidation_threshold: number;
323
- h_vol: number;
324
- price: number;
325
- }
326
- export interface CrossMarginGeneralInfoResponse {
327
- collateral_info: Record<CollateralAsset, CollateralAssetGeneralInfo>;
328
- borrowed_info: Record<BorrowedAsset, BorrowedAssetGeneralInfo>;
329
- }
330
- export interface UserOpenPositionInfo {
331
- position_id: string;
332
- collateral_assets: Record<CollateralAsset, CollateralAssetInfo>;
333
- borrowed_asset: BorrowedAsset;
334
- borrowed_amount: BigDecimalString;
335
- created_at: number;
336
- updated_at: number;
337
- current_ltv: number;
338
- margin_call_ltv: number;
339
- liquidation_ltv: number;
340
- interest_cost: number;
341
- }
342
- export interface UserOpenPositionsResponse {
343
- positions: UserOpenPositionInfo[];
344
- }
345
- export interface UserClosedPositionInfo {
346
- position_id: string;
347
- collateral_assets: Record<CollateralAsset, CollateralAssetInfo>;
348
- borrowed_asset: BorrowedAsset;
349
- borrowed_amount: BigDecimalString;
350
- created_at: number;
351
- closed_at: number;
352
- interest_cost: number;
353
- status: CrossMarginPositionStatus;
354
- repaid_amount?: number;
355
- }
356
- export interface UserOperationInfo {
357
- position_id: string;
358
- operation_id: string;
359
- created_at: number;
360
- finished_at: number;
361
- operation_type: CrossMarginOperationType;
362
- amount: BigDecimalString;
363
- symbol: string;
364
- }
365
- export interface UserHistoryResponse {
366
- positions: UserClosedPositionInfo[];
367
- operations: UserOperationInfo[];
492
+ export interface ExportWalletResponse {
493
+ user_id: string;
494
+ wallets: ExportWallet[];
495
+ }
496
+ export interface CloseInitRequest {
497
+ user_nonce: string;
498
+ }
499
+ export interface CloseInitResponse {
500
+ server_nonce: string;
501
+ }
502
+ export interface CloseFinishRequest {
503
+ user_nonce: string;
504
+ server_nonce: string;
505
+ }
506
+ export interface CloseFinishResponse {
507
+ user_id: string;
508
+ is_closed: boolean;
368
509
  }