mirror of
https://github.com/oceanprotocol/react.git
synced 2024-12-22 17:23:32 +01:00
updates for new version of lib
This commit is contained in:
parent
e71b2849dc
commit
8943aa0639
@ -8,7 +8,7 @@ module.exports = function override(config, env) {
|
||||
alias: {
|
||||
...config.resolve.alias,
|
||||
react: path.resolve('../node_modules/react'),
|
||||
"@oceanprotocol/lib": path.resolve('../node_modules/@oceanprotocol/lib')
|
||||
'@oceanprotocol/lib': path.resolve('../node_modules/@oceanprotocol/lib')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,25 +7,20 @@ import shortid from 'shortid'
|
||||
import { MetadataExample } from './MetadataExample'
|
||||
|
||||
export function AllDdos() {
|
||||
const { chainId, account, ocean } = useOcean()
|
||||
const { chainId, account, accountId, ocean } = useOcean()
|
||||
|
||||
const [ddos, setDdos] = useState<DDO[] | undefined>()
|
||||
|
||||
useEffect(() => {
|
||||
async function init() {
|
||||
if (!ocean || !account) return
|
||||
if (!ocean || !account || !accountId) return
|
||||
|
||||
const assets = await ocean.assets.query({
|
||||
page: 1,
|
||||
offset: 10,
|
||||
query: {},
|
||||
sort: { created: -1 }
|
||||
})
|
||||
const assets = await ocean.assets.ownerAssets(accountId)
|
||||
|
||||
setDdos(assets.results.slice(0, 4))
|
||||
}
|
||||
init()
|
||||
}, [ocean, account, chainId])
|
||||
}, [ocean, account, chainId, accountId])
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -3,13 +3,13 @@ import './App.css'
|
||||
import { OceanProvider } from '@oceanprotocol/react'
|
||||
import { Wallet } from './Wallet'
|
||||
import { Publish } from './Publish'
|
||||
import { ConfigHelper } from '@oceanprotocol/lib'
|
||||
import { ConfigHelper, Logger } from '@oceanprotocol/lib'
|
||||
import { AllDdos } from './AllDdos'
|
||||
import { ConsumeDdo } from './ConsumeDdo'
|
||||
import { NetworkMonitor } from './NetworkMonitor'
|
||||
import { LogLevel } from '@oceanprotocol/lib/dist/node/utils'
|
||||
|
||||
const configRinkeby = new ConfigHelper().getConfig('rinkeby')
|
||||
|
||||
const providerOptions = {}
|
||||
|
||||
export const web3ModalOpts = {
|
||||
@ -19,6 +19,7 @@ export const web3ModalOpts = {
|
||||
|
||||
function App() {
|
||||
console.log(configRinkeby)
|
||||
Logger.setLevel(LogLevel.Verbose)
|
||||
const init = async () => {}
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -7,12 +7,12 @@ import { Metadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/Metadata'
|
||||
|
||||
export function Publish() {
|
||||
const { publish, publishStepText, isLoading } = usePublish()
|
||||
const [ddo, setDdo] = useState<DDO | undefined|null>()
|
||||
const [ddo, setDdo] = useState<DDO | undefined | null>()
|
||||
|
||||
const asset = {
|
||||
main: {
|
||||
type: 'dataset',
|
||||
name: 'test-dataset',
|
||||
name: 'test-dataset - ' + new Date().toISOString(),
|
||||
dateCreated: new Date(Date.now()).toISOString().split('.')[0] + 'Z', // remove milliseconds
|
||||
author: 'oceanprotocol-team',
|
||||
license: 'MIT',
|
||||
|
11510
package-lock.json
generated
11510
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,7 @@
|
||||
"dist/"
|
||||
],
|
||||
"dependencies": {
|
||||
"@oceanprotocol/lib": "^0.3.1",
|
||||
"@oceanprotocol/lib": "file:../ocean-lib-js",
|
||||
"axios": "^0.20.0",
|
||||
"decimal.js": "^10.2.0",
|
||||
"web3": "^1.3.0",
|
||||
|
@ -107,7 +107,7 @@ function usePublish(): UsePublish {
|
||||
const timeout = 0
|
||||
const services: Service[] = []
|
||||
|
||||
const price = ocean.datatokens.toWei('1')
|
||||
const price = '1'
|
||||
switch (serviceType) {
|
||||
case 'access': {
|
||||
const accessService = await ocean.assets.createAccessServiceAttributes(
|
||||
@ -170,16 +170,15 @@ function usePublish(): UsePublish {
|
||||
|
||||
Logger.log('services created', services)
|
||||
|
||||
const ddo = await ocean.assets
|
||||
.create(
|
||||
asset,
|
||||
account,
|
||||
services,
|
||||
dataTokenOptions?.cap,
|
||||
dataTokenOptions?.name,
|
||||
dataTokenOptions?.symbol
|
||||
)
|
||||
.next(setStep)
|
||||
const ddo = await ocean.assets.create(
|
||||
asset,
|
||||
account,
|
||||
services,
|
||||
dataTokenOptions?.cap,
|
||||
dataTokenOptions?.name,
|
||||
dataTokenOptions?.symbol
|
||||
)
|
||||
// .next(setStep)
|
||||
Logger.log('ddo created', ddo)
|
||||
setStep(7)
|
||||
await mint(ddo.dataToken, tokensToMint)
|
||||
|
Loading…
Reference in New Issue
Block a user