Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TxDetail - XRP - Display destination tag #16634

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/blockchain-link-types/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ export interface Transaction {
details: TransactionDetail;
vsize?: number;
feeRate?: string;
rippleSpecific?: {
destinationTag?: number;
};
}

/* Account */
Expand Down
4 changes: 4 additions & 0 deletions packages/blockchain-link-utils/src/ripple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const transformTransaction = (tx: any, descriptor?: string): Transaction
const addresses = [tx.Destination];
const amount = tx.Amount;
const fee = tx.Fee;
const destinationTag = tx.DestinationTag;

// TODO: https://github.com/ripple/ripple-lib/blob/develop/docs/index.md#transaction-types
return {
Expand Down Expand Up @@ -56,5 +57,8 @@ export const transformTransaction = (tx: any, descriptor?: string): Transaction
totalInput: '0',
totalOutput: '0',
},
rippleSpecific: {
destinationTag,
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default [
totalInput: '0',
totalOutput: '0',
},
rippleSpecific: { destinationTag: undefined },
},
],
},
Expand Down Expand Up @@ -200,6 +201,7 @@ export default [
totalInput: '0',
totalOutput: '0',
},
rippleSpecific: { destinationTag: undefined },
},
{
type: 'recv',
Expand Down Expand Up @@ -227,6 +229,7 @@ export default [
totalInput: '0',
totalOutput: '0',
},
rippleSpecific: { destinationTag: undefined },
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ const xrpTx = {
tokens: [],
internalTransfers: [],
details: { size: 0, totalInput: '0', totalOutput: '0', vin: [], vout: [] },
rippleSpecific: {
destinationTag: xrpFixture.DestinationTag,
},
};

export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const notifyAddresses = [
...tx,
type: 'sent',
targets: [{ addresses: ['B'], isAddress: true, n: 0 }],
rippleSpecific: { destinationTag: undefined },
},
},
},
Expand All @@ -145,6 +146,7 @@ const notifyAddresses = [
...tx,
type: 'recv',
targets: [{ addresses: ['A'], isAddress: true, n: 0 }],
rippleSpecific: { destinationTag: undefined },
},
},
},
Expand Down Expand Up @@ -187,6 +189,7 @@ const notifyAddresses = [
...tx,
type: 'sent',
targets: [{ addresses: ['B'], isAddress: true, n: 0 }],
rippleSpecific: { destinationTag: undefined },
},
},
},
Expand All @@ -213,6 +216,7 @@ const notifyAddresses = [
...tx,
type: 'recv',
targets: [{ addresses: ['C'], isAddress: true, n: 0 }],
rippleSpecific: { destinationTag: undefined },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ export const BasicTxDetails = ({
</Item>
</>
)}

{tx.rippleSpecific && (
<Item label={<Translation id="DESTINATION_TAG_SHORT" />} iconName="tag">
{tx.rippleSpecific.destinationTag ?? '-'}
</Item>
)}
</Grid>
</Card>
);
Expand Down
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
4 changes: 4 additions & 0 deletions packages/suite/src/support/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5462,6 +5462,10 @@ export default defineMessages({
defaultMessage: 'Destination tag',
id: 'DESTINATION_TAG',
},
DESTINATION_TAG_SHORT: {
defaultMessage: 'Memo/Tag',
id: 'DESTINATION_TAG_SHORT',
},
DESTINATION_TAG_TOOLTIP: {
id: 'DESTINATION_TAG_TOOLTIP',
defaultMessage:
Expand Down
Loading