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
19 changes: 10 additions & 9 deletions app/(app)/sla/components/beneficiary-contract-deploy-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ export function BeneficiaryContractDeployWidget({
resolver: zodResolver(formSchema),
});

const {
reset: resetForm,
formState: { isValid: isFormValid },
} = form;
const { reset: resetForm } = form;

const [admin, provider, withdrawer] = useWatch({
const values = useWatch({
control: form.control,
name: ["admin", "provider", "withdrawer"],
});

const transaction = useMemo<TransactionBase | null>(() => {
if (!isFormValid) {
const validationResult = formSchema.safeParse(values);

if (!validationResult.success) {
return null;
}

const { admin, provider, withdrawer } = validationResult.data;

const providerIdInteger = BigInt(
provider.replaceAll(storageProviderIdPrefixRegex, "")
);
Expand All @@ -89,7 +89,7 @@ export function BeneficiaryContractDeployWidget({
}),
value: "0",
};
}, [admin, factoryAddress, isFormValid, provider, withdrawer]);
}, [factoryAddress, values]);

const clear = useCallback(() => {
resetForm();
Expand All @@ -101,8 +101,9 @@ export function BeneficiaryContractDeployWidget({
abi: beneficiaryFactoryAbi,
address: factoryAddress,
eventName: "ProxyCreated",
poll: true,
pollingInterval: 2_000,
onLogs(logs) {
console.log(logs, transactionHash);
const createdContactLog = logs.find((log) => {
return log.transactionHash === transactionHash && !!log.args.proxy;
});
Expand Down