> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reown.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

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 theme={null}
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">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @reown/appkit @reown/appkit-adapter-wagmi wagmi viem
      ```

      ```bash Yarn theme={null}
      yarn add @reown/appkit @reown/appkit-adapter-wagmi wagmi viem
      ```

      ```bash Bun theme={null}
      bun add @reown/appkit @reown/appkit-adapter-wagmi wagmi viem
      ```

      ```bash pnpm theme={null}
      pnpm add @reown/appkit @reown/appkit-adapter-wagmi wagmi viem
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Ethers v5">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
      ```

      ```bash Yarn theme={null}
      yarn add @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
      ```

      ```bash Bun theme={null}
      bun add @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
      ```

      ```bash pnpm theme={null}
      pnpm add @reown/appkit @reown/appkit-adapter-ethers5 ethers@5.7.2
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Ethers">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @reown/appkit @reown/appkit-adapter-ethers ethers
      ```

      ```bash Yarn theme={null}
      yarn add @reown/appkit @reown/appkit-adapter-ethers ethers
      ```

      ```bash Bun theme={null}
      bun add @reown/appkit @reown/appkit-adapter-ethers ethers
      ```

      ```bash pnpm theme={null}
      pnpm add @reown/appkit @reown/appkit-adapter-ethers ethers
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Solana">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @reown/appkit @reown/appkit-adapter-solana
      ```

      ```bash Yarn theme={null}
      yarn add @reown/appkit @reown/appkit-adapter-solana
      ```

      ```bash Bun theme={null}
      bun add @reown/appkit @reown/appkit-adapter-solana
      ```

      ```bash pnpm theme={null}
      pnpm add @reown/appkit @reown/appkit-adapter-solana
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Bitcoin">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @reown/appkit @reown/appkit-adapter-bitcoin
      ```

      ```bash Yarn theme={null}
      yarn add @reown/appkit @reown/appkit-adapter-bitcoin
      ```

      ```bash Bun theme={null}
      bun add @reown/appkit @reown/appkit-adapter-bitcoin
      ```

      ```bash pnpm theme={null}
      pnpm add @reown/appkit @reown/appkit-adapter-bitcoin
      ```
    </CodeGroup>
  </Tab>

  <Tab title="TON">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @reown/appkit @reown/appkit-adapter-ton
      ```

      ```bash Yarn theme={null}
      yarn add @reown/appkit @reown/appkit-adapter-ton
      ```

      ```bash Bun theme={null}
      bun add @reown/appkit @reown/appkit-adapter-ton
      ```

      ```bash pnpm theme={null}
      pnpm add @reown/appkit @reown/appkit-adapter-ton
      ```
    </CodeGroup>
  </Tab>

  <Tab title="TRON">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @reown/appkit @reown/appkit-adapter-tron
      ```

      ```bash Yarn theme={null}
      yarn add @reown/appkit @reown/appkit-adapter-tron
      ```

      ```bash Bun theme={null}
      bun add @reown/appkit @reown/appkit-adapter-tron
      ```

      ```bash pnpm theme={null}
      pnpm add @reown/appkit @reown/appkit-adapter-tron
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Others networks (AppKit Core)">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @reown/appkit @reown/appkit-universal-connector @reown/appkit-common ethers
      ```

      ```bash Yarn theme={null}
      yarn add @reown/appkit @reown/appkit-universal-connector @reown/appkit-common ethers
      ```

      ```bash Bun theme={null}
      bun add @reown/appkit @reown/appkit-universal-connector @reown/appkit-common ethers
      ```

      ```bash pnpm theme={null}
      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.

<Card title="Don't have a project ID?" icon="circle-info" href="https://dashboard.reown.com/?utm_source=cloud_banner&utm_medium=docs&utm_campaign=backlinks">
  Head over to Reown Dashboard and create a new project.
</Card>

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

    For a quick integration, you can use the `createAppKit` function with a unified configuration. This automatically applies the predefined configurations for different adapters like Wagmi, Ethers, or Solana, so you no longer need to manually configure each one individually. Simply pass the common parameters such as `projectId`, `chains`, `metadata`, etc., and the function will handle the adapter-specific configurations under the hood.

    This includes WalletConnect, Coinbase and Injected connectors, and the [Blockchain API](../../../../cloud/blockchain-api) as a [transport](https://wagmi.sh/core/api/createConfig#transports)

    In your `main.js` file set up the following configuration.

    ```ts theme={null}
    import { createAppKit } from '@reown/appkit'
    import { mainnet, arbitrum } from '@reown/appkit/networks'
    import { WagmiAdapter } from '@reown/appkit-adapter-wagmi'

    // 1. Get a project ID at https://dashboard.reown.com
    const projectId = 'YOUR_PROJECT_ID'

    export const networks = [mainnet, arbitrum]

    // 2. Set up Wagmi adapter
    const wagmiAdapter = new WagmiAdapter({
      projectId,
      networks
    })

    // 3. Configure the metadata
    const metadata = {
      name: 'AppKit',
      description: 'AppKit Example',
      url: 'https://example.com', // origin must match your domain & subdomain
      icons: ['https://avatars.githubusercontent.com/u/179229932']
    }

    // 3. Create the modal
    const modal = createAppKit({
      adapters: [wagmiAdapter],
      networks: [mainnet, arbitrum],
      metadata,
      projectId,
      features: {
        analytics: true // Optional - defaults to your Cloud configuration
      }
    })

    // 4. Trigger modal programaticaly
    const openConnectModalBtn = document.getElementById('open-connect-modal')
    const openNetworkModalBtn = document.getElementById('open-network-modal')

    openConnectModalBtn.addEventListener('click', () => modal.open())
    openNetworkModalBtn.addEventListener('click', () => modal.open({ view: 'Networks' }))

    // 5. Alternatively use w3m component buttons within the index.html file
    ```

    ## Importing networks

    Reown AppKit use [Viem](https://viem.sh/) networks under the hood, which provide a wide variety of networks for EVM chains. You can find all the networks supported by Viem within the `@reown/appkit/networks` path.

    ```js {2} theme={null}
    import { createAppKit } from '@reown/appkit'
    import { mainnet, arbitrum, base, scroll, polygon } from '@reown/appkit/networks'
    ```

    <Note>
      Looking to add a custom network? Check out the [custom networks](/appkit/javascript/core/custom-networks) section.
    </Note>
  </Tab>

  <Tab title="Ethers v5">
    In your `main.js` file set up the following configuration.

    ```ts theme={null}
    import { createAppKit } from "@reown/appkit";
    import { Ethers5Adapter } from "@reown/appkit-adapter-ethers5";
    import { mainnet, arbitrum } from "@reown/appkit/networks";

    // 1. Get projectId at https://dashboard.reown.com
    const projectId = "YOUR_PROJECT_ID";

    // 2. Create your application's metadata object
    const metadata = {
      name: "My Website",
      description: "My Website description",
      url: "https://mywebsite.com", // url must match your domain & subdomain
      icons: ["https://avatars.mywebsite.com/"],
    };

    // 3. Create a AppKit instance
    const modal = createAppKit({
      adapters: [new Ethers5Adapter()],
      metadata: metadata,
      networks: [mainnet, arbitrum],
      projectId,
      features: {
        analytics: true, // Optional - defaults to your Cloud configuration
      },
    });
    ```

    <Warning>
      Make sure that the `url` from the `metadata` matches your domain and subdomain. This will later be used by the **Verify API** to tell wallets if your application has been verified or not.
    </Warning>
  </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>

    In your `main.js` file set up the following configuration.

    ```ts theme={null}
    import { createAppKit } from "@reown/appkit";
    import { EthersAdapter } from "@reown/appkit-adapter-ethers";
    import { mainnet, arbitrum } from "@reown/appkit/networks";

    // 1. Get projectId from https://dashboard.reown.com
    const projectId = "YOUR_PROJECT_ID";

    // 2. Create your application's metadata object
    const metadata = {
      name: "AppKit",
      description: "AppKit Example",
      url: "https://reown.com/appkit", // origin must match your domain & subdomain
      icons: ["https://avatars.githubusercontent.com/u/179229932"],
    };

    // 3. Create a AppKit instance
    const modal = createAppKit({
      adapters: [new EthersAdapter()],
      networks: [mainnet, arbitrum],
      metadata,
      projectId,
      features: {
        analytics: true, // Optional - defaults to your Cloud configuration
      },
    });
    ```

    <Warning>
      Make sure that the `url` from the `metadata` matches your domain and subdomain. This will later be used by the **Verify API** to tell wallets if your application has been verified or not.
    </Warning>
  </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>

    AppKit Solana is built on top of the AppKit library and provides a set of components and actions to easily connect Solana wallets with your application.

    On top of your app set up the following configuration.

    ```tsx theme={null}
    import { createAppKit } from "@reown/appkit";
    import { SolanaAdapter } from "@reown/appkit-adapter-solana";
    import { solana, solanaTestnet, solanaDevnet } from "@reown/appkit/networks";

    // 0. Set up Solana Adapter
    const solanaWeb3JsAdapter = new SolanaAdapter();

    // 1. Get projectId from https://dashboard.reown.com
    const projectId = "YOUR_PROJECT_ID";

    // 2. Create a metadata object - optional
    const metadata = {
      name: "AppKit",
      description: "AppKit Solana Example",
      url: "https://example.com", // origin must match your domain & subdomain
      icons: ["https://avatars.githubusercontent.com/u/179229932"],
    };

    // 3. Create modal
    createAppKit({
      adapters: [solanaWeb3JsAdapter],
      networks: [solana, solanaTestnet, solanaDevnet],
      metadata: metadata,
      projectId,
      features: {
        analytics: true, // Optional - defaults to your Cloud configuration
      },
    });
    ```
  </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>

    AppKit Bitcoin is built on top of the AppKit library and provides a set of components and actions to easily connect Bitcoin wallets with your decentralized application.

    On top of your app set up the following configuration.

    ```tsx theme={null}
    // App.tsx
    import { createAppKit } from '@reown/appkit'
    import { BitcoinAdapter } from '@reown/appkit-adapter-bitcoin'
    import { bitcoin, bitcoinTestnet, bitcoinSignet } from '@reown/appkit/networks'

    // 1. Get projectId from https://dashboard.reown.com
    const projectId = 'YOUR_PROJECT_ID'

    // 2. Set the networks
    const networks = [bitcoin, bitcoinTestnet, bitcoinSignet]

    // 3. Set up Bitcoin Adapter
    const bitcoinAdapter = new BitcoinAdapter({
      projectId
    })

    // 4. Create a metadata object - optional
    const metadata = {
      name: 'AppKit',
      description: 'AppKit Bitcoin Example',
      url: 'https://example.com', // origin must match your domain & subdomain
      icons: ['https://avatars.githubusercontent.com/u/179229932']
    }

    // 5. Create modal
    const modal = createAppKit({
      adapters: [bitcoinAdapter],
      networks,
      metadata,
      projectId,
      features: {
        analytics: true // Optional - defaults to your Dashboard configuration,
        email: false,
        socials: []
      }
    })

    // 6. Trigger modal programaticaly
    const openConnectModalBtn = document.getElementById('open-connect-modal')
    const openNetworkModalBtn = document.getElementById('open-network-modal')

    openConnectModalBtn.addEventListener('click', () => modal.open())
    openNetworkModalBtn.addEventListener('click', () => modal.open({ view: 'Networks' }))
    ```

    ## Bitcoin Provider Interface

    ```ts theme={null}
    export interface BitcoinConnector extends ChainAdapterConnector, Provider {
      getAccountAddresses(): Promise<BitcoinConnector.AccountAddress[]>;
      signMessage(params: BitcoinConnector.SignMessageParams): Promise<string>;
      sendTransfer(params: BitcoinConnector.SendTransferParams): Promise<string>;
      signPSBT(
        params: BitcoinConnector.SignPSBTParams
      ): Promise<BitcoinConnector.SignPSBTResponse>;
    }
    ```

    ### Parameters

    <Tabs>
      <Tab title="SignMessageParams">
        ```ts theme={null}
          export type SignMessageParams = {
            /**
             * The message to be signed
             */
            message: string
            /**
             * The address to sign the message with
             */
            address: string
          }
        ```
      </Tab>

      <Tab title="SendTransferParams">
        ```ts theme={null}
          export type SendTransferParams = {
            /**
             * The amount to be sent in satoshis
             */
            amount: string
            /**
             * The address to send the transfer to
             */
            recipient: string
          }
        ```
      </Tab>

      <Tab title="SignPSBTParams">
        ```ts theme={null}
          export type SignPSBTParams = {
            /**
             * The PSBT to be signed, string base64 encoded
             */
            psbt: string
            signInputs: {
              /**
               * The address whose private key to use for signing.
               */
              address: string
              /**
               * Specifies which input to sign
               */
              index: number
              /**
               * Specifies which part(s) of the transaction the signature commits to
               */
              sighashTypes: number[]
            }[]

            /**
             * If `true`, the PSBT will be broadcasted after signing. Default is `false`.
             */
            broadcast?: boolean

        }

        ```
      </Tab>
    </Tabs>

    ### Responses

    <Tabs>
      <Tab title="AccountAddress">
        ```ts theme={null}
          export type AccountAddress = {
            /**
             * Public address belonging to the account.
             */
            address: string
            /**
             * Public key for the derivation path in hex, without 0x prefix
             */
            publicKey?: string
            /**
             * The derivation path of the address e.g. "m/84'/0'/0'/0/0"
             */
            path?: string
            /**
             * The purpose of the address
             */
            purpose: 'payment' | 'ordinal' | 'stx'
          }
        ```
      </Tab>

      <Tab title="SignPSBTResponse">
        ```ts theme={null}
          export type SignPSBTResponse = {
            /**
             * The signed PSBT, string base64 encoded
             */
            psbt: string
            /**
             * The `string` transaction id of the broadcasted transaction or `undefined` if not broadcasted
             */
            txid?: string
          }
        ```
      </Tab>
    </Tabs>
  </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>

    AppKit TON is built on top of the AppKit library and provides a set of components and actions to easily connect TON wallets with your decentralized application.

    On top of your app set up the following configuration.

    ```tsx theme={null}
    // App.tsx
    import { createAppKit } from '@reown/appkit'
    import { TonAdapter } from '@reown/appkit-adapter-ton'
    import { ton, tonTestnet } from '@reown/appkit/networks'

    // 1. Get projectId from https://dashboard.reown.com
    const projectId = 'YOUR_PROJECT_ID'

    // 2. Set the networks
    const networks = [ton, tonTestnet]

    // 3. Set up TON Adapter
    const tonAdapter = new TonAdapter({
      projectId
    })

    // 4. Create a metadata object - optional
    const metadata = {
      name: 'AppKit',
      description: 'AppKit TON Example',
      url: 'https://example.com', // origin must match your domain & subdomain
      icons: ['https://avatars.githubusercontent.com/u/179229932']
    }

    // 5. Create modal
    const modal = createAppKit({
      adapters: [tonAdapter],
      networks,
      metadata,
      projectId,
      features: {
        analytics: true // Optional - defaults to your Dashboard configuration,
        email: false,
        socials: []
      }
    })

    // 6. Trigger modal programmatically
    const openConnectModalBtn = document.getElementById('open-connect-modal')
    const openNetworkModalBtn = document.getElementById('open-network-modal')

    openConnectModalBtn.addEventListener('click', () => modal.open())
    openNetworkModalBtn.addEventListener('click', () => modal.open({ view: 'Networks' }))
    ```
  </Tab>

  <Tab title="TRON">
    AppKit TRON is built on top of the AppKit library and provides a set of components and actions to easily connect TRON wallets with your decentralized application.

    On top of your app set up the following configuration.

    ```tsx theme={null}
    // App.tsx
    import { createAppKit } from '@reown/appkit'
    import { TronAdapter } from '@reown/appkit-adapter-tron'
    import { tronMainnet, tronShastaTestnet } from '@reown/appkit/networks'

    // Import wallet adapters you want to support
    import { TronLinkAdapter } from '@tronweb3/tronwallet-adapter-tronlink'

    // 1. Get projectId from https://dashboard.reown.com
    const projectId = 'YOUR_PROJECT_ID'

    // 2. Set the networks
    const networks = [tronMainnet, tronShastaTestnet]

    // 3. Set up TRON Adapter with wallet adapters
    const tronAdapter = new TronAdapter({
      walletAdapters: [
        new TronLinkAdapter({
          openUrlWhenWalletNotFound: false,
          checkTimeout: 3000
        })
      ]
    })

    // 4. Create a metadata object - optional
    const metadata = {
      name: 'AppKit',
      description: 'AppKit TRON Example',
      url: 'https://example.com', // origin must match your domain & subdomain
      icons: ['https://avatars.githubusercontent.com/u/179229932']
    }

    // 5. Create modal
    const modal = createAppKit({
      adapters: [tronAdapter],
      networks,
      metadata,
      projectId,
      features: {
        analytics: true, // Optional - defaults to your Dashboard configuration
        email: false,
        socials: []
      }
    })

    // 6. Trigger modal programaticaly
    const openConnectModalBtn = document.getElementById('open-connect-modal')
    const openNetworkModalBtn = document.getElementById('open-network-modal')

    openConnectModalBtn.addEventListener('click', () => modal.open())
    openNetworkModalBtn.addEventListener('click', () => modal.open({ view: 'Networks' }))
    ```

    ## Install Wallet Adapters

    TRON adapter requires you to install wallet adapters separately. This gives you control over which wallets to support and reduces bundle size.

    <Tabs>
      <Tab title="TronLink">
        <CodeGroup>
          ```bash npm theme={null}
          npm install @tronweb3/tronwallet-adapter-tronlink
          ```

          ```bash Yarn theme={null}
          yarn add @tronweb3/tronwallet-adapter-tronlink
          ```

          ```bash Bun theme={null}
          bun add @tronweb3/tronwallet-adapter-tronlink
          ```

          ```bash pnpm theme={null}
          pnpm add @tronweb3/tronwallet-adapter-tronlink
          ```
        </CodeGroup>
      </Tab>

      <Tab title="MetaMask">
        <CodeGroup>
          ```bash npm theme={null}
          npm install @tronweb3/tronwallet-adapter-metamask-tron
          ```

          ```bash Yarn theme={null}
          yarn add @tronweb3/tronwallet-adapter-metamask-tron
          ```

          ```bash Bun theme={null}
          bun add @tronweb3/tronwallet-adapter-metamask-tron
          ```

          ```bash pnpm theme={null}
          pnpm add @tronweb3/tronwallet-adapter-metamask-tron
          ```
        </CodeGroup>
      </Tab>

      <Tab title="Trust Wallet">
        <CodeGroup>
          ```bash npm theme={null}
          npm install @tronweb3/tronwallet-adapter-trust
          ```

          ```bash Yarn theme={null}
          yarn add @tronweb3/tronwallet-adapter-trust
          ```

          ```bash Bun theme={null}
          bun add @tronweb3/tronwallet-adapter-trust
          ```

          ```bash pnpm theme={null}
          pnpm add @tronweb3/tronwallet-adapter-trust
          ```
        </CodeGroup>
      </Tab>

      <Tab title="OKX Wallet">
        <CodeGroup>
          ```bash npm theme={null}
          npm install @tronweb3/tronwallet-adapter-okxwallet
          ```

          ```bash Yarn theme={null}
          yarn add @tronweb3/tronwallet-adapter-okxwallet
          ```

          ```bash Bun theme={null}
          bun add @tronweb3/tronwallet-adapter-okxwallet
          ```

          ```bash pnpm theme={null}
          pnpm add @tronweb3/tronwallet-adapter-okxwallet
          ```
        </CodeGroup>
      </Tab>

      <Tab title="BitKeep">
        <CodeGroup>
          ```bash npm theme={null}
          npm install @tronweb3/tronwallet-adapter-bitkeep
          ```

          ```bash Yarn theme={null}
          yarn add @tronweb3/tronwallet-adapter-bitkeep
          ```

          ```bash Bun theme={null}
          bun add @tronweb3/tronwallet-adapter-bitkeep
          ```

          ```bash pnpm theme={null}
          pnpm add @tronweb3/tronwallet-adapter-bitkeep
          ```
        </CodeGroup>
      </Tab>

      <Tab title="Binance Wallet">
        <CodeGroup>
          ```bash npm theme={null}
          npm install @tronweb3/tronwallet-adapter-binance
          ```

          ```bash Yarn theme={null}
          yarn add @tronweb3/tronwallet-adapter-binance
          ```

          ```bash Bun theme={null}
          bun add @tronweb3/tronwallet-adapter-binance
          ```

          ```bash pnpm theme={null}
          pnpm add @tronweb3/tronwallet-adapter-binance
          ```
        </CodeGroup>
      </Tab>
    </Tabs>

    <Note>
      For a complete list of available TRON wallet adapters, visit the [official wallet adapter documentation](https://walletadapter.org/docs/guide/wallet-reference.html).
    </Note>

    ### Using Multiple Wallet Adapters

    After installing your desired wallet adapters, import and add them to the `walletAdapters` array when creating the TRON adapter:

    ```tsx theme={null}
    import { TronLinkAdapter } from '@tronweb3/tronwallet-adapter-tronlink'
    import { MetaMaskAdapter } from '@tronweb3/tronwallet-adapter-metamask-tron'
    import { TrustAdapter } from '@tronweb3/tronwallet-adapter-trust'
    import { OkxWalletAdapter } from '@tronweb3/tronwallet-adapter-okxwallet'

    const tronAdapter = new TronAdapter({
      walletAdapters: [
        new TronLinkAdapter({
          openUrlWhenWalletNotFound: false,
          checkTimeout: 3000
        }),
        new MetaMaskAdapter(),
        new TrustAdapter(),
        new OkxWalletAdapter({
          openUrlWhenWalletNotFound: false
        })
      ]
    })
    ```
  </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>

    For a quick integration of Appkit Core you can use the `UniversalConnector` class. Which simplifies the integration of Appkit Core by providing a single interface for all the blockchain protocols.

    You can configure the Universal Connector with the networks you want to support.
    For more information, please visit [RPC Reference](https://docs.reown.com/advanced/multichain/rpc-reference/cosmos-rpc) section from our docs.

    We recommend creating a config file to establish a singleton instance for the Universal Connector:

    ```tsx theme={null}
    import { UniversalConnector } from '@reown/appkit-universal-connector'

    export const projectId = import.meta.env.VITE_PROJECT_ID || "b56e18d47c72ab683b10814fe9495694" // this is a public projectId only to use on localhost
    if (!projectId) {
      throw new Error('Project ID is not defined')
    }

    // you can configure your own network
    const suiMainnet = {
      id: 784,
      chainNamespace: 'sui',
      caipNetworkId: 'sui:mainnet',
      name: 'Sui',
      nativeCurrency: { name: 'SUI', symbol: 'SUI', decimals: 9 },
      rpcUrls: { default: { http: ['https://fullnode.mainnet.sui.io:443'] } }
    }

    const stacksMainnet = {
      id: 1,
      chainNamespace: 'stacks',
      caipNetworkId: 'stacks:1',
      name: 'Stacks',
      nativeCurrency: { name: 'STX', symbol: 'STX', decimals: 6 },
      rpcUrls: { default: { http: ['https://stacks-node-mainnet.stacks.co'] } }
    }


    export const networks = [suiMainnet, stacksMainnet]

    export let universalConnector

    export async function getUniversalConnector() {
      if (!universalConnector) {
        universalConnector = await UniversalConnector.init({
          projectId,
          metadata: {
            name: 'Universal Connector',
            description: 'Universal Connector',
            url: 'https://appkit.reown.com',
            icons: ['https://appkit.reown.com/icon.png']
          },
          networks: [
            {
              methods: ['sui_signPersonalMessage'],
              chains: [suiMainnet],
              events: [],
              namespace: 'sui'
            },
            {
              methods: ['stx_signMessage'],
              chains: [stacksMainnet],
              events: ['stx_chainChanged'],
              namespace: 'stacks'
            }
          ]
        })
      }
      return universalConnector
    }
    ```

    In de main.js file you can add :

    ```tsx theme={null}
    import { getUniversalConnector } from './config/appKit.js'

    async function setup() {
      const universalConnector = await getUniversalConnector()

      // check if session is already connected
      if (universalConnector?.provider.session) {
        session = universalConnector?.provider.session
      }
    }

    setup() 
    ```
  </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 theme={null}
      <!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 theme={null}
      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 theme={null}
    <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 theme={null}
      npm install @wagmi/core
      ```

      ```bash Yarn theme={null}
      yarn add @wagmi/core
      ```

      ```bash Bun theme={null}
      bun a @wagmi/core
      ```

      ```bash pnpm theme={null}
      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 theme={null}
    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 theme={null}
    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">
    [@Solana/web3.js](https://solana.com/docs/clients/javascript) library allows for seamless interaction with wallets and smart contracts on the Solana blockchain.

    For a practical example of how it works, you can refer to our [lab dApp](https://appkit-lab.reown.com/appkit/?name=solana).

    ```js theme={null}
    import { PublicKey, LAMPORTS_PER_SOL, Transaction, SystemProgram } from "@solana/web3.js";

    import type { Provider } from '@reown/appkit-adapter-solana'

    const solanaProvider = {};
    const solanaConnection = {};
    modal.subscribeProviders(state => {
        solanaProvider = state['solana'];
        const url = solanaProvider.getActiveChain().rpcUrls.default.http[0];
        const solanaConnection = new Connection(url);
    })

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

    const sendTransaction = async () => {
      if (!addressFrom || !solanaConnection) throw Error('user is disconnected');

      const wallet = new PublicKey(addressFrom);
      if (!wallet) throw Error('wallet provider is not available');

      const latestBlockhash = await solanaConnection.getLatestBlockhash();

      const transaction = new Transaction({
        feePayer: wallet,
        recentBlockhash: latestBlockhash?.blockhash,
      }).add(
        SystemProgram.transfer({
          fromPubkey: wallet,
          toPubkey: new PublicKey(address), // destination address
          lamports: 1000,
        })
      );

      return await provider.sendTransaction(transaction, solanaConnection);
    }

    const getBalance = async () => {
      if (!addressFrom || !solanaConnection) throw Error('user is disconnected');

      const wallet = new PublicKey(addressFrom);
      const balance = await solanaConnection?.getBalance(wallet);
      if (balance !== undefined) {
        return `${balance / LAMPORTS_PER_SOL}`;
      } else {
        return '-';
      }
    }
    ```
  </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 theme={null}
    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 theme={null}
    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>
