-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add full documentation on plan management scripts and running the pla…
…n API. Users should reference this README to know how to manage their plans. Update [rdn] to use the interval in scrtxxs
- Loading branch information
Showing
5 changed files
with
378 additions
and
2 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
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,13 @@ | ||
#!/bin/bash | ||
|
||
PREFIXDIR="/home/sentinel/api/helpers" | ||
cd $PREFIXDIR | ||
rm subs.json subs2.json subs3.json unsub.json | ||
python3 query_subs.py >> subs.json | ||
cat subs.json | sed -e "s/'/\"/g" >> subs2.json | ||
cat subs2.json | jq >> subs3.json | ||
cat subs3.json | jq 'length' | ||
jq 'group_by(.Node) | map(select(length > 1)) | add | .[2:]' subs3.json >> unsub.json | ||
cat unsub.json | ||
sleep 10 | ||
python3 unsubscribe.py --file unsub.json |
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,41 @@ | ||
#!/bin/env python3 | ||
|
||
from urllib.parse import urlparse | ||
from datetime import datetime | ||
from sentinel_sdk.sdk import SDKInstance | ||
from sentinel_sdk.types import PageRequest | ||
|
||
#GRPC = "https://grpc.bluefren.xyz:443" | ||
GRPC = "https://grpc.bluefren.xyz:9090" | ||
#GRPC = "https://grpc.mathnodes.com:443" | ||
#GRPC = "http://grpc.dvpn.me:9090" | ||
#GRPC = "http://grpc.mathnodes.com:9000" | ||
#GRPC = "https://grpc.noncompliant.network:443" | ||
#GRPC = "http://noncompliant.network:9090" | ||
#SSL = True | ||
SSL = False | ||
WalletAddress = "sent1mrqc5hzdp7gttvrylqu060cevgfx2kaadgt9xx" | ||
#WalletAddress = "sent1d2ps3wvk6yzkachaden4rk7faccvq59937h2te" | ||
def qs(): | ||
grpcaddr, grpcport = urlparse(GRPC).netloc.split(":") | ||
_sdk = SDKInstance(grpcaddr, int(grpcport), ssl=SSL) | ||
subscriptions = _sdk.subscriptions.QuerySubscriptionsForAccount(address=WalletAddress, pagination=PageRequest(limit=1000)) | ||
|
||
SubsNodesInfo = [{ | ||
'Denom': "", # TODO: (?) | ||
'Deposit': f"{subscription.deposit.amount}{subscription.deposit.denom}", | ||
'Gigabytes': f"{subscription.gigabytes}", | ||
'Hours': f"{subscription.hours}", | ||
'ID': f"{subscription.base.id}", | ||
'Inactive Date': datetime.fromtimestamp(subscription.base.inactive_at.seconds).strftime('%Y-%m-%d %H:%M:%S.%f'), # '2024-03-26 19:37:52.52297981', | ||
'Node': subscription.node_address, | ||
'Owner': subscription.base.address, | ||
'Plan': '0', # TODO: (?) | ||
'Status': ["unspecified", "active", "inactive_pending", "inactive"][subscription.base.status], | ||
} for subscription in subscriptions] | ||
|
||
|
||
print(SubsNodesInfo) | ||
|
||
|
||
qs() |
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
Oops, something went wrong.