Constructor
new TokenHistory(client, accessOptions)
Creates an instance of token history api.
Parameters:
Name | Type | Description |
---|---|---|
client |
ApiClient | The Api client to use to connect with KAS. |
accessOptions |
AccessOptions | An instance of AccessOptions including |
Members
auth :string
Type:
- string
accessKeyId :string
Type:
- string
secretAccessKey :string
Type:
- string
chainId :string
Type:
- string
accessOptions :AccessOptions
Type:
apiInstances :object
Type:
- object
client :object
Type:
- object
tokenApi :TokenApi
Type:
tokenContractApi :TokenContractApi
Type:
tokenHistoryApi :TokenHistoryApi
Type:
tokenOwnershipApi :TokenOwnershipApi
Type:
Methods
getTransferHistory(presets, queryOptionsopt, callbackopt) → {PageableTransfers}
Gets token transfer history list.
GET /v2/transfer
Example
const query = {
kind: [caver.kas.tokenHistory.queryOptions.kind.KLAY],
size: 1,
range: '1593529200,1599145200',
}
const result = await caver.kas.tokenHistory.getTransferHistory([80], query)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
presets |
Array.<number> | Preset IDs to be used for search, Preset ID can be checked in KAS Console. |
|
queryOptions |
TokenHistoryQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- PageableTransfers
getTransferHistoryByTxHash(transactionHash, callbackopt) → {Transfers}
Token transaction history inquiry with transaction hash.
GET /v2/transfer/tx/{transaction-hash}
Example
const result = await caver.kas.tokenHistory.getTransferHistoryByTxHash('0x063b947b7bc70356ace9644a30188541e345b28e532810d1b80c132882c742ad')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transactionHash |
string | Transaction hash to search transfer history. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- Transfers
getTransferHistoryByAccount(address, queryOptionsopt, callbackopt) → {PageableTransfers}
Search token transfer history of a specific EOA.
GET /v2/transfer/account/{address}
Example
const query = {
kind: [caver.kas.tokenHistory.queryOptions.kind.NFT],
size: 1,
range: '1593529200,1599145200',
caFilter: '0xbbe63781168c9e67e7a8b112425aa84c479f39aa',
}
const result = await caver.kas.tokenHistory.getTransferHistoryByAccount('0x76c6b1f34562ed7a843786e1d7f57d0d7948a6f1', query)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
address |
string | The EOA address used to search for token transfer history. The from or to in the search result matches the suggested address value. |
|
queryOptions |
TokenHistoryQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- PageableTransfers
getFTContractList(queryOptionsopt, callbackopt) → {PageableFtContractDetails}
Retrieve information of all labeled FT contracts.
GET /v2/contract/ft
Example
const query = {
status: caver.kas.tokenHistory.queryOptions.status.COMPLETED,
size: 1,
type: caver.kas.tokenHistory.queryOptions.type.KIP7,
}
const result = await caver.kas.tokenHistory.getFTContractList(query)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
queryOptions |
TokenHistoryQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
getFTContract(ftAddress, callbackopt) → {FtContractDetail}
Retrieves the information of the FT contract labeled with the address of the FT contract.
GET /v2/contract/ft/{ft-address}
Example
const result = await caver.kas.tokenHistory.getFTContract('0x4a29e5f60090a75de0f62c6224e04e0f610ca4af')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
ftAddress |
string | Address of the FT contract for which information is to be retrieved. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FtContractDetail
getNFTContractList(queryOptionsopt, callbackopt) → {PageableNftContractDetails}
Retrieve information of all labeled NFT contracts.
GET /v2/contract/nft
Example
const query = {
status: caver.kas.tokenHistory.queryOptions.status.COMPLETED,
size: 1,
type: caver.kas.tokenHistory.queryOptions.type.KIP17,
}
const result = await caver.kas.tokenHistory.getNFTContractList(query)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
queryOptions |
TokenHistoryQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
getNFTContract(nftAddress, callbackopt) → {NftContractDetail}
Retrieves the information of the NFT contract labeled with the address of the NFT contract.
GET /v2/contract/nft/{nftAddress}
Example
const result = await caver.kas.tokenHistory.getNFTContract('0xbbe63781168c9e67e7a8b112425aa84c479f39aa')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
nftAddress |
string | Address of the NFT contract for which information is to be retrieved. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- NftContractDetail
getNFTList(nftAddress, queryOptionsopt, callbackopt) → {PageableNfts}
Retrieves information of all NFTs issued by a specific NFT contract.
GET /v2/contract/nft/{nft-address}/token
Example
const query = { size: 1 }
const result = await caver.kas.tokenHistory.getNFTList('0xbbe63781168c9e67e7a8b112425aa84c479f39aa', query)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
nftAddress |
string | NFT contract address for which you want to search all issued NFTs. |
|
queryOptions |
TokenHistoryQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- PageableNfts
getNFTListByOwner(nftAddress, ownerAddress, queryOptionsopt, callbackopt) → {PageableNfts}
Among the NFTs issued from the NFT contract address,
the information of the NFT owned by the EOA address received as a parameter is retrieved.
GET /v2/contract/nft/{nft-address}/owner/{owner-address}
Example
const contractAddress = '0xbbe63781168c9e67e7a8b112425aa84c479f39aa'
const ownerAddress = '0xa1c56175bbafaeaac2da534bed2c50079c63344a'
const query = {
size: 1,
cursor: 'PdOALgqNme5a9vJ6KDBAZ4gzwx6alLo1Q5mX7q2Oz2d7e8PrK1Jpwbm9LZ6D0lRxNnvx4BMAVXNE5Qao3kqgWGYOp9rW8Y3GEDM0deNPbKvkJVEz4oXVrY0Wxk1lbp7B'
}
const result = await caver.kas.tokenHistory.getNFTListByOwner(contractAddress, ownerAddress, query)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
nftAddress |
string | Address of the NFT contract to be searched. |
|
ownerAddress |
string | Address of the EOA to be searched. |
|
queryOptions |
TokenHistoryQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- PageableNfts
getNFT(nftAddress, tokenId, callbackopt) → {Nft}
Retrieve information of a specific NFT.
GET /v2/contract/nft/{nft-address}/token/{token-id}
Example
const contractAddress = '0xbbe63781168c9e67e7a8b112425aa84c479f39aa'
const tokenId = '0x7b'
const result = await caver.kas.tokenHistory.getNFT(contractAddress, tokenId)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
nftAddress |
string | Address of the NFT contract to be searched. |
|
tokenId |
string | number | Token id to be searched. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- Nft
getNFTOwnershipHistory(nftAddress, tokenId, queryOptionsopt, callbackopt) → {PageableNftOwnershipChanges}
Retrieve the record of ownership changes for a specific NFT.
GET /v2/contract/nft/{nft-address}/token/{token-id}/history
Example
const result = await caver.kas.tokenHistory.getNFTOwnershipHistory('0xbbe63781168c9e67e7a8b112425aa84c479f39aa', '0x7b')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
nftAddress |
string | Address of the NFT contract to be searched. |
|
tokenId |
string | number | Token id to be searched. |
|
queryOptions |
TokenHistoryQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
getMTContractList(queryOptionsopt, callbackopt) → {PageableFtContractDetails}
Retrieve information of all labeled MT contracts.
GET /v2/contract/mt
Example
// without query parameter
const ret = await caver.kas.tokenHistory.getMTContractList()
// with query parameter
const ret = await caver.kas.tokenHistory.getMTContractList({
status: caver.kas.tokenHistory.queryOptions.status.COMPLETED,
size: 1,
type: caver.kas.tokenHistory.queryOptions.type.KIP37,
cursor: 'eyJjc...',
})
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
queryOptions |
TokenHistoryQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
getMTContract(mtAddress, callbackopt) → {MtContractDetail}
Retrieves a labeled MT contract information.
GET /v2/contract/mt/{mt-address}
Example
const ret = await caver.kas.tokenHistory.getMTContract('0x219f6f9a47ced24c0451dd80ff97d6feca4533c0')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
mtAddress |
string | Address of the MT contract for which information is to be retrieved. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- MtContractDetail
getMTListByOwner(mtAddress, ownerAddress, queryOptionsopt, callbackopt) → {PageableMtTokensWithBalance}
Lists all tokens of a MT contract that are owned by the queried EOA address.
GET /v2/contract/mt/{mt-address}/owner/{owner-address}
Example
const mtContractAddress = '0x219f6f9a47ced24c0451dd80ff97d6feca4533c0'
const owner = '0xb8bb4b109f18eb6f292757aaec623200f1a41369'
// without query parameter
const ret = await caver.kas.tokenHistory.getMTListByOwner(mtContractAddress, owner)
// with query parameter
const ret = await caver.kas.tokenHistory.getMTListByOwner(mtContractAddress, owner, { size: 1, cursor: 'eyJjc...' })
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
mtAddress |
string | Address of the MT contract to be searched. |
|
ownerAddress |
string | Address of the account. |
|
queryOptions |
TokenHistoryQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
getMT(mtAddress, ownerAddress, tokenId, callbackopt) → {MtToken}
Retrieves a specific MT information.
GET /v2/contract/mt/{mt-address}/owner/{owner-address}/token/{token-id}
Example
const mtContractAddress = '0x219f6f9a47ced24c0451dd80ff97d6feca4533c0'
const owner = '0xb8bb4b109f18eb6f292757aaec623200f1a41369'
// with token id in hex
const ret = await caver.kas.tokenHistory.getMT(mtContractAddress, owner, '0x0')
// with token id in number
const ret = await caver.kas.tokenHistory.getMT(mtContractAddress, owner, 0)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
mtAddress |
string | Address of the MT contract to be searched. |
|
ownerAddress |
string | Address of the account. |
|
tokenId |
string | number | Token id to be searched. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- MtToken
getMTOwnerListByTokenId(mtAddress, tokenId, queryOptionsopt, callbackopt) → {PageableMtTokens}
Lists all EOA addresses who own the queried MT.
GET /v2/contract/mt/{mt-address}/token/{token-id}
Example
const mtContractAddress = '0x219f6f9a47ced24c0451dd80ff97d6feca4533c0'
// with query parameter and token id in hex
const ret = await caver.kas.tokenHistory.getMTOwnerListByTokenId(mtContractAddress, '0x0')
// without query parameter and with token id in number
const ret = await caver.kas.tokenHistory.getMTOwnerListByTokenId(mtContractAddress, 0, { size: 1, cursor: 'eyJjc...' })
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
mtAddress |
string | Address of the MT contract to be searched. |
|
tokenId |
string | number | Token id to be searched. |
|
queryOptions |
TokenHistoryQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- PageableMtTokens