Skip to main content

Leases

Leases returns the list of channels that were either purchased or sold by the trader within the auction.

Source: poolrpc/trader.proto

gRPC

rpc Leases (LeasesRequest) returns (LeasesResponse);

REST

HTTP MethodPath
GET /v1/pool/leases

Code Samples

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 = {
batch_ids: <bytes>,
accounts: <bytes>,
};
client.leases(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "leases": <Lease>,
// "total_amt_earned_sat": <uint64>,
// "total_amt_paid_sat": <uint64>,
// }

Messages

poolrpc.LeasesRequest

Source: poolrpc/trader.proto

FieldgRPC TypeREST TypeREST Placement
batch_ids
bytes[]arrayquery
accounts
bytes[]arrayquery

poolrpc.LeasesResponse

Source: poolrpc/trader.proto

FieldgRPC TypeREST Type
leases
Lease[]array
total_amt_earned_sat
uint64string
total_amt_paid_sat
uint64string

Nested Messages

poolrpc.Lease

FieldgRPC TypeREST Type
channel_point
OutPointobject
channel_amt_sat
uint64string
channel_duration_blocks
uint32integer
channel_lease_expiry
uint32integer
premium_sat
uint64string
execution_fee_sat
uint64string
chain_fee_sat
uint64string
clearing_rate_price
uint64string
order_fixed_rate
uint64string
order_nonce
bytesstring
matched_order_nonce
bytesstring
purchased
boolboolean
channel_remote_node_key
bytesstring
channel_node_tier
NodeTierstring
self_chan_balance
uint64string
sidecar_channel
boolboolean

poolrpc.OutPoint

FieldgRPC TypeREST Type
txid
bytesstring
output_index
uint32integer

Enums

poolrpc.NodeTier

NameNumber
TIER_DEFAULT
0
TIER_0
1
TIER_1
2