# Connect an æpp to a wallet

This guide describes the 4 steps that are necessary to connect your application to a wallet using the RPC API.

## Prerequisites

* Install [Superhero Wallet extension](https://wallet.superhero.com/) for simplicity of example.\
  You can build your own wallet in the next example

## 1. Specify imports and constants

{% @github-files/github-code-block url="<https://github.com/aeternity/aepp-sdk-js/blob/f60d1b8a1124b32781769342e4941c8dacf6ad53/examples/browser/aepp/src/StoreAeSdkPlugin.js#L1-L5>" %}

## 2. Initialize the `AeSdkAepp` class

{% @github-files/github-code-block url="<https://github.com/aeternity/aepp-sdk-js/blob/f60d1b8a1124b32781769342e4941c8dacf6ad53/examples/browser/aepp/src/StoreAeSdkPlugin.js#L34-L49>" %}

## 3. Scan for wallets and connect to a wallet

{% @github-files/github-code-block url="<https://github.com/aeternity/aepp-sdk-js/blob/f60d1b8a1124b32781769342e4941c8dacf6ad53/examples/browser/aepp/src/Connect.vue#L66-L85>" %}

Alternatively, aepp can request wallet to share node url it connected to. If agreed, then aepp can\
connect to the wallet's node.

```js
await this.aeSdk.connectToWallet(wallet.getConnection(), {
  connectNode: true,
  name: 'wallet-node',
  select: true,
});
```

It can be used to

* improve responsiveness by connecting to the exact node that wallet uses;
* allow to connect aepps to private/development networks without changing their configuration;
* simplify configuration on aepp side.

Note:

* The steps above are snippets taken from the full implementation of\
  the [Simple æpp](https://github.com/aeternity/aepp-sdk-js/blob/f60d1b8a1124b32781769342e4941c8dacf6ad53/examples/browser/aepp)


---

# 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.aeternity.com/developer-documentation/aepp-sdk-js/docs/guides/connect-aepp-to-wallet.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.
