Skip to content

Commit

Permalink
taprpc: add tapscript sibling to finalize call
Browse files Browse the repository at this point in the history
  • Loading branch information
jharveyb committed Feb 22, 2024
1 parent 5487769 commit 4d6630b
Show file tree
Hide file tree
Showing 6 changed files with 1,029 additions and 677 deletions.
3 changes: 2 additions & 1 deletion rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,8 @@ func (r *rpcServer) NewAddr(ctx context.Context,
return nil, err
}

// Was there a tapscript sibling preimage specified?
// Was there a tapscript sibling preimage specified? If so, decode it
// and check that it is not a Taproot Asset Commitment.
tapscriptSibling, _, err := commitment.MaybeDecodeTapscriptPreimage(
req.TapscriptSibling,
)
Expand Down
255 changes: 160 additions & 95 deletions taprpc/mintrpc/mint.pb.go

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions taprpc/mintrpc/mint.proto
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,22 @@ message FinalizeBatchRequest {

// The optional fee rate to use for the minting transaction, in sat/kw.
uint32 fee_rate = 2;

/*
The optional tapscript sibling that will be used when deriving the genesis
output for the batch. This sibling is a tapscript tree, which allows the
minter to encumber future transfers of assets in the batch with Tapscript.
*/
oneof batch_sibling {
/*
An ordered list of TapLeafs, which will be used to construct a
Tapscript tree.
*/
taprpc.TapscriptFullTree full_tree = 3;

// A TapBranch that represents a Tapscript tree managed externally.
taprpc.TapBranch branch = 4;
}
}

message FinalizeBatchResponse {
Expand Down
45 changes: 45 additions & 0 deletions taprpc/mintrpc/mint.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@
"type": "integer",
"format": "int64",
"description": "The optional fee rate to use for the minting transaction, in sat/kw."
},
"full_tree": {
"$ref": "#/definitions/taprpcTapscriptFullTree",
"description": "An ordered list of TapLeafs, which will be used to construct a\nTapscript tree."
},
"branch": {
"$ref": "#/definitions/taprpcTapBranch",
"description": "A TapBranch that represents a Tapscript tree managed externally."
}
}
},
Expand Down Expand Up @@ -423,6 +431,43 @@
],
"default": "ASSET_VERSION_V0",
"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."
},
"taprpcTapBranch": {
"type": "object",
"properties": {
"left_taphash": {
"type": "string",
"format": "byte",
"description": "The TapHash of the left child of the root hash of a Tapscript tree."
},
"right_taphash": {
"type": "string",
"format": "byte",
"description": "The TapHash of the right child of the root hash of a Tapscript tree."
}
}
},
"taprpcTapLeaf": {
"type": "object",
"properties": {
"script": {
"type": "string",
"format": "byte",
"description": "The script of the tap leaf."
}
}
},
"taprpcTapscriptFullTree": {
"type": "object",
"properties": {
"all_leaves": {
"type": "array",
"items": {
"$ref": "#/definitions/taprpcTapLeaf"
},
"description": "The complete, ordered list of all tap leaves of the tree."
}
}
}
}
}
Loading

0 comments on commit 4d6630b

Please sign in to comment.