Skip to main content

Active Account

import { DAppClient } from "@airgap/beacon-sdk";
const dAppClient = new DAppClient({ name: "Beacon Docs" });
const activeAccount = await dAppClient.getActiveAccount();
if (activeAccount) {
// User already has account connected, everything is ready
// You can now do an operation request, sign request, or send another permission request to switch wallet
console.log("Already connected:", activeAccount.address);
return activeAccount;
} else {
const permissions = await dAppClient.requestPermissions();
console.log("New connection:", permissions.address);
return permissions;