Show the NFT history of a wallet
As non-fungible tokens (NFTs) gain traction in the world of digital assets, it becomes increasingly essential for users to manage and monitor their NFT-related transactions across various blockchain networks. This guide introduces you to obtaining all NFT transactions for a specific wallet, offering a comprehensive view of your NFT wallet history. By leveraging this functionality, you can effectively track the acquisition, transfer, and sale of NFTs associated with your wallet, analyze your trading patterns, and maintain accurate records for tax or accounting purposes. Ultimately, this operation empowers you to take full control of your unique digital assets and navigate the ever-evolving NFT landscape with greater ease and efficiency.
Use the TatumSDK (
@tatumio/tatum
) to get a transaction history of the wallet.TypeScript
JavaScript
curl
1
// yarn add @tatumio/tatum
2
import {TatumSDK, Network, Ethereum, ResponseDto, NftTransaction} from '@tatumio/tatum'
3
4
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
5
6
const txs: ResponseDto<NftTransaction[]> = await tatum.nft.getAllNftTransactionsByAddress({
7
addresses: ['0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d'], // replace with your address
8
})
9
10
console.log(txs.data)
1
// Install with: npm install @tatumio/tatum
2
const { TatumSDK, Network } = require("@tatumio/tatum");
3
4
(async () => {
5
try {
6
const tatum = await TatumSDK.init({ network: Network.ETHEREUM });
7
const txs = await tatum.nft.getAllNftTransactionsByAddress({
8
addresses: ['0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d'], // replace with your address
9
});
10
console.log(txs.data);
11
} catch (error) {
12
console.error("Error fetching wallet history:", error);
13
}
14
})();
1
curl --location --request GET 'https://api.tatum.io/v4/data/transactions?addresses=0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d&chain=ethereum'
[
{
"chain": "ethereum-mainnet",
"hash": "0x3d5dafbb461ae5b1a485756c345779ed7e0a21ca4d8e2d59fb3453a7c38131b9",
"address": "0x727ea45b2eb6abb2badd3dc7106d146e0dc0450d",
"blockNumber": 17029923,
"transactionIndex": 79,
"transactionType": "nft",
"transactionSubtype": "outgoing",
"amount": "-0.2",
"timestamp": 1681278035000,
"counterAddress": "0x64ceaaf5df1be80f29f35589f096f0714f458b40"
}
]
1
interface GetAllNftTransactionsByAddress {
2
/**
3
* Addresses to get NFT transactions from.
4
*/
5
addresses: string[]
6
/**
7
* Token ID
8
*/
9
tokenId: string
10
/**
11
* Token contract address
12
*/
13
tokenAddress: string
14
/**
15
* Optional transaction type. If not specified, both incoming and outgoing transactions are returned.
16
*/
17
transactionType?: 'incoming' | 'outgoing'
18
/**
19
* Optional from block. If not specified, all transactions are returned from the beginning of the blockchain.
20
*/
21
fromBlock?: number
22
/**
23
* Optional to block. If not specified, all transactions are returned up till now.
24
*/
25
toBlock?: number
26
/**
27
* Optional page size. If not specified, the default page size is used, which is 10.
28
*/
29
pageSize?: number
30
/**
31
* Optional page number. If not specified, the first page is returned.
32
*/
33
page?: number
34
}
1
interface ResponseDto<T> {
2
/**
3
* Actual payload of the response
4
*/
5
data: T
6
/**
7
* Status of the response
8
*/
9
status: Status
10
/**
11
* In case of ERROR status, this field contains the error message and detailed description
12
*/
13
error?: ErrorWithMessage
14
}
15
16
interface NftTransaction {
17
/**
18
* Blockchain network
19
*/
20
chain: string
21
/**
22
* Block number
23
*/
24
blockNumber: number
25
/**
26
* Transaction hash
27
*/
28
hash: string
29
/**
30
* Transaction type
31
*/
32
transactionType: 'incoming' | 'outgoing' | 'zero-transfer'
33
/**
34
* Index of the transaction in the block
35
*/
36
transactionIndex: number
37
/**
38
* Address of the token collection
39
*/
40
tokenAddress: string
41
/**
42
* Token ID
43
*/
44
tokenId: string
45
/**
46
* Amount transferred. For outgoing transactions, it's a negative number. For zero-transfer transactions, it's always 0. For incoming transactions, it's a positive number.
47
*/
48
amount: string
49
/**
50
* Transaction timestamp - UTC millis
51
*/
52
timestamp: number
53
/**
54
* Address, on which transaction occurred. This is receiver address for incoming transactions and sender address for outgoing transactions.
55
*/
56
address: string
57
/**
58
* Counter address of the transaction. This is sender address for incoming transactions on `address` and receiver address for outgoing transactions on `address`.
59
*/
60
counterAddress: string
61
}
Network | Support |
---|---|
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai | NFTs (BAYC,...)
ERC-1155 Tokens |
Last modified 8d ago