From 5eb9dc087af6a61b13f18c3c3ce6f92d326e56a2 Mon Sep 17 00:00:00 2001 From: "kody.low" Date: Sun, 21 Jan 2024 11:39:29 -0800 Subject: [PATCH] fix: signet nodes for quick open channel --- .../home/faucetActions/request-channel.tsx | 49 +------------------ .../home/quickActions/openChannel/index.tsx | 46 ++++++++++++++++- 2 files changed, 45 insertions(+), 50 deletions(-) diff --git a/src/client/src/views/home/faucetActions/request-channel.tsx b/src/client/src/views/home/faucetActions/request-channel.tsx index 6bf81b0d..c0d487ad 100644 --- a/src/client/src/views/home/faucetActions/request-channel.tsx +++ b/src/client/src/views/home/faucetActions/request-channel.tsx @@ -5,35 +5,6 @@ import { InputWithDeco } from '../../../components/input/InputWithDeco'; import { ColorButton } from '../../../components/buttons/colorButton/ColorButton'; import { faucetApi } from '../../../api/FaucetApi'; import { useGetNodeInfoQuery } from '../../../graphql/queries/__generated__/getNodeInfo.generated'; -import { Container, IconStyle, Item } from '../quickActions/openChannel'; -import { Hexagon } from 'react-feather'; - -const signetNodes = [ - { - name: '025698cc9ac623f5d1ba', - pubkey: - '025698cc9ac623f5d1baf56310f2f1b62dfffee43ffcdb2c20ccb541f70497d540', - host: '54.158.203.78', - connectionString: - '025698cc9ac623f5d1baf56310f2f1b62dfffee43ffcdb2c20ccb541f70497d540@54.158.203.78:9739', - }, - { - name: 'mutiny-net-lnd', - pubkey: - '02465ed5be53d04fde66c9418ff14a5f2267723810176c9212b722e542dc1afb1b', - host: '45.79.52.207', - connectionString: - '02465ed5be53d04fde66c9418ff14a5f2267723810176c9212b722e542dc1afb1b@45.79.52.207:9735', - }, - { - name: 'GREENFELONY', - pubkey: - '0366abc8eb4da61e31a8d2c4520d31cabdf58cc5250f855657397f3dd62493938a', - host: '45.33.17.66', - connectionString: - '0366abc8eb4da61e31a8d2c4520d31cabdf58cc5250f855657397f3dd62493938a@45.33.17.66:39735', - }, -]; export const RequestChannel = () => { const [loading, setLoading] = useState(false); @@ -42,7 +13,7 @@ export const RequestChannel = () => { const [push_amount, setPushAmount] = useState(25000); const [pubkey, setPubkey] = useState(''); const [host, setHost] = useState(''); - const [port, setPort] = useState(9735); + const port = 9735; // LND default const { data } = useGetNodeInfoQuery(); @@ -76,24 +47,6 @@ export const RequestChannel = () => { return ( <> - - {signetNodes.map((item, index) => ( - { - const [pubkey, host, port] = item.connectionString.split(/@|:/); - setPubkey(pubkey); - setHost(host); - setPort(Number(port)); - }} - > - - - - {item.name} - - ))} - setCapacity(Number(value))} diff --git a/src/client/src/views/home/quickActions/openChannel/index.tsx b/src/client/src/views/home/quickActions/openChannel/index.tsx index 65cced86..2d8731cc 100644 --- a/src/client/src/views/home/quickActions/openChannel/index.tsx +++ b/src/client/src/views/home/quickActions/openChannel/index.tsx @@ -30,6 +30,35 @@ import { ColorButton } from '../../../../components/buttons/colorButton/ColorBut import { BaseNode } from '../../../../graphql/types'; import { OpenChannelCard } from './OpenChannel'; import { OpenRecommended } from './OpenRecommended'; +import { Network } from '../../../../api/types'; +import { useGatewayState } from '../../../../context/GatewayContext'; + +const signetNodes = [ + { + name: '025698cc9ac623f5d1ba', + public_key: + '025698cc9ac623f5d1baf56310f2f1b62dfffee43ffcdb2c20ccb541f70497d540', + socket: '54.158.203.78', + connectionString: + '025698cc9ac623f5d1baf56310f2f1b62dfffee43ffcdb2c20ccb541f70497d540@54.158.203.78:9739', + }, + { + name: 'mutiny-net-lnd', + public_key: + '02465ed5be53d04fde66c9418ff14a5f2267723810176c9212b722e542dc1afb1b', + socket: '45.79.52.207', + connectionString: + '02465ed5be53d04fde66c9418ff14a5f2267723810176c9212b722e542dc1afb1b@45.79.52.207:9735', + }, + { + name: 'GREENFELONY', + public_key: + '0366abc8eb4da61e31a8d2c4520d31cabdf58cc5250f855657397f3dd62493938a', + socket: '45.33.17.66', + connectionString: + '0366abc8eb4da61e31a8d2c4520d31cabdf58cc5250f855657397f3dd62493938a@45.33.17.66:39735', + }, +]; export const IconStyle = styled.div` margin-bottom: 8px; @@ -50,6 +79,9 @@ export const Item = styled.div` cursor: pointer; background: ${backgroundColor}; will-change: transform, opacity; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; :hover { background: ${themeColors.blue2}; @@ -83,6 +115,7 @@ export const OpenChannel = ({ setOpenCard }: OpenChannelProps) => { const [partner, setPartner] = React.useState(null); const [open, set] = React.useState(false); const { data, loading } = useGetBaseNodesQuery(); + const { gatewayInfo } = useGatewayState(); React.useEffect(() => { if (!loading && data && data.getBaseNodes) { @@ -136,12 +169,21 @@ export const OpenChannel = ({ setOpenCard }: OpenChannelProps) => { return ( <> - {(data?.getBaseNodes || []).map( + {(gatewayInfo?.network === Network.Signet || Network.Regtest + ? signetNodes + : data?.getBaseNodes || [] + ).map( (item, index) => item && ( setPartner(item)} + onClick={() => + setPartner({ + name: item.name, + public_key: item.public_key, + socket: item.socket, + }) + } > {getIcon(item?.name || '')} {item.name}