Skip to content

Quickstart ​

Integrate the embedded wallet in just a few lines of code.

Installation ​

Install the two packages used by the React example from the public npm registry using npm's default configuration.

sh
npm install @drop-wallet/core @drop-wallet/react

Use @drop-wallet/core on its own for a framework-independent integration. For Vue, see the Vue quickstart.

Usage ​

Call createWallet at the top level of your application with your appId and the providers you want to expose. This creates the hidden iframe and wires up the postMessage transport.

Next, wrap your application in the <WalletProvider> context provider and render the <WalletWidget> somewhere in your layout:

tsx
// src/index.tsx
import { createWallet } from '@drop-wallet/core'
import { WalletProvider, WalletWidget } from '@drop-wallet/react'
import { createRoot } from 'react-dom/client'

import App from './App'

const wallet = createWallet({
  appId: '<YOUR_APP_ID>', // Only required for production, see "App ID" below.
  providers: {
    ethereum: true,
    // solana: true,
    // bitcoin: true,
  },
})

const root = createRoot(document.getElementById('root')!)
root.render(
  <WalletProvider wallet={wallet}>
    <WalletWidget />
    <App />
  </WalletProvider>,
)

INFO

The widget stays invisible and only renders once the user connects the wallet. Place it somewhere that is always mounted — typically at the root of your layout, next to <App />.

Vue ​

The Vue bindings require Vue 3.5 or later. After the first public @drop-wallet/vue release, install both packages from npm.

sh
npm install @drop-wallet/core @drop-wallet/vue

Initialize the wallet in the root component's onMounted hook so it creates the iframe in the browser. Keep the wallet in a shallowRef and pass it to <WalletProvider>.

vue
<!-- App.vue -->
<script setup lang="ts">
import { createWallet, type Wallet } from '@drop-wallet/core'
import { WalletProvider, WalletWidget } from '@drop-wallet/vue'
import { onMounted, shallowRef } from 'vue'

import ConnectWallet from './ConnectWallet.vue'

const wallet = shallowRef<Wallet>()

onMounted(() => {
  wallet.value = createWallet({
    providers: { solana: true },
  })
})
</script>

<template>
  <WalletProvider v-if="wallet" :wallet="wallet">
    <ConnectWallet />
    <WalletWidget />
  </WalletProvider>
</template>

Call connect() from a click handler so the browser can open the signer popup. useWallet() and useConnected() return Vue refs. The widget appears after the wallet connects.

vue
<!-- ConnectWallet.vue -->
<script setup lang="ts">
import { useConnected, useWallet } from '@drop-wallet/vue'
import { ref } from 'vue'

const wallet = useWallet()
const connected = useConnected()
const connecting = ref(false)
const error = ref('')

async function connect() {
  if (connected.value || connecting.value) return

  connecting.value = true
  error.value = ''

  try {
    const solana = await wallet.value.getProvider('solana')
    if (!solana) throw new Error('The Solana provider is unavailable')
    await solana.connect()
  } catch {
    error.value = 'Could not connect to Drop Wallet. Try again.'
  } finally {
    connecting.value = false
  }
}
</script>

<template>
  <button
    type="button"
    :aria-disabled="connected || connecting"
    @click="connect"
  >
    {{ connecting ? 'Connecting…' : 'Connect Drop Wallet' }}
  </button>
  <p role="status">
    {{ error || (connected ? 'Drop Wallet connected.' : '') }}
  </p>
</template>

App ID ​

appId is a UUID that identifies your integration. It drives per-dApp settings — allowed parent origins (frame-ancestors CSP), which additional assets to surface, feature flags — and is enforced at the Drop wallet edge.

During local development you can omit it: the wallet will load with a localhost-only allow-list.

When you're ready to ship to production, register an App ID. See the App ID guide for the registration flow.

Next steps ​