Links

nft_approvalForAll

Get historical events for NFT approval at any address without scanning the entire chain.
Through nft_approvalForAll, you can fetch all the approvalForAll events happening in specified contract, contractAddress is necessary. If you specify the contract address and account address, the API will return all the approvalForAll events of that collection which the account address has.
Supported on Ethereum, BNB Chain, Optimism, and Arbitrum.

Parameters

Object - An object with the following fields (required):
  • contractAddress(hex string, required) - the contract address of the collection. BlockVision currently support both ERC721 and ERC1155.
  • accountAddress(hex string, optional) - the account address you want to query.
  • fromBlockNumber(integer number, optional) - the starting time range you want to fetch events over.
  • toBlockNumber(integer number, optional) - the ending time range you want to fetch events over.
  • fromAddress(hex string, optional) - the sending address in the transaction.
  • toAddress(hex string, optional) - the receiving address in the transaction.
  • pageSize(integer number, optional, default 20 max 50) - max number of results to return per call.
  • pageIndex(integer number, optional, default 1) - page index.

Returns

Object - An object with the following fields:
  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • result(object) - an object with the following fields:
    • data(array of object, defined below) - response data, sorted in ascending order by block number.
  • Object schema:
    • blockNumber(integer number) - the block where the transfer occurred.
    • txHash(hex string) - transaction hash.
    • blockHash(hex string) - block hash.
    • logIndex(integer number) - event index.
    • contractAddress(hex string) - contract address.
    • approved(hex string) - approved address.
    • owner(hex string) - owner address.

Example

Request

curl
TypeScript
curl https://api.blockvision.org/v1/<api key> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "nft_approvalForAll",
"params": {
"fromBlockNumber": 0,
"toBlockNumber": 0,
"fromAddress":"",
"toAddress":"",
"contractAddress":"0x495f947276749Ce646f68AC8c248420045cb7b5e",
"pageSize": 5,
"pageIndex": 1
}
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.ETH_MAINNET)
// Access the BlockVision NFT API
bv.getNFTApprovalForAll({
fromBlockNumber: 0,
toBlockNumber: 0,
fromAddress: '',
toAddress: '',
contractAddress: '0x495f947276749Ce646f68AC8c248420045cb7b5e'
}).then(console.log)

Result

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"data": [
{
"contractAddress": "0xad9Fd7cB4fC7A0fBCE08d64068f60CbDE22Ed34C",
"blockNumber": 14796442,
"txHash": "0x7d9e081e5c48397857be29bd1a547ff77bf8d07c66654b2a62628ef874419d6a",
"blockHash": "0x4b99cae3954e7068dc15d140a4ac491eaf61679a562eb17d3239e1ef34e04390",
"logIndex": "127",
"owner": "0x56d52773286B34AD69b9a8e175539F2e067b87d6",
"approved": "1"
},
{
"contractAddress": "0xad9Fd7cB4fC7A0fBCE08d64068f60CbDE22Ed34C",
"blockNumber": 14795704,
"txHash": "0xb41f219d9389b2fa2c93bd82720cd9ec19f07b476aafe1abad0d29f377d9db48",
"blockHash": "0x201d6b26bcb81e65b5e1aa0ba0c6819d3146b7c5cad4304cbd3fd171f6b9ff7a",
"logIndex": "46",
"owner": "0x592d22fd5A6d36aA64F018b5051288D7AA3AcAe0",
"approved": "1"
},
{
"contractAddress": "0xad9Fd7cB4fC7A0fBCE08d64068f60CbDE22Ed34C",
"blockNumber": 14794781,
"txHash": "0xddcf90c8f5e96c462cee5f2deb1c4b6f279e236987a2432450aeab44a3991a08",
"blockHash": "0xdb140a4afeb25d36f148478e7c8d5428808f61d059ea8be941c01405f5dfebbb",
"logIndex": "151",
"owner": "0x1b2a21A03843f3545B00E9Ba0d3065F85E2c28aA",
"approved": "1"
},
{
"contractAddress": "0xad9Fd7cB4fC7A0fBCE08d64068f60CbDE22Ed34C",
"blockNumber": 14792765,
"txHash": "0x394db818149a3b54bb4b76e57286e7d2f10c0715f5116519d8219c45b737737a",
"blockHash": "0xa7c6aac6fe0d1ca80febc111da42f4475205c92f730b9387a50b0fd8f833a983",
"logIndex": "28",
"owner": "0x39a8365b060C5B099B874aE8Fd99520426a8D6Cb",
"approved": "1"
},
{
"contractAddress": "0xad9Fd7cB4fC7A0fBCE08d64068f60CbDE22Ed34C",
"blockNumber": 14792765,
"txHash": "0x98c92ce9d9b6a954f242b509684ebf96cfc8e73f924f82bebcf8548b2df66764",
"blockHash": "0xa7c6aac6fe0d1ca80febc111da42f4475205c92f730b9387a50b0fd8f833a983",
"logIndex": "21",
"owner": "0x39a8365b060C5B099B874aE8Fd99520426a8D6Cb",
"approved": "1"
}
],
"nextPageIndex": 2
}
}