Connect a Universal Profile
To interact with a Universal Profile, your dApp can call the window.ethereum
object, similar to other wallets. Before a connection can be established, users have to create their Universal Profile by:
Optionally, you can create new Universal Profiles by âïļ deploying them programmatically. Please keep in mind that you would also have to deploy your own Transaction Relay Service to allow gasless onboarding, as customly deployed profiles will not receive free monthly transaction quota through the LUKSO Transaction Relay Service.
Connect to a dAppâ
The Universal Profile Extension automatically manages incoming requests and returns the address of the connected Universal Profile. To get the conrolling EOAs of the smart contract account, you can manually fetch it's controllers.
import Web3 from 'web3';
const web3 = new Web3(window.ethereum);
async function connect() {
await web3.eth.requestAccounts();
try {
const accounts = await web3.eth.requestAccounts();
console.log('Connected with', accounts[0]);
} catch (error) {
// handle connection error
}
}
connect();

If you expect your users to have multiple browser wallets or extensions, we recommend installing Web3 Onboard by following our Web3 Onboard Configuration. The library will allow users to manage multiple browser providers in parallel.