File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
packages/kit/src/views/LightningNetwork/components Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { isLightningNetworkByNetworkId } from '@onekeyhq/shared/src/engine/engin
11
11
import backgroundApiProxy from '../../../background/instance/backgroundApiProxy' ;
12
12
import { useAccount , useNavigation , useNetwork } from '../../../hooks' ;
13
13
import { TabRoutes } from '../../../routes/routesEnum' ;
14
+ import { setRecipient } from '../../../store/reducers/swap' ;
14
15
15
16
import type { MessageDescriptor } from 'react-intl' ;
16
17
@@ -55,11 +56,23 @@ function LNSwapMenu({
55
56
if ( account ) {
56
57
if ( isWithdraw ) {
57
58
backgroundApiProxy . serviceSwap . setSendingAccountSimple ( account ) ;
58
- } else {
59
- backgroundApiProxy . serviceSwap . setRecipientToAccount (
60
- account ,
61
- network ,
62
- ) ;
59
+ } else if ( network ?. id && account ) {
60
+ const lnurlMap =
61
+ await backgroundApiProxy . serviceLightningNetwork . batchGetLnUrlByAccounts (
62
+ {
63
+ networkId : network . id ,
64
+ accounts : [ account ] ,
65
+ } ,
66
+ ) ;
67
+ const address = lnurlMap [ account . id ] ?? account . address ;
68
+ const data = {
69
+ address,
70
+ name : account . name ,
71
+ accountId : account . id ,
72
+ networkId : network . id ,
73
+ networkImpl : network . impl ,
74
+ } ;
75
+ backgroundApiProxy . dispatch ( setRecipient ( data ) ) ;
63
76
}
64
77
}
65
78
navigation . getParent ( ) ?. navigate ( TabRoutes . Swap ) ;
You can’t perform that action at this time.
0 commit comments