Skip to main content

RecoverAccounts

RecoverAccounts queries the auction server for this trader daemon's accounts in case we lost our local account database.

Source: poolrpc/trader.proto

gRPC

rpc RecoverAccounts (RecoverAccountsRequest) returns (RecoverAccountsResponse);

REST

HTTP MethodPath
POST /v1/pool/accounts/recover

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 = {
full_client: <bool>,
account_target: <uint32>,
auctioneer_key: <string>,
height_hint: <uint32>,
bitcoin_host: <string>,
bitcoin_user: <string>,
bitcoin_password: <string>,
bitcoin_httppostmode: <bool>,
bitcoin_usetls: <bool>,
bitcoin_tlspath: <string>,
};
client.recoverAccounts(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "num_recovered_accounts": <uint32>,
// }

Messages

poolrpc.RecoverAccountsRequest

Source: poolrpc/trader.proto

FieldgRPC TypeREST TypeREST Placement
full_client
boolbooleanbody
account_target
uint32integerbody
auctioneer_key
stringstringbody
height_hint
uint32integerbody
bitcoin_host
stringstringbody
bitcoin_user
stringstringbody
bitcoin_password
stringstringbody
bitcoin_httppostmode
boolbooleanbody
bitcoin_usetls
boolbooleanbody
bitcoin_tlspath
stringstringbody

poolrpc.RecoverAccountsResponse

Source: poolrpc/trader.proto

FieldgRPC TypeREST Type
num_recovered_accounts
uint32integer