Skip to main content

ListInvoices

ListInvoices is a wrapper around lnd's lnrpc.ListInvoices method that only returns invoices that involve at least one Taproot Asset. The full lnd invoice is returned along with the decoded asset amounts that the invoice's HTLCs carry, so that callers don't need to parse the custom channel data themselves. All request fields behave the same way as they do for lnd's lnrpc.ListInvoices RPC method.

Source: tapchannelrpc/tapchannel.proto

gRPC

rpc ListInvoices (ListInvoicesRequest) returns (ListInvoicesResponse);

REST

HTTP MethodPath
POST /v1/taproot-assets/channels/invoices

Code Samples

const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_HOST = 'localhost:10029'
const MACAROON_PATH = 'TAPD_DIR/data/regtest/admin.macaroon'
const TLS_PATH = 'TAPD_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('tapchannelrpc/tapchannel.proto', loaderOptions);
const tapchannelrpc = grpc.loadPackageDefinition(packageDefinition).tapchannelrpc;
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 tapchannelrpc.TaprootAssetChannels(GRPC_HOST, creds);
let request = {
request: <ListInvoiceRequest>,
};
client.listInvoices(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "invoices": <AssetInvoice>,
// "last_index_offset": <uint64>,
// "first_index_offset": <uint64>,
// }

Messages

tapchannelrpc.ListInvoicesRequest

Source: tapchannelrpc/tapchannel.proto

FieldgRPC TypeREST TypeREST Placement
request
ListInvoiceRequestobjectbody

tapchannelrpc.ListInvoicesResponse

Source: tapchannelrpc/tapchannel.proto

FieldgRPC TypeREST Type
invoices
AssetInvoice[]array
last_index_offset
uint64string
first_index_offset
uint64string

Nested Messages

tapchannelrpc.AssetAmount

FieldgRPC TypeREST Type
asset_id
bytesstring
amount
uint64string
group_key
bytesstring

tapchannelrpc.AssetInvoice

FieldgRPC TypeREST Type
invoice
Invoiceobject
asset_amounts
AssetAmount[]array