Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo script hitting some APIs to create accounts, invoices #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions demo-giga.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

echo Creating account:
curl -X POST http://localhost:8081/account/raffe -d '{}'
echo
echo

echo Getting account:
curl -X GET http://localhost:8081/account/raffe
echo
echo

echo Getting account balance:
curl -X GET http://localhost:8081/account/raffe/balance
echo
echo

echo Creating invoice:
curl -X POST http://localhost:8081/account/raffe/invoice -d '{"vendor":"raffe","items":[{"type":"item","name":"Foods","value":"10","quantity":1}]}'
echo
echo

echo Make a payment to the above 'pay_to_address' and list invoices again.
echo After 6 blocks of confirmation, the invoice will be marked paid.
echo Then, check account balance again - basically re-run this script.
echo

echo Listing invoices:
curl -X GET http://localhost:8081/account/raffe/invoices -s | jq .
echo
echo

INVOICE_ID="DSDAt1e5yeAaqkeVcJHATUpKjHVECCQaPQ"
echo Get an invoice:
curl -X GET "http://localhost:8081/account/raffe/invoice/$INVOICE_ID" -s | jq .
echo
echo