@@ -25,10 +25,10 @@ import useIsMounted from '~/shared/hooks/useIsMounted'
2525import { ProjectType , SalePoint } from '~/shared/types'
2626import { ProjectDraft } from '~/stores/projectDraft'
2727import { SalePointsPayload } from '~/types/projects'
28- import { formatChainName } from '~/utils'
2928import {
30- getChainConfig ,
31- getChainConfigExtension ,
29+ getChainDisplayName ,
30+ getChainKey ,
31+ getMarketplaceChainConfigs ,
3232 useCurrentChainId ,
3333} from '~/utils/chains'
3434import { Route as R , routeOptions } from '~/utils/routes'
@@ -59,15 +59,13 @@ export default function ProjectEditorPage() {
5959
6060 const chainId = useCurrentChainId ( )
6161
62- const availableChains = useMemo < Chain [ ] > (
63- ( ) => getChainConfigExtension ( chainId ) . marketplaceChains . map ( getChainConfig ) ,
62+ const availableChainConfigs = useMemo < Chain [ ] > (
63+ ( ) => getMarketplaceChainConfigs ( chainId ) ,
6464 [ chainId ] ,
6565 )
6666
67- const salePoints = availableChains
68- . map < SalePoint | undefined > (
69- ( { name : chainName } ) => existingSalePoints [ chainName ] ,
70- )
67+ const salePoints = availableChainConfigs
68+ . map < SalePoint | undefined > ( ( { id } ) => existingSalePoints [ getChainKey ( id ) ] )
7169 . filter ( Boolean ) as SalePoint [ ]
7270
7371 function onSalePointChange ( value : SalePoint ) {
@@ -76,16 +74,16 @@ export default function ProjectEditorPage() {
7674 }
7775
7876 update ( ( draft ) => {
79- const { name : chainName } = getChainConfig ( value . chainId )
77+ const chainKey = getChainKey ( value . chainId )
8078
81- if ( draft . salePoints [ chainName ] ?. readOnly ) {
79+ if ( draft . salePoints [ chainKey ] ?. readOnly ) {
8280 /**
8381 * Read-only sale point must not be updated.
8482 */
8583 return
8684 }
8785
88- draft . salePoints [ chainName ] = value
86+ draft . salePoints [ chainKey ] = value
8987
9088 if ( draft . type !== ProjectType . DataUnion ) {
9189 return
@@ -151,14 +149,15 @@ export default function ProjectEditorPage() {
151149 </ Content >
152150 < Content $desktopMaxWidth = { 728 } >
153151 { salePoints . map ( ( salePoint ) => {
154- const chainName = getChainConfig (
152+ const chainKey = getChainKey (
155153 salePoint . chainId ,
156- ) . name
154+ )
157155
158- const formattedChainName =
159- formatChainName ( chainName )
156+ const chainName = getChainDisplayName (
157+ salePoint . chainId ,
158+ )
160159
161- const beneficiaryErrorKey = `salePoints.${ chainName } .beneficiaryAddress`
160+ const beneficiaryErrorKey = `salePoints.${ chainKey } .beneficiaryAddress`
162161
163162 const beneficiaryInvalid =
164163 ! ! errors [ beneficiaryErrorKey ]
@@ -172,7 +171,7 @@ export default function ProjectEditorPage() {
172171 >
173172 < h4 >
174173 Set the payment token and price on
175- the { formattedChainName } chain
174+ the { chainName } chain
176175 </ h4 >
177176 < p >
178177 You can set a price for others to
@@ -191,7 +190,7 @@ export default function ProjectEditorPage() {
191190 < p >
192191 This wallet address receives the
193192 payments for this product on{ ' ' }
194- { formattedChainName } chain.
193+ { chainName } chain.
195194 </ p >
196195 < BeneficiaryAddressEditor
197196 invalid = { beneficiaryInvalid }
@@ -325,10 +324,8 @@ export default function ProjectEditorPage() {
325324 < >
326325 Set the payment token and
327326 price on the
328- { formatChainName (
329- getChainConfig (
330- salePoint . chainId ,
331- ) . name ,
327+ { getChainDisplayName (
328+ salePoint . chainId ,
332329 ) } { ' ' }
333330 chain
334331 </ >
0 commit comments