Skip to content

Commit 209f6ae

Browse files
committed
Remove indirection caused by destructuring
1 parent 7845ae4 commit 209f6ae

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

src/components/cards/SwapDetailsCard.tsx

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,12 @@ const TXID_PLACEHOLDER = '{{TXID}}'
3333

3434
export function SwapDetailsCard(props: Props) {
3535
const { swapData, transaction, sourceWallet } = props
36-
3736
const { memos = [], spendTargets = [], tokenId } = transaction
3837

39-
const {
40-
isEstimate,
41-
orderId,
42-
orderUri,
43-
payoutAddress,
44-
payoutWalletId,
45-
plugin,
46-
refundAddress
47-
} = swapData
4838
const formattedOrderUri =
49-
orderUri == null
39+
swapData.orderUri == null
5040
? undefined
51-
: orderUri.replace(TXID_PLACEHOLDER, transaction.txid)
41+
: swapData.orderUri.replace(TXID_PLACEHOLDER, transaction.txid)
5242
const payoutCurrencyCode = swapData.payoutCurrencyCode
5343

5444
const handleExchangeDetails = useHandler(async () => {
@@ -78,10 +68,12 @@ export function SwapDetailsCard(props: Props) {
7868
{
7969
subject: sprintf(
8070
lstrings.transaction_details_exchange_support_request,
81-
plugin.displayName
71+
swapData.plugin.displayName
8272
),
8373
recipients:
84-
plugin.supportEmail != null ? [plugin.supportEmail] : undefined,
74+
swapData.plugin.supportEmail != null
75+
? [swapData.plugin.supportEmail]
76+
: undefined,
8577
body,
8678
isHTML: true
8779
},
@@ -119,7 +111,7 @@ export function SwapDetailsCard(props: Props) {
119111
// The wallet may have been deleted:
120112
const account = useSelector(state => state.core.account)
121113
const currencyWallets = useWatch(account, 'currencyWallets')
122-
const destinationWallet = currencyWallets[payoutWalletId]
114+
const destinationWallet = currencyWallets[swapData.payoutWalletId]
123115
const destinationWalletName =
124116
destinationWallet == null ? '' : getWalletName(destinationWallet)
125117
const destinationDenomination = useSelector(state =>
@@ -196,15 +188,17 @@ export function SwapDetailsCard(props: Props) {
196188
},
197189
{
198190
title: lstrings.transaction_details_exchange_service,
199-
body: plugin.displayName
191+
body: swapData.plugin.displayName
200192
},
201193
{
202194
title: lstrings.transaction_details_exchange_order_id,
203-
body: orderId || ''
195+
body: swapData.orderId || ''
204196
},
205197
{
206198
title: lstrings.quote_type,
207-
body: isEstimate ? lstrings.estimated_quote : lstrings.fixed_quote
199+
body: swapData.isEstimate
200+
? lstrings.estimated_quote
201+
: lstrings.fixed_quote
208202
}
209203
]
210204
},
@@ -261,11 +255,11 @@ export function SwapDetailsCard(props: Props) {
261255
: []),
262256
{
263257
title: lstrings.transaction_details_exchange_payout_address,
264-
body: payoutAddress
258+
body: swapData.payoutAddress
265259
},
266260
{
267261
title: lstrings.transaction_details_exchange_refund_address,
268-
body: refundAddress || ''
262+
body: swapData.refundAddress || ''
269263
}
270264
]
271265
}
@@ -294,15 +288,15 @@ export function SwapDetailsCard(props: Props) {
294288
: lstrings.fixed_quote}
295289
</EdgeText>
296290
</EdgeRow>
297-
{orderUri == null ? null : (
291+
{swapData.orderUri == null ? null : (
298292
<EdgeRow
299293
rightButtonType="touchable"
300294
title={lstrings.transaction_details_exchange_status_page}
301295
onPress={handleLink}
302296
body={formattedOrderUri}
303297
/>
304298
)}
305-
{plugin.supportEmail == null ? null : (
299+
{swapData.plugin.supportEmail == null ? null : (
306300
<EdgeRow
307301
rightButtonType="touchable"
308302
title={lstrings.transaction_details_exchange_support}

0 commit comments

Comments
 (0)