This demo site for testing StarKey Wallet connect
Clone the project
git clone git@github.com:nolan-supra/starkey-demo.gitGo to the project directory
cd frontend-web-wallet-connect-demoInstall dependencies
yarn installStart the development server
yarn devStart the production server
yarn build
yarn start- Check extension is installed or not
- Connect wallet
- Get current connected account
- Get token balance
- Send-token
- Subscribe extension event
- All events
if (window?.starKeyWallet || window?.starKey) {
console.log('Extension installed');
}else{
console.log('Extension not installed');
}window.starKeyWallet.connectWallet();
OR
window.starKeyWallet.connectWallet({
multiple: false,
network: 'ETH'
})const currentAccount = await window.starKeyWallet.getCurrentAccount();const balance = await window.starKeyWallet.getBalance(); const tx = {
toAddress: '0x8d8313ac41a47908ea3cc4497d68f864472f1b792c6855eba20d206324702e0e',
amount: 0.0001,
token: 'SUPRA',
};
const sendTX = await starKeyWallet.sendTokenAmount(tx);
console.log({ sendTX });window?.starKeyWallet?.onMessage((message) => {
console.log('~~~Message received:~~~', message);
})| Event name | Type | Description |
|---|---|---|
starkey-window-open |
Connection | |
starkey-window-remove |
Connection | |
starkey-wallet-connected |
Connection | |
starkey-wallet-disconnected |
Connection | |
starkey-wallet-updated |
Account Info | |
starkey-transaction-initiated |
Transaction | |
starkey-transaction-decline |
Transaction | |
starkey-transaction-failed |
Transaction | |
starkey-transaction-success |
Transaction |