Skip to content

Commit

Permalink
Merge pull request #28 from Kodylow/quick-open-channel-mutiny
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow authored Jan 21, 2024
2 parents 32f0142 + 5eb9dc0 commit bc9b44e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 50 deletions.
49 changes: 1 addition & 48 deletions src/client/src/views/home/faucetActions/request-channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>(false);
Expand All @@ -42,7 +13,7 @@ export const RequestChannel = () => {
const [push_amount, setPushAmount] = useState<number>(25000);
const [pubkey, setPubkey] = useState<string>('');
const [host, setHost] = useState<string>('');
const [port, setPort] = useState<number>(9735);
const port = 9735; // LND default

const { data } = useGetNodeInfoQuery();

Expand Down Expand Up @@ -76,24 +47,6 @@ export const RequestChannel = () => {
return (
<>
<Card>
<Container>
{signetNodes.map((item, index) => (
<Item
key={`${index}-${item.name}`}
onClick={() => {
const [pubkey, host, port] = item.connectionString.split(/@|:/);
setPubkey(pubkey);
setHost(host);
setPort(Number(port));
}}
>
<IconStyle>
<Hexagon size="18" />
</IconStyle>
{item.name}
</Item>
))}
</Container>
<InputWithDeco
value={capacity}
inputCallback={value => setCapacity(Number(value))}
Expand Down
46 changes: 44 additions & 2 deletions src/client/src/views/home/quickActions/openChannel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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};
Expand Down Expand Up @@ -83,6 +115,7 @@ export const OpenChannel = ({ setOpenCard }: OpenChannelProps) => {
const [partner, setPartner] = React.useState<BaseNode | null>(null);
const [open, set] = React.useState(false);
const { data, loading } = useGetBaseNodesQuery();
const { gatewayInfo } = useGatewayState();

React.useEffect(() => {
if (!loading && data && data.getBaseNodes) {
Expand Down Expand Up @@ -136,12 +169,21 @@ export const OpenChannel = ({ setOpenCard }: OpenChannelProps) => {
return (
<>
<Container>
{(data?.getBaseNodes || []).map(
{(gatewayInfo?.network === Network.Signet || Network.Regtest
? signetNodes
: data?.getBaseNodes || []
).map(
(item, index) =>
item && (
<Item
key={`${index}-${item.name}`}
onClick={() => setPartner(item)}
onClick={() =>
setPartner({
name: item.name,
public_key: item.public_key,
socket: item.socket,
})
}
>
<IconStyle>{getIcon(item?.name || '')}</IconStyle>
{item.name}
Expand Down

0 comments on commit bc9b44e

Please sign in to comment.