Skip to content

Commit

Permalink
fix: AuthorizeActionOptions for bids
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox committed Dec 13, 2024
1 parent ac14d7c commit d0ac28b
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions webapp/src/modules/bid/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

0 comments on commit d0ac28b

Please sign in to comment.