1
1
import { AdaptedWallet , NewNetwork as Network , StandardNetwork } from '@aptos-labs/wallet-adapter-core' ;
2
2
import {
3
3
AccountInfo ,
4
+ AptosFeatures ,
4
5
AptosSignAndSubmitTransactionInput ,
5
6
AptosSignMessageInput ,
6
7
AptosSignTransactionInputV1_1 ,
8
+ WalletIcon ,
7
9
} from '@aptos-labs/wallet-standard' ;
8
10
import { useEffect , useMemo , useState } from 'react' ;
9
11
import { useActiveWalletId } from './useActiveWalletId' ;
@@ -12,25 +14,25 @@ import { useAvailableWallets } from './useAvailableWallets';
12
14
export interface UseActiveWalletUninitializedResult {
13
15
isInitialized : false ;
14
16
isConnected : false ;
15
- account ?: undefined ;
16
- network ?: undefined ;
17
- wallet ?: undefined ;
17
+ activeAccount ?: undefined ;
18
+ activeNetwork ?: undefined ;
18
19
}
19
20
20
21
export interface UseActiveWalletDisconnectedResult {
21
22
isInitialized : true ;
22
23
isConnected : false ;
23
- account ?: undefined ;
24
- network ?: undefined ;
25
- wallet ?: undefined ;
24
+ activeAccount ?: undefined ;
25
+ activeNetwork ?: undefined ;
26
26
}
27
27
28
28
export interface UseActiveWalletConnectedResult {
29
29
isInitialized : true ;
30
30
isConnected : true ;
31
- account : AccountInfo ;
32
- network : Network ;
33
- // wallet: Wallet;
31
+ activeAccount : AccountInfo ;
32
+ activeNetwork : Network ;
33
+ name : string ;
34
+ icon : WalletIcon ;
35
+ features : AptosFeatures ;
34
36
disconnect : ( ) => Promise < void > ;
35
37
signMessage : ( input : AptosSignMessageInput )
36
38
=> ReturnType < AdaptedWallet [ 'signMessage' ] > ;
@@ -102,10 +104,11 @@ export function useActiveWallet(): UseActiveWalletResult {
102
104
return {
103
105
isInitialized : true ,
104
106
isConnected : true ,
105
- // todo: pass other useful info
106
- // wallet: activeWallet,
107
- account : activeAccount ,
108
- network : activeNetwork ,
107
+ activeAccount,
108
+ activeNetwork,
109
+ name : activeWallet . name ,
110
+ icon : activeWallet . icon ,
111
+ features : activeWallet . features ,
109
112
disconnect : async ( ) => activeWallet . disconnect ( ) ,
110
113
signMessage : async ( input ) => activeWallet . signMessage ( input ) ,
111
114
signTransaction : async ( input ) => activeWallet . signTransaction ( input ) ,
0 commit comments