Skip to content

Commit

Permalink
refactor: revert temp workaround (deriv-com#14797)
Browse files Browse the repository at this point in the history
  • Loading branch information
rostislav-deriv authored and vinu-deriv committed May 28, 2024
1 parent 92d1962 commit a4c1650
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
2 changes: 0 additions & 2 deletions packages/api-v2/src/hooks/useInfiniteTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ const useInfiniteTransactions = () => {
},
payload: {
action_type: filter,
// TODO: remove this once backend adds `to` and `from` for Deriv X transfers
description: 1,
},
});

Expand Down
2 changes: 0 additions & 2 deletions packages/api-v2/src/hooks/useTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ const useTransactions = () => {
},
payload: {
action_type: filter,
// TODO: remove this once backend adds `to` and `from` for Deriv X transfers
description: 1,
},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo } from 'react';
import React from 'react';
import { WalletText } from '../../../../../../components/Base';
import { THooks } from '../../../../../../types';
import { TransactionsCompletedRowAccountDetails } from './components/TransactionsCompletedRowAccountDetails';
Expand All @@ -12,23 +12,6 @@ type TProps = {
};

const TransactionsCompletedRow: React.FC<TProps> = ({ accounts, transaction, wallet }) => {
// TODO: remove this once backend adds `to` and `from` for Deriv X and CTrader transfers
const dxtradeOrCtraderToFrom = useMemo(() => {
if (transaction?.action_type !== 'transfer' || !transaction.longcode) return null;
const longcodeMessageTokens = transaction.longcode.split(' ');
const direction = longcodeMessageTokens[4] === 'cTrader' ? 'to' : longcodeMessageTokens[1];
const dxtradeOrCtraderLoginid = longcodeMessageTokens.find(
token => token.startsWith('DX') || token.startsWith('CT')
);
return dxtradeOrCtraderLoginid
? {
from: { loginid: wallet.loginid },
to: { loginid: wallet.loginid },
...(direction && { [direction]: { loginid: dxtradeOrCtraderLoginid } }),
}
: null;
}, [transaction?.action_type, transaction.longcode, wallet.loginid]);

if (!transaction.action_type || !transaction.amount) return null;

const displayCurrency = wallet?.currency_config?.display_code || 'USD';
Expand All @@ -52,14 +35,11 @@ const TransactionsCompletedRow: React.FC<TProps> = ({ accounts, transaction, wal
) : (
<TransactionsCompletedRowTransferAccountDetails
accounts={accounts}
direction={
(transaction.from ?? dxtradeOrCtraderToFrom?.from)?.loginid === wallet?.loginid ? 'to' : 'from'
}
direction={transaction.from?.loginid === wallet?.loginid ? 'to' : 'from'}
loginid={
[
transaction.from?.loginid ?? dxtradeOrCtraderToFrom?.from.loginid,
transaction.to?.loginid ?? dxtradeOrCtraderToFrom?.to.loginid,
].find(loginid => loginid !== wallet?.loginid) ?? ''
[transaction.from?.loginid, transaction.to?.loginid].find(
loginid => loginid !== wallet?.loginid
) ?? ''
}
/>
)}
Expand Down

0 comments on commit a4c1650

Please sign in to comment.