From c959e1a40853c93d08a7efa4df18a954d85221ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Hr=C3=A1ch?= Date: Tue, 28 Jan 2025 15:44:01 +0100 Subject: [PATCH] chore(suite): migrate ripple txs by removing and re-fetching transfers --- packages/suite/src/storage/CHANGELOG.md | 4 ++++ .../suite/src/storage/migrations/index.ts | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/packages/suite/src/storage/CHANGELOG.md b/packages/suite/src/storage/CHANGELOG.md index 90027c4218d7..c4dfc3bd4dce 100644 --- a/packages/suite/src/storage/CHANGELOG.md +++ b/packages/suite/src/storage/CHANGELOG.md @@ -1,5 +1,9 @@ # Storage changelog +## 52 + +- saved ripple network type txs are removed to be fetched again and obtain internal transfers and token transfer contract and standard + ## 51 - Changed `metadata.key` on non-eth EVM networks accounts to be `descriptor-chainId` diff --git a/packages/suite/src/storage/migrations/index.ts b/packages/suite/src/storage/migrations/index.ts index 66c21faeb98a..96447f894959 100644 --- a/packages/suite/src/storage/migrations/index.ts +++ b/packages/suite/src/storage/migrations/index.ts @@ -1176,4 +1176,27 @@ export const migrate: OnUpgradeFunc = async ( return account; }); } + + if (oldVersion < 52) { + const accountsToUpdate = ['xrp', 'txrp']; + + // remove ripple network transactions + 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; + } + }); + } };