novasamatech / nova-spektr

Nova Spektr — All-in-one Polkadot desktop wallet supporting multisigs, staking, light clients, and more
https://novaspektr.io
Apache License 2.0
40 stars 16 forks source link

Create a Portfolio view for assets #1415

Closed pgolovkin closed 4 months ago

pgolovkin commented 9 months ago

Create a Portfolio view for assets. It should be asset oriented but not chain oriented.

Mockups and prototypes link

DOD:

  1. Research how Talisman, SubWallet group assets - it groups Token ticker -> Chains where token exists
  2. Describe how to make grouping in Talisman, SubWallet
Tbaut commented 9 months ago

I'm not sure I understand what this is. Isn't there already an overview of the asset owned?

pgolovkin commented 9 months ago

There are no mockups and requirements. This task is not ready for development.

pgolovkin commented 6 months ago

@sokolova-an Next step is to implement POC:

  1. Create config example for portfolio view (DOT, KSM, ACA). Config file should contain: key - token ticker, value - chainId, maybe price id, may be link to token icon, other attributes may be added depending on needs.
  2. Use this config for building portfolio view
  3. Implement Portfolio view without sorting, search, multishard support

Address that may be used for test - 12YK3LD8FzVgyBuN6mQkCaZUHyExQdjyvX1Fn67DJ5A4rL2R

sokolova-an commented 6 months ago

Result after POC: Add the script to create tokens.json file. Something like:

const tokenMap = new Map();
chains.forEach((i) => {
  i.assets.forEach((asset) => {
    const symbol = asset.symbol;
    const chains = { chainId: i.chainId, assetId: asset.assetId };
    if (tokenMap.has(symbol)) {
      tokenMap.set(symbol, { ...tokenMap.get(symbol), chains: [...tokenMap.get(symbol).chains, chains] });
    } else {
      tokenMap.set(symbol, {
        precision: asset.precision,
        symbol: asset.symbol,
        priceId: asset.priceId,
        name: asset.name,
        icon: asset.icon,
        chains: [chains],
      });
    }
  });
});
const tokensJson = Array.from(tokenMap.values());

TODO: