Skip to content
This repository has been archived by the owner on Aug 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #137 from oceanprotocol/small-refactor
Browse files Browse the repository at this point in the history
ocean-lib update + small refactor
  • Loading branch information
mihaisc authored Oct 5, 2020
2 parents db32d54 + bb62fa8 commit b29d468
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 31 deletions.
14 changes: 7 additions & 7 deletions example/src/AllDdos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useCompute/useCompute.ts
Original file line number Diff line number Diff line change
@@ -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: (
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useConsume/useConsume.ts
Original file line number Diff line number Diff line change
@@ -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: (
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useMetadata/useMetadata.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/usePublish/usePublish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/providers/OceanProvider/OceanProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/utils/dtUtils.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/web3.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"jsx": "react",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"baseUrl": "src",
"sourceMap": true,
"declaration": true,
"importHelpers": true,
Expand Down

0 comments on commit b29d468

Please sign in to comment.