Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add magic auto authorization feature #2372

Merged
merged 9 commits into from
Feb 11, 2025

Conversation

LautaroPetaccio
Copy link
Contributor

This PR adds the Magic Auto Authorization feature. This implies that Magic users will not be prompted to authorize contracts on most of the operations on the Marketplace. There's a SellModal that still has authorizations, but other operations should not show the authorization modal.
The new changes imply that we must propagate the error of the authorizations to the components. This is done in several components, most of them which use the ConfirmInputValueModal which now handles errors.

Copy link

vercel bot commented Feb 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marketplace ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 11, 2025 3:41pm

@coveralls
Copy link

coveralls commented Feb 7, 2025

Coverage Status

coverage: 66.009% (-0.06%) from 66.065%
when pulling 73ee055 on feat/add-magic-auto-authorization-signatures
into 7b25db2 on master.

@@ -56,7 +57,7 @@ const ConfirmRentModal = ({
if (isUserTheOperatorAddress) {
setOperatorAddress('')
} else {
setOperatorAddress(wallet!.address)
setOperatorAddress(wallet?.address)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we show an error message when the wallet is undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user shouldn't ever reach this modal if the wallet is not defined. I've changed the ! to ? because we shouldn't use the ! anymore.

}

const [isLoadingAuthorizations, isAuthorized] = useAuthorization(authorization, onFetchAuthorizations)
const authorizedContract = !!offchainOrdersContract && isOffchainPublicNFTOrdersEnabled ? offchainOrdersContract : marketplaceContract
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const authorizedContract = !!offchainOrdersContract && isOffchainPublicNFTOrdersEnabled ? offchainOrdersContract : marketplaceContract
const authorizedContract = offchainOrdersContract || marketplaceContract

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! Changed it

const contract = getContract({
address: authorization.authorizedAddress
})
const handleCreateOrder = () => onCreateOrder(nft, parseMANANumber(price), new Date(`${expiresAt} 00:00:00`).getTime(), fingerprint)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const handleCreateOrder = () => onCreateOrder(nft, parseMANANumber(price), new Date(`${expiresAt} 00:00:00`).getTime(), fingerprint)
const handleCreateOrder = useCallback(() => onCreateOrder(nft, parseMANANumber(price), new Date(`${expiresAt} 00:00:00`).getTime(), fingerprint), [expiresAt, fingerprint, nft, price, onCreateOrder])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it!

@LautaroPetaccio LautaroPetaccio merged commit f0a832f into master Feb 11, 2025
9 checks passed
@LautaroPetaccio LautaroPetaccio deleted the feat/add-magic-auto-authorization-signatures branch February 11, 2025 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants