diff --git a/backend/polygon_id/credential_issuer.py b/backend/polygon_id/credential_issuer.py index 7deff66..18231e5 100644 --- a/backend/polygon_id/credential_issuer.py +++ b/backend/polygon_id/credential_issuer.py @@ -32,7 +32,7 @@ def generate_credential_link(scores: Scores): 'expiration': None, 'limitedClaims': 1, 'mtProof': False, - 'schemaID': 'c895e94a-643f-4e47-8ece-b434a520ba08', + 'schemaID': '428a54e7-16eb-42bf-b49b-9b45818637a9', 'signatureProof': True, } @@ -42,18 +42,22 @@ def generate_credential_link(scores: Scores): json=json_data ) + print( + response.text + ) + return {"url": "https://issuer-ui.polygonid.me/credentials/scan-link/" + response.json()['id'], "id": response.json()['id']} -# p = generate_credential_link( -# Scores( -# 0.5, -# 0.5, -# 0.5, -# 0.5, -# 0.5, -# 0.5 -# ) -# ) +p = generate_credential_link( + Scores( + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5 + ) +) -# print(p) +print(p) diff --git a/backend/routes.py b/backend/routes.py index ac7deed..71a561b 100644 --- a/backend/routes.py +++ b/backend/routes.py @@ -36,10 +36,11 @@ def attest(): def scores(): try: - data = request.get_json() + # get query param + recipient = request.args.get('recipient') scores = get_scores( - data['recipient'] + recipient ) except Exception as e: diff --git a/backend/run.py b/backend/run.py index 2d43787..ff0b87f 100644 --- a/backend/run.py +++ b/backend/run.py @@ -1,8 +1,11 @@ from flask import Flask +from flask_cors import CORS from routes import main app = Flask(__name__) app.register_blueprint(main) +CORS(app, resources={r"/get-scores/*": {"origins": "https://near.org"}}) + if __name__ == '__main__': - app.run(host='127.0.0.1', port=5555) + app.run(host='127.0.0.1', port=3000) diff --git a/backend/spot_scoring/scoring.py b/backend/spot_scoring/scoring.py index 8e1abb8..cf861ce 100644 --- a/backend/spot_scoring/scoring.py +++ b/backend/spot_scoring/scoring.py @@ -88,12 +88,16 @@ def calculate_wallet_data_score(wallet_data): def calculate_degen_score(address): score = get_degen_score(address) - return score + return 1 def calculate_nomis_score_eth(address): score = get_nomis_score_eth(address) - return score + + if score: + return score['data']['score'] + + return 1 def calculate_gitcoin_score(address): @@ -102,7 +106,7 @@ def calculate_gitcoin_score(address): if score: return round(float(score['score']) / 100, 5) - return score + return 1 def calculate_spot_score(followers, following, posts, comments, mirrors, publications, collects, gitcoin): @@ -181,13 +185,21 @@ def get_scores(address): gitcoin_score = calculate_gitcoin_score(address) + print( + social_score, + degen_score, + nomis_score, + gitcoin_score, + wallet_data_score + ) + return { "scores": { "social_score": social_score, "degen_score": degen_score, "nomis_score_eth": nomis_score, "gitcoin_score": gitcoin_score, - "spot_score": 777 * (float(social_score) + float(degen_score)+float(nomis_score)+float(gitcoin_score) + float(wallet_data_score)) / 5, + "spot_score": 100 * (float(social_score) + float(degen_score)+float(nomis_score)+float(gitcoin_score) + float(wallet_data_score)) / 5, "wallet_data": wallet_data_score, },