mirror of
https://github.com/oceanprotocol/react.git
synced 2025-02-14 21:10:38 +01:00
fix mint
This commit is contained in:
parent
bd15ab144d
commit
d0d7de83f8
@ -83,10 +83,16 @@ function usePricing(ddo: DDO): UsePricing {
|
|||||||
setPricingStepText(messages[index])
|
setPricingStepText(messages[index])
|
||||||
}
|
}
|
||||||
|
|
||||||
async function mint(tokensToMint: string): Promise<TransactionReceipt> {
|
async function mint(
|
||||||
|
tokensToMint: string
|
||||||
|
): Promise<TransactionReceipt | void> {
|
||||||
Logger.log('mint function', dataToken, accountId)
|
Logger.log('mint function', dataToken, accountId)
|
||||||
const tx = await ocean.datatokens.mint(dataToken, accountId, tokensToMint)
|
const balance = await ocean.datatokens.balance(dataToken, accountId)
|
||||||
return tx
|
if (parseFloat(tokensToMint) > parseFloat(balance)) {
|
||||||
|
tokensToMint = String(parseFloat(tokensToMint) - parseFloat(balance))
|
||||||
|
const tx = await ocean.datatokens.mint(dataToken, accountId, tokensToMint)
|
||||||
|
return tx
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function buyDT(
|
async function buyDT(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user