Skip to content

Commit

Permalink
feat(suite): add Destination tag into TxDetail
Browse files Browse the repository at this point in the history
  • Loading branch information
izmy committed Jan 28, 2025
1 parent 3588934 commit e1dcfbe
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
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 @@ -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
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

0 comments on commit e1dcfbe

Please sign in to comment.