active_address_associations_for_protocol
Schema: lib
Description
This function retrieves the latest address associations for a given protocol. It can also be constrained by association type and chain. Address associations help map an address to other associated addresses. For example, if a loan protocol creates a dedicated contract for your loan, address associations can map your address to the loan contract's address. This allows modeling more complicated relationships between accounts.
Usage
Signature
lib.active_address_associations_for_protocol(
protocol_to_find text,
association_type_to_find text,
chain_to_find text
)
Parameters
Name | Type | Description |
---|---|---|
protocol_to_find | text | The name of the protocol to find associations for (e.g. 'DeltaPrime') |
association_type_to_find | text | (Optional) The type of association to search for (e.g. 'Smart loan') |
chain_to_find | text | (Optional) The chain to search for (e.g. 'arbitrum') |
Results
This function returns a table with the following columns:
Column | Type | Description |
---|---|---|
id | character | The ID of the address association |
updated_time | timestamptz | The time the association was last updated |
chain | text | The chain of the association |
address | text | The address for the association |
associated_address | text | The address associated with the previous address |
protocol | text | The protocol (e.g. 'DeltaPrime') |
association_type | text | The type of association (e.g. 'Smart loan') |
context | jsonb | Any additional context for the association |
Examples
Retrieve all address associations for the protocol "DeltaPrime"
select *
from lib.active_address_associations_for_protocol('DeltaPrime');
Retrieve all address associations for the protocol "DeltaPrime" with the association type "Smart loan" on the "arbitrum" chain
select *
from lib.active_address_associations_for_protocol(
'DeltaPrime',
'Smart loan',
'arbitrum'
);
Similarly, with named parameters
select *
from lib.active_address_associations_for_protocol(
protocol_to_find => 'DeltaPrime',
association_type_to_find => 'Smart loan',
chain_to_find => 'arbitrum'
);
Retrieve all address associations for the protocol "DeltaPrime" with the association type "Smart loan" on all chains
select *
from lib.active_address_associations_for_protocol(
'DeltaPrime',
'Smart loan'
);
Similarly, with named parameters
select *
from lib.active_address_associations_for_protocol(
protocol_to_find => 'DeltaPrime',
association_type_to_find => 'Smart loan'
);