AddressLists represent a list of addresses, identified by a unique ID.

Some list IDs are reserved and auto generated by the blockchain. Otherwise, the list can be created on-chain via MsgCreateAddressLists.

For the BitBadges indexer / API, we also allow users to create off-chain lists hosted in a centralized manner.

On-chain lists are stored on the blockchain, are permanent, non editable, non deletable, and can be used for defining permissions and approvals. Off-chain lists are stored off-chain, are mutable, and can be edited / deleted at any time by the creator.

Hierarchy (view full)

Implements

Constructors

Properties

addresses: string[]

The addresses of the address list. If this is a tracker list, the addresses are the tracker IDs.

aliasAddress?: string

The alias BitBadges address of the address list.

createdBy?: string

The address that created the address list.

customData: string

Arbitrary custom data that can be stored on-chain.

listId: string

The ID of the address list.

uri: string

The URI where to fetch the address list metadata from.

whitelist: boolean

Whether or not to include ONLY the addresses or include all EXCEPT the addresses.

Methods

  • Checks if a specific account is in the given address list. This means added to a whitelist or NOT included in a blacklist.

    Parameters

    • address: string

    Returns boolean

    The double negative may get confusing.

  • Compares this object's fields to another object's fields for equality. Equality is determined by comparing the JSON representations of the objects.

    If normalizeNumberTypes is true, then all number types will be compared as strings (i.e. "1n" === "1" === 1). Else, they will be compared as their native types (i.e. 1n !== 1 !== "1").

    Type Parameters

    Parameters

    • other: undefined | null | CustomType<U>
    • OptionalnormalizeNumberTypes: boolean

    Returns boolean

  • Gets the addresses that are in both lists.

    Note the returned value can be a whitelist or a blacklist, depending on the input lists. For example, all addresses except Bob (blacklist) overlap or just Bob (whitelist) overlap.

    Parameters

    Returns AddressList

  • Inverts the list in-place. Simply done by invert the whitelist property.

    Returns this

  • Removes addresses from the list in-place.

    If this is a whitelist, the address will be removed (if it is currently added). If this is a blacklist, the address will be added (if it is not currently added). Otherwise, it is a no-op since it is already removed.

    Parameters

    Returns this

  • Generates a list ID for a given address list.

    Parameters

    • addressList: iAddressList

      The address list to generate the ID for

    Returns string

  • Returns the address list for a list ID, if it is a reserved ID (i.e. Mint, Manager, All, None, validly formatted address, ...)

    Parameters

    • addressListId: string

    Returns AddressList

  • Returns the tracker list for a tracker ID list. Little different logic because tracker ID lists can only be reserved IDs (no storage) and can be nonvalid addresses

    Parameters

    • trackerListId: string

    Returns AddressList