Skip to content

Commit

Permalink
Use domain from request in message (#14)
Browse files Browse the repository at this point in the history
Signed-off-by: Julian Strobl <[email protected]>
  • Loading branch information
jmastr authored Nov 22, 2023
1 parent 174d632 commit f70d659
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ def list_files(request: Request):


@app.post("/register_asset", status_code=201)
async def register_asset_id(request_body: RegisterRequest):
async def register_asset_id(request_body: RegisterRequest, request: Request):
print(f" request_body: { request_body }")
print(f" TYPE : {isinstance(request_body.contract, dict)}")
print(f" TYPE : {isinstance(request_body.contract, str)}")
if register_asset_id_local(request_body.asset_id):
if register_asset_id_local(request_body.asset_id, str(request.url.netloc)):
print(f"File succesffully written: {request_body.asset_id}")
register_asset_id_on_liquid(request_body.asset_id, request_body.contract)
return {"asset_id": request_body.asset_id}


def register_asset_id_local(asset_id: str):
def register_asset_id_local(asset_id: str, netloc: str):
try:
f = open(f"{WELL_KNOWN_FOLDER}/liquid-asset-proof-" + asset_id, "w")
f.write("Authorize linking the domain name assets.rddl.io to the Liquid asset " + asset_id)
f.write("Authorize linking the domain name " + netloc + " to the Liquid asset " + asset_id)
f.close()
except Exception as e:
print(f"File Write execption: {e}")
Expand Down

0 comments on commit f70d659

Please sign in to comment.