starcoinorg / starmask-extension

A blockchain wallet browser extension for starcoin
Apache License 2.0
35 stars 15 forks source link

StarMask

A blockchain wallet browser extension for Starcoin blockchain.

Initialize

yarn setup
cp .starmaskrc.dist .starmaskrc # change the values according to your needs
yarn start

Development

It is convenient to use yarn link @starcoin/xxx for debugging in localhost,

but dont forget doing the following steps before next release:

yarn unlink @starcoin/xxx`
yarn add @starcoin/xxx
yarn setup:postinstall

How to transfer the old state in local storage to new state

  1. check the last_version_number in app/scripts/migrations/index.js
  2. NEW_VERSION = last_version_number + 1
  3. yarn generate:migration <NEW_VERSION> to generate app/scripts/migrations/<NEW_VERSION>.js and app/scripts/migrations/<NEW_VERSION>.test.js
  4. modify transformState in app/scripts/migrations/<NEW_VERSION>.js, add test cases in app/scripts/migrations/<NEW_VERSION>.test.js
  5. add following line in app/scripts/migrations/index.js:
require('./<NEW_VERSION>').default,
  1. run yarn start or wait until it reloaded, then the old state will be migrated to the new state.

Tips:

  1. check 054.js and 054.test.js for demo of handling tokens.

  2. if you want to debug and re-run .js multi times, you can add following in app/scripts/background.js -> loadStateFromPersistence

 versionedData.meta.version = <last_version_number>;

before this line:

  const { TransactionController } = versionedData.data;

Add build to Chrome

Publish

How to display custom tokens logo in Main network

  1. Maintain custom tokens in @starcoin/starmask-contract-metadata
  1. in starmask-extension

Docs