Hooks
React hooks that provide deeper access into the wallet APIs
Inside the <ArweaveWalletKit>
, you can use all kinds of hooks that are reactive to the different strategies. Some of the hooks and/or api functions might not be supported by all wallets.
useConnection
useConnection
This is the core hook for connecting / disconnecting a strategy.
To use the different functionalities the various Arweave wallets provide, you need to request permissions from the user to interact with their wallets. This can be done with the connect()
function.
To end the current ArConnect session for the user, you can disconnect from the extension, using the disconnect()
function. This removes all permissions from your application.
The connected
function is simply a boolean for checking whether the user is connected with the application.
Usage
useApi
useApi
The API hook returns the active strategy's API as an intractable object. Can be used to sign/encrypt, etc.
Usage
The available API functions may vary depending on the chosen strategy.
useProfileModal
useProfileModal
Toggle visibility (display/ hide) a modal with the connected userβs profile information and a disconnect button.
useActiveAddress
useActiveAddress
The Active address hook returns the address that is currently connected with the application. It requires the ACCESS_ADDRESS
and the ACCESS_ALL_ADDRESSES
permission.
Usage
usePublicKey
usePublicKey
The Active address hook returns the public key that is currently connected with the application. It requires the ACCESS_PUBLIC_KEY
permission.
Usage
usePermissions
usePermissions
The Permissions hook returns the permissions given to the application by the connected user.
Usage
useAddresses
useAddresses
This hook returns all the addresses in the connected wallet, known by Arweave Wallet Kit. This is useful for fetching all the addresses a connected user may have. It requires the ACCESS_ALL_ADDRESSES
permission.
Usage
useWalletNames
useWalletNames
This hook returns any names associated with all the addresses the connected user may have. An example of these names are ANS names that can be associated with any Arweave wallet addresses. It requires the ACCESS_ALL_ADDRESSES
permission.
Usage
useStrategy
useStrategy
Active strategy hook. Returns the currently used strategy's ID ("arconnect", "webwallet"
, etc.)
Usage
Last updated