ListAutopilotFeatures
ListAutopilotFeatures fetches all the features supported by the Autopilot server along with the rules that we need to support in order to subscribe to those features.
Source: lit-autopilot.proto
gRPC
rpc ListAutopilotFeatures (ListAutopilotFeaturesRequest) returns (ListAutopilotFeaturesResponse);
REST
HTTP Method | Path |
---|---|
GET | /v1/autopilot/features |
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:8443'
const MACAROON_PATH = 'LIT_DIR/regtest/lit.macaroon'
const TLS_PATH = 'LIT_DIR/tls.cert'
const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('lit-autopilot.proto', loaderOptions);
const litrpc = grpc.loadPackageDefinition(packageDefinition).litrpc;
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 litrpc.Autopilot(GRPC_HOST, creds);
let request = {};
client.listAutopilotFeatures(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "features": <FeaturesEntry>,
// }
import codecs, grpc, os
# Generate the following 2 modules by compiling the lit-autopilot.proto with the grpcio-tools.
# See https://github.com/lightningnetwork/lnd/blob/master/docs/grpc/python.md for instructions.
import lit-autopilot_pb2 as litrpc, lit-autopilot_pb2_grpc as lit-autopilotstub
GRPC_HOST = 'localhost:8443'
MACAROON_PATH = 'LIT_DIR/regtest/lit.macaroon'
TLS_PATH = 'LIT_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 = lit-autopilotstub.AutopilotStub(channel)
request = litrpc.ListAutopilotFeaturesRequest()
response = stub.ListAutopilotFeatures(request)
print(response)
# {
# "features": <FeaturesEntry>,
# }
- Javascript
- Python
const fs = require('fs');
const request = require('request');
const REST_HOST = 'localhost:8443'
const MACAROON_PATH = 'LIT_DIR/regtest/lit.macaroon'
let options = {
url: `https://${REST_HOST}/v1/autopilot/features`,
// 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:
// {
// "features": <object>, // <FeaturesEntry>
// }
import base64, codecs, json, requests
REST_HOST = 'localhost:8443'
MACAROON_PATH = 'LIT_DIR/regtest/lit.macaroon'
TLS_PATH = 'LIT_DIR/tls.cert'
url = f'https://{REST_HOST}/v1/autopilot/features'
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())
# {
# "features": <FeaturesEntry>,
# }
$ litcli autopilot features --help
NAME:
litcli autopilot features - List available Autopilot features.
USAGE:
litcli autopilot features [arguments...]
DESCRIPTION:
List available Autopilot features.
Messages
litrpc.ListAutopilotFeaturesRequest
Source: lit-autopilot.proto
note
This request has no parameters.
litrpc.ListAutopilotFeaturesResponse
Source: lit-autopilot.proto
Field | gRPC Type | REST Type |
---|---|---|
features | FeaturesEntry[] | object |
Nested Messages
litrpc.ChannelConstraint
Field | gRPC Type | REST Type |
---|---|---|
min_capacity_sat | uint64 | string |
max_capacity_sat | uint64 | string |
max_push_sat | uint64 | string |
private_allowed | bool | boolean |
public_allowed | bool | boolean |
litrpc.ChannelPolicyBounds
Field | gRPC Type | REST Type |
---|---|---|
min_base_msat | uint64 | string |
max_base_msat | uint64 | string |
min_rate_ppm | uint32 | integer |
max_rate_ppm | uint32 | integer |
min_cltv_delta | uint32 | integer |
max_cltv_delta | uint32 | integer |
min_htlc_msat | uint64 | string |
max_htlc_msat | uint64 | string |
litrpc.ChannelRestrict
Field | gRPC Type | REST Type |
---|---|---|
channel_ids | uint64[] | array |
litrpc.Feature
Field | gRPC Type | REST Type |
---|---|---|
name | string | string |
description | string | string |
rules | RulesEntry[] | object |
permissions_list | Permissions[] | array |
requires_upgrade | bool | boolean |
default_config | string | string |
privacy_flags | uint64 | string |
litrpc.Feature.RulesEntry
Field | gRPC Type | REST Type |
---|---|---|
key | string | unknown |
value | RuleValues | unknown |
litrpc.HistoryLimit
Field | gRPC Type | REST Type |
---|---|---|
start_time | uint64 | string |
duration | uint64 | string |
litrpc.ListAutopilotFeaturesResponse.FeaturesEntry
Field | gRPC Type | REST Type |
---|---|---|
key | string | unknown |
value | Feature | unknown |
litrpc.MacaroonPermission
Field | gRPC Type | REST Type |
---|---|---|
entity | string | string |
action | string | string |
litrpc.OffChainBudget
Field | gRPC Type | REST Type |
---|---|---|
max_amt_msat | uint64 | string |
max_fees_msat | uint64 | string |
litrpc.OnChainBudget
Field | gRPC Type | REST Type |
---|---|---|
absolute_amt_sats | uint64 | string |
max_sat_per_v_byte | uint64 | string |
litrpc.PeerRestrict
Field | gRPC Type | REST Type |
---|---|---|
peer_ids | string[] | array |
litrpc.Permissions
Field | gRPC Type | REST Type |
---|---|---|
method | string | string |
operations | MacaroonPermission[] | array |
litrpc.Rate
Field | gRPC Type | REST Type |
---|---|---|
iterations | uint32 | integer |
num_hours | uint32 | integer |
litrpc.RateLimit
Field | gRPC Type | REST Type |
---|---|---|
read_limit | Rate | object |
write_limit | Rate | object |
litrpc.RuleValue
Field | gRPC Type | REST Type |
---|---|---|
rate_limit | RateLimit | object |
chan_policy_bounds | ChannelPolicyBounds | object |
history_limit | HistoryLimit | object |
off_chain_budget | OffChainBudget | object |
on_chain_budget | OnChainBudget | object |
send_to_self | SendToSelf | object |
channel_restrict | ChannelRestrict | object |
peer_restrict | PeerRestrict | object |
channel_constraint | ChannelConstraint | object |
litrpc.RuleValues
Field | gRPC Type | REST Type |
---|---|---|
known | bool | boolean |
defaults | RuleValue | object |
min_value | RuleValue | object |
max_value | RuleValue | object |
litrpc.SendToSelf
note
This response has no parameters.