The contract API provide users the entries to interact with the ERC721 contracts, including deploying the contracts, setting the sponsors and so on.
Contract Actions
Deploy Contract
The Deploy contract API helps users to deploy a ERC721 or a ERC1155 contract.
Name
Meaning
Param Type
Data Type
Authorization
Bearer Token
Header
string
Name
Meaning
Param Type
Type
Required
Default
name
The name of the NFT
body
string
symbol
The symbol of the NFT
body
string
owner_address
The creater of the contract
body
string
type
The type of the contract, e.g., erc721, erc1155
body
string
base_uri
The uri of the NFT. For ERC721 contract, the token_uri is the base_uri. For ERC1155 contract, the token_uri is the base_uri/ token_id. During minting, if the metadata_uri is not null, the base_uri will be ignored.
body
string
null string
chain
The chain type, which can be conflux or conflux_test
body
string
royalties_bps
The price
of the royalties. When a transferring happens, the projector or creator of the NFT can obtain from the transaction.
body
integer
0
royalties_address
The address of the beneficiary. When a transaferring happens, this address can obtain from the transaction.
body
string
The owner of the contract
tokens_burnable
Whether the function of burning tokens by the token owner is supported
body
bool
false
tokens_transferable_by_admin
Whether the function of transferring tokens by the contract admin is supported
body
bool
false
tokens_transferable_by_user
Whether the function of transferring tokens by contract user is supported
body
bool
false
transfer_cooldown_time
The cooldown time of transfering tokens. Once a transfer transaction is confirmed, the cooldown time must pass before the transfer transaction can be proposed again.
body
integer
false
is_sponsor_for_all_user
Whether the contract can be called by all users free. If the function opens, all uesrs can call the contract free.
The uri of the NFT. For ERC721 contract, the token_uri is the base_uri. For ERC1155 contract, the token_uri is the base_uri/ token_id. During minting, if the metadata_uri is not null, the base_uri will be ignored.
string
address
string
royalties_bps
The price
of the royalties. When a transferring happens, the projector or creator of the NFT can obtain from the transaction.
integer
royalties_address
The address of the beneficiary. When a transaferring happens, this address can obtain from the transaction.
string
tokens_burnable
Whether the function of burning tokens by the token owner is supported
bool
tokens_transferable_by_admin
Whether the function of transferring tokens by the contract admin is supported
bool
tokens_transferable_by_user
Whether the function of transferring tokens by contract user is supported
bool
transfer_cooldown_time
The cooldown time of transfering tokens. Once a transfer transaction is confirmed, the cooldown time must pass before the transfer transaction can be proposed again.
When the API is called successfully, we need to use the id in response to call Query contract detail API to get the contract address. It takes several seconds that the contract address can be obtained from Query contract detail API.
Update contract admin
The Update contract admin API provides users the entry to update the admin of the specific contract.
Good to know: Conflux provides users the sponsor function. Once a contract is sponsored by an account, the accounts in the contract white list can call this contracts for free.
The Set sponsor API provides users to set a sponser for a specific contract according to the sponsor' address.
Name
Meaning
Param Type
Data Type
Authorization
Bearer Token
Header
string
Name
Meaning
Param Type
Data Type
Required
address
The address of the contract
Path
string
chain
The blockchain name: conflux, conflux_test(default)
query
string
auto_sponsor
Whether auto recharge sponsor balance when not enough
query
bool
Name
Meaning
Type
sponsor_gas_tx_id
The id of the sponsor gas setting transaction. gas is used for contract running.
integer
sponsor_collateral_tx_i
The id of the sponsor storage setting transaction. collateral is presented for storage.
The Obtain contarct list API provides users the entry to get the inforamtion of the contracts deployed in a specified app. The parameter page and size are optional parameters.
Name
Meaning
Param Type
Data Type
Authorization
Bearer Token
Header
string
Name
Meaning
Param Type
Data Type
Required
Default
page
Page Query
query
integer
1
limit
Page Query
query
integer
10
Name
Meaning
Type
count
The number of the deployed contracts
integer
items
The contract information
[]Contract
The Contract Struct is listed as follow:
Name
Meaning
Type
created_at
The time of creating the item in the database
string
updated_at
The time of updating the item in the database
string
deleted_at
The time of deleting the item in the database
string
id
The id of the item in the database
integer
app_id
The id of the app
integer
chain_id
The id of the chain. 1029-mainnet, 1-testnet
integer
chain_type
The type of the chain. 1-CFX, 2-ETH
integer
name
The name of the NFT
string
symbol
The symbol of the NFT
string
owner_address
The admin of the contract
string
type
The type of the contract, e.g., erc721, erc1155
string
base_uri
The uri of the NFT. For ERC721 contract, the token_uri is the base_uri. For ERC1155 contract, the token_uri is the base_uri/ token_id. During minting, if the metadata_uri is not null, the base_uri will be ignored.
string
address
The address of the contract
string
royalties_bps
The price
of the royalties. When a transferring happens, the projector or creator of the NFT can obtain from the transaction.
integer
royalties_address
The address of the beneficiary. When a transaferring happens, this address can obtain from the transaction.
string
tokens_burnable
Whether the function of burning tokens by the token owner is supported
bool
tokens_transferable_by_admin
Whether the function of transferring tokens by the contract admin is supported
bool
tokens_transferable_by_user
Whether the function of transferring tokens by contract user is supported
bool
transfer_cooldown_time
The cooldown time of transfering tokens. Once a transfer transaction is confirmed, the cooldown time must pass before the transfer transaction can be proposed again.
integer
status
The status of the transaction. 0-pending, 1-success, 2-failed
The Query detail contract API provides users the entry to get the detail contract information of a specific contract according to the contract's id. The parameter chain is optional, which can be used to choose the test or main network of conflux.
Name
Meaning
Param Type
Data Type
Authorization
Bearer Token
Header
string
Name
Meaning
Param Type
Data Type
Required
id
The id of the contract
Path
integer
Name
Meaning
Type
created_at
The time of creating the item in the database
string
updated_at
The time of updating the item in the database
string
deleted_at
The time of deleting the item in the database
string
id
The id of the item in the database
integer
app_id
The id of the app
integer
chain_id
The id of the chain. 1029-mainnet, 1-testnet
integer
chain_type
The type of the chain. 1-CFX, 2-ETH
integer
name
The name of the NFT
string
symbol
The symbol of the NFT
string
owner_address
The admin of the contract
string
type
The type of the contract, e.g., erc721, erc1155
string
base_uri
The uri of the NFT. For ERC721 contract, the token_uri is the base_uri. For ERC1155 contract, the token_uri is the base_uri/ token_id. During minting, if the metadata_uri is not null, the base_uri will be ignored.
string
address
The address of the contract.
string
royalties_bps
The price
of the royalties. When a transferring happens, the projector or creator of the NFT can obtain from the transaction.
integer
royalties_address
The address of the beneficiary. When a transaferring happens, this address can obtain from the transaction.
string
tokens_burnable
Whether the function of burning tokens by the token owner is supported
bool
tokens_transferable_by_admin
Whether the function of transferring tokens by the contract admin is supported
bool
tokens_transferable_by_user
Whether the function of transferring tokens by contract user is supported
bool
transfer_cooldown_time
The cooldown time of transfering tokens. Once a transfer transaction is confirmed, the cooldown time must pass before the transfer transaction can be proposed again.
integer
status
The status of the transaction. 0-pending, 1-success, 2-failed
The Query sponsor API provides users the entry to get the sponsors of a specific contract according to the contract's address. The parameter chain is optional, which can be used to choose the test or main network of conflux.
Good to know: Conflux Network can be divided into the main network and the test network. The later is used to test the developed functions for developers.
Name
Meaning
Param Type
Data Type
Authorization
Bearer Token
Header
string
Name
Meaning
Param Type
Data Type
Required
address
The address of the sponsor
Path
string
chain
The chain type, which can be conflux or conflux_test
The Query Contract Whitelist API provides users to get the whitelist of the specific contract. Only the addresses in the whitelist can call the contract free.
Name
Meaning
Param Type
Data Type
Authorization
Bearer Token
Header
string
Name
Meaning
Param Type
Data Type
Required
address
The address of the contract
Path
string
Return the slices of the addresses in the whiltelist.
The id of the item in the database, which can be used to
The address of the contract. The response will be null after calling this interface. After several seconds, it can call according to the id.
The status of the transaction. 0-pending, 1-success, 2-failed. The response will be 0 after calling this interface. After several seconds, it can call according to the id.
The hash of the transaction. The response will be null after calling this interface. After several seconds, it can call according to the id.
Error with https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation DeployContract has multiple requestBodies
Error with https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation DeployContract has multiple requestBodies
Error with https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation DeployContract has multiple requestBodies
Error with https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation DeployContract has multiple requestBodies
Error with https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation DeployContract has multiple requestBodies
Error with https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation DeployContract has multiple requestBodies
Error with https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation DeployContract has multiple requestBodies
Error with https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation DeployContract has multiple requestBodies
Error with https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation DeployContract has multiple requestBodies
Error with https://824600799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Ln5WTo00HxQnwIT1nSu%2Fuploads%2Fgit-blob-b7eb9a491644b192bf198732c032444b2d93114f%2Fswagger.json?alt=media: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation DeployContract has multiple requestBodies