Skip to content

Commit

Permalink
feat: remove old code from ClaimNamePage
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo committed Jan 22, 2024
1 parent 76a05dd commit a604fd2
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 38 deletions.
5 changes: 5 additions & 0 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@
"@walletconnect/core": "2.9.2",
"@walletconnect/keyvaluestorage": "1.0.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ import {
PRICE_IN_WEI,
isEnoughClaimMana
} from '../../../modules/ens/utils'
import {
MARKETPLACE_SERVER_URL,
marketplaceAPI
} from '../../../modules/vendor/decentraland/marketplace/api'
import { MARKETPLACE_SERVER_URL } from '../../../modules/vendor/decentraland/marketplace/api'
import { DCLController__factory } from '../../../contracts/factories/DCLController__factory'
import { Mana } from '../../Mana'
import { Props } from './ClaimNameFatFingerModal.types'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { connect } from 'react-redux'
import { push, replace } from 'connected-react-router'
import { ChainId } from '@dcl/schemas'
import { AuthIdentity } from 'decentraland-crypto-fetch'
import { openModal } from 'decentraland-dapps/dist/modules/modal/actions'
import { isConnecting } from 'decentraland-dapps/dist/modules/wallet/selectors'
import { getWallet } from '../../../modules/wallet/selectors'
import { locations } from '../../../modules/routing/locations'
import { Section } from '../../../modules/vendor/decentraland'
import { BrowseOptions } from '../../../modules/routing/types'
import { getCurrentIdentity } from '../../../modules/identity/selectors'
import { claimNameTransactionSubmitted } from '../../../modules/ens/actions'
import {
MapDispatch,
MapDispatchProps,
Expand All @@ -20,24 +16,14 @@ import ClaimNamePage from './ClaimNamePage'

const mapState = (state: RootState): MapStateProps => ({
isConnecting: isConnecting(state),
wallet: getWallet(state),
identity: (getCurrentIdentity(state) as AuthIdentity | null) ?? undefined
wallet: getWallet(state)
})

const mapDispatch = (dispatch: MapDispatch): MapDispatchProps => ({
onBrowse: (options?: BrowseOptions) =>
dispatch(push(locations.names({ ...options, section: Section.ENS }))),
onClaim: (name: string) =>
dispatch(openModal('ClaimNameFatFingerModal', { name })),
onClaimTxSubmitted: (
subdomain: string,
address: string,
chainId: ChainId,
txHash: string
) =>
dispatch(
claimNameTransactionSubmitted(subdomain, address, chainId, txHash)
),
onRedirect: path => dispatch(replace(path))
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ jest.mock('../../../modules/ens/utils', () => ({

describe('ClaimNamePage', () => {
let walletMock: Wallet
let currentManaMock: number
let onBrowseMock: Props['onBrowse']
let onClaimMock: Props['onClaim']
let onRedirectMock: Props['onRedirect']

const renderAndTypeText = async (text: string) => {
const matchers = renderWithProviders(
<ClaimNamePage
currentMana={currentManaMock}
wallet={walletMock}
isConnecting={false}
onClaim={onClaimMock}
Expand Down Expand Up @@ -105,7 +103,6 @@ describe('ClaimNamePage', () => {
})
describe('and has enough funds to claim the NAME', () => {
beforeEach(() => {
currentManaMock = 100
walletMock = {} as Wallet
onClaimMock = jest.fn()
})
Expand All @@ -123,7 +120,6 @@ describe('ClaimNamePage', () => {
})
describe('and does not have enough funds to claim the NAME', () => {
beforeEach(() => {
currentManaMock = 99 // 100 is the mana needed
walletMock = {} as Wallet
onClaimMock = jest.fn()
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
import { Dispatch } from 'redux'
import { CallHistoryMethodAction } from 'connected-react-router'
import { Wallet } from 'decentraland-dapps/dist/modules/wallet/types'
import { AuthIdentity } from 'decentraland-crypto-fetch'
import {
OpenModalAction,
openModal
} from 'decentraland-dapps/dist/modules/modal/actions'
import { BrowseOptions } from '../../../modules/routing/types'
import {
ClaimNameTransactionSubmittedAction,
claimNameTransactionSubmitted
} from '../../../modules/ens/actions'

export type Props = {
wallet: Wallet | null
isConnecting: boolean
identity: AuthIdentity | undefined
onClaimTxSubmitted: typeof claimNameTransactionSubmitted
onBrowse: (options?: BrowseOptions) => void
onClaim: typeof openModal
onRedirect: (path: string) => void
}

export type MapStateProps = Pick<Props, 'wallet' | 'isConnecting' | 'identity'>
export type MapStateProps = Pick<Props, 'wallet' | 'isConnecting'>
export type MapDispatchProps = Pick<
Props,
'onBrowse' | 'onClaim' | 'onRedirect' | 'onClaimTxSubmitted'
>
export type MapDispatch = Dispatch<
| CallHistoryMethodAction
| OpenModalAction
| ClaimNameTransactionSubmittedAction
'onBrowse' | 'onClaim' | 'onRedirect'
>
export type MapDispatch = Dispatch<CallHistoryMethodAction | OpenModalAction>
5 changes: 5 additions & 0 deletions webapp/src/modules/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { all } from 'redux-saga/effects'
import { AuthIdentity } from 'decentraland-crypto-fetch'
import { ApplicationName } from 'decentraland-dapps/dist/modules/features/types'
import { authorizationSaga } from 'decentraland-dapps/dist/modules/authorization/sagas'
import { FiatGateway } from 'decentraland-dapps/dist/modules/gateway/types'
import { createAnalyticsSaga } from 'decentraland-dapps/dist/modules/analytics/sagas'
import { createProfileSaga } from 'decentraland-dapps/dist/modules/profile/sagas'
import { transactionSaga } from 'decentraland-dapps/dist/modules/transaction/sagas'
Expand Down Expand Up @@ -55,6 +56,10 @@ const contentClient = createContentClient({
})

const gatewaySaga = createGatewaySaga({
[FiatGateway.WERT]: {
marketplaceServerURL: config.get('MARKETPLACE_SERVER_URL'),
url: config.get('WERT_API_URL')
},
[NetworkGatewayType.MOON_PAY]: {
apiBaseUrl: config.get('MOON_PAY_API_URL'),
apiKey: config.get('MOON_PAY_API_KEY'),
Expand Down

0 comments on commit a604fd2

Please sign in to comment.