|
1 | 1 | /* eslint-disable @next/next/no-img-element */ |
2 | | -import type { WalletModalProps } from '@cosmos-kit/core'; |
| 2 | +import type { ChainWalletBase, WalletModalProps } from '@cosmos-kit/core'; |
3 | 3 | import { WalletStatus } from '@cosmos-kit/core'; |
4 | 4 | import { useCallback, Fragment, useState, useMemo, useEffect } from 'react'; |
5 | 5 | import { Dialog, Transition } from '@headlessui/react'; |
@@ -34,6 +34,7 @@ export const TailwindModal = ({ |
34 | 34 | const [currentView, setCurrentView] = useState<ModalView>( |
35 | 35 | ModalView.WalletList |
36 | 36 | ); |
| 37 | + const [qrWallet, setQRWallet] = useState<ChainWalletBase | undefined>(); |
37 | 38 |
|
38 | 39 | const current = walletRepo?.current; |
39 | 40 | const currentWalletData = current?.walletInfo; |
@@ -71,8 +72,11 @@ export const TailwindModal = ({ |
71 | 72 |
|
72 | 73 | // 1ms timeout prevents _render from determining the view to show first |
73 | 74 | setTimeout(() => { |
74 | | - if (walletRepo?.getWallet(name)?.walletInfo.mode === 'wallet-connect') |
| 75 | + const wallet = walletRepo?.getWallet(name); |
| 76 | + if (wallet?.walletInfo.mode === 'wallet-connect') { |
75 | 77 | setCurrentView(ModalView.QRCode); |
| 78 | + setQRWallet(wallet); |
| 79 | + } |
76 | 80 | }, 1); |
77 | 81 | }, |
78 | 82 | [walletRepo] |
@@ -131,7 +135,8 @@ export const TailwindModal = ({ |
131 | 135 | <QRCode |
132 | 136 | onClose={onCloseModal} |
133 | 137 | onReturn={() => setCurrentView(ModalView.WalletList)} |
134 | | - qrUri={current?.qrUrl} |
| 138 | + qrUri={qrWallet?.qrUrl} |
| 139 | + name={qrWallet?.walletInfo.prettyName} |
135 | 140 | /> |
136 | 141 | ); |
137 | 142 | case ModalView.Error: |
|
0 commit comments