CJYen 3 éve
szülő
commit
b5d3e71b21
3 módosított fájl, 62 hozzáadás és 3 törlés
  1. 57 0
      app/api/api_v1/endpoints/joyso.py
  2. 4 0
      app/api/api_v1/endpoints/models.py
  3. 1 3
      app/main.py

+ 57 - 0
app/api/api_v1/endpoints/joyso.py

@@ -0,0 +1,57 @@
+import requests
+from random import randrange
+import json
+import models
+
+
+baseUrl = "https://nft-api-staging.joyso.io/api/v1/"
+headers = {'Authorization': 'Basic %s' %
+                            'bmZ0OmMxOTEzOWMzYjM3YjdjZWU3ZmY3OTFiZGU3NzdjZWNl'}
+
+
+# # Get address
+# path = 'accounts/test01'
+# r = requests.get(baseUrl + path, headers=headers)
+#
+# print(r.json())
+
+
+# Mint
+async def mint(userModel : models.joysoMint):
+    path = "erc1155/mint"
+    txid = str(randrange(99999))
+    to = userModel.toaddress
+    uid = '88888888'
+    amount = userModel.amount
+
+    data = {
+        "txid": txid,
+        "to": to,
+        "uid": uid,
+        "amount": amount
+    }
+
+    r = requests.post(baseUrl+path, headers=headers, data=json.dumps(data))
+
+    print(r.text)
+
+
+# # Transfer
+# path = "accounts/test01/erc1155/safe_transfer_to"
+# txid = "202112229"
+# to = "0x72487C7A8bA487DFC3ed3Aa055ac5033138D8659"
+# uid = "88888888"
+# contract = "0xe0d9102c88b09369df99b1c126fb2eebc13804f8"
+# value = "1"
+#
+# data = {
+#     "txid": txid,
+#     "to": to,
+#     "uid": uid,
+#     "contract": contract,
+#     "value": value
+# }
+#
+# r = requests.post(baseUrl+path, headers=headers, data=data)
+#
+# print(r.json())

+ 4 - 0
app/api/api_v1/endpoints/models.py

@@ -15,3 +15,7 @@ class NftDrops(BaseModel):
 class callBack(BaseModel):
     type: str
     data: dict
+
+class joysoMint(BaseModel):
+    toaddress: str
+    amount: str

+ 1 - 3
app/main.py

@@ -4,9 +4,7 @@ from starlette.middleware.cors import CORSMiddleware
 from app.api.api_v1.api import api_router
 from app.core.config import settings
 
-app = FastAPI(
-    title=settings.PROJECT_NAME, openapi_url=f"{settings.API_V1_STR}/openapi.json"
-)
+app = FastAPI(title=settings.PROJECT_NAME, openapi_url=f"{settings.API_V1_STR}/openapi.json")
 
 # Set all CORS enabled origins
 if settings.BACKEND_CORS_ORIGINS: