Skip to main content

Overview

The Solana (SVM) wallet provider supports Phantom, Solflare, Backpack, and all Solana wallet adapter compatible wallets.

Installation

yarn add @layerswap/wallet-svm

Basic Usage

import { LayerswapProvider, Swap } from "@layerswap/widget"
import { createSVMProvider } from "@layerswap/wallet-svm"
import "@layerswap/widget/index.css"

export const App = () => {
  const svmProvider = createSVMProvider({
    walletConnectConfigs: {
      projectId: "YOUR_WALLETCONNECT_PROJECT_ID",
      name: "Your App Name",
      description: "Your app description",
      url: "https://yourapp.com",
      icons: ["https://yourapp.com/icon.png"]
    }
  })

  return (
    <LayerswapProvider
      walletProviders={[svmProvider]}
    >
      <Swap />
    </LayerswapProvider>
  )
}

Configuration

WalletConnect Configuration

The Solana provider requires WalletConnect configuration:
import { createSVMProvider } from "@layerswap/wallet-svm"
import type { WalletConnectConfig } from "@layerswap/wallet-svm"

const walletConnectConfigs: WalletConnectConfig = {
  projectId: string,      // Required: Your WalletConnect project ID
  name: string,           // Required: Your app name
  description: string,    // Required: Your app description
  url: string,            // Required: Your app URL
  icons: string[]         // Required: Array of logo URLs
}

const svmProvider = createSVMProvider({ walletConnectConfigs })
Get your WalletConnect project ID at WalletConnect Cloud.