写了个测试脚本,利用nftport API ,使用脚本mint NFT,完成后可在opensea等平台查看。
在 官网 获取api_key。
1、Deploy your own contract with Deploy a contract for NFT products
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": "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
curl --request GET \
--url 'https://api.nftport.xyz/v0/contracts/...?chain=polygon' \
--header 'Authorization: ...' \
--header 'Content-Type: application/json'
{
"response": "OK",
"chain": "polygon",
"contract_address": "...",
"transaction_hash": "...",
"error": null
}
3、Upload your file to IPFS with Upload a file to IPFS
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": "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
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": "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
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": "OK",
"chain": "polygon",
"contract_address": "...",
"transaction_hash": "...",
"error": null
}
Python code on Github: