-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathquickstart.sh
More file actions
executable file
·66 lines (55 loc) · 1.77 KB
/
Copy pathquickstart.sh
File metadata and controls
executable file
·66 lines (55 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# InsumerAPI Quickstart — generates a key and verifies a wallet.
# Just run: bash quickstart.sh
set -euo pipefail
API="https://api.insumermodel.com"
# --- Step 1: Get a free API key ---
if [ -n "${INSUMER_API_KEY:-}" ]; then
API_KEY="$INSUMER_API_KEY"
echo "Using existing key: ${API_KEY:0:20}..."
else
echo ""
read -p "Email (for your free API key): " EMAIL
if [ -z "$EMAIL" ]; then
echo "Email required. Or set INSUMER_API_KEY= to skip."
exit 1
fi
APP_NAME="${INSUMER_APP_NAME:-quickstart-demo}"
echo "Creating key for ${EMAIL}..."
KEY_RESPONSE=$(curl -s -X POST "$API/v1/keys/create" \
-H "Content-Type: application/json" \
-d "{\"email\": \"${EMAIL}\", \"appName\": \"${APP_NAME}\", \"tier\": \"free\"}")
API_KEY=$(echo "$KEY_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin).get('key',''))" 2>/dev/null)
if [ -z "$API_KEY" ]; then
echo "Error: $KEY_RESPONSE"
exit 1
fi
echo ""
echo "Your API key: $API_KEY"
echo "Save this — you won't see it again."
echo ""
fi
# --- Step 2: Verify Vitalik's wallet holds USDC on Ethereum ---
echo "Verifying wallet holds USDC on Ethereum..."
echo ""
curl -s -X POST "$API/v1/attest" \
-H "Content-Type: application/json" \
-H "X-API-Key: $API_KEY" \
-d '{
"wallet": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"conditions": [
{
"type": "token_balance",
"contractAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"chainId": 1,
"threshold": "100",
"decimals": 6,
"label": "USDC >= 100 on Ethereum"
}
]
}' | python3 -m json.tool
# --- Step 3: Check remaining credits ---
echo ""
echo "Credits remaining:"
curl -s "$API/v1/credits" \
-H "X-API-Key: $API_KEY" | python3 -m json.tool