Skip to content

Commit

Permalink
Fix bug creating with EVM address
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Dec 19, 2024
1 parent a106f59 commit ab309f7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions centrifuge-app/src/pages/IssuerCreatePool/PoolSetupSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PoolMetadataInput } from '@centrifuge/centrifuge-js'
import { useAddress, useCentEvmChainId, useCentrifugeUtils, useWallet } from '@centrifuge/centrifuge-react'
import { useCentEvmChainId, useWallet } from '@centrifuge/centrifuge-react'
import {
Box,
Checkbox,
Expand All @@ -14,7 +14,6 @@ import {
Text,
TextInput,
} from '@centrifuge/fabric'
import { getAddress } from 'ethers'
import { Field, FieldArray, FieldProps, useFormikContext } from 'formik'
import { useEffect } from 'react'
import { useTheme } from 'styled-components'
Expand Down Expand Up @@ -61,16 +60,15 @@ const TaxDocument = () => {
export const PoolSetupSection = () => {
const theme = useTheme()
const chainId = useCentEvmChainId()
const utils = useCentrifugeUtils()
const address = useAddress()!
const form = useFormikContext<CreatePoolValues>()
const { values } = form
const { connectedType, evm } = useWallet()
const formattedAddress = connectedType === 'evm' ? getAddress(evm.selectedAddress!) : utils.formatAddress(address)
const {
substrate: { selectedAddress },
} = useWallet()

useEffect(() => {
form.setFieldValue('adminMultisig.signers[0]', formattedAddress)
}, [formattedAddress])
form.setFieldValue('adminMultisig.signers[0]', selectedAddress)
}, [])

Check warning on line 71 in centrifuge-app/src/pages/IssuerCreatePool/PoolSetupSection.tsx

View workflow job for this annotation

GitHub Actions / build-app

React Hook useEffect has missing dependencies: 'form' and 'selectedAddress'. Either include them or remove the dependency array

Check warning on line 71 in centrifuge-app/src/pages/IssuerCreatePool/PoolSetupSection.tsx

View workflow job for this annotation

GitHub Actions / ff-prod / build-app

React Hook useEffect has missing dependencies: 'form' and 'selectedAddress'. Either include them or remove the dependency array

return (
<Box>
Expand All @@ -93,6 +91,7 @@ export const PoolSetupSection = () => {
icon={<IconHelpCircle size="iconSmall" color={theme.colors.textSecondary} />}
onChange={() => {
form.setFieldValue('adminMultisigEnabled', false)
form.setFieldValue('adminMultisig.signers', [selectedAddress])
}}
isChecked={!values.adminMultisigEnabled}
id="singleMultisign"
Expand Down

0 comments on commit ab309f7

Please sign in to comment.