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 connectionCurrent Adapter:
SOLPay.adapters.CURRENT_ADAPTER(or leave the adapter field blank)Phantom:
SOLPay.adapters.PHANTOMSolflare:
SOLPay.adapters.SOLFLARESlope:
SOLPay.adapters.SLOPEGlow:
SOLPay.adapters.GLOWExodus:
SOLPay.adapters.EXODUSBrave:
SOLPay.adapters.BRAVE
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 usedSOL Pay SDK Fatal Error: No adapter found.- could not find an adapterSOL Pay SDK Fatal Error: Solana wallet not found!- could not find the wallet installed in the user's browserSOL 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!).Phantom: phantom.app
Solflare: solflare.com
Slope: slope.finance
Glow: glow.app
Exodus: www.exodus.com/browser-extension
Brave: brave.com/wallet
Last updated