mirror of
https://github.com/oceanprotocol/react.git
synced 2025-02-14 21:10:38 +01:00
add marketFeeAddress
This commit is contained in:
parent
0ace964925
commit
867b52fb31
@ -15,7 +15,7 @@ interface UseMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function useMetadata(did?: DID | string): UseMetadata {
|
function useMetadata(did?: DID | string): UseMetadata {
|
||||||
const { ocean, status, config, accountId } = useOcean()
|
const { ocean, status, config, accountId, marketFeeAddress } = useOcean()
|
||||||
const [ddo, setDDO] = useState<DDO | undefined>()
|
const [ddo, setDDO] = useState<DDO | undefined>()
|
||||||
const [metadata, setMetadata] = useState<Metadata | undefined>()
|
const [metadata, setMetadata] = useState<Metadata | undefined>()
|
||||||
const [title, setTitle] = useState<string | undefined>()
|
const [title, setTitle] = useState<string | undefined>()
|
||||||
@ -33,7 +33,11 @@ function useMetadata(did?: DID | string): UseMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getBestPrice(dataTokenAddress: string): Promise<string> {
|
async function getBestPrice(dataTokenAddress: string): Promise<string> {
|
||||||
return await getBestDataTokenPrice(ocean, accountId, dataTokenAddress)
|
return await getBestDataTokenPrice(
|
||||||
|
ocean,
|
||||||
|
marketFeeAddress,
|
||||||
|
dataTokenAddress
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getMetadata(did: DID | string): Promise<Metadata> {
|
async function getMetadata(did: DID | string): Promise<Metadata> {
|
||||||
|
@ -28,6 +28,7 @@ interface OceanProviderValue {
|
|||||||
balance: Balance
|
balance: Balance
|
||||||
chainId: number | undefined
|
chainId: number | undefined
|
||||||
status: ProviderStatus
|
status: ProviderStatus
|
||||||
|
marketFeeAddress: string
|
||||||
connect: (config?: Config) => Promise<void>
|
connect: (config?: Config) => Promise<void>
|
||||||
logout: () => Promise<void>
|
logout: () => Promise<void>
|
||||||
refreshBalance: () => Promise<void>
|
refreshBalance: () => Promise<void>
|
||||||
@ -38,10 +39,12 @@ const OceanContext = createContext(null)
|
|||||||
function OceanProvider({
|
function OceanProvider({
|
||||||
initialConfig,
|
initialConfig,
|
||||||
web3ModalOpts,
|
web3ModalOpts,
|
||||||
|
marketFeeAddress,
|
||||||
children
|
children
|
||||||
}: {
|
}: {
|
||||||
initialConfig: Config
|
initialConfig: Config
|
||||||
web3ModalOpts?: Partial<ICoreOptions>
|
web3ModalOpts?: Partial<ICoreOptions>
|
||||||
|
marketFeeAddress: string
|
||||||
children: any
|
children: any
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const [web3, setWeb3] = useState<Web3 | undefined>()
|
const [web3, setWeb3] = useState<Web3 | undefined>()
|
||||||
@ -169,6 +172,7 @@ function OceanProvider({
|
|||||||
chainId,
|
chainId,
|
||||||
status,
|
status,
|
||||||
config,
|
config,
|
||||||
|
marketFeeAddress,
|
||||||
connect,
|
connect,
|
||||||
logout,
|
logout,
|
||||||
refreshBalance
|
refreshBalance
|
||||||
|
@ -5,6 +5,8 @@ export async function getCheapestPool(
|
|||||||
accountId: string,
|
accountId: string,
|
||||||
dataTokenAddress: string
|
dataTokenAddress: string
|
||||||
): Promise<{ poolAddress: string; poolPrice: string }> {
|
): Promise<{ poolAddress: string; poolPrice: string }> {
|
||||||
|
if (!ocean || !accountId || !dataTokenAddress) return
|
||||||
|
|
||||||
const tokenPools = await ocean.pool.searchPoolforDT(
|
const tokenPools = await ocean.pool.searchPoolforDT(
|
||||||
accountId,
|
accountId,
|
||||||
dataTokenAddress
|
dataTokenAddress
|
||||||
|
Loading…
x
Reference in New Issue
Block a user