Skip to main content

CloseAccount

CloseAccount closes an account and returns the funds locked in that account to the connected lnd node's wallet.

Source: poolrpc/trader.proto

gRPC

rpc CloseAccount (CloseAccountRequest) returns (CloseAccountResponse);

REST

HTTP MethodPath
DELETE /v1/pool/accounts

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 = {
trader_key: <bytes>,
output_with_fee: <OutputWithFee>,
outputs: <OutputsWithImplicitFee>,
};
client.closeAccount(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "close_txid": <bytes>,
// }

Messages

poolrpc.CloseAccountRequest

Source: poolrpc/trader.proto

FieldgRPC TypeREST TypeREST Placement
trader_key
bytesstringquery
output_with_fee
OutputWithFeeobjectquery
outputs
OutputsWithImplicitFeeobjectunknown

poolrpc.CloseAccountResponse

Source: poolrpc/trader.proto

FieldgRPC TypeREST Type
close_txid
bytesstring

Nested Messages

poolrpc.Output

FieldgRPC TypeREST Type
value_sat
uint64string
address
stringstring

poolrpc.OutputsWithImplicitFee

FieldgRPC TypeREST Type
outputs
Output[]array

poolrpc.OutputWithFee

FieldgRPC TypeREST Type
address
stringstring
conf_target
uint32integer
fee_rate_sat_per_kw
uint64string