mirror of
https://github.com/oceanprotocol/react.git
synced 2024-11-25 11:28:46 +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])
|
||||
}
|
||||
|
||||
async function mint(tokensToMint: string): Promise<TransactionReceipt> {
|
||||
async function mint(
|
||||
tokensToMint: string
|
||||
): Promise<TransactionReceipt | void> {
|
||||
Logger.log('mint function', dataToken, accountId)
|
||||
const tx = await ocean.datatokens.mint(dataToken, accountId, tokensToMint)
|
||||
return tx
|
||||
const balance = await ocean.datatokens.balance(dataToken, accountId)
|
||||
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(
|
||||
|
Loading…
Reference in New Issue
Block a user