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

Commit

Permalink
lib update
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaisc committed Sep 28, 2020
1 parent c937847 commit 92c4e4b
Show file tree
Hide file tree
Showing 7 changed files with 3,236 additions and 3,846 deletions.
3 changes: 2 additions & 1 deletion example/config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module.exports = function override(config, env) {
...config.resolve,
alias: {
...config.resolve.alias,
react: path.resolve('../node_modules/react')
react: path.resolve('../node_modules/react'),
"@oceanprotocol/lib": path.resolve('../node_modules/@oceanprotocol/lib')
}
}
}
Expand Down
7,009 changes: 3,196 additions & 3,813 deletions example/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/src/Publish.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Metadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/Metadata'

export function Publish() {
const { publish, publishStepText, isLoading } = usePublish()
const [ddo, setDdo] = useState<DDO | undefined>()
const [ddo, setDdo] = useState<DDO | undefined|null>()

const asset = {
main: {
Expand Down
20 changes: 13 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.2.5",
"@oceanprotocol/lib": "^0.3.1",
"axios": "^0.20.0",
"decimal.js": "^10.2.0",
"web3": "^1.3.0",
Expand Down
20 changes: 10 additions & 10 deletions src/hooks/useCompute/useCompute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function useCompute(): UseCompute {
computeService,
rawAlgorithmMeta
)
const order = await ocean.compute.order(
const tokenTransfer = await ocean.compute.order(
accountId,
did,
computeService.index,
Expand All @@ -91,18 +91,18 @@ function useCompute(): UseCompute {
)

setStep(1)
const computeOrder = JSON.parse(order)
Logger.log('compute order', computeOrder)
const tokenTransfer = await ocean.datatokens.transferWei(
computeOrder.dataToken,
computeOrder.to,
String(computeOrder.numTokens),
computeOrder.from
)
// const computeOrder = JSON.parse(order)
// Logger.log('compute order', computeOrder)
// const tokenTransfer = await ocean.datatokens.transferWei(
// computeOrder.dataToken,
// computeOrder.to,
// String(computeOrder.numTokens),
// computeOrder.from
// )
setStep(2)
const response = await ocean.compute.start(
did,
(tokenTransfer as any).transactionHash,
tokenTransfer,
dataTokenAddress,
account,
undefined,
Expand Down
26 changes: 13 additions & 13 deletions src/hooks/useConsume/useConsume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,27 @@ function useConsume(): UseConsume {
await checkAndBuyDT(ocean, dataTokenAddress, account, config)

setStep(1)
const order = await ocean.assets.order(
const tokenTransfer = await ocean.assets.order(
did as string,
serviceType,
accountId
)
Logger.log('order created', order)
Logger.log('order created', tokenTransfer)
setStep(2)
const res = JSON.parse(order)
Logger.log('order parsed', res)
Logger.log('ocean.datatokens before transfer', ocean.datatokens)
const tokenTransfer = await ocean.datatokens.transferWei(
res.dataToken,
res.to,
String(res.numTokens),
res.from
)
Logger.log('token transfered', tokenTransfer)
// const res = JSON.parse(order)
// Logger.log('order parsed', res)
// Logger.log('ocean.datatokens before transfer', ocean.datatokens)
// const tokenTransfer = await ocean.datatokens.transferWei(
// res.dataToken,
// res.to,
// String(res.numTokens),
// res.from
// )
// Logger.log('token transfered', tokenTransfer)
setStep(3)
await ocean.assets.download(
did as string,
(tokenTransfer as any).transactionHash,
tokenTransfer,
dataTokenAddress,
account,
''
Expand Down

0 comments on commit 92c4e4b

Please sign in to comment.