Skip to content
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
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"access": "public"
},
"dependencies": {
"@dfx.swiss/react": "1.3.0-beta.252",
"@dfx.swiss/react-components": "1.3.0-beta.252",
"@dfx.swiss/react": "^1.3.0-beta.253",
"@dfx.swiss/react-components": "^1.3.0-beta.253",
"@ledgerhq/hw-app-btc": "^6.24.1",
"@ledgerhq/hw-app-eth": "^6.33.7",
"@ledgerhq/hw-transport-webhid": "^6.27.19",
Expand Down
30 changes: 23 additions & 7 deletions src/components/exchange-rate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,27 @@ export function ExchangeRate({
const totalFee = `${fees.total}${feeSymbol}`;
const dfxFee = `${fees.dfx}${feeSymbol} (${(fees.rate * 100).toFixed(2)}%${fees.min ? minFee : ''})`;
const networkFee = `${fees.network}${feeSymbol}`;
const bankFee = type !== TransactionType.SWAP && `${fees.bank}${feeSymbol}`;
const bankFixedFee = type !== TransactionType.SWAP && fees.bankFixed ? `${fees.bankFixed}${feeSymbol}` : undefined;
const bankPercentFee =
type !== TransactionType.SWAP && fees.bankPercent ? `${fees.bankPercent}${feeSymbol}` : undefined;
const bankFee =
type !== TransactionType.SWAP && !bankFixedFee && !bankPercentFee && fees.bank ? `${fees.bank}${feeSymbol}` : false;
const networkStartFee = fees?.networkStart ? `${fees?.networkStart}${feeSymbol}` : undefined;

const l1Replacement =
'blockchain' in to &&
(to.blockchain === Blockchain.BITCOIN
? 'Lightning'
: to.blockchain === Blockchain.ETHEREUM
? 'Arbitrum / Optimism'
: undefined);
? 'Arbitrum / Optimism'
: undefined);

const outputInfo =
type === TransactionType.BUY
? 'The output amount is computed as the input amount minus the DFX fee, bank fee and the network fee over the base rate. That is, {{output}} {{outputSymbol}} = ({{input}} {{inputSymbol}} - {{dfxFee}} {{feeSymbol}} - {{bankFee}} {{feeSymbol}} - {{networkFee}} {{feeSymbol}}) ÷ {{baseRate}}.'
: type === TransactionType.SWAP
? 'The output amount is computed as the input amount minus the DFX fee and the network fee over the base rate. That is, {{output}} {{outputSymbol}} = ({{input}} {{inputSymbol}} - {{dfxFee}} {{feeSymbol}} - {{networkFee}} {{feeSymbol}}) ÷ {{baseRate}}.'
: 'The output amount is computed as the input amount times the base rate minus the DFX fee, bank fee and the network fee. That is, {{output}} {{inputSymbol}} = {{input}} {{outputSymbol}} × {{baseRate}} - {{dfxFee}} {{feeSymbol}} - {{bankFee}} {{feeSymbol}} - {{networkFee}} {{feeSymbol}}.';
? 'The output amount is computed as the input amount minus the DFX fee and the network fee over the base rate. That is, {{output}} {{outputSymbol}} = ({{input}} {{inputSymbol}} - {{dfxFee}} {{feeSymbol}} - {{networkFee}} {{feeSymbol}}) ÷ {{baseRate}}.'
: 'The output amount is computed as the input amount times the base rate minus the DFX fee, bank fee and the network fee. That is, {{output}} {{inputSymbol}} = {{input}} {{outputSymbol}} × {{baseRate}} - {{dfxFee}} {{feeSymbol}} - {{bankFee}} {{feeSymbol}} - {{networkFee}} {{feeSymbol}}.';

return (
<StyledCollapsible
Expand All @@ -66,8 +70,8 @@ export function ExchangeRate({
rate === Number.MAX_VALUE
? '∞'
: 'blockchain' in from
? Utils.formatAmountCrypto(rate)
: Utils.formatAmount(rate)
? Utils.formatAmountCrypto(rate)
: Utils.formatAmount(rate)
} ${from.name}/${to.name}`}
>
<StyledVerticalStack gap={2}>
Expand All @@ -91,6 +95,18 @@ export function ExchangeRate({
<div>{totalFee}</div>
<div className="text-dfxGray-800">{translate('screens/payment', 'DFX fee')}</div>
<div>{dfxFee}</div>
{bankFixedFee && (
<>
<div className="text-dfxGray-800">{translate('screens/payment', 'Bank fee (fixed)')}</div>
<div>{bankFixedFee}</div>
</>
)}
{bankPercentFee && (
<>
<div className="text-dfxGray-800">{translate('screens/payment', 'Bank fee (percent)')}</div>
<div>{bankPercentFee}</div>
</>
)}
{bankFee && (
<>
<div className="text-dfxGray-800">{translate('screens/payment', 'Bank fee')}</div>
Expand Down
22 changes: 18 additions & 4 deletions src/screens/transaction.screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,10 @@ function TransactionRefund({ setError }: TransactionRefundProps): JSX.Element {
try {
const isBankRefund = isBuy && transaction.inputPaymentMethod !== FiatPaymentMethod.CARD;

const formTarget = isBuy ? data.iban ?? '' : data.address?.address;
const refundTarget = showIbanOverride ? formTarget : refundDetails?.refundTarget ?? formTarget;
const formTarget = isBuy ? (data.iban ?? '') : data.address?.address;
const refundTarget = showIbanOverride ? formTarget : (refundDetails?.refundTarget ?? formTarget);

const refundName = showIbanOverride ? data.creditorName : refundDetails?.bankDetails?.name ?? data.creditorName;
const refundName = showIbanOverride ? data.creditorName : (refundDetails?.bankDetails?.name ?? data.creditorName);

await setTransactionRefundTarget(transaction.id, {
refundTarget,
Expand Down Expand Up @@ -831,7 +831,9 @@ export function TransactionList({ isSupport, setError, onSelectTransaction }: Tr
onSubmit={handleSubmit(submitAssignment)}
>
<StyledVerticalStack gap={3} full>
<p className="text-dfxGray-700 mt-4">{translate('screens/payment', 'Remittance info')}</p>
<p className="text-dfxGray-700 mt-4">
{translate('screens/payment', 'Remittance info')}
</p>
<StyledDropdown<TransactionTarget>
rootRef={rootRef}
items={transactionTargets ?? []}
Expand Down Expand Up @@ -1014,7 +1016,19 @@ export function TxInfo({ tx, showUserDetails }: TxInfoProps): JSX.Element {
label: translate('screens/payment', 'Network fee'),
text: `${tx.fees.network} ${tx.inputAsset}`,
});
tx.fees?.bankFixed != null &&
rateItems.push({
label: translate('screens/payment', 'Bank fee (fixed)'),
text: `${tx.fees.bankFixed} ${tx.inputAsset}`,
});
tx.fees?.bankPercent != null &&
rateItems.push({
label: translate('screens/payment', 'Bank fee (percent)'),
text: `${tx.fees.bankPercent} ${tx.inputAsset}`,
});
tx.fees?.bank != null &&
tx.fees?.bankFixed == null &&
tx.fees?.bankPercent == null &&
rateItems.push({
label: translate('screens/payment', 'Bank fee'),
text: `${tx.fees.bank} ${tx.inputAsset}`,
Expand Down
Loading