1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

fix provider fee approve for free assets

This commit is contained in:
Bogdan Fazakas 2022-06-22 06:58:29 +03:00
parent 455a68a29c
commit 256744317f

View File

@ -186,12 +186,16 @@ export async function handleComputeOrder(
initializeData.providerFee &&
initializeData.providerFee.providerFeeAmount !== '0'
) {
const baseToken =
asset?.accessDetails?.type === 'free'
? getOceanConfig(asset.chainId).oceanTokenAddress
: asset?.accessDetails?.baseToken?.address
const txApproveWei = await approveWei(
web3,
accountId,
asset.accessDetails.baseToken.address,
asset.accessDetails.datatoken.address,
initializeData.providerFee.providerFeeAmount
baseToken,
asset?.accessDetails?.datatoken?.address,
initializeData?.providerFee?.providerFeeAmount
)
if (!txApproveWei) {
toast.error('Failed to approve provider fees!')