<p></p>
<p>After implementing rpc wallet protection methods (<a href="https://github.com/bisq-network/bisq/issues/4198" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/4198/hovercard">ISSUE 4214</a> + <a href="https://github.com/bisq-network/bisq/pull/4214" data-hovercard-type="pull_request" data-hovercard-url="/bisq-network/bisq/pull/4214/hovercard">PR 4214</a>), we need a  minimum set of endpoints to enable trading from the gRPC API, and a bats script for test / demo purposes.</p>
<p>The goal of the set of PRs that will accompany this issue is to allow a user to perform all of the following functions with the gRPC API  (the UI should not be needed for any setup):</p>
<ul class="contains-task-list">
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> List BTC Receiving/Funding/Deposit Addresses<br>
[TODO Pick method name part Receiving || Funding || Deposit]<br>
[TODO combine this and two following tasks into a single task (method).]</p>
<p>Method Signature:      <code>listfundaddress ["addr"]</code></p>
<p>Show all receive/deposit/funding addresses, similar to  UI -> FUNDS -> RECEIVE FUNDS list box, or one receive/deposit/funding address.    Outputs array of BTC address, balance, # confirmations, usage ("Unused", "Used in N transaction(s)).</p>
<p>Analog to <a href="https://bitcoincore.org/en/doc/0.19.0/rpc/wallet/listreceivedbyaddress" rel="nofollow">listreceivedbyaddress</a></p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> List Used BTC Receiving Addresses</p>
<p>Method Signature:      <code>listfundaddress used</code></p>
<p>Show all used receive/deposit/funding addresses.</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> List Unused BTC Receiving Address</p>
<p>Method Signature:      <code>listfundaddress unused</code></p>
<p>Show zero or one unused receive/deposit/funding address.</p>
<p>See <code>DepositView</code> -> <code>walletService.getAvailableAddressEntries()...</code><br>
See <code>BtcWalletService</code> ->  <code>public List<AddressEntry> getAvailableAddressEntries()</code></p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Create New BTC Deposit Address</p>
<p>[TODO Pick method name part Receiving || Funding || Deposit]</p>
<p>Method Signature:      <code>newdepositaddress</code></p>
<p>If an unused receive address exists, show <code>funds.deposit.selectUnused</code> error message, plus the existing unused address.</p>
<p>See <code>DepositView</code> -> <code>newSavingsAddressEntry = walletService.getFreshAddressEntry()</code><br>
See <code>BtcWalletService</code> -> <code>public AddressEntry getFreshAddressEntry()</code></p>
<p>Analog to <a href="https://bitcoincore.org/en/doc/0.19.0/rpc/wallet/getnewaddress" rel="nofollow">getnewaddress</a></p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Fund a BTC wallet</p>
<p>No new method is needed to fund a wallet.  User sends BTC from an external wallet to a Bisq "Fund your wallet" address, then awaits confirmations.</p>
<p>Use Case:<br>
User sends BTC via <code>bitcoin-cli sendtoaddress "addr" amt</code><br>
User queries the status of the funding tx by calling <code>listfundaddress "addr"</code></p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Create a payment method</p>
<p>Method Signature:      <code>createpaymentacct acct-name paymentmethod acct-number currency</code></p>
<p>(The different payment methods will have different attributes, the above signature is specific to PerfectMoney)</p>
<p>In the interest in keeping it simple at this stage, the 1st impl can only create a "PerfectMoney dummy" account, mimicking the default payment method created by the UI when running Bisq in regtest / dev mode with the DAO setup used to test every new release.</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> List Offers</p>
<p>Method Signature:      <code>listoffers currency</code>    [all offers]<br>
Method Signature:       <code>listbuyoffers currency</code><br>
Method Signature:       <code>listselloffers currency</code></p>
<p>Output would display same info as UI's Offer Book, plus a unique identifier to be used in<br>
a <code>takeoffer</code> method.</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Create Offer</p>
<p>Method Signature:      <code>createoffer buy|sell [TBD]</code></p>
<p>BUY  Offer Parameters:  <code>payment-method  amt  currency  pct-from-mkt-price  min-amt [pct-sec-deposit]</code></p>
<p>SELL Offer Parameters:  <code>payment-method  amt  currency  pct-from-mkt-price  min-amt [pct-sec-deposit]</code></p>
<p><em>Note: there may be differences in the non-unique BUY/SELL offer params shown above (todo).</em></p>
<p>Offer details are cached in a CoreTradeService object, and user is shown review details + Toc, and<br>
the offer's unique identifier (analog to btc tx-id), or, an offer creation failure / rejection error message.</p>
<p>If the offer is valid, it can be broadcast using the unique id;  see Broadcast Offer.</p>
<p>Only one offer can be cached at a time.  Every new offer will override a previously cached offer.</p>
<p>Funding source defaults to Bisq wallet.<br>
Fee currency defaults to BTC.<br>
(Support for displaying Bsq balance and paying trade fee with Bsq not in scope.)</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Broadcast Offer  (Or Confirm Offer)</p>
<p>Method Signature:      <code>broadcastoffer offer-id</code>  OR  <code>confirmoffer offer-id</code></p>
<p>Confirm and broadcast a valid offer cached by <code>createoffer</code>.</p>
<p>Validates details of offer before broadcasting it, then displays success (with id) or fail reason message.</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Take Offer</p>
<p>Method Signature:      <code>takeoffer offer-id</code></p>
<p>After trade is funded, offer details are cached in the <code>CoreTradeService</code>, and user is shown review details + Toc, and the offer's unique identifier (analog to btc tx-id), or, an offer creation failure error message.</p>
<p>If the funded offer is valid, it can be broadcast using the unique id:  <code>confirmtakeoffer offer-id</code></p>
<p>Only one offer can be cached at a time.  Every new offer will override a previously cached offer.</p>
<p>Taker must have a matching payment-method associated with selected offer.</p>
<p>Funding source defaults to Bisq wallet.<br>
Fee currency defaults to BTC.<br>
(Support for displaying Bsq balance and paying trade fee with BSQ not in scope.)</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Confirm Take Offer</p>
<p>Method Signature:      <code>confirmtakeoffer offer-id</code></p>
<p>Confirm and begin the payment protocol started by <code>takeoffer offer-id</code></p>
<p>Validates details of offer before broadcasting it, then displays success (with id) or fail reason message.</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Query Offer Status</p>
<p>Method Signature:      <code>offerstatus offer-id</code></p>
<p>Displays status of offer, including trade protocol steps that have and have not been completed.</p>
<p>Offer creators & takers will see different offer status information, but both will see the same<br>
initial state:</p>
<p><code>WAITING_FOR_BLOCKCHAIN_CONFIRMATION</code> (of deposit fees)</p>
<p>Offer States seen by Takers:</p>
<p><code>START_PAYMENT</code><br>
<code>WAITING_FOR_PAYMENT_ARRIVAL</code></p>
<p>Offer States seen by Creators:</p>
<p><code>WAITING_FOR_PAYMENT</code><br>
<code>PAYMENT_RECEIVED</code></p>
<p>Note: there may be some states unique to SELL offer creators/takers and BUY offer creators/takers.</p>
<p>Creators and takers will also see the same final status:</p>
<p><code>COMPLETED</code> (can move funds)</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Start Payment</p>
<p>Method Signature:      <code>paymentstarted offer-id</code></p>
<p>Called by BTC buyers after submitting a payment.</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Payment Received</p>
<p>Method Signature:      <code>paymentreceived offer-id</code></p>
<p>Called by BTC sellers after receiving a payment.</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Cancel Offer</p>
<p>Method Signature:      <code>canceloffer offer-id</code></p>
<p>Allow user to cancel an existing offer that has not passed the <code>START_PAYMENT</code> stage of the trade protocol.</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Move BTC from completed trades to Bisq BTC wallet</p>
<p>Method Signature:      <code>movefunds</code></p>
<p>Move BTC funds and trade fees to Bisq wallet after a successful trade completion.</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Withdraw BTC to an external wallet</p>
<p>Method Signature:      <code>withdrawbtc "addr"</code></p>
<p>Withdraw BTC from Bisq wallet to external BTC address</p>
</li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/issues/4257">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNUVMQAZYIUCLLINK7TRRRH6NANCNFSM4NBAF6MA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNSKDJC54KII2QM7NF3RRRH6NA5CNFSM4NBAF6MKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4JG5ZG4A.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/issues/4257",
"url": "https://github.com/bisq-network/bisq/issues/4257",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>