0.1.752 • Published 9 months ago

@alphabatem/vue2-wallet-adapter v0.1.752

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

vue2-wallet-adapter

Solana Wallet Adapter for Vue 2

Fork of Vue3 Wallet adapter by @lorisleiva:

https://github.com/lorisleiva/solana-wallets-vue

Solana Wallets Vue

Integrates Solana wallets in your Vue 3 applications.

⚡️ View demo / Browse demo code

Installation

To get started, you'll need to install the @alphabatem/vue2-wallet-adapter npm package as well as the wallets adapters provided by Solana.

yarn add @alphabatem/vue2-wallet-adapter @solana/wallet-adapter-wallets

Setup

You can initialise the wallet store manually using the initWallet method like so.

import { initWallet } from 'solana-wallets-vue';
initWallet(walletOptions);

Finally, import and render the WalletMultiButton component to allow users to select a wallet et connect to it.

<script setup>
import { WalletMultiButton } from 'solana-wallets-vue'
</script>

<template>
  <wallet-multi-button></wallet-multi-button>
</template>

If you prefer the dark mode, simply provide the dark boolean props to the component above.

<wallet-multi-button dark></wallet-multi-button>

Usage

You can then call useWallet() at any time to access the wallet store — or access the $wallet global propery instead.

Here's an example of a function that sends one lamport to a random address.

import { useWallet } from 'solana-wallets-vue';
import { Connection, clusterApiUrl, Keypair, SystemProgram, Transaction } from '@solana/web3.js';

export const sendOneLamportToRandomAddress = () => {
  const connection = new Connection(clusterApiUrl('devnet'))
  const { publicKey, sendTransaction } = useWallet();
  if (!publicKey.value) return;

  const transaction = new Transaction().add(
    SystemProgram.transfer({
      fromPubkey: publicKey.value,
      toPubkey: Keypair.generate().publicKey,
      lamports: 1,
    })
  );

  const signature = await sendTransaction(transaction, connection);
  await connection.confirmTransaction(signature, 'processed');
};
0.1.7281

9 months ago

0.1.7280

9 months ago

0.1.749

9 months ago

0.1.748

9 months ago

0.1.7203

9 months ago

0.1.7202

9 months ago

0.1.7205

9 months ago

0.1.7204

9 months ago

0.1.752

9 months ago

0.1.7207

9 months ago

0.1.751

9 months ago

0.1.7206

9 months ago

0.1.7209

9 months ago

0.1.7208

9 months ago

0.1.7283

9 months ago

0.1.7282

9 months ago

0.1.750

9 months ago

0.1.7285

9 months ago

0.1.7284

9 months ago

0.1.7287

9 months ago

0.1.7286

9 months ago

0.1.7289

9 months ago

0.1.7201

9 months ago

0.1.7288

9 months ago

0.1.7200

9 months ago

0.1.7270

9 months ago

0.1.7309

9 months ago

0.1.7313

9 months ago

0.1.7312

9 months ago

0.1.7279

9 months ago

0.1.7315

9 months ago

0.1.7314

9 months ago

0.1.7272

9 months ago

0.1.7271

9 months ago

0.1.7274

9 months ago

0.1.7273

9 months ago

0.1.7276

9 months ago

0.1.7275

9 months ago

0.1.7311

9 months ago

0.1.7278

9 months ago

0.1.7310

9 months ago

0.1.7277

9 months ago

0.1.7225

9 months ago

0.1.7224

9 months ago

0.1.7227

9 months ago

0.1.7226

9 months ago

0.1.7229

9 months ago

0.1.7228

9 months ago

0.1.7221

9 months ago

0.1.7220

9 months ago

0.1.7223

9 months ago

0.1.7222

9 months ago

0.1.7290

9 months ago

0.1.7292

9 months ago

0.1.7291

9 months ago

0.1.7214

9 months ago

0.1.701

9 months ago

0.1.7213

9 months ago

0.1.7216

9 months ago

0.1.703

9 months ago

0.1.7215

9 months ago

0.1.702

9 months ago

0.1.7218

9 months ago

0.1.7217

9 months ago

0.1.7219

9 months ago

0.1.7294

9 months ago

0.1.7293

9 months ago

0.1.7296

9 months ago

0.1.7295

9 months ago

0.1.7298

9 months ago

0.1.7210

9 months ago

0.1.7297

9 months ago

0.1.7212

9 months ago

0.1.7299

9 months ago

0.1.7211

9 months ago

0.1.704

9 months ago

0.1.712

9 months ago

0.1.711

9 months ago

0.1.714

9 months ago

0.1.713

9 months ago

0.1.710

9 months ago

0.1.7191

9 months ago

0.1.7193

9 months ago

0.1.7192

9 months ago

0.1.719

9 months ago

0.1.716

9 months ago

0.1.715

9 months ago

0.1.718

9 months ago

0.1.717

9 months ago

0.1.7236

9 months ago

0.1.7235

9 months ago

0.1.7195

9 months ago

0.1.7194

9 months ago

0.1.7230

9 months ago

0.1.7197

9 months ago

0.1.7196

9 months ago

0.1.7232

9 months ago

0.1.7199

9 months ago

0.1.7231

9 months ago

0.1.7198

9 months ago

0.1.7234

9 months ago

0.1.7233

9 months ago

0.1.74

9 months ago

0.1.7302

9 months ago

0.1.7269

9 months ago

0.1.7301

9 months ago

0.1.7268

9 months ago

0.1.7304

9 months ago

0.1.7303

9 months ago

0.1.7306

9 months ago

0.1.7305

9 months ago

0.1.7308

9 months ago

0.1.7307

9 months ago

0.1.7300

9 months ago

0.1.7267

9 months ago

0.1.745

9 months ago

0.1.7412

9 months ago

0.1.744

9 months ago

0.1.7411

9 months ago

0.1.747

9 months ago

0.1.746

9 months ago

0.1.7413

9 months ago

0.1.641

1 year ago

0.1.64

1 year ago

0.1.63

1 year ago

0.1.62

1 year ago

0.1.61

1 year ago

0.1.60

1 year ago

0.1.59

1 year ago

0.1.58

2 years ago

0.1.57

2 years ago

0.1.56

2 years ago

0.1.55

2 years ago

0.1.54

2 years ago

0.1.53

2 years ago

0.1.52

2 years ago

0.1.51

2 years ago

0.1.5

2 years ago

0.1.41

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago