# useCheckMappedAccount

Checks if a Substrate account is mapped to an EVM address for ink! v6 contracts deployed on pallet-revive. This is essential for interacting with ink! v6 contracts on PolkaVM-based chains.

#### Props

| Name      | Type                | Description                                                                    |
| --------- | ------------------- | ------------------------------------------------------------------------------ |
| `address` | `SubstrateAddress?` | The Substrate address to check. Defaults to connected account if not provided. |
| `options` | `NetworkOptions?`   | Optional network selection options (e.g., `{ networkId: 'popTestnet' }`).      |

#### Return Type

| Name         | Type                   | Description                                                                                                   |
| ------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------- |
| `isMapped`   | `boolean \| undefined` | Whether the account is mapped to an EVM address. `undefined` if not yet checked or revive pallet unavailable. |
| `isLoading`  | `boolean`              | Whether the mapping check is in progress.                                                                     |
| `error`      | `Error \| undefined`   | Any error that occurred during the check.                                                                     |
| `evmAddress` | `string \| undefined`  | The corresponding EVM address derived from the Substrate address.                                             |
| `refresh`    | `() => Promise<void>`  | Function to manually re-check the mapping status.                                                             |

#### Basic Usage

```tsx
import { useCheckMappedAccount } from 'typink';

function AccountMappingStatus() {
  const { isMapped, isLoading, evmAddress, refresh } = useCheckMappedAccount();

  if (isLoading) return <div>Checking mapping status...</div>;

  if (isMapped === false) {
    return (
      <div>
        <p>Account not mapped. Please map your account first.</p>
        <button onClick={refresh}>Check Again</button>
      </div>
    );
  }

  return <div>Account mapped to: {evmAddress}</div>;
}
```

**Check specific address:**

```tsx
const { isMapped, evmAddress } = useCheckMappedAccount(
  '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
  { networkId: 'popTestnet' }
);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dedot.dev/typink/hooks-and-providers/usecheckmappedaccount.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
