API Reference for the Token Factory Service (1.0)

Download OpenAPI specification:Download

Token Factory service makes it trivial to generate and deploy token smart contracts for token specifications ERC20 (for fungible tokens) and ERC721 (for non-fungible tokens). Token Contracts manage the total supply, ownership, transfers, delegate spenders, as well as minting and burning tokens.

tokenfactory

Authentication

app_creds

Kaleido API for marketplace services are authenticated using application credentials. The username and password must be created in the environment containing the service instance as "Application Credentials". For more details see the documentation on App Credentials.

Security Scheme Type HTTP
HTTP Authorization Scheme basic

Contracts

Get the Token Contracts

Authorizations:

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create / update a Token Contract

Authorizations:
Request Body schema: application/json
name
required
string

User defined name for the token contract

symbol
required
string

User defined ticker symbol for the token contract

type
required
string

The type of token contract to create (erc20 or erc721)

supply
string

The initial supply of tokens (erc20 only)

burnable
boolean
mintable
boolean
deploy
boolean

Set to true to deploy the contract to the chain

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "symbol": "string",
  • "type": "string",
  • "supply": "string",
  • "burnable": true,
  • "mintable": true,
  • "deploy": true
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "symbol": "string",
  • "type": "string",
  • "supply": "string",
  • "burnable": true,
  • "mintable": true,
  • "deploy": true,
  • "_id": "string",
  • "address": "string",
  • "from": "string",
  • "created_at": "string",
  • "updated_at": "string"
}

Get the Token Contract by address or id

Authorizations:
path Parameters
contract_address_or_id
required
string

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get the ERC20 Token Contract's total supply

Authorizations:
path Parameters
contract_address
required
string

Responses

Response samples

Content type
application/json
{
  • "totalSupply": "string"
}

Get the Token Contract's name

Authorizations:
path Parameters
contract_address
required
string

Responses

Response samples

Content type
application/json
{
  • "name": "string"
}

Get the Token Contract's symbol

Authorizations:
path Parameters
contract_address
required
string

Responses

Response samples

Content type
application/json
{
  • "symbol": "string"
}

Get the balance of an account for a given Token Contract

Authorizations:
path Parameters
contract_address
required
string
account_address
required
string

Responses

Response samples

Content type
application/json
{
  • "balance": "string"
}

Get the account owner of a token_id (ERC721 only)

Authorizations:
path Parameters
contract_address
required
string
token_id
required
string

Responses

Response samples

Content type
application/json
{
  • "address": "string"
}

Transfer tokens to an account

Authorizations:
path Parameters
contract_address
required
string
Request Body schema: application/json
toAddress
required
string

The address to transfer to

amount
string

The amount of tokens to transfer (erc20 only)

tokenId
string

The tokenId to transfer (erc721 only)

from
string

The address used to sign the transfer transaction

fromAddress
required
string

The address to transfer from

Responses

Request samples

Content type
application/json
{
  • "toAddress": "string",
  • "amount": "string",
  • "tokenId": "string",
  • "from": "string",
  • "fromAddress": "string"
}

Response samples

Content type
application/json
{
  • "blockHash": "string",
  • "blockNumber": 0,
  • "contractAddress": "string",
  • "cumulativeGasUsed": 0,
  • "from": "string",
  • "gasUsed": 0,
  • "logs":
    [
    ],
  • "logsBloom": "string",
  • "status": true,
  • "to": "string",
  • "transactionHash": "string",
  • "transactionNumber": "string"
}

Approve an account as a spender

Authorizations:
path Parameters
contract_address
required
string
Request Body schema: application/json
spenderAddress
required
string

The address to allow as a spender

amount
string

The amount of tokens to allocate to the spender (erc20 only)

tokenId
string

The tokenId to allocate to the spender (erc721 only)

from
required
string

The address used to sign the approve transaction

Responses

Request samples

Content type
application/json
{
  • "spenderAddress": "string",
  • "amount": "string",
  • "tokenId": "string",
  • "from": "string"
}

Response samples

Content type
application/json
{
  • "blockHash": "string",
  • "blockNumber": 0,
  • "contractAddress": "string",
  • "cumulativeGasUsed": 0,
  • "from": "string",
  • "gasUsed": 0,
  • "logs":
    [
    ],
  • "logsBloom": "string",
  • "status": true,
  • "to": "string",
  • "transactionHash": "string",
  • "transactionNumber": "string"
}

Mint tokens

Authorizations:
path Parameters
contract_address
required
string
Request Body schema: application/json
toAddress
required
string

The address to mint to

amount
string

The amount of tokens to mint (erc20 only)

tokenId
string

The tokenId to mint (erc721 only)

tokenURI
string

The tokenURI for the tokenId (erc721 only)

from
required
string

The address used to sign the mint transaction

Responses

Request samples

Content type
application/json
{
  • "toAddress": "string",
  • "amount": "string",
  • "tokenId": "string",
  • "tokenURI": "string",
  • "from": "string"
}

Response samples

Content type
application/json
{
  • "blockHash": "string",
  • "blockNumber": 0,
  • "contractAddress": "string",
  • "cumulativeGasUsed": 0,
  • "from": "string",
  • "gasUsed": 0,
  • "logs":
    [
    ],
  • "logsBloom": "string",
  • "status": true,
  • "to": "string",
  • "transactionHash": "string",
  • "transactionNumber": "string"
}

Burn tokens

Authorizations:
path Parameters
contract_address
required
string
Request Body schema: application/json
amount
string

The amount of tokens to burn (erc20 only)

tokenId
string

The tokenId to burn (erc721 only)

from
required
string

The address used to sign the burn transaction

fromAddress
string

The address to burn tokens from

Responses

Request samples

Content type
application/json
{
  • "amount": "string",
  • "tokenId": "string",
  • "from": "string",
  • "fromAddress": "string"
}

Response samples

Content type
application/json
{
  • "blockHash": "string",
  • "blockNumber": 0,
  • "contractAddress": "string",
  • "cumulativeGasUsed": 0,
  • "from": "string",
  • "gasUsed": 0,
  • "logs":
    [
    ],
  • "logsBloom": "string",
  • "status": true,
  • "to": "string",
  • "transactionHash": "string",
  • "transactionNumber": "string"
}

Add a minter account

Authorizations:
path Parameters
contract_address
required
string
Request Body schema: application/json
minterAddress
required
string

The address to add as a minter

from
required
string

The address used to sign the burn transaction

Responses

Request samples

Content type
application/json
{
  • "minterAddress": "string",
  • "from": "string"
}

Response samples

Content type
application/json
{
  • "blockHash": "string",
  • "blockNumber": 0,
  • "contractAddress": "string",
  • "cumulativeGasUsed": 0,
  • "from": "string",
  • "gasUsed": 0,
  • "logs":
    [
    ],
  • "logsBloom": "string",
  • "status": true,
  • "to": "string",
  • "transactionHash": "string",
  • "transactionNumber": "string"
}