1
0
mirror of https://github.com/oceanprotocol/react.git synced 2024-12-23 01:29:49 +01:00

ocean-lib update + small refactor

This commit is contained in:
mihaisc 2020-10-05 10:09:42 +03:00
parent db32d54ed8
commit bb62fa8978
No known key found for this signature in database
GPG Key ID: 4FB0C2329B4C6E29
11 changed files with 32 additions and 31 deletions

View File

@ -15,13 +15,13 @@ export function AllDdos() {
async function init() {
if (!ocean || !accountId || !accountId) return
const assets = await ocean.assets.ownerAssets(accountId)
// const assets = await ocean.assets.query({
// page: 1,
// offset: 10,
// query: {},
// sort: { created: -1 }
// })
//const assets = await ocean.assets.ownerAssets(accountId)
const assets = await ocean.assets.query({
page: 1,
offset: 10,
query: {},
sort: { created: -1 }
})
console.log('assets', assets.results)
setDdos(assets.results.slice(0, 4))
}

14
package-lock.json generated
View File

@ -1516,17 +1516,17 @@
}
},
"@oceanprotocol/contracts": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.5.2.tgz",
"integrity": "sha512-PTMeP8Ixe66F2YMUgVLibg9k7r2db85Syb66tWUpI+dGnt5KzW1SmQOsyVRjp3x8avRAyMFYaOodXp570jnsmQ=="
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.5.3.tgz",
"integrity": "sha512-gJ8qQACJgxOPIrPE0OFQ09iYXBAisOGg56EmelQlsMUgp0yY0DKgBntDP83S/Ho1yBjGygqfxCjQrPH63hh/PA=="
},
"@oceanprotocol/lib": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.5.3.tgz",
"integrity": "sha512-LYKqgAuf5PNOiGr6Je6v8yupaFmFojiPtkl/gywlBhF/MsMn/PdKLvHRaNge5y69hoJVXfYYEpr0HzyHq9Mx5w==",
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.5.5.tgz",
"integrity": "sha512-TJTehUaQnFfNp0dJmw0t15+mpYbTkeF+RX4oc6D5FN7hmlhdvC8kfGf8yeHiqxI2Nb703foFLSSs38MWu/XEpg==",
"requires": {
"@ethereum-navigator/navigator": "^0.5.0",
"@oceanprotocol/contracts": "^0.5.1",
"@oceanprotocol/contracts": "^0.5.3",
"decimal.js": "^10.2.0",
"fs": "0.0.1-security",
"lzma": "^2.3.2",

View File

@ -25,7 +25,7 @@
"dist/"
],
"dependencies": {
"@oceanprotocol/lib": "^0.5.3",
"@oceanprotocol/lib": "^0.5.5",
"axios": "^0.20.0",
"decimal.js": "^10.2.1",
"web3": "^1.3.0",

View File

@ -1,10 +1,10 @@
import { useState } from 'react'
import { useOcean } from '../../providers'
import { useOcean } from 'providers'
import { ComputeValue } from './ComputeOptions'
import { Logger } from '@oceanprotocol/lib'
import { MetadataAlgorithm } from '@oceanprotocol/lib/dist/node/ddo/interfaces/MetadataAlgorithm'
import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/ComputeJob'
import { checkAndBuyDT } from '../../utils/dtUtils'
import { checkAndBuyDT } from 'utils/dtUtils'
interface UseCompute {
compute: (

View File

@ -1,8 +1,8 @@
import { useState } from 'react'
import { useOcean } from '../../providers'
import { feedback } from '../../utils'
import { useOcean } from 'providers'
import { feedback } from 'utils'
import { DID, Logger, ServiceType } from '@oceanprotocol/lib'
import { checkAndBuyDT } from '../../utils/dtUtils'
import { checkAndBuyDT } from 'utils/dtUtils'
interface UseConsume {
consume: (

View File

@ -1,9 +1,9 @@
import { useState, useEffect, useCallback } from 'react'
import { DID, DDO, Metadata, Logger } from '@oceanprotocol/lib'
import { useOcean } from '../../providers'
import ProviderStatus from '../../providers/OceanProvider/ProviderStatus'
import { getBestDataTokenPrice } from '../../utils/dtUtils'
import { isDDO } from '../../utils'
import { useOcean } from 'providers'
import ProviderStatus from 'providers/OceanProvider/ProviderStatus'
import { getBestDataTokenPrice } from 'utils/dtUtils'
import { isDDO } from 'utils'
import BestPrice from './BestPrice'
interface UseMetadata {

View File

@ -6,9 +6,9 @@ import {
} from '@oceanprotocol/lib/dist/node/ddo/interfaces/Service'
import { useState } from 'react'
import { DataTokenOptions } from '.'
import { useOcean } from '../../providers'
import ProviderStatus from '../../providers/OceanProvider/ProviderStatus'
import { publishFeedback } from '../../utils'
import { useOcean } from 'providers'
import ProviderStatus from 'providers/OceanProvider/ProviderStatus'
import { publishFeedback } from 'utils'
import { PriceOptions } from './PriceOptions'
interface UsePublish {

View File

@ -12,7 +12,7 @@ import ProviderStatus from './ProviderStatus'
import { Ocean, Logger, Account, Config } from '@oceanprotocol/lib'
import Web3Modal, { ICoreOptions } from 'web3modal'
import { getDefaultProviders } from './getDefaultProviders'
import { getAccountId, getBalance } from '../../utils'
import { getAccountId, getBalance } from 'utils'
interface Balance {
eth: string | undefined

View File

@ -1,7 +1,7 @@
import { Logger, Ocean, Account, Config } from '@oceanprotocol/lib'
import { Decimal } from 'decimal.js'
import Pool from '../hooks/useMetadata/Pool'
import BestPrice from '../hooks/useMetadata/BestPrice'
import Pool from 'hooks/useMetadata/Pool'
import BestPrice from 'hooks/useMetadata/BestPrice'
import Web3 from 'web3'
export async function getCheapestPool(

View File

@ -1,6 +1,6 @@
import Web3 from 'web3'
import { Account } from '@oceanprotocol/lib'
import { Balance } from '../providers'
import { Balance } from 'providers'
export async function getAccountId(web3: Web3): Promise<string> {
const accounts = await web3.eth.getAccounts()

View File

@ -8,6 +8,7 @@
"jsx": "react",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"baseUrl": "src",
"sourceMap": true,
"declaration": true,
"importHelpers": true,