Request Permissions
RequestPermissions helps dApps connect with users' wallets. This involves asking for and getting the user's permission to access certain wallet features, which is needed for any actions the dApp wants to perform with the user's account.
- Beacon
- Taquito
Example
import { DAppClient, PermissionScope } from "@airgap/beacon-sdk"; const dAppClient = new DAppClient({ name: "Beacon Docs" }); // You can request specific permissions if you want const scopes: PermissionScope[] = [ PermissionScope.OPERATION_REQUEST, PermissionScope.SIGN, ]; try { console.log("Requesting permissions..."); const permissions = await dAppClient.requestPermissions({ scopes }); console.log("Got permissions:", permissions.address); } catch (error) { console.error("Got error:", error); }
Loading...
Example
import { TezosToolkit } from "@taquito/taquito"; import { BeaconWallet } from "@taquito/beacon-wallet"; import { PermissionScope } from "@airgap/beacon-sdk"; const Tezos = new TezosToolkit("https://mainnet.api.tez.ie"); const wallet = new BeaconWallet({ name: "Beacon Docs Taquito" }); Tezos.setWalletProvider(wallet); // You can request specific permissions if you want const scopes: PermissionScope[] = [ PermissionScope.OPERATION_REQUEST, PermissionScope.SIGN, ]; try { const permissions = await wallet.client.requestPermissions({ scopes }); console.log("Got permissions:", permissions.address); } catch (error) { console.error("Got error:", error); }
Loading...