Skip to main content

ListPayments

ListPayments is a wrapper around lnd's lnrpc.ListPayments method that only returns payments that involve at least one Taproot Asset. The full lnd payment is returned along with the decoded asset amounts that the payment'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.ListPayments RPC method.

Source: tapchannelrpc/tapchannel.proto

gRPC​

rpc ListPayments (ListPaymentsRequest) returns (ListPaymentsResponse);

REST​

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

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: <ListPaymentsRequest>,
};
client.listPayments(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "payments": <AssetPayment>,
// "first_index_offset": <uint64>,
// "last_index_offset": <uint64>,
// }

Messages​

tapchannelrpc.ListPaymentsRequest​

Source: tapchannelrpc/tapchannel.proto

FieldgRPC TypeREST TypeREST Placement
request
ListPaymentsRequestobjectbody

tapchannelrpc.ListPaymentsResponse​

Source: tapchannelrpc/tapchannel.proto

FieldgRPC TypeREST Type
payments
AssetPayment[]array
first_index_offset
uint64string
last_index_offset
uint64string

Nested Messages​

tapchannelrpc.AssetAmount​

FieldgRPC TypeREST Type
asset_id
bytesstring
amount
uint64string
group_key
bytesstring

tapchannelrpc.AssetPayment​

FieldgRPC TypeREST Type
payment
Paymentobject
asset_amounts
AssetAmount[]array