-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Subscribe to events automatically when deploying smartdeploy
- Loading branch information
1 parent
be6746b
commit dd81a61
Showing
5 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
SOROBAN_NETWORK=testnet | ||
SOROBAN_ACCOUNT=default | ||
CONFIG_DIR=. | ||
SOROBAN_FEE=10000000 | ||
MERCURY_BACKEND_ENDPOINT=https://api.mercurydata.app:8443 | ||
MERCURY_JWT_TOKEN=request-access-to-mercury-team |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/target/ | ||
.soroban | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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" |