Establishing Connection

In order to start interacting with the Rise 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.rise 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.rise.connect()
console.log(respone)
//{
//  address: "0xe19578243c9744fb4b7675192ed1c489d64e2aab17bc37cc1446b6e5601d7ce8"
//  authKey: "0xe19578243c9744fb4b7675192ed1c489d64e2aab17bc37cc1446b6e5601d7ce8"
//  publicKey: "0x71c87ca87e89dd7d02d224465cc40a1aafb10a76a91a0857ddac29fe0c3cdf23"
//}

You can also listen for the connect event.

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

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

console.log(window.rise.isConnected())
// true
console.log(window.rise.publicKey)
// '0x71c87ca87e89dd7d02d224465cc40a1aafb10a76a91a0857ddac29fe0c3cdf23'
console.log(window.rise.address)
// '0xe19578243c9744fb4b7675192ed1c489d64e2aab17bc37cc1446b6e5601d7ce8'
console.log(window.rise.authKey)
// '0xe19578243c9744fb4b7675192ed1c489d64e2aab17bc37cc1446b6e5601d7ce8'

Disconnecting

Disconnecting is done by calling disconnect() function

window.rise.disconnect()

Last updated