@@ -18,24 +18,26 @@ interface MintSupplyTabProps {
1818// Intended for Edition contracts (not Edition Drop)
1919const MintSupplyTab : React . FC < MintSupplyTabProps > = ( { contract, tokenId } ) => {
2020 const trackEvent = useTrack ( ) ;
21+ const address = useActiveAccount ( ) ?. address ;
2122 const {
2223 register,
2324 handleSubmit,
2425 formState : { errors } ,
2526 reset,
2627 } = useForm < { to : string ; amount : string } > ( {
27- defaultValues : { amount : "1" } ,
28+ defaultValues : { amount : "1" , to : address } ,
2829 } ) ;
2930
30- const address = useActiveAccount ( ) ?. address ;
3131 const { mutateAsync, isPending } = useSendAndConfirmTransaction ( ) ;
3232
3333 return (
3434 < form
3535 className = "flex w-full flex-col gap-2"
3636 onSubmit = { handleSubmit ( ( data ) => {
37- if ( ! address ) {
38- return toast . error ( "No wallet connected." ) ;
37+ if ( ! data . to ) {
38+ return toast . error (
39+ "Please enter the wallet address of the recipient." ,
40+ ) ;
3941 }
4042 trackEvent ( {
4143 category : "nft" ,
@@ -44,7 +46,7 @@ const MintSupplyTab: React.FC<MintSupplyTabProps> = ({ contract, tokenId }) => {
4446 } ) ;
4547 const transaction = mintAdditionalSupplyTo ( {
4648 contract,
47- to : address ,
49+ to : data . to ,
4850 tokenId : BigInt ( tokenId ) ,
4951 supply : BigInt ( data . amount ) ,
5052 } ) ;
@@ -74,36 +76,34 @@ const MintSupplyTab: React.FC<MintSupplyTabProps> = ({ contract, tokenId }) => {
7476 } ) ;
7577 } ) }
7678 >
77- < div className = "flex flex-col gap-3" >
78- < div className = "flex w-full flex-col gap-6 md:flex-row" >
79- < FormControl isRequired isInvalid = { ! ! errors . to } >
80- < FormLabel > Amount</ FormLabel >
81- < Input placeholder = "1" { ...register ( "amount" ) } min = { 1 } />
82- < FormHelperText > How many would you like to mint?</ FormHelperText >
83- < FormLabel className = "mt-3" > Recipient</ FormLabel >
84- < Input
85- placeholder = "0x..."
86- defaultValue = { address || "" }
87- { ...register ( "to" ) }
88- />
89- < FormHelperText >
90- Address to receive the NFT(s) - Defaults to your own wallet
91- </ FormHelperText >
92- < FormErrorMessage > { errors . to ?. message } </ FormErrorMessage >
93- </ FormControl >
94- </ div >
95-
96- < TransactionButton
97- txChainID = { contract . chain . id }
98- transactionCount = { 1 }
99- isLoading = { isPending }
100- type = "submit"
101- colorScheme = "primary"
102- alignSelf = "flex-end"
103- >
104- Mint
105- </ TransactionButton >
79+ < div className = "flex w-full flex-col gap-6 md:flex-row" >
80+ < FormControl isRequired isInvalid = { ! ! errors . to } >
81+ < FormLabel > Amount</ FormLabel >
82+ < Input placeholder = "1" { ...register ( "amount" ) } min = { 1 } />
83+ < FormHelperText > How many would you like to mint?</ FormHelperText >
84+ < FormLabel className = "mt-3" > Recipient</ FormLabel >
85+ < Input
86+ placeholder = "0x..."
87+ defaultValue = { address || "" }
88+ { ...register ( "to" ) }
89+ />
90+ < FormHelperText >
91+ Address to receive the NFT(s) - Defaults to your own wallet
92+ </ FormHelperText >
93+ < FormErrorMessage > { errors . to ?. message } </ FormErrorMessage >
94+ </ FormControl >
10695 </ div >
96+
97+ < TransactionButton
98+ txChainID = { contract . chain . id }
99+ transactionCount = { 1 }
100+ isLoading = { isPending }
101+ type = "submit"
102+ colorScheme = "primary"
103+ alignSelf = "flex-end"
104+ >
105+ Mint
106+ </ TransactionButton >
107107 </ form >
108108 ) ;
109109} ;
0 commit comments