mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-10-11 18:10:50 -04:00
general rebase in order to update payment methods and desktop app
Co-authored-by: Alva Swanson <alvasw@protonmail.com> Co-authored-by: andyheko <haoen.ko@gmail.com> Co-authored-by: Bisq GitHub Admin <51445974+bisq-github-admin-3@users.noreply.github.com> Co-authored-by: BtcContributor <79100296+BtcContributor@users.noreply.github.com> Co-authored-by: cd2357 <cd2357@users.noreply.github.com> Co-authored-by: chimp1984 <chimp1984@gmx.com> Co-authored-by: Chris Beams <chris@beams.io> Co-authored-by: Christoph Atteneder <christoph.atteneder@gmail.com> Co-authored-by: Devin Bileck <603793+devinbileck@users.noreply.github.com> Co-authored-by: ghubstan <36207203+ghubstan@users.noreply.github.com> Co-authored-by: Huey <hueydane@gmail.com> Co-authored-by: Jakub Loucký <jakub.loucky@outlook.cz> Co-authored-by: jmacxx <47253594+jmacxx@users.noreply.github.com> Co-authored-by: KanoczTomas <tomas.kanocz@cnl.sk> Co-authored-by: m52go <735155+m52go@users.noreply.github.com> Co-authored-by: Marcus0x <marcus0x@xrhodium.org> Co-authored-by: MarnixCroes <93143998+MarnixCroes@users.noreply.github.com> Co-authored-by: Martin Harrigan <martinharrigan@gmail.com> Co-authored-by: MwithM <50149324+MwithM@users.noreply.github.com> Co-authored-by: sqrrm <sqrrm@users.noreply.github.com> Co-authored-by: Stan <36207203+ghubstan@users.noreply.github.com> Co-authored-by: Stephan Oeste <emzy@emzy.de> Co-authored-by: Steven Barclay <stejbac@gmail.com> Co-authored-by: WAT <shiido.it@gmail.com> Co-authored-by: wiz <j@wiz.biz> Co-authored-by: xyzmaker123 <84982606+xyzmaker123@users.noreply.github.com>
This commit is contained in:
parent
15a1fe8a36
commit
88578bed10
539 changed files with 27629 additions and 8178 deletions
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
# Prerequisites:
|
||||
#
|
||||
# - Linux or OSX with bash, Java 10, or Java 11-12 (JDK language compatibility 10), and bitcoin-core (v0.19, v0.20, v0.21).
|
||||
# - Linux or OSX with bash, Java 11-15 (JDK language compatibility 11), and bitcoin-core (v0.19 - v22).
|
||||
#
|
||||
# - Bisq must be fully built with apitest dao setup files installed.
|
||||
# Build command: `./gradlew clean build :apitest:installDaoSetup`
|
||||
|
@ -134,7 +134,7 @@ sleeptraced 3
|
|||
|
||||
# Show Alice's new offer.
|
||||
printdate "ALICE: Looking at her new $DIRECTION $CURRENCY_CODE offer."
|
||||
CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID"
|
||||
CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID"
|
||||
printdate "ALICE CLI: $CMD"
|
||||
OFFER=$($CMD)
|
||||
exitoncommandalert $?
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# Prerequisites:
|
||||
#
|
||||
# - Linux or OSX with bash, Java 10, or Java 11-12 (JDK language compatibility 10), and bitcoin-core (v0.19, v0.20, v0.21).
|
||||
# - Linux or OSX with bash, Java 11-15 (JDK language compatibility 11), and bitcoin-core (v0.19 - v22).
|
||||
#
|
||||
# - Bisq must be fully built with apitest dao setup files installed.
|
||||
# Build command: `./gradlew clean build :apitest:installDaoSetup`
|
||||
|
@ -94,7 +94,7 @@ while : ; do
|
|||
|
||||
# Show Alice's new offer.
|
||||
printdate "ALICE $ALICE_ROLE: Looking at her new $DIRECTION $CURRENCY_CODE offer."
|
||||
CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID"
|
||||
CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID"
|
||||
printdate "ALICE CLI: $CMD"
|
||||
OFFER=$($CMD)
|
||||
exitoncommandalert $?
|
||||
|
|
|
@ -193,7 +193,6 @@ gencreateoffercommand() {
|
|||
CMD+=" --market-price-margin=$MKT_PRICE_MARGIN"
|
||||
fi
|
||||
CMD+=" --security-deposit=15.0"
|
||||
CMD+=" --fee-currency=BTC"
|
||||
echo "$CMD"
|
||||
}
|
||||
|
||||
|
@ -368,7 +367,7 @@ waitfortradepaymentsent() {
|
|||
|
||||
IS_TRADE_PAYMENT_SENT=$(istradepaymentsent "$TRADE_DETAIL")
|
||||
exitoncommandalert $?
|
||||
printdate "$SELLER: Has buyer's fiat payment been initiated? $IS_TRADE_PAYMENT_SENT"
|
||||
printdate "$SELLER: Has buyer's payment been initiated? $IS_TRADE_PAYMENT_SENT"
|
||||
if [ "$IS_TRADE_PAYMENT_SENT" = "YES" ]
|
||||
then
|
||||
DONE=1
|
||||
|
@ -407,7 +406,7 @@ waitfortradepaymentreceived() {
|
|||
# but we do not need to simulate that in this regtest script.
|
||||
IS_TRADE_PAYMENT_SENT=$(istradepaymentreceived "$TRADE_DETAIL")
|
||||
exitoncommandalert $?
|
||||
printdate "$SELLER: Has buyer's payment been transferred to seller's fiat account? $IS_TRADE_PAYMENT_SENT"
|
||||
printdate "$SELLER: Has buyer's payment been transferred to seller's account? $IS_TRADE_PAYMENT_SENT"
|
||||
if [ "$IS_TRADE_PAYMENT_SENT" = "YES" ]
|
||||
then
|
||||
DONE=1
|
||||
|
@ -427,7 +426,7 @@ delayconfirmpaymentstarted() {
|
|||
PORT="$2"
|
||||
OFFER_ID="$3"
|
||||
RANDOM_WAIT=$(echo $[$RANDOM % 5 + 1])
|
||||
printdate "$PAYER: Sending fiat payment sent message to seller in $RANDOM_WAIT seconds..."
|
||||
printdate "$PAYER: Sending 'payment sent' message to seller in $RANDOM_WAIT seconds..."
|
||||
sleeptraced "$RANDOM_WAIT"
|
||||
CMD="$CLI_BASE --port=$PORT confirmpaymentstarted --trade-id=$OFFER_ID"
|
||||
printdate "$PAYER_CLI: $CMD"
|
||||
|
@ -446,7 +445,7 @@ delayconfirmpaymentreceived() {
|
|||
PORT="$2"
|
||||
OFFER_ID="$3"
|
||||
RANDOM_WAIT=$(echo $[$RANDOM % 5 + 1])
|
||||
printdate "$PAYEE: Sending fiat payment sent message to seller in $RANDOM_WAIT seconds..."
|
||||
printdate "$PAYEE: Sending 'payment sent' message to seller in $RANDOM_WAIT seconds..."
|
||||
sleeptraced "$RANDOM_WAIT"
|
||||
CMD="$CLI_BASE --port=$PORT confirmpaymentreceived --trade-id=$OFFER_ID"
|
||||
printdate "$PAYEE_CLI: $CMD"
|
||||
|
@ -457,11 +456,10 @@ delayconfirmpaymentreceived() {
|
|||
printbreak
|
||||
}
|
||||
|
||||
# This is a large function that should be broken up if it ever makes sense to not treat a trade
|
||||
# execution simulation as an atomic operation. But we are not testing api methods here, just
|
||||
# demonstrating how to use them to get through the trade protocol. It should work for any trade
|
||||
# between Bob & Alice, as long as Alice is maker, Bob is taker, and the offer to be taken is the
|
||||
# first displayed in Bob's getoffers command output.
|
||||
# This is a large function that might be split into smaller functions. But we are not testing
|
||||
# api methods here, just demonstrating how to use them to get through the V1 trade protocol with
|
||||
# the CLI. It should work for any trade between Bob & Alice, as long as Alice is maker, Bob is
|
||||
# taker, and the offer to be taken is the first displayed in Bob's getoffers command output.
|
||||
executetrade() {
|
||||
# Bob list available offers.
|
||||
printdate "BOB $BOB_ROLE: Looking at $DIRECTION $CURRENCY_CODE offers."
|
||||
|
@ -532,24 +530,27 @@ executetrade() {
|
|||
fi
|
||||
|
||||
# Generate some btc blocks
|
||||
printdate "Generating btc blocks after fiat transfer."
|
||||
printdate "Generating btc blocks after payment."
|
||||
genbtcblocks 2 2
|
||||
printbreak
|
||||
|
||||
# Complete the trade on the seller side.
|
||||
if [ "$DIRECTION" = "BUY" ]
|
||||
then
|
||||
printdate "BOB $BOB_ROLE: Closing trade by keeping funds in Bisq wallet."
|
||||
CMD="$CLI_BASE --port=$BOB_PORT keepfunds --trade-id=$OFFER_ID"
|
||||
printdate "BOB CLI: $CMD"
|
||||
else
|
||||
printdate "ALICE (taker): Closing trade by keeping funds in Bisq wallet."
|
||||
CMD="$CLI_BASE --port=$ALICE_PORT keepfunds --trade-id=$OFFER_ID"
|
||||
printdate "ALICE CLI: $CMD"
|
||||
fi
|
||||
# Complete the trade on both sides
|
||||
printdate "BOB $BOB_ROLE: Closing trade and keeping funds in Bisq wallet."
|
||||
CMD="$CLI_BASE --port=$BOB_PORT closetrade --trade-id=$OFFER_ID"
|
||||
printdate "BOB CLI: $CMD"
|
||||
KEEP_FUNDS_MSG=$($CMD)
|
||||
commandalert $? "Could close trade with keepfunds command."
|
||||
# Print the keepfunds command's console output.
|
||||
commandalert $? "Closed trade with closetrade command."
|
||||
# Print the closetrade command's console output.
|
||||
printdate "$KEEP_FUNDS_MSG"
|
||||
sleeptraced 3
|
||||
printbreak
|
||||
|
||||
printdate "ALICE (taker): Closing trade and keeping funds in Bisq wallet."
|
||||
CMD="$CLI_BASE --port=$ALICE_PORT closetrade --trade-id=$OFFER_ID"
|
||||
printdate "ALICE CLI: $CMD"
|
||||
KEEP_FUNDS_MSG=$($CMD)
|
||||
commandalert $? "Closed trade with closetrade command."
|
||||
# Print the closetrade command's console output.
|
||||
printdate "$KEEP_FUNDS_MSG"
|
||||
sleeptraced 3
|
||||
printbreak
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Runs fiat <-> btc trading scenarios using the API CLI with a local regtest bitcoin node.
|
||||
# Demonstrates a fiat <-> btc trade using the API CLI with a local regtest bitcoin node.
|
||||
#
|
||||
# A country code argument is used to create a country based face to face payment account for the simulated
|
||||
# trade, and the maker's face to face payment account's currency code is used when creating the offer.
|
||||
#
|
||||
# Prerequisites:
|
||||
#
|
||||
# - Linux or OSX with bash, Java 10, or Java 11-12 (JDK language compatibility 10), and bitcoin-core (v0.19, v0.20, or v0.21).
|
||||
# - Linux or OSX with bash, Java 11-15 (JDK language compatibility 11), and bitcoin-core (v0.19 - v22).
|
||||
#
|
||||
# - Bisq must be fully built with apitest dao setup files installed.
|
||||
# Build command: `./gradlew clean build :apitest:installDaoSetup`
|
||||
|
@ -26,15 +26,16 @@
|
|||
#
|
||||
# `$ apitest/scripts/trade-simulation.sh -d buy -c fr -m 3.00 -a 0.125`
|
||||
#
|
||||
# Script options: -d <direction> -c <country-code> -m <mkt-price-margin(%)> - f <fixed-price> -a <amount(btc)>
|
||||
# Script options: -d <direction> -c <country-code> -m <mkt-price-margin(%)> -f <fixed-price> -a <amount(btc)>
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# Create a buy/eur offer to buy 0.125 btc at a mkt-price-margin of 0%, using an Italy face to face payment account:
|
||||
# Create and take a buy/eur offer to buy 0.125 btc at a mkt-price-margin of 0%, using an Italy face to face
|
||||
# payment account:
|
||||
#
|
||||
# `$ apitest/scripts/trade-simulation.sh -d buy -c it -m 0.00 -a 0.125`
|
||||
#
|
||||
# Create a sell/eur offer to sell 0.125 btc at a fixed-price of 38,000 euros, using a France face to face
|
||||
# Create and take a sell/eur offer to sell 0.125 btc at a fixed-price of 38,000 euros, using a France face to face
|
||||
# payment account:
|
||||
#
|
||||
# `$ apitest/scripts/trade-simulation.sh -d sell -c fr -f 38000 -a 0.125`
|
||||
|
@ -53,8 +54,6 @@ printdate "Started $APP_BASE_NAME with parameters:"
|
|||
printscriptparams
|
||||
printbreak
|
||||
|
||||
registerdisputeagents
|
||||
|
||||
# Demonstrate how to create a country based, face to face account.
|
||||
showcreatepaymentacctsteps "Alice" "$ALICE_PORT"
|
||||
|
||||
|
@ -96,7 +95,7 @@ sleeptraced 3
|
|||
|
||||
# Show Alice's new offer.
|
||||
printdate "ALICE $ALICE_ROLE: Looking at her new $DIRECTION $CURRENCY_CODE offer."
|
||||
CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID"
|
||||
CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID"
|
||||
printdate "ALICE CLI: $CMD"
|
||||
OFFER=$($CMD)
|
||||
exitoncommandalert $?
|
||||
|
|
122
apitest/scripts/trade-xmr-simulation.sh
Executable file
122
apitest/scripts/trade-xmr-simulation.sh
Executable file
|
@ -0,0 +1,122 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Runs xmr <-> btc trading scenarios using the API CLI with a local regtest bitcoin node.
|
||||
#
|
||||
# Prerequisites:
|
||||
#
|
||||
# - Linux or OSX with bash, Java 11-15 (JDK language compatibility 11), and bitcoin-core (v0.19 - v22).
|
||||
#
|
||||
# - Bisq must be fully built with apitest dao setup files installed.
|
||||
# Build command: `./gradlew clean build :apitest:installDaoSetup`
|
||||
#
|
||||
# - All supporting nodes must be run locally, in dev/dao/regtest mode:
|
||||
# bitcoind, seednode, arbdaemon, alicedaemon, bobdaemon
|
||||
#
|
||||
# These should be run using the apitest harness. From the root project dir, run:
|
||||
# `$ ./bisq-apitest --apiPassword=xyz --supportingApps=bitcoind,seednode,arbdaemon,alicedaemon,bobdaemon --shutdownAfterTests=false`
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# This script must be run from the root of the project, e.g.:
|
||||
#
|
||||
# `$ apitest/scripts/trade-xmr-simulation.sh -d buy -f 0.05 -a 0.125`
|
||||
#
|
||||
# Script options: -d <direction> -m <mkt-price-margin(%)> -f <fixed-price> -a <amount(btc)>
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# Create a buy/xmr offer to buy 0.125 btc at an xmr fixed-price of 0.05 btc, using an xmr payment account:
|
||||
#
|
||||
# `$ apitest/scripts/trade-xmr-simulation.sh -d buy -f 0.05 -a 0.125`
|
||||
#
|
||||
# Create a sell/xmr offer to sell 0.125 btc at at an xmr mkt-price-margin of 0%, using using an xmr payment account:
|
||||
#
|
||||
# `$ apitest/scripts/trade-xmr-simulation.sh -d sell -m 0.00 -a 0.125`
|
||||
|
||||
export APP_BASE_NAME=$(basename "$0")
|
||||
export APP_HOME=$(pwd -P)
|
||||
export APITEST_SCRIPTS_HOME="$APP_HOME/apitest/scripts"
|
||||
export CURRENCY_CODE="XMR"
|
||||
export ALICE_XMR_ADDRESS="44i8xZbd8ecaD6nQQrHjr1BwTp6QfGL22iWqHZKmU4QYSyr1F64XAxM4HgvQHxbny7ehfxemaA9LPDLz2wY3fxhB1bbMEco"
|
||||
export BOB_XMR_ADDRESS="48xdBkXaCosPxcWwXRZdSGc33M9tYu6k9ga56dqkNrgsjQuJX16xW2qTyWTZstJpXXj87dj5p4H3y1xAfoVjAysoAYrXh2N"
|
||||
|
||||
source "$APITEST_SCRIPTS_HOME/trade-simulation-env.sh"
|
||||
source "$APITEST_SCRIPTS_HOME/trade-simulation-utils.sh"
|
||||
|
||||
checksetup
|
||||
parsexmrscriptopts "$@"
|
||||
|
||||
printdate "Started $APP_BASE_NAME with parameters:"
|
||||
printscriptparams
|
||||
printbreak
|
||||
|
||||
registerdisputeagents
|
||||
|
||||
# Demonstrate how to create an XMR altcoin payment account.
|
||||
|
||||
printdate "Create Alice's XMR Trading Payment Account."
|
||||
# Note: Having problems passing a double quoted --account-name param to function.
|
||||
CMD="$CLI_BASE --port=$ALICE_PORT createcryptopaymentacct --account-name=Alice_XMR_Account"
|
||||
CMD+=" --currency-code=XMR --address=$ALICE_XMR_ADDRESS --trade-instant=false"
|
||||
printdate "ALICE CLI: $CMD"
|
||||
CMD_OUTPUT=$(createpaymentacct "$CMD")
|
||||
echo "$CMD_OUTPUT"
|
||||
printbreak
|
||||
export ALICE_ACCT_ID=$(getnewpaymentacctid "$CMD_OUTPUT")
|
||||
printdate "Alice's XMR payment-account-id: $ALICE_ACCT_ID"
|
||||
exitoncommandalert $?
|
||||
printbreak
|
||||
|
||||
printdate "Create Bob's XMR Trading Payment Account."
|
||||
# Note: Having problems passing a double quoted --account-name param to function.
|
||||
CMD="$CLI_BASE --port=$BOB_PORT createcryptopaymentacct --account-name=Bob_XMR_Account"
|
||||
CMD+=" --currency-code=XMR --address=$BOB_XMR_ADDRESS --trade-instant=false"
|
||||
printdate "BOB CLI: $CMD"
|
||||
CMD_OUTPUT=$(createpaymentacct "$CMD")
|
||||
echo "$CMD_OUTPUT"
|
||||
printbreak
|
||||
export BOB_ACCT_ID=$(getnewpaymentacctid "$CMD_OUTPUT")
|
||||
printdate "Bob's XMR payment-account-id: $BOB_ACCT_ID"
|
||||
exitoncommandalert $?
|
||||
printbreak
|
||||
|
||||
# Alice creates an offer.
|
||||
printdate "ALICE $ALICE_ROLE: Creating $DIRECTION $CURRENCY_CODE offer with payment acct $ALICE_ACCT_ID."
|
||||
CMD=$(gencreateoffercommand "$ALICE_PORT" "$ALICE_ACCT_ID")
|
||||
printdate "ALICE CLI: $CMD"
|
||||
OFFER_ID=$(createoffer "$CMD")
|
||||
exitoncommandalert $?
|
||||
printdate "ALICE $ALICE_ROLE: Created offer with id: $OFFER_ID."
|
||||
printbreak
|
||||
sleeptraced 3
|
||||
|
||||
# Show Alice's new offer.
|
||||
printdate "ALICE $ALICE_ROLE: Looking at her new $DIRECTION $CURRENCY_CODE offer."
|
||||
CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID"
|
||||
printdate "ALICE CLI: $CMD"
|
||||
OFFER=$($CMD)
|
||||
exitoncommandalert $?
|
||||
echo "$OFFER"
|
||||
printbreak
|
||||
sleeptraced 3
|
||||
|
||||
# Generate some btc blocks.
|
||||
printdate "Generating btc blocks after publishing Alice's offer."
|
||||
genbtcblocks 3 1
|
||||
printbreak
|
||||
|
||||
# Go through the trade protocol.
|
||||
executetrade
|
||||
exitoncommandalert $?
|
||||
printbreak
|
||||
|
||||
# Get balances after trade completion.
|
||||
printdate "Bob & Alice's balances after trade:"
|
||||
printdate "ALICE CLI:"
|
||||
printbalances "$ALICE_PORT"
|
||||
printbreak
|
||||
printdate "BOB CLI:"
|
||||
printbalances "$BOB_PORT"
|
||||
printbreak
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue