Skip to main content

FetchSupplyCommit

FetchSupplyCommit fetches the on-chain supply commitment for a specific asset group.

Source: universerpc/universe.proto

gRPC

rpc FetchSupplyCommit (FetchSupplyCommitRequest) returns (FetchSupplyCommitResponse);

REST

HTTP MethodPath
GET /v1/taproot-assets/universe/supply/{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>,
issuance_leaf_keys: <bytes>,
burn_leaf_keys: <bytes>,
ignore_leaf_keys: <bytes>,
};
client.fetchSupplyCommit(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "supply_commitment_root": <MerkleSumNode>,
// "anchor_txid": <string>,
// "anchor_tx_out_idx": <uint32>,
// "anchor_tx_out_internal_key": <bytes>,
// "block_height": <uint32>,
// "block_hash": <bytes>,
// "block_tx_index": <uint32>,
// "tx_chain_fees_sats": <int64>,
// "issuance_subtree_root": <SupplyCommitSubtreeRoot>,
// "burn_subtree_root": <SupplyCommitSubtreeRoot>,
// "ignore_subtree_root": <SupplyCommitSubtreeRoot>,
// "issuance_leaf_inclusion_proofs": <bytes>,
// "burn_leaf_inclusion_proofs": <bytes>,
// "ignore_leaf_inclusion_proofs": <bytes>,
// }

Messages

universerpc.FetchSupplyCommitRequest

Source: universerpc/universe.proto

FieldgRPC TypeREST TypeREST Placement
group_key_bytes
bytesstringquery
group_key_str
stringstringpath
issuance_leaf_keys
bytes[]arrayquery
burn_leaf_keys
bytes[]arrayquery
ignore_leaf_keys
bytes[]arrayquery

universerpc.FetchSupplyCommitResponse

Source: universerpc/universe.proto

FieldgRPC TypeREST Type
supply_commitment_root
MerkleSumNodeobject
anchor_txid
stringstring
anchor_tx_out_idx
uint32integer
anchor_tx_out_internal_key
bytesstring
block_height
uint32integer
block_hash
bytesstring
block_tx_index
uint32integer
tx_chain_fees_sats
int64string
issuance_subtree_root
SupplyCommitSubtreeRootobject
burn_subtree_root
SupplyCommitSubtreeRootobject
ignore_subtree_root
SupplyCommitSubtreeRootobject
issuance_leaf_inclusion_proofs
bytes[]array
burn_leaf_inclusion_proofs
bytes[]array
ignore_leaf_inclusion_proofs
bytes[]array

Nested Messages

universerpc.MerkleSumNode

FieldgRPC TypeREST Type
root_hash
bytesstring
root_sum
int64string

universerpc.SupplyCommitSubtreeRoot

FieldgRPC TypeREST Type
type
stringstring
root_node
MerkleSumNodeobject
supply_tree_leaf_key
bytesstring
supply_tree_inclusion_proof
bytesstring