-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclaimXP.sh
36 lines (29 loc) · 1.02 KB
/
claimXP.sh
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
# Configuration of variables
WALLET_PEM="Path/to/WalletPEM"
XP_SC="erd1qqqqqqqqqqqqqpgq8pdxqhhnp38qkezf7lcx5qww85zmph708juq48geul"
PROXY="https://gateway.multiversx.com"
CHAIN="1"
claimXP() {
# Execute the transaction and capture the output
output=$(mxpy --verbose contract call ${XP_SC} --recall-nonce \
--pem=${WALLET_PEM} \
--gas-limit=5000000 \
--proxy=${PROXY} --chain=${CHAIN} \
--function="claim" \
--send)
echo "$output"
# Extract the transaction hash from the output
txHash=$(echo "$output" | perl -nle 'print $1 if /emittedTransactionHash": "([^"]+)/')
echo "Transaction Hash: $txHash"
# Immediately check the transaction status
checkTransactionStatus "$txHash"
}
checkTransactionStatus() {
local txHash=$1
echo "Checking transaction status..."
response=$(curl -s "${PROXY}/transaction/${txHash}/process-status")
status=$(echo "$response" | jq -r '.data.status')
echo "Current status: $status - $response"
}
# Call the function
claimXP