1
0
mirror of https://github.com/oceanprotocol/react.git synced 2025-02-14 21:10:38 +01:00

fix minting

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
mihaisc 2020-10-27 18:17:18 +02:00
parent 834c9dd142
commit 5b84f07d49
No known key found for this signature in database
GPG Key ID: 4FB0C2329B4C6E29

View File

@ -203,16 +203,16 @@ function usePricing(ddo: DDO): UsePricing {
const { const {
type, type,
dtAmount,
oceanAmount, oceanAmount,
price, price,
weightOnDataToken, weightOnDataToken,
swapFee swapFee
} = priceOptions } = priceOptions
let dtAmount = priceOptions.dtAmount
const isPool = type === 'dynamic' const isPool = type === 'dynamic'
if (!isPool && !config.fixedRateExchangeAddress) { if (!isPool && !config.fixedRateExchangeAddress) {
Logger.error(`'fixedRateExchangeAddress' not set in ccnfig.`) Logger.error(`'fixedRateExchangeAddress' not set in config.`)
return return
} }
@ -222,6 +222,8 @@ function usePricing(ddo: DDO): UsePricing {
setStep(99, 'pool') setStep(99, 'pool')
try { try {
//if fixedPrice set dt to max amount
if (!isPool) dtAmount = 1000
await mint(`${dtAmount}`) await mint(`${dtAmount}`)
// dtAmount for fixed price is set to max // dtAmount for fixed price is set to max
@ -237,7 +239,7 @@ function usePricing(ddo: DDO): UsePricing {
) )
.next((step: number) => setStep(step, 'pool')) .next((step: number) => setStep(step, 'pool'))
: await ocean.fixedRateExchange : await ocean.fixedRateExchange
.create(dataToken, `${price}`, accountId, `1000`) .create(dataToken, `${price}`, accountId, '${dtAmount}')
.next((step: number) => setStep(step, 'exchange')) .next((step: number) => setStep(step, 'exchange'))
await sleep(20000) await sleep(20000)
return tx return tx