Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { TransactionButton } from "components/buttons/TransactionButton";
import { useV5DashboardChain } from "lib/v5-adapter";
import { ArrowRightLeftIcon, CheckIcon } from "lucide-react";
import {
NATIVE_TOKEN_ADDRESS,
type PreparedTransaction,
type ThirdwebClient,
getAddress,
prepareTransaction,
toTokens,
} from "thirdweb";
Expand Down Expand Up @@ -39,6 +41,9 @@ export function SwapTransactionCardLayout(props: {
const { swapData } = props;
const txChain = useV5DashboardChain(swapData.transaction.chainId);

const isSellingNativeToken =
getAddress(swapData.from.address) === getAddress(NATIVE_TOKEN_ADDRESS);

return (
<div className="max-w-lg">
<div className="rounded-xl border bg-card">
Expand Down Expand Up @@ -102,6 +107,12 @@ export function SwapTransactionCardLayout(props: {
client: props.client,
data: swapData.transaction.data,
to: swapData.transaction.to,
erc20Value: isSellingNativeToken
? undefined
: {
amountWei: BigInt(swapData.from.amount),
tokenAddress: swapData.from.address,
},
});

props.sendTx(tx);
Expand Down
Loading