mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-17 04:04:21 +01:00
Add support for unilateral exit (#79)
* v0 unilateral redemption * add fee outputs to congestion tree * unilateral exit * rework unilateral exit verbosity * substract fee from vtxo amount * remove unused functions and variables * fix after reviews * Update noah/explorer.go Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com> Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com> * remove bufferutils --------- Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com> Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
This commit is contained in:
@@ -558,6 +558,9 @@
|
||||
},
|
||||
"spent": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"poolTxid": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,14 +262,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1SignPsetWithSchnorrKeyResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"signedTx": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1SignTransactionResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -169,6 +169,7 @@ message Vtxo {
|
||||
Input outpoint = 1;
|
||||
Output receiver = 2;
|
||||
bool spent = 3;
|
||||
string pool_txid = 4;
|
||||
}
|
||||
|
||||
message GetPubkeyRequest {}
|
||||
|
||||
@@ -1325,6 +1325,7 @@ type Vtxo struct {
|
||||
Outpoint *Input `protobuf:"bytes,1,opt,name=outpoint,proto3" json:"outpoint,omitempty"`
|
||||
Receiver *Output `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"`
|
||||
Spent bool `protobuf:"varint,3,opt,name=spent,proto3" json:"spent,omitempty"`
|
||||
PoolTxid string `protobuf:"bytes,4,opt,name=pool_txid,json=poolTxid,proto3" json:"pool_txid,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Vtxo) Reset() {
|
||||
@@ -1380,6 +1381,13 @@ func (x *Vtxo) GetSpent() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Vtxo) GetPoolTxid() string {
|
||||
if x != nil {
|
||||
return x.PoolTxid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetPubkeyRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -1573,84 +1581,86 @@ var file_ark_v1_service_proto_rawDesc = []byte{
|
||||
0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74, 0x78, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x76, 0x74, 0x78, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x74, 0x78, 0x6f,
|
||||
0x52, 0x05, 0x76, 0x74, 0x78, 0x6f, 0x73, 0x22, 0x73, 0x0a, 0x04, 0x56, 0x74, 0x78, 0x6f, 0x12,
|
||||
0x29, 0x0a, 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74,
|
||||
0x52, 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x08, 0x72, 0x65,
|
||||
0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x61,
|
||||
0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x08, 0x72, 0x65,
|
||||
0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x70, 0x65, 0x6e, 0x74, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x73, 0x70, 0x65, 0x6e, 0x74, 0x22, 0x12, 0x0a, 0x10,
|
||||
0x47, 0x65, 0x74, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x22, 0x2b, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x32, 0xfd, 0x06,
|
||||
0x0a, 0x0a, 0x41, 0x72, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x73, 0x0a, 0x0f,
|
||||
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12,
|
||||
0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
|
||||
0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x1f, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
|
||||
0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31,
|
||||
0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
|
||||
0x72, 0x12, 0x67, 0x0a, 0x0c, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e,
|
||||
0x74, 0x12, 0x1b, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d,
|
||||
0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c,
|
||||
0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x61, 0x79,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3,
|
||||
0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x73, 0x0a, 0x0f, 0x46, 0x69,
|
||||
0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x2e,
|
||||
0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50,
|
||||
0x52, 0x05, 0x76, 0x74, 0x78, 0x6f, 0x73, 0x22, 0x90, 0x01, 0x0a, 0x04, 0x56, 0x74, 0x78, 0x6f,
|
||||
0x12, 0x29, 0x0a, 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x70, 0x75,
|
||||
0x74, 0x52, 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x08, 0x72,
|
||||
0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
|
||||
0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x08, 0x72,
|
||||
0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x70, 0x65, 0x6e, 0x74,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x73, 0x70, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a,
|
||||
0x09, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x74, 0x78, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x70, 0x6f, 0x6f, 0x6c, 0x54, 0x78, 0x69, 0x64, 0x22, 0x12, 0x0a, 0x10, 0x47, 0x65,
|
||||
0x74, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x2b,
|
||||
0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x32, 0xfd, 0x06, 0x0a, 0x0a,
|
||||
0x41, 0x72, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x73, 0x0a, 0x0f, 0x52, 0x65,
|
||||
0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x2e,
|
||||
0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50,
|
||||
0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e,
|
||||
0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50,
|
||||
0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50,
|
||||
0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f,
|
||||
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x70,
|
||||
0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x12,
|
||||
0x57, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x61, 0x72,
|
||||
0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
|
||||
0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18,
|
||||
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e,
|
||||
0x64, 0x2f, 0x7b, 0x74, 0x78, 0x69, 0x64, 0x7d, 0x12, 0x65, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45,
|
||||
0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1d, 0x2e, 0x61, 0x72, 0x6b,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65,
|
||||
0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61,
|
||||
0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
||||
0x0c, 0x12, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x30, 0x01, 0x12,
|
||||
0x50, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x13, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61,
|
||||
0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f,
|
||||
0x70, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64,
|
||||
0x7d, 0x12, 0x55, 0x0a, 0x06, 0x46, 0x61, 0x75, 0x63, 0x65, 0x74, 0x12, 0x15, 0x2e, 0x61, 0x72,
|
||||
0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x61, 0x75, 0x63, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x61, 0x75, 0x63,
|
||||
0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93,
|
||||
0x02, 0x16, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x61, 0x75, 0x63, 0x65, 0x74, 0x2f, 0x7b,
|
||||
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x5d, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74,
|
||||
0x56, 0x74, 0x78, 0x6f, 0x73, 0x12, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c,
|
||||
0x69, 0x73, 0x74, 0x56, 0x74, 0x78, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x19, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74, 0x78,
|
||||
0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93,
|
||||
0x02, 0x15, 0x12, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x74, 0x78, 0x6f, 0x73, 0x2f, 0x7b, 0x61,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x54, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x50, 0x75,
|
||||
0x62, 0x6b, 0x65, 0x79, 0x12, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
|
||||
0x74, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19,
|
||||
0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x75, 0x62, 0x6b, 0x65,
|
||||
0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
||||
0x0c, 0x12, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x42, 0x92, 0x01,
|
||||
0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x53, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 0x67, 0x69,
|
||||
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x6b, 0x2d, 0x6e, 0x65, 0x74,
|
||||
0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x61, 0x72, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2d, 0x73, 0x70, 0x65,
|
||||
0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61,
|
||||
0x72, 0x6b, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x72, 0x6b, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x58,
|
||||
0x58, 0xaa, 0x02, 0x06, 0x41, 0x72, 0x6b, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x06, 0x41, 0x72, 0x6b,
|
||||
0x5c, 0x56, 0x31, 0xe2, 0x02, 0x12, 0x41, 0x72, 0x6b, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42,
|
||||
0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x07, 0x41, 0x72, 0x6b, 0x3a, 0x3a,
|
||||
0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12,
|
||||
0x67, 0x0a, 0x0c, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12,
|
||||
0x1b, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x61,
|
||||
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61,
|
||||
0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x61, 0x79, 0x6d, 0x65,
|
||||
0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93,
|
||||
0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65,
|
||||
0x6e, 0x74, 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x73, 0x0a, 0x0f, 0x46, 0x69, 0x6e, 0x61,
|
||||
0x6c, 0x69, 0x7a, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x72,
|
||||
0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50, 0x61, 0x79,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x72,
|
||||
0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50, 0x61, 0x79,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3,
|
||||
0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x12, 0x57, 0x0a,
|
||||
0x08, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x61, 0x72, 0x6b, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52,
|
||||
0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3,
|
||||
0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f,
|
||||
0x7b, 0x74, 0x78, 0x69, 0x64, 0x7d, 0x12, 0x65, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65,
|
||||
0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x12,
|
||||
0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x30, 0x01, 0x12, 0x50, 0x0a,
|
||||
0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x13, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x50,
|
||||
0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x72, 0x6b,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x69,
|
||||
0x6e, 0x67, 0x2f, 0x7b, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x12,
|
||||
0x55, 0x0a, 0x06, 0x46, 0x61, 0x75, 0x63, 0x65, 0x74, 0x12, 0x15, 0x2e, 0x61, 0x72, 0x6b, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x46, 0x61, 0x75, 0x63, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x16, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x61, 0x75, 0x63, 0x65, 0x74,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16,
|
||||
0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x61, 0x75, 0x63, 0x65, 0x74, 0x2f, 0x7b, 0x61, 0x64,
|
||||
0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x5d, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74,
|
||||
0x78, 0x6f, 0x73, 0x12, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,
|
||||
0x74, 0x56, 0x74, 0x78, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e,
|
||||
0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74, 0x78, 0x6f, 0x73,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15,
|
||||
0x12, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x74, 0x78, 0x6f, 0x73, 0x2f, 0x7b, 0x61, 0x64, 0x64,
|
||||
0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x54, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x50, 0x75, 0x62, 0x6b,
|
||||
0x65, 0x79, 0x12, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50,
|
||||
0x75, 0x62, 0x6b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61,
|
||||
0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x12,
|
||||
0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x42, 0x92, 0x01, 0x0a, 0x0a,
|
||||
0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68,
|
||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x6b, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f,
|
||||
0x72, 0x6b, 0x2f, 0x61, 0x72, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2d, 0x73, 0x70, 0x65, 0x63, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x72, 0x6b,
|
||||
0x2f, 0x76, 0x31, 0x3b, 0x61, 0x72, 0x6b, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x58, 0x58, 0xaa,
|
||||
0x02, 0x06, 0x41, 0x72, 0x6b, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x06, 0x41, 0x72, 0x6b, 0x5c, 0x56,
|
||||
0x31, 0xe2, 0x02, 0x12, 0x41, 0x72, 0x6b, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65,
|
||||
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x07, 0x41, 0x72, 0x6b, 0x3a, 0x3a, 0x56, 0x31,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -1786,110 +1786,6 @@ func (x *ClaimPegInResponse) GetTxHex() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type SignPsetWithSchnorrKeyRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// The partial transaction to sign in base64 format.
|
||||
Tx string `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"`
|
||||
// The sighash type. SIGHASH_DEFAULT is used for any input that does not specify one.
|
||||
SighashType uint32 `protobuf:"varint,2,opt,name=sighash_type,json=sighashType,proto3" json:"sighash_type,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SignPsetWithSchnorrKeyRequest) Reset() {
|
||||
*x = SignPsetWithSchnorrKeyRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ocean_v1_transaction_proto_msgTypes[30]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SignPsetWithSchnorrKeyRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SignPsetWithSchnorrKeyRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SignPsetWithSchnorrKeyRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ocean_v1_transaction_proto_msgTypes[30]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SignPsetWithSchnorrKeyRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SignPsetWithSchnorrKeyRequest) Descriptor() ([]byte, []int) {
|
||||
return file_ocean_v1_transaction_proto_rawDescGZIP(), []int{30}
|
||||
}
|
||||
|
||||
func (x *SignPsetWithSchnorrKeyRequest) GetTx() string {
|
||||
if x != nil {
|
||||
return x.Tx
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SignPsetWithSchnorrKeyRequest) GetSighashType() uint32 {
|
||||
if x != nil {
|
||||
return x.SighashType
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type SignPsetWithSchnorrKeyResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
SignedTx string `protobuf:"bytes,1,opt,name=signed_tx,json=signedTx,proto3" json:"signed_tx,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SignPsetWithSchnorrKeyResponse) Reset() {
|
||||
*x = SignPsetWithSchnorrKeyResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ocean_v1_transaction_proto_msgTypes[31]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SignPsetWithSchnorrKeyResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SignPsetWithSchnorrKeyResponse) ProtoMessage() {}
|
||||
|
||||
func (x *SignPsetWithSchnorrKeyResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ocean_v1_transaction_proto_msgTypes[31]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SignPsetWithSchnorrKeyResponse.ProtoReflect.Descriptor instead.
|
||||
func (*SignPsetWithSchnorrKeyResponse) Descriptor() ([]byte, []int) {
|
||||
return file_ocean_v1_transaction_proto_rawDescGZIP(), []int{31}
|
||||
}
|
||||
|
||||
func (x *SignPsetWithSchnorrKeyResponse) GetSignedTx() string {
|
||||
if x != nil {
|
||||
return x.SignedTx
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_ocean_v1_transaction_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_ocean_v1_transaction_proto_rawDesc = []byte{
|
||||
@@ -2074,93 +1970,77 @@ var file_ocean_v1_transaction_proto_rawDesc = []byte{
|
||||
0x61, 0x69, 0x6d, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x22, 0x2b, 0x0a, 0x12, 0x43, 0x6c, 0x61,
|
||||
0x69, 0x6d, 0x50, 0x65, 0x67, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x15, 0x0a, 0x06, 0x74, 0x78, 0x5f, 0x68, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x05, 0x74, 0x78, 0x48, 0x65, 0x78, 0x22, 0x52, 0x0a, 0x1d, 0x53, 0x69, 0x67, 0x6e, 0x50, 0x73,
|
||||
0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x53, 0x63, 0x68, 0x6e, 0x6f, 0x72, 0x72, 0x4b, 0x65, 0x79,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x78, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x78, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x68, 0x61,
|
||||
0x73, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x73,
|
||||
0x69, 0x67, 0x68, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3d, 0x0a, 0x1e, 0x53, 0x69,
|
||||
0x67, 0x6e, 0x50, 0x73, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x53, 0x63, 0x68, 0x6e, 0x6f, 0x72,
|
||||
0x72, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09,
|
||||
0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x74, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x08, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x54, 0x78, 0x32, 0xd1, 0x09, 0x0a, 0x12, 0x54, 0x72,
|
||||
0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x12, 0x53, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
|
||||
0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0b, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x55,
|
||||
0x74, 0x78, 0x6f, 0x73, 0x12, 0x1c, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x55, 0x74, 0x78, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65,
|
||||
0x6c, 0x65, 0x63, 0x74, 0x55, 0x74, 0x78, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x4d, 0x0a, 0x0c, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x46, 0x65, 0x65,
|
||||
0x73, 0x12, 0x1d, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x73, 0x74,
|
||||
0x69, 0x6d, 0x61, 0x74, 0x65, 0x46, 0x65, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x1e, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x73, 0x74, 0x69,
|
||||
0x6d, 0x61, 0x74, 0x65, 0x46, 0x65, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x56, 0x0a, 0x0f, 0x53, 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x12, 0x20, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53,
|
||||
0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x53, 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x14, 0x42, 0x72, 0x6f, 0x61,
|
||||
0x64, 0x63, 0x61, 0x73, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x12, 0x25, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x72, 0x6f, 0x61,
|
||||
0x64, 0x63, 0x61, 0x73, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x54, 0x72, 0x61, 0x6e,
|
||||
0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x47, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x73, 0x65, 0x74, 0x12, 0x1b, 0x2e,
|
||||
0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50,
|
||||
0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6f, 0x63, 0x65,
|
||||
0x05, 0x74, 0x78, 0x48, 0x65, 0x78, 0x32, 0xe4, 0x08, 0x0a, 0x12, 0x54, 0x72, 0x61, 0x6e, 0x73,
|
||||
0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a,
|
||||
0x0e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||
0x1f, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72,
|
||||
0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x20, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54,
|
||||
0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0b, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x55, 0x74, 0x78, 0x6f,
|
||||
0x73, 0x12, 0x1c, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6c,
|
||||
0x65, 0x63, 0x74, 0x55, 0x74, 0x78, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x1d, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63,
|
||||
0x74, 0x55, 0x74, 0x78, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d,
|
||||
0x0a, 0x0c, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x46, 0x65, 0x65, 0x73, 0x12, 0x1d,
|
||||
0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61,
|
||||
0x74, 0x65, 0x46, 0x65, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e,
|
||||
0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74,
|
||||
0x65, 0x46, 0x65, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a,
|
||||
0x0f, 0x53, 0x69, 0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x12, 0x20, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e,
|
||||
0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69,
|
||||
0x67, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x14, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61,
|
||||
0x73, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x2e,
|
||||
0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61,
|
||||
0x73, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x42, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a,
|
||||
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x73, 0x65, 0x74, 0x12, 0x1b, 0x2e, 0x6f, 0x63, 0x65,
|
||||
0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x73, 0x65, 0x74,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x50, 0x73, 0x65, 0x74, 0x12, 0x1b, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x55,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x44, 0x0a, 0x09, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x73, 0x65, 0x74, 0x12, 0x1a,
|
||||
0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50,
|
||||
0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6f, 0x63, 0x65,
|
||||
0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x73, 0x65, 0x74, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x08, 0x53, 0x69, 0x67, 0x6e, 0x50,
|
||||
0x73, 0x65, 0x74, 0x12, 0x19, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53,
|
||||
0x69, 0x67, 0x6e, 0x50, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a,
|
||||
0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x50, 0x73,
|
||||
0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x4d, 0x69,
|
||||
0x6e, 0x74, 0x12, 0x15, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x69,
|
||||
0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6f, 0x63, 0x65, 0x61,
|
||||
0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x3b, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x6f, 0x63,
|
||||
0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x52, 0x65, 0x6d, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35,
|
||||
0x0a, 0x04, 0x42, 0x75, 0x72, 0x6e, 0x12, 0x15, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,
|
||||
0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65,
|
||||
0x72, 0x12, 0x19, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61,
|
||||
0x6e, 0x73, 0x66, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6f,
|
||||
0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x0c, 0x50, 0x65, 0x67, 0x49,
|
||||
0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x67, 0x49, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x50, 0x65, 0x67, 0x49, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x43, 0x6c, 0x61, 0x69, 0x6d,
|
||||
0x50, 0x65, 0x67, 0x49, 0x6e, 0x12, 0x1b, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x65, 0x67, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c,
|
||||
0x61, 0x69, 0x6d, 0x50, 0x65, 0x67, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x6b, 0x0a, 0x16, 0x53, 0x69, 0x67, 0x6e, 0x50, 0x73, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68,
|
||||
0x53, 0x63, 0x68, 0x6e, 0x6f, 0x72, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x27, 0x2e, 0x6f, 0x63, 0x65,
|
||||
0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x50, 0x73, 0x65, 0x74, 0x57, 0x69,
|
||||
0x74, 0x68, 0x53, 0x63, 0x68, 0x6e, 0x6f, 0x72, 0x72, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53,
|
||||
0x69, 0x67, 0x6e, 0x50, 0x73, 0x65, 0x74, 0x57, 0x69, 0x74, 0x68, 0x53, 0x63, 0x68, 0x6e, 0x6f,
|
||||
0x72, 0x72, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa4, 0x01,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50,
|
||||
0x73, 0x65, 0x74, 0x12, 0x1b, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x55,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x1c, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x50, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44,
|
||||
0x0a, 0x09, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x73, 0x65, 0x74, 0x12, 0x1a, 0x2e, 0x6f, 0x63,
|
||||
0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x73, 0x65, 0x74,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x08, 0x53, 0x69, 0x67, 0x6e, 0x50, 0x73, 0x65, 0x74,
|
||||
0x12, 0x19, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e,
|
||||
0x50, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6f, 0x63,
|
||||
0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x50, 0x73, 0x65, 0x74, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x4d, 0x69, 0x6e, 0x74, 0x12,
|
||||
0x15, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x69, 0x6e, 0x74, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x4d, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b,
|
||||
0x0a, 0x06, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x18, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6d,
|
||||
0x69, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x42,
|
||||
0x75, 0x72, 0x6e, 0x12, 0x15, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x42,
|
||||
0x75, 0x72, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6f, 0x63, 0x65,
|
||||
0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x41, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x12, 0x19,
|
||||
0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66,
|
||||
0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6f, 0x63, 0x65, 0x61,
|
||||
0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x0c, 0x50, 0x65, 0x67, 0x49, 0x6e, 0x41, 0x64,
|
||||
0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x50, 0x65, 0x67, 0x49, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x50, 0x65, 0x67, 0x49, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x65, 0x67,
|
||||
0x49, 0x6e, 0x12, 0x1b, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c,
|
||||
0x61, 0x69, 0x6d, 0x50, 0x65, 0x67, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x1c, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d,
|
||||
0x50, 0x65, 0x67, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa4, 0x01,
|
||||
0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x6f, 0x63, 0x65, 0x61, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x10,
|
||||
0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x50, 0x01, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61,
|
||||
@@ -2187,60 +2067,58 @@ func file_ocean_v1_transaction_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_ocean_v1_transaction_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_ocean_v1_transaction_proto_msgTypes = make([]protoimpl.MessageInfo, 32)
|
||||
var file_ocean_v1_transaction_proto_msgTypes = make([]protoimpl.MessageInfo, 30)
|
||||
var file_ocean_v1_transaction_proto_goTypes = []interface{}{
|
||||
(SelectUtxosRequest_Strategy)(0), // 0: ocean.v1.SelectUtxosRequest.Strategy
|
||||
(*GetTransactionRequest)(nil), // 1: ocean.v1.GetTransactionRequest
|
||||
(*GetTransactionResponse)(nil), // 2: ocean.v1.GetTransactionResponse
|
||||
(*SelectUtxosRequest)(nil), // 3: ocean.v1.SelectUtxosRequest
|
||||
(*SelectUtxosResponse)(nil), // 4: ocean.v1.SelectUtxosResponse
|
||||
(*EstimateFeesRequest)(nil), // 5: ocean.v1.EstimateFeesRequest
|
||||
(*EstimateFeesResponse)(nil), // 6: ocean.v1.EstimateFeesResponse
|
||||
(*SignTransactionRequest)(nil), // 7: ocean.v1.SignTransactionRequest
|
||||
(*SignTransactionResponse)(nil), // 8: ocean.v1.SignTransactionResponse
|
||||
(*BroadcastTransactionRequest)(nil), // 9: ocean.v1.BroadcastTransactionRequest
|
||||
(*BroadcastTransactionResponse)(nil), // 10: ocean.v1.BroadcastTransactionResponse
|
||||
(*CreatePsetRequest)(nil), // 11: ocean.v1.CreatePsetRequest
|
||||
(*CreatePsetResponse)(nil), // 12: ocean.v1.CreatePsetResponse
|
||||
(*UpdatePsetRequest)(nil), // 13: ocean.v1.UpdatePsetRequest
|
||||
(*UpdatePsetResponse)(nil), // 14: ocean.v1.UpdatePsetResponse
|
||||
(*BlindPsetRequest)(nil), // 15: ocean.v1.BlindPsetRequest
|
||||
(*BlindPsetResponse)(nil), // 16: ocean.v1.BlindPsetResponse
|
||||
(*SignPsetRequest)(nil), // 17: ocean.v1.SignPsetRequest
|
||||
(*SignPsetResponse)(nil), // 18: ocean.v1.SignPsetResponse
|
||||
(*MintRequest)(nil), // 19: ocean.v1.MintRequest
|
||||
(*MintResponse)(nil), // 20: ocean.v1.MintResponse
|
||||
(*RemintRequest)(nil), // 21: ocean.v1.RemintRequest
|
||||
(*RemintResponse)(nil), // 22: ocean.v1.RemintResponse
|
||||
(*BurnRequest)(nil), // 23: ocean.v1.BurnRequest
|
||||
(*BurnResponse)(nil), // 24: ocean.v1.BurnResponse
|
||||
(*TransferRequest)(nil), // 25: ocean.v1.TransferRequest
|
||||
(*TransferResponse)(nil), // 26: ocean.v1.TransferResponse
|
||||
(*PegInAddressRequest)(nil), // 27: ocean.v1.PegInAddressRequest
|
||||
(*PegInAddressResponse)(nil), // 28: ocean.v1.PegInAddressResponse
|
||||
(*ClaimPegInRequest)(nil), // 29: ocean.v1.ClaimPegInRequest
|
||||
(*ClaimPegInResponse)(nil), // 30: ocean.v1.ClaimPegInResponse
|
||||
(*SignPsetWithSchnorrKeyRequest)(nil), // 31: ocean.v1.SignPsetWithSchnorrKeyRequest
|
||||
(*SignPsetWithSchnorrKeyResponse)(nil), // 32: ocean.v1.SignPsetWithSchnorrKeyResponse
|
||||
(*BlockDetails)(nil), // 33: ocean.v1.BlockDetails
|
||||
(*Utxo)(nil), // 34: ocean.v1.Utxo
|
||||
(*Input)(nil), // 35: ocean.v1.Input
|
||||
(*Output)(nil), // 36: ocean.v1.Output
|
||||
(*UnblindedInput)(nil), // 37: ocean.v1.UnblindedInput
|
||||
(SelectUtxosRequest_Strategy)(0), // 0: ocean.v1.SelectUtxosRequest.Strategy
|
||||
(*GetTransactionRequest)(nil), // 1: ocean.v1.GetTransactionRequest
|
||||
(*GetTransactionResponse)(nil), // 2: ocean.v1.GetTransactionResponse
|
||||
(*SelectUtxosRequest)(nil), // 3: ocean.v1.SelectUtxosRequest
|
||||
(*SelectUtxosResponse)(nil), // 4: ocean.v1.SelectUtxosResponse
|
||||
(*EstimateFeesRequest)(nil), // 5: ocean.v1.EstimateFeesRequest
|
||||
(*EstimateFeesResponse)(nil), // 6: ocean.v1.EstimateFeesResponse
|
||||
(*SignTransactionRequest)(nil), // 7: ocean.v1.SignTransactionRequest
|
||||
(*SignTransactionResponse)(nil), // 8: ocean.v1.SignTransactionResponse
|
||||
(*BroadcastTransactionRequest)(nil), // 9: ocean.v1.BroadcastTransactionRequest
|
||||
(*BroadcastTransactionResponse)(nil), // 10: ocean.v1.BroadcastTransactionResponse
|
||||
(*CreatePsetRequest)(nil), // 11: ocean.v1.CreatePsetRequest
|
||||
(*CreatePsetResponse)(nil), // 12: ocean.v1.CreatePsetResponse
|
||||
(*UpdatePsetRequest)(nil), // 13: ocean.v1.UpdatePsetRequest
|
||||
(*UpdatePsetResponse)(nil), // 14: ocean.v1.UpdatePsetResponse
|
||||
(*BlindPsetRequest)(nil), // 15: ocean.v1.BlindPsetRequest
|
||||
(*BlindPsetResponse)(nil), // 16: ocean.v1.BlindPsetResponse
|
||||
(*SignPsetRequest)(nil), // 17: ocean.v1.SignPsetRequest
|
||||
(*SignPsetResponse)(nil), // 18: ocean.v1.SignPsetResponse
|
||||
(*MintRequest)(nil), // 19: ocean.v1.MintRequest
|
||||
(*MintResponse)(nil), // 20: ocean.v1.MintResponse
|
||||
(*RemintRequest)(nil), // 21: ocean.v1.RemintRequest
|
||||
(*RemintResponse)(nil), // 22: ocean.v1.RemintResponse
|
||||
(*BurnRequest)(nil), // 23: ocean.v1.BurnRequest
|
||||
(*BurnResponse)(nil), // 24: ocean.v1.BurnResponse
|
||||
(*TransferRequest)(nil), // 25: ocean.v1.TransferRequest
|
||||
(*TransferResponse)(nil), // 26: ocean.v1.TransferResponse
|
||||
(*PegInAddressRequest)(nil), // 27: ocean.v1.PegInAddressRequest
|
||||
(*PegInAddressResponse)(nil), // 28: ocean.v1.PegInAddressResponse
|
||||
(*ClaimPegInRequest)(nil), // 29: ocean.v1.ClaimPegInRequest
|
||||
(*ClaimPegInResponse)(nil), // 30: ocean.v1.ClaimPegInResponse
|
||||
(*BlockDetails)(nil), // 31: ocean.v1.BlockDetails
|
||||
(*Utxo)(nil), // 32: ocean.v1.Utxo
|
||||
(*Input)(nil), // 33: ocean.v1.Input
|
||||
(*Output)(nil), // 34: ocean.v1.Output
|
||||
(*UnblindedInput)(nil), // 35: ocean.v1.UnblindedInput
|
||||
}
|
||||
var file_ocean_v1_transaction_proto_depIdxs = []int32{
|
||||
33, // 0: ocean.v1.GetTransactionResponse.block_details:type_name -> ocean.v1.BlockDetails
|
||||
31, // 0: ocean.v1.GetTransactionResponse.block_details:type_name -> ocean.v1.BlockDetails
|
||||
0, // 1: ocean.v1.SelectUtxosRequest.strategy:type_name -> ocean.v1.SelectUtxosRequest.Strategy
|
||||
34, // 2: ocean.v1.SelectUtxosResponse.utxos:type_name -> ocean.v1.Utxo
|
||||
35, // 3: ocean.v1.EstimateFeesRequest.inputs:type_name -> ocean.v1.Input
|
||||
36, // 4: ocean.v1.EstimateFeesRequest.outputs:type_name -> ocean.v1.Output
|
||||
35, // 5: ocean.v1.CreatePsetRequest.inputs:type_name -> ocean.v1.Input
|
||||
36, // 6: ocean.v1.CreatePsetRequest.outputs:type_name -> ocean.v1.Output
|
||||
35, // 7: ocean.v1.UpdatePsetRequest.inputs:type_name -> ocean.v1.Input
|
||||
36, // 8: ocean.v1.UpdatePsetRequest.outputs:type_name -> ocean.v1.Output
|
||||
37, // 9: ocean.v1.BlindPsetRequest.extra_unblinded_inputs:type_name -> ocean.v1.UnblindedInput
|
||||
36, // 10: ocean.v1.BurnRequest.receivers:type_name -> ocean.v1.Output
|
||||
36, // 11: ocean.v1.TransferRequest.receivers:type_name -> ocean.v1.Output
|
||||
32, // 2: ocean.v1.SelectUtxosResponse.utxos:type_name -> ocean.v1.Utxo
|
||||
33, // 3: ocean.v1.EstimateFeesRequest.inputs:type_name -> ocean.v1.Input
|
||||
34, // 4: ocean.v1.EstimateFeesRequest.outputs:type_name -> ocean.v1.Output
|
||||
33, // 5: ocean.v1.CreatePsetRequest.inputs:type_name -> ocean.v1.Input
|
||||
34, // 6: ocean.v1.CreatePsetRequest.outputs:type_name -> ocean.v1.Output
|
||||
33, // 7: ocean.v1.UpdatePsetRequest.inputs:type_name -> ocean.v1.Input
|
||||
34, // 8: ocean.v1.UpdatePsetRequest.outputs:type_name -> ocean.v1.Output
|
||||
35, // 9: ocean.v1.BlindPsetRequest.extra_unblinded_inputs:type_name -> ocean.v1.UnblindedInput
|
||||
34, // 10: ocean.v1.BurnRequest.receivers:type_name -> ocean.v1.Output
|
||||
34, // 11: ocean.v1.TransferRequest.receivers:type_name -> ocean.v1.Output
|
||||
1, // 12: ocean.v1.TransactionService.GetTransaction:input_type -> ocean.v1.GetTransactionRequest
|
||||
3, // 13: ocean.v1.TransactionService.SelectUtxos:input_type -> ocean.v1.SelectUtxosRequest
|
||||
5, // 14: ocean.v1.TransactionService.EstimateFees:input_type -> ocean.v1.EstimateFeesRequest
|
||||
@@ -2256,25 +2134,23 @@ var file_ocean_v1_transaction_proto_depIdxs = []int32{
|
||||
25, // 24: ocean.v1.TransactionService.Transfer:input_type -> ocean.v1.TransferRequest
|
||||
27, // 25: ocean.v1.TransactionService.PegInAddress:input_type -> ocean.v1.PegInAddressRequest
|
||||
29, // 26: ocean.v1.TransactionService.ClaimPegIn:input_type -> ocean.v1.ClaimPegInRequest
|
||||
31, // 27: ocean.v1.TransactionService.SignPsetWithSchnorrKey:input_type -> ocean.v1.SignPsetWithSchnorrKeyRequest
|
||||
2, // 28: ocean.v1.TransactionService.GetTransaction:output_type -> ocean.v1.GetTransactionResponse
|
||||
4, // 29: ocean.v1.TransactionService.SelectUtxos:output_type -> ocean.v1.SelectUtxosResponse
|
||||
6, // 30: ocean.v1.TransactionService.EstimateFees:output_type -> ocean.v1.EstimateFeesResponse
|
||||
8, // 31: ocean.v1.TransactionService.SignTransaction:output_type -> ocean.v1.SignTransactionResponse
|
||||
10, // 32: ocean.v1.TransactionService.BroadcastTransaction:output_type -> ocean.v1.BroadcastTransactionResponse
|
||||
12, // 33: ocean.v1.TransactionService.CreatePset:output_type -> ocean.v1.CreatePsetResponse
|
||||
14, // 34: ocean.v1.TransactionService.UpdatePset:output_type -> ocean.v1.UpdatePsetResponse
|
||||
16, // 35: ocean.v1.TransactionService.BlindPset:output_type -> ocean.v1.BlindPsetResponse
|
||||
18, // 36: ocean.v1.TransactionService.SignPset:output_type -> ocean.v1.SignPsetResponse
|
||||
20, // 37: ocean.v1.TransactionService.Mint:output_type -> ocean.v1.MintResponse
|
||||
22, // 38: ocean.v1.TransactionService.Remint:output_type -> ocean.v1.RemintResponse
|
||||
24, // 39: ocean.v1.TransactionService.Burn:output_type -> ocean.v1.BurnResponse
|
||||
26, // 40: ocean.v1.TransactionService.Transfer:output_type -> ocean.v1.TransferResponse
|
||||
28, // 41: ocean.v1.TransactionService.PegInAddress:output_type -> ocean.v1.PegInAddressResponse
|
||||
30, // 42: ocean.v1.TransactionService.ClaimPegIn:output_type -> ocean.v1.ClaimPegInResponse
|
||||
32, // 43: ocean.v1.TransactionService.SignPsetWithSchnorrKey:output_type -> ocean.v1.SignPsetWithSchnorrKeyResponse
|
||||
28, // [28:44] is the sub-list for method output_type
|
||||
12, // [12:28] is the sub-list for method input_type
|
||||
2, // 27: ocean.v1.TransactionService.GetTransaction:output_type -> ocean.v1.GetTransactionResponse
|
||||
4, // 28: ocean.v1.TransactionService.SelectUtxos:output_type -> ocean.v1.SelectUtxosResponse
|
||||
6, // 29: ocean.v1.TransactionService.EstimateFees:output_type -> ocean.v1.EstimateFeesResponse
|
||||
8, // 30: ocean.v1.TransactionService.SignTransaction:output_type -> ocean.v1.SignTransactionResponse
|
||||
10, // 31: ocean.v1.TransactionService.BroadcastTransaction:output_type -> ocean.v1.BroadcastTransactionResponse
|
||||
12, // 32: ocean.v1.TransactionService.CreatePset:output_type -> ocean.v1.CreatePsetResponse
|
||||
14, // 33: ocean.v1.TransactionService.UpdatePset:output_type -> ocean.v1.UpdatePsetResponse
|
||||
16, // 34: ocean.v1.TransactionService.BlindPset:output_type -> ocean.v1.BlindPsetResponse
|
||||
18, // 35: ocean.v1.TransactionService.SignPset:output_type -> ocean.v1.SignPsetResponse
|
||||
20, // 36: ocean.v1.TransactionService.Mint:output_type -> ocean.v1.MintResponse
|
||||
22, // 37: ocean.v1.TransactionService.Remint:output_type -> ocean.v1.RemintResponse
|
||||
24, // 38: ocean.v1.TransactionService.Burn:output_type -> ocean.v1.BurnResponse
|
||||
26, // 39: ocean.v1.TransactionService.Transfer:output_type -> ocean.v1.TransferResponse
|
||||
28, // 40: ocean.v1.TransactionService.PegInAddress:output_type -> ocean.v1.PegInAddressResponse
|
||||
30, // 41: ocean.v1.TransactionService.ClaimPegIn:output_type -> ocean.v1.ClaimPegInResponse
|
||||
27, // [27:42] is the sub-list for method output_type
|
||||
12, // [12:27] is the sub-list for method input_type
|
||||
12, // [12:12] is the sub-list for extension type_name
|
||||
12, // [12:12] is the sub-list for extension extendee
|
||||
0, // [0:12] is the sub-list for field type_name
|
||||
@@ -2647,30 +2523,6 @@ func file_ocean_v1_transaction_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ocean_v1_transaction_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SignPsetWithSchnorrKeyRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ocean_v1_transaction_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SignPsetWithSchnorrKeyResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@@ -2678,7 +2530,7 @@ func file_ocean_v1_transaction_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_ocean_v1_transaction_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 32,
|
||||
NumMessages: 30,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -56,9 +56,6 @@ type TransactionServiceClient interface {
|
||||
// ClaimPegIn returns a transaction to claim funds pegged on the Bitcoin
|
||||
// main-chain to have them available on the Liquid side-chain.
|
||||
ClaimPegIn(ctx context.Context, in *ClaimPegInRequest, opts ...grpc.CallOption) (*ClaimPegInResponse, error)
|
||||
// SignPsetWithSchnorrKey signs all taproot inputs of the provided tx with
|
||||
// the key at the given derivation path.
|
||||
SignPsetWithSchnorrKey(ctx context.Context, in *SignPsetWithSchnorrKeyRequest, opts ...grpc.CallOption) (*SignPsetWithSchnorrKeyResponse, error)
|
||||
}
|
||||
|
||||
type transactionServiceClient struct {
|
||||
@@ -204,15 +201,6 @@ func (c *transactionServiceClient) ClaimPegIn(ctx context.Context, in *ClaimPegI
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *transactionServiceClient) SignPsetWithSchnorrKey(ctx context.Context, in *SignPsetWithSchnorrKeyRequest, opts ...grpc.CallOption) (*SignPsetWithSchnorrKeyResponse, error) {
|
||||
out := new(SignPsetWithSchnorrKeyResponse)
|
||||
err := c.cc.Invoke(ctx, "/ocean.v1.TransactionService/SignPsetWithSchnorrKey", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// TransactionServiceServer is the server API for TransactionService service.
|
||||
// All implementations should embed UnimplementedTransactionServiceServer
|
||||
// for forward compatibility
|
||||
@@ -255,9 +243,6 @@ type TransactionServiceServer interface {
|
||||
// ClaimPegIn returns a transaction to claim funds pegged on the Bitcoin
|
||||
// main-chain to have them available on the Liquid side-chain.
|
||||
ClaimPegIn(context.Context, *ClaimPegInRequest) (*ClaimPegInResponse, error)
|
||||
// SignPsetWithSchnorrKey signs all taproot inputs of the provided tx with
|
||||
// the key at the given derivation path.
|
||||
SignPsetWithSchnorrKey(context.Context, *SignPsetWithSchnorrKeyRequest) (*SignPsetWithSchnorrKeyResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedTransactionServiceServer should be embedded to have forward compatible implementations.
|
||||
@@ -309,9 +294,6 @@ func (UnimplementedTransactionServiceServer) PegInAddress(context.Context, *PegI
|
||||
func (UnimplementedTransactionServiceServer) ClaimPegIn(context.Context, *ClaimPegInRequest) (*ClaimPegInResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ClaimPegIn not implemented")
|
||||
}
|
||||
func (UnimplementedTransactionServiceServer) SignPsetWithSchnorrKey(context.Context, *SignPsetWithSchnorrKeyRequest) (*SignPsetWithSchnorrKeyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SignPsetWithSchnorrKey not implemented")
|
||||
}
|
||||
|
||||
// UnsafeTransactionServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to TransactionServiceServer will
|
||||
@@ -594,24 +576,6 @@ func _TransactionService_ClaimPegIn_Handler(srv interface{}, ctx context.Context
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _TransactionService_SignPsetWithSchnorrKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SignPsetWithSchnorrKeyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TransactionServiceServer).SignPsetWithSchnorrKey(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ocean.v1.TransactionService/SignPsetWithSchnorrKey",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TransactionServiceServer).SignPsetWithSchnorrKey(ctx, req.(*SignPsetWithSchnorrKeyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// TransactionService_ServiceDesc is the grpc.ServiceDesc for TransactionService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -679,10 +643,6 @@ var TransactionService_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "ClaimPegIn",
|
||||
Handler: _TransactionService_ClaimPegIn_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SignPsetWithSchnorrKey",
|
||||
Handler: _TransactionService_SignPsetWithSchnorrKey_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "ocean/v1/transaction.proto",
|
||||
|
||||
@@ -38,6 +38,7 @@ func main() {
|
||||
SchedulerType: cfg.SchedulerType,
|
||||
TxBuilderType: cfg.TxBuilderType,
|
||||
WalletAddr: cfg.WalletAddr,
|
||||
MinRelayFee: cfg.MinRelayFee,
|
||||
}
|
||||
svc, err := grpcservice.NewService(svcConfig, appConfig)
|
||||
if err != nil {
|
||||
|
||||
@@ -18,15 +18,15 @@ require (
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/timshannon/badgerhold/v4 v4.0.3
|
||||
github.com/urfave/cli/v2 v2.26.0
|
||||
github.com/vulpemventures/go-elements v0.4.7
|
||||
github.com/vulpemventures/go-elements v0.5.1
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17
|
||||
google.golang.org/grpc v1.59.0
|
||||
google.golang.org/protobuf v1.31.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/btcsuite/btcd v0.23.1 // indirect
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
|
||||
github.com/btcsuite/btcd v0.23.1
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2
|
||||
github.com/btcsuite/btcd/btcutil v1.1.3
|
||||
github.com/btcsuite/btcd/btcutil/psbt v1.1.4 // indirect
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
|
||||
|
||||
@@ -48,8 +48,8 @@ github.com/btcsuite/btcd v0.23.1 h1:IB8cVQcC2X5mHbnfirLG5IZnkWYNTPlLZVrxUYSotbE=
|
||||
github.com/btcsuite/btcd v0.23.1/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
|
||||
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
|
||||
github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE=
|
||||
github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ=
|
||||
@@ -327,8 +327,8 @@ github.com/urfave/cli/v2 v2.26.0 h1:3f3AMg3HpThFNT4I++TKOejZO8yU55t3JnnSr4S4QEI=
|
||||
github.com/urfave/cli/v2 v2.26.0/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
|
||||
github.com/vulpemventures/fastsha256 v0.0.0-20160815193821-637e65642941 h1:CTcw80hz/Sw8hqlKX5ZYvBUF5gAHSHwdjXxRf/cjDcI=
|
||||
github.com/vulpemventures/fastsha256 v0.0.0-20160815193821-637e65642941/go.mod h1:GXBJykxW2kUcktGdsgyay7uwwWvkljASfljNcT0mbh8=
|
||||
github.com/vulpemventures/go-elements v0.4.7 h1:M5dtBHwRXqct75DJeEv5b0PUFS93t0gh2naJaGlvp60=
|
||||
github.com/vulpemventures/go-elements v0.4.7/go.mod h1:aBGuWXHaiAIUIcwqCdtEh2iQ3kJjKwHU9ywvhlcRSeU=
|
||||
github.com/vulpemventures/go-elements v0.5.1 h1:F83n7dScOnAnpyH9VgWLdC68Qcva+2EWVzzNuW2UKak=
|
||||
github.com/vulpemventures/go-elements v0.5.1/go.mod h1:aBGuWXHaiAIUIcwqCdtEh2iQ3kJjKwHU9ywvhlcRSeU=
|
||||
github.com/vulpemventures/go-secp256k1-zkp v1.1.6 h1:BmsrmXRLUibwa75Qkk8yELjpzCzlAjYFGLiLiOdq7Xo=
|
||||
github.com/vulpemventures/go-secp256k1-zkp v1.1.6/go.mod h1:zo7CpgkuPgoe7fAV+inyxsI9IhGmcoFgyD8nqZaPSOM=
|
||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||
|
||||
@@ -36,6 +36,7 @@ type Config struct {
|
||||
SchedulerType string
|
||||
TxBuilderType string
|
||||
WalletAddr string
|
||||
MinRelayFee uint64
|
||||
|
||||
repo ports.RepoManager
|
||||
svc application.Service
|
||||
@@ -62,6 +63,9 @@ func (c *Config) Validate() error {
|
||||
if len(c.WalletAddr) <= 0 {
|
||||
return fmt.Errorf("missing onchain wallet address")
|
||||
}
|
||||
if c.MinRelayFee < 30 {
|
||||
return fmt.Errorf("invalid min relay fee, must be at least 30 sats")
|
||||
}
|
||||
if err := c.repoManager(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -140,7 +144,7 @@ func (c *Config) txBuilderService() error {
|
||||
func (c *Config) appService() error {
|
||||
net := c.mainChain()
|
||||
svc, err := application.NewService(
|
||||
c.RoundInterval, c.Network, net, c.wallet, c.repo, c.txBuilder,
|
||||
c.RoundInterval, c.Network, net, c.wallet, c.repo, c.txBuilder, c.MinRelayFee,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -21,6 +21,7 @@ type Config struct {
|
||||
NoTLS bool
|
||||
Network common.Network
|
||||
LogLevel int
|
||||
MinRelayFee uint64
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -34,6 +35,7 @@ var (
|
||||
Insecure = "INSECURE"
|
||||
LogLevel = "LOG_LEVEL"
|
||||
Network = "NETWORK"
|
||||
MinRelayFee = "MIN_RELAY_FEE"
|
||||
|
||||
defaultDatadir = common.AppDataDir("arkd", false)
|
||||
defaultRoundInterval = 60
|
||||
@@ -44,6 +46,7 @@ var (
|
||||
defaultInsecure = true
|
||||
defaultNetwork = "testnet"
|
||||
defaultLogLevel = 5
|
||||
defaultMinRelayFee = 30
|
||||
)
|
||||
|
||||
func LoadConfig() (*Config, error) {
|
||||
@@ -59,6 +62,7 @@ func LoadConfig() (*Config, error) {
|
||||
viper.SetDefault(Insecure, defaultInsecure)
|
||||
viper.SetDefault(LogLevel, defaultLogLevel)
|
||||
viper.SetDefault(Network, defaultNetwork)
|
||||
viper.SetDefault(MinRelayFee, defaultMinRelayFee)
|
||||
|
||||
net, err := getNetwork()
|
||||
if err != nil {
|
||||
@@ -80,6 +84,7 @@ func LoadConfig() (*Config, error) {
|
||||
DbDir: filepath.Join(viper.GetString(Datadir), "db"),
|
||||
LogLevel: viper.GetInt(LogLevel),
|
||||
Network: net,
|
||||
MinRelayFee: viper.GetUint64(MinRelayFee),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ type Service interface {
|
||||
}
|
||||
|
||||
type service struct {
|
||||
minRelayFee uint64
|
||||
roundInterval int64
|
||||
network common.Network
|
||||
onchainNework network.Network
|
||||
@@ -57,6 +58,7 @@ type service struct {
|
||||
func NewService(
|
||||
interval int64, network common.Network, onchainNetwork network.Network,
|
||||
walletSvc ports.WalletService, repoManager ports.RepoManager, builder ports.TxBuilder,
|
||||
minRelayFee uint64,
|
||||
) (Service, error) {
|
||||
eventsCh := make(chan domain.RoundEvent)
|
||||
paymentRequests := newPaymentsMap(nil)
|
||||
@@ -66,7 +68,7 @@ func NewService(
|
||||
return nil, fmt.Errorf("failed to fetch pubkey: %s", err)
|
||||
}
|
||||
svc := &service{
|
||||
interval, network, onchainNetwork, pubkey,
|
||||
minRelayFee, interval, network, onchainNetwork, pubkey,
|
||||
walletSvc, repoManager, builder, paymentRequests, forfeitTxs,
|
||||
eventsCh,
|
||||
}
|
||||
@@ -265,7 +267,7 @@ func (s *service) startFinalization() {
|
||||
return
|
||||
}
|
||||
|
||||
signedPoolTx, tree, err := s.builder.BuildPoolTx(s.pubkey, s.wallet, payments)
|
||||
signedPoolTx, tree, err := s.builder.BuildPoolTx(s.pubkey, s.wallet, payments, s.minRelayFee)
|
||||
if err != nil {
|
||||
changes = round.Fail(fmt.Errorf("failed to create pool tx: %s", err))
|
||||
log.WithError(err).Warn("failed to create pool tx")
|
||||
@@ -412,6 +414,7 @@ func (s *service) getNewVtxos(round *domain.Round) []domain.Vtxo {
|
||||
vtxos = append(vtxos, domain.Vtxo{
|
||||
VtxoKey: domain.VtxoKey{Txid: node.Txid, VOut: uint32(i)},
|
||||
Receiver: domain.Receiver{Pubkey: pubkey, Amount: out.Value},
|
||||
PoolTx: round.Txid,
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
@@ -122,5 +122,6 @@ func (r Receiver) IsOnchain() bool {
|
||||
type Vtxo struct {
|
||||
VtxoKey
|
||||
Receiver
|
||||
Spent bool
|
||||
Spent bool
|
||||
PoolTx string
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
type TxBuilder interface {
|
||||
BuildPoolTx(
|
||||
aspPubkey *secp256k1.PublicKey, wallet WalletService, payments []domain.Payment,
|
||||
aspPubkey *secp256k1.PublicKey, wallet WalletService, payments []domain.Payment, minRelayFee uint64,
|
||||
) (poolTx string, congestionTree domain.CongestionTree, err error)
|
||||
BuildForfeitTxs(
|
||||
aspPubkey *secp256k1.PublicKey, poolTx string, payments []domain.Payment,
|
||||
|
||||
@@ -150,6 +150,7 @@ func (b *txBuilder) BuildPoolTx(
|
||||
aspPubkey *secp256k1.PublicKey,
|
||||
wallet ports.WalletService,
|
||||
payments []domain.Payment,
|
||||
minRelayFee uint64,
|
||||
) (poolTx string, congestionTree domain.CongestionTree, err error) {
|
||||
aspScriptBytes, err := p2wpkhScript(aspPubkey, b.net)
|
||||
if err != nil {
|
||||
@@ -159,17 +160,16 @@ func (b *txBuilder) BuildPoolTx(
|
||||
aspScript := hex.EncodeToString(aspScriptBytes)
|
||||
|
||||
offchainReceivers, onchainReceivers := receiversFromPayments(payments)
|
||||
sharedOutputAmount := sumReceivers(offchainReceivers)
|
||||
|
||||
numberOfConnectors := numberOfVTXOs(payments)
|
||||
connectorOutputAmount := connectorAmount * numberOfConnectors
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
makeTree, sharedOutputScript, err := buildCongestionTree(
|
||||
makeTree, sharedOutputScript, sharedOutputAmount, err := buildCongestionTree(
|
||||
b.net,
|
||||
aspPubkey,
|
||||
offchainReceivers,
|
||||
minRelayFee,
|
||||
)
|
||||
if err != nil {
|
||||
return
|
||||
@@ -273,14 +273,6 @@ func receiversFromPayments(
|
||||
return
|
||||
}
|
||||
|
||||
func sumReceivers(receivers []domain.Receiver) uint64 {
|
||||
var sum uint64
|
||||
for _, r := range receivers {
|
||||
sum += r.Amount
|
||||
}
|
||||
return sum
|
||||
}
|
||||
|
||||
type output struct {
|
||||
script string
|
||||
amount uint64
|
||||
|
||||
@@ -8,12 +8,14 @@ import (
|
||||
"github.com/ark-network/ark/internal/core/domain"
|
||||
"github.com/ark-network/ark/internal/core/ports"
|
||||
txbuilder "github.com/ark-network/ark/internal/infrastructure/tx-builder/covenant"
|
||||
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
secp256k1 "github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/vulpemventures/go-elements/network"
|
||||
"github.com/vulpemventures/go-elements/payment"
|
||||
"github.com/vulpemventures/go-elements/psetv2"
|
||||
"github.com/vulpemventures/go-elements/taproot"
|
||||
"github.com/vulpemventures/go-elements/transaction"
|
||||
)
|
||||
|
||||
@@ -114,7 +116,7 @@ func (*mockedWalletService) Status(ctx context.Context) (ports.WalletStatus, err
|
||||
|
||||
// Transfer implements ports.WalletService.
|
||||
func (*mockedWalletService) Transfer(ctx context.Context, outs []ports.TxOutput) (string, error) {
|
||||
return createTestPoolTx(1000, (450+500)*1)
|
||||
return createTestPoolTx(outs[0].GetAmount(), (450+500)*1)
|
||||
}
|
||||
|
||||
func TestBuildCongestionTree(t *testing.T) {
|
||||
@@ -153,8 +155,8 @@ func TestBuildCongestionTree(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedNodesNum: 3,
|
||||
expectedLeavesNum: 2,
|
||||
expectedNodesNum: 1,
|
||||
expectedLeavesNum: 1,
|
||||
},
|
||||
{
|
||||
payments: []domain.Payment{
|
||||
@@ -234,8 +236,8 @@ func TestBuildCongestionTree(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedNodesNum: 11,
|
||||
expectedLeavesNum: 6,
|
||||
expectedNodesNum: 5,
|
||||
expectedLeavesNum: 2,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -244,7 +246,8 @@ func TestBuildCongestionTree(t *testing.T) {
|
||||
require.NotNil(t, key)
|
||||
|
||||
for _, f := range fixtures {
|
||||
poolTx, tree, err := builder.BuildPoolTx(key, &mockedWalletService{}, f.payments)
|
||||
poolTx, tree, err := builder.BuildPoolTx(key, &mockedWalletService{}, f.payments, 30)
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, f.expectedNodesNum, tree.NumberOfNodes())
|
||||
require.Len(t, tree.Leaves(), f.expectedLeavesNum)
|
||||
@@ -258,32 +261,37 @@ func TestBuildCongestionTree(t *testing.T) {
|
||||
require.Len(t, tree[0], 1)
|
||||
require.Equal(t, poolTxID, tree[0][0].ParentTxid)
|
||||
|
||||
// check the leaves
|
||||
for _, leaf := range tree.Leaves() {
|
||||
pset, err := psetv2.NewPsetFromBase64(leaf.Tx)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Len(t, pset.Inputs, 1)
|
||||
require.Len(t, pset.Outputs, 1)
|
||||
|
||||
inputTxID := chainhash.Hash(pset.Inputs[0].PreviousTxid).String()
|
||||
require.Equal(t, leaf.ParentTxid, inputTxID)
|
||||
}
|
||||
|
||||
// check the nodes
|
||||
for _, level := range tree[:len(tree)-2] {
|
||||
for _, level := range tree {
|
||||
for _, node := range level {
|
||||
pset, err := psetv2.NewPsetFromBase64(node.Tx)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Len(t, pset.Inputs, 1)
|
||||
require.Len(t, pset.Outputs, 2)
|
||||
require.Len(t, pset.Outputs, 3)
|
||||
|
||||
inputTxID := chainhash.Hash(pset.Inputs[0].PreviousTxid).String()
|
||||
require.Equal(t, node.ParentTxid, inputTxID)
|
||||
|
||||
children := tree.Children(node.Txid)
|
||||
require.Len(t, children, 2)
|
||||
if len(children) > 0 {
|
||||
require.Len(t, children, 2)
|
||||
|
||||
for i, child := range children {
|
||||
childTx, err := psetv2.NewPsetFromBase64(child.Tx)
|
||||
require.NoError(t, err)
|
||||
|
||||
for _, leaf := range childTx.Inputs[0].TapLeafScript {
|
||||
key := leaf.ControlBlock.InternalKey
|
||||
rootHash := leaf.ControlBlock.RootHash(leaf.Script)
|
||||
|
||||
outputScript := taproot.ComputeTaprootOutputKey(key, rootHash)
|
||||
previousScriptKey := pset.Outputs[i].Script[2:]
|
||||
require.Len(t, previousScriptKey, 32)
|
||||
require.Equal(t, schnorr.SerializePubKey(outputScript), previousScriptKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
// Copyright (c) 2015-2017 The btcsuite developers
|
||||
// Use of this source code is governed by an ISC
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package txbuilder
|
||||
|
||||
const (
|
||||
maxInt32 = 1<<31 - 1
|
||||
minInt32 = -1 << 31
|
||||
)
|
||||
|
||||
// scriptNum represents a numeric value used in the scripting engine with
|
||||
// special handling to deal with the subtle semantics required by consensus.
|
||||
//
|
||||
// All numbers are stored on the data and alternate stacks encoded as little
|
||||
// endian with a sign bit. All numeric opcodes such as OP_ADD, OP_SUB,
|
||||
// and OP_MUL, are only allowed to operate on 4-byte integers in the range
|
||||
// [-2^31 + 1, 2^31 - 1], however the results of numeric operations may overflow
|
||||
// and remain valid so long as they are not used as inputs to other numeric
|
||||
// operations or otherwise interpreted as an integer.
|
||||
//
|
||||
// For example, it is possible for OP_ADD to have 2^31 - 1 for its two operands
|
||||
// resulting 2^32 - 2, which overflows, but is still pushed to the stack as the
|
||||
// result of the addition. That value can then be used as input to OP_VERIFY
|
||||
// which will succeed because the data is being interpreted as a boolean.
|
||||
// However, if that same value were to be used as input to another numeric
|
||||
// opcode, such as OP_SUB, it must fail.
|
||||
//
|
||||
// This type handles the aforementioned requirements by storing all numeric
|
||||
// operation results as an int64 to handle overflow and provides the Bytes
|
||||
// method to get the serialized representation (including values that overflow).
|
||||
//
|
||||
// Then, whenever data is interpreted as an integer, it is converted to this
|
||||
// type by using the MakeScriptNum function which will return an error if the
|
||||
// number is out of range or not minimally encoded depending on parameters.
|
||||
// Since all numeric opcodes involve pulling data from the stack and
|
||||
// interpreting it as an integer, it provides the required behavior.
|
||||
type scriptNum int64
|
||||
|
||||
// Bytes returns the number serialized as a little endian with a sign bit.
|
||||
func (n scriptNum) Bytes() []byte {
|
||||
// Zero encodes as an empty byte slice.
|
||||
if n == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Take the absolute value and keep track of whether it was originally
|
||||
// negative.
|
||||
isNegative := n < 0
|
||||
if isNegative {
|
||||
n = -n
|
||||
}
|
||||
|
||||
// Encode to little endian. The maximum number of encoded bytes is 9
|
||||
// (8 bytes for max int64 plus a potential byte for sign extension).
|
||||
result := make([]byte, 0, 9)
|
||||
for n > 0 {
|
||||
result = append(result, byte(n&0xff))
|
||||
n >>= 8
|
||||
}
|
||||
|
||||
// When the most significant byte already has the high bit set, an
|
||||
// additional high byte is required to indicate whether the number is
|
||||
// negative or positive. The additional byte is removed when converting
|
||||
// back to an integral and its high bit is used to denote the sign.
|
||||
//
|
||||
// Otherwise, when the most significant byte does not already have the
|
||||
// high bit set, use it to indicate the value is negative, if needed.
|
||||
if result[len(result)-1]&0x80 != 0 {
|
||||
extraByte := byte(0x00)
|
||||
if isNegative {
|
||||
extraByte = 0x80
|
||||
}
|
||||
result = append(result, extraByte)
|
||||
|
||||
} else if isNegative {
|
||||
result[len(result)-1] |= 0x80
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// Int32 returns the script number clamped to a valid int32. That is to say
|
||||
// when the script number is higher than the max allowed int32, the max int32
|
||||
// value is returned and vice versa for the minimum value. Note that this
|
||||
// behavior is different from a simple int32 cast because that truncates
|
||||
// and the consensus rules dictate numbers which are directly cast to ints
|
||||
// provide this behavior.
|
||||
//
|
||||
// In practice, for most opcodes, the number should never be out of range since
|
||||
// it will have been created with MakeScriptNum using the defaultScriptLen
|
||||
// value, which rejects them. In case something in the future ends up calling
|
||||
// this function against the result of some arithmetic, which IS allowed to be
|
||||
// out of range before being reinterpreted as an integer, this will provide the
|
||||
// correct behavior.
|
||||
func (n scriptNum) Int32() int32 {
|
||||
if n > maxInt32 {
|
||||
return maxInt32
|
||||
}
|
||||
|
||||
if n < minInt32 {
|
||||
return minInt32
|
||||
}
|
||||
|
||||
return int32(n)
|
||||
}
|
||||
@@ -29,24 +29,23 @@ type pluggableCongestionTree func(outpoint psetv2.InputArgs) (domain.CongestionT
|
||||
|
||||
// withOutput returns an introspection script that checks the script and the amount of the output at the given index
|
||||
// verify will add an OP_EQUALVERIFY at the end of the script, otherwise it will add an OP_EQUAL
|
||||
func withOutput(outputIndex uint64, taprootWitnessProgram []byte, amount uint32, verify bool) []byte {
|
||||
func withOutput(index byte, taprootWitnessProgram []byte, amount uint64, verify bool) []byte {
|
||||
amountBuffer := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint32(amountBuffer, amount)
|
||||
binary.LittleEndian.PutUint64(amountBuffer, amount)
|
||||
|
||||
index := scriptNum(outputIndex).Bytes()
|
||||
|
||||
script := append(index, []byte{
|
||||
script := []byte{
|
||||
index,
|
||||
OP_INSPECTOUTPUTSCRIPTPUBKEY,
|
||||
txscript.OP_1,
|
||||
txscript.OP_EQUALVERIFY,
|
||||
txscript.OP_DATA_32,
|
||||
}...)
|
||||
}
|
||||
|
||||
script = append(script, taprootWitnessProgram...)
|
||||
script = append(script, []byte{
|
||||
txscript.OP_EQUALVERIFY,
|
||||
}...)
|
||||
script = append(script, index...)
|
||||
script = append(script, index)
|
||||
script = append(script, []byte{
|
||||
OP_INSPECTOUTPUTVALUE,
|
||||
txscript.OP_1,
|
||||
@@ -114,12 +113,12 @@ func sweepTapLeaf(sweepKey *secp256k1.PublicKey) (*taproot.TapElementsLeaf, erro
|
||||
// forceSplitCoinTapLeaf returns a taproot leaf that enforces a split into two outputs
|
||||
// each output (left and right) will have the given amount and the given taproot key as witness program
|
||||
func forceSplitCoinTapLeaf(
|
||||
leftKey, rightKey *secp256k1.PublicKey, leftAmount, rightAmount uint32,
|
||||
leftKey, rightKey *secp256k1.PublicKey, leftAmount, rightAmount uint64,
|
||||
) taproot.TapElementsLeaf {
|
||||
nextScriptLeft := withOutput(0, schnorr.SerializePubKey(leftKey), leftAmount, rightKey != nil)
|
||||
nextScriptLeft := withOutput(txscript.OP_0, schnorr.SerializePubKey(leftKey), leftAmount, rightKey != nil)
|
||||
branchScript := append([]byte{}, nextScriptLeft...)
|
||||
if rightKey != nil {
|
||||
nextScriptRight := withOutput(1, schnorr.SerializePubKey(rightKey), rightAmount, false)
|
||||
nextScriptRight := withOutput(txscript.OP_1, schnorr.SerializePubKey(rightKey), rightAmount, false)
|
||||
branchScript = append(branchScript, nextScriptRight...)
|
||||
}
|
||||
return taproot.NewBaseTapElementsLeaf(branchScript)
|
||||
@@ -164,33 +163,34 @@ func buildCongestionTree(
|
||||
net *network.Network,
|
||||
aspPublicKey *secp256k1.PublicKey,
|
||||
receivers []domain.Receiver,
|
||||
) (pluggableTree pluggableCongestionTree, sharedOutputScript []byte, err error) {
|
||||
feeSatsPerNode uint64,
|
||||
) (pluggableTree pluggableCongestionTree, sharedOutputScript []byte, sharedOutputAmount uint64, err error) {
|
||||
unspendableKeyBytes, err := hex.DecodeString(unspendablePoint)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
unspendableKey, err := secp256k1.ParsePubKey(unspendableKeyBytes)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
var nodes []*node
|
||||
|
||||
for _, r := range receivers {
|
||||
nodes = append(nodes, newLeaf(net, unspendableKey, aspPublicKey, r))
|
||||
nodes = append(nodes, newLeaf(net, unspendableKey, aspPublicKey, r, feeSatsPerNode))
|
||||
}
|
||||
|
||||
for len(nodes) > 1 {
|
||||
nodes, err = createTreeLevel(nodes)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
}
|
||||
|
||||
psets, err := nodes[0].psets(nil, 0)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
// find the root
|
||||
@@ -205,29 +205,28 @@ func buildCongestionTree(
|
||||
// compute the shared output script
|
||||
sweepLeaf, err := sweepTapLeaf(aspPublicKey)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
leftOutput := rootPset.Outputs[0]
|
||||
|
||||
leftWitnessProgram := leftOutput.Script[2:]
|
||||
leftKey, err := schnorr.ParsePubKey(leftWitnessProgram)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
var rightAmount uint32
|
||||
var rightAmount uint64
|
||||
var rightKey *secp256k1.PublicKey
|
||||
|
||||
if len(rootPset.Outputs) > 1 {
|
||||
rightAmount = uint32(rootPset.Outputs[1].Value)
|
||||
rightAmount = rootPset.Outputs[1].Value
|
||||
rightKey, err = schnorr.ParsePubKey(rootPset.Outputs[1].Script[2:])
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
}
|
||||
|
||||
goToTreeScript := forceSplitCoinTapLeaf(
|
||||
leftKey, rightKey, uint32(leftOutput.Value), rightAmount,
|
||||
leftKey, rightKey, leftOutput.Value, rightAmount,
|
||||
)
|
||||
|
||||
taprootTree := taproot.AssembleTaprootScriptTree(goToTreeScript, *sweepLeaf)
|
||||
@@ -235,7 +234,7 @@ func buildCongestionTree(
|
||||
taprootKey := taproot.ComputeTaprootOutputKey(unspendableKey, root[:])
|
||||
outputScript, err := taprootOutputScript(taprootKey)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
return func(outpoint psetv2.InputArgs) (domain.CongestionTree, error) {
|
||||
@@ -278,8 +277,9 @@ func buildCongestionTree(
|
||||
Leaf: psetWithLevel.leaf,
|
||||
})
|
||||
}
|
||||
|
||||
return tree, nil
|
||||
}, outputScript, nil
|
||||
}, outputScript, uint64(rightAmount) + leftOutput.Value + uint64(feeSatsPerNode), nil
|
||||
}
|
||||
|
||||
func createTreeLevel(nodes []*node) ([]*node, error) {
|
||||
@@ -308,6 +308,7 @@ type node struct {
|
||||
left *node
|
||||
right *node
|
||||
network *network.Network
|
||||
feeSats uint64
|
||||
|
||||
// cached values
|
||||
_taprootKey *secp256k1.PublicKey
|
||||
@@ -320,12 +321,14 @@ func newLeaf(
|
||||
internalKey *secp256k1.PublicKey,
|
||||
sweepKey *secp256k1.PublicKey,
|
||||
receiver domain.Receiver,
|
||||
feeSats uint64,
|
||||
) *node {
|
||||
return &node{
|
||||
sweepKey: sweepKey,
|
||||
internalTaprootKey: internalKey,
|
||||
receivers: []domain.Receiver{receiver},
|
||||
network: network,
|
||||
feeSats: feeSats,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,21 +344,53 @@ func newBranch(
|
||||
left: left,
|
||||
right: right,
|
||||
network: left.network,
|
||||
feeSats: left.feeSats,
|
||||
}
|
||||
}
|
||||
|
||||
func (n *node) isLeaf() bool {
|
||||
return n.left.isEmpty() && (n.right == nil || n.right.isEmpty())
|
||||
}
|
||||
|
||||
// is it the final node of the tree
|
||||
func (n *node) isLeaf() bool {
|
||||
return len(n.receivers) == 1
|
||||
func (n *node) isEmpty() bool {
|
||||
return n.left == nil && n.right == nil
|
||||
}
|
||||
|
||||
func (n *node) countChildren() int {
|
||||
if n.isEmpty() {
|
||||
return 0
|
||||
}
|
||||
|
||||
result := 0
|
||||
|
||||
if n.left != nil && !n.left.isEmpty() {
|
||||
result++
|
||||
result += n.left.countChildren()
|
||||
}
|
||||
|
||||
if n.right != nil && !n.right.isEmpty() {
|
||||
result++
|
||||
result += n.right.countChildren()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// compute the output amount of a node
|
||||
func (n *node) amount() uint32 {
|
||||
var amount uint32
|
||||
func (n *node) amount() uint64 {
|
||||
var amount uint64
|
||||
for _, r := range n.receivers {
|
||||
amount += uint32(r.Amount)
|
||||
amount += r.Amount
|
||||
}
|
||||
return amount
|
||||
if n.isEmpty() {
|
||||
return amount
|
||||
}
|
||||
|
||||
nb := uint64(n.countChildren())
|
||||
|
||||
return amount + (nb+1)*n.feeSats
|
||||
|
||||
}
|
||||
|
||||
func (n *node) taprootKey() (*secp256k1.PublicKey, *taproot.IndexedElementsTapScriptTree, error) {
|
||||
@@ -368,7 +403,7 @@ func (n *node) taprootKey() (*secp256k1.PublicKey, *taproot.IndexedElementsTapSc
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if n.isLeaf() {
|
||||
if n.isEmpty() {
|
||||
key, err := hex.DecodeString(n.receivers[0].Pubkey)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -379,13 +414,12 @@ func (n *node) taprootKey() (*secp256k1.PublicKey, *taproot.IndexedElementsTapSc
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
leafScript, err := checksigScript(pubkey)
|
||||
vtxoLeaf, err := common.VtxoScript(pubkey)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
leafTaprootLeaf := taproot.NewBaseTapElementsLeaf(leafScript)
|
||||
leafTaprootTree := taproot.AssembleTaprootScriptTree(leafTaprootLeaf, *sweepTaprootLeaf)
|
||||
leafTaprootTree := taproot.AssembleTaprootScriptTree(*vtxoLeaf, *sweepTaprootLeaf)
|
||||
root := leafTaprootTree.RootNode.TapHash()
|
||||
|
||||
taprootKey := taproot.ComputeTaprootOutputKey(
|
||||
@@ -437,7 +471,7 @@ func (n *node) script() ([]byte, error) {
|
||||
return taprootOutputScript(taprootKey)
|
||||
}
|
||||
|
||||
// use script & amount to create OutputArgs
|
||||
// use script & amount() to create OutputArgs
|
||||
func (n *node) output() (*psetv2.OutputArgs, error) {
|
||||
script, err := n.script()
|
||||
if err != nil {
|
||||
@@ -476,13 +510,18 @@ func (n *node) pset(args *psetArgs) (*psetv2.Pset, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if n.isLeaf() {
|
||||
feeOutput := psetv2.OutputArgs{
|
||||
Amount: uint64(n.feeSats),
|
||||
Asset: n.network.AssetID,
|
||||
}
|
||||
|
||||
if n.isEmpty() {
|
||||
output, err := n.output()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = updater.AddOutputs([]psetv2.OutputArgs{*output})
|
||||
err = updater.AddOutputs([]psetv2.OutputArgs{*output, feeOutput})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -499,7 +538,7 @@ func (n *node) pset(args *psetArgs) (*psetv2.Pset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = updater.AddOutputs([]psetv2.OutputArgs{*outputLeft, *outputRight})
|
||||
err = updater.AddOutputs([]psetv2.OutputArgs{*outputLeft, *outputRight, feeOutput})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -529,7 +568,11 @@ func (n *node) psets(inputArgs *psetArgs, level int) ([]psetWithLevel, error) {
|
||||
{pset, level, n.isLeaf()},
|
||||
}
|
||||
|
||||
if n.isLeaf() {
|
||||
if n.left.isEmpty() && (n.right == nil || n.right.isEmpty()) {
|
||||
return nodeResult, nil
|
||||
}
|
||||
|
||||
if n.isEmpty() {
|
||||
return nodeResult, nil
|
||||
}
|
||||
|
||||
@@ -540,7 +583,7 @@ func (n *node) psets(inputArgs *psetArgs, level int) ([]psetWithLevel, error) {
|
||||
|
||||
txID := unsignedTx.TxHash().String()
|
||||
|
||||
_, taprootTree, err := n.taprootKey()
|
||||
_, leftTaprootTree, err := n.left.taprootKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -550,18 +593,23 @@ func (n *node) psets(inputArgs *psetArgs, level int) ([]psetWithLevel, error) {
|
||||
Txid: txID,
|
||||
TxIndex: 0,
|
||||
},
|
||||
taprootTree: taprootTree,
|
||||
taprootTree: leftTaprootTree,
|
||||
}, level+1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, rightTaprootTree, err := n.right.taprootKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
psetsRight, err := n.right.psets(&psetArgs{
|
||||
input: psetv2.InputArgs{
|
||||
Txid: txID,
|
||||
TxIndex: 1,
|
||||
},
|
||||
taprootTree: taprootTree,
|
||||
taprootTree: rightTaprootTree,
|
||||
}, level+1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -91,6 +91,7 @@ func (b *txBuilder) BuildForfeitTxs(
|
||||
// BuildPoolTx implements ports.TxBuilder.
|
||||
func (b *txBuilder) BuildPoolTx(
|
||||
aspPubkey *secp256k1.PublicKey, wallet ports.WalletService, payments []domain.Payment,
|
||||
minRelayFee uint64,
|
||||
) (poolTx string, congestionTree domain.CongestionTree, err error) {
|
||||
aspScriptBytes, err := p2wpkhScript(aspPubkey, b.net)
|
||||
if err != nil {
|
||||
|
||||
@@ -238,7 +238,8 @@ func TestBuildCongestionTree(t *testing.T) {
|
||||
require.NotNil(t, key)
|
||||
|
||||
for _, f := range fixtures {
|
||||
poolTx, tree, err := builder.BuildPoolTx(key, &mockedWalletService{}, f.payments)
|
||||
poolTx, tree, err := builder.BuildPoolTx(key, &mockedWalletService{}, f.payments, 30)
|
||||
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, f.expectedNodesNum, tree.NumberOfNodes())
|
||||
require.Len(t, tree.Leaves(), f.expectedLeavesNum)
|
||||
|
||||
@@ -273,7 +273,8 @@ func (v vtxoList) toProto(hrp string, aspKey *secp256k1.PublicKey) []*arkv1.Vtxo
|
||||
Address: addr,
|
||||
Amount: vv.Amount,
|
||||
},
|
||||
Spent: vv.Spent,
|
||||
PoolTxid: vv.PoolTx,
|
||||
Spent: vv.Spent,
|
||||
})
|
||||
}
|
||||
return list
|
||||
|
||||
@@ -3,13 +3,24 @@ module github.com/ark-network/ark/common
|
||||
go 1.21.0
|
||||
|
||||
require (
|
||||
github.com/btcsuite/btcd v0.23.1
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2
|
||||
github.com/btcsuite/btcd/btcutil v1.1.3
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/stretchr/testify v1.8.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
|
||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect
|
||||
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
|
||||
golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
|
||||
github.com/vulpemventures/go-elements v0.5.1
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -2,14 +2,22 @@ github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBA
|
||||
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
|
||||
github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY=
|
||||
github.com/btcsuite/btcd v0.23.1 h1:IB8cVQcC2X5mHbnfirLG5IZnkWYNTPlLZVrxUYSotbE=
|
||||
github.com/btcsuite/btcd v0.23.1/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
|
||||
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
|
||||
github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE=
|
||||
github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ=
|
||||
github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0=
|
||||
github.com/btcsuite/btcd/btcutil/psbt v1.1.4 h1:Edx4AfBn+YPam2KP5AobDitulGp4r1Oibm8oruzkMdI=
|
||||
github.com/btcsuite/btcd/btcutil/psbt v1.1.4/go.mod h1:9AyU6EQVJ9Iw9zPyNT1lcdHd6cnEZdno5wLu5FY74os=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
|
||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
|
||||
@@ -24,6 +32,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
|
||||
github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=
|
||||
github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs=
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
|
||||
@@ -58,12 +68,23 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
|
||||
github.com/vulpemventures/fastsha256 v0.0.0-20160815193821-637e65642941 h1:CTcw80hz/Sw8hqlKX5ZYvBUF5gAHSHwdjXxRf/cjDcI=
|
||||
github.com/vulpemventures/fastsha256 v0.0.0-20160815193821-637e65642941/go.mod h1:GXBJykxW2kUcktGdsgyay7uwwWvkljASfljNcT0mbh8=
|
||||
github.com/vulpemventures/go-elements v0.5.1 h1:F83n7dScOnAnpyH9VgWLdC68Qcva+2EWVzzNuW2UKak=
|
||||
github.com/vulpemventures/go-elements v0.5.1/go.mod h1:aBGuWXHaiAIUIcwqCdtEh2iQ3kJjKwHU9ywvhlcRSeU=
|
||||
github.com/vulpemventures/go-secp256k1-zkp v1.1.6 h1:BmsrmXRLUibwa75Qkk8yELjpzCzlAjYFGLiLiOdq7Xo=
|
||||
github.com/vulpemventures/go-secp256k1-zkp v1.1.6/go.mod h1:zo7CpgkuPgoe7fAV+inyxsI9IhGmcoFgyD8nqZaPSOM=
|
||||
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM=
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
@@ -79,6 +100,8 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68 h1:z8Hj/bl9cOV2grsOpEaQFUaly0JWN3i97mo3jXKJNp0=
|
||||
golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
@@ -98,5 +121,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
23
common/tree.go
Normal file
23
common/tree.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
"github.com/vulpemventures/go-elements/taproot"
|
||||
)
|
||||
|
||||
func checksigScript(pubkey *secp256k1.PublicKey) ([]byte, error) {
|
||||
key := schnorr.SerializePubKey(pubkey)
|
||||
return txscript.NewScriptBuilder().AddData(key).AddOp(txscript.OP_CHECKSIG).Script()
|
||||
}
|
||||
|
||||
func VtxoScript(pubkey *secp256k1.PublicKey) (*taproot.TapElementsLeaf, error) {
|
||||
script, err := checksigScript(pubkey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tapLeaf := taproot.NewBaseTapElementsLeaf(script)
|
||||
return &tapLeaf, nil
|
||||
}
|
||||
@@ -10,9 +10,10 @@ import (
|
||||
)
|
||||
|
||||
type vtxo struct {
|
||||
amount uint64
|
||||
txid string
|
||||
vout uint32
|
||||
amount uint64
|
||||
txid string
|
||||
vout uint32
|
||||
poolTxid string
|
||||
}
|
||||
|
||||
func getVtxos(
|
||||
@@ -28,9 +29,10 @@ func getVtxos(
|
||||
vtxos := make([]vtxo, 0, len(response.Vtxos))
|
||||
for _, v := range response.Vtxos {
|
||||
vtxos = append(vtxos, vtxo{
|
||||
amount: v.Receiver.Amount,
|
||||
txid: v.Outpoint.Txid,
|
||||
vout: v.Outpoint.Vout,
|
||||
amount: v.Receiver.Amount,
|
||||
txid: v.Outpoint.Txid,
|
||||
vout: v.Outpoint.Vout,
|
||||
poolTxid: v.PoolTxid,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -170,42 +170,111 @@ func getOffchainBalance(
|
||||
return balance, nil
|
||||
}
|
||||
|
||||
func getOnchainBalance(addr string) (uint64, error) {
|
||||
type utxo struct {
|
||||
Txid string `json:"txid"`
|
||||
Vout uint32 `json:"vout"`
|
||||
Amount uint64 `json:"value"`
|
||||
Asset string `json:"asset"`
|
||||
}
|
||||
|
||||
func getOnchainUtxos(addr string) ([]utxo, error) {
|
||||
_, net, err := getNetwork()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
baseUrl := explorerUrl[net.Name]
|
||||
resp, err := http.Get(fmt.Sprintf("%s/address/%s/utxo", baseUrl, addr))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return nil, err
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return 0, fmt.Errorf(string(body))
|
||||
return nil, fmt.Errorf(string(body))
|
||||
}
|
||||
payload := []interface{}{}
|
||||
payload := []utxo{}
|
||||
if err := json.Unmarshal(body, &payload); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return payload, nil
|
||||
}
|
||||
|
||||
func getOnchainBalance(addr string) (uint64, error) {
|
||||
payload, err := getOnchainUtxos(addr)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
_, net, err := getNetwork()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
balance := uint64(0)
|
||||
for _, p := range payload {
|
||||
utxo := p.(map[string]interface{})
|
||||
asset, ok := utxo["asset"].(string)
|
||||
if !ok || asset != net.AssetID {
|
||||
if p.Asset != net.AssetID {
|
||||
continue
|
||||
}
|
||||
balance += uint64(utxo["value"].(float64))
|
||||
|
||||
balance += p.Amount
|
||||
}
|
||||
return balance, nil
|
||||
}
|
||||
|
||||
func getTxHex(txid string) (string, error) {
|
||||
_, net, err := getNetwork()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
baseUrl := explorerUrl[net.Name]
|
||||
resp, err := http.Get(fmt.Sprintf("%s/tx/%s/hex", baseUrl, txid))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return "", fmt.Errorf(string(body))
|
||||
}
|
||||
|
||||
return string(body), nil
|
||||
}
|
||||
|
||||
func broadcast(txHex string) (string, error) {
|
||||
_, net, err := getNetwork()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
body := bytes.NewBuffer([]byte(txHex))
|
||||
|
||||
baseUrl := explorerUrl[net.Name]
|
||||
resp, err := http.Post(fmt.Sprintf("%s/tx", baseUrl), "text/plain", body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
bodyResponse, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return "", fmt.Errorf(string(bodyResponse))
|
||||
}
|
||||
|
||||
return string(bodyResponse), nil
|
||||
}
|
||||
|
||||
func getNetwork() (*common.Network, *network.Network, error) {
|
||||
state, err := getState()
|
||||
if err != nil {
|
||||
|
||||
56
noah/explorer.go
Normal file
56
noah/explorer.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/vulpemventures/go-elements/transaction"
|
||||
)
|
||||
|
||||
type Explorer interface {
|
||||
GetTxHex(txid string) (string, error)
|
||||
Broadcast(txHex string) (string, error)
|
||||
}
|
||||
|
||||
type explorer struct {
|
||||
cache map[string]string
|
||||
}
|
||||
|
||||
func NewExplorer() Explorer {
|
||||
return &explorer{
|
||||
cache: make(map[string]string),
|
||||
}
|
||||
}
|
||||
|
||||
func (e *explorer) GetTxHex(txid string) (string, error) {
|
||||
if hex, ok := e.cache[txid]; ok {
|
||||
return hex, nil
|
||||
}
|
||||
|
||||
txHex, err := getTxHex(txid)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
e.cache[txid] = txHex
|
||||
|
||||
return txHex, nil
|
||||
}
|
||||
|
||||
func (e *explorer) Broadcast(txHex string) (string, error) {
|
||||
tx, err := transaction.NewTxFromHex(txHex)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
txid := tx.TxHash().String()
|
||||
e.cache[txid] = txHex
|
||||
|
||||
txid, err = broadcast(txHex)
|
||||
if err != nil {
|
||||
if strings.Contains(strings.ToLower(err.Error()), "transaction already in block chain") {
|
||||
return txid, nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
return txid, nil
|
||||
}
|
||||
@@ -9,6 +9,7 @@ replace github.com/ark-network/ark => ../asp
|
||||
require (
|
||||
github.com/ark-network/ark v0.0.0-00010101000000-000000000000
|
||||
github.com/ark-network/ark/common v0.0.0-00010101000000-000000000000
|
||||
github.com/btcsuite/btcd v0.23.4
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
|
||||
@@ -18,7 +19,6 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/btcsuite/btcd v0.23.4 // indirect
|
||||
github.com/btcsuite/btcd/btcutil/psbt v1.1.8 // indirect
|
||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect
|
||||
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
|
||||
@@ -31,7 +31,7 @@ require (
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/vulpemventures/go-elements v0.4.7
|
||||
github.com/vulpemventures/go-elements v0.5.1
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||
golang.org/x/net v0.19.0 // indirect
|
||||
golang.org/x/sys v0.15.0 // indirect
|
||||
|
||||
@@ -82,6 +82,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee h1:8Iv5m6xEo1NR1AvpV+7XmhI4r39LGNzwUL4YpMuL5vk=
|
||||
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
@@ -91,8 +93,8 @@ github.com/urfave/cli/v2 v2.26.0 h1:3f3AMg3HpThFNT4I++TKOejZO8yU55t3JnnSr4S4QEI=
|
||||
github.com/urfave/cli/v2 v2.26.0/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
|
||||
github.com/vulpemventures/fastsha256 v0.0.0-20160815193821-637e65642941 h1:CTcw80hz/Sw8hqlKX5ZYvBUF5gAHSHwdjXxRf/cjDcI=
|
||||
github.com/vulpemventures/fastsha256 v0.0.0-20160815193821-637e65642941/go.mod h1:GXBJykxW2kUcktGdsgyay7uwwWvkljASfljNcT0mbh8=
|
||||
github.com/vulpemventures/go-elements v0.4.7 h1:M5dtBHwRXqct75DJeEv5b0PUFS93t0gh2naJaGlvp60=
|
||||
github.com/vulpemventures/go-elements v0.4.7/go.mod h1:aBGuWXHaiAIUIcwqCdtEh2iQ3kJjKwHU9ywvhlcRSeU=
|
||||
github.com/vulpemventures/go-elements v0.5.1 h1:F83n7dScOnAnpyH9VgWLdC68Qcva+2EWVzzNuW2UKak=
|
||||
github.com/vulpemventures/go-elements v0.5.1/go.mod h1:aBGuWXHaiAIUIcwqCdtEh2iQ3kJjKwHU9ywvhlcRSeU=
|
||||
github.com/vulpemventures/go-secp256k1-zkp v1.1.6 h1:BmsrmXRLUibwa75Qkk8yELjpzCzlAjYFGLiLiOdq7Xo=
|
||||
github.com/vulpemventures/go-secp256k1-zkp v1.1.6/go.mod h1:zo7CpgkuPgoe7fAV+inyxsI9IhGmcoFgyD8nqZaPSOM=
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
|
||||
|
||||
215
noah/redeem.go
215
noah/redeem.go
@@ -1,8 +1,14 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
arkv1 "github.com/ark-network/ark/api-spec/protobuf/gen/ark/v1"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
@@ -66,7 +72,11 @@ func redeemAction(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
if force {
|
||||
return unilateralRedeem(addr)
|
||||
if amount > 0 {
|
||||
fmt.Printf("WARNING: unilateral exit (--force) ignores --amount flag, it will redeem all your VTXOs\n")
|
||||
}
|
||||
|
||||
return unilateralRedeem(ctx, addr)
|
||||
}
|
||||
|
||||
return collaborativeRedeem(ctx, addr, amount)
|
||||
@@ -217,7 +227,206 @@ func collaborativeRedeem(ctx *cli.Context, addr string, amount uint64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func unilateralRedeem(address string) error {
|
||||
fmt.Println("unilateral redeem is not implemented yet")
|
||||
func unilateralRedeem(ctx *cli.Context, addr string) error {
|
||||
onchainScript, err := address.ToOutputScript(addr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
client, close, err := getClientFromState(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer close()
|
||||
|
||||
offchainAddr, _, err := getAddress()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
vtxos, err := getVtxos(ctx, client, offchainAddr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
totalVtxosAmount := uint64(0)
|
||||
|
||||
for _, vtxo := range vtxos {
|
||||
totalVtxosAmount += vtxo.amount
|
||||
}
|
||||
|
||||
ok := askForConfirmation(fmt.Sprintf("redeem %d sats to %s ?", totalVtxosAmount, addr))
|
||||
if !ok {
|
||||
return fmt.Errorf("aborting unilateral exit")
|
||||
}
|
||||
|
||||
finalPset, err := psetv2.New(nil, nil, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
updater, err := psetv2.NewUpdater(finalPset)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
congestionTrees := make(map[string]*arkv1.Tree, 0)
|
||||
transactionsMap := make(map[string]struct{}, 0)
|
||||
transactions := make([]string, 0)
|
||||
|
||||
for _, vtxo := range vtxos {
|
||||
if _, ok := congestionTrees[vtxo.poolTxid]; !ok {
|
||||
round, err := client.GetRound(ctx.Context, &arkv1.GetRoundRequest{
|
||||
Txid: vtxo.poolTxid,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
congestionTrees[vtxo.poolTxid] = round.GetRound().GetCongestionTree()
|
||||
}
|
||||
|
||||
redeemBranch, err := newRedeemBranch(ctx, congestionTrees[vtxo.poolTxid], vtxo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := redeemBranch.UpdatePath(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
branchTxs, err := redeemBranch.RedeemPath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := redeemBranch.AddVtxoInput(updater); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, txHex := range branchTxs {
|
||||
if _, ok := transactionsMap[txHex]; !ok {
|
||||
transactions = append(transactions, txHex)
|
||||
transactionsMap[txHex] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_, net, err := getNetwork()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
outputs := []psetv2.OutputArgs{
|
||||
{
|
||||
Asset: net.AssetID,
|
||||
Amount: totalVtxosAmount,
|
||||
Script: onchainScript,
|
||||
},
|
||||
}
|
||||
|
||||
if err := updater.AddOutputs(outputs); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
utx, err := updater.Pset.UnsignedTx()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
vBytes := utx.VirtualSize()
|
||||
feeAmount := uint64(math.Ceil(float64(vBytes) * 0.2))
|
||||
|
||||
if totalVtxosAmount-feeAmount <= 0 {
|
||||
return fmt.Errorf("not enough VTXOs to pay the fees (%d sats), aborting unilateral exit", feeAmount)
|
||||
}
|
||||
|
||||
updater.Pset.Outputs[0].Value = totalVtxosAmount - feeAmount
|
||||
|
||||
if err := updater.AddOutputs([]psetv2.OutputArgs{
|
||||
{
|
||||
Asset: net.AssetID,
|
||||
Amount: feeAmount,
|
||||
},
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
prvKey, err := privateKeyFromPassword()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
explorer := NewExplorer()
|
||||
|
||||
for i, txHex := range transactions {
|
||||
for {
|
||||
txid, err := explorer.Broadcast(txHex)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "bad-txns-inputs-missingorspent") {
|
||||
time.Sleep(1 * time.Second)
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(txid) > 0 {
|
||||
fmt.Printf("(%d/%d) broadcasted tx %s\n", i+1, len(transactions), txid)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := signPset(finalPset, explorer, prvKey); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i, input := range finalPset.Inputs {
|
||||
if len(input.TapScriptSig) > 0 || len(input.PartialSigs) > 0 {
|
||||
if err := psetv2.Finalize(finalPset, i); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signedTx, err := psetv2.Extract(finalPset)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
hex, err := signedTx.ToHex()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
id, err := explorer.Broadcast(hex)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("(final) redeem tx %s\n", id)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// askForConfirmation asks the user for confirmation. A user must type in "yes" or "no" and then press enter.
|
||||
// if the input is not recognized, it will ask again.
|
||||
func askForConfirmation(s string) bool {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
|
||||
for {
|
||||
fmt.Printf("%s [y/n]: ", s)
|
||||
|
||||
response, err := reader.ReadString('\n')
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
response = strings.ToLower(strings.TrimSpace(response))
|
||||
|
||||
if response == "y" || response == "yes" {
|
||||
return true
|
||||
} else if response == "n" || response == "no" {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,6 +240,7 @@ func ping(ctx *cli.Context, client arkv1.ArkServiceClient, req *arkv1.PingReques
|
||||
|
||||
go func(t *time.Ticker) {
|
||||
for range t.C {
|
||||
// nolint
|
||||
client.Ping(ctx.Context, req)
|
||||
}
|
||||
}(ticker)
|
||||
|
||||
199
noah/signer.go
Normal file
199
noah/signer.go
Normal file
@@ -0,0 +1,199 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/ark-network/ark/common"
|
||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
"github.com/vulpemventures/go-elements/address"
|
||||
"github.com/vulpemventures/go-elements/payment"
|
||||
"github.com/vulpemventures/go-elements/psetv2"
|
||||
"github.com/vulpemventures/go-elements/transaction"
|
||||
)
|
||||
|
||||
func signPset(
|
||||
pset *psetv2.Pset,
|
||||
explorer Explorer,
|
||||
prvKey *secp256k1.PrivateKey,
|
||||
) error {
|
||||
updater, err := psetv2.NewUpdater(pset)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i, input := range pset.Inputs {
|
||||
if input.WitnessUtxo != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
prevoutTxHex, err := explorer.GetTxHex(chainhash.Hash(input.PreviousTxid).String())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
prevoutTx, err := transaction.NewTxFromHex(prevoutTxHex)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
utxo := prevoutTx.Outputs[input.PreviousTxIndex]
|
||||
if utxo == nil {
|
||||
return fmt.Errorf("witness utxo not found")
|
||||
}
|
||||
|
||||
if err := updater.AddInWitnessUtxo(i, utxo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sighashType := txscript.SigHashAll
|
||||
|
||||
if utxo.Script[0] == txscript.OP_1 {
|
||||
sighashType = txscript.SigHashDefault
|
||||
}
|
||||
|
||||
if err := updater.AddInSighashType(i, sighashType); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
signer, err := psetv2.NewSigner(updater.Pset)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, onchainAddr, err := getAddress()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
onchainWalletScript, err := address.ToOutputScript(onchainAddr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
utx, err := pset.UnsignedTx()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, liquidNet, err := getNetwork()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
prevoutsScripts := make([][]byte, 0)
|
||||
prevoutsValues := make([][]byte, 0)
|
||||
prevoutsAssets := make([][]byte, 0)
|
||||
|
||||
for _, input := range pset.Inputs {
|
||||
prevoutsScripts = append(prevoutsScripts, input.WitnessUtxo.Script)
|
||||
prevoutsValues = append(prevoutsValues, input.WitnessUtxo.Value)
|
||||
prevoutsAssets = append(prevoutsAssets, input.WitnessUtxo.Asset)
|
||||
}
|
||||
|
||||
for i, input := range pset.Inputs {
|
||||
if bytes.Equal(input.WitnessUtxo.Script, onchainWalletScript) {
|
||||
p, err := payment.FromScript(input.WitnessUtxo.Script, liquidNet, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
preimage := utx.HashForWitnessV0(
|
||||
i,
|
||||
p.Script,
|
||||
input.WitnessUtxo.Value,
|
||||
txscript.SigHashAll,
|
||||
)
|
||||
|
||||
sig := ecdsa.Sign(
|
||||
prvKey,
|
||||
preimage[:],
|
||||
)
|
||||
|
||||
signatureWithSighashType := append(sig.Serialize(), byte(txscript.SigHashAll))
|
||||
|
||||
err = signer.SignInput(i, signatureWithSighashType, prvKey.PubKey().SerializeCompressed(), nil, nil)
|
||||
if err != nil {
|
||||
fmt.Println("error signing input: ", err)
|
||||
return err
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
pubkey, err := getWalletPublicKey()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
vtxoLeaf, err := common.VtxoScript(pubkey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(input.TapLeafScript) > 0 {
|
||||
genesis, err := chainhash.NewHashFromStr(liquidNet.GenesisBlockHash)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, leaf := range input.TapLeafScript {
|
||||
if bytes.Equal(leaf.Script, vtxoLeaf.Script) {
|
||||
hash := leaf.TapHash()
|
||||
|
||||
preimage := utx.HashForWitnessV1(
|
||||
i,
|
||||
prevoutsScripts,
|
||||
prevoutsAssets,
|
||||
prevoutsValues,
|
||||
txscript.SigHashDefault,
|
||||
genesis,
|
||||
&hash,
|
||||
nil,
|
||||
)
|
||||
|
||||
sig, err := schnorr.Sign(
|
||||
prvKey,
|
||||
preimage[:],
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tapScriptSig := psetv2.TapScriptSig{
|
||||
PartialSig: psetv2.PartialSig{
|
||||
PubKey: schnorr.SerializePubKey(prvKey.PubKey()),
|
||||
Signature: sig.Serialize(),
|
||||
},
|
||||
LeafHash: hash.CloneBytes(),
|
||||
}
|
||||
|
||||
if err := signer.SignTaprootInputTapscriptSig(i, tapScriptSig); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for i, input := range pset.Inputs {
|
||||
if len(input.PartialSigs) > 0 {
|
||||
valid, err := pset.ValidateInputSignatures(i)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !valid {
|
||||
return fmt.Errorf("invalid signature for input %d", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
237
noah/unilateral_redeem.go
Normal file
237
noah/unilateral_redeem.go
Normal file
@@ -0,0 +1,237 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
arkv1 "github.com/ark-network/ark/api-spec/protobuf/gen/ark/v1"
|
||||
"github.com/ark-network/ark/common"
|
||||
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/vulpemventures/go-elements/psetv2"
|
||||
"github.com/vulpemventures/go-elements/taproot"
|
||||
)
|
||||
|
||||
type RedeemBranch interface {
|
||||
// UpdatePath checks for transactions of the branch onchain and updates the branch accordingly
|
||||
UpdatePath() error
|
||||
// Redeem will sign the branch of the tree and return the associated signed pset + the vtxo input
|
||||
RedeemPath() ([]string, error)
|
||||
// AddInput adds the vtxo input created by the branch
|
||||
AddVtxoInput(updater *psetv2.Updater) error
|
||||
}
|
||||
|
||||
type redeemBranch struct {
|
||||
vtxo *vtxo
|
||||
branch []*psetv2.Pset
|
||||
sweepTapLeaf *taproot.TapElementsLeaf
|
||||
internalKey *secp256k1.PublicKey
|
||||
}
|
||||
|
||||
func newRedeemBranch(ctx *cli.Context, tree *arkv1.Tree, vtxo vtxo) (RedeemBranch, error) {
|
||||
for _, level := range tree.Levels {
|
||||
for _, node := range level.Nodes {
|
||||
if node.Txid == vtxo.txid {
|
||||
nodes, err := findParents([]*arkv1.Node{node}, tree)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
branch := make([]*psetv2.Pset, 0, len(nodes))
|
||||
for _, node := range nodes {
|
||||
pset, err := psetv2.NewPsetFromBase64(node.Tx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
branch = append(branch, pset)
|
||||
}
|
||||
|
||||
// find sweep tap leaf
|
||||
sweepTapLeaf, err := findSweepLeafScript(branch[0].Inputs[0].TapLeafScript)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
xOnlyKey := branch[0].Inputs[0].TapInternalKey
|
||||
internalKey, err := schnorr.ParsePubKey(xOnlyKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &redeemBranch{
|
||||
vtxo: &vtxo,
|
||||
branch: branch,
|
||||
sweepTapLeaf: sweepTapLeaf,
|
||||
internalKey: internalKey,
|
||||
}, nil
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("vtxo not found")
|
||||
}
|
||||
|
||||
// UpdatePath checks for transactions of the branch onchain and updates the branch accordingly
|
||||
func (r *redeemBranch) UpdatePath() error {
|
||||
for i := len(r.branch) - 1; i >= 0; i-- {
|
||||
pset := r.branch[i]
|
||||
unsignedTx, err := pset.UnsignedTx()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
txHash := unsignedTx.TxHash().String()
|
||||
|
||||
_, err = getTxHex(txHash)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// if no error, the tx exists onchain, so we can remove it (+ the parents) from the branch
|
||||
if i == len(r.branch)-1 {
|
||||
r.branch = []*psetv2.Pset{}
|
||||
} else {
|
||||
r.branch = r.branch[i+1:]
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RedeemPath returns the list of transactions to broadcast in order to access the vtxo output
|
||||
func (r *redeemBranch) RedeemPath() ([]string, error) {
|
||||
transactions := make([]string, 0, len(r.branch))
|
||||
|
||||
for _, pset := range r.branch {
|
||||
for i, input := range pset.Inputs {
|
||||
if len(input.TapLeafScript) == 0 {
|
||||
return nil, fmt.Errorf("tap leaf script not found on input #%d", i)
|
||||
}
|
||||
|
||||
sweepTapLeafScript := r.sweepTapLeaf.Script
|
||||
|
||||
for _, leaf := range input.TapLeafScript {
|
||||
if bytes.Equal(leaf.Script, sweepTapLeafScript) {
|
||||
continue
|
||||
}
|
||||
|
||||
controlBlock, err := leaf.ControlBlock.ToBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
unsignedTx, err := pset.UnsignedTx()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
unsignedTx.Inputs[i].Witness = [][]byte{
|
||||
leaf.Script,
|
||||
controlBlock[:],
|
||||
}
|
||||
|
||||
hex, err := unsignedTx.ToHex()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
transactions = append(transactions, hex)
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return transactions, nil
|
||||
}
|
||||
|
||||
// AddVtxoInput is a wrapper around psetv2.Updater adding a taproot input letting to spend the vtxo output
|
||||
func (r *redeemBranch) AddVtxoInput(updater *psetv2.Updater) error {
|
||||
walletPubkey, err := getWalletPublicKey()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
nextInputIndex := len(updater.Pset.Inputs)
|
||||
if err := updater.AddInputs([]psetv2.InputArgs{
|
||||
{
|
||||
Txid: r.vtxo.txid,
|
||||
TxIndex: r.vtxo.vout,
|
||||
},
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// add taproot tree letting to spend the vtxo
|
||||
checksigLeaf, err := common.VtxoScript(walletPubkey)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
vtxoTaprootTree := taproot.AssembleTaprootScriptTree(
|
||||
*checksigLeaf,
|
||||
*r.sweepTapLeaf,
|
||||
)
|
||||
|
||||
proofIndex := vtxoTaprootTree.LeafProofIndex[checksigLeaf.TapHash()]
|
||||
|
||||
if err := updater.AddInTapLeafScript(
|
||||
nextInputIndex,
|
||||
psetv2.NewTapLeafScript(
|
||||
vtxoTaprootTree.LeafMerkleProofs[proofIndex],
|
||||
r.internalKey,
|
||||
),
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// findParents is a recursive function that finds all the parents of a VTXO in a congestion tree
|
||||
// it returns the branch of the tree letting to redeem the VTXO (from pool tx to leaf)
|
||||
func findParents(ls []*arkv1.Node, tree *arkv1.Tree) ([]*arkv1.Node, error) {
|
||||
if len(ls) == 0 {
|
||||
return nil, fmt.Errorf("empty list")
|
||||
}
|
||||
|
||||
for levelIndex, level := range tree.Levels {
|
||||
for _, node := range level.Nodes {
|
||||
if node.Txid == ls[0].ParentTxid {
|
||||
newTree := &arkv1.Tree{
|
||||
Levels: tree.Levels[:levelIndex],
|
||||
}
|
||||
|
||||
newList := append([]*arkv1.Node{node}, ls...)
|
||||
if len(newTree.Levels) > 0 {
|
||||
return findParents(newList, newTree)
|
||||
}
|
||||
|
||||
return newList, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("parent not found")
|
||||
}
|
||||
|
||||
// findSweepLeafScript finds the sweep leaf in a set of tap leaf scripts
|
||||
func findSweepLeafScript(leaves []psetv2.TapLeafScript) (*taproot.TapElementsLeaf, error) {
|
||||
for _, leaf := range leaves {
|
||||
if len(leaf.Script) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
if bytes.Contains(leaf.Script, []byte{txscript.OP_CHECKSIG}) && bytes.Contains(leaf.Script, []byte{txscript.OP_CHECKSEQUENCEVERIFY}) {
|
||||
tapLeaf := taproot.NewBaseTapElementsLeaf(leaf.Script)
|
||||
return &tapLeaf, nil
|
||||
}
|
||||
|
||||
}
|
||||
return nil, fmt.Errorf("sweep leaf not found")
|
||||
}
|
||||
Reference in New Issue
Block a user