mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Feature/issue 1175 catch user rejection buy (#1177)
* fix approval rejection on buyDtFromPool * fix approval rejection on order
This commit is contained in:
parent
1eacf9d93e
commit
fc6e00669c
@ -60,6 +60,9 @@ export async function order(
|
||||
orderPriceAndFees.price,
|
||||
false
|
||||
)
|
||||
if (!txApprove) {
|
||||
return
|
||||
}
|
||||
|
||||
const freParams = {
|
||||
exchangeContract: config.fixedRateExchangeAddress,
|
||||
|
@ -56,6 +56,9 @@ export async function buyDtFromPool(
|
||||
dtPrice.tokenAmount,
|
||||
false
|
||||
)
|
||||
if (!approveTx) {
|
||||
return
|
||||
}
|
||||
const result = await pool.swapExactAmountOut(
|
||||
accountId,
|
||||
accessDetails.addressOrId,
|
||||
|
@ -146,9 +146,7 @@ export default function Download({
|
||||
asset.accessDetails.datatoken?.symbol
|
||||
)[0]
|
||||
)
|
||||
|
||||
const tx = await buyDtFromPool(asset.accessDetails, accountId, web3)
|
||||
|
||||
if (!tx) {
|
||||
toast.error('Failed to buy datatoken from pool!')
|
||||
setIsLoading(false)
|
||||
@ -162,7 +160,11 @@ export default function Download({
|
||||
)[asset.accessDetails?.type === 'fixed' ? 2 : 1]
|
||||
)
|
||||
const orderTx = await order(web3, asset, orderPriceAndFees, accountId)
|
||||
|
||||
if (!orderTx) {
|
||||
toast.error('Failed to buy datatoken from pool!')
|
||||
setIsLoading(false)
|
||||
return
|
||||
}
|
||||
setIsOwned(true)
|
||||
setValidOrderTx(orderTx.transactionHash)
|
||||
} catch (ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user