AlphaWallet / AlphaWallet/alpha-wallet-android

Normalise Realm storage for Tokens

Aperta
#2,584 0 commenti 0 reazioni 1 assegnatario Rivendicata da @asif-finimble Vedi su GitHub
Lingua principale
Java
Stelle
646
Fork
579
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.