Skip to main content

ListAddresses

ListAddresses retrieves all the addresses along with their balance. An account name filter can be provided to filter through all of the wallet accounts and return the addresses of only those matching.

Source: walletrpc/walletkit.proto

gRPC

rpc ListAddresses (ListAddressesRequest) returns (ListAddressesResponse);

REST

HTTP MethodPath
GET /v2/wallet/addresses

Code Samples

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

const GRPC_HOST = 'localhost:10009'
const MACAROON_PATH = 'LND_DIR/data/chain/bitcoin/regtest/admin.macaroon'
const TLS_PATH = 'LND_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync(['lightning.proto', 'walletrpc/walletkit.proto'], loaderOptions);
const walletrpc = grpc.loadPackageDefinition(packageDefinition).walletrpc;
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 walletrpc.WalletKit(GRPC_HOST, creds);
let request = {
account_name: <string>,
show_custom_accounts: <bool>,
};
client.listAddresses(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "account_with_addresses": <AccountWithAddresses>,
// }

Messages

walletrpc.ListAddressesRequest

Source: walletrpc/walletkit.proto

FieldgRPC TypeREST TypeREST Placement
account_name
stringstringquery
show_custom_accounts
boolbooleanquery

walletrpc.ListAddressesResponse

Source: walletrpc/walletkit.proto

FieldgRPC TypeREST Type
account_with_addresses
AccountWithAddresses[]array

Nested Messages

walletrpc.AccountWithAddresses

FieldgRPC TypeREST Type
name
stringstring
address_type
AddressTypestring
derivation_path
stringstring
addresses
AddressProperty[]array

walletrpc.AddressProperty

FieldgRPC TypeREST Type
address
stringstring
is_internal
boolboolean
balance
int64string

Enums

walletrpc.AddressType

NameNumber
UNKNOWN
0
WITNESS_PUBKEY_HASH
1
NESTED_WITNESS_PUBKEY_HASH
2
HYBRID_NESTED_WITNESS_PUBKEY_HASH
3
TAPROOT_PUBKEY
4