From d0ac28b0a0a7329142b0ceb77e37d100fbe08e8d Mon Sep 17 00:00:00 2001 From: Gabriel Diaz Date: Fri, 13 Dec 2024 11:01:39 -0300 Subject: [PATCH] fix: AuthorizeActionOptions for bids --- webapp/src/modules/bid/utils.ts | 42 ++++++++++++++------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/webapp/src/modules/bid/utils.ts b/webapp/src/modules/bid/utils.ts index 2d94de9170..d1dc677b72 100644 --- a/webapp/src/modules/bid/utils.ts +++ b/webapp/src/modules/bid/utils.ts @@ -104,36 +104,30 @@ export function getAcceptBidAuthorizationOptions( } const offchainMarketplaceContract = getContract(ContractName.OffChainMarketplace, bid.chainId) + const authorizeActionOptions = { + targetContractName: ContractName.ERC721CollectionV2, + targetContractLabel: targetContractLabel || ContractName.ERC721CollectionV2, + authorizedAddress: offchainMarketplaceContract.address, + targetContract: { + address: bid.contractAddress, + chainId: bid.chainId, + name: ContractName.ERC721CollectionV2, + network: bid.network + } as Contract, + authorizedContractLabel: offchainMarketplaceContract.name, + onAuthorized: onAccept + } + if ('tokenId' in bid) { return { - targetContractName: ContractName.ERC721, - targetContractLabel: targetContractLabel || ContractName.ERC721, - authorizedAddress: offchainMarketplaceContract.address, - targetContract: { - address: bid.contractAddress, - chainId: bid.chainId, - name: ContractName.ERC721, - network: bid.network - } as Contract, + ...authorizeActionOptions, authorizationType: AuthorizationType.APPROVAL, - authorizedContractLabel: offchainMarketplaceContract.name, - tokenId: bid.tokenId, - onAuthorized: onAccept + tokenId: bid.tokenId } } else { return { - targetContractName: ContractName.ERC721CollectionV2, - targetContractLabel: targetContractLabel || ContractName.ERC721CollectionV2, - authorizedAddress: offchainMarketplaceContract.address, - targetContract: { - address: bid.contractAddress, - chainId: bid.chainId, - name: ContractName.ERC721CollectionV2, - network: bid.network - } as Contract, - authorizationType: AuthorizationType.MINT, - authorizedContractLabel: offchainMarketplaceContract.name, - onAuthorized: onAccept + ...authorizeActionOptions, + authorizationType: AuthorizationType.MINT } } }