Introduction
Let's discover Earth Connect in less than 5 minutes.
Getting Started
Get started by checking if earth wallet is installed.
if (window.earth !== undefined) {
console.log('Earth Wallet Exists');
//Do something
}
else {
console.log('Dear User, please install Earth Wallet at https://www.earthwallet.io/');
}
Earth Wallet can be installed here.
Connect user address to Dapp โ๏ธ
Get the user address
const account = await window.earth.connect();
console.log('account: ' + account);
//account: xyzzzz
Getting user address is very simple and by calling earth.connect()
Once connected, calling earth.connect()
will give same connected address e.g xyzzz. Currently, user can select ICP Secp256k1
addresses only.
Check if Earth Wallet is connected
const isConnected = await window.earth.isConnected()
//{connected: false} or {connected: true}
Get address meta
const addressMeta = await window.earth.getAddressMeta();
/*
{
name: 'xyz',
createdAt: 1635962486,
principalId: 'o7nwu-xxx',
publicKey: 'asddd',
type: 'ecdsa'
}
/*
Anything unclear or issue in this docs? Please connect at Discord!