Guide

Vue / Nuxt

Integrate Buff with Solana wallet adapter or Reown.

Install

$npm install @buff/sdk solana-wallets-vueCopy

Composable

useBuff.ts
typescript
1import { ref, watch } from 'vue'
2import { useWallet } from 'solana-wallets-vue'
3import { Buff } from '@buff/sdk'
4
5export function useBuff(platformId: string) {
6 const buff = ref<Buff | null>(null)
7 const { signMessage, publicKey } = useWallet()
8
9 watch([signMessage, publicKey], async ([sign, pk]) => {
10 if (!sign || !pk) { buff.value = null; return }
11 buff.value = await Buff.init({
12 platformId,
13 signMessage: (msg) => sign(msg),
14 plan: 'sprout',
15 investInto: 'BTC',
16 })
17 }, { immediate: true })
18
19 return { buff }
20}
Note
Both approaches use the same Buff SDK. Only the signMessage source differs.