Skip to content

Commit 399c864

Browse files
committed
send server wallet txn fix
1 parent 01a20cb commit 399c864

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/project-wallet/project-wallet-details.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
createThirdwebClient,
2121
Engine,
2222
getContract,
23+
NATIVE_TOKEN_ADDRESS,
2324
readContract,
2425
type ThirdwebClient,
2526
toUnits,
@@ -889,11 +890,15 @@ function SendProjectWalletModalContent(props: SendProjectWalletModalProps) {
889890

890891
const sendMutation = useMutation({
891892
mutationFn: async (values: SendFormValues) => {
893+
const normalizedTokenAddress =
894+
values.tokenAddress?.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase()
895+
? undefined
896+
: values.tokenAddress;
892897
let decimals = 18;
893-
if (values.tokenAddress) {
898+
if (normalizedTokenAddress) {
894899
const decimalsRpc = await readContract({
895900
contract: getContract({
896-
address: values.tokenAddress,
901+
address: normalizedTokenAddress,
897902
chain: selectedChain,
898903
client,
899904
}),
@@ -914,7 +919,9 @@ function SendProjectWalletModalContent(props: SendProjectWalletModalProps) {
914919
teamId,
915920
walletAddress,
916921
secretKey: secretKeyValue,
917-
...(values.tokenAddress ? { tokenAddress: values.tokenAddress } : {}),
922+
...(normalizedTokenAddress
923+
? { tokenAddress: normalizedTokenAddress }
924+
: {}),
918925
...(vaultAccessTokenValue
919926
? { vaultAccessToken: vaultAccessTokenValue }
920927
: {}),
@@ -956,7 +963,7 @@ function SendProjectWalletModalContent(props: SendProjectWalletModalProps) {
956963
<Form {...form}>
957964
<form
958965
onSubmit={form.handleSubmit((values) => {
959-
void sendMutation.mutateAsync(values);
966+
sendMutation.mutate(values);
960967
})}
961968
>
962969
<div className="space-y-4 px-4 pb-8 lg:px-6">

0 commit comments

Comments
 (0)