Skip to content

Commit

Permalink
Improve display of selected WC signer address
Browse files Browse the repository at this point in the history
  • Loading branch information
nop33 committed Oct 21, 2023
1 parent b074ac3 commit 6468f11
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/contexts/walletConnect/WalletConnectSessionProposalModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ const WalletConnectSessionProposalModal = ({
const dispatch = useAppDispatch()
const walletMnemonic = useAppSelector((s) => s.wallet.mnemonic)
const { requiredChainInfo, metadata } = parseSessionProposalEvent(proposalEvent)
const addressesInGroup = useAppSelector((s) => selectAddressesInGroup(s, requiredChainInfo?.addressGroup))
const group = requiredChainInfo?.addressGroup
const addressesInGroup = useAppSelector((s) => selectAddressesInGroup(s, group))
const currentAddressIndexes = useRef(addresses.map(({ index }) => index))
const persistAddressSettings = usePersistAddressSettings()

Expand Down Expand Up @@ -99,12 +100,7 @@ const WalletConnectSessionProposalModal = ({
setLoading('Generating new address...')

const { masterKey } = await walletImportAsyncUnsafe(mnemonicToSeed, walletMnemonic)
const newAddressData = deriveNewAddressData(
masterKey,
requiredChainInfo?.addressGroup,
undefined,
currentAddressIndexes.current
)
const newAddressData = deriveNewAddressData(masterKey, group, undefined, currentAddressIndexes.current)
const newAddress = { ...newAddressData, settings: { label: '', color: getRandomLabelColor(), isDefault: false } }

try {
Expand Down Expand Up @@ -164,7 +160,7 @@ const WalletConnectSessionProposalModal = ({
<InfoBox title="New address needed" Icon={PlusSquare}>
<AppText>
The dApp asks for an address in group
<AppText color="accent"> {requiredChainInfo?.addressGroup}</AppText>. Click below to generate one!
<AppText color="accent"> {group}</AppText>. Click below to generate one!
</AppText>
</InfoBox>
</ScreenSection>
Expand All @@ -179,10 +175,10 @@ const WalletConnectSessionProposalModal = ({
<>
{showAlternativeSignerAddresses ? (
<ScreenSection>
<SectionTitle semiBold>Addresses in group {requiredChainInfo?.addressGroup}</SectionTitle>
<SectionTitle semiBold>Addresses{group !== undefined ? ` in group ${group}` : ''}</SectionTitle>
<SectionSubtitle color="secondary">Tap to select another one</SectionSubtitle>
<AddressList>
{addressesInGroup.map((address, index) => (
{addressesInGroup.map((address) => (
<AddressBox
key={address.hash}
addressHash={address.hash}
Expand All @@ -206,7 +202,11 @@ const WalletConnectSessionProposalModal = ({
<ScreenSection>
<SectionTitle semiBold>Connect with address</SectionTitle>
<SectionSubtitle color="secondary">Tap to change the address to connect with.</SectionSubtitle>
<AddressBox addressHash={signerAddress.hash} onPress={() => setShowAlternativeSignerAddresses(true)} />
<AddressBox
addressHash={signerAddress.hash}
onPress={() => setShowAlternativeSignerAddresses(true)}
isSelected
/>
</ScreenSection>
)}

Expand Down

0 comments on commit 6468f11

Please sign in to comment.