haveno-ts/config/grpc.proto
2021-11-20 16:25:15 -05:00

602 lines
15 KiB
Protocol Buffer

/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
syntax = "proto3";
package io.bisq.protobuffer;
import "pb.proto";
option java_package = "bisq.proto.grpc";
option java_multiple_files = true;
///////////////////////////////////////////////////////////////////////////////////////////
// DisputeAgents
///////////////////////////////////////////////////////////////////////////////////////////
service DisputeAgents {
rpc RegisterDisputeAgent (RegisterDisputeAgentRequest) returns (RegisterDisputeAgentReply) {
}
}
message RegisterDisputeAgentRequest {
string dispute_agent_type = 1;
string registration_key = 2;
}
message RegisterDisputeAgentReply {
}
///////////////////////////////////////////////////////////////////////////////////////////
// Help
///////////////////////////////////////////////////////////////////////////////////////////
service Help {
rpc GetMethodHelp (GetMethodHelpRequest) returns (GetMethodHelpReply) {
}
}
message GetMethodHelpRequest {
string method_name = 1;
}
message GetMethodHelpReply {
string method_help = 1;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Offers
///////////////////////////////////////////////////////////////////////////////////////////
service Offers {
rpc GetOffer (GetOfferRequest) returns (GetOfferReply) {
}
rpc GetMyOffer (GetMyOfferRequest) returns (GetMyOfferReply) {
}
rpc GetOffers (GetOffersRequest) returns (GetOffersReply) {
}
rpc GetMyOffers (GetMyOffersRequest) returns (GetMyOffersReply) {
}
rpc CreateOffer (CreateOfferRequest) returns (CreateOfferReply) {
}
rpc CancelOffer (CancelOfferRequest) returns (CancelOfferReply) {
}
}
message GetOfferRequest {
string id = 1;
}
message GetOfferReply {
OfferInfo offer = 1;
}
message GetMyOfferRequest {
string id = 1;
}
message GetMyOfferReply {
OfferInfo offer = 1;
}
message GetOffersRequest {
string direction = 1;
string currency_code = 2;
}
message GetOffersReply {
repeated OfferInfo offers = 1;
}
message GetMyOffersRequest {
string direction = 1;
string currency_code = 2;
}
message GetMyOffersReply {
repeated OfferInfo offers = 1;
}
message CreateOfferRequest {
string currency_code = 1;
string direction = 2;
string price = 3;
bool use_market_based_price = 4;
double market_price_margin = 5;
uint64 amount = 6 [jstype = JS_STRING];
uint64 min_amount = 7 [jstype = JS_STRING];
double buyer_security_deposit = 8;
uint64 trigger_price = 9 [jstype = JS_STRING];
string payment_account_id = 10;
}
message CreateOfferReply {
OfferInfo offer = 1;
}
message CancelOfferRequest {
string id = 1;
}
message CancelOfferReply {
}
message OfferInfo {
string id = 1;
string direction = 2;
uint64 price = 3;
bool use_market_based_price = 4;
double market_price_margin = 5;
uint64 amount = 6;
uint64 min_amount = 7;
uint64 volume = 8;
uint64 min_volume = 9;
uint64 buyer_security_deposit = 10;
uint64 trigger_price = 11;
string payment_account_id = 12;
string payment_method_id = 13;
string payment_method_short_name = 14;
string base_currency_code = 15;
string counter_currency_code = 16;
uint64 date = 17;
string state = 18;
uint64 seller_security_deposit = 19;
string offer_fee_payment_tx_id = 20;
uint64 tx_fee = 21;
uint64 maker_fee = 22;
}
message AvailabilityResultWithDescription {
AvailabilityResult availability_result = 1;
string description = 2;
}
///////////////////////////////////////////////////////////////////////////////////////////
// PaymentAccounts
///////////////////////////////////////////////////////////////////////////////////////////
service PaymentAccounts {
rpc CreatePaymentAccount (CreatePaymentAccountRequest) returns (CreatePaymentAccountReply) {
}
rpc GetPaymentAccounts (GetPaymentAccountsRequest) returns (GetPaymentAccountsReply) {
}
rpc GetPaymentMethods (GetPaymentMethodsRequest) returns (GetPaymentMethodsReply) {
}
rpc GetPaymentAccountForm (GetPaymentAccountFormRequest) returns (GetPaymentAccountFormReply) {
}
rpc CreateCryptoCurrencyPaymentAccount (CreateCryptoCurrencyPaymentAccountRequest) returns (CreateCryptoCurrencyPaymentAccountReply) {
}
rpc GetCryptoCurrencyPaymentMethods (GetCryptoCurrencyPaymentMethodsRequest) returns (GetCryptoCurrencyPaymentMethodsReply) {
}
}
message CreatePaymentAccountRequest {
string payment_account_form = 1;
}
message CreatePaymentAccountReply {
PaymentAccount payment_account = 1;
}
message GetPaymentAccountsRequest {
}
message GetPaymentAccountsReply {
repeated PaymentAccount payment_accounts = 1;
}
message GetPaymentMethodsRequest {
}
message GetPaymentMethodsReply {
repeated PaymentMethod payment_methods = 1;
}
message GetPaymentAccountFormRequest {
string payment_method_id = 1;
}
message GetPaymentAccountFormReply {
string payment_account_form_json = 1;
}
message CreateCryptoCurrencyPaymentAccountRequest {
string account_name = 1;
string currency_code = 2;
string address = 3;
bool trade_instant = 4;
}
message CreateCryptoCurrencyPaymentAccountReply {
PaymentAccount payment_account = 1;
}
message GetCryptoCurrencyPaymentMethodsRequest {
}
message GetCryptoCurrencyPaymentMethodsReply {
repeated PaymentMethod payment_methods = 1;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Price
///////////////////////////////////////////////////////////////////////////////////////////
service Price {
rpc GetMarketPrice (MarketPriceRequest) returns (MarketPriceReply) {
}
}
message MarketPriceRequest {
string currency_code = 1;
}
message MarketPriceReply {
double price = 1;
}
///////////////////////////////////////////////////////////////////////////////////////////
// GetTradeStatistics
///////////////////////////////////////////////////////////////////////////////////////////
service GetTradeStatistics {
rpc GetTradeStatistics (GetTradeStatisticsRequest) returns (GetTradeStatisticsReply) {
}
}
message GetTradeStatisticsRequest {
}
message GetTradeStatisticsReply {
repeated TradeStatistics3 trade_statistics = 1;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Shutdown
///////////////////////////////////////////////////////////////////////////////////////////
service ShutdownServer {
rpc Stop (StopRequest) returns (StopReply) {
}
}
message StopRequest {
}
message StopReply {
}
///////////////////////////////////////////////////////////////////////////////////////////
// Trades
///////////////////////////////////////////////////////////////////////////////////////////
service Trades {
rpc GetTrade (GetTradeRequest) returns (GetTradeReply) {
}
rpc TakeOffer (TakeOfferRequest) returns (TakeOfferReply) {
}
rpc ConfirmPaymentStarted (ConfirmPaymentStartedRequest) returns (ConfirmPaymentStartedReply) {
}
rpc ConfirmPaymentReceived (ConfirmPaymentReceivedRequest) returns (ConfirmPaymentReceivedReply) {
}
rpc KeepFunds (KeepFundsRequest) returns (KeepFundsReply) {
}
rpc WithdrawFunds (WithdrawFundsRequest) returns (WithdrawFundsReply) {
}
}
message TakeOfferRequest {
string offer_id = 1;
string payment_account_id = 2;
}
message TakeOfferReply {
TradeInfo trade = 1;
AvailabilityResultWithDescription failure_reason = 2;
}
message ConfirmPaymentStartedRequest {
string trade_id = 1;
}
message ConfirmPaymentStartedReply {
}
message ConfirmPaymentReceivedRequest {
string trade_id = 1;
}
message ConfirmPaymentReceivedReply {
}
message GetTradeRequest {
string trade_id = 1;
}
message GetTradeReply {
TradeInfo trade = 1;
}
message KeepFundsRequest {
string trade_id = 1;
}
message KeepFundsReply {
}
message WithdrawFundsRequest {
string trade_id = 1;
string address = 2;
string memo = 3;
}
message WithdrawFundsReply {
}
message TradeInfo {
OfferInfo offer = 1;
string trade_id = 2;
string short_id = 3;
uint64 date = 4;
string role = 5;
uint64 tx_fee_as_long = 7;
uint64 taker_fee_as_long = 8;
string taker_fee_tx_id = 9;
reserved 10; // was depositTxId
string payout_tx_id = 11;
uint64 trade_amount_as_long = 12;
uint64 trade_price = 13;
string trading_peer_node_address = 14;
string state = 15;
string phase = 16;
string trade_period_state = 17;
bool is_deposit_published = 18;
bool is_deposit_confirmed = 19;
bool is_fiat_sent = 20;
bool is_fiat_received = 21;
bool is_payout_published = 22;
bool is_withdrawn = 23;
string contract_as_json = 24;
ContractInfo contract = 25;
string maker_deposit_tx_id = 100;
string taker_deposit_tx_id = 101;
}
message ContractInfo {
string buyer_node_address = 1;
string seller_node_address = 2;
reserved 3; // was mediator_node_address
reserved 4; // was refund_agent_node_address
bool is_buyer_maker_and_seller_taker = 5;
string maker_account_id = 6;
string taker_account_id = 7;
PaymentAccountPayloadInfo maker_payment_account_payload = 8;
PaymentAccountPayloadInfo taker_payment_account_payload = 9;
string maker_payout_address_string = 10;
string taker_payout_address_string = 11;
uint64 lock_time = 12;
string arbitrator_node_address = 100;
}
message PaymentAccountPayloadInfo {
string id = 1;
string payment_method_id = 2;
string address = 3;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Transactions
///////////////////////////////////////////////////////////////////////////////////////////
message TxFeeRateInfo {
bool use_custom_tx_fee_rate = 1;
uint64 custom_tx_fee_rate = 2;
uint64 fee_service_rate = 3;
uint64 last_fee_service_request_ts = 4;
uint64 min_fee_service_rate = 5;
}
message TxInfo {
string tx_id = 1;
uint64 input_sum = 2;
uint64 output_sum = 3;
uint64 fee = 4;
int32 size = 5;
bool is_pending = 6;
string memo = 7;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Wallets
///////////////////////////////////////////////////////////////////////////////////////////
service Wallets {
rpc GetBalances (GetBalancesRequest) returns (GetBalancesReply) {
}
rpc GetNewDepositSubaddress (GetNewDepositSubaddressRequest) returns (GetNewDepositSubaddressReply) {
}
rpc GetAddressBalance (GetAddressBalanceRequest) returns (GetAddressBalanceReply) {
}
rpc SendBtc (SendBtcRequest) returns (SendBtcReply) {
}
rpc GetTxFeeRate (GetTxFeeRateRequest) returns (GetTxFeeRateReply) {
}
rpc SetTxFeeRatePreference (SetTxFeeRatePreferenceRequest) returns (SetTxFeeRatePreferenceReply) {
}
rpc UnsetTxFeeRatePreference (UnsetTxFeeRatePreferenceRequest) returns (UnsetTxFeeRatePreferenceReply) {
}
rpc GetTransaction (GetTransactionRequest) returns (GetTransactionReply) {
}
rpc GetFundingAddresses (GetFundingAddressesRequest) returns (GetFundingAddressesReply) {
}
rpc SetWalletPassword (SetWalletPasswordRequest) returns (SetWalletPasswordReply) {
}
rpc RemoveWalletPassword (RemoveWalletPasswordRequest) returns (RemoveWalletPasswordReply) {
}
rpc LockWallet (LockWalletRequest) returns (LockWalletReply) {
}
rpc UnlockWallet (UnlockWalletRequest) returns (UnlockWalletReply) {
}
}
message GetBalancesRequest {
string currency_code = 1;
}
message GetBalancesReply {
BalancesInfo balances = 1;
}
message GetNewDepositSubaddressRequest {
}
message GetNewDepositSubaddressReply {
string subaddress = 1;
}
message GetAddressBalanceRequest {
string address = 1;
}
message GetAddressBalanceReply {
AddressBalanceInfo address_balance_info = 1;
}
message SendBtcRequest {
string address = 1;
string amount = 2;
string tx_fee_rate = 3;
string memo = 4;
}
message SendBtcReply {
TxInfo tx_info = 1;
}
message GetTxFeeRateRequest {
}
message GetTxFeeRateReply {
TxFeeRateInfo tx_fee_rate_info = 1;
}
message SetTxFeeRatePreferenceRequest {
uint64 tx_fee_rate_preference = 1;
}
message SetTxFeeRatePreferenceReply {
TxFeeRateInfo tx_fee_rate_info = 1;
}
message UnsetTxFeeRatePreferenceRequest {
}
message UnsetTxFeeRatePreferenceReply {
TxFeeRateInfo tx_fee_rate_info = 1;
}
message GetTransactionRequest {
string tx_id = 1;
}
message GetTransactionReply {
TxInfo tx_info = 1;
}
message GetFundingAddressesRequest {
}
message GetFundingAddressesReply {
repeated AddressBalanceInfo address_balance_info = 1;
}
message SetWalletPasswordRequest {
string password = 1;
string new_password = 2;
}
message SetWalletPasswordReply {
}
message RemoveWalletPasswordRequest {
string password = 1;
}
message RemoveWalletPasswordReply {
}
message LockWalletRequest {
}
message LockWalletReply {
}
message UnlockWalletRequest {
string password = 1;
uint64 timeout = 2;
}
message UnlockWalletReply {
}
message BalancesInfo {
// Field names are shortened for readability's sake, i.e.,
// balancesInfo.getBtc().getAvailableBalance() is cleaner than
// balancesInfo.getBtcBalanceInfo().getAvailableBalance().
BtcBalanceInfo btc = 1;
XmrBalanceInfo xmr = 2;
}
message BtcBalanceInfo {
uint64 available_balance = 1;
uint64 reserved_balance = 2;
uint64 total_available_balance = 3;
uint64 locked_balance = 4;
}
message XmrBalanceInfo {
uint64 balance = 1 [jstype = JS_STRING];
uint64 unlocked_balance = 2 [jstype = JS_STRING];
uint64 locked_balance = 3 [jstype = JS_STRING];
uint64 reserved_offer_balance = 4 [jstype = JS_STRING];
uint64 reserved_trade_balance = 5 [jstype = JS_STRING];
}
message AddressBalanceInfo {
string address = 1;
int64 balance = 2;
int64 num_confirmations = 3;
bool is_address_unused = 4;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Version
///////////////////////////////////////////////////////////////////////////////////////////
service GetVersion {
rpc GetVersion (GetVersionRequest) returns (GetVersionReply) {
}
}
message GetVersionRequest {
}
message GetVersionReply {
string version = 1;
}