forked from ZyntariHQ/Invoisio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinvoke-payment-history.sh
More file actions
72 lines (63 loc) · 1.72 KB
/
Copy pathinvoke-payment-history.sh
File metadata and controls
72 lines (63 loc) · 1.72 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
67
68
69
70
71
72
#!/usr/bin/env bash
#
# Retrieve a bounded page of payment history from the Invoisio Soroban contract
#
# Usage: ./invoke-payment-history.sh <cursor> [limit]
#
# Arguments:
# cursor - Next history index to read from
# limit - Optional page size (default: 25)
#
# Environment variables:
# STELLAR_NETWORK - Network to use (default: testnet)
# CONTRACT_ID - Override contract ID (default: read from .contract-id file)
#
# Example:
# ./invoke-payment-history.sh 0 25
set -e
cd "$(dirname "$0")"
# Configuration
NETWORK="${STELLAR_NETWORK:-testnet}"
IDENTITY="${STELLAR_IDENTITY:-invoisio-admin}"
CONTRACT_ID_FILE="contracts/invoice-payment/.contract-id"
# Parse arguments
CURSOR="$1"
LIMIT="${2:-25}"
# Show usage if cursor is missing
if [ -z "$CURSOR" ]; then
echo "Usage: $0 <cursor> [limit]"
echo ""
echo "Example:"
echo " $0 0 25"
exit 1
fi
# Get contract ID
if [ -n "$CONTRACT_ID" ]; then
echo "ℹ️ Using CONTRACT_ID from environment: $CONTRACT_ID"
elif [ -f "$CONTRACT_ID_FILE" ]; then
CONTRACT_ID=$(cat "$CONTRACT_ID_FILE")
else
echo "❌ Error: Contract ID not found"
echo ""
echo "Either:"
echo " 1. Deploy the contract first: ./deploy.sh"
echo " 2. Set CONTRACT_ID environment variable"
exit 1
fi
echo "========================================="
echo "Retrieving Payment History"
echo "========================================="
echo "Contract ID: $CONTRACT_ID"
echo "Cursor: $CURSOR"
echo "Limit: $LIMIT"
echo "Network: $NETWORK"
echo ""
# Invoke payment_history
stellar contract invoke \
--id "$CONTRACT_ID" \
--source "$IDENTITY" \
--network "$NETWORK" \
-- payment_history \
--cursor "$CURSOR" \
--limit "$LIMIT"
echo ""