address_associations
Schema: public
Description
This table is used to store associations between different addresses. This table is useful for tracking the relationships between addresses and their associated addresses, as well as the context and type of association. This table contains only the current state of known address associations.
Examples of assocations:
- When an account holder (the
address
) opens a new smart loan (theassociated_address
) a record can be stored in this table tying the two addresses together - If a protocol opens "child accounts" on your behalf to partition funds, a record can be stored in this table tying your account (the
address
) with the child account (theassociated_address
)
Columns
Name | Type | Description | Default |
---|---|---|---|
id | character | Unique identifier for the association | None |
updated_time | timestamptz | Timestamp for when the association was last updated | None |
chain | text | Name of the blockchain or cryptocurrency | None |
address | text | Address for the primary entity in the association | None |
associated_address | text | Address for the associated entity in the association | None |
protocol | text | Protocol used for the association | None |
association_type | text | Type of association between the two addresses | None |
association_removed | boolean | Flag for when the association has been removed | false |
context | jsonb | Additional context or information about the association | None |
Examples
Retrieve all address association events for account 0x6962148BCDe900BDEd3C12ce6239AbE404945e33
select aa.*
from address_associations aa
where address = '0x6962148bcde900bded3c12ce6239abe404945e33'
order by aa.updated_time;
Retrieve all address association events for the protocol "DeltaPrime"
select aa.*
from address_associations aa
order by aa.updated_time;
Get all active address associations for account 0x6962148bcde900bded3c12ce6239abe404945e33
select
aa.id,
aa.updated_time,
aa.chain,
aa.address,
aa.associated_address,
aa.protocol,
aa.association_type,
aa.context,
aa.association_removed
from address_associations aa
where aa.address = '0x6962148bcde900bded3c12ce6239abe404945e33'
and not association_removed
order by aa.address, aa.updated_time desc;