Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #124 from niteshbalusu11:group-channels
Browse files Browse the repository at this point in the history
Group-channels
  • Loading branch information
niteshbalusu11 authored Oct 11, 2022
2 parents 9d28daf + 5730715 commit 4a0f36d
Show file tree
Hide file tree
Showing 52 changed files with 1,758 additions and 735 deletions.
56 changes: 31 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,79 +10,85 @@ https://t.me/lndboss

```shell
# See an accounting formatted list of various types of transactions
bos accounting "category"
accounting "category"

# See total balance, including pending funds, excluding future commit fees
bos balance
balance

# Call ln-service raw APIs
bos call "method"
call "method"

# Get the number of days the node cert remains valid
bos cert-validity-days
cert-validity-days

# Receive on-chain funds via a regular address
bos chain-deposit
chain-deposit

# See the current fee estimates confirmation targets
bos chainfees
chainfees

# Show chain fees paid
bos chart-chain-fees
chart-chain-fees

# Show routing fees earned
bos chart-fees-earned
chart-fees-earned

# Show routing fees paid
bos chart-fees-paid
chart-fees-paid

# Show a chart of payments received
bos chart-payments-received
chart-payments-received

# See details on how closed channels resolved on-chain
bos closed
closed

# Create a group channel request
create-group-channel

# View outbound fee rates and update outbound fee rates to peers
bos fees
fees

# Query the node to find something like a payment, channel or node
bos find "query"
find "query"

# Output a summarized version of peers forwarded towards
bos forwards
forwards

# Look up the channels and fee rates of a node by its public key
bos graph "pubkey"
graph "pubkey"

# Joins a group channel request
create-group-channel "invite_code"

# Collection of lnurl features
bos lnurl "function"
lnurl "function"

# Batch open channels, zero conf supported
bos open "pubkeys"
open "pubkeys"

# Pay a payment request (invoice), probing first
bos pay "payment_request"
pay "payment_request"

# Show channel-connected peers
bos peers
peers

# Output the price of BTC
bos price
price

# Test if funds can be sent to a destination
bos probe "payment_request/public_key"
probe "payment_request/public_key"

# Rebalance funds between peers
bos rebalance
rebalance

# Reconnect to offline peers
bos reconnect
reconnect

# Send funds using keysend or lnurl/lightning address and an optional message to a node
bos send
send

# Tags can be used in other commands via tag and avoid options
bos tags
tags
```

### LndBoss is now available for one click install in AppStores of:
Expand Down
146 changes: 145 additions & 1 deletion SERVER.md
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,80 @@ try {

<br></br>

### CreateGroupChannel

```javascript
/**
@PostRequest
@Url
http://localhost:8055/api/create-group-channel
@Body
/**
{
capacity: <Channel Capacity Tokens Number>
count: <Group Member Count Number>
rate: <Opening Chain Fee Tokens Per VByte Rate Number>
}
@Response
{
transaction_id: <Transaction Id Hex String>
}
*/
*/

import { io } from 'socket.io-client';

try {
const url = 'http://localhost:8055/api/create-group-channel';

// Unique connection name for websocket connection.
const dateString = Date.now().toString();

const postBody = {
capacity: 1000000,
count: 3,
rate: 2,
};

// You will need live logs for create-group-channel, you can start a websocket connection with the server and add an event listener.
// Websocket url is the same as the server url http://localhost:8055
// Messages from the server are passed to client using the dateString passed from above.
const socket = io();

socket.on('connect', () => {
console.log('connected');
});

socket.on('disconnect', () => {
console.log('disconnected');
});

// Make sure to pass the same dateString from above
socket.on(`${dateString}`, data => {
console.log(data);
});

socket.on('error', err => {
throw err;
});

// End websocket code.

const config = {
headers: { Authorization: `Bearer ${accessToken}` },
};

const response = await axios.post(url, postBody, config);
} catch (error) {
console.error(error);
}
```

<br></br>

### Fees

```javascript
Expand All @@ -640,7 +714,7 @@ http://localhost:8055/api/fees
*/

try {
const url = 'http://localhost:8055/api/open';
const url = 'http://localhost:8055/api/fees';

const postBody = {
fee_rate: ['100'],
Expand Down Expand Up @@ -833,6 +907,76 @@ try {

<br></br>

### JoinGroupChannel

```javascript
/**
@PostRequest
@Url
http://localhost:8055/api/join-group-channel
@Body
/**
{
code: <Group Invite Code String>
max_rate: <Max Opening Chain Fee Tokens Per VByte Fee Rate Number>
}
@Response
{
transaction_id: <Channel Funding Transaction Id Hex String>
}
*/

import { io } from 'socket.io-client';

try {
const url = 'http://localhost:8055/api/join-group-channel';

// Unique connection name for websocket connection.
const dateString = Date.now().toString();

const postBody = {
code: 'invite_code',
max_rate: 3,
};

// You will need live logs for join-group-channel, you can start a websocket connection with the server and add an event listener.
// Websocket url is the same as the server url http://localhost:8055
// Messages from the server are passed to client using the dateString passed from above.
const socket = io();

socket.on('connect', () => {
console.log('connected');
});

socket.on('disconnect', () => {
console.log('disconnected');
});

// Make sure to pass the same dateString from above
socket.on(`${dateString}`, data => {
console.log(data);
});

socket.on('error', err => {
throw err;
});

// End websocket code.

const config = {
headers: { Authorization: `Bearer ${accessToken}` },
};

const response = await axios.post(url, postBody, config);
} catch (error) {
console.error(error);
}
```

<br></br>

### Lnurl

```javascript
Expand Down
23 changes: 23 additions & 0 deletions src/client/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ const commands: Commands = [
limit: 'Limit',
},
},
{
name: 'Create Group Channel (Experimental)',
value: 'CreateGroupChannel',
description: 'Coordinate balanced channels group',
longDescription: 'Create a group channel invite code, other nodes can join the group using join-group-channel',
flags: {
capacity: 'Capacity',
fee_rate: 'FeeRate',
size: 'Size',
},
},
{
name: 'Fees',
value: 'Fees',
Expand Down Expand Up @@ -221,6 +232,18 @@ const commands: Commands = [
sort: 'Sort',
},
},
{
name: 'Join Group Channel (Experimental)',
value: 'JoinGroupChannel',
description: 'Join a balanced channels group',
longDescription: 'Another node should have run create-group-channel to create group',
args: {
code: 'Code',
},
flags: {
max_fee_rate: 'MaxFeeRate',
},
},
{
name: 'Lnurl',
value: 'Lnurl',
Expand Down
24 changes: 24 additions & 0 deletions src/client/output/CreateGroupChannelOutput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';

/*
Renders the output of the create-group-channel command.
*/

type Args = {
data: string | undefined;
};
const CreateGroupChannelOutput = ({ data }: Args) => {
return (
<div style={styles.div} id="creategroupchanneloutput">
{!!data && <pre>{data}</pre>}
</div>
);
};

export default CreateGroupChannelOutput;

const styles = {
div: {
width: '1100px',
},
};
24 changes: 24 additions & 0 deletions src/client/output/JoinGroupChannelOutput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';

/*
Renders the output of the join-group-channel command.
*/

type Args = {
data: string | undefined;
};
const JoinGroupChannelOutput = ({ data }: Args) => {
return (
<div style={styles.div} id="creategroupchanneloutput">
{!!data && <pre>{data}</pre>}
</div>
);
};

export default JoinGroupChannelOutput;

const styles = {
div: {
width: '1100px',
},
};
10 changes: 10 additions & 0 deletions src/client/output/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ import ChartFeesEarnedOutput from './ChartFeesEarnedOutput';
import ChartFeesPaidOutput from './ChartFeesPaidOutput';
import ChartPaymentsReceivedOutput from './ChartPaymentsReceivedOutput';
import ClosedOutput from './ClosedOutput';
import CreateGroupChannelOutput from './CreateGroupChannelOutput';
import FeesOutput from './FeesOutput';
import FindOutput from './FindOutput';
import ForwardsOutput from './ForwardsOutput';
import JoinGroupChannelOutput from './JoinGroupChannelOutput';
import OpenOutput from './OpenOutput';
import PeersOutput from './PeersOutput';
import PriceOutput from './PriceOutput';
import ReconnectOutput from './ReconnectOutput';
import TagsOutput from './TagsOutput';

export {
Expand All @@ -25,9 +30,14 @@ export {
ChartFeesPaidOutput,
ChartPaymentsReceivedOutput,
ClosedOutput,
CreateGroupChannelOutput,
FeesOutput,
FindOutput,
ForwardsOutput,
JoinGroupChannelOutput,
OpenOutput,
PeersOutput,
PriceOutput,
ReconnectOutput,
TagsOutput,
};
Loading

0 comments on commit 4a0f36d

Please sign in to comment.