Skip to main content

FundBatch

tapcli assets mint fund FundBatch will attempt to fund the current pending batch with a genesis input, or create a new funded batch if no batch exists yet. This RPC is only needed if a custom witness is needed to finalize the batch. Otherwise, FinalizeBatch can be called directly.

Source: mintrpc/mint.proto

gRPC

rpc FundBatch (FundBatchRequest) returns (FundBatchResponse);

REST

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

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>,
fee_rate: <uint32>,
full_tree: <TapscriptFullTree>,
branch: <TapBranch>,
};
client.fundBatch(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "batch": <MintingBatch>,
// }

Messages

mintrpc.FundBatchRequest

Source: mintrpc/mint.proto

FieldgRPC TypeREST TypeREST Placement
short_response
boolbooleanbody
fee_rate
uint32integerbody
full_tree
TapscriptFullTreeobjectbody
branch
TapBranchobjectbody

mintrpc.FundBatchResponse

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

taprpc.TapBranch

FieldgRPC TypeREST Type
left_taphash
bytesstring
right_taphash
bytesstring

taprpc.TapLeaf

FieldgRPC TypeREST Type
script
bytesstring

taprpc.TapscriptFullTree

FieldgRPC TypeREST Type
all_leaves
TapLeaf[]array

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