Skip to content

Commit

Permalink
feat(wallet-frontend): allow receiver in query params
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurapov committed Oct 25, 2024
1 parent 37a9b19 commit 78120e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/wallet/frontend/src/pages/send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { ExchangeRate } from '@/components/ExchangeRate'
import { useSnapshot } from 'valtio'
import { balanceState } from '@/lib/balance'
import { AssetOP } from '@wallet/shared'
import { useRouter } from 'next/router'

type SendProps = InferGetServerSidePropsType<typeof getServerSideProps>

Expand All @@ -50,6 +51,9 @@ const SendPage: NextPageWithLayout<SendProps> = ({ accounts }) => {
const [receiverAssetCode, setReceiverAssetCode] = useState<string | null>(
null
)
const router = useRouter()
const receiverFromQueryParams = router.query?.receiver ? decodeURIComponent(router.query?.receiver as string) : null;

const [receiverPublicName, setReceiverPublicName] = useState('Recepient')
const [currentExchangeRates, setCurrentExchangeRates] =
useState<ExchangeRates>()
Expand Down Expand Up @@ -80,7 +84,7 @@ const SendPage: NextPageWithLayout<SendProps> = ({ accounts }) => {
schema: sendSchema,
defaultValues: {
paymentType: PAYMENT_SEND,
receiver: isUserFirstTime ? INTERLEDGER_WALLET_ADDRESS : ''
receiver: receiverFromQueryParams ?? (isUserFirstTime ? INTERLEDGER_WALLET_ADDRESS : '')
}
})

Expand Down

0 comments on commit 78120e9

Please sign in to comment.