Skip to main content

SealBatch

tapcli assets mint seal SealBatch will attempt to seal the current pending batch by creating and validating asset group witness for all assets in the batch. If a witness is not provided, a signature will be derived to serve as the witness. This RPC is only needed if any assets in the batch have a custom asset group key that require an external signer. Otherwise, FinalizeBatch can be called directly.

Source: mintrpc/mint.proto

gRPC

rpc SealBatch (SealBatchRequest) returns (SealBatchResponse);

REST

HTTP MethodPath
POST /v1/taproot-assets/assets/mint/seal

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('mintrpc/mint.proto', loaderOptions);
const mintrpc = grpc.loadPackageDefinition(packageDefinition).mintrpc;
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 mintrpc.Mint(GRPC_HOST, creds);
let request = {
short_response: <bool>,
group_witnesses: <GroupWitness>,
};
client.sealBatch(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "batch": <MintingBatch>,
// }

Messages

mintrpc.SealBatchRequest

Source: mintrpc/mint.proto

FieldgRPC TypeREST TypeREST Placement
short_response
boolbooleanbody
group_witnesses
GroupWitness[]arraybody

mintrpc.SealBatchResponse

Source: mintrpc/mint.proto

FieldgRPC TypeREST Type
batch
MintingBatchobject

Nested Messages

mintrpc.MintingBatch

FieldgRPC TypeREST Type
batch_key
bytesstring
batch_txid
stringstring
state
BatchStatestring
assets
PendingAsset[]array
created_at
int64string
height_hint
uint32integer
batch_psbt
bytesstring

mintrpc.PendingAsset

FieldgRPC TypeREST Type
asset_version
AssetVersionstring
asset_type
AssetTypestring
name
stringstring
asset_meta
AssetMetaobject
amount
uint64string
new_grouped_asset
boolboolean
group_key
bytesstring
group_anchor
stringstring
group_internal_key
KeyDescriptorobject
group_tapscript_root
bytesstring
script_key
ScriptKeyobject

taprpc.AssetMeta

FieldgRPC TypeREST Type
data
bytesstring
type
AssetMetaTypestring
meta_hash
bytesstring

taprpc.GroupWitness

FieldgRPC TypeREST Type
genesis_id
bytesstring
witness
bytes[]array

taprpc.KeyDescriptor

FieldgRPC TypeREST Type
raw_key_bytes
bytesstring
key_loc
KeyLocatorobject

taprpc.KeyLocator

FieldgRPC TypeREST Type
key_family
int32integer
key_index
int32integer

taprpc.ScriptKey

FieldgRPC TypeREST Type
pub_key
bytesstring
key_desc
KeyDescriptorobject
tap_tweak
bytesstring

Enums

mintrpc.BatchState

NameNumber
BATCH_STATE_UNKNOWN
0
BATCH_STATE_PENDING
1
BATCH_STATE_FROZEN
2
BATCH_STATE_COMMITTED
3
BATCH_STATE_BROADCAST
4
BATCH_STATE_CONFIRMED
5
BATCH_STATE_FINALIZED
6
BATCH_STATE_SEEDLING_CANCELLED
7
BATCH_STATE_SPROUT_CANCELLED
8

taprpc.AssetMetaType

NameNumber
META_TYPE_OPAQUE
0
META_TYPE_JSON
1

taprpc.AssetType

NameNumber
NORMAL
0
COLLECTIBLE
1

taprpc.AssetVersion

NameNumber
ASSET_VERSION_V0
0
ASSET_VERSION_V1
1