From 2f7af2b39e2ca52ee88035826f5a36293275acfa Mon Sep 17 00:00:00 2001
From: Lautaro Petaccio <1120791+LautaroPetaccio@users.noreply.github.com>
Date: Wed, 15 Sep 2021 15:12:47 -0300
Subject: [PATCH] fix: Partners not showing up (#419)
* fix: Partners not loading
* fix: Partners not showing up
* chore: Use uniswap v2
* fix: Tests and enums
* fix: All assets not being selected in account
---
webapp/.ci/.env.dev | 2 +-
webapp/.ci/.env.prd | 2 +-
webapp/.ci/.env.stg | 2 +-
webapp/.env.example | 2 +-
.../AssetBrowse/AssetBrowse.container.ts | 3 +-
.../components/AssetBrowse/AssetBrowse.tsx | 48 +++---
.../AssetBrowse/AssetBrowse.types.ts | 2 +-
.../BrowsePage/BrowsePage.container.ts | 19 +-
.../components/BrowsePage/BrowsePage.types.ts | 2 +-
.../Vendor/NFTSections/NFTSections.tsx | 6 +-
.../Vendor/NFTSidebar/NFTSidebar.tsx | 6 +-
.../Vendor/NFTSidebar/NFTSidebar.types.ts | 4 +-
webapp/src/modules/routing/sagas.ts | 7 +-
webapp/src/modules/routing/selectors.spec.ts | 162 +++++++++++++++++-
webapp/src/modules/routing/selectors.ts | 38 ++--
webapp/src/modules/routing/types.ts | 2 +-
webapp/src/modules/vendor/routing/types.ts | 18 +-
webapp/src/modules/vendor/utils.ts | 6 +-
18 files changed, 257 insertions(+), 74 deletions(-)
diff --git a/webapp/.ci/.env.dev b/webapp/.ci/.env.dev
index c890bbaa3e..7fe9354701 100644
--- a/webapp/.ci/.env.dev
+++ b/webapp/.ci/.env.dev
@@ -20,7 +20,7 @@ REACT_APP_MARKETPLACE_ADAPTER_FEE_PER_MILLION=25000
REACT_APP_MAX_PRICE_INCREASE_PERCENTAGE=15
REACT_APP_MANA_ADDRESS=0x2a8fd99c19271f4f04b1b7b9c4f7cf264b626edb
REACT_APP_CONVERTER_ADDRESS=0x2782eb28Dcb1eF4E7632273cd4e347e130Ce4646
-REACT_APP_CONVERTER_EXCHANGE=uniswap
+REACT_APP_CONVERTER_EXCHANGE=uniswap_v2
# Misc
REACT_APP_INTERCOM_APP_ID=z0h94kay
diff --git a/webapp/.ci/.env.prd b/webapp/.ci/.env.prd
index 70fef877eb..8b0920d489 100644
--- a/webapp/.ci/.env.prd
+++ b/webapp/.ci/.env.prd
@@ -20,7 +20,7 @@ REACT_APP_MARKETPLACE_ADAPTER_FEE_PER_MILLION=25000
REACT_APP_MAX_PRICE_INCREASE_PERCENTAGE=15
REACT_APP_MANA_ADDRESS=0x0f5d2fb29fb7d3cfee444a200298f468908cc942
REACT_APP_CONVERTER_ADDRESS=0x2859581da59bd4e16a866dd06b461b76d8e489a4
-REACT_APP_CONVERTER_EXCHANGE=kyber_network
+REACT_APP_CONVERTER_EXCHANGE=uniswap_v2
# Misc
REACT_APP_INTERCOM_APP_ID=z0h94kay
diff --git a/webapp/.ci/.env.stg b/webapp/.ci/.env.stg
index 1c21298ebe..cddcfa5532 100644
--- a/webapp/.ci/.env.stg
+++ b/webapp/.ci/.env.stg
@@ -20,7 +20,7 @@ REACT_APP_MARKETPLACE_ADAPTER_FEE_PER_MILLION=25000
REACT_APP_MAX_PRICE_INCREASE_PERCENTAGE=15
REACT_APP_MANA_ADDRESS=0x0f5d2fb29fb7d3cfee444a200298f468908cc942
REACT_APP_CONVERTER_ADDRESS=0x2859581da59bd4e16a866dd06b461b76d8e489a4
-REACT_APP_CONVERTER_EXCHANGE=kyber_network
+REACT_APP_CONVERTER_EXCHANGE=uniswap_v2
# Misc
REACT_APP_INTERCOM_APP_ID=z0h94kay
diff --git a/webapp/.env.example b/webapp/.env.example
index 77313e9bb6..6921fa5b00 100644
--- a/webapp/.env.example
+++ b/webapp/.env.example
@@ -16,7 +16,7 @@ REACT_APP_MAKERS_PLACE_API_URL=https://makersplace.com/api
REACT_APP_KNOWN_ORIGIN_API_URL=https://api.thegraph.com/subgraphs/name/knownorigin/known-origin
# Partner's Marketplace Adapter
-REACT_APP_CONVERTER_EXCHANGE=kyber_network
+REACT_APP_CONVERTER_EXCHANGE=uniswap_v2
REACT_APP_MARKETPLACE_ADAPTER_FEE_PER_MILLION=25000
REACT_APP_MAX_PRICE_INCREASE_PERCENTAGE=15
REACT_APP_MANA_ADDRESS=0x0f5d2fb29fb7d3cfee444a200298f468908cc942
diff --git a/webapp/src/components/AssetBrowse/AssetBrowse.container.ts b/webapp/src/components/AssetBrowse/AssetBrowse.container.ts
index c1e32953b1..bd4027a506 100644
--- a/webapp/src/components/AssetBrowse/AssetBrowse.container.ts
+++ b/webapp/src/components/AssetBrowse/AssetBrowse.container.ts
@@ -23,12 +23,11 @@ import {
Props
} from './AssetBrowse.types'
import AssetBrowse from './AssetBrowse'
-import { Section } from '../../modules/vendor/decentraland'
const mapState = (state: RootState): MapStateProps => ({
isMap: getIsMap(state),
onlyOnSale: getOnlyOnSale(state),
- section: getSection(state) as Section,
+ section: getSection(state),
isLoading:
isLoadingType(getLoadingNFTs(state), FETCH_NFTS_REQUEST) ||
isLoadingType(getLoadingItems(state), FETCH_ITEMS_REQUEST),
diff --git a/webapp/src/components/AssetBrowse/AssetBrowse.tsx b/webapp/src/components/AssetBrowse/AssetBrowse.tsx
index e1bfd6633d..d89c60dfe7 100644
--- a/webapp/src/components/AssetBrowse/AssetBrowse.tsx
+++ b/webapp/src/components/AssetBrowse/AssetBrowse.tsx
@@ -3,8 +3,10 @@ import { Container, Page, Responsive } from 'decentraland-ui'
import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { View } from '../../modules/ui/types'
-import { Section } from '../../modules/vendor/decentraland'
+import { Section as DecentralandSection } from '../../modules/vendor/decentraland'
import { AssetType } from '../../modules/asset/types'
+import { VendorName } from '../../modules/vendor'
+import { Section } from '../../modules/vendor/routing/types'
import { Atlas } from '../Atlas'
import { AccountSidebar } from '../AccountSidebar'
import { AssetList } from '../AssetList'
@@ -19,24 +21,24 @@ import './AssetBrowse.css'
const hasPrimarySales = (section?: Section) => {
switch (section) {
- case Section.WEARABLES:
- case Section.WEARABLES_HEAD:
- case Section.WEARABLES_EYEBROWS:
- case Section.WEARABLES_EYES:
- case Section.WEARABLES_FACIAL_HAIR:
- case Section.WEARABLES_HAIR:
- case Section.WEARABLES_MOUTH:
- case Section.WEARABLES_UPPER_BODY:
- case Section.WEARABLES_LOWER_BODY:
- case Section.WEARABLES_FEET:
- case Section.WEARABLES_ACCESORIES:
- case Section.WEARABLES_EARRING:
- case Section.WEARABLES_EYEWEAR:
- case Section.WEARABLES_HAT:
- case Section.WEARABLES_HELMET:
- case Section.WEARABLES_MASK:
- case Section.WEARABLES_TIARA:
- case Section.WEARABLES_TOP_HEAD: {
+ case DecentralandSection.WEARABLES:
+ case DecentralandSection.WEARABLES_HEAD:
+ case DecentralandSection.WEARABLES_EYEBROWS:
+ case DecentralandSection.WEARABLES_EYES:
+ case DecentralandSection.WEARABLES_FACIAL_HAIR:
+ case DecentralandSection.WEARABLES_HAIR:
+ case DecentralandSection.WEARABLES_MOUTH:
+ case DecentralandSection.WEARABLES_UPPER_BODY:
+ case DecentralandSection.WEARABLES_LOWER_BODY:
+ case DecentralandSection.WEARABLES_FEET:
+ case DecentralandSection.WEARABLES_ACCESORIES:
+ case DecentralandSection.WEARABLES_EARRING:
+ case DecentralandSection.WEARABLES_EYEWEAR:
+ case DecentralandSection.WEARABLES_HAT:
+ case DecentralandSection.WEARABLES_HELMET:
+ case DecentralandSection.WEARABLES_MASK:
+ case DecentralandSection.WEARABLES_TIARA:
+ case DecentralandSection.WEARABLES_TOP_HEAD: {
return true
}
default:
@@ -134,7 +136,9 @@ const AssetBrowse = (props: Props) => {
? 'account_page.primary_market_subtitle'
: 'browse_page.primary_market_subtitle'
),
- disabled: !hasPrimarySales(section),
+ disabled:
+ !hasPrimarySales(section) ||
+ vendor !== VendorName.DECENTRALAND,
onClick: hanldeBrowseItems
},
{
@@ -143,7 +147,9 @@ const AssetBrowse = (props: Props) => {
? 'account_page.secondary_market_title'
: 'browse_page.secondary_market_title'
),
- active: assetType === AssetType.NFT,
+ active:
+ assetType === AssetType.NFT ||
+ vendor !== VendorName.DECENTRALAND,
description: t(
view === View.ACCOUNT
? 'account_page.secondary_market_subtitle'
diff --git a/webapp/src/components/AssetBrowse/AssetBrowse.types.ts b/webapp/src/components/AssetBrowse/AssetBrowse.types.ts
index a972322610..61025a2c4d 100644
--- a/webapp/src/components/AssetBrowse/AssetBrowse.types.ts
+++ b/webapp/src/components/AssetBrowse/AssetBrowse.types.ts
@@ -9,7 +9,7 @@ import {
fetchAssetsFromRoute,
FetchAssetsFromRouteAction
} from '../../modules/routing/actions'
-import { Section } from '../../modules/vendor/decentraland'
+import { Section } from '../../modules/vendor/routing/types'
import { AssetType } from '../../modules/asset/types'
export type Props = {
diff --git a/webapp/src/components/BrowsePage/BrowsePage.container.ts b/webapp/src/components/BrowsePage/BrowsePage.container.ts
index 8cba8bd7f9..ae14964986 100644
--- a/webapp/src/components/BrowsePage/BrowsePage.container.ts
+++ b/webapp/src/components/BrowsePage/BrowsePage.container.ts
@@ -9,20 +9,13 @@ import {
} from '../../modules/routing/selectors'
import { MapStateProps } from './BrowsePage.types'
import BrowsePage from './BrowsePage'
-import { Section } from '../../modules/vendor/decentraland'
-const mapState = (state: RootState): MapStateProps => {
- let section = getSection(state) as Section
- if (section === Section.ALL) {
- section = Section.WEARABLES
- }
- return {
- vendor: getVendor(state),
- assetType: getAssetType(state),
- section,
- isFullscreen: getIsFullscreen(state)
- }
-}
+const mapState = (state: RootState): MapStateProps => ({
+ vendor: getVendor(state),
+ assetType: getAssetType(state),
+ section: getSection(state),
+ isFullscreen: getIsFullscreen(state)
+})
const mapDispatch = () => ({})
diff --git a/webapp/src/components/BrowsePage/BrowsePage.types.ts b/webapp/src/components/BrowsePage/BrowsePage.types.ts
index 4cd9a36664..963ce30bc2 100644
--- a/webapp/src/components/BrowsePage/BrowsePage.types.ts
+++ b/webapp/src/components/BrowsePage/BrowsePage.types.ts
@@ -1,5 +1,5 @@
import { AssetType } from '../../modules/asset/types'
-import { Section } from '../../modules/vendor/decentraland/routing/types'
+import { Section } from '../../modules/vendor/routing/types'
import { VendorName } from '../../modules/vendor/types'
export type Props = {
diff --git a/webapp/src/components/Vendor/NFTSections/NFTSections.tsx b/webapp/src/components/Vendor/NFTSections/NFTSections.tsx
index fdafb2fb50..db06053a14 100644
--- a/webapp/src/components/Vendor/NFTSections/NFTSections.tsx
+++ b/webapp/src/components/Vendor/NFTSections/NFTSections.tsx
@@ -1,7 +1,7 @@
import React from 'react'
import { VendorName } from '../../../modules/vendor/types'
-import { Section } from '../../../modules/vendor/routing/types'
+import { Sections } from '../../../modules/vendor/routing/types'
import { Section as KnownOriginSection } from '../../../modules/vendor/known_origin/routing/types'
import { Section as DecentralandSection } from '../../../modules/vendor/decentraland/routing/types'
import { NFTSections as KnownOriginNFTSections } from '../known_origin/NFTSections'
@@ -18,7 +18,7 @@ const NFTSections = (props: Props) => {
switch (vendor) {
case VendorName.SUPER_RARE:
case VendorName.MAKERS_PLACE:
- const all = Section[vendor].ALL
+ const all = Sections[vendor].ALL
return (