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:

Last updated