Code Snippets
Different ways to mint tokens
SDK Coming Soon
With the release of our SDK, you'll be able to easily integrate all features within your framework of choice.
NFT Mint
Minting an ERC721 NFT
This example mints a new ERC721 NFT and sends it directly to the specified user.
curl -X POST https://api.3mint.io/api/v1/mint
-H "Content-Type: application/json"
-H "X-API-KEY: [YOUR_API_KEY]"
-d '{"chain": "polygon",
"network": "mainnet",
"type": "erc721",
"to": "0x958fb436dB50DB2F689C364712113cc226b38151",
"contractAddress": "0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2",
"quantity": 1 // How many NFTs should be minted -- must be positive integer
}'
import axios from 'axios';
// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/mint';
var requestOptions = {
method: 'POST',
url: `${url}`,
headers: {
'Content-Type': 'application/json',
'X-API-KEY': `${apiKey}`
},
data: {
'chain': 'polygon',
'network': 'mainnet',
'type': 'erc721',
'to': '0x958fb436dB50DB2F689C364712113cc226b38151',
'contractAddress': '0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2',
'quantity': 1 // How many NFTs should be minted -- must be positive integer
}
};
axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
Minting an ERC1155 NFT
This example mints a new ERC1155 NFT and sends it directly to the specified user.
curl -X POST https://api.3mint.io/api/v1/mint
-H "Content-Type: application/json"
-H "X-API-KEY: [YOUR_API_KEY]"
-d '{"chain": "polygon",
"network": "mainnet",
"type": "erc1155",
"to": "0x958fb436dB50DB2F689C364712113cc226b38151",
"contractAddress": "0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2",
"tokenId": "1",
"quantity": 1 // How many NFTs should be minted -- must be positive integer
}'
import axios from 'axios';
// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/mint';
var requestOptions = {
method: 'POST',
url: `${url}`,
headers: {
'Content-Type': 'application/json',
'X-API-KEY': `${apiKey}`
},
data: {
'chain': 'polygon',
'network': 'mainnet',
'type': 'erc1155',
'to': '0x958fb436dB50DB2F689C364712113cc226b38151',
'contractAddress': '0x552a43cb61bc127d81b1f280bc39f62e5a51c0c2',
'tokenId': '1',
'quantity': 1 // How many NFTs should be minted -- must be positive integer
}
};
axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
ERC20 Airdrop
Minting an ERC20 token
This example sends an existing ERC20 token directly to the specified user.
curl -X POST https://api.3mint.io/api/v1/mint
-H "Content-Type: application/json"
-H "X-API-KEY: [YOUR_API_KEY]"
-d '{"chain": "polygon",
"network": "mainnet",
"type": "erc20",
"to": "0x958fb436dB50DB2F689C364712113cc226b38151",
"contractAddress": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"quantity": 1.01 // How many tokens should be sent -- must be positive float
}'
import axios from 'axios';
// replace with your 3mint api key
const apiKey = 'demo';
const url = 'https://api.3mint.io/api/v1/mint';
var requestOptions = {
method: 'POST',
url: `${url}`,
headers: {
'Content-Type': 'application/json',
'X-API-KEY': `${apiKey}`
},
data: {
'chain': 'polygon',
'network': 'mainnet',
'type': 'erc20',
'to': '0x958fb436dB50DB2F689C364712113cc226b38151',
'contractAddress': '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',
'quantity': 1.01 // How many tokens should be sent -- must be positive float
}
};
axios(config)
.then(response => console.log(response))
.catch(error => console.log(error));
Last updated