Skip to content
Example Solana Web-based Wallet
Branch: master
Clone or download
dependabot-preview Bump webpack-cli from 3.3.5 to 3.3.6
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 3.3.5 to 3.3.6.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/v3.3.6/CHANGELOG.md)
- [Commits](webpack/webpack-cli@v3.3.5...v3.3.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Latest commit 8cd6c00 Jul 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist Autofill seed phrase when recovering wallet (#242) Jul 12, 2019
src Autofill seed phrase when recovering wallet (#242) Jul 12, 2019
.babelrc Improve resizing Aug 15, 2018
.eslintignore Ignore dist/ Sep 25, 2018
.eslintrc.js Fund dapps (#240) Jul 12, 2019
.flowconfig Add flow Sep 29, 2018
.gitignore load/save file store plumbing Aug 16, 2018
.prettierrc.yaml Add prettier Dec 14, 2018
.travis.yml Add .travis.yml Dec 14, 2018
LICENSE Add LICENSE Aug 24, 2018
README.md
package-lock.json Bump webpack-cli from 3.3.5 to 3.3.6 Jul 15, 2019
package.json Use mnemonic seed phrase to generate and recover wallets (#236) Jul 9, 2019
server.js Display port Aug 24, 2018
webpack.config.js npm run pretty Dec 14, 2018

README.md

Build status

Example Web Wallet

This project demonstrates how to use the Solana Javascript API to implement a simple web wallet.

IMPORTANT: This wallet does not sufficently protect the private keys it generates and should NOT be used in a non-test environment

Getting Started

$ npm install
$ npm run start

Then open your browser to http://localhost:8080/

Development

When making changes, using the webpack-dev-server can be quite convenient as it will rebuild and reload the app automatically

$ npm run dev

Funding dApps

If this wallet is opened by a dApp, it will accept requests for funds. In order to request funds from your dApp, follow these steps:

  1. Attach a message event listener to the dApp window
window.addEventListener('message', (e) => { /* ... */ });
  1. Open the wallet url in a window from the dApp
const walletWindow = window.open(WALLET_URL, 'wallet', 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=500, height=600');
  1. Wait for the wallet to load, it will post a 'ready' message when it's ready to handle requests
window.addEventListener('message', (e) => {
  if (e.data) {
    switch (e.data.method) {
      case 'ready': {
        // ...
        break;
      }
    }
  }
});
  1. Send an 'addFunds' request
walletWindow.postMessage({
  method: 'addFunds',
  params: {
    pubkey: '7q4tpevKWZFSXszPfnvWDuuE19EhSnsAmt5x4MqCyyVb',
    amount: 150,
    network: 'https://api.beta.testnet.solana.com',
  },
}, WALLET_URL);
  1. Listen for an 'addFundsResponse' event which will include the amount transferred and the transaction signature
window.addEventListener('message', (e) => {
  // ...
  switch (e.data.method) {
    case 'ready': {
      // ...
      break;
    }
    case 'addFundsResponse': {
      const {amount, signature} = e.data.params;
      // ...
      break;
    }
  }
});
You can’t perform that action at this time.