From e29bd48716b738cf74d3fbb9875e25dd44077be6 Mon Sep 17 00:00:00 2001 From: mihaisc Date: Wed, 15 Jul 2020 16:01:50 +0300 Subject: [PATCH] transferWei --- example/src/ConsumeDdo.tsx | 3 ++- src/hooks/useConsume/useConsume.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/example/src/ConsumeDdo.tsx b/example/src/ConsumeDdo.tsx index 11482bc..94a5617 100644 --- a/example/src/ConsumeDdo.tsx +++ b/example/src/ConsumeDdo.tsx @@ -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() useEffect(() => { async function init() { @@ -30,6 +30,7 @@ export function ConsumeDdo() {
DID
{consumeStepText}
+
{consumeError}
) } diff --git a/src/hooks/useConsume/useConsume.ts b/src/hooks/useConsume/useConsume.ts index e062814..a98f8e8 100644 --- a/src/hooks/useConsume/useConsume.ts +++ b/src/hooks/useConsume/useConsume.ts @@ -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)