Skip to content

Commit 4d02025

Browse files
committed
scripts: add tapd to update_protos script
1 parent 62a5fd2 commit 4d02025

File tree

6 files changed

+1541
-2
lines changed

6 files changed

+1541
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
"loop_release_tag": "v0.22.0-beta",
1010
"pool_release_tag": "v0.6.2-beta",
1111
"faraday_release_tag": "v0.2.9-alpha",
12+
"tapd_release_tag": "v0.2.0-lit-0",
1213
"lit_release_tag": "v0.9.0-alpha",
1314
"protoc_version": "21.9"
1415
},
1516
"scripts": {
1617
"build": "NODE_ENV=production webpack",
1718
"dev": "webpack --watch --stats-error-details",
18-
"update-protos": "sh scripts/update_protos.sh ${npm_package_config_lnd_release_tag} ${npm_package_config_loop_release_tag} ${npm_package_config_pool_release_tag} ${npm_package_config_faraday_release_tag} ${npm_package_config_lit_release_tag}",
19+
"update-protos": "sh scripts/update_protos.sh ${npm_package_config_lnd_release_tag} ${npm_package_config_loop_release_tag} ${npm_package_config_pool_release_tag} ${npm_package_config_faraday_release_tag} ${npm_package_config_tapd_release_tag} ${npm_package_config_lit_release_tag}",
1920
"generate": "sh scripts/generate_types.sh ${npm_package_config_lnd_release_tag} ${npm_package_config_loop_release_tag} ${npm_package_config_pool_release_tag} ${npm_package_config_faraday_release_tag} ${npm_package_config_lit_release_tag} ${npm_package_config_protoc_version}",
2021
"prettier": "prettier --check '**/*.ts*'",
2122
"prettier-write": "prettier --check --write '**/*.ts*'",
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
syntax = "proto3";
2+
3+
import "taprootassets.proto";
4+
5+
package assetwalletrpc;
6+
7+
option go_package = "github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc";
8+
9+
service AssetWallet {
10+
/*
11+
FundVirtualPsbt selects inputs from the available asset commitments to fund
12+
a virtual transaction matching the template.
13+
*/
14+
rpc FundVirtualPsbt (FundVirtualPsbtRequest)
15+
returns (FundVirtualPsbtResponse);
16+
17+
/*
18+
SignVirtualPsbt signs the inputs of a virtual transaction and prepares the
19+
commitments of the inputs and outputs.
20+
*/
21+
rpc SignVirtualPsbt (SignVirtualPsbtRequest)
22+
returns (SignVirtualPsbtResponse);
23+
24+
/*
25+
AnchorVirtualPsbts merges and then commits multiple virtual transactions in
26+
a single BTC level anchor transaction.
27+
28+
TODO(guggero): Actually implement accepting and merging multiple
29+
transactions.
30+
*/
31+
rpc AnchorVirtualPsbts (AnchorVirtualPsbtsRequest)
32+
returns (taprpc.SendAssetResponse);
33+
34+
/*
35+
NextInternalKey derives the next internal key for the given key family and
36+
stores it as an internal key in the database to make sure it is identified
37+
as a local key later on when importing proofs. While an internal key can
38+
also be used as the internal key of a script key, it is recommended to use
39+
the NextScriptKey RPC instead, to make sure the tweaked Taproot output key
40+
is also recognized as a local key.
41+
*/
42+
rpc NextInternalKey (NextInternalKeyRequest)
43+
returns (NextInternalKeyResponse);
44+
45+
/*
46+
NextScriptKey derives the next script key (and its corresponding internal
47+
key) and stores them both in the database to make sure they are identified
48+
as local keys later on when importing proofs.
49+
*/
50+
rpc NextScriptKey (NextScriptKeyRequest) returns (NextScriptKeyResponse);
51+
52+
/*
53+
ProveAssetOwnership creates an ownership proof embedded in an asset
54+
transition proof. That ownership proof is a signed virtual transaction
55+
spending the asset with a valid witness to prove the prover owns the keys
56+
that can spend the asset.
57+
*/
58+
rpc ProveAssetOwnership (ProveAssetOwnershipRequest)
59+
returns (ProveAssetOwnershipResponse);
60+
61+
/*
62+
VerifyAssetOwnership verifies the asset ownership proof embedded in the
63+
given transition proof of an asset and returns true if the proof is valid.
64+
*/
65+
rpc VerifyAssetOwnership (VerifyAssetOwnershipRequest)
66+
returns (VerifyAssetOwnershipResponse);
67+
}
68+
69+
message FundVirtualPsbtRequest {
70+
oneof template {
71+
/*
72+
Use an existing PSBT packet as the template for the funded PSBT.
73+
74+
TODO(guggero): Actually implement this. We can't use the "reserved"
75+
keyword here because we're in a oneof, so we add the field but implement
76+
it later.
77+
*/
78+
bytes psbt = 1;
79+
80+
/*
81+
Use the asset outputs and optional asset inputs from this raw template.
82+
*/
83+
TxTemplate raw = 2;
84+
}
85+
}
86+
87+
message FundVirtualPsbtResponse {
88+
/*
89+
The funded but not yet signed PSBT packet.
90+
*/
91+
bytes funded_psbt = 1;
92+
93+
/*
94+
The index of the added change output or -1 if no change was left over.
95+
*/
96+
int32 change_output_index = 2;
97+
}
98+
99+
message TxTemplate {
100+
/*
101+
An optional list of inputs to use. Every input must be an asset UTXO known
102+
to the wallet. The sum of all inputs must be greater than or equal to the
103+
sum of all outputs.
104+
105+
If no inputs are specified, asset coin selection will be performed instead
106+
and inputs of sufficient value will be added to the resulting PSBT.
107+
*/
108+
repeated PrevId inputs = 1;
109+
110+
/*
111+
A map of all Taproot Asset addresses mapped to the anchor transaction's
112+
output index that should be sent to.
113+
*/
114+
map<string, uint64> recipients = 2;
115+
}
116+
117+
message PrevId {
118+
/*
119+
The bitcoin anchor output on chain that contains the input asset.
120+
*/
121+
OutPoint outpoint = 1;
122+
123+
/*
124+
The asset ID of the previous asset tree.
125+
*/
126+
bytes id = 2;
127+
128+
/*
129+
The tweaked Taproot output key committing to the possible spending
130+
conditions of the asset.
131+
*/
132+
bytes script_key = 3;
133+
}
134+
135+
message OutPoint {
136+
/*
137+
Raw bytes representing the transaction id.
138+
*/
139+
bytes txid = 1;
140+
141+
/*
142+
The index of the output on the transaction.
143+
*/
144+
uint32 output_index = 2;
145+
}
146+
147+
message SignVirtualPsbtRequest {
148+
/*
149+
The PSBT of the virtual transaction that should be signed. The PSBT must
150+
contain all required inputs, outputs, UTXO data and custom fields required
151+
to identify the signing key.
152+
*/
153+
bytes funded_psbt = 1;
154+
}
155+
156+
message SignVirtualPsbtResponse {
157+
/*
158+
The signed virtual transaction in PSBT format.
159+
*/
160+
bytes signed_psbt = 1;
161+
162+
/*
163+
The indices of signed inputs.
164+
*/
165+
repeated uint32 signed_inputs = 2;
166+
}
167+
168+
message AnchorVirtualPsbtsRequest {
169+
/*
170+
The list of virtual transactions that should be merged and committed to in
171+
the BTC level anchor transaction.
172+
*/
173+
repeated bytes virtual_psbts = 1;
174+
}
175+
176+
message NextInternalKeyRequest {
177+
uint32 key_family = 1;
178+
}
179+
180+
message NextInternalKeyResponse {
181+
taprpc.KeyDescriptor internal_key = 1;
182+
}
183+
184+
message NextScriptKeyRequest {
185+
uint32 key_family = 1;
186+
}
187+
188+
message NextScriptKeyResponse {
189+
taprpc.ScriptKey script_key = 1;
190+
}
191+
192+
message ProveAssetOwnershipRequest {
193+
bytes asset_id = 1;
194+
195+
bytes script_key = 2;
196+
}
197+
198+
message ProveAssetOwnershipResponse {
199+
bytes proof_with_witness = 1;
200+
}
201+
202+
message VerifyAssetOwnershipRequest {
203+
bytes proof_with_witness = 1;
204+
}
205+
206+
message VerifyAssetOwnershipResponse {
207+
bool valid_proof = 1;
208+
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
syntax = "proto3";
2+
3+
import "taprootassets.proto";
4+
5+
package mintrpc;
6+
7+
option go_package = "github.com/lightninglabs/taproot-assets/taprpc/mintrpc";
8+
9+
service Mint {
10+
/* tapcli: `assets mint`
11+
MintAsset will attempt to mint the set of assets (async by default to
12+
ensure proper batching) specified in the request.
13+
*/
14+
rpc MintAsset (MintAssetRequest) returns (MintAssetResponse);
15+
16+
/* tapcli: `assets mint finalize`
17+
FinalizeBatch will attempt to finalize the current pending batch.
18+
*/
19+
rpc FinalizeBatch (FinalizeBatchRequest) returns (FinalizeBatchResponse);
20+
21+
/* tapcli: `assets mint cancel`
22+
CancelBatch will attempt to cancel the current pending batch.
23+
*/
24+
rpc CancelBatch (CancelBatchRequest) returns (CancelBatchResponse);
25+
26+
/* tapcli: `assets mint batches`
27+
ListBatches lists the set of batches submitted to the daemon, including
28+
pending and cancelled batches.
29+
*/
30+
rpc ListBatches (ListBatchRequest) returns (ListBatchResponse);
31+
}
32+
33+
message MintAsset {
34+
// The type of the asset to be created.
35+
taprpc.AssetType asset_type = 1;
36+
37+
// The name, or "tag" of the asset. This will affect the final asset ID.
38+
string name = 2;
39+
40+
/*
41+
A blob that resents metadata related to the asset. This will affect the
42+
final asset ID.
43+
*/
44+
taprpc.AssetMeta asset_meta = 3;
45+
46+
/*
47+
The total amount of units of the new asset that should be created. If the
48+
AssetType is Collectible, then this field cannot be set.
49+
*/
50+
uint64 amount = 4;
51+
52+
/*
53+
The specific group key this asset should be minted with.
54+
*/
55+
bytes group_key = 5;
56+
57+
/*
58+
The name of the asset in the batch that will anchor a new asset group.
59+
This asset will be minted with the same group key as the anchor asset.
60+
*/
61+
string group_anchor = 6;
62+
}
63+
64+
message MintAssetRequest {
65+
/*
66+
The asset to be minted.
67+
*/
68+
MintAsset asset = 1;
69+
70+
/*
71+
If true, then the asset will be created with a group key, which allows for
72+
future asset issuance.
73+
*/
74+
bool enable_emission = 2;
75+
}
76+
77+
message MintAssetResponse {
78+
/*
79+
A public key serialized in compressed format that can be used to uniquely
80+
identify a pending minting batch. Responses that share the same key will be
81+
batched into the same minting transaction.
82+
*/
83+
bytes batch_key = 1;
84+
}
85+
86+
message MintingBatch {
87+
// The internal public key of the batch.
88+
bytes batch_key = 1;
89+
90+
// The assets that are part of the batch.
91+
repeated MintAsset assets = 2;
92+
93+
// The state of the batch.
94+
BatchState state = 3;
95+
}
96+
97+
enum BatchState {
98+
BATCH_STATE_UNKNOWN = 0;
99+
BATCH_STATE_PEDNING = 1;
100+
BATCH_STATE_FROZEN = 2;
101+
BATCH_STATE_COMMITTED = 3;
102+
BATCH_STATE_BROADCAST = 4;
103+
BATCH_STATE_CONFIRMED = 5;
104+
BATCH_STATE_FINALIZED = 6;
105+
BATCH_STATE_SEEDLING_CANCELLED = 7;
106+
BATCH_STATE_SPROUT_CANCELLED = 8;
107+
}
108+
109+
message FinalizeBatchRequest {
110+
}
111+
112+
message FinalizeBatchResponse {
113+
// The internal public key of the batch.
114+
bytes batch_key = 1;
115+
}
116+
117+
message CancelBatchRequest {
118+
}
119+
120+
message CancelBatchResponse {
121+
// The internal public key of the batch.
122+
bytes batch_key = 1;
123+
}
124+
125+
message ListBatchRequest {
126+
// The optional batch key of the batch to list. When using REST this field
127+
// must be encoded as base64url.
128+
bytes batch_key = 1;
129+
}
130+
131+
message ListBatchResponse {
132+
repeated MintingBatch batches = 1;
133+
}

0 commit comments

Comments
 (0)