Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment