-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathpeerswaprpc.proto
190 lines (148 loc) · 4.19 KB
/
peerswaprpc.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
syntax = "proto3";
package peerswap;
option go_package = "github.com/elementsproject/peerswap/peerswaprpc";
service PeerSwap {
rpc SwapOut(SwapOutRequest) returns (SwapResponse);
rpc SwapIn(SwapInRequest) returns (SwapResponse);
rpc GetSwap(GetSwapRequest) returns (SwapResponse);
rpc ListSwaps(ListSwapsRequest) returns (ListSwapsResponse);
rpc ListPeers(ListPeersRequest) returns (ListPeersResponse);
rpc ListRequestedSwaps(ListRequestedSwapsRequest) returns (ListRequestedSwapsResponse);
rpc ListActiveSwaps(ListSwapsRequest) returns (ListSwapsResponse);
// policy
rpc AllowSwapRequests(AllowSwapRequestsRequest) returns (Policy);
rpc ReloadPolicyFile(ReloadPolicyFileRequest) returns (Policy);
rpc AddPeer(AddPeerRequest) returns (Policy);
rpc RemovePeer(RemovePeerRequest) returns (Policy);
rpc AddSusPeer(AddPeerRequest) returns (Policy);
rpc RemoveSusPeer(RemovePeerRequest) returns (Policy);
// Liquid Stuff
rpc LiquidGetAddress(GetAddressRequest) returns (GetAddressResponse);
rpc LiquidGetBalance(GetBalanceRequest) returns (GetBalanceResponse);
rpc LiquidSendToAddress(SendToAddressRequest) returns (SendToAddressResponse);
rpc Stop(Empty) returns (Empty);
}
message GetAddressRequest {}
message GetAddressResponse {
string address = 1;
}
message GetBalanceRequest {}
message GetBalanceResponse {
uint64 sat_amount = 1;
}
message SendToAddressRequest {
string address = 1;
uint64 sat_amount = 2;
}
message SendToAddressResponse {
string tx_id = 1;
}
message SwapOutRequest {
uint64 channel_id = 1;
uint64 swap_amount = 2;
string asset = 3;
bool force = 4;
}
message SwapOutResponse {
PrettyPrintSwap swap = 1;
}
message SwapInRequest {
uint64 channel_id = 1;
uint64 swap_amount = 2;
string asset = 3;
bool force = 4;
}
message SwapResponse {
PrettyPrintSwap swap = 1;
}
message GetSwapRequest {
string swap_id = 1;
}
message ListSwapsRequest {}
message ListSwapsResponse {
repeated PrettyPrintSwap swaps = 1;
}
message ListPeersRequest {}
message ListPeersResponse {
repeated PeerSwapPeer peers = 1;
}
message ReloadPolicyFileRequest {}
message AddPeerRequest {
string peer_pubkey = 1;
}
message RemovePeerRequest {
string peer_pubkey = 1;
}
message ListRequestedSwapsRequest {}
message ListRequestedSwapsResponse {
map<string, RequestSwapList> requested_swaps = 1;
}
message RequestSwapList {
repeated RequestedSwap requested_swaps = 1;
}
message RequestedSwap {
string asset = 1;
uint64 amount_sat = 2;
SwapType swap_type = 3;
string rejection_reason = 4;
enum SwapType {
SWAP_IN = 0;
SWAP_OUT = 1;
}
}
message PrettyPrintSwap {
string id = 1;
int64 created_at = 2;
string asset = 3;
string type = 4;
string role = 5;
string state = 6;
string initiator_node_id = 7;
string peer_node_id = 8;
uint64 amount = 9;
string channel_id = 10;;
string opening_tx_id = 11;
string claim_tx_id = 12;
string cancel_message = 13;
uint64 lnd_chan_id = 14;
}
message PeerSwapPeer {
string node_id = 1;
bool swaps_allowed = 2;
repeated string supported_assets = 3;
repeated PeerSwapPeerChannel channels = 4;
SwapStats as_sender = 5;
SwapStats as_receiver = 6;
uint64 paid_fee = 7;
}
message PeerSwapPeerChannel {
uint64 channel_id = 1;
uint64 local_balance = 2;
uint64 remote_balance = 3;
bool active = 5;
}
message SwapStats {
uint64 swaps_out = 1;
uint64 swaps_in = 2;
uint64 sats_out = 3;
uint64 sats_in = 4;
}
message PeerSwapNodes {
string node_id = 1;
}
message Policy {
uint64 reserve_onchain_msat = 1;
uint64 min_swap_amount_msat = 2;
bool accept_all_peers = 3;
bool allow_new_swaps = 4;
repeated string allowlisted_peers = 5;
repeated string suspicious_peer_list = 6;
}
message AllowSwapRequestsRequest {
bool allow = 1;
}
message AllowSwapRequestsResponse {
bool allow = 1;
}
message Empty {
}