SOL Pay
  • SOL Pay
  • Quick Start
  • Streams
  • Stake Pools
  • Reference
    • SDK Reference
      • connectNetwork
      • connectWallet
      • sendSolanaLamports
      • sendSolana
      • sendTokens
      • sendTokensDecimal
      • signTransaction
      • broadcastSerializedTransaction
      • streamLamports
      • backupStreamWallet
      • getStreamDetails
      • refillStream
      • pauseStream
      • resumeStream
      • closeStream
      • signMessage
      • getBalance
      • getTokenBalances
      • getAccountInfo
      • getAssociatedTokenAddress
      • getTokenBalance
      • tokens.getData
      • tokens.getTags
      • tokens.getToken
      • tokens.search
      • tokens.getRawUnvalidatedList
      • adapters
      • networks
    • API Reference
      • transaction.php
      • token_transaction.php
      • signature.php
  • Website
  • Source Code
Powered by GitBook
On this page
  • Parameters:
  • Returns:
  • Throws:
  • Side Effects:
  1. Reference
  2. SDK Reference

connectWallet

Connects to a Solana Web3 wallet:

(async() => {
    await SOLPay.connectWallet(); // {"address": "..."}
    await SOLPay.connectWallet(SOLPay.adapters.PHANTOM); // {"address": "..."}
})();

Parameters:

  • adapter (optional, default: SOLPay.adapters.CURRENT_ADAPTER || SOLPay.adapters.PHANTOM) - the wallet to use for the connection

    • Current Adapter: SOLPay.adapters.CURRENT_ADAPTER (or leave the adapter field blank)

    • Phantom: SOLPay.adapters.PHANTOM

    • Solflare: SOLPay.adapters.SOLFLARE

    • Slope: SOLPay.adapters.SLOPE

    • Glow: SOLPay.adapters.GLOW

    • Exodus: SOLPay.adapters.EXODUS

    • Brave: SOLPay.adapters.BRAVE

Adapters:

For more information on adapters, see adapters.

Returns:

object ({"address": "..."}) - the wallet details for the connected wallet

  • address: string ("...") - the address of the wallet

Throws:

  • SOL Pay SDK Fatal Error: Invalid adapter ${adapter}. - an invalid adapter was used

  • SOL Pay SDK Fatal Error: No adapter found. - could not find an adapter

  • SOL Pay SDK Fatal Error: Solana wallet not found! - could not find the wallet installed in the user's browser

  • SOL Pay SDK Fatal Error: Could not connect to Solana wallet! - could not connect to the wallet

Side Effects:

  • SOL Pay will attempt to open the wallet's official website in a new window if it cannot find the wallet installed in the browser (SOL Pay SDK Fatal Error: Solana wallet not found!).

PreviousconnectNetworkNextsendSolanaLamports

Last updated 2 years ago

Phantom:

Solflare:

Slope:

Glow:

Exodus:

Brave:

phantom.app
solflare.com
slope.finance
glow.app
www.exodus.com/browser-extension
brave.com/wallet