watch_getTransfersByAddress
This method is needed to watch all transfers to certain addresses and other filters. It can be useful to receive historical wallet transfers
Parameters
Object - An object with the following fields
- 1.
addresses
:DATA
, 20 Bytes - a user address (i.e.0x1a2b3x...
) or array of user addresses. - 2.
fromBlock
(optional):QUANTITY
- the minimum block number from where to get the transactions - 3.
toBlock
(optional):QUANTITY
- the maximum block number from where to get the transactions. - 4.
transferType
(optional):DATA
- transfer type(trx/erc20/erc721)
- 5.
transferDirection
(optional):DATA
- transfer direction(from/to)
- 6.
contractAddresses
(optional):DATA
, 20 Bytes - contract address (i.e.0x1a2b3x
) or list of contract addresses. - 7.
offset
(optional):QUANTITY
- offset. - 8.
limit
(optional):QUANTITY
- limit
"params": [
{
"addresses": "0x123f96bc8edcb73bd5b8612c1e5203f90d4628a4",
"contractAddresses": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"transferDirection": "to",
"fromBlock": 14046400,
"toBlock": 14049300,
"offset": 1,
"limit": 10
}
]
Returns
Array
- The list of all the transfers- Object schema:
- 1.blockNumber: :
QUANTITY
- the block number. null when its pending block. - 2.blockTimestamp:
DATETIME
- the UTC DATETIME for when the block was collated. - 3.transactionHash:
DATA
, 32 Bytes - hash of the transaction. - 4.transactionIndex:
QUANTITY
- index of transactions in block - 5.logIndex:
QUANTITY
- index of transaction logs - 6.contractAddress:
DATA
, 20 Bytes - contract address (i.e.0x1a2b3x
) - 7.transferType:
DATA
, transfer type(trx/erc20/erc721)
- 8.from:
DATA
, 20 Bytes - address of the sender. - 9.to:
DATA
, 20 Bytes - address of the receiver. null when it's a contract creation transaction. - 10.value:
QUANTITY
- value transferred. - 11.fee:
QUANTITY
- fee of the transaction. - 12.asset:
DATA
-ETH
or the token's symbol.null
if not defined in the contract and not available from our sources. - 13.decimals:
QUANTITY
- contract decimal.null
if not defined in the contract and not available from other sources. - 14.error (optional):
BOOLEAN
- True, if the transaction was made with an error
Request example
Curl
Postman
curl https://ethereum.api.watchdata.io/node/jsonrpc?api_key=your_api_key
-X POST \
-H "Content-Type: application/json" \
-d '{"id": 1, "method": "watch_getTransfersByAddress", "jsonrpc": "2.0", "params": [{"addresses": "0x123f96bc8edcb73bd5b8612c1e5203f90d4628a4","contractAddresses": "0xdac17f958d2ee523a2206206994597c13d831ec7","transferDirection": "to","fromBlock": 14046400,"toBlock": 14049300,"offset": 1,"limit": 10}]}'
URL: https://ethereum.api.watchdata.io/node/jsonrpc?api_key=your_api_key
RequestType: POST
Body:
{
"id": 1,
"method": "watch_getTransfersByAddress",
"jsonrpc": "2.0",
"params": [
{
"addresses": "0x123f96bc8edcb73bd5b8612c1e5203f90d4628a4",
"contractAddresses": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"transferDirection": "to",
"fromBlock": 14046400,
"toBlock": 14049300,
"offset": 1,
"limit": 10
}
]
}
Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"blockNumber": 14049260,
"blockTimestamp": "2022-01-21T13:47:35",
"transactionHash": "0x8a1258d3b31fb5ea1d51f65542f1f436e24de8eeb36726e8075e286fea6154b7",
"transactionIndex": 128,
"logIndex": 221,
"contractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"transferType": "erc20transfer",
"from": "0x2819c144d5946404c0516b6f817a960db37d4929",
"to": "0x123f96bc8edcb73bd5b8612c1e5203f90d4628a4",
"value": 2165000000,
"fee": 8550565140309632,
"asset": "USDT",
"decimals": 6
}
]
}
Last modified 1yr ago