Deploy an NFT Contract

After generating a contract for the NFT collection, you need to deploy the contract.

You will send a POST request to /nft/<nft_collection_name> endpoint, calling the :deploy method, to deploy the NFT collection smart contract.

Deploy the NFT contract.

POST https://api.playfix.io/nft/<nft_collection_name>:deploy

Path Parameters

Name
Type
Description

nft_collect_name*

String

The name of the NFT. This will start with a prefix of "nfts/" followed by a ULID.

Headers

Name
Type
Description

Authorization*

String

Bearer <your_access_token>

Request Body

Name
Type
Description

clientSide*

Object

Client side configuration for deploying the NFT contract.

clientSide.address*

String

The smart contract address; automatically generated by MetaMask.

clientSide.network*

String

The network where the collection will be deployed.

clientSide.txHash*

String

The smart contract creation transaction hash, automatically generated by MetaMask.

{
  "nft": {
    "name":"nfts/01gg71g4h2ycjyagxcfcvgadg3",
    "project":"projects/01gfv5g90rd26redcnygvj9q3a",
    "standard":"NFT_STANDARD_UNSPECIFIED",
    "title":"Carz",
    "description":"",
    "itemCount":"1",
    "imageCoverUrl":"https://ipfs-gateway.playfix.io/ipfs/QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
    "imageCoverCid":"QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
    "config":{
      "name":"Carz",
      "symbol":"CRS",
      "itemPrice":0.01,
      "baseUri":"ipfs://bafybeidbvgkfvkf5jsjy23szl2by5klbdai6zvdk6ybg5sjkasf4cuokdy/",
      "burnable":false,
      "pausable":false,
      "ownerAddress":"0x7c992EF85B5F10013a7D4A07cB6c30A75708D516"
      },
    "network":"NETWORK_POLYGON_MUMBAI",
    "contractAddress":"0xFFe996EE4846409Ec9e7069Ba6358D6F3F5620d0",
    "deployTxHash":""
   }
}

Example Curl API Call

curl --request POST \
  --url https://api.playfix.io/nft/<nft_collection_name>:deploy \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <your_access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "clientSide": {
      "network": "NETWORK_POLYGON",
      "address": "0xFFe996EE4846409Ec9e7069Ba6358D6F3F5620d0",
      "txHash":"0x0000000000000000000000000000000000000000000000000000000000000000"
      }
    }'

Example Python API Call

import requests
import json

nft = "<nft_collection_name>"
payload = {
    "clientSide": {
        "network": "NETWORK_POLYGON",
        "address": "0xFFe996EE4846409Ec9e7069Ba6358D6F3F5620d0",
        "txHash":"0x0000000000000000000000000000000000000000000000000000000000000000"
        }
    }

r = requests.post(
    "https://api.playfix.io/nft/" + nft + ":deploy",
    headers = {
        "Authorization": "Bearer <your_access_token>",
        "Accept": "application/json",
        "Content-Type": "application/json"
    },
    data = json.dumps(payload)
)

print(r.text)

You must connect to MetaMask to run this process.

Request Body

  • clientSide: An object containing the configurations for deploying the NFT collection smart contract using MetaMask.

    • network: The network where the collection will be deployed.

    • address: The smart contract address. This is automatically generated by MetaMask.

    • txHash: The smart contract creation transaction hash, automatically generated by MetaMask.

Response

{
  "nft": {
    "name":"nfts/01gg71g4h2ycjyagxcfcvgadg3",
    "project":"projects/01gfv5g90rd26redcnygvj9q3a",
    "standard":"NFT_STANDARD_UNSPECIFIED",
    "title":"Carz",
    "description":"",
    "itemCount":"1",
    "imageCoverUrl":"https://ipfs-gateway.playfix.io/ipfs/QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
    "imageCoverCid":"QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
    "config":{
      "name":"Carz",
      "symbol":"CRS",
      "itemPrice":0.01,
      "baseUri":"ipfs://bafybeidbvgkfvkf5jsjy23szl2by5klbdai6zvdk6ybg5sjkasf4cuokdy/",
      "burnable":false,
      "pausable":false,
      "ownerAddress":"0x7c992EF85B5F10013a7D4A07cB6c30A75708D516"
      },
    "network":"NETWORK_POLYGON_MUMBAI",
    "contractAddress":"0xFFe996EE4846409Ec9e7069Ba6358D6F3F5620d0",
    "deployTxHash":""
   }
}

Once you deploy the NFT collection contract, you can no longer modify or delete an NFT item in the collection, the NFT collection or the collection contract.

Last updated