From 5b84f07d4957d92650d4b9cdf420e80a13b00d1e Mon Sep 17 00:00:00 2001 From: mihaisc Date: Tue, 27 Oct 2020 18:17:18 +0200 Subject: [PATCH] fix minting Signed-off-by: mihaisc --- src/hooks/usePricing/usePricing.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hooks/usePricing/usePricing.ts b/src/hooks/usePricing/usePricing.ts index ff22dde..3afadd6 100644 --- a/src/hooks/usePricing/usePricing.ts +++ b/src/hooks/usePricing/usePricing.ts @@ -203,16 +203,16 @@ function usePricing(ddo: DDO): UsePricing { const { type, - dtAmount, oceanAmount, price, weightOnDataToken, swapFee } = priceOptions + let dtAmount = priceOptions.dtAmount const isPool = type === 'dynamic' if (!isPool && !config.fixedRateExchangeAddress) { - Logger.error(`'fixedRateExchangeAddress' not set in ccnfig.`) + Logger.error(`'fixedRateExchangeAddress' not set in config.`) return } @@ -222,6 +222,8 @@ function usePricing(ddo: DDO): UsePricing { setStep(99, 'pool') try { + //if fixedPrice set dt to max amount + if (!isPool) dtAmount = 1000 await mint(`${dtAmount}`) // dtAmount for fixed price is set to max @@ -237,7 +239,7 @@ function usePricing(ddo: DDO): UsePricing { ) .next((step: number) => setStep(step, 'pool')) : await ocean.fixedRateExchange - .create(dataToken, `${price}`, accountId, `1000`) + .create(dataToken, `${price}`, accountId, '${dtAmount}') .next((step: number) => setStep(step, 'exchange')) await sleep(20000) return tx