From 5fa7a46492328ea02ace6e238f31a1502eaa0bd5 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 1 May 2019 23:12:13 -0300 Subject: [PATCH] implement getInfo method. --- src/interfaces/eclair.js | 4 ++++ src/interfaces/lightningd_spark.js | 4 ++++ src/interfaces/ptarmigan.js | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/interfaces/eclair.js b/src/interfaces/eclair.js index 095b6fc..b59471b 100644 --- a/src/interfaces/eclair.js +++ b/src/interfaces/eclair.js @@ -6,6 +6,10 @@ const fetch = window.fetch const WebSocket = window.WebSocket const URLSearchParams = window.URLSearchParams +export function getInfo() { + return rpcCall('getinfo').then(({nodeId, alias}) => ({id: nodeId, alias})) +} + export function summary() { return Promise.all([ rpcCall('getinfo').then( diff --git a/src/interfaces/lightningd_spark.js b/src/interfaces/lightningd_spark.js index 0c75260..eea5e12 100644 --- a/src/interfaces/lightningd_spark.js +++ b/src/interfaces/lightningd_spark.js @@ -8,6 +8,10 @@ import {getRpcParams, normalizeURL} from '../utils' const fetch = window.fetch const EventSource = window.EventSource +export function getInfo() { + return rpcCall('getinfo').then(({id, alias, color}) => ({id, alias, color})) +} + export function summary() { return Promise.all([ rpcCall('getinfo').then(({blockheight, id, alias, color, address}) => { diff --git a/src/interfaces/ptarmigan.js b/src/interfaces/ptarmigan.js index 4146357..d668e3f 100644 --- a/src/interfaces/ptarmigan.js +++ b/src/interfaces/ptarmigan.js @@ -4,6 +4,10 @@ import {getRpcParams, normalizeURL} from '../utils' const fetch = window.fetch +export function getInfo() { + return rpcCall('getinfo').then(info => ({id: info.node_id})) +} + export function summary() { return Promise.all([ rpcCall('getinfo'),