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 &&
initializeData.providerFee.providerFeeAmount !== '0' initializeData.providerFee.providerFeeAmount !== '0'
) { ) {
const baseToken =
asset?.accessDetails?.type === 'free'
? getOceanConfig(asset.chainId).oceanTokenAddress
: asset?.accessDetails?.baseToken?.address
const txApproveWei = await approveWei( const txApproveWei = await approveWei(
web3, web3,
accountId, accountId,
asset.accessDetails.baseToken.address, baseToken,
asset.accessDetails.datatoken.address, asset?.accessDetails?.datatoken?.address,
initializeData.providerFee.providerFeeAmount initializeData?.providerFee?.providerFeeAmount
) )
if (!txApproveWei) { if (!txApproveWei) {
toast.error('Failed to approve provider fees!') toast.error('Failed to approve provider fees!')