From 78d0665bf9c6dcfe98392a67c36b085a56851db7 Mon Sep 17 00:00:00 2001 From: katty barroso Date: Tue, 7 Jan 2025 14:00:07 +0100 Subject: [PATCH] Display the formatted address --- .../IssuerCreatePool/PoolSetupSection.tsx | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/centrifuge-app/src/pages/IssuerCreatePool/PoolSetupSection.tsx b/centrifuge-app/src/pages/IssuerCreatePool/PoolSetupSection.tsx index c28ce5c5a..2c197cd48 100644 --- a/centrifuge-app/src/pages/IssuerCreatePool/PoolSetupSection.tsx +++ b/centrifuge-app/src/pages/IssuerCreatePool/PoolSetupSection.tsx @@ -1,5 +1,5 @@ import { PoolMetadataInput } from '@centrifuge/centrifuge-js' -import { useCentEvmChainId, useWallet } from '@centrifuge/centrifuge-react' +import { useCentEvmChainId, useCentrifugeUtils, useWallet } from '@centrifuge/centrifuge-react' import { Box, Checkbox, @@ -14,12 +14,14 @@ import { Text, TextInput, } from '@centrifuge/fabric' +import { isAddress } from '@polkadot/util-crypto' import { Field, FieldArray, FieldProps, useFormikContext } from 'formik' import { useEffect } from 'react' import { useTheme } from 'styled-components' import { FieldWithErrorMessage } from '../../../src/components/FieldWithErrorMessage' import { Tooltips } from '../../../src/components/Tooltips' import { feeCategories } from '../../../src/config' +import { isEvmAddress } from '../../../src/utils/address' import { FormAddressInput } from './FormAddressInput' import { AddButton } from './PoolDetailsSection' import { CheckboxOption, Line, StyledGrid } from './PoolStructureSection' @@ -48,7 +50,11 @@ const TaxDocument = () => { {({ field }: FieldProps) => ( + Require investors to upload tax documents before signing the subscription agreement. + + } onChange={(val) => form.setFieldValue('onboarding.taxInfoRequired', val.target.checked ? true : false)} /> )} @@ -62,13 +68,13 @@ export const PoolSetupSection = () => { const chainId = useCentEvmChainId() const form = useFormikContext() const { values } = form - const { - substrate: { selectedAddress }, - } = useWallet() + const utils = useCentrifugeUtils() + const ctx = useWallet() + const { substrate, connectedType } = ctx useEffect(() => { - form.setFieldValue('adminMultisig.signers[0]', selectedAddress) - }, []) + form.setFieldValue('adminMultisig.signers[0]', substrate.selectedAddress) + }, [substrate]) return ( @@ -91,7 +97,7 @@ export const PoolSetupSection = () => { icon={} onChange={() => { form.setFieldValue('adminMultisigEnabled', false) - form.setFieldValue('adminMultisig.signers', [selectedAddress]) + form.setFieldValue('adminMultisig.signers', [substrate.selectedAddress]) }} isChecked={!values.adminMultisigEnabled} id="singleMultisign" @@ -136,18 +142,22 @@ export const PoolSetupSection = () => { )) ) : ( - - - {({ field }: FieldProps) => ( + + {({ field, form }: FieldProps) => { + const isValidAddress = + connectedType === 'evm' ? isEvmAddress(field.value) : isAddress(field.value) + + return ( form.setFieldValue(field.name, e.target.value)} /> - )} - - + ) + }} + )} {values.adminMultisigEnabled && (