Class BitBadgesAddressList<T>

Type Parameters

Hierarchy (view full)

Implements

Constructors

Properties

_docId: string

A unique stringified document ID

_id?: string

A unique document ID (Mongo DB ObjectID)

addresses: string[]

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

aliasAddress?: string

The alias cosmos address of the address list.

claims: {
    claimId: string;
    plugins: IntegrationPluginDetails<string>[];
}[]

The claims of the address list.

Type declaration

createdBlock: T

The block number when this list was created

createdBy: string

The cosmos address of the user who created this list

customData: string

Arbitrary custom data that can be stored on-chain.

lastUpdated: T

The timestamp of when this list was last updated (milliseconds since epoch)

listId: string

The ID of the address list.

listsActivity: ListActivityDoc<T>[]

The activity of the address list.

metadata?: Metadata<T>

The metadata of the address list.

nsfw?: {
    reason: string;
}

The NSFW reason if this list is NSFW

Type declaration

  • reason: string
private?: boolean

True if this list is private and will not show up in search results

reported?: {
    reason: string;
}

The reported reason if this list is reported

Type declaration

  • reason: string
updateHistory: iUpdateHistory<T>[]

The update history of this list

uri: string

The URI where to fetch the address list metadata from.

viewableWithLink?: boolean

True if this list is viewable if queried by the list ID directly

views: {
    [viewId: string]: {
        ids: string[];
        pagination: PaginationInfo;
        type: string;
    };
}

The views of the address list.

Type declaration

  • [viewId: string]: {
        ids: string[];
        pagination: PaginationInfo;
        type: string;
    }
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

    Remarks

    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>
    • Optional normalizeNumberTypes: boolean

    Returns boolean

  • Fetches all the documents for a specific view. 1 second delay between each fetch to avoid rate limiting.

    Parameters

    Returns Promise<void>

  • Fetches the next batch of documents for a specific view. 25 documents are fetched at a time. This updates the view in the class instance, as well as handling the pagination.

    Parameters

    Returns Promise<void>

  • Gets the bookmark for a specific view. This is to be passed into the fetchNextForView method.

    Parameters

    • viewId: string

    Returns string

  • Returns true if the address list is stored off-chain. Off-chain lists are stored in the database and are not part of the blockchain. They are updatable, deletable, and can be used for surveys. On-chain lists are immutable and are created through blockchain transactions.

    Returns boolean

  • 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

  • Returns if the view has more pages to be fetched. If we have reached the end of the view, this will return false.

    Parameters

    • viewId: string

    Returns boolean

  • Fetches and initializes a BitBadgesAddressList from the API. Must pass in a valid BitBadgesApi instance.

    Type Parameters

    Parameters

    • api: BaseBitBadgesApi<T>
    • options: {
          listId: string;
          viewsToFetch?: {
              bookmark: string;
              viewId: string;
              viewType: "listActivity";
          }[];
      }
      • listId: string
      • Optional viewsToFetch?: {
            bookmark: string;
            viewId: string;
            viewType: "listActivity";
        }[]

    Returns Promise<BitBadgesAddressList<T>>