Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Use the Address component in the recieve modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim committed Jul 13, 2023
1 parent 762fff3 commit 70bfad3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions src/components/ReceiveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { ViewProtocolService } from '@buf/penumbra-zone_penumbra.bufbuild_connec
import { AddressByIndexRequest } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/view/v1alpha1/view_pb'
import { extensionTransport } from '@/lib/extensionTransport'
import { ModalProps, ModalWrapper } from './ModalWrapper'
import { Copy } from './Copy'
import { AddressComponent } from './penumbra/Address'
import { Address } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/crypto/v1alpha1/crypto_pb'

export const ReceiveModal: React.FC<ModalProps> = ({ show, onClose }) => {
const [address, setAddress] = useState<string>('')
const [address, setAddress] = useState<Address | undefined>()

useEffect(() => {
const getAddressByIndex = async () => {
Expand All @@ -22,10 +23,7 @@ export const ReceiveModal: React.FC<ModalProps> = ({ show, onClose }) => {
})

const { address } = await client.addressByIndex(request)

const { altBech32m } = address?.toJson() as { altBech32m: string }

setAddress(altBech32m)
setAddress(address)
}
getAddressByIndex()
}, [])
Expand All @@ -34,8 +32,8 @@ export const ReceiveModal: React.FC<ModalProps> = ({ show, onClose }) => {
<ModalWrapper show={show} onClose={onClose}>
<div className='relative overflow-y-auto pt-[22px] pb-[90px] px-[16px]'>
<p className='h3 mb-[8px]'>Address 1</p>
<div className='flex p-[10px] justify-center items-center gap-[8px] rounded-[10px] bg-dark_grey text_body text-light_grey'>
<Copy text={address} type='full' />
<div className='py-[8px] px-[16px] bg-dark_grey rounded-[10px] text_numbers_s text-light_grey break-words min-h-[44px]'>
{address && <AddressComponent address={address} show_full />}
</div>
</div>
</ModalWrapper>
Expand Down
2 changes: 1 addition & 1 deletion src/components/penumbra/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const AddressComponent: React.FC<{

return (
<div style={{ display: 'inline-block' }}>
<span className='monospace'>{display_address}</span>
<span className='monospace break-all'>{display_address}</span>
<span
className='cursor-pointer hover:no-underline hover:opacity-75'
onClick={handleCopy}
Expand Down

0 comments on commit 70bfad3

Please sign in to comment.