Skip to content

Instantly share code, notes, and snippets.

@bretton
Created June 15, 2022 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bretton/35949862c1d368ff66b897ad78618f76 to your computer and use it in GitHub Desktop.
Save bretton/35949862c1d368ff66b897ad78618f76 to your computer and use it in GitHub Desktop.
Get Amboss Magma LN channel capacity offers API list
query GetMagmaOffers {
getOffers {
list {
account
amboss_fee_rate
base_fee
base_fee_cap
fee_rate
fee_rate_cap
id
max_size
min_block_length
min_size
seller_score
side
status
total_size
orders {
locked_size
}
}
}
}
#!/usr/bin/env bash
if [ ! -f $1 ] || [ $# -ne 1 ]
then
echo Queries the amboss magma graphql API
echo "Usage:"
echo
echo "$0 getmagmaoffers.gql"
exit 1
fi
# read the gql query from the file named in the argument
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
TOKEN=$(cat "${DIR}"/token)
QUERY=$(jq -n \
--arg q "$(cat $1 | tr -d '\n')" \
'{ query: $q }')
SERVER="https://api.amboss.space/graphql"
# do the query
#curl -s -X POST \
# -H "Content-Type: application/json" \
# -H "Authorization: bearer ${TOKEN}" \
# --data "${QUERY}" \
# "${SERVER}"
# no auth version below
curl -s -X POST \
-H "Content-Type: application/json" \
--data "${QUERY}" \
"${SERVER}"
@bretton
Copy link
Author

bretton commented May 20, 2023

2023-05-20: might need to use python instead of bash, jq, curl. Something changed in the API and it only works with python now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment