superstack-wallet-sdk 0.5.3 → 0.5.5
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/esm/src/client.js +1 -1
- package/dist/esm/src/client.js.map +1 -1
- package/dist/esm/src/context.js.map +1 -1
- package/dist/esm/src/context_backup.js +2 -0
- package/dist/esm/src/context_backup.js.map +1 -0
- package/dist/esm/src/hooks.js +1 -1
- package/dist/esm/src/hooks.js.map +1 -1
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/modal.js +1 -1
- package/dist/esm/src/modal.js.map +1 -1
- package/dist/esm/src/storage.js +1 -1
- package/dist/esm/src/storage.js.map +1 -1
- package/dist/esm/src/types.js.map +1 -1
- package/dist/esm/types/client.d.ts +7 -2
- package/dist/esm/types/context_backup.d.ts +28 -0
- package/dist/esm/types/hooks.d.ts +10 -1
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/modal.d.ts +2 -1
- package/dist/esm/types/storage.d.ts +8 -1
- package/dist/esm/types/types.d.ts +2 -1
- package/dist/index.cjs +123 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +55 -8
- package/package.json +3 -2
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
|
|
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,8 +666,10 @@ 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";
|
|
672
|
+
declare const BACKUP_WALLET_INFO = "backup_wallet_info";
|
|
631
673
|
interface StorageState {
|
|
632
674
|
accessToken: string;
|
|
633
675
|
socials: Social[];
|
|
@@ -637,13 +679,18 @@ declare class Storage {
|
|
|
637
679
|
static saveState(token: string, socials: Social[]): void;
|
|
638
680
|
static saveAccessToken(token: string): void;
|
|
639
681
|
static saveWalletType(type: "phantom" | "embedded"): void;
|
|
682
|
+
static saveBackupWalletType(type: "phantom_backup" | "embedded_backup"): void;
|
|
640
683
|
static saveSwitchedAccountAddress(address: string): void;
|
|
684
|
+
static saveBackupWalletInfo(wallet: WalletInfo): void;
|
|
641
685
|
static getWalletType(): "phantom" | "embedded" | null;
|
|
686
|
+
static getBackupWalletType(): "phantom_backup" | "embedded_backup" | null;
|
|
642
687
|
static getState(): StorageState | null;
|
|
643
688
|
static getSocials(): Social[] | null;
|
|
644
689
|
static getAccessToken(): string | null;
|
|
645
690
|
static getSwitchedAccountAddress(): string | null;
|
|
691
|
+
static getBackupWalletInfo(): WalletInfo | null;
|
|
646
692
|
static clear(): void;
|
|
693
|
+
static clearBackup(): void;
|
|
647
694
|
}
|
|
648
695
|
|
|
649
696
|
declare const theme: {
|
|
@@ -755,5 +802,5 @@ declare function useCoinbaseOnramp(): {
|
|
|
755
802
|
getCoinbaseOnrampUrl: (amount: number, blockchain?: "solana" | "ethereum", redirectUrl?: string) => Promise<string>;
|
|
756
803
|
};
|
|
757
804
|
|
|
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 };
|
|
805
|
+
export { ACCESS_TOKEN_KEY, BACKUP_WALLET_INFO, 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
806
|
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
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "A wallet SDK for superstack",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -93,5 +93,6 @@
|
|
|
93
93
|
"ts-jest": "^29.1.2",
|
|
94
94
|
"tslib": "^2.6.2",
|
|
95
95
|
"typescript": "^5.3.3"
|
|
96
|
-
}
|
|
96
|
+
},
|
|
97
|
+
"packageManager": "pnpm@10.16.0+sha512.8066e7b034217b700a9a4dbb3a005061d641ba130a89915213a10b3ca4919c19c037bec8066afdc559b89635fdb806b16ea673f2468fbb28aabfa13c53e3f769"
|
|
97
98
|
}
|