Skip to main content

BatchSnapshots

BatchSnapshots returns a list of batch snapshots starting at the start batch ID and going back through the history of batches, returning at most the number of specified batches. A maximum of 100 snapshots can be queried in one call. If no start batch ID is provided, the most recent finalized batch is used as the starting point to go back from.

Source: poolrpc/trader.proto

gRPC

rpc BatchSnapshots (BatchSnapshotsRequest) returns (BatchSnapshotsResponse);

REST

HTTP MethodPath
GET /v1/pool/batch/snapshots

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 = {
start_batch_id: <bytes>,
num_batches_back: <uint32>,
};
client.batchSnapshots(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "batches": <BatchSnapshotResponse>,
// }

Messages

poolrpc.BatchSnapshotsRequest

Source: auctioneerrpc/auctioneer.proto

FieldgRPC TypeREST TypeREST Placement
start_batch_id
bytesstringquery
num_batches_back
uint32integerquery

poolrpc.BatchSnapshotsResponse

Source: auctioneerrpc/auctioneer.proto

FieldgRPC TypeREST Type
batches
BatchSnapshotResponse[]array

Nested Messages

poolrpc.AskSnapshot

FieldgRPC TypeREST Type
version
uint32integer
lease_duration_blocks
uint32integer
rate_fixed
uint32integer
chan_type
OrderChannelTypestring

poolrpc.BatchSnapshotResponse

FieldgRPC TypeREST Type
version
uint32integer
batch_id
bytesstring
prev_batch_id
bytesstring
clearing_price_ratedeprecated
uint32integer
matched_ordersdeprecated
MatchedOrderSnapshot[]array
batch_tx_id
stringstring
batch_tx
bytesstring
batch_tx_fee_rate_sat_per_kw
uint64string
creation_timestamp_ns
uint64string
matched_markets
MatchedMarketsEntry[]object

poolrpc.BatchSnapshotResponse.MatchedMarketsEntry

FieldgRPC TypeREST Type
key
uint32unknown
value
MatchedMarketSnapshotunknown

poolrpc.BidSnapshot

FieldgRPC TypeREST Type
version
uint32integer
lease_duration_blocks
uint32integer
rate_fixed
uint32integer
chan_type
OrderChannelTypestring

poolrpc.MatchedMarketSnapshot

FieldgRPC TypeREST Type
matched_orders
MatchedOrderSnapshot[]array
clearing_price_rate
uint32integer

poolrpc.MatchedOrderSnapshot

FieldgRPC TypeREST Type
ask
AskSnapshotobject
bid
BidSnapshotobject
matching_rate
uint32integer
total_sats_cleared
uint64string
units_matched
uint32integer

Enums

poolrpc.OrderChannelType

NameNumber
ORDER_CHANNEL_TYPE_UNKNOWN
0
ORDER_CHANNEL_TYPE_PEER_DEPENDENT
1
ORDER_CHANNEL_TYPE_SCRIPT_ENFORCED
2
ORDER_CHANNEL_TYPE_SIMPLE_TAPROOT
3