Skip to main content

FetchSupplyLeaves

FetchSupplyLeaves fetches the supply leaves for a specific asset group within a specified block height range. The leaves include issuance, burn, and ignore leaves, which represent the supply changes for the asset group.

Source: universerpc/universe.proto

gRPC

rpc FetchSupplyLeaves (FetchSupplyLeavesRequest) returns (FetchSupplyLeavesResponse);

REST

HTTP MethodPath
GET /v1/taproot-assets/universe/supply/leaves/{group_key_str}

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 = 'TAPROOT-ASSETS_DIR/regtest/taproot-assets.macaroon'
const TLS_PATH = 'TAPROOT-ASSETS_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('universerpc/universe.proto', loaderOptions);
const universerpc = grpc.loadPackageDefinition(packageDefinition).universerpc;
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 universerpc.Universe(GRPC_HOST, creds);
let request = {
group_key_bytes: <bytes>,
group_key_str: <string>,
block_height_start: <uint32>,
block_height_end: <uint32>,
};
client.fetchSupplyLeaves(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "issuance_leaves": <SupplyLeafEntry>,
// "burn_leaves": <SupplyLeafEntry>,
// "ignore_leaves": <SupplyLeafEntry>,
// }

Messages

universerpc.FetchSupplyLeavesRequest

Source: universerpc/universe.proto

FieldgRPC TypeREST TypeREST Placement
group_key_bytes
bytesstringquery
group_key_str
stringstringpath
block_height_start
uint32integerquery
block_height_end
uint32integerquery

universerpc.FetchSupplyLeavesResponse

Source: universerpc/universe.proto

FieldgRPC TypeREST Type
issuance_leaves
SupplyLeafEntry[]array
burn_leaves
SupplyLeafEntry[]array
ignore_leaves
SupplyLeafEntry[]array

Nested Messages

universerpc.MerkleSumNode

FieldgRPC TypeREST Type
root_hash
bytesstring
root_sum
int64string

universerpc.Outpoint

FieldgRPC TypeREST Type
hash_str
stringstring
index
int32integer

universerpc.SupplyLeafEntry

FieldgRPC TypeREST Type
leaf_key
SupplyLeafKeyobject
leaf_node
MerkleSumNodeobject
block_height
uint32integer
raw_leaf
bytesstring

universerpc.SupplyLeafKey

FieldgRPC TypeREST Type
outpoint
Outpointobject
script_key
bytesstring
asset_id
bytesstring