feat: Initial staked domains

This commit is contained in:
2025-07-18 12:55:36 +10:00
parent 1742ac6988
commit 5f4fc93e37

View File

@@ -43,6 +43,27 @@ functions = {
def main(params, authentication):
return {"status": "Success"}
def checkStaked(domain):
"""
Check if a domain is staked on Shakestation.
"""
response = requests.post(f"https://shakestation.io/api",
data={"action":"getStakedTLD","tld":domain})
if response.status_code != 200:
return False
data = response.json()
# Check if the domain is staked
if "data" not in data:
return False
return data["data"]
return False
def domain_info(params, authentication):
domain = params.get("domain")
if not domain:
@@ -62,25 +83,27 @@ def domain_info(params, authentication):
return {"info": "No type found in the data"}
domainType = data["data"]["type"]
skippedTypes = ["auction"]
score = data["data"].get("score", "No score available")
if domainType in skippedTypes:
return {"info": f"<h4>Score: {score}</h4>"}
returnInfo = f"<h4>Score: {score}</h4>"
if domainType == "marketplace":
price = data["data"].get("price", "No price available")
return {"info": f"<h4>Score: {score}<br>Price: {price}</h4><a href='https://shakestation.io/domain/{domain}'>View Listing</a>"}
returnInfo = f"<h4>Score: {score}<br>Price: {price}</h4><a href='https://shakestation.io/domain/{domain}'>View Listing</a>"
stakedData = checkStaked(domain)
if stakedData:
returnInfo += f"<h4>Staked: {stakedData.get('price', '-1')} HNS ({stakedData.get('renew_price','-1')} HNS/yr)</h4>"
return {"info": f"TODO: {domainType} domain type not implemented yet. Data: {data}"}
return {"info": returnInfo}
if __name__ == "__main__":
# Example usage
params = {"domain": "pinwheelgalaxy"}
authentication = None # Replace with actual authentication if needed
result = domain_info(params, authentication)
print(json.dumps(result, indent=2))
params = {"domain": "denizen"}
result = domain_info(params, authentication)
print(json.dumps(result, indent=2))