Deploy a Token
After creating a token and generating a smart contract for it, you need to deploy the token smart contract.
You will send a POST request to the /token
endpoint, using the :deploy
method to deploy the contract.
Deploy the token contract.
POST
https://api.playfix.io/token/<token_name>:deploy
Path Parameters
token_name*
String
An automatically generated token name
. This will start with a prefix of "tokens/" followed by a ULID.
Example: tokens/01gfrf15n9hqw3v08sqearsgh9
Headers
Authorization*
String
Bearer <your_bearer_token>
Request Body
clientSide*
Object
Client side configuration for deploying the token contract.
clientSide.address*
String
The smart contract address; automatically generated by MetaMask.
{
"token": {
"name": "<token_name>",
"project": "projects/01gfav9m1c4zd6eq154th2pafz",
"title": "The Block Party Token",
"config": {
"name": "Blocked",
"symbol": "BPT",
"decimals": "18",
"initialSupply": "1000",
"totalSupply": "10000",
"mintable": true,
"burnable": true,
"pausable": true,
"permit": true,
"votes": true,
"flashMinting": true,
"snapshots": true,
"ownerAddress": "<your_wallet_address>"
},
"network": "NETWORK_POLYGON_MUMBAI",
"address": "0x9979D2e15776ABe9a43d6762Df71D0693aDfFE4D",
"deployTxHash": ""
}
}
Example cURL API Call
curl --request POST \
--url https://api.playfix.io/token/<token_name>:deploy \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <your_access_token>' \
--header 'Content-Type: application/json' \
--data '{
"clientSide": {
"network": "NETWORK_POLYGON",
"address": "0x9979D2e15776ABe9a43d6762Df71D0693aDfFE4D",
"txHash":"0x0000000000000000000000000000000000000000000000000000000000000000"
}
}'
Example Python API Call
import requests
import json
token = "<token_name>"
payload = {
"clientSide": {
"network": "NETWORK_POLYGON",
"address": "0x9979D2e15776ABe9a43d6762Df71D0693aDfFE4D",
"txHash":"0x0000000000000000000000000000000000000000000000000000000000000000"
}
}
r = requests.post(
"https://api.playfix.io/token/" + token + ":deploy",
headers = {
"Authorization": "Bearer <your_access_token>",
"Accept": "application/json",
"Content-Type": "application/json"
},
data = json.dumps(payload)
)
print(r.text)
Request Body
clientSide
: An object containing the configurations for deploying the token smart contract using MetaMask.network
: The network where the token will be deployed.address
: The smart contract address. This is automatically generated by MetaMask.txHash
: A temporary transaction hash generated by MetaMask.
Response
{
"token": {
"name": "<token_name>",
"project": "projects/01gfav9m1c4zd6eq154th2pafz",
"title": "The Block Party Token",
"config": {
"name": "Blocked",
"symbol": "BPT",
"decimals": "18",
"initialSupply": "1000",
"totalSupply": "10000",
"mintable": true,
"burnable": true,
"pausable": true,
"permit": true,
"votes": true,
"flashMinting": true,
"snapshots": true,
"ownerAddress": "<your_wallet_address>"
},
"network": "NETWORK_POLYGON_MUMBAI",
"address": "0x9979D2e15776ABe9a43d6762Df71D0693aDfFE4D",
"deployTxHash": ""
}
}
Last updated