ArweaveKit Docs
  • ArweaveKit
    • Introduction
  • πŸ”Wallets
    • Introduction to Wallets
    • Create Wallet
    • Get Wallet Address
    • Get Wallet Balance
    • Wallet Plugins
  • πŸ’³ARWEAVE WALLET KIT
    • Introduction to Arweave Wallet Kit
    • Setup
    • Connect Button
    • Hooks
    • Customization
  • 🏦Transactions
    • Introduction to Transactions
    • Create Transaction
    • Sign Transaction
    • Post Transaction
    • Get Transaction Status
    • Get Transaction
    • Create and Post Transaction with Othent
    • Transaction Plugins
  • πŸ“„SMART CONTRACTS
    • Introduction to Smart Contracts
    • Create Contract
    • Write Contract
    • Read Contract State
    • View Contract State
    • Write Contract with Othent
    • Read Contract with Othent
    • Smart Contract Plugins
  • βœ…AUTH
    • Introduction to Auth
    • Connect
    • Disconnect
    • Get Active Address
    • Get Permissions
    • Get Wallet Names
    • Get All Addresses
    • Get Active Public Key
    • Is Installed
    • Log In with Othent
    • Log Out with Othent
    • Get User Details with Othent
    • Auth Plugins
  • πŸ”Encryption
    • Introduction to Encryption
    • Encrypt Data with AES
    • Decrypt Data with AES
    • Encrypt AES Key with RSA
    • Decrypt AES Key with RSA
    • Encryption Plugins
  • 🌐GRAPHQL
    • Introduction to GraphQL
    • Query All Arweave Transactions
    • Query Arweave Data
    • Query Arweave Transactions
    • GraphQL Plugins
  • πŸ—ΊοΈRoadMap
    • Features
  • πŸ“˜REFERENCES
    • ArweaveKit in Browser Environments
  • πŸ› οΈSUPPORTING TOOLS
    • Arweave StarterKit
Powered by GitBook
On this page
  • useConnection
  • Usage
  • useApi
  • Usage
  • useProfileModal
  • useActiveAddress
  • Usage
  • usePublicKey
  • Usage
  • usePermissions
  • Usage
  • useAddresses
  • Usage
  • useWalletNames
  • Usage
  • useStrategy
  • Usage

Was this helpful?

  1. ARWEAVE WALLET KIT

Hooks

React hooks that provide deeper access into the wallet APIs

PreviousConnect ButtonNextCustomization

Last updated 3 months ago

Was this helpful?

Inside the , you can use all kinds of hooks that are reactive to the different . Some of the hooks and/or api functions might not be supported by all wallets.

useConnection

This is the core hook for connecting / disconnecting a .

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 Wander 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

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";

useApi

Usage

const api = useApi();

// sign
await api.sign(transaction);

// encrypt
await api.encrypt(...)

The available API functions may vary depending on the chosen strategy.

useProfileModal

Toggle visibility (display/ hide) a modal with the connected user’s profile information and a disconnect button.

const profileModal = useProfileModal();

profileModal.setOpen(true);

useActiveAddress

Usage

const address = useActiveAddress();

usePublicKey

Usage

const publicKey = usePublicKey();

usePermissions

The Permissions hook returns the permissions given to the application by the connected user.

Usage

const permissions = usePermissions();

useAddresses

Usage

const addresses = useAddresses();

useWalletNames

Usage

const walletNames = useWalletNames();

useStrategy

Usage

const strategy = useStrategy();

The API hook returns the active 's API as an intractable object. Can be used to sign/encrypt, etc.

The Active address hook returns the address that is currently connected with the application. It requires the and the permission.

The Active address hook returns the public key that is currently connected with the application. It requires the permission.

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 permission.

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 permission.

Active hook. Returns the currently used strategy's ID (, , etc.)

πŸ’³
ACCESS_ADDRESS
ACCESS_ALL_ADDRESSES
ACCESS_PUBLIC_KEY
ACCESS_ALL_ADDRESSES
ACCESS_ALL_ADDRESSES
"wander"
"webwallet"
<ArweaveWalletKit>
strategies
strategy
strategy
strategy