Update contracts context

This commit is contained in:
Serkan Reis 2023-10-07 10:46:37 +03:00
parent ca8f5cca58
commit b697b1a857

View File

@ -6,6 +6,8 @@ import type { UseBaseMinterContractProps } from 'contracts/baseMinter'
import { useBaseMinterContract } from 'contracts/baseMinter'
import { type UseOpenEditionFactoryContractProps, useOpenEditionFactoryContract } from 'contracts/openEditionFactory'
import { type UseOpenEditionMinterContractProps, useOpenEditionMinterContract } from 'contracts/openEditionMinter'
import type { UseRoyaltyRegistryContractProps } from 'contracts/royaltyRegistry'
import { useRoyaltyRegistryContract } from 'contracts/royaltyRegistry'
import type { UseSG721ContractProps } from 'contracts/sg721'
import { useSG721Contract } from 'contracts/sg721'
import type { UseVendingFactoryContractProps } from 'contracts/vendingFactory'
@ -36,6 +38,7 @@ export interface ContractsStore extends State {
openEditionFactory: UseOpenEditionFactoryContractProps | null
badgeHub: UseBadgeHubContractProps | null
splits: UseSplitsContractProps | null
royaltyRegistry: UseRoyaltyRegistryContractProps | null
}
/**
@ -52,6 +55,7 @@ export const defaultValues: ContractsStore = {
openEditionFactory: null,
badgeHub: null,
splits: null,
royaltyRegistry: null,
}
/**
@ -85,6 +89,7 @@ const ContractsSubscription: VFC = () => {
const openEditionFactory = useOpenEditionFactoryContract()
const badgeHub = useBadgeHubContract()
const splits = useSplitsContract()
const royaltyRegistry = useRoyaltyRegistryContract()
useEffect(() => {
useContracts.setState({
@ -98,8 +103,9 @@ const ContractsSubscription: VFC = () => {
openEditionFactory,
badgeHub,
splits,
royaltyRegistry,
})
}, [sg721, vendingMinter, baseMinter, whitelist, vendingFactory, baseFactory, badgeHub, splits])
}, [sg721, vendingMinter, baseMinter, whitelist, vendingFactory, baseFactory, badgeHub, splits, royaltyRegistry])
return null
}