#!/bin/bash # Params and usage if [[ $# -eq 0 || $# -gt 2 || "$1" == "help" || "$1" == "--help" || "$1" == "-h" ]]; then echo " Usage: - Get current price (BTC/AEON rate) $0 price - Make an order $0 $0 bc1qz5dwx8x2lx45shk0hky373q8ur5d0vcvjz80ev 0.001 - Check order status $0 $0 aeonapi-5nDeaaYYjCRG " exit 0 fi # If jq is installed, use it as output parser output_parser="cat" if command -v "jq" >/dev/null 2>&1; then output_parser="jq ." fi # Price if [[ "$1" == "price" ]]; then curl -s https://aeonapi.com/api/v2/aeon2btc/order_parameter_query/ | $output_parser exit 0 fi # Make an order (BTC address and amount) if [[ $# -eq 2 ]]; then payload="{\"btc_dest_address\": \"$1\", \"btc_amount\": $2}" curl -s -d "$payload" -H 'Content-Type: application/json' https://aeonapi.com/api/v2/aeon2btc/order_create/ | $output_parser exit 0 fi # Order check (uuid) if [[ $# -eq 1 ]]; then payload="{\"uuid\": \"$1\"}" curl -s -d "$payload" -H 'Content-Type: application/json' https://aeonapi.com/api/v2/aeon2btc/order_status_query/ | $output_parser exit 0 fi # EOF