-
Notifications
You must be signed in to change notification settings - Fork 648
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
Conversation
…/refactor-buy-with-crypto-modal
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
d39194e
to
65519c3
Compare
…t/mint-name-with-crypto-modal
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.
LGTM!! great job 👏👏👏
@@ -0,0 +1,13 @@ | |||
import { t } from 'decentraland-dapps/dist/modules/translation' |
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 file webapp/src/components/AssetPage/SaleActionBox/BuyNFTButtons/BuyWithCryptoButton/BuyWithCryptoButton.container.ts
looks empty, should re remove it?
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.
Removed it!
{t(`buy_with_crypto_modal.buy_with_card`)} | ||
</ChainButton> | ||
{onBuyWithCard && ( | ||
<ChainButton |
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.
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?
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.
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), |
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.
Can we try to unify the verb here? Either claim or mint, WDYT?
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.
Done! I've used Minting as the modal name is called Mint
.
} = props | ||
|
||
const onBuyNatively = useCallback(() => { | ||
console.log('Executing on buy natively') |
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.
can we remove this log?
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.
Removed it!
if (item.price === '0' || isPriceTooLow(item.price)) { | ||
return { | ||
gasCost: undefined, | ||
isFetchingGasCost: false |
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 calculate the gast cost for this cases? the meta tx are not available and it's not going through the provider, right?
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.
Removed it!
@@ -246,8 +245,15 @@ export const useBuyNftGasCost = ( | |||
selectedChain, | |||
order.network | |||
) | |||
|
|||
if (order.price === '0' || isPriceTooLow(order.price)) { |
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.
in case we keep this logic, should we move it into a function to avoid having it repeated?
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.
Removed it!
@@ -117,4 +135,48 @@ export function* ensSaga() { | |||
yield put(claimNameFailure(ensError)) | |||
} | |||
} | |||
|
|||
function* handleClaimNameCrossChainRequest( |
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.
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)
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.
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) { |
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.
can't we just put the claimNameSuccess
action in both cases? I don't fully understand the difference between putting the 2 different actions.
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.
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.
webapp/src/modules/ens/actions.ts
Outdated
@@ -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' |
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.
can we move this import up a few lines?
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.
Moved it!
import { getIsClaimingNamesWithFiatEnabled } from '../../../modules/features/selectors' | ||
import { | ||
getIsClaimingNamesWithFiatEnabled, | ||
getIsMintingNamesWithAxelarEnabled |
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.
nit-pick: can we change the name Axelar
for CrossChain
to keep consistency?
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
MintNameWithCryptoModal
which uses theBuyWithCryptoModal
.