Class BitBadgesAdminAPI<T>

This is the BitBadgesAPI class which provides all typed API calls to the BitBadges API. See official documentation for more details and examples. Must pass in a valid API key. , iGetDeveloperAppsPayload convertFunction is used to convert any responses returned by the API to your desired NumberType.

import { BigIntify, Stringify, Numberify, BitBadgesAPI } from "bitbadgesjs-sdk";
const BitBadgesApi = new BitBadgesAPI({ convertFunction: BigIntify, ....})
const collections = await BitBadgesApi.getCollections(...);

By default, we use the official API URL (https://api.bitbadges.io). You can override this by passing in a custom apiUrl.

Type Parameters

Hierarchy (View Summary, Expand)

Constructors

Properties

Methods

addApprovalDetailsToOffChainStorage addBalancesToOffChainStorage addToIpfs assertPositiveInteger broadcastTx calculatePoints checkClaimSuccess checkIfSignedIn completeClaim createAddressLists createApiKey createApplication createAttestation createClaims createDeveloperApp createDynamicDataStore createPaymentIntent createPlugin createSIWBBRequest createUtilityListing deleteAddressLists deleteApiKey deleteApplication deleteAttestation deleteClaims deleteConnectedAccount deleteDeveloperApp deleteDynamicDataStore deletePlugin deleteSIWBBRequest deleteUtilityListing exchangeSIWBBAuthorizationCode fetchMetadataDirectly filterBadgesInCollection filterSuggestions generateAppleWalletPass generateGoogleWallet getAccount getAccounts getActiveAuthorizations getAddressList getAddressListActivity getAddressListClaims getAddressListListings getAddressLists getAddressListsForUser getApiKeys getApplication getApplications getAttemptDataFromRequestBin getAttestation getAttestations getAttestationsForUser getBadgeActivity getBadgeBalanceByAddress getBadgeBalanceByAddressSpecificBadge getBadgeMetadata getBadgesViewForUser getBrowse getClaim getClaimActivityForUser getClaimAlertsForUser getClaimAttempts getClaimAttemptStatus getClaims getCollection getCollectionAmountTrackerById getCollectionAmountTrackers getCollectionChallengeTrackerById getCollectionChallengeTrackers getCollectionClaims getCollectionListings getCollectionOwners getCollections getCollectionTransferActivity getConnectedAccounts getDeveloperApp getDeveloperApps getDynamicDataActivity getDynamicDataStore getDynamicDataStores getDynamicDataStoreValue getDynamicDataStoreValuesPaginated getEmbeddedWallet getGatedContentForClaim getListActivityForUser getMap getMaps getMapValue getMapValues getOwnersForBadge getPlugin getPluginErrors getPlugins getPointsActivity getPointsActivityForUser getRefreshStatus getReservedClaimCodes getSearchResults getSignInChallenge getSIWBBRequestsForDeveloperApp getSiwbbRequestsForUser getStatus getTokensFromFaucet getTransferActivityForUser getUtilityListing getUtilityListings handleApiError performBatchStoreAction performStoreAction refreshMetadata revokeOauthAuthorization rotateApiKey rotateSIWBBRequest scheduleTokenRefresh searchApplications searchClaims searchDeveloperApps searchDynamicDataStores searchPlugins searchUtilityListings sendClaimAlert setAccessToken signOut signWithEmbeddedWallet simulateClaim simulateTx unsetAccessToken updateAccountInfo updateAddressListAddresses updateAddressListCoreDetails updateAddressLists updateApplication updateAttestation updateClaims updateDeveloperApp updateDynamicDataStore updatePlugin updateUserSeenActivity updateUtilityListing uploadBalances verifyAttestation verifyOwnershipRequirements verifySignIn verifySIWBBRequest

Constructors

Properties

accessToken: string = ''
apiKey: undefined | string = process.env.BITBADGES_API_KEY
appendedHeaders: Record<string, string> = {}
axios: AxiosInstance = ...
BACKEND_URL: string = ...
ConvertFunction: (num: NumberType) => T

Methods

  • For password based approvals, we hand out codes behind the scenes whenever a user requests a password. This is to prevent replay attacks on the blockchain. This API call will return a valid code if a valid password is provided.

    Each address is limited to one code per password. If the password is provided again, they will receive the same code.

    Parameters

    Returns Promise<CompleteClaimSuccessResponse>

    • API Route: POST /api/v0/claims/complete/:claimId/:address
    • SDK Function Call: await BitBadgesApi.completeClaim(claimId, address, { ...body });
    • Authentication: Must be signed in.
    const res = await BitBadgesApi.completeClaim(claimId, address, { ...body });
    console.log(res);
  • Gets accounts and accompying details.

    Parameters

    Returns Promise<GetAccountsSuccessResponse<T>>

    • API Route: POST /api/v0/users
    • SDK Function Call: await BitBadgesApi.getAccounts(payload);
    • Tutorial: See the Fetching Accounts tutoral on the official docs.
    • Authentication: Must be signed in, if fetching private information such as private lists or auth codes. If fetching public information only, no sign in required.
    const res = await BitBadgesApi.getAccounts([{ address }]);
    console.log(res);

    This function is used to fetch accounts and their details. It is your responsibility to join the data together (paginations, etc). Use getAccountsAndUpdate for a more convenient way to handle paginations and appending metadata.

MMNEPVFCICPMFPCPTTAAATR