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

transferWei

This commit is contained in:
mihaisc 2020-07-15 16:01:50 +03:00
parent 3dc0cf4792
commit e29bd48716
2 changed files with 4 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import { useEffect } from 'react'
export function ConsumeDdo() {
const { accountId, ocean } = useOcean()
const { consumeStepText, consume} = useConsume()
const { consumeStepText, consume, consumeError} = useConsume()
const [did, setDid]=useState<string|undefined>()
useEffect(() => {
async function init() {
@ -30,6 +30,7 @@ export function ConsumeDdo() {
<div>DID <input onChange={handleChange}></input></div>
<div><button onClick={consumeDid}>Consume did</button></div>
<div>{consumeStepText}</div>
<div>{consumeError}</div>
</>
)
}

View File

@ -47,7 +47,7 @@ function useConsume(): UseConsume {
setStep(2)
const res = JSON.parse(order)
Logger.log('order parsed', res)
const tokenTransfer = await ocean.datatokens.transfer(
const tokenTransfer = await ocean.datatokens.transferWei(
res.dataToken,
res.to,
res.numTokens,
@ -66,6 +66,7 @@ function useConsume(): UseConsume {
setStep(4)
} catch (error) {
setConsumeError(error.message)
Logger.error(error)
} finally {
setConsumeStep(undefined)
setConsumeStepText(undefined)