1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

add marketFeeAddress to consume/compute

This commit is contained in:
Matthias Kretschmann 2020-10-09 21:31:57 +02:00
parent 18fa4dd2bc
commit 8fb1998b02
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 11 additions and 3 deletions

View File

@ -2,6 +2,7 @@ module.exports = {
network: process.env.GATSBY_NETWORK || 'rinkeby', network: process.env.GATSBY_NETWORK || 'rinkeby',
infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx', infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx',
metadataStoreUri: process.env.GATSBY_METADATA_STORE_URI, metadataStoreUri: process.env.GATSBY_METADATA_STORE_URI,
// The ETH address the marketplace fee will be sent to.
marketFeeAddress: marketFeeAddress:
process.env.GATSBY_MARKET_FEE_ADDRESS || process.env.GATSBY_MARKET_FEE_ADDRESS ||
'0x903322C7E45A60d7c8C3EA236c5beA9Af86310c7', '0x903322C7E45A60d7c8C3EA236c5beA9Af86310c7',

View File

@ -15,6 +15,7 @@ import styles from './Compute.module.css'
import Button from '../../atoms/Button' import Button from '../../atoms/Button'
import Input from '../../atoms/Input' import Input from '../../atoms/Input'
import Alert from '../../atoms/Alert' import Alert from '../../atoms/Alert'
import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
export default function Compute({ export default function Compute({
ddo, ddo,
@ -25,7 +26,8 @@ export default function Compute({
}): ReactElement { }): ReactElement {
const { ocean } = useOcean() const { ocean } = useOcean()
const { compute, isLoading, computeStepText, computeError } = useCompute() const { compute, isLoading, computeStepText, computeError } = useCompute()
const computeService = ddo.findServiceByType('compute').attributes.main const { marketFeeAddress } = useSiteMetadata()
const computeService = ddo.findServiceByType('compute')
const metadataService = ddo.findServiceByType('metadata') const metadataService = ddo.findServiceByType('metadata')
const [isJobStarting, setIsJobStarting] = useState(false) const [isJobStarting, setIsJobStarting] = useState(false)
@ -75,7 +77,8 @@ export default function Compute({
computeService, computeService,
ddo.dataToken, ddo.dataToken,
algorithmRawCode, algorithmRawCode,
computeContainer computeContainer,
marketFeeAddress
) )
setIsPublished(true) setIsPublished(true)

View File

@ -8,6 +8,7 @@ import Web3Feedback from '../../molecules/Wallet/Feedback'
import styles from './Consume.module.css' import styles from './Consume.module.css'
import Loader from '../../atoms/Loader' import Loader from '../../atoms/Loader'
import { useOcean, useConsume } from '@oceanprotocol/react' import { useOcean, useConsume } from '@oceanprotocol/react'
import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
export default function Consume({ export default function Consume({
ddo, ddo,
@ -19,6 +20,7 @@ export default function Consume({
isBalanceSufficient: boolean isBalanceSufficient: boolean
}): ReactElement { }): ReactElement {
const { ocean } = useOcean() const { ocean } = useOcean()
const { marketFeeAddress } = useSiteMetadata()
const { consumeStepText, consume, consumeError } = useConsume() const { consumeStepText, consume, consumeError } = useConsume()
const isDisabled = !ocean || !isBalanceSufficient const isDisabled = !ocean || !isBalanceSufficient
@ -34,7 +36,9 @@ export default function Consume({
) : ( ) : (
<Button <Button
style="primary" style="primary"
onClick={() => consume(ddo.id, ddo.dataToken, 'access')} onClick={() =>
consume(ddo.id, ddo.dataToken, 'access', marketFeeAddress)
}
disabled={isDisabled} disabled={isDisabled}
> >
Buy Buy