mirror of
https://github.com/oceanprotocol/react.git
synced 2025-02-14 21:10:38 +01:00
quick example fix
Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
parent
6981863794
commit
2701b33b38
2549
example/package-lock.json
generated
2549
example/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import './App.css'
|
import './App.css'
|
||||||
import { OceanProvider } from '@oceanprotocol/react'
|
import { OceanProvider } from '@oceanprotocol/react'
|
||||||
import { Wallet } from './Wallet'
|
import { Wallet } from './Wallet'
|
||||||
@ -8,7 +8,6 @@ import { AllDdos } from './AllDdos'
|
|||||||
import { ConsumeDdo } from './ConsumeDdo'
|
import { ConsumeDdo } from './ConsumeDdo'
|
||||||
import { NetworkMonitor } from './NetworkMonitor'
|
import { NetworkMonitor } from './NetworkMonitor'
|
||||||
import { LogLevel } from '@oceanprotocol/lib/dist/node/utils'
|
import { LogLevel } from '@oceanprotocol/lib/dist/node/utils'
|
||||||
import { Pricing } from './Pricing'
|
|
||||||
|
|
||||||
const configRinkeby = new ConfigHelper().getConfig('rinkeby')
|
const configRinkeby = new ConfigHelper().getConfig('rinkeby')
|
||||||
const providerOptions = {}
|
const providerOptions = {}
|
||||||
@ -27,6 +26,8 @@ function App() {
|
|||||||
init()
|
init()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
const [did, setDid] = useState<string | undefined>()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<OceanProvider initialConfig={configRinkeby} web3ModalOpts={web3ModalOpts}>
|
<OceanProvider initialConfig={configRinkeby} web3ModalOpts={web3ModalOpts}>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
@ -40,9 +41,6 @@ function App() {
|
|||||||
<div>
|
<div>
|
||||||
<Publish />
|
<Publish />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<Pricing />
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
<ConsumeDdo />
|
<ConsumeDdo />
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,13 +6,6 @@ import { Metadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/Metadata'
|
|||||||
|
|
||||||
export function Publish() {
|
export function Publish() {
|
||||||
const { publish, publishStepText, isLoading } = usePublish()
|
const { publish, publishStepText, isLoading } = usePublish()
|
||||||
const {
|
|
||||||
createPricing,
|
|
||||||
pricingStep,
|
|
||||||
pricingStepText,
|
|
||||||
pricingIsLoading,
|
|
||||||
pricingError
|
|
||||||
} = usePricing()
|
|
||||||
const [ddo, setDdo] = useState<DDO | undefined | null>()
|
const [ddo, setDdo] = useState<DDO | undefined | null>()
|
||||||
|
|
||||||
const asset = {
|
const asset = {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { useOcean, usePricing } from '@oceanprotocol/react'
|
import { PriceOptions, useOcean, usePricing } from '@oceanprotocol/react'
|
||||||
// import { useOcean, usePublish } from '@oceanprotocol/react'
|
// import { useOcean, usePublish } from '@oceanprotocol/react'
|
||||||
import { DDO } from '@oceanprotocol/lib'
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
@ -16,14 +16,16 @@ export function Trade() {
|
|||||||
pricingStepText,
|
pricingStepText,
|
||||||
pricingIsLoading,
|
pricingIsLoading,
|
||||||
pricingError
|
pricingError
|
||||||
} = usePricing()
|
} = usePricing(new DDO())
|
||||||
const [datatoken, setDatatoken] = useState<string | undefined>()
|
const [datatoken, setDatatoken] = useState<string | undefined>()
|
||||||
|
|
||||||
|
|
||||||
const handleBuy = async () => {
|
const handleBuy = async () => {
|
||||||
const tx = await buyDT(datatoken, '1')
|
const tx = await buyDT('1')
|
||||||
console.log(tx)
|
console.log(tx)
|
||||||
}
|
}
|
||||||
const handleSell = async () => {
|
const handleSell = async () => {
|
||||||
const tx = await buyDT(datatoken, '1')
|
const tx = await buyDT('1')
|
||||||
console.log(tx)
|
console.log(tx)
|
||||||
}
|
}
|
||||||
const handleChange = (e: any) => {
|
const handleChange = (e: any) => {
|
||||||
@ -37,8 +39,8 @@ export function Trade() {
|
|||||||
type: 'fixed',
|
type: 'fixed',
|
||||||
weightOnDataToken: '',
|
weightOnDataToken: '',
|
||||||
swapFee: ''
|
swapFee: ''
|
||||||
}
|
} as PriceOptions
|
||||||
const tx = await createPricing(datatoken, priceOptions)
|
const tx = await createPricing(priceOptions)
|
||||||
console.log(tx)
|
console.log(tx)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,7 +25,7 @@
|
|||||||
"dist/"
|
"dist/"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oceanprotocol/lib": "^0.9.12",
|
"@oceanprotocol/lib": "^0.9.14",
|
||||||
"axios": "^0.21.0",
|
"axios": "^0.21.0",
|
||||||
"decimal.js": "^10.2.1",
|
"decimal.js": "^10.2.1",
|
||||||
"web3": "^1.3.0",
|
"web3": "^1.3.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user