Class BitBadgesUserInfo<T>

BitBadgesUserInfo is the type for accounts returned by the BitBadges API. It includes all Docrmation about an account.

Note that returned user Docs will only fetch what is requested. It is your responsibility to join the data together (paginations, etc). See documentation for helper functions, examples, and tutorials on handling this data and paginations.

Type Parameters

Hierarchy (view full)

Implements

Constructors

Properties

_docId: string

A unique stringified document ID

_id?: string

A unique document ID (Mongo DB ObjectID)

accountNumber: T

The account number of the account

activity: TransferActivityDoc<T>[]

A list of transfer activity items for the account. Paginated and fetched as needed. To be used in conjunction with views.

address: string

The native address of the account

addressLists: BitBadgesAddressList<T>[]

A list of address lists for the account. Paginated and fetched as needed. To be used in conjunction with views.

airdropped?: boolean

Indicates whether the account has claimed their airdrop.

alias?: {
    collectionId?: T;
    listId?: string;
}

The alias for the account.

approvalTrackers: ApprovalTrackerDoc<T>[]

A list of approvals tracker activity items for the account. Paginated and fetched as needed. To be used in conjunction with views.

approvedSignInMethods?: {
    addresses?: {
        address: string;
        scopes: OAuthScopeDetails[];
    }[];
    discord?: {
        discriminator?: string;
        id: string;
        scopes: OAuthScopeDetails[];
        username: string;
    };
    github?: {
        id: string;
        scopes: OAuthScopeDetails[];
        username: string;
    };
    google?: {
        id: string;
        scopes: OAuthScopeDetails[];
        username: string;
    };
    twitter?: {
        id: string;
        scopes: OAuthScopeDetails[];
        username: string;
    };
}

Approved ways to sign in

attestationProofs: AttestationProofDoc<T>[]

A list of atestation proofs for the account. Paginated and fetched as needed. To be used in conjunction with views.

attestations: iAttestationDoc<T>[]

A list of user attestations for the account. Paginated and fetched as needed. To be used in conjunction with views.

avatar?: string

The avatar of the account.

balance?: CosmosCoin<T>

The balance of the account

btcAddress: string

The Bitcoin address of the account

The chain of the account.

claimAlerts: ClaimAlertDoc<T>[]

A list of claim alerts for the account. Paginated and fetched as needed. To be used in conjunction with views.

collected: BalanceDocWithDetails<T>[]

A list of badges that the account has collected. Paginated and fetched as needed. To be used in conjunction with views.

cosmosAddress: string

The Cosmos address of the account

createdAt?: T

The timestamp of when this account was created (milliseconds since epoch)

customLinks?: iCustomLink[]

The custom links of the account

customPages?: {
    attestations: CustomListPage[];
    badges: CustomPage<T>[];
    lists: CustomListPage[];
}

The custom pages of the account

discord?: string

The Discord username of the account

ethAddress: string

The Eth address of the account

fetchedProfile?: boolean

Whether we have already fetched the profile or not

github?: string

The GitHub username of the account

hiddenBadges?: BatchBadgeDetailsArray<T>

The hidden badges of the account

hiddenLists?: string[]

The hidden lists of the account

latestSignedInChain?: SupportedChain

The latest chain the user signed in with

listsActivity: ListActivityDoc<T>[]

A list of list activity items for the account. Paginated and fetched as needed. To be used in conjunction with views.

merkleChallenges: MerkleChallengeDoc<T>[]

A list of merkle challenge activity items for the account. Paginated and fetched as needed. To be used in conjunction with views.

notifications?: NotificationPreferences<T>

The notifications of the account

nsfw?: {
    [badgeId: string]: string;
}

Indicates whether the account is NSFW.

profilePicUrl?: string

The profile picture URL of the account

pubKeyType: string

The public key type of the account

publicKey: string

The public key of the account

readme?: string

The readme of the account

reported?: {
    [badgeId: string]: string;
}

Indicates whether the account has been reported.

reservedMap?: MapDoc<T>

The reserved map for the account. This is created and managed on-chain through the x/maps module.

resolvedName?: string

The resolved name of the account (e.g. ENS name).

seenActivity?: T

The timestamp of the last activity seen for this account (milliseconds since epoch)

sequence?: T

The sequence of the account

siwbbRequests: SIWBBRequestDoc<T>[]

A list of SIWBB requests for the account. Paginated and fetched as needed. To be used in conjunction with views.

socialConnections?: SocialConnections<T>

Social connections stored for the account

solAddress: string

The Solana address of the account.

telegram?: string

The Telegram username of the account

twitter?: string

The Twitter username of the account

username?: string

The username of the account

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

The views for this collection and their pagination Doc. Views will only include the doc _ids. Use the pagination to fetch more. To be used in conjunction with activity, announcements, reviews, owners, merkleChallenges, and approvalTrackers. For example, if you want to fetch the activity for a view, you would use the view's pagination to fetch the doc _ids, then use the corresponding activity array to find the matching docs.

watchlists?: {
    attestations: CustomListPage[];
    badges: CustomPage<T>[];
    lists: CustomListPage[];
}

The watched lists of the account's portfolio

Methods

  • 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

  • Fetch the user's information via an API request and updates the current BitBadgesUserInfo object. This will handle all paginations, etc. behind the scenes.

    Parameters

    Returns Promise<void>

  • Fetch badge balances for a collection and updates the user's collected array. Must pass in a valid API instance.

    Parameters

    • collectionId: T

    Returns undefined | BalanceArray<T>

    const res = await user.fetchBadgeBalances(api, 123n);
    console.log(res.balances);
  • Logic for updating the current BitBadgesUserInfo object with a new API response. If forceful is true, it will overwrite everything.

    Parameters

    Returns void