Skip to main content

InsertSupplyCommit

InsertSupplyCommit inserts a supply commitment for a specific asset group. This includes the commitment details, supply leaves (issuance, burn, and ignore), and chain proof that proves the commitment has been mined.

Source: universerpc/universe.proto

gRPC

rpc InsertSupplyCommit (InsertSupplyCommitRequest) returns (InsertSupplyCommitResponse);

REST

HTTP MethodPath
POST /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>,
chain_data: <SupplyCommitChainData>,
spent_commitment_outpoint: <OutPoint>,
issuance_leaves: <SupplyLeafEntry>,
burn_leaves: <SupplyLeafEntry>,
ignore_leaves: <SupplyLeafEntry>,
};
client.insertSupplyCommit(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// }

Messages

universerpc.InsertSupplyCommitRequest

Source: universerpc/universe.proto

FieldgRPC TypeREST TypeREST Placement
group_key_bytes
bytesunknownbody
group_key_str
stringstringpath
chain_data
SupplyCommitChainDataobjectbody
spent_commitment_outpoint
OutPointobjectbody
issuance_leaves
SupplyLeafEntry[]objectbody
burn_leaves
SupplyLeafEntry[]objectbody
ignore_leaves
SupplyLeafEntry[]objectbody

universerpc.InsertSupplyCommitResponse

Source: universerpc/universe.proto

note

This response has no parameters.

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.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