superstack-wallet-sdk 0.5.8 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -223,6 +223,8 @@ interface DeBridgeDlnCreateTxRequest {
223
223
  srcChainPriorityLevel?: string | null;
224
224
  }
225
225
  type BuildTransactionRequest = {
226
+ wallet_address?: string | null;
227
+ } & ({
226
228
  type: "HyperbeatVaultApprove";
227
229
  data: {
228
230
  vault_id: VaultId;
@@ -267,11 +269,248 @@ type BuildTransactionRequest = {
267
269
  data: {
268
270
  request: DeBridgeDlnCreateTxRequest;
269
271
  };
270
- };
272
+ });
271
273
  interface BuildTransactionResponse {
272
274
  raw_transaction: string;
273
275
  metadata?: any;
274
276
  }
277
+ declare enum LighterOrderSide {
278
+ Buy = "buy",
279
+ Sell = "sell"
280
+ }
281
+ declare enum LighterOrderType {
282
+ Limit = "limit",
283
+ Market = "market",
284
+ StopLoss = "stop_loss",
285
+ StopLossLimit = "stop_loss_limit",
286
+ TakeProfit = "take_profit",
287
+ TakeProfitLimit = "take_profit_limit",
288
+ Twap = "twap",
289
+ TwapSub = "twap_sub"
290
+ }
291
+ declare enum LighterTimeInForce {
292
+ ImmediateOrCancel = "immediate_or_cancel",
293
+ GoodTillTime = "good_till_time",
294
+ PostOnly = "post_only"
295
+ }
296
+ declare enum LighterMarginMode {
297
+ Cross = "cross",
298
+ Isolated = "isolated"
299
+ }
300
+ declare enum LighterGroupingType {
301
+ Default = "default",
302
+ OneTriggersTheOther = "one_triggers_the_other",
303
+ OneCancelsTheOther = "one_cancels_the_other",
304
+ OneTriggersAOneCancelsTheOther = "one_triggers_a_one_cancels_the_other"
305
+ }
306
+ interface LighterTxContext {
307
+ account_index: number;
308
+ from_account_index: number;
309
+ api_key_index: number;
310
+ expired_at: number;
311
+ nonce: number;
312
+ }
313
+ interface LighterOrderParams {
314
+ account_index: number;
315
+ from_account_index: number;
316
+ api_key_index: number;
317
+ expired_at: number;
318
+ nonce: number;
319
+ market_index: number;
320
+ client_order_index?: number | null;
321
+ base_amount: number;
322
+ price?: number | null;
323
+ side: LighterOrderSide;
324
+ order_type: LighterOrderType;
325
+ time_in_force?: LighterTimeInForce | null;
326
+ reduce_only?: boolean;
327
+ trigger_price?: number | null;
328
+ order_expiry_ms?: number | null;
329
+ }
330
+ interface LighterLeverageParams {
331
+ account_index: number;
332
+ from_account_index: number;
333
+ api_key_index: number;
334
+ expired_at: number;
335
+ nonce: number;
336
+ market_index: number;
337
+ leverage: number;
338
+ margin_mode: LighterMarginMode;
339
+ }
340
+ interface LighterWithdrawParams {
341
+ account_index: number;
342
+ from_account_index: number;
343
+ api_key_index: number;
344
+ expired_at: number;
345
+ nonce: number;
346
+ usdc_amount: number;
347
+ }
348
+ interface LighterCreateSubAccountParams {
349
+ account_index: number;
350
+ from_account_index: number;
351
+ api_key_index: number;
352
+ expired_at: number;
353
+ nonce: number;
354
+ }
355
+ interface LighterGroupedOrderEntry {
356
+ market_index: number;
357
+ client_order_index?: number | null;
358
+ base_amount: number;
359
+ price?: number | null;
360
+ side: LighterOrderSide;
361
+ order_type: LighterOrderType;
362
+ time_in_force?: LighterTimeInForce | null;
363
+ reduce_only?: boolean;
364
+ trigger_price?: number | null;
365
+ order_expiry_ms?: number | null;
366
+ }
367
+ interface LighterGroupedOrdersParams {
368
+ account_index: number;
369
+ from_account_index: number;
370
+ api_key_index: number;
371
+ expired_at: number;
372
+ nonce: number;
373
+ grouping_type: LighterGroupingType;
374
+ orders: LighterGroupedOrderEntry[];
375
+ }
376
+ interface LighterGeneralTransferParams {
377
+ account_index: number;
378
+ from_account_index: number;
379
+ api_key_index: number;
380
+ expired_at: number;
381
+ nonce: number;
382
+ to_account_index: number;
383
+ usdc_amount: number;
384
+ fee?: number;
385
+ memo_hex?: string | null;
386
+ }
387
+ interface LighterCancelOrderParams {
388
+ account_index: number;
389
+ from_account_index: number;
390
+ api_key_index: number;
391
+ expired_at: number;
392
+ nonce: number;
393
+ market_index: number;
394
+ index: number;
395
+ }
396
+ interface LighterCancelAllOrdersParams {
397
+ account_index: number;
398
+ from_account_index: number;
399
+ api_key_index: number;
400
+ expired_at: number;
401
+ nonce: number;
402
+ time_in_force: LighterTimeInForce;
403
+ time: number;
404
+ }
405
+ type LighterBuildTransactionRequest = {
406
+ wallet_address?: string | null;
407
+ } & ({
408
+ type: "Order";
409
+ data: LighterOrderParams;
410
+ } | {
411
+ type: "UpdateLeverage";
412
+ data: LighterLeverageParams;
413
+ } | {
414
+ type: "Withdraw";
415
+ data: LighterWithdrawParams;
416
+ } | {
417
+ type: "CreateSubAccount";
418
+ data: LighterCreateSubAccountParams;
419
+ } | {
420
+ type: "Transfer";
421
+ data: LighterGeneralTransferParams;
422
+ } | {
423
+ type: "GroupedOrders";
424
+ data: LighterGroupedOrdersParams;
425
+ } | {
426
+ type: "CancelOrder";
427
+ data: LighterCancelOrderParams;
428
+ } | {
429
+ type: "CancelAllOrders";
430
+ data: LighterCancelAllOrdersParams;
431
+ });
432
+ interface LighterBuildTransactionResponse {
433
+ tx_type: number;
434
+ tx_info: string;
435
+ tx_hash?: string | null;
436
+ hash: string;
437
+ }
438
+ interface LighterAuthRequest {
439
+ wallet_address?: string | null;
440
+ expires_in_ms?: number | null;
441
+ account_index: number;
442
+ }
443
+ interface LighterAuthResponse {
444
+ auth: string;
445
+ expires_at: number;
446
+ }
447
+ interface LighterChangeKeyRequest {
448
+ wallet_address?: string | null;
449
+ account_index: number;
450
+ }
451
+ interface LighterChangeKeyResponse {
452
+ account_index: number;
453
+ public_key: string;
454
+ }
455
+ interface ExchangeSignature {
456
+ r: string;
457
+ s: string;
458
+ v: number;
459
+ }
460
+ interface ExchangePayload {
461
+ action: any;
462
+ nonce: number;
463
+ signature: ExchangeSignature;
464
+ vaultAddress?: string | null;
465
+ expiresAfter?: number | null;
466
+ }
467
+ interface ExchangeResponse {
468
+ payload: ExchangePayload;
469
+ }
470
+ interface ExchangeRequest {
471
+ action: any;
472
+ vaultAddress?: string | null;
473
+ expiresAfter?: number | null;
474
+ isMainnet?: boolean | null;
475
+ walletAddress?: string | null;
476
+ }
477
+ interface ExportInitRequest {
478
+ user_nonce: string;
479
+ account_index?: number;
480
+ }
481
+ interface ExportInitResponse {
482
+ server_nonce: string;
483
+ }
484
+ interface ExportFinishRequest {
485
+ user_nonce?: string;
486
+ server_nonce?: string;
487
+ account_index?: number;
488
+ is_export: boolean;
489
+ }
490
+ interface ExportWallet {
491
+ network: Network;
492
+ wallet_set: string;
493
+ address: string;
494
+ private_key: string;
495
+ }
496
+ interface ExportWalletResponse {
497
+ user_id: string;
498
+ wallets: ExportWallet[];
499
+ }
500
+ interface CloseInitRequest {
501
+ user_nonce: string;
502
+ }
503
+ interface CloseInitResponse {
504
+ server_nonce: string;
505
+ }
506
+ interface CloseFinishRequest {
507
+ user_nonce: string;
508
+ server_nonce: string;
509
+ }
510
+ interface CloseFinishResponse {
511
+ user_id: string;
512
+ is_closed: boolean;
513
+ }
275
514
 
276
515
  interface PhantomWalletAdapterConfig {
277
516
  }
@@ -524,10 +763,116 @@ declare class WalletClient {
524
763
  }): Promise<BuildTransactionResponse>;
525
764
  /**
526
765
  * Build a transaction using the server-side build transaction API
527
- * @param request Build transaction request
766
+ * @param request Build transaction request (with optional wallet_address field)
767
+ * @param walletAddress Optional wallet address (will be added to request if provided)
528
768
  * @returns Build transaction response with raw transaction
529
769
  */
530
770
  buildTransaction(request: BuildTransactionRequest, walletAddress?: string): Promise<BuildTransactionResponse>;
771
+ /**
772
+ * Initialize the export process by generating a server nonce
773
+ * @param accountIndex Optional account index to export (defaults to 0)
774
+ * @returns Server nonce for verification
775
+ */
776
+ exportInit(accountIndex?: number): Promise<ExportInitResponse>;
777
+ /**
778
+ * Finalize the export process and retrieve wallet private keys
779
+ * @param params Export parameters including nonces and account index
780
+ * @returns Exported wallet information with private keys
781
+ */
782
+ exportFinal(params: {
783
+ userNonce: string;
784
+ serverNonce: string;
785
+ accountIndex?: number;
786
+ isExport?: boolean;
787
+ }): Promise<ExportWalletResponse>;
788
+ /**
789
+ * Retrieve previously exported wallet information
790
+ * @param accountIndex Optional account index (defaults to 0)
791
+ * @returns Previously exported wallet information
792
+ */
793
+ getExportedWallets(accountIndex?: number): Promise<ExportWalletResponse>;
794
+ /**
795
+ * Initialize the account closure process
796
+ * @returns Server nonce for verification
797
+ */
798
+ closeInit(): Promise<CloseInitResponse>;
799
+ /**
800
+ * Finalize the account closure process and permanently delete the account
801
+ * @param params Close parameters including nonces
802
+ * @returns Confirmation that the account was closed
803
+ */
804
+ closeFinal(params: {
805
+ userNonce: string;
806
+ serverNonce: string;
807
+ }): Promise<CloseFinishResponse>;
808
+ /**
809
+ * Raw v1 sign API - Sign a message with user's wallet
810
+ * @param params Sign parameters including network, address, and message
811
+ * @returns Signature string
812
+ */
813
+ signV1(params: {
814
+ network: Network;
815
+ address: string;
816
+ message: string;
817
+ }): Promise<string>;
818
+ /**
819
+ * Raw v2 sign API - Sign a transaction (Solana or Ethereum EIP712) with user's wallet
820
+ * @param params Sign parameters including network, address, and transaction
821
+ * @returns Signature string
822
+ */
823
+ signV2(params: {
824
+ network: Network;
825
+ address: string;
826
+ tx: {
827
+ Solana?: string;
828
+ EthereumEip712?: Record<string, unknown>;
829
+ };
830
+ }): Promise<string>;
831
+ /**
832
+ * Raw v3 sign API - Sign a Solana transaction with user's wallet
833
+ * Note: v3 sign API only supports Solana transactions
834
+ * @param params Sign parameters including network, address, and Solana transaction
835
+ * @returns Signature string
836
+ */
837
+ signV3(params: {
838
+ network: Network;
839
+ address: string;
840
+ tx: {
841
+ Solana: string;
842
+ };
843
+ }): Promise<string>;
844
+ /**
845
+ * Build a Lighter transaction using the server-side build transaction API
846
+ * @param request Lighter build transaction request (with optional wallet_address field)
847
+ * @param walletAddress Optional wallet address (will be added to request if provided)
848
+ * @returns Lighter build transaction response with transaction details
849
+ */
850
+ lighterBuildTransaction(request: LighterBuildTransactionRequest, walletAddress?: string): Promise<LighterBuildTransactionResponse>;
851
+ /**
852
+ * Generate a Lighter authentication token
853
+ * @param params Auth parameters including account_index and optional wallet_address and expires_in_ms
854
+ * @returns Lighter auth response with token and expiration
855
+ */
856
+ lighterAuth(params: {
857
+ lighter_account_index: number;
858
+ wallet_address?: string | null;
859
+ expires_in_ms?: number | null;
860
+ }): Promise<LighterAuthResponse>;
861
+ /**
862
+ * Rotate/change the Lighter L2 key for an account
863
+ * @param params Change key parameters including account_index and optional wallet_address
864
+ * @returns Lighter change key response with new public key
865
+ */
866
+ lighterChangeKey(params: {
867
+ lighter_account_index: number;
868
+ wallet_address?: string | null;
869
+ }): Promise<LighterChangeKeyResponse>;
870
+ /**
871
+ * Sign and build a Hyperliquid exchange transaction
872
+ * @param request Exchange request with action and optional parameters
873
+ * @returns Exchange response with signed payload
874
+ */
875
+ exchange(request: ExchangeRequest): Promise<ExchangeResponse>;
531
876
  }
532
877
  type SignTransactionReturnType<serializer extends viem.SerializeTransactionFn<viem.TransactionSerializable> = viem.SerializeTransactionFn<viem.TransactionSerializable>, transaction extends Parameters<serializer>[0] = Parameters<serializer>[0]> = viem.TransactionSerialized<viem.GetTransactionType<transaction>>;
533
878
 
@@ -784,5 +1129,5 @@ declare function useCoinbaseOnramp(): {
784
1129
  getCoinbaseOnrampUrl: (amount: number, blockchain?: "solana" | "ethereum", redirectUrl?: string) => Promise<string>;
785
1130
  };
786
1131
 
787
- export { ACCESS_TOKEN_KEY, BACKUP_WALLET_INFO, BACKUP_WALLET_TYPE_KEY, Network, STORAGE_STATE_KEY, SWITCHED_ACCOUNT_ADDRESS, SocialType, Storage, VaultId, WALLET_TYPE_KEY, WalletClient, WalletProvider, WalletProviderBackup, WalletType, injectStyles, isVersionedTransaction, theme, useActiveWallet, useCoinbaseOnramp, useConnect, useLoginModal, useWallet, useWalletBackup, useWalletBackupStatus, useWalletStatus };
788
- export type { AccountInfo, ApiResponse, BuildTransactionRequest, BuildTransactionResponse, CoinbaseOnrampRequest, DeBridgeDlnCreateTxRequest, IModalManager, LoginModalProps, LoginType, MiddleAccount, MiddleAccountRequest, MultiAccountRequest, OrderState, SignMessageResponse, SignRequestV1, SignRequestV2, SignRequestV3, SignTransactionResponse, SignTransactionReturnType, Social, SocialInfo, SubAccountInfo, SupportedTransactionVersions, TransactionOrVersionedTransaction, TransferRequest, UnsignedTxV2, UnsignedTxV3, UserSession, Wallet, WalletInfo, WalletProviderConfig };
1132
+ export { ACCESS_TOKEN_KEY, BACKUP_WALLET_INFO, BACKUP_WALLET_TYPE_KEY, LighterGroupingType, LighterMarginMode, LighterOrderSide, LighterOrderType, LighterTimeInForce, Network, STORAGE_STATE_KEY, SWITCHED_ACCOUNT_ADDRESS, SocialType, Storage, VaultId, WALLET_TYPE_KEY, WalletClient, WalletProvider, WalletProviderBackup, WalletType, injectStyles, isVersionedTransaction, theme, useActiveWallet, useCoinbaseOnramp, useConnect, useLoginModal, useWallet, useWalletBackup, useWalletBackupStatus, useWalletStatus };
1133
+ export type { AccountInfo, ApiResponse, BuildTransactionRequest, BuildTransactionResponse, CloseFinishRequest, CloseFinishResponse, CloseInitRequest, CloseInitResponse, CoinbaseOnrampRequest, DeBridgeDlnCreateTxRequest, ExchangePayload, ExchangeRequest, ExchangeResponse, ExchangeSignature, ExportFinishRequest, ExportInitRequest, ExportInitResponse, ExportWallet, ExportWalletResponse, IModalManager, LighterAuthRequest, LighterAuthResponse, LighterBuildTransactionRequest, LighterBuildTransactionResponse, LighterCancelAllOrdersParams, LighterCancelOrderParams, LighterChangeKeyRequest, LighterChangeKeyResponse, LighterCreateSubAccountParams, LighterGeneralTransferParams, LighterGroupedOrderEntry, LighterGroupedOrdersParams, LighterLeverageParams, LighterOrderParams, LighterTxContext, LighterWithdrawParams, LoginModalProps, LoginType, MiddleAccount, MiddleAccountRequest, MultiAccountRequest, OrderState, SignMessageResponse, SignRequestV1, SignRequestV2, SignRequestV3, SignTransactionResponse, SignTransactionReturnType, Social, SocialInfo, SubAccountInfo, SupportedTransactionVersions, TransactionOrVersionedTransaction, TransferRequest, UnsignedTxV2, UnsignedTxV3, UserSession, Wallet, WalletInfo, WalletProviderConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superstack-wallet-sdk",
3
- "version": "0.5.8",
3
+ "version": "0.5.10",
4
4
  "description": "A wallet SDK for superstack",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",