Feature 2: Display Node Alias and Balance
git checkout feat-2Added API endpoint to return node alias and channel balance
/**
* GET /api/info
*/
export const getInfo = async (req: Request, res: Response) => {
const { token } = req.body;
if (!token) throw new Error('Your node is not connected!');
// find the node that's making the request
const node = db.getNodeByToken(token);
if (!node) throw new Error('Node not found with this token');
// get the node's pubkey and alias
const rpc = nodeManager.getRpc(node.token);
const { alias, identityPubkey: pubkey } = await rpc.getInfo();
const { balance } = await rpc.channelBalance();
res.send({ alias, balance, pubkey });
};Display node info in the UI

Last updated
Was this helpful?