Read an NFT Contract

You can view an NFT collection's contract by sending a GET request to the /nft/contract endpoint.

Get the details of an NFT item.

GET https://api.playfix.io/nft/<nft_collection_name>/contract

Path Parameters

Name
Type
Description

nft_name*

String

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

Headers

Name
Type
Description

Authorization*

String

Bearer <your_access_token>

{
  "contract": {
    "source": {
      "main": "//...",
      "imports": {
      @opengsn/contracts/src/BaseRelayRecipient.sol: "..."
      @opengsn/contracts/src/interfaces/IRelayRecipient.sol: "..."
      @openzeppelin/contracts/access/AccessControl.sol: "..."
      @openzeppelin/contracts/access/IAccessControl.sol: "..."
      @openzeppelin/contracts/token/ERC721/ERC721.sol: "..."
      @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol: "..."
      @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol: "..."
      @openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol: "..."
      @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol: "..."
      @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol: "..."
      @openzeppelin/contracts/utils/Address.sol: "..."
      @openzeppelin/contracts/utils/Context.sol: "..."
      @openzeppelin/contracts/utils/Strings.sol: "..."
      }
    },
    "abi": "[{...}, {...}, {...}, ...]",
    "bytecode": "0x..."
  }
}

Example Curl API Call

curl --request GET \
  --url https://api.playfix.io/nft/<nft_collection_name>/contract \
  --header 'Authorization: Bearer <your_access_token>'

Example Python API Call

import requests

r = requests.get(
    "https://api.playfix.io/nft/<nft_collection_name>",
    headers = {
        "Authorization": "Bearer <your_access_token>"
        }
    )

print(r.text)

Response Body

{
  "contract": {
    "source": {
      "main": "//...",
      "imports": {
      @opengsn/contracts/src/BaseRelayRecipient.sol: "..."
      @opengsn/contracts/src/interfaces/IRelayRecipient.sol: "..."
      @openzeppelin/contracts/access/AccessControl.sol: "..."
      @openzeppelin/contracts/access/IAccessControl.sol: "..."
      @openzeppelin/contracts/token/ERC721/ERC721.sol: "..."
      @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol: "..."
      @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol: "..."
      @openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol: "..."
      @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol: "..."
      @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol: "..."
      @openzeppelin/contracts/utils/Address.sol: "..."
      @openzeppelin/contracts/utils/Context.sol: "..."
      @openzeppelin/contracts/utils/Strings.sol: "..."
      }
    },
    "abi": "[{...}, {...}, {...}, ...]",
    "bytecode": "0x..."
  }
}

The response is identical to the response from generating the NFT contract.

This sample response is compressed.

Last updated