mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
* prototype getting ENS names the right decentralized way * get all profile metadata with ENS * refactor account display in context of top sales list * support almost all default text records * refactor text record fetching * more web3 calls reduction * package cleanup * add Publisher component test, mock out ens utils * remove mock to run @utils/ens directly * add Avatar stories * cleanup * rebase fixes * profile loading tweaks * fixes * merge cleanup * remove @ensdomains/ensjs * fetch ENS data from proxy * update avatar tests * tweak error catching for all axios fetches * test tweaks * api path fix * fetching fixes * account switching tweaks * remove unused methods * add ENS fetching tests * jest timeout tweak * update readme
21 lines
585 B
TypeScript
21 lines
585 B
TypeScript
import { useEffect, useState } from 'react'
|
|
import { NftFactory } from '@oceanprotocol/lib'
|
|
import { useWeb3 } from '@context/Web3'
|
|
import { getOceanConfig } from '@utils/ocean'
|
|
|
|
function useNftFactory(): NftFactory {
|
|
const { web3, chainId } = useWeb3()
|
|
const [nftFactory, setNftFactory] = useState<NftFactory>()
|
|
|
|
useEffect(() => {
|
|
if (!web3 || !chainId) return
|
|
const config = getOceanConfig(chainId)
|
|
const factory = new NftFactory(config?.nftFactoryAddress, web3)
|
|
setNftFactory(factory)
|
|
}, [web3, chainId])
|
|
|
|
return nftFactory
|
|
}
|
|
|
|
export default useNftFactory
|