12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import requests
- from random import randrange
- import json
- from app.api.api_v1.endpoints import models
- from fastapi import APIRouter
- router = APIRouter()
- 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
- @router.post("/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))
- return 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())
|