Skip to content

Commit 8169ee4

Browse files
committed
taprpc: add tapscript sibling to finalize call
1 parent 28a5ccc commit 8169ee4

File tree

6 files changed

+1029
-677
lines changed

6 files changed

+1029
-677
lines changed

rpcserver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,8 @@ func (r *rpcServer) NewAddr(ctx context.Context,
10971097
return nil, err
10981098
}
10991099

1100-
// Was there a tapscript sibling preimage specified?
1100+
// Was there a tapscript sibling preimage specified? If so, decode it
1101+
// and check that it is not a Taproot Asset Commitment.
11011102
tapscriptSibling, _, err := commitment.MaybeDecodeTapscriptPreimage(
11021103
req.TapscriptSibling,
11031104
)

taprpc/mintrpc/mint.pb.go

Lines changed: 160 additions & 95 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

taprpc/mintrpc/mint.proto

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,22 @@ message FinalizeBatchRequest {
177177

178178
// The optional fee rate to use for the minting transaction, in sat/kw.
179179
uint32 fee_rate = 2;
180+
181+
/*
182+
The optional tapscript sibling that will be used when deriving the genesis
183+
output for the batch. This sibling is a tapscript tree, which allows the
184+
minter to encumber future transfers of assets in the batch with Tapscript.
185+
*/
186+
oneof batch_sibling {
187+
/*
188+
An ordered list of TapLeafs, which will be used to construct a
189+
Tapscript tree.
190+
*/
191+
taprpc.TapscriptFullTree full_tree = 3;
192+
193+
// A TapBranch that represents a Tapscript tree managed externally.
194+
taprpc.TapBranch branch = 4;
195+
}
180196
}
181197

182198
message FinalizeBatchResponse {

taprpc/mintrpc/mint.swagger.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@
196196
"type": "integer",
197197
"format": "int64",
198198
"description": "The optional fee rate to use for the minting transaction, in sat/kw."
199+
},
200+
"full_tree": {
201+
"$ref": "#/definitions/taprpcTapscriptFullTree",
202+
"description": "An ordered list of TapLeafs, which will be used to construct a\nTapscript tree."
203+
},
204+
"branch": {
205+
"$ref": "#/definitions/taprpcTapBranch",
206+
"description": "A TapBranch that represents a Tapscript tree managed externally."
199207
}
200208
}
201209
},
@@ -423,6 +431,43 @@
423431
],
424432
"default": "ASSET_VERSION_V0",
425433
"description": " - ASSET_VERSION_V0: ASSET_VERSION_V0 is the default asset version. This version will include\nthe witness vector in the leaf for a tap commitment.\n - ASSET_VERSION_V1: ASSET_VERSION_V1 is the asset version that leaves out the witness vector\nfrom the MS-SMT leaf encoding."
434+
},
435+
"taprpcTapBranch": {
436+
"type": "object",
437+
"properties": {
438+
"left_taphash": {
439+
"type": "string",
440+
"format": "byte",
441+
"description": "The TapHash of the left child of the root hash of a Tapscript tree."
442+
},
443+
"right_taphash": {
444+
"type": "string",
445+
"format": "byte",
446+
"description": "The TapHash of the right child of the root hash of a Tapscript tree."
447+
}
448+
}
449+
},
450+
"taprpcTapLeaf": {
451+
"type": "object",
452+
"properties": {
453+
"script": {
454+
"type": "string",
455+
"format": "byte",
456+
"description": "The script of the tap leaf."
457+
}
458+
}
459+
},
460+
"taprpcTapscriptFullTree": {
461+
"type": "object",
462+
"properties": {
463+
"all_leaves": {
464+
"type": "array",
465+
"items": {
466+
"$ref": "#/definitions/taprpcTapLeaf"
467+
},
468+
"description": "The complete, ordered list of all tap leaves of the tree."
469+
}
470+
}
426471
}
427472
}
428473
}

0 commit comments

Comments
 (0)