# Using the `useCapabilities` Hook

> **Key takeaway:** ☞ The renaming of "Ledger Live" to "Ledger Wallet" and "wallet" (in the hardware sense) to "signer" is still in progress. This page may contain legacy references that will be updated.

The `useCapabilities` hook is part of the `@ledgerhq/wallet-api-client-react` package (current version: 1.4.x). It lets you fetch the list of Wallet API methods your Live App is allowed to call for the connected user, so you can check what you can do with the user's account before calling a method that might be rejected.

> **Note:** Package versions change frequently. Check the [npm page](https://www.npmjs.com/package/@ledgerhq/wallet-api-client-react) for the latest release before pinning a version in your Live App.

## Sample code

Here is an example that shows how to use the `useCapabilities` hook inside a React component:

**Required permission:** [`wallet.capabilities`](https://developers.ledger.com/docs/ledger-live/discover/guides/wallet-api/appendix/manifest#permissions)

```jsx
import { useState } from "react";
import { useCapabilities } from "@ledgerhq/wallet-api-client-react";

function App() {
  const { capabilities } = useCapabilities();

  return (
    <>
      <h1>Capabilities</h1>
      <button onClick={() => {console.log(capabilities)}}> log Capabilities </button>
    </>
  );
}

export default App;
```

In this example:

- We import the `useCapabilities` hook from the `@ledgerhq/wallet-api-client-react` package.

- We use the hook to get the `capabilities` array.

- When the button is clicked, it log the list of capabilities.

## Understanding the response

Here is an example of a partial response from the `useCapabilities` hook:

```json
[
  'account.list', 
  'account.receive', 
  'account.request', 
  'bitcoin.getXPub', 
  'currency.list', 
  'device.close', 
  'device.exchange', 
  'device.transport', 
  'exchange.complete', 
  'exchange.start', 
  'message.sign', 
  'storage.get', 
  'storage.set', 
  'transaction.sign', 
  'transaction.signAndBroadcast', 
  'wallet.capabilities', 
  'wallet.info', 
  'wallet.userId'
]
```

Each string in the array represents a capability.
They are composed in two part `group.method` :

- `group`: Specifies in which area does the permission belong.

```
wallet, currency, account, exchange, bitcoin, device, transaction, storage, message, account
```

- `method`: Specifies the method that you can call with this specific user.

## Other fields

```jsx
  const capabilitiesHook = useCapabilities();
```

`loading` : Loading state of capabilities field

```jsx
  if (capabilitiesHook.loading){
    ...
  };
```

`error` : State of the request

```jsx
  if (capabilitiesHook.error){
    ...
  };
```

`updateData` : Function that update the updateData

```jsx
  capabilitiesHook.updateData();
```

`updatedAt` : Last update of capabilities

## Related hooks

- [`useAccounts`](./useAccounts): list the user's accounts once you've confirmed `account.list` is available
- [`useWalletInfo`](./useWalletInfo): check the wallet version and tracking settings
- [`useUserId`](./useUserId): fetch the user ID if `wallet.userId` is available

## Related

- [Manifest permissions reference](https://developers.ledger.com/docs/ledger-live/discover/guides/wallet-api/appendix/manifest#permissions): declare the permissions your Live App requests
