Code Monkey home page Code Monkey logo

chain-desktop-wallet's People

Contributors

calvinaco avatar calvinlauyh avatar cdc-hitesh avatar cheese1 avatar cldh214 avatar crypto-eddy avatar crypto-matto avatar cryptodotbzh avatar dependabot[bot] avatar ema987 avatar jlbernal avatar leejw51crypto avatar linfeng-crypto avatar mattopolitan avatar tomtau avatar xinyucro avatar yi-cro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chain-desktop-wallet's Issues

Problem : Missing Create Password Page

'Create password screen' is basic password submission with a password field and a confirm password field.

We can have a text on top saying something along the lines of "You need to set up app password, this password will be used to encrypt the wallets and you should never forget it because there's not a way to get it back when it's lost"

The design may reference on Create Wallet create.tsx / Restore Wallet Page restore.tsx at the moment.

Suggested form submission component: Form - Ant Design

螢幕截圖 2020-12-11 下午3 50 55

Problem : Missing a bunch of custom network configuration fields

An illustration on what configuration fields to be provided:
https://github.com/crypto-com/chain-desktop-wallet/blob/master/src/service/WalletImporter.spec.ts#L39

{
      derivationPath: "44'/245'/0'/0/0",
      name: 'Pystaport-Custom-Network',
      network: {
        chainId: 'chainmaind',
        addressPrefix: 'pcro',
        validatorAddressPrefix: 'pcrocncl',
        validatorPubKeyPrefix: 'pcrocnclconspub',
        coin: {
          baseDenom: 'basepcro',
          croDenom: 'pcro',
        },
        bip44Path: {
          coinType: 1,
          account: 0,
        },
      },
      nodeUrl: '123.18.45.12:3400',
    };

Problem : Missing Rpc service class that will be making calls to the network node

This will expose an API like

  loadAccountBalance(address: string, assetDenom: string): Promise<string>;

  loadSequenceNumber(address: string): Promise<number>;

  loadAccountNumber(address: string): Promise<number>;

  // Broadcast trx return trx hash
  broadcastTransaction(signedTxHex: string): Promise<string>;

  getTransactionByHash(transactionHash: string): Promise<IndexedTx>;

Problem: Missing module bundler tools

Just had a quick chat with @crypto-matto for LESS integration, know that css processing tools are not decided yet (CSS-module? style-component etc), and also the bundler (Webpack? Parcel? Rollup etc). So here is a discussion issue.

After the decision, @crypto-matto can better integrate LESS with the css processing tool and bundler as a whole.

Problem: Potential function calls failure when no created wallets in db

螢幕截圖 2020-12-16 下午2 09 13

  public async retrieveCurrentWalletAssets(): Promise<UserAsset[]> {
    const currentSession = await this.storageService.retrieveCurrentSession();
    const assets = await this.storageService.retrieveAssetsByWallet(
      currentSession.wallet.identifier,
    );

    return assets.map(data => {
      const asset: UserAsset = { ...data };
      return asset;
    });
  }

Also this.retrieveCurrentWalletAssets() might return null, getting [0] of null would result in crash

  public async retrieveDefaultWalletAsset(): Promise<UserAsset> {
    return (await this.retrieveCurrentWalletAssets())[0];
  }

Problem : Missing mnemonic phrase encryption and decryption flow with its relation with the app password

Current state

Currently, mnemonic phrases are stored in plain text format, but the goal is to have them saved after being encrypted.

Objectives

  • We should be able to save the mnemonic phrase encrypted after import/restore or new wallet creation

  • When the user wants to do a transaction, we should be able to decrypt the encrypted mnemonic and extract the key from the mnemonic for signing purposes.

  • The phrase should normally be encrypted with the user set password as the encryption key so that only the user or owner of the password can decrypt it and sign transactions

Outcome

At the end of this task, we should have the implementation of the 3 main steps or functions :

  • Storing passwords securely, since these passwords will later be used as encryption keys

  • Using that stored password to encrypt the mnemonic phrase, here the previously stored password is used as the encryption key. We'd only store the encrypted mnemonic phrase.

  • And finally decrypting the previously-stored phrase with the password ( which was used as the encryption key ) and use the phrase to sign transactions when needed.

Note

This task is not UI related, it's mostly logic behind the storage of sensitive data, the encryption and decryption of phrases.

Problem : Refactor and use consistent function action names

  • For actions or operations getting data from the network or any API call, the prefix load or fetch should be used

E.g : loadAccountBalance(), loadAssetPrice(), fetchAccountSequence()

  • For actions or operations getting data from the local DB, the prefix retrieve should be used

E.g : retrieveAccountBalance(), retrieveCurrentSession()

Problem : Add support for switching between wallets - Set current session - Keep session and asset state

1. Switching between wallets

User should be able to switch to all wallets that have been created or imported in the desktop app
The below function helps load all existing wallets in the app and shown in a pop-up list for users to select which wallet to switch to.

const allWallets = walletService.retrieveAllWallets()

2. Set current session

By switching to a new wallet, that means the session has changed to a new wallet, so whenever the app is opened again, the last wallet should be selected by default.

/// Something around this code snippet would be used to persist new session 
/// And also updating the recoil state
const newSession = new Session(newSelectedWallet)
setCurrentSession(newSession) 
setSession(newSession) // recoil

3. Keep session in the recoil state

In many places in the app, many views need to access the currently selected wallet info like wallet address and co.
So by keeping the session in a recoil state makes it easy to use it straight away in the views that need them.

An example here is for 'receive screen', we need to display QR code of the address, by using a recoil state, we can have something simple like.

  const session: Session = useRecoilValue<Session>(sessionState);
  
   <QRCode value={session.wallet.address} size={180} />

4. Display current asset data

Data like balance and staked balance can be shown straight by retrieving data from the DB

const currentAsset = await assetService.retrieveDefaultWalletAsset() // Return current asset

// Display balance
currentAsset.balance

// Display staked balance
currentAsset.stakedBalance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.