-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsubscribe_events.sh
More file actions
executable file
·33 lines (29 loc) · 971 Bytes
/
subscribe_events.sh
File metadata and controls
executable file
·33 lines (29 loc) · 971 Bytes
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
#!/bin/bash
# Load the .env variables
if [ -f .env ]; then
source .env
else
echo "The file .env doesn't exist"
exit 1
fi
# Subscribe to the "Publish" event
# XDR built with JS: sorobanClient.xdr.ScVal.scvString("Publish").toXDR("base64")
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MERCURY_JWT_TOKEN" \
-d '{
"contract_id": "'"$1"'",
"topic1": "AAAADgAAAAdQdWJsaXNoAA=="
}' \
$MERCURY_BACKEND_ENDPOINT/event
# Subscribe to the "Deploy" event
# XDR built with JS: sorobanClient.xdr.ScVal.scvString("Deploy").toXDR("base64")
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MERCURY_JWT_TOKEN" \
-d '{
"contract_id": "'"$1"'",
"topic1": "AAAADgAAAAZEZXBsb3kAAA=="
}' \
$MERCURY_BACKEND_ENDPOINT/event
echo "\n\nSuccessfully subscribed to the events"