Skip to content

Commit fa6e5c3

Browse files
committed
[TOOL-4354] Nebula: Configure erc20Value for swap prepared transaction
1 parent 1bfb597 commit fa6e5c3

File tree

1 file changed

+11
-0
lines changed
  • apps/dashboard/src/app/nebula-app/(app)/components/Swap

1 file changed

+11
-0
lines changed

apps/dashboard/src/app/nebula-app/(app)/components/Swap/SwapCards.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { TransactionButton } from "components/buttons/TransactionButton";
22
import { useV5DashboardChain } from "lib/v5-adapter";
33
import { ArrowRightLeftIcon, CheckIcon } from "lucide-react";
44
import {
5+
NATIVE_TOKEN_ADDRESS,
56
type PreparedTransaction,
67
type ThirdwebClient,
8+
getAddress,
79
prepareTransaction,
810
toTokens,
911
} from "thirdweb";
@@ -39,6 +41,9 @@ export function SwapTransactionCardLayout(props: {
3941
const { swapData } = props;
4042
const txChain = useV5DashboardChain(swapData.transaction.chainId);
4143

44+
const isSellingNativeToken =
45+
getAddress(swapData.from.address) === getAddress(NATIVE_TOKEN_ADDRESS);
46+
4247
return (
4348
<div className="max-w-lg">
4449
<div className="rounded-xl border bg-card">
@@ -102,6 +107,12 @@ export function SwapTransactionCardLayout(props: {
102107
client: props.client,
103108
data: swapData.transaction.data,
104109
to: swapData.transaction.to,
110+
erc20Value: isSellingNativeToken
111+
? undefined
112+
: {
113+
amountWei: BigInt(swapData.from.amount),
114+
tokenAddress: swapData.from.address,
115+
},
105116
});
106117

107118
props.sendTx(tx);

0 commit comments

Comments
 (0)