Establishing a Connection

After detecting the provider, an application can initiate a connection request to Panda. This request triggers a user prompt that asks for permission to further engage. Users must approve this request before the app can proceed with additional inquiries, like signing messages or sending transactions.

Upon the initial granting of permission, the web application's domain becomes whitelisted for subsequent connection requests. Following a successful connection, both the application and the user have the ability to sever the connection whenever desired. See disconnecting.

Connecting

Connecting to Panda Wallet is easy:

const wallet = initProvider(); // see "Detecting the Provider"
try {
    const identityPubKey = await wallet.connect();
    console.log(identityPubKey);
    // 03d8111d4717b15c4b4204e429d46b32d84b2976576c2574d836b41d709f07e1b8
} catch (err) {
    console.log(err);
}

You can also call isConnected() at any time to check the state of the connection. For added security, the wallet will disconnect after 10 minutes of inactivity from the user.

const isConnected = await wallet.isConnected();

Last updated