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>,
commit_outpoint: <OutPoint>,
spent_commit_outpoint: <OutPoint>,
very_first: <bool>,
};
client.fetchSupplyCommit(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "chain_data": <SupplyCommitChainData>,
// "tx_chain_fees_sats": <int64>,
// "issuance_subtree_root": <SupplyCommitSubtreeRoot>,
// "burn_subtree_root": <SupplyCommitSubtreeRoot>,
// "ignore_subtree_root": <SupplyCommitSubtreeRoot>,
// "issuance_leaves": <SupplyLeafEntry>,
// "burn_leaves": <SupplyLeafEntry>,
// "ignore_leaves": <SupplyLeafEntry>,
// "total_outstanding_supply": <uint64>,
// "spent_commitment_outpoint": <OutPoint>,
// }

Messages

universerpc.FetchSupplyCommitRequest

Source: universerpc/universe.proto

FieldgRPC TypeREST TypeREST Placement
group_key_bytes
bytesstringquery
group_key_str
stringstringpath
commit_outpoint
OutPointobjectquery
spent_commit_outpoint
OutPointobjectquery
very_first
boolbooleanquery

universerpc.FetchSupplyCommitResponse

Source: universerpc/universe.proto

FieldgRPC TypeREST Type
chain_data
SupplyCommitChainDataobject
tx_chain_fees_sats
int64string
issuance_subtree_root
SupplyCommitSubtreeRootobject
burn_subtree_root
SupplyCommitSubtreeRootobject
ignore_subtree_root
SupplyCommitSubtreeRootobject
issuance_leaves
SupplyLeafEntry[]array
burn_leaves
SupplyLeafEntry[]array
ignore_leaves
SupplyLeafEntry[]array
total_outstanding_supply
uint64string
spent_commitment_outpoint
OutPointobject

Nested Messages

taprpc.OutPoint

FieldgRPC TypeREST Type
txid
bytesstring
output_index
uint32integer

universerpc.MerkleSumNode

FieldgRPC TypeREST Type
root_hash
bytesstring
root_sum
int64string

universerpc.Outpoint

FieldgRPC TypeREST Type
hash_str
stringstring
index
int32integer

universerpc.SupplyCommitChainData

FieldgRPC TypeREST Type
txn
bytesstring
tx_out_idx
uint32integer
internal_key
bytesstring
output_key
bytesstring
supply_root_hash
bytesstring
supply_root_sum
uint64string
block_header
bytesstring
block_hash
bytesstring
block_height
uint32integer
tx_block_merkle_proof
bytesstring
tx_index
uint32integer

universerpc.SupplyCommitSubtreeRoot

FieldgRPC TypeREST Type
type
stringstring
root_node
MerkleSumNodeobject
supply_tree_leaf_key
bytesstring
supply_tree_inclusion_proof
bytesstring

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