⚑Vue Quick Start

Guide for using the @txnlab/use-wallet-vue package in your Vue project

The Vue adapter is a plugin that injects a WalletManager instance into the Vue app's context. It exposes a useWallet composable function, which lets you access the wallet manager from anywhere in your app.

Before proceeding with this Quick Start guide, please read the Get Started section for installation and configuration instructions.

WalletManagerPlugin

In the root of your application, install the plugin with your configuration object.

import { NetworkId, WalletId, WalletManagerPlugin } from '@txnlab/use-wallet-vue'
import { createApp } from 'vue'
import App from './App.vue'

const app = createApp(App)

// Install the plugin
app.use(WalletManagerPlugin, {
  wallets: [...],
  network: NetworkId.TESTNET
})

app.mount('#app')

Wallet Menu

Now, in any component you have access the wallet manager and its state via the useWallet composable. Here is an example of a basic wallet menu implementation:

Signing Transactions

To sign and send transactions, you can use the library's algodClient instance and the transactionSigner provided by the active wallet.

Example Applications

To see fully functioning Vue examples, check out these example apps:

Last updated