nns-dapp icon indicating copy to clipboard operation
nns-dapp copied to clipboard

Populate icrc store with imported tokens

Open mstrasinskis opened this issue 5 months ago • 0 comments

Motivation

The imported tokens are ICRC tokens. The only new difference is that the index canister is optional. To make the NNS-dapp work with them, the only change needed is to modify the ICRC store to support entries without the index canister (here).

Once the ICRC store supports tokens without an index canister, we can add imported tokens to the ICRC store, and they will be displayed in the tokens table and on the wallet page.

Changes

  • Make indexCanisterId optional in IcrcCanistersStore.
  • Add imported tokens to IcrcCanistersStore after loading them.

Tests

  • Unit test that the icrsStore was populated after imported tokens loading.
  • Other parts were tested manually:

The existence of the work-around suggests that not specifying an index canister already works.

The index canister is optional in IcrcWallet.

The transaction list is now shown when no index canister.

{#if nonNullish($selectedAccountStore.account) && nonNullish($selectedIcrcTokenUniverseIdStore) && nonNullish(indexCanisterId)}
  <IcrcWalletTransactionsList

Index canister is not used in GetTokensModal.

The index canister is not used in the logic of derived stores that uses icrcStore:

  • icrc-universes.derived
  • selectable-universe.derived
  • selected-universe.derived store

Todos

  • [ ] Add entry to changelog (if necessary). Not necessary.

mstrasinskis avatar Aug 30 '24 10:08 mstrasinskis