transfers_for_participant
Schema: lib
Description
The transfers_for_participant function is used to retrieve all transfers for a given participant within a specified time range. A "participant" can be either the sender or recipient of a token transfer. This function also allows for an optional chain
constraint to limit to only transactions on a given chain.
Usage
Signature
lib.transfers_for_participant(
participant text,
start_time timestamptz,
end_time timestamptz,
token_chain text
)
Parameters
Name | Type | Description |
---|---|---|
participant | text | The participant for whom transfers will be retrieved. This can be either the sender or recipient of a token transfer. |
start_time | timestamptz | The starting point for the data search. Only transfers that occurred at or after this time will be included. |
end_time | timestamptz | The endpoint for the data search. Only transfers that occurred at or before this time will be included. |
token_chain | text | (Optional) The specific chain to look for transfers on. This is useful if an address is used across multiple chains, but you only want transfers for one chain |
Results
The function returns a table with the following columns:
Name | Type | Description |
---|---|---|
id | text | The unique identifier for the transfer. |
chain | text | The token chain for the transfer. |
transaction_hash | text | The hash of the transaction that initiated the transfer. |
log_index | integer | The index of the log within the transaction. |
consensus_time | timestamptz | The time at which the transfer was confirmed by the network. |
contract | text | The address of the contract involved in the transfer. |
aliased_contract | text | The alias of the contract, if one exists. |
entrypoint_contract | text | The address of the entrypoint contract involved in the transfer. |
aliased_entrypoint_contract | text | The alias of the entrypoint contract, if one exists. |
sender | text | The address of the sender in the transfer. |
aliased_sender | text | The alias of the sender, if one exists. |
recipient | text | The address of the recipient in the transfer. |
aliased_recipient | text | The alias of the recipient, if one exists. |
val | numeric | The value of the transfer. |
decimaled_val | numeric | The value of the transfer, converted to the appropriate decimal place if decimal places is known for the token |
Examples
Retrieve all transfers within the last 6 hours for an address
select *
from lib.transfers_for_participant(
'0x0de0fd789ec103bc076528e026f0e96bee3c69dc',
now() - '6 hours'::interval,
now()
);
Retrieve all transfers within the last 6 hours for an address on the Kava chain
select *
from lib.transfers_for_participant(
'0x0de0fd789ec103bc076528e026f0e96bee3c69dc',
now() - '6 hours'::interval,
now(),
'kava'
);