Skip to content

Commit

Permalink
chore(suite): migrate ripple txs by removing and re-fetching transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
izmy authored and tomasklim committed Jan 30, 2025
1 parent c46de7a commit 61741c4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/suite/src/storage/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

- Deprecated Vertcoin (VTC), Bitcoin Gold (BTG), Namecoin (NMC), DigiByte (DGB), and Dash (DASH) networks. Removed related transactions, accounts, and settings.
- Renamed coinmarketTrades to tradingTrades
- saved ripple network type txs are removed to be fetched again and obtain internal transfers and token transfer contract and standard

## 51

Expand Down
23 changes: 22 additions & 1 deletion packages/suite/src/storage/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1181,8 +1181,8 @@ export const migrate: OnUpgradeFunc<SuiteDBSchema> = async (
});
}

// Deprecate Vertcoin (VTC) and other networks
if (oldVersion < 52) {
// Deprecate Vertcoin (VTC) and other networks
const deprecatedNetworks = ['vtc', 'btg', 'nmc', 'dgb', 'dash'];

// Remove transactions related to deprecated networks
Expand Down Expand Up @@ -1227,6 +1227,27 @@ export const migrate: OnUpgradeFunc<SuiteDBSchema> = async (
for (const network of deprecatedNetworks) {
await backendSettings.delete(network as NetworkSymbol); // Delete backend settings for each deprecated network
}

// remove ripple network transactions
const accountsToUpdate = ['xrp', 'txrp'];

await updateAll<'txs', DBWalletAccountTransactionCompatible>(transaction, 'txs', tx => {
if (accountsToUpdate.includes(tx.tx.symbol)) {
return null;
}
tx.tx.internalTransfers = [];

return tx;
});

// force to fetch ripple network transactions again
await updateAll(transaction, 'accounts', account => {
if (accountsToUpdate.includes(account.symbol)) {
account.history = { total: 0, unconfirmed: 0, tokens: 0 };

return account;
}
});
}

if (oldVersion < 53) {
Expand Down

0 comments on commit 61741c4

Please sign in to comment.