NFTport API 使用手册
April 18th, 2022

写了个测试脚本,利用nftport API ,使用脚本mint NFT,完成后可在opensea等平台查看。

官网 获取api_key。

avatar
avatar

Mint NFT

1、Deploy your own contract with Deploy a contract for NFT products

Send

curl --request POST \
  --url https://api.nftport.xyz/v0/contracts \
  --header 'Authorization: ...' \
  --header 'Content-Type: application/json' \
  --data '{
  "chain": "polygon",
  "name": "...",
  "symbol": "C",
  "owner_address": "...",
  "metadata_updatable": false,
  "type": "erc721"
}'

Response

{
  "response": "OK",
  "chain": "polygon",
  "transaction_hash": "...",
  "transaction_external_url": "https://polygonscan.com/tx/...",
  "owner_address": "...",
  "name": "...",
  "symbol": "C"
}

2 、Get the Contract_address After a real long time

Send

curl --request GET \
  --url 'https://api.nftport.xyz/v0/contracts/...?chain=polygon' \
  --header 'Authorization: ...' \
  --header 'Content-Type: application/json'

Response

{
  "response": "OK",
  "chain": "polygon",
  "contract_address": "...",
  "transaction_hash": "...",
  "error": null
}

3、Upload your file to IPFS with Upload a file to IPFS

Send

curl --request POST \
  --url https://api.nftport.xyz/v0/files \
  --header 'Authorization: ...' \
  --header 'Content-Type: multipart/form-data' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form file=picture_path

Response

{
  "response": "OK",
  "ipfs_url": "https://ipfs.io/ipfs/...",
  "file_name": "...",
  "content_type": "image/png",
  "file_size": 64856,
  "file_size_mb": 0.0619,
  "error": null
}

4、Create and upload your NFT metadata file with Upload metadata to IPFS

Send

curl --request POST \
  --url https://api.nftport.xyz/v0/metadata \
  --header 'Authorization: ...' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "...",
  "description": "...",
  "file_url": "https://ipfs.io/ipfs/..."
}'

Response

{
  "response": "OK",
  "metadata_uri": "ipfs://...",
  "name": "...",
  "description": "...",
  "file_url": "https://ipfs.io/ipfs/...",
  "external_url": null,
  "animation_url": null,
  "custom_fields": null,
  "attributes": null,
  "error": null
}

5、Mint NFTs to your contract with Customizable minting

Send

curl --request POST \
  --url https://api.nftport.xyz/v0/mints/customizable \
  --header 'Authorization: ...' \
  --header 'Content-Type: application/json' \
  --data '{
  "chain": "polygon",
  "contract_address": "...",
  "metadata_uri": "ipfs://...",
  "mint_to_address": "..."
}'

Response

{
  "response": "OK",
  "chain": "polygon",
  "contract_address": "...",
  "transaction_hash": "...",
  "error": null
}

Python code on Github:

Subscribe to XiaoShin
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.
More from XiaoShin

Skeleton

Skeleton

Skeleton