superstack-wallet-sdk 0.5.3 → 0.5.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.
package/dist/index.d.ts CHANGED
@@ -114,8 +114,9 @@ interface IModalManager {
114
114
  enableGoogle?: boolean;
115
115
  enableTwitter?: boolean;
116
116
  enablePhantom?: boolean;
117
+ isBackup?: boolean;
117
118
  }) => Promise<void>;
118
- hideModal: () => void;
119
+ hideModal: (isBackup?: boolean) => void;
119
120
  }
120
121
  interface MiddleAccountRequest {
121
122
  order_id: string;
@@ -380,15 +381,18 @@ declare class WalletClient {
380
381
  private walletInfo;
381
382
  private phantomAdapter;
382
383
  private walletType;
384
+ private backupWalletType;
383
385
  private solanaCluster;
384
386
  private ethereumNetwork;
385
387
  private defaultNetwork;
386
388
  constructor(config: WalletProviderConfig);
387
389
  private setWallet;
388
390
  private setWalletType;
391
+ private setBackupWalletType;
389
392
  getWallet(): WalletInfo | null;
390
393
  getPhantomAdapter(): PhantomWalletAdapter | null;
391
394
  getWalletType(): "phantom" | "embedded";
395
+ getBackupWalletType(): "phantom_backup" | "embedded_backup";
392
396
  get wallet(): Wallet | null;
393
397
  get address(): string | null;
394
398
  get network(): Network | null;
@@ -402,7 +406,7 @@ declare class WalletClient {
402
406
  get solanaAddress(): string | null;
403
407
  get id(): string | null;
404
408
  get social_links(): Social[] | null;
405
- reconnect(): Promise<WalletInfo | null>;
409
+ reconnect(isBackup?: boolean): Promise<WalletInfo | null>;
406
410
  connectPhantom(): Promise<WalletInfo | null>;
407
411
  updateAccountName(name: string): Promise<any>;
408
412
  signSolanaTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
@@ -446,12 +450,14 @@ declare class WalletClient {
446
450
  code: string;
447
451
  code_verifier: string;
448
452
  network?: Network;
453
+ isBackup?: boolean;
449
454
  }): Promise<WalletInfo | null>;
450
455
  loginWithChallenge(type: LoginType, params: {
451
456
  wallet_address: string;
452
457
  challenge: string;
453
458
  signature: string;
454
459
  network?: Network;
460
+ isBackup?: boolean;
455
461
  }): Promise<WalletInfo | null>;
456
462
  oauthInit(params: {
457
463
  provider: string;
@@ -471,7 +477,7 @@ declare class WalletClient {
471
477
  expires_at: number;
472
478
  }>;
473
479
  getSession(): Promise<WalletInfo>;
474
- logout(): Promise<void>;
480
+ logout(isBackup?: boolean): Promise<void>;
475
481
  getOAuth2ClientId(provider: string): Promise<string>;
476
482
  setSelectedWallet(walletId: string): void;
477
483
  getSelectedWallet(): string | null;
@@ -543,7 +549,7 @@ declare class WalletClient {
543
549
  }
544
550
  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>>;
545
551
 
546
- interface WalletState {
552
+ interface WalletState$1 {
547
553
  isAuthenticated: boolean;
548
554
  isConnecting: boolean;
549
555
  isInitialized: boolean;
@@ -557,7 +563,7 @@ interface WalletState {
557
563
  enableTwitter: boolean;
558
564
  enablePhantom: boolean;
559
565
  }
560
- interface WalletContextValue extends WalletState {
566
+ interface WalletContextValue$1 extends WalletState$1 {
561
567
  connect: () => Promise<void>;
562
568
  disconnect: () => void;
563
569
  }
@@ -566,7 +572,32 @@ interface WalletProviderProps {
566
572
  config: WalletProviderConfig;
567
573
  }
568
574
  declare function WalletProvider({ children, config }: WalletProviderProps): react__default.JSX.Element;
569
- declare function useWallet(): WalletContextValue;
575
+ declare function useWallet(): WalletContextValue$1;
576
+
577
+ interface WalletState {
578
+ isAuthenticated: boolean;
579
+ isConnecting: boolean;
580
+ isInitialized: boolean;
581
+ walletInfo: WalletInfo | null;
582
+ wallet: WalletClient | null;
583
+ session: UserSession | null;
584
+ error: string | null;
585
+ enableEmail: boolean;
586
+ enablePhone: boolean;
587
+ enableGoogle: boolean;
588
+ enableTwitter: boolean;
589
+ enablePhantom: boolean;
590
+ }
591
+ interface WalletContextValue extends WalletState {
592
+ connect: () => Promise<void>;
593
+ disconnect: () => void;
594
+ }
595
+ interface WalletProviderBackupProps {
596
+ children: ReactNode;
597
+ config: WalletProviderConfig;
598
+ }
599
+ declare function WalletProviderBackup({ children, config }: WalletProviderBackupProps): react__default.JSX.Element;
600
+ declare function useWalletBackup(): WalletContextValue;
570
601
 
571
602
  declare function useConnect(): {
572
603
  connect: () => Promise<void>;
@@ -581,10 +612,18 @@ declare function useWalletStatus(): {
581
612
  isInitialized: boolean;
582
613
  ready: boolean;
583
614
  };
615
+ declare function useWalletBackupStatus(): {
616
+ isAuthenticated: boolean;
617
+ authenticated: boolean;
618
+ error: string | null;
619
+ session: UserSession | null;
620
+ isInitialized: boolean;
621
+ ready: boolean;
622
+ };
584
623
  declare function useActiveWallet(): {
585
624
  wallet: WalletClient | null;
586
625
  };
587
- declare function useLoginModal({ client, isOpen, onClose, onLogin, isLoading, }: LoginModalProps): {
626
+ declare function useLoginModal({ client, isOpen, onClose, onLogin, isLoading }: LoginModalProps): {
588
627
  email: string;
589
628
  setEmail: react.Dispatch<react.SetStateAction<string>>;
590
629
  emailSent: boolean;
@@ -611,6 +650,7 @@ declare function useLoginModal({ client, isOpen, onClose, onLogin, isLoading, }:
611
650
  wallet_address: string;
612
651
  challenge: string;
613
652
  signature: string;
653
+ isBackup?: boolean;
614
654
  }) => Promise<void>;
615
655
  phone: string;
616
656
  setPhone: react.Dispatch<react.SetStateAction<string>>;
@@ -626,6 +666,7 @@ declare function useLoginModal({ client, isOpen, onClose, onLogin, isLoading, }:
626
666
 
627
667
  declare const STORAGE_STATE_KEY = "embedded_wallet_state";
628
668
  declare const WALLET_TYPE_KEY = "superstack_wallet_type";
669
+ declare const BACKUP_WALLET_TYPE_KEY = "superstack_backup_wallet_type";
629
670
  declare const ACCESS_TOKEN_KEY = "embedded_wallet_access_token";
630
671
  declare const SWITCHED_ACCOUNT_ADDRESS = "switched_account_address";
631
672
  interface StorageState {
@@ -637,13 +678,16 @@ declare class Storage {
637
678
  static saveState(token: string, socials: Social[]): void;
638
679
  static saveAccessToken(token: string): void;
639
680
  static saveWalletType(type: "phantom" | "embedded"): void;
681
+ static saveBackupWalletType(type: "phantom_backup" | "embedded_backup"): void;
640
682
  static saveSwitchedAccountAddress(address: string): void;
641
683
  static getWalletType(): "phantom" | "embedded" | null;
684
+ static getBackupWalletType(): "phantom_backup" | "embedded_backup" | null;
642
685
  static getState(): StorageState | null;
643
686
  static getSocials(): Social[] | null;
644
687
  static getAccessToken(): string | null;
645
688
  static getSwitchedAccountAddress(): string | null;
646
689
  static clear(): void;
690
+ static clearBackup(): void;
647
691
  }
648
692
 
649
693
  declare const theme: {
@@ -755,5 +799,5 @@ declare function useCoinbaseOnramp(): {
755
799
  getCoinbaseOnrampUrl: (amount: number, blockchain?: "solana" | "ethereum", redirectUrl?: string) => Promise<string>;
756
800
  };
757
801
 
758
- export { ACCESS_TOKEN_KEY, BorrowedAsset, CollateralAsset, CrossMarginOperationType, CrossMarginPositionStatus, Network, STORAGE_STATE_KEY, SWITCHED_ACCOUNT_ADDRESS, SocialType, Storage, VaultId, WALLET_TYPE_KEY, WalletClient, WalletProvider, WalletType, injectStyles, isVersionedTransaction, theme, useActiveWallet, useCoinbaseOnramp, useConnect, useLoginModal, useWallet, useWalletStatus };
802
+ export { ACCESS_TOKEN_KEY, BACKUP_WALLET_TYPE_KEY, BorrowedAsset, CollateralAsset, CrossMarginOperationType, CrossMarginPositionStatus, 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 };
759
803
  export type { AccountInfo, ApiResponse, BigDecimalString, BorrowedAssetGeneralInfo, BuildTransactionRequest, BuildTransactionResponse, CoinbaseOnrampRequest, CollateralAssetGeneralInfo, CollateralAssetInfo, CrossMarginAdjustMarginRequest, CrossMarginAdjustMarginResponse, CrossMarginBorrowQuoteRequest, CrossMarginBorrowQuoteResponse, CrossMarginBorrowRequest, CrossMarginBorrowResponse, CrossMarginGeneralInfoResponse, CrossMarginRepayQuoteRequest, CrossMarginRepayQuoteResponse, CrossMarginRepayRequest, CrossMarginRepayResponse, IModalManager, LoginModalProps, LoginType, MiddleAccount, MiddleAccountRequest, OrderState, SignMessageResponse, SignRequestV1, SignRequestV2, SignTransactionResponse, SignTransactionReturnType, Social, SocialInfo, SupportedTransactionVersions, TransactionOrVersionedTransaction, TransferRequest, UnsignedTx, UserClosedPositionInfo, UserHistoryResponse, UserOpenPositionInfo, UserOpenPositionsResponse, UserOperationInfo, UserSession, Wallet, WalletInfo, WalletProviderConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superstack-wallet-sdk",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "A wallet SDK for superstack",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",