ListAutopilotSessions
ListAutopilotSessions lists all the sessions that are of type TypeAutopilot.
Source: lit-autopilot.proto
gRPC
rpc ListAutopilotSessions (ListAutopilotSessionsRequest) returns (ListAutopilotSessionsResponse);
REST
HTTP Method | Path |
---|---|
GET | /v1/autopilot/sessions |
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.listAutopilotSessions(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "sessions": <Session>,
// }
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.ListAutopilotSessionsRequest()
response = stub.ListAutopilotSessions(request)
print(response)
# {
# "sessions": <Session>,
# }
- 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/sessions`,
// 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:
// {
// "sessions": <array>, // <Session>
// }
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/sessions'
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())
# {
# "sessions": <Session>,
# }
$ litcli autopilot list --help
NAME:
litcli autopilot list - List all Autopilot sessions.
USAGE:
litcli autopilot list [arguments...]
DESCRIPTION:
List all Autopilot sessions.
Messages
litrpc.ListAutopilotSessionsRequest
Source: lit-autopilot.proto
note
This request has no parameters.
litrpc.ListAutopilotSessionsResponse
Source: lit-autopilot.proto
Field | gRPC Type | REST Type |
---|---|---|
sessions | Session[] | array |
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.HistoryLimit
Field | gRPC Type | REST Type |
---|---|---|
start_time | uint64 | string |
duration | uint64 | string |
litrpc.MacaroonPermission
Field | gRPC Type | REST Type |
---|---|---|
entity | string | string |
action | string | string |
litrpc.MacaroonRecipe
Field | gRPC Type | REST Type |
---|---|---|
permissions | MacaroonPermission[] | array |
caveats | string[] | array |
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.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.RulesMap
Field | gRPC Type | REST Type |
---|---|---|
rules | RulesEntry[] | object |
litrpc.RulesMap.RulesEntry
Field | gRPC Type | REST Type |
---|---|---|
key | string | unknown |
value | RuleValue | unknown |
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.SendToSelf
note
This response has no parameters.
litrpc.Session
Field | gRPC Type | REST Type |
---|---|---|
id | bytes | string |
label | string | string |
session_state | SessionState | string |
session_type | SessionType | string |
expiry_timestamp_seconds | uint64 | string |
mailbox_server_addr | string | string |
dev_server | bool | boolean |
pairing_secret | bytes | string |
pairing_secret_mnemonic | string | string |
local_public_key | bytes | string |
remote_public_key | bytes | string |
created_at | uint64 | string |
macaroon_recipe | MacaroonRecipe | object |
account_id | string | string |
autopilot_feature_info | AutopilotFeatureInfoEntry[] | object |
revoked_at | uint64 | string |
group_id | bytes | string |
feature_configs | FeatureConfigsEntry[] | object |
privacy_flags | uint64 | string |
litrpc.Session.AutopilotFeatureInfoEntry
Field | gRPC Type | REST Type |
---|---|---|
key | string | unknown |
value | RulesMap | unknown |
litrpc.Session.FeatureConfigsEntry
Field | gRPC Type | REST Type |
---|---|---|
key | string | unknown |
value | string | unknown |
Enums
litrpc.SessionState
Name | Number |
---|---|
STATE_CREATED | 0 |
STATE_IN_USE | 1 |
STATE_REVOKED | 2 |
STATE_EXPIRED | 3 |
litrpc.SessionType
Name | Number |
---|---|
TYPE_MACAROON_READONLY | 0 |
TYPE_MACAROON_ADMIN | 1 |
TYPE_MACAROON_CUSTOM | 2 |
TYPE_UI_PASSWORD | 3 |
TYPE_AUTOPILOT | 4 |
TYPE_MACAROON_ACCOUNT | 5 |