Connection API
await window.spika.connect();
This method will prompt user to grant web application permission to access account's address, public key and authentication key.
This method will add application to the whitelist.
Response example
1
{
2
"responseMethod": "connect",
3
"id": 4,
4
"response": {
5
"address": "0x07313c786ae592e2b134ef11a26721e4bf9f46e44139ce3bee35a011a9dea062",
6
"publicKey": "0x246149be5064eb9913690c7b2eca963fede52fcbd072d2fbba22f7383e66c0c8",
7
"authKey": "0x07313c786ae592e2b134ef11a26721e4bf9f46e44139ce3bee35a011a9dea062"
8
}
9
}
10
}
It will return
false
if:- account not initialized yet (e.g. address is not created);
- user rejected request;
- error occurred during request
await window.spika.disconnect();
This method will revoke application from the whitelist and return
true
on success or false
if application is not registered.Response example
1
{
2
"responseMethod": "disconnect",
3
"id": 5,
4
"response": true
5
}
await window.spika.isConnected();
This method will return
true
if application is whitelisted and return false
if not.Response example
1
{
2
"responseMethod": "isConnected",
3
"id": 5,
4
"response": true
5
}
Last modified 1yr ago