Skip to main content
Reown Docs

Installation

3 min read

Svelte#

AppKit has support for Wagmi and Ethers v6 on Ethereum, @solana/web3.js on Solana, Bitcoin, TON and TRON. Choose one of these to get started.

Note

We recommend using SvelteKit v5 to get started with AppKit Svelte.

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:

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

Warning

AppKit is only compatible with wagmi 2.x. Ensure you are using a compatible version.

Cloud Configuration#

Create a new project on Reown Dashboard and obtain a new project ID.

Don't have a project ID?

Head over to Reown Dashboard and create a new project.

Implementation#

Svelte Wagmi Example

Check the Svelte Wagmi example

For this example, we'll be using Wagmi and Viem.

Start by importing createAppKit from @reown/appkit and the necessary chains and WagmiAdapter from @reown/appkit-adapter-wagmi.

Note

Make sure to set your VITE_PROJECT_ID environment variable which you can get from Reown Dashboard.

Note

The browser check ensures AppKit is only initialized in the browser environment, which is important for SvelteKit's SSR compatibility.

Then import this configuration in your app layout to ensure AppKit is initialized:

Trigger the modal#

The recommended way to trigger the modal in Svelte is to use the <appkit-button /> web component. After setting up AppKit in your application, you can simply use the button component anywhere in your Svelte templates:

The <appkit-button /> is a web component that's automatically registered when AppKit is initialized. No additional imports are required.

Alternative approaches#

You can also trigger the modal programmatically using the AppKit instance:

Or use other AppKit web components:

The recommended way to trigger the modal is using the initializeAppKit function and web components:

You can also trigger the modal programmatically by calling the open method from AppKit instance:

You can select the modal's view when calling the open function:

Blockchain Interaction#

You need to install @wagmi/core to interact with smart contracts:

Wagmi actions can help us interact with wallets and smart contracts:

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

Read more about Wagmi actions for smart contract interaction here.

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:

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