connectNetwork

Connects to the Solana network through an RPC endpoint

(async() => {
    await SOLPay.connectNetwork("https://solana-api.projectserum.com", "confirmed"); // {"network": "https://solana-api.projectserum.com", "commitment": "confirmed"}
    await SOLPay.connectNetwork(); // {"network": "...", "commitment": "confirmed"}
})();

Parameters:

  • network (optional, default: default RPC network): string - the RPC URL to use for the connection

  • commitment (optional, default: "confirmed"): string - the commitment to use for the connection

Networks:

For more information on networks, see networks.

Returns:

object ({"network": "...", "commitment": "..."}) - the connection details

Throws:

  • SOL Pay SDK Fatal Error: Invalid network ${network}. - network not specified or unable to connect to the network

Last updated