Skip to main content

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

NameTypeDescription
participanttextThe participant for whom transfers will be retrieved. This can be either the sender or recipient of a token transfer.
start_timetimestamptzThe starting point for the data search. Only transfers that occurred at or after this time will be included.
end_timetimestamptzThe endpoint for the data search. Only transfers that occurred at or before this time will be included.
token_chaintext(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:

NameTypeDescription
idtextThe unique identifier for the transfer.
chaintextThe token chain for the transfer.
transaction_hashtextThe hash of the transaction that initiated the transfer.
log_indexintegerThe index of the log within the transaction.
consensus_timetimestamptzThe time at which the transfer was confirmed by the network.
contracttextThe address of the contract involved in the transfer.
aliased_contracttextThe alias of the contract, if one exists.
entrypoint_contracttextThe address of the entrypoint contract involved in the transfer.
aliased_entrypoint_contracttextThe alias of the entrypoint contract, if one exists.
sendertextThe address of the sender in the transfer.
aliased_sendertextThe alias of the sender, if one exists.
recipienttextThe address of the recipient in the transfer.
aliased_recipienttextThe alias of the recipient, if one exists.
valnumericThe value of the transfer.
decimaled_valnumericThe 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'
);