TokenHistory

TokenHistory

A warpping class that connects TokenHistory API.

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 chainId, accessKeyId and secretAccessKey.

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

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. kind, range, size, and cursor.

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}

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}

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. kind, caFilter, range, size, and cursor.

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

Parameters:
Name Type Attributes Description
queryOptions TokenHistoryQueryOptions <optional>

Filters required when retrieving data. status, type, size, and cursor.

callback function <optional>

The callback function to call.

Returns:
Type
PageableFtContractDetails

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}

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

Parameters:
Name Type Attributes Description
queryOptions TokenHistoryQueryOptions <optional>

Filters required when retrieving data. status, type, size, and cursor.

callback function <optional>

The callback function to call.

Returns:
Type
PageableNftContractDetails

getNFTContract(nftAddress, callbackopt) → {NftContractDetail}

Retrieves the information of the NFT contract labeled with the address of the NFT contract.
GET /v2/contract/nft/{nftAddress}

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

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. size, and cursor.

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}

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. size, and cursor.

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}

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

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. size, and cursor.

callback function <optional>

The callback function to call.

Returns:
Type
PageableNftOwnershipChanges

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. status, type, size, and cursor.

callback function <optional>

The callback function to call.

Returns:
Type
PageableFtContractDetails

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. size, and cursor.

callback function <optional>

The callback function to call.

Returns:
Type
PageableMtTokensWithBalance

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. size, and cursor.

callback function <optional>

The callback function to call.

Returns:
Type
PageableMtTokens