new KIP17Api()
- Version:
- 1.0
KIP17 service.
Methods
approveAll(xChainId, contractAddressOrAlias, opts, callback)
ApproveAll
Approves an EOA, to
, to perform token operations on all token of a contract which from
owns.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
xChainId |
String | Klaytn network chain ID, one of [1001, 8217] |
||||||
contractAddressOrAlias |
String | Contract address (hexadecimal, starting with 0x) or alias |
||||||
opts |
Object | Optional parameters Properties
|
||||||
callback |
KIP17Api~approveAllCallback | The callback function, accepting three arguments: error, data, response data is of type: Kip17TransactionStatusResponse |
approveToken(xChainId, contractAddressOrAlias, tokenId, opts, callback)
ApproveToken
Approves an EOA, to
, to perform token operations on a particular token of a contract which from
owns. If from
is not the owner, then the transaction submitted from this API will be reverted.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
xChainId |
String | Klaytn network chain ID; one of [1001, 8217] |
||||||
contractAddressOrAlias |
String | Contract address (hexadecimal, starting with 0x) or alias |
||||||
tokenId |
String | Token ID to approve the 3rd party to transfer |
||||||
opts |
Object | Optional parameters Properties
|
||||||
callback |
KIP17Api~approveTokenCallback | The callback function, accepting three arguments: error, data, response data is of type: Kip17TransactionStatusResponse |
burnToken(xChainId, contractAddressOrAlias, tokenId, opts, callback)
BurnToken
Burns a token. If from
is not the owner or has been approved for this operation, then the transaction submitted from this API will be reverted.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
xChainId |
String | Klaytn network chain ID; one of [1001, 8217] |
||||||
contractAddressOrAlias |
String | Contract address or unique alias |
||||||
tokenId |
String | Token ID to burn |
||||||
opts |
Object | Optional parameters Properties
|
||||||
callback |
KIP17Api~burnTokenCallback | The callback function, accepting three arguments: error, data, response data is of type: Kip17TransactionStatusResponse |
deployContract(xChainId, opts, callback)
DeployContract Deploys a new KIP-17 contract with user submitted parameters.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
xChainId |
String | Klaytn network chain ID; one of [1001, 8217] |
||||||
opts |
Object | Optional parameters Properties
|
||||||
callback |
KIP17Api~deployContractCallback | The callback function, accepting three arguments: error, data, response data is of type: Kip17TransactionStatusResponse |
getContract(xChainId, contractAddressOrAlias, callback)
GetContract Retrieves KIP-17 contract information by either contract address or alias.
Parameters:
Name | Type | Description |
---|---|---|
xChainId |
String | Klaytn network chain ID; one of [1001, 8217] |
contractAddressOrAlias |
String | Contract address (hexadecimal, starting with 0x) or alias |
callback |
KIP17Api~getContractCallback | The callback function, accepting three arguments: error, data, response data is of type: Kip17ContractInfoResponse |
getOwnerTokens(xChainId, contractAddressOrAlias, ownerAddress, opts, callback)
GetOwnerTokens
Lists all tokens of the same owner (owner-address
) of a contract.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
xChainId |
String | Klaytn network chain ID |
|||||||||
contractAddressOrAlias |
String | Contract address (hexadecimal, starting with 0x) or alias |
|||||||||
ownerAddress |
String | Token owner address |
|||||||||
opts |
Object | Optional parameters Properties
|
|||||||||
callback |
KIP17Api~getOwnerTokensCallback | The callback function, accepting three arguments: error, data, response data is of type: GetOwnerKip17TokensResponse |
getToken(xChainId, contractAddressOrAlias, tokenId, callback)
GetToken Retrieves the requested token information of a parcitular KIP-17 contract.
Parameters:
Name | Type | Description |
---|---|---|
xChainId |
String | Klaytn network chain ID |
contractAddressOrAlias |
String | Contract address or unique alias |
tokenId |
String | Token ID to retreive |
callback |
KIP17Api~getTokenCallback | The callback function, accepting three arguments: error, data, response data is of type: GetKip17TokenResponse |
getTokenHistory(xChainId, contractAddressOrAlias, tokenId, opts, callback)
GetTokenHistory Lists token transfer histories starting from the time the requested token was minted, where each entry of the response items shows a transfer record.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
xChainId |
String | Klaytn network chain ID |
|||||||||
contractAddressOrAlias |
String | Contract address (hexadecimal, starting with 0x) or alias |
|||||||||
tokenId |
String | Token ID |
|||||||||
opts |
Object | Optional parameters Properties
|
|||||||||
callback |
KIP17Api~getTokenHistoryCallback | The callback function, accepting three arguments: error, data, response data is of type: GetKip17TokenHistoryResponse |
listContractsInDeployerPool(xChainId, opts, callback)
ListContractsInDeployerPool Lists all contracts deployed in the requested deployer pool. If the pool is not specified, the default pool will be queried.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
xChainId |
String | Klaytn network chain ID; one of [1001, 8217] |
|||||||||
opts |
Object | Optional parameters Properties
|
|||||||||
callback |
KIP17Api~listContractsInDeployerPoolCallback | The callback function, accepting three arguments: error, data, response data is of type: Kip17ContractListResponse |
listTokens(xChainId, contractAddressOrAlias, opts, callback)
ListTokens Lists all tokens minted from a particular KIP-17 contract. Use contract address or alias to query the contract.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
xChainId |
String | Klaytn network chain ID |
|||||||||
contractAddressOrAlias |
String | Contract address (hexadecimal, starting with 0x) or alias |
|||||||||
opts |
Object | Optional parameters Properties
|
|||||||||
callback |
KIP17Api~listTokensCallback | The callback function, accepting three arguments: error, data, response data is of type: Kip17TokenListResponse |
mintToken(xChainId, contractAddressOrAlias, opts, callback)
MintToken Mints a new token on the requested KIP-17 contract. The target contract can be requested by either contract address or alias.
Do not mint a token to an address outside of account pools you control. KIP-17 APIs only allow actions among accounts populated within the KAS account pools that you own.Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
xChainId |
String | Klaytn network chain ID; one of [1001, 8217] |
||||||
contractAddressOrAlias |
String | Contract address (hexadecimal, starting with 0x) or alias |
||||||
opts |
Object | Optional parameters Properties
|
||||||
callback |
KIP17Api~mintTokenCallback | The callback function, accepting three arguments: error, data, response data is of type: Kip17TransactionStatusResponse |
transferToken(xChainId, contractAddressOrAlias, tokenId, opts, callback)
TransferToken
Transfers a token. If sender
and owner
are not the same, then sender
must have been approved for this token transfer.
krn:*:kip17:*:account-pool:*
makes sure the API caller has the right to invoke transfer method on the requested contract. Although contracts in Klaytn are publicly available and anyone who knows the address can invoke the contract functions, if the contract owner does not reveal the address, it would be difficult to even find out the address as it requires indirect measures such as observing network communication. To this end, as we do not know whether the address has been publicly advertised or not, KIP-17 API assumes that only the contract owner invokes contract functions. - The second KRN is for the sender
, and must be formatted as krn:*:wallet:*:account-pool:*
. Currently, KIP-17 API only allows transferring tokens among accounts populated in KAS Wallet account pools. - As all other APIs, leavning x-krn
empty automatically fills the field with default values.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
xChainId |
String | Klaytn network chain ID; one of [1001, 8217] |
||||||
contractAddressOrAlias |
String | Contract address (hexadecimal, starting with 0x) or alias |
||||||
tokenId |
String | Token ID |
||||||
opts |
Object | Optional parameters Properties
|
||||||
callback |
KIP17Api~transferTokenCallback | The callback function, accepting three arguments: error, data, response data is of type: Kip17TransactionStatusResponse |
Type Definitions
approveAllCallback(error, data, response)
Callback function to receive the result of the approveAll operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
Kip17TransactionStatusResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |
approveTokenCallback(error, data, response)
Callback function to receive the result of the approveToken operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
Kip17TransactionStatusResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |
burnTokenCallback(error, data, response)
Callback function to receive the result of the burnToken operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
Kip17TransactionStatusResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |
deployContractCallback(error, data, response)
Callback function to receive the result of the deployContract operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
Kip17TransactionStatusResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |
getContractCallback(error, data, response)
Callback function to receive the result of the getContract operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
Kip17ContractInfoResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |
getOwnerTokensCallback(error, data, response)
Callback function to receive the result of the getOwnerTokens operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
GetOwnerKip17TokensResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |
getTokenCallback(error, data, response)
Callback function to receive the result of the getToken operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
GetKip17TokenResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |
getTokenHistoryCallback(error, data, response)
Callback function to receive the result of the getTokenHistory operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
GetKip17TokenHistoryResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |
listContractsInDeployerPoolCallback(error, data, response)
Callback function to receive the result of the listContractsInDeployerPool operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
Kip17ContractListResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |
listTokensCallback(error, data, response)
Callback function to receive the result of the listTokens operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
Kip17TokenListResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |
mintTokenCallback(error, data, response)
Callback function to receive the result of the mintToken operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
Kip17TransactionStatusResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |
transferTokenCallback(error, data, response)
Callback function to receive the result of the transferToken operation.
Parameters:
Name | Type | Description |
---|---|---|
error |
String | Error message, if any. |
data |
Kip17TransactionStatusResponse | The data returned by the service call. |
response |
String | The complete HTTP response. |