GetInfo
GetInfo returns general information about the state of the Pool trader daemon.
Source: poolrpc/trader.proto
gRPC
rpc GetInfo (GetInfoRequest) returns (GetInfoResponse);
REST
HTTP Method | Path |
---|---|
GET | /v1/pool/info |
Code Samples
- gRPC
- REST
- Shell
- Javascript
- Python
const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');
const GRPC_HOST = 'localhost:12010'
const MACAROON_PATH = 'POOL_DIR/regtest/pool.macaroon'
const TLS_PATH = 'POOL_DIR/tls.cert'
const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('poolrpc/trader.proto', loaderOptions);
const poolrpc = grpc.loadPackageDefinition(packageDefinition).poolrpc;
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
const tlsCert = fs.readFileSync(TLS_PATH);
const sslCreds = grpc.credentials.createSsl(tlsCert);
const macaroon = fs.readFileSync(MACAROON_PATH).toString('hex');
const macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) {
let metadata = new grpc.Metadata();
metadata.add('macaroon', macaroon);
callback(null, metadata);
});
let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
let client = new poolrpc.Trader(GRPC_HOST, creds);
let request = {};
client.getInfo(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "version": <string>,
// "accounts_total": <uint32>,
// "accounts_active": <uint32>,
// "accounts_active_expired": <uint32>,
// "accounts_archived": <uint32>,
// "orders_total": <uint32>,
// "orders_active": <uint32>,
// "orders_archived": <uint32>,
// "current_block_height": <uint32>,
// "batches_involved": <uint32>,
// "node_rating": <NodeRating>,
// "lsat_tokens": <uint32>,
// "subscribed_to_auctioneer": <bool>,
// "new_nodes_only": <bool>,
// "market_info": <MarketInfoEntry>,
// }
import codecs, grpc, os
# Generate the following 2 modules by compiling the poolrpc/trader.proto with the grpcio-tools.
# See https://github.com/lightningnetwork/lnd/blob/master/docs/grpc/python.md for instructions.
import trader_pb2 as poolrpc, trader_pb2_grpc as traderstub
GRPC_HOST = 'localhost:12010'
MACAROON_PATH = 'POOL_DIR/regtest/pool.macaroon'
TLS_PATH = 'POOL_DIR/tls.cert'
# create macaroon credentials
macaroon = codecs.encode(open(MACAROON_PATH, 'rb').read(), 'hex')
def metadata_callback(context, callback):
callback([('macaroon', macaroon)], None)
auth_creds = grpc.metadata_call_credentials(metadata_callback)
# create SSL credentials
os.environ['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA'
cert = open(TLS_PATH, 'rb').read()
ssl_creds = grpc.ssl_channel_credentials(cert)
# combine macaroon and SSL credentials
combined_creds = grpc.composite_channel_credentials(ssl_creds, auth_creds)
# make the request
channel = grpc.secure_channel(GRPC_HOST, combined_creds)
stub = traderstub.TraderStub(channel)
request = poolrpc.GetInfoRequest()
response = stub.GetInfo(request)
print(response)
# {
# "version": <string>,
# "accounts_total": <uint32>,
# "accounts_active": <uint32>,
# "accounts_active_expired": <uint32>,
# "accounts_archived": <uint32>,
# "orders_total": <uint32>,
# "orders_active": <uint32>,
# "orders_archived": <uint32>,
# "current_block_height": <uint32>,
# "batches_involved": <uint32>,
# "node_rating": <NodeRating>,
# "lsat_tokens": <uint32>,
# "subscribed_to_auctioneer": <bool>,
# "new_nodes_only": <bool>,
# "market_info": <MarketInfoEntry>,
# }
- Javascript
- Python
const fs = require('fs');
const request = require('request');
const REST_HOST = 'localhost:8281'
const MACAROON_PATH = 'POOL_DIR/regtest/pool.macaroon'
let options = {
url: `https://${REST_HOST}/v1/pool/info`,
// Work-around for self-signed certificates.
rejectUnauthorized: false,
json: true,
headers: {
'Grpc-Metadata-macaroon': fs.readFileSync(MACAROON_PATH).toString('hex'),
},
}
request.get(options, function(error, response, body) {
console.log(body);
});
// Console output:
// {
// "version": <string>, // <string>
// "accounts_total": <integer>, // <uint32>
// "accounts_active": <integer>, // <uint32>
// "accounts_active_expired": <integer>, // <uint32>
// "accounts_archived": <integer>, // <uint32>
// "orders_total": <integer>, // <uint32>
// "orders_active": <integer>, // <uint32>
// "orders_archived": <integer>, // <uint32>
// "current_block_height": <integer>, // <uint32>
// "batches_involved": <integer>, // <uint32>
// "node_rating": <object>, // <NodeRating>
// "lsat_tokens": <integer>, // <uint32>
// "subscribed_to_auctioneer": <boolean>, // <bool>
// "new_nodes_only": <boolean>, // <bool>
// "market_info": <object>, // <MarketInfoEntry>
// }
import base64, codecs, json, requests
REST_HOST = 'localhost:8281'
MACAROON_PATH = 'POOL_DIR/regtest/pool.macaroon'
TLS_PATH = 'POOL_DIR/tls.cert'
url = f'https://{REST_HOST}/v1/pool/info'
macaroon = codecs.encode(open(MACAROON_PATH, 'rb').read(), 'hex')
headers = {'Grpc-Metadata-macaroon': macaroon}
r = requests.get(url, headers=headers, verify=TLS_PATH)
print(r.json())
# {
# "version": <string>,
# "accounts_total": <uint32>,
# "accounts_active": <uint32>,
# "accounts_active_expired": <uint32>,
# "accounts_archived": <uint32>,
# "orders_total": <uint32>,
# "orders_active": <uint32>,
# "orders_archived": <uint32>,
# "current_block_height": <uint32>,
# "batches_involved": <uint32>,
# "node_rating": <NodeRating>,
# "lsat_tokens": <uint32>,
# "subscribed_to_auctioneer": <bool>,
# "new_nodes_only": <bool>,
# "market_info": <MarketInfoEntry>,
# }
$ pool getinfo --help
NAME:
pool getinfo - show info about the daemon's current state
USAGE:
pool getinfo [arguments...]
DESCRIPTION:
Displays basic info about the current state of the Pool trader daemon
Messages
poolrpc.GetInfoRequest
Source: poolrpc/trader.proto
note
This request has no parameters.
poolrpc.GetInfoResponse
Source: poolrpc/trader.proto
Field | gRPC Type | REST Type |
---|---|---|
version | string | string |
accounts_total | uint32 | integer |
accounts_active | uint32 | integer |
accounts_active_expired | uint32 | integer |
accounts_archived | uint32 | integer |
orders_total | uint32 | integer |
orders_active | uint32 | integer |
orders_archived | uint32 | integer |
current_block_height | uint32 | integer |
batches_involved | uint32 | integer |
node_rating | NodeRating | object |
lsat_tokens | uint32 | integer |
subscribed_to_auctioneer | bool | boolean |
new_nodes_only | bool | boolean |
market_info | MarketInfoEntry[] | object |
Nested Messages
poolrpc.GetInfoResponse.MarketInfoEntry
Field | gRPC Type | REST Type |
---|---|---|
key | uint32 | unknown |
value | MarketInfo | unknown |
poolrpc.MarketInfo
Field | gRPC Type | REST Type |
---|---|---|
num_asks | TierValue[] | array |
num_bids | TierValue[] | array |
ask_open_interest_units | TierValue[] | array |
bid_open_interest_units | TierValue[] | array |
poolrpc.MarketInfo.TierValue
Field | gRPC Type | REST Type |
---|---|---|
tier | NodeTier | unknown |
value | uint32 | unknown |
poolrpc.NodeRating
Field | gRPC Type | REST Type |
---|---|---|
node_pubkey | bytes | string |
node_tier | NodeTier | string |
Enums
poolrpc.NodeTier
Name | Number |
---|---|
TIER_DEFAULT | 0 |
TIER_0 | 1 |
TIER_1 | 2 |