AlphaWallet / AlphaWallet/alpha-wallet-android

Normalise Realm storage for Tokens

Ouverte
#2,584 0 commentaires 0 réactions 1 personne assignée Réclamée par @asif-finimble Voir sur GitHub
Langage dominant
Java
Étoiles
646
Forks
579
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

This is a large-ish project to optimise storage of tokens esp for multi-wallet apps.

It also has a number of other advantages eg new wallets benefit from previous wallet's discovered tokens.

The current structure looks like this:

## RealmToken

### Static Data
- address-chain
- name
- symbol
- group
- interface Spec (erc20/erc721 etc)
- decimals
- auxData

### Dynamic Data
- addedTime;
- updatedTime;
- balance
- isEnabled
- lastBlockRead
- earliestTxBlock
- visibilityChanged

### Deprecated (can be deleted)
- erc1155BlockRead
- tokenId

This update should create a separate, singleton database which contains the static data. The per wallet dynamic databases should only contain the dynamic data above.

In this way two new schemas should be used; RealmStaticToken and RealmWalletToken. RealmToken will be deprecated, but left in place for migration.

When the database is upgraded (AWRealmMigration) you should trigger a one-time migration (using statics to set a flag in TokensService, that gets picked up when TokensService is initialised is fine). This migration would go through all the wallets, strip out all the data in RealmToken, and populate the respective RealmWalletToken, and add to the global RealmStaticToken database as appropriate.

This update will touch a fair few files, but since most token fetches are via TokensService and the fetchTokenMetas methods these usages are mostly centralised (but not entirely - there are a fair few listeners that will need updating - note for listeners you'll be listening for changes to the respective RealmWalletToken DB).

When you fetch tokens you'll need to combine data from the StaticToken and WalletToken realms.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.