Skip to content

nolan-supra/starkey-demo

Repository files navigation

Star Key Web Wallet Connect Demo

This demo site for testing StarKey Wallet connect

Run Locally

Clone the project

  git clone git@github.com:nolan-supra/starkey-demo.git

Go to the project directory

  cd frontend-web-wallet-connect-demo

Install dependencies

  yarn install

Start the development server

  yarn dev

Start the production server

  yarn build
  yarn start

API for connect StarKey Wallet with website

Check extension is installed or not

if (window?.starKeyWallet || window?.starKey) {
  console.log('Extension installed');
}else{
  console.log('Extension not installed');
}

Connect wallet

window.starKeyWallet.connectWallet();

OR

window.starKeyWallet.connectWallet({
	multiple: false,
	network: 'ETH'
})

Get current connected account

const currentAccount = await window.starKeyWallet.getCurrentAccount();

Get token balance

const balance = await window.starKeyWallet.getBalance();

Send token

 const tx = {
      toAddress: '0x8d8313ac41a47908ea3cc4497d68f864472f1b792c6855eba20d206324702e0e',
      amount: 0.0001,
      token: 'SUPRA',
    };

    const sendTX = await starKeyWallet.sendTokenAmount(tx);
    console.log({ sendTX });

Subscribe extension event

window?.starKeyWallet?.onMessage((message) => {
    console.log('~~~Message received:~~~', message);   
})

All events

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors