Skip to main content

MintAsset

MintAsset will attempt to mint the set of assets (async by default to ensure proper batching) specified in the request. The pending batch is returned that shows the other pending assets that are part of the next batch. This call will block until the operation succeeds (asset is staged in the batch) or fails.

Source: mintrpc/mint.proto

gRPC

rpc MintAsset (MintAssetRequest) returns (MintAssetResponse);

REST

HTTP MethodPath
POST /v1/taproot-assets/assets

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 = {
asset: <MintAsset>,
short_response: <bool>,
};
client.mintAsset(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "pending_batch": <MintingBatch>,
// }

Messages

mintrpc.MintAssetRequest

Source: mintrpc/mint.proto

FieldgRPC TypeREST TypeREST Placement
asset
MintAssetobjectbody
short_response
boolbooleanbody

mintrpc.MintAssetResponse

Source: mintrpc/mint.proto

FieldgRPC TypeREST Type
pending_batch
MintingBatchobject

Nested Messages

mintrpc.MintAsset

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

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