# Installation

import CloudBanner from '/snippets/cloud-banner.mdx'

import WagmiImplementation from '/snippets/appkit/javascript/wagmi/about/implementation.mdx'

import Ethers5Implementation from '/snippets/appkit/javascript/ethers5/implementation.mdx'

import EthersImplementation from '/snippets/appkit/javascript/ethers/about/implementation.mdx'

import SolanaImplementation from '/snippets/appkit/javascript/solana/about/implementation.mdx'
import SolanaPrograms from '/snippets/appkit/javascript/solana/about/programs.mdx'

import BitcoinImplementation from '/snippets/appkit/javascript/bitcoin/about/implementation.mdx'

import TonImplementation from '/snippets/appkit/javascript/ton/about/implementation.mdx'

import TronImplementation from '/snippets/appkit/javascript/tron/about/implementation.mdx'

import CoreImplementation from '/snippets/appkit/javascript/core/about/implementation.mdx'

AppKit provides seamless integration with multiple blockchain ecosystems. It supports [Wagmi](https://wagmi.sh/) and [Ethers v6](https://docs.ethers.org/v6/) on Ethereum,
[@solana/web3.js](https://solana-labs.github.io/solana-web3.js/) on Solana, as well as Bitcoin, TON, TRON and other networks.

<Note>
  We recommend using [Vite](https://vitejs.dev/guide/#scaffolding-your-first-vite-project) to get
  started with AppKit JavaScript.
</Note>

## Installation

Try installing AppKit Skills to get AI-assisted guidance. Your AI coding assistant can help you set up, build, and debug your AppKit integration.

To install AppKit Skills, run the following command in your terminal:

```bash
npx skills add https://github.com/reown-com/skills --skill appkit --agent '*'
```

After installation, you can ask your AI assistant for help with AppKit setup, implementation, and troubleshooting.

## Custom Installation

<Tabs>
<Tab title="Wagmi">

<Warning>
  AppKit is only compatible with wagmi 2.x. Ensure you are using a compatible version.
</Warning>

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-wagmi wagmi@2.x viem
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-wagmi wagmi@2.x viem
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-wagmi wagmi@2.x viem
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-wagmi wagmi@2.x viem
```

</CodeGroup>

</Tab>
<Tab title="Ethers v5">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
```

</CodeGroup>

</Tab>
<Tab title="Ethers">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-ethers ethers
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-ethers ethers
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-ethers ethers
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-ethers ethers
```

</CodeGroup>

</Tab>
<Tab title="Solana">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-solana
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-solana
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-solana
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-solana
```

</CodeGroup>

</Tab>
<Tab title="Bitcoin">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-bitcoin
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-bitcoin
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-bitcoin
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-bitcoin
```

</CodeGroup>

</Tab>
<Tab title="TON">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-ton
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-ton
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-ton
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-ton
```

</CodeGroup>

</Tab>
<Tab title="TRON">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-adapter-tron
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-adapter-tron
```

```bash Bun
bun add @reown/appkit @reown/appkit-adapter-tron
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-adapter-tron
```

</CodeGroup>

</Tab>
<Tab title="Others networks (AppKit Core)">

<CodeGroup>

```bash npm
npm install @reown/appkit @reown/appkit-universal-connector @reown/appkit-common ethers
```

```bash Yarn
yarn add @reown/appkit @reown/appkit-universal-connector @reown/appkit-common ethers
```

```bash Bun
bun add @reown/appkit @reown/appkit-universal-connector @reown/appkit-common ethers
```

```bash pnpm
pnpm add @reown/appkit @reown/appkit-universal-connector @reown/appkit-common ethers
```

</CodeGroup>

</Tab>
</Tabs>

## Cloud Configuration

Create a new project on [Reown Dashboard](https://dashboard.reown.com) and obtain a new project ID.

<CloudBanner />

## Implementation

<Tabs>
<Tab title="Wagmi">
<Card title="wagmi Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/javascript/javascript-wagmi">
Check the JavaScript wagmi example
</Card>

<WagmiImplementation />

</Tab>
<Tab title="Ethers v5">

<Ethers5Implementation />

</Tab>
<Tab title="Ethers">
<Card title="ethers Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/javascript/javascript-ethers">
Check the JavaScript ethers example
</Card>

<EthersImplementation />

</Tab>
<Tab title="Solana">
<Warning>
MetaMask does not currently support WalletConnect connections on Solana. The MetaMask team is working on adding this feature. In the meantime, we recommend using other wallets that support Solana. You can find the complete list of supported wallets on [WalletGuide](https://walletguide.walletconnect.network/).
</Warning>

<Card title="Solana Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/javascript/javascript-solana">
Check the JavaScript Solana example
</Card>

<SolanaImplementation />

</Tab>
<Tab title="Bitcoin">
<Card title="Bitcoin Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/javascript/javascript-bitcoin">
Check the JavaScript Bitcoin example
</Card>

<BitcoinImplementation />

</Tab>
<Tab title="TON">
<Card title="TON Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/javascript/javascript-ton">
Check the JavaScript TON example
</Card>

<TonImplementation />

</Tab>
<Tab title="TRON">

<TronImplementation />

</Tab>
<Tab title="Others networks (AppKit Core)">
<Card title="AppKit Core Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/javascript/javascript-core-universal-connector">
Check the JavaScript AppKit Core example for Sui and Stacks
</Card>

<CoreImplementation />

</Tab>
</Tabs>

## Trigger the modal

<Tabs>
<Tab title="AppKit">

To open AppKit you can use our [**web component**](/appkit/javascript/core/components) or build your own button with AppKit [**actions**](/appkit/javascript/core/actions#open-and-close-the-modal).

<CodeGroup>

```tsx ConnectButton.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>HTML AppKit Example</title>
  </head>
  <body>
    <appkit-button />
    <script type="module" src="main.js"></script>
  </body>
</html>
```

You can trigger the modal by calling the `open` function from the modal instance.

```js ConnectButtonWithFunctions.js
const modal = createAppKit({
  adapters: [wagmiAdapter],
  networks: [mainnet, arbitrum],
  projectId
})

modal.open()
```

</CodeGroup>

</Tab>
<Tab title="AppKit Core">

To open AppKit Core you need to call the `connect` function from the Universal Connector.

```tsx
<script>
  let session = null

  async function handleConnect() {
    // universalConnector is the universal connector instance from the implementation section
    if (!universalConnector) {
      return
    }

    const { session: providerSession } = await universalConnector.connect()
    session = providerSession
  }

  async function handleDisconnect() {
    if (!universalConnector) {
      return
    }
    await universalConnector.disconnect()
    session = null
  }

  document.getElementById('open-connect-modal').addEventListener('click', handleConnect)
  document.getElementById('disconnect').addEventListener('click', handleDisconnect)
</script>

<div>
  <button id="open-connect-modal">Open AppKit Core</button>
  <button id="disconnect">Disconnect</button>
</div>
```

</Tab>
</Tabs>

## Blockchain Interaction

<Tabs>

<Tab title="Wagmi">
You need to install @wagmi/core to interact with smart contracts:

<CodeGroup>

```bash npm
npm install @wagmi/core
```

```bash Yarn
yarn add @wagmi/core
```

```bash Bun
bun a @wagmi/core
```

```bash pnpm
pnpm add @wagmi/core
```

</CodeGroup>

[Wagmi actions](https://wagmi.sh/core/api/actions/readContract) can help us interact with wallets and smart contracts:

For this use case, we need to import the `wagmiConfig`from our AppKit WagmiAdapter configuration.

```tsx
import { readContract } from '@wagmi/core'
import { USDTAbi } from '../abi/USDTAbi'

const USDTAddress = '0x...'

const data = readContract(wagmiConfig, {
  address: USDTAddress,
  abi: USDTAbi,
  functionName: 'totalSupply',
  args: []
})
```

Read more about Wagmi actions for smart contract interaction [here](https://wagmi.sh/core/actions/readContract).

</Tab>
<Tab title="Ethers">

[Ethers](https://docs.ethers.org/v6/) can help us interact with wallets and smart contracts:

```tsx
import { BrowserProvider, Contract, parseEther } from 'ethers'

const provider = await modal.subscribeProviders(state => {
  return state['eip155']
})

const addressFrom = await modal.subscribeAccount(state => {
  return state
})

if (!provider) throw Error('No provider found')
if (!addressFrom) throw Error('No address found')

function sendTransaction() {
  const tx = {
    from: addressFrom,
    to: '0x...', // any address
    value: parseEther('0.0001')
  }
  const ethersProvider = new BrowserProvider(provider)
  const signer = await ethersProvider.getSigner()
  const tx = await signer.sendTransaction(tx)
  console.log('transaction:', tx)
}
```

</Tab>
<Tab title="Solana">
  <SolanaPrograms />
</Tab>
</Tabs>

## Alternative Installation

If you are starting from scratch, you can use the following methods to set up your project with Reown AppKit.

<AccordionGroup>
<Accordion title="AppKit Skills">
  AppKit Skills provide AI-powered assistance for building with Reown AppKit. Once installed, your AI coding assistant can help you set up, build, and debug your AppKit integration.

To install AppKit Skills, run the following command in your terminal:

```bash
npx skills add https://github.com/reown-com/skills --skill appkit --agent '*'
```

After installation, you can ask your AI assistant for help with AppKit setup, implementation, and troubleshooting.

</Accordion>
<Accordion title="AppKit CLI">
  Reown offers a dedicated CLI to set up a minimal version of AppKit in the easiest and quickest way possible.

To do this, please run the command below.

```bash
npx @reown/appkit-cli
```

After running the command, you will be prompted to confirm the installation of the CLI. Upon your confirmation, the CLI will request the following details:

1. **Project Name**: Enter the name for your project.
2. **Framework**: Select your preferred framework or library. Currently, you have three options: React, Next.js, and Vue.
3. **Network-Specific libraries**: Choose whether you want to install Wagmi, Ethers, Solana, or Multichain (EVM + Solana).

After providing the project name and selecting your preferences, the CLI will install a minimal example of AppKit with your preferred blockchain library. The example will be pre-configured with a `projectId` that will only work on `localhost`.

To fully configure your project, please obtain a `projectId` from the Reown Dashboard and update your project accordingly.

**Refer to [this section](#cloud-configuration) for more information.**

</Accordion>
</AccordionGroup>
