Establishing Connection

In order to start interacting with the Elli Wallet, an app must first establish a connection.

This connection request will prompt the user for permission to share their address, indicating that they are willing to interact further. Once permission is established for the first time, the web application's domain will be whitelisted for future connection requests.

Similarly, it is possible to terminate the connection both on the application and the user side.

The window.elli object exposes a connect() function that returns a Promise that resolves to object (defined below) when the user accepts the connection request, and resolves to false when the user declines the request or closes the pop-up.

const response = await window.elli.connect()
console.log(respone)
//{
//  address: "0xfe7de9d90ccede875feec078e09692f731537abefa757aecbd74decb1d55e7cf"
//  publicKey: "053PUtsnUjDjU6XnsiRegxZld9YyM5d0vJkuT98ww5k="
//}

You can also listen for the connect event.

window.elli.on("connect", () => console.log("connected!"));

Once connected to the Elli Wallet extension, window.elli object gets updated and exposes a few convenient properties like isConnected, publicKey, and address.

console.log(window.elli.isConnected())
// true
console.log(window.elli.publicKey)
// '053PUtsnUjDjU6XnsiRegxZld9YyM5d0vJkuT98ww5k='
console.log(window.elli.address)
// '0xfe7de9d90ccede875feec078e09692f731537abefa757aecbd74decb1d55e7cf'

Disconnecting

Disconnecting is done by calling disconnect() function

Last updated