Update a Token

If a token is yet to be deployed, you can alter and update its details. To accomplish this, send a PATCH request to the Playfix API's /token endpoint.

Update an existing token.

PATCH https://api.playfix.io/token/<token_name>

Path Parameters

Name
Type
Description

token_name*

String

An automatically generated token name. This will start with a prefix of "tokens/" followed by a ULID.

Example: tokens/01gfrf15n9hqw3v08sqearsgh9

Headers

Name
Type
Description

Authorization*

String

Bearer <your_access_token>

Request Body

Name
Type
Description

project

String

The name of the project that will contain the token.

title

String

The title of the token.

config

Object

Configuration options for the token.

config.symbol

String

A shorthand symbol to refer to the token. Choose a short, uppercase word between 3-5 characters that is unique within your project.

config.decimals

String

A non-negative integer that specifies the number of digits after the decimal point of a unit token. 18 is the standard and recommended decimal for ERC-20 tokens, but you can choose any number from 0 upwards.

config.initialSupply

String

A positive integer specifying the number of tokens that will be minted for a start.

config.totalSupply

String

A positive integer specifying the fixed total number of tokens that can ever exist. The value can either be greater than or equal to the initialSupply.

config.mintable

boolean

Set to true to allow minting of new tokens.

config.burnable

boolean

Set to true to allow burning of tokens.

config.permit

boolean

Set to true to allow gasless approval of tokens.

config.pausable

boolean

Set to true to allow the pausing of token transfers.

config.votes

boolean

Set to true to enable using token for voting.

config.flashMinting

boolean

Set to true to allow flash minting.

config.snapshots

boolean

Set to true to allow snapshots of token balances for easy querying in the future.

config.ownerAddress

String

Wallet address of the contract owner. which receives the initial token supply.

network

String

Name of the network where the token will be deployed. Accepted values include:

NETWORK_ETHEREUM,

NETWORK_ETHEREUM_RINKERBY,

NETWORK_POLYGON, or NETWORK_POLYGON_MUMBAI .

{
  "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_ETHEREUM",
  "address": "",
  "deployTxHash": ""
}

Example cURL API Call

curl --request PATCH \
  --url 'https://api.playfix.io/token/<token_name>' \
  --header 'Authorization: Bearer <your_access_token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
    "project": "projects/01gfav9m1c4zd6eq154th2pafz",
    "title": "The Block Party Game 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_ETHEREUM"
    }'

Example Python API Call

import requests
import json

payload = {
    "project": "projects/01gfav9m1c4zd6eq154th2pafz",
    "title": "The Block Party Game 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_ETHEREUM",
    }

r = requests.patch(
    "https://api.playfix.io/token/<token_name>",
    headers = {
        "Authorization": "Bearer <your_access_token>",
        "Accept": "application/json",
        "Content-Type": "application/json"
        },
    data = json.dumps(payload)
    )

print(r.text)

Replace <your_token_name> with the value of name from the response of the token creation process.

Example: tokens/01gfrf15n9hqw3v08sqearsgh9

Response

{
  "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_ETHEREUM",
  "address": "",
  "deployTxHash": ""
}

You can only update a token details if it is yet to be deployed.

Last updated