new TokenHistoryApi()
- Version:
- 1.0
TokenHistory service.
Methods
getTransfers(opts, callback)
Query received and sent transfers of tokens Query all transaction history. Transaction history is divided into KLAY Transfer (`KlayTransfer`), FT Transfer (`FtTransfer`), NFT Transfer (`NftTransfer`), and MT Transfer (`MtTransfer`). <p></p> ## KlayTransfer in FT/NFT/MT transactions <p></p> For transfers of FTs, NFTs, or MTs, `KlayTransfer` history will also be included in the query result. This is because FT/NFT/MT transfers are essentially execution of a corresponding contract function, and the response for the transfer includes `KlayTransfer`, which is equivalent to the transaction for sending KLAY. Since most transactions that execute contract functions do not usually send KLAY, the `value` of `KlayTransfer` that transfered NT, NFT, and MT may be zero. By using the `exclude-zero-klay=true` query, `KlayTransfer` can be excluded. <p></p> ## Transaction type<p></p> * You can choose KLAY, FT, NFT or MT by setting `kind` parameter to get transaction history of a certain type or a combination of types.<br> * If you don't set the `kind` parameter, all transaction types will be returned.<p></p><br> ## Date range<p></p> * `range` is queried in the form of `range={from},{to}`<br> * `{from}` and `{to}` will be considered Unix time in the case of a decimal number, and block number in the case of a hexadecimal number<br> * When there is no value for `{to}`, current time or the latest block number will be used.<br> * You can retrieve the transaction history from the past 6 months maximum. (for both Unix time and block number)<p></p><br> ## Preset<p></p> Preset is a collection of EOA and FT, NFT and MT contracts. You can use it to repetitively retrieve transaction history for certain accounts quickly and easily.<p></p> * The parameter `presets` is a required parameter.<br> * Preset needs to be created on KAS Console in advance.<br> * You can check your Preset ID on KAS Console. For more information please visit Preset.<p></p><br> ## Size<p></p> * The query parameter `size` is optional. (Min = 1, Max = 1000, Default = 100)<br> * Returns an error when given a negative number<br> * Uses default value (`size=100`) when `size=0`<br> * Uses the maximum value (`size=1000`) when given a value higher than the maximum value.<br>
Parameters:
| Name | Type | Description |
|---|---|---|
opts |
Object | Optional parameters |
callback |
TokenHistoryApi~getTransfersCallback | The callback function, accepting three arguments: error, data, response data is of type: PageableTransfers |
getTransfersByEoa(opts, callback)
Query received and sent transfers of tokens with EOA Query token transaction history for a certain EOA. Functionally, it is same as `GET /v2/transfer`. If the EOA received the token, `to` is same as the EOA, and if the EOA sent the token, `from` is the same as the EOA in the returned transfer object. Transaction history is divided into KLAY transfer (`KlayTransfer`), FT transfer (`FtTransfer`), NFT transfer (`NftTransfer`), MT transfer (`MtTransfer`). For FT, NFT, MT transfers, history of `KlayTransfer` will be included in the result. `KlayTransfer` included in FT, NFT, MT transfers may have a `value` of 0. For more details, please refer to `GET /v2/transfer`.<p></p> ## Transaction type<p></p> * You can set the `kind` parameter to query different types of transactions.<br> * Not setting the `kind` parameter will query all types of transactions.<p></p><br> ## Date range<p></p> * `range` is queried in the form of `range={from},{to}`<br> * `{from}` and `{to}` will be considered Unix time in the case of a decimal number, and block number in the case of a hexadecimal number<br> * When there is no value for `{to}`, current time or the latest block number will be used.<br> * You can retrieve the transaction history from the past 6 months maximum. (for both unix time and block number)<p></p><br> ## Size<p></p> * The query parameter `size` is optional. (Min = 1, Max = 1000, Default = 100)<br> * Returns an error when given a negative number.<br> * Uses default value (`size=100`) when given a 0.<br> * Uses the maximum value (`size=1000`) when given a value higher than 1000.<br>
Parameters:
| Name | Type | Description |
|---|---|---|
opts |
Object | Optional parameters |
callback |
TokenHistoryApi~getTransfersByEoaCallback | The callback function, accepting three arguments: error, data, response data is of type: PageableTransfers |
getTransfersByTxHash(callback)
Query received and sent transfers of tokens with transaction hash Get transaction history by transaction hash. Transaction history is divided into KLAY transfer (`KlayTransfer`), FT transfer (`FtTransfer`), NFT transfer (`NftTransfer`), MT transfer (`MtTransfer`). For FT, NFT, MT transfers, history of `KlayTransfer` will be included in the result. `KlayTransfer` included in FT, NFT, MT transfers may have a `value` of 0. For more details, please refer to `GET /v2/transfer`.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
TokenHistoryApi~getTransfersByTxHashCallback | The callback function, accepting three arguments: error, data, response data is of type: Transfers |
Type Definitions
getTransfersCallback(error, data, response)
Callback function to receive the result of the getTransfers operation.
Parameters:
| Name | Type | Description |
|---|---|---|
error |
String | Error message, if any. |
data |
PageableTransfers | The data returned by the service call. |
response |
String | The complete HTTP response. |
getTransfersByEoaCallback(error, data, response)
Callback function to receive the result of the getTransfersByEoa operation.
Parameters:
| Name | Type | Description |
|---|---|---|
error |
String | Error message, if any. |
data |
PageableTransfers | The data returned by the service call. |
response |
String | The complete HTTP response. |
getTransfersByTxHashCallback(error, data, response)
Callback function to receive the result of the getTransfersByTxHash operation.
Parameters:
| Name | Type | Description |
|---|---|---|
error |
String | Error message, if any. |
data |
Transfers | The data returned by the service call. |
response |
String | The complete HTTP response. |