Skip to main content

CommitVirtualPsbts

CommitVirtualPsbts creates the output commitments and proofs for the given virtual transactions by committing them to the BTC level anchor transaction. In addition, the BTC level anchor transaction is funded and prepared up to the point where it is ready to be signed.

Source: assetwalletrpc/assetwallet.proto

gRPC

rpc CommitVirtualPsbts (CommitVirtualPsbtsRequest) returns (CommitVirtualPsbtsResponse);

REST

HTTP MethodPath
POST /v1/taproot-assets/wallet/virtual-psbt/commit

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('assetwalletrpc/assetwallet.proto', loaderOptions);
const assetwalletrpc = grpc.loadPackageDefinition(packageDefinition).assetwalletrpc;
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 assetwalletrpc.AssetWallet(GRPC_HOST, creds);
let request = {
virtual_psbts: <bytes>,
passive_asset_psbts: <bytes>,
anchor_psbt: <bytes>,
existing_output_index: <int32>,
add: <bool>,
target_conf: <uint32>,
sat_per_vbyte: <uint64>,
};
client.commitVirtualPsbts(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "anchor_psbt": <bytes>,
// "virtual_psbts": <bytes>,
// "passive_asset_psbts": <bytes>,
// "change_output_index": <int32>,
// "lnd_locked_utxos": <OutPoint>,
// }

Messages

assetwalletrpc.CommitVirtualPsbtsRequest

Source: assetwalletrpc/assetwallet.proto

FieldgRPC TypeREST TypeREST Placement
virtual_psbts
bytes[]arraybody
passive_asset_psbts
bytes[]arraybody
anchor_psbt
bytesstringbody
existing_output_index
int32integerbody
add
boolbooleanbody
target_conf
uint32integerbody
sat_per_vbyte
uint64stringbody

assetwalletrpc.CommitVirtualPsbtsResponse

Source: assetwalletrpc/assetwallet.proto

FieldgRPC TypeREST Type
anchor_psbt
bytesstring
virtual_psbts
bytes[]array
passive_asset_psbts
bytes[]array
change_output_index
int32integer
lnd_locked_utxos
OutPoint[]array

Nested Messages

taprpc.OutPoint

FieldgRPC TypeREST Type
txid
bytesstring
output_index
uint32integer