Closed adityabhattad2021 closed 4 months ago
Replaced the old "Distribute Tokens" button with the new BlockchainActionButton component, to make the UI for blockchain actions consistent.
export function BlockchainActionButton({ className, smartContractAddress, functionName, args = [], buttonText, iconName, isDisabled = false, successMessage, smartContractABI, }: BlockchainActionButtonProps) { const Icon = iconMap[iconName]; const { handleSubmit, isLoading } = useWeb3FormSubmit(); const onSubmit = handleSubmit(async () => { const hash = await writeContract(wagmiConfig, { address: smartContractAddress, abi: smartContractABI, functionName: functionName, args: args, }); await waitForTransactionReceipt(wagmiConfig, { hash: hash, }); return { hash, message: successMessage, }; }); return ( <Web3SubmitButton isLoading={isLoading} onClick={onSubmit} className={className} disabled={isDisabled} > <Icon className="mr-2 h-4 w-4" /> {buttonText} </Web3SubmitButton> ); }
Closes: #19
Changes
Replaced the old "Distribute Tokens" button with the new BlockchainActionButton component, to make the UI for blockchain actions consistent.
Relevant Code: