-
Notifications
You must be signed in to change notification settings - Fork 684
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
feat: Add magic auto authorization feature #2372
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -56,7 +57,7 @@ const ConfirmRentModal = ({ | |||
if (isUserTheOperatorAddress) { | |||
setOperatorAddress('') | |||
} else { | |||
setOperatorAddress(wallet!.address) | |||
setOperatorAddress(wallet?.address) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const authorizedContract = !!offchainOrdersContract && isOffchainPublicNFTOrdersEnabled ? offchainOrdersContract : marketplaceContract | |
const authorizedContract = offchainOrdersContract || marketplaceContract |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it!
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.