Comment on page
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.Usage
const { connected, connect, disconnect } = useConnection();
// initiate connection
await connect();
// disconnect the connected strategy
await disconnect();
// is there a strategy connected?
connected ? "wallet connected" : "no connected wallet";
API hook. Returns the active strategy's API as an intractable object. Can be used to sign/encrypt, etc.
Usage
const api = useApi();
// sign
await api.sign(transaction);
// encrypt
await api.encrypt(...)
Some API functions might not be supported depending on the strategy the user chose. (e.g.: Othent does not support the
signature()
function.Toggle / display a modal with profile information and a disconnect button.
const profileModal = useProfileModal();
profileModal.setOpen(true);
Usage
const address = useActiveAddress();
Usage
const publicKey = usePublicKey();
Permissions hook. Returns the permissions given to the app, known by Arweave Wallet Kit.
Usage
const permissions = usePermissions();
All addresses hook. Returns the addresses in the connected wallet, known by Arweave Wallet Kit. Requires the
ACCESS_ALL_ADDRESSES
permission.Usage
const addresses = useAddresses();
All addresses hook. Returns the addresses in the connected wallet, known by Arweave Wallet Kit. Requires the
ACCESS_ALL_ADDRESSES
permission.Usage
const walletNames = useWalletNames();
Usage
const strategy = useStrategy();
Last modified 5mo ago