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 Mint name with crypto modal #2140

Merged
merged 24 commits into from
Feb 22, 2024

Conversation

LautaroPetaccio
Copy link
Contributor

This PR adds the MintNameWithCryptoModal which uses the BuyWithCryptoModal.

Copy link

vercel bot commented Feb 17, 2024

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 22, 2024 3:30pm

@coveralls
Copy link

coveralls commented Feb 17, 2024

Coverage Status

coverage: 65.958% (+0.1%) from 65.86%
when pulling cc9acb7 on feat/mint-name-with-crypto-modal
into 558dd01 on master.

Base automatically changed from fix/refactor-buy-with-crypto-modal to master February 20, 2024 14:35
@fzavalia fzavalia force-pushed the feat/mint-name-with-crypto-modal branch from d39194e to 65519c3 Compare February 20, 2024 15:21
Copy link
Contributor

@juanmahidalgo juanmahidalgo left a comment

Choose a reason for hiding this comment

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

LGTM!! great job 👏👏👏

@@ -0,0 +1,13 @@
import { t } from 'decentraland-dapps/dist/modules/translation'
Copy link
Contributor

Choose a reason for hiding this comment

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

the file webapp/src/components/AssetPage/SaleActionBox/BuyNFTButtons/BuyWithCryptoButton/BuyWithCryptoButton.container.ts looks empty, should re remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it!

{t(`buy_with_crypto_modal.buy_with_card`)}
</ChainButton>
{onBuyWithCard && (
<ChainButton
Copy link
Contributor

Choose a reason for hiding this comment

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

might not be part of the scope of the PR but should we change this ChainButton to a regular one? Since it's buying with card and it won't matter in which chain is the asset, right?
Also, can we turn onBuyWithCard to be a mandatory param so we don't have to do this checks? as the one above in line 344. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that we should definitely change it. I'll apply the change in a different PR with more refactors.


const mapState = (state: RootState): MapStateProps => {
return {
isClaimingName: isLoadingType(getLoading(state), CLAIM_NAME_REQUEST),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we try to unify the verb here? Either claim or mint, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! I've used Minting as the modal name is called Mint.

} = props

const onBuyNatively = useCallback(() => {
console.log('Executing on buy natively')
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove this log?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it!

if (item.price === '0' || isPriceTooLow(item.price)) {
return {
gasCost: undefined,
isFetchingGasCost: false
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 calculate the gast cost for this cases? the meta tx are not available and it's not going through the provider, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it!

@@ -246,8 +245,15 @@ export const useBuyNftGasCost = (
selectedChain,
order.network
)

if (order.price === '0' || isPriceTooLow(order.price)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

in case we keep this logic, should we move it into a function to avoid having it repeated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it!

@@ -117,4 +135,48 @@ export function* ensSaga() {
yield put(claimNameFailure(ensError))
}
}

function* handleClaimNameCrossChainRequest(
Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT if we create something generic like EXECUTE_ROUTE_REQUEST and use it to execute cross-chain routes and later on dispatch the success action depending on what is getting bought? (might get out of scope if too complex, we can leave it for later)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally on board with this change, I'll apply it in a second PR with the sagas tests.

@@ -74,7 +87,12 @@ export function* ensSaga() {
content: ethers.constants.AddressZero,
contractAddress: dclRegistrarContract.address
}
yield put(claimNameSuccess(ens, subdomain, hash))

if (isCrossChain) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can't we just put the claimNameSuccess action in both cases? I don't fully understand the difference between putting the 2 different actions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As we split the loading selector into buying natively and cross chain, this action should eventually end up clearing the cross chain request action loader. I'll keep it for now and I'll try to refactor the modal into a single loader to later see if we can simplify this and other requests as well.

@@ -2,6 +2,7 @@ import { action } from 'typesafe-actions'
import { ChainId } from '@dcl/schemas'
import { buildTransactionPayload } from 'decentraland-dapps/dist/modules/transaction/utils'
import { ENS, ENSError } from './types'
import { Route } from 'decentraland-transactions/crossChain'
Copy link
Contributor

Choose a reason for hiding this comment

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

can we move this import up a few lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved it!

import { getIsClaimingNamesWithFiatEnabled } from '../../../modules/features/selectors'
import {
getIsClaimingNamesWithFiatEnabled,
getIsMintingNamesWithAxelarEnabled
Copy link
Contributor

Choose a reason for hiding this comment

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

nit-pick: can we change the name Axelar for CrossChain to keep consistency?

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 2e18a55 into master Feb 22, 2024
7 checks passed
@LautaroPetaccio LautaroPetaccio deleted the feat/mint-name-with-crypto-modal branch February 22, 2024 15:41
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.

None yet

4 participants