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