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

200

Token Contract Retrieved

500

Internal Error

get /contracts

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

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

200

Token Contract Updated

201

Token Contract Created

404

Application Credential Not Found

500

Internal Error

post /contracts

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts

Request samples

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

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "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

200

Token Contract Retrieved

500

Internal Error

get /contracts/{contract_address_or_id}

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts/{contract_address_or_id}

Response samples

Content type
application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Get the ERC20 Token Contract's total supply

Authorizations:
path Parameters
contract_address
required
string

Responses

200

Total supply retrieved

500

Internal Error

get /contracts/{contract_address}/totalSupply

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts/{contract_address}/totalSupply

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "totalSupply": "string"
}

Get the Token Contract's name

Authorizations:
path Parameters
contract_address
required
string

Responses

200

Contract name retrieved

500

Internal Error

get /contracts/{contract_address}/name

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts/{contract_address}/name

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "name": "string"
}

Get the Token Contract's symbol

Authorizations:
path Parameters
contract_address
required
string

Responses

200

Contract symbol retrieved

500

Internal Error

get /contracts/{contract_address}/symbol

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts/{contract_address}/symbol

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "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

200

Account balance retrieved

500

Internal Error

get /contracts/{contract_address}/balanceOf/{account_address}

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts/{contract_address}/balanceOf/{account_address}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "balance": "string"
}

Get the account owner of a token_id (ERC721 only)

Authorizations:
path Parameters
contract_address
required
string
token_id
required
string

Responses

200

Token owner retrieved

500

Internal Error

get /contracts/{contract_address}/ownerOf/{token_id}

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts/{contract_address}/ownerOf/{token_id}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "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

200

Token Transfer Complete

500

Internal Error

post /contracts/{contract_address}/transfer

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts/{contract_address}/transfer

Request samples

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

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "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

200

Token Approve Complete

500

Internal Error

post /contracts/{contract_address}/approve

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts/{contract_address}/approve

Request samples

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

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "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

200

Token Minting Complete

500

Internal Error

post /contracts/{contract_address}/mint

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts/{contract_address}/mint

Request samples

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

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "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

200

Token Burning Complete

500

Internal Error

post /contracts/{contract_address}/burn

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts/{contract_address}/burn

Request samples

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

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "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

200

Token Add Minter Complete

500

Internal Error

post /contracts/{contract_address}/addMinter

Each Kaleido service instance gets assigned a unique hostname. The service URL can be obtained from the /status endpoint for that service. E.g: https://console.kaleido.io/api/v1/c/{consortia_id}/e/{environment_id}/services/{service_id}/status

https://service_host/api/v1/contracts/{contract_address}/addMinter

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "minterAddress": "string",
  • "from": "string"
}

Response samples

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