Skip to content

Commit b6bb75d

Browse files
committed
Use custom data input for native assets only
Use action title from simulation in confirmation view
1 parent 47256c7 commit b6bb75d

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/ui/components/address-action/TransactionConfirmationView/TransactionConfirmationView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ export function TransactionConfirmationView({
103103
borderRadius: 12,
104104
}}
105105
>
106-
<UIText kind="headline/h2">{title}</UIText>
106+
<UIText kind="headline/h2">
107+
{txInterpretQuery.data?.action?.type.display_value ?? title}
108+
</UIText>
107109
<HStack gap={8} alignItems="center">
108110
<WalletAvatar
109111
address={wallet.address}

src/ui/pages/SendForm/SendForm.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ function SendFormComponent() {
165165
tokenValue = '',
166166
addressInputValue = '',
167167
data = '',
168+
tokenAssetCode = '',
168169
} = formState;
169170
const chain = tokenChain ? createChain(tokenChain) : null;
170171
const currentPosition = useCurrentPosition(formState, currentPositions);
@@ -212,6 +213,8 @@ function SendFormComponent() {
212213
supportsSponsoredTransactions: network?.supports_sponsored_transactions,
213214
});
214215

216+
const nativeAssetId = network?.native_asset?.id;
217+
const isNativeAsset = tokenAssetCode === nativeAssetId;
215218
const configuration = useMemo(() => toConfiguration(formState), [formState]);
216219

217220
const snapshotRef = useRef<{ state: SendFormState } | null>(null);
@@ -463,7 +466,7 @@ function SendFormComponent() {
463466
value={tokenValue}
464467
network={network}
465468
onChange={(value) => handleChange('tokenValue', value)}
466-
tokenAssetCode={formState.tokenAssetCode || null}
469+
tokenAssetCode={tokenAssetCode || null}
467470
currentItem={currentPosition ?? null}
468471
items={currentPositions}
469472
onAssetCodeChange={(value) =>
@@ -481,6 +484,7 @@ function SendFormComponent() {
481484
/>
482485
) : null}
483486
{preferences?.configurableTransactionData &&
487+
isNativeAsset &&
484488
addressType === 'evm' ? (
485489
<FormFieldset
486490
title="Data"

src/ui/pages/SendForm/shared/prepareSendData.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ export async function prepareSendData(
226226
getDecimals({ asset: position.asset, chain })
227227
).toFixed(),
228228
});
229+
if (data && isNativeAsset) {
230+
tx = { ...tx, data };
231+
}
229232
}
230233
if (gasLimit) {
231234
invariant(isNumeric(gasLimit), 'Gas limit must be numeric');
@@ -245,9 +248,6 @@ export async function prepareSendData(
245248
});
246249
nonce = String(latestNonce);
247250
}
248-
if (data) {
249-
tx = { ...tx, data };
250-
}
251251
tx = await applyConfigurationAsync({
252252
chain,
253253
formState: { ...formState, nonce },

0 commit comments

Comments
 (0)