Adds a balance map to off-chain storage. Mode can either be 'ipfs" for storing on IPFS or 'centralized' for storing on DigitalOcean.
POST /api/v0/addBalancesToOffChainStorage
await BitBadgesApi.addBalancesToOffChainStorage(payload);
const res = await BitBadgesApi.addBalancesToOffChainStorage(payload);
console.log(res);
Broadcasts a transaction to the blockchain.
POST /api/v0/broadcast
await BitBadgesApi.broadcastTx(payload);
Also, consider checking out Broadcast UI, so you can simply copy and paste your transaction to a UI. All signing, API communication, etc is outsourced to the UI.
Checks if the user is signed in.
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.
Creates address lists stored by BitBadges centralized servers.
Creates an off-chain attestation signature (typically a credential).
Creates a claim.
Creates a SIWBB request.
Optional
payload: CreateSIWBBRequestPayloadDeletes address lists. Must be created off-chain.
Deletes an off-chain attestation signature (typically a credential).
Deletes a claim.
Deletes a SIWBB request.
Optional
payload: DeleteSIWBBRequestPayloadGets and verifies a SIWBB request.
Optional
payload: ExchangeSIWBBAuthorizationCodePayloadFilters badges in a collection based on multiple filter values.
Gets the filter suggestions based on attributes in a collection.
Optional
payload: FilterSuggestionsPayloadGets accounts and accompying details.
POST /api/v0/users
await BitBadgesApi.getAccounts(payload);
const res = await BitBadgesApi.getAccounts([{ address, fetchSequence: true, fetchBalance: true }]);
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.
Gets address lists. Can be on-chain or off-chain.
Get an off-chain attestation signature (typically a credential).
Gets the activity for a specific badge in a collection
Gets the balance of a specific badge for a specific address
Optional
payload: GetBadgeBalanceByAddressPayloadGets details for a browse / explore page.
Gets claim alerts for a collection.
Gets the status of a claim attempt.
Gets the claim by ID.
This function retrieves badge collections and accompanying details. Consider using the getCollectionsAndUpdate
function instead for native support in handling paginations, appending metadata, and more.
POST /api/v0/collections
const res = await BitBadgesApi.getCollections([{ collectionId, metadataToFetch: { badgeIds: [{ start: 1n, end: 10n }] } }]);
const collection = res.collections[0];
Get the gated content for a claim.
Get map values
Get maps by ID
Gets the owners for a specific badge in a collection
Gets the refresh status for a collection. Used to track if any errors occur during a refresh, or if it is in the queue or not.
For on-chain claims where codes are "reserved" for a specific address, this function will return all codes reserved.
POST /api/v0/claims/reserved/:claimId/:address
await BitBadgesApi.getReservedClaimCodes(claimId, address, { ...body });
const res = await BitBadgesApi.getReservedClaimCodes(claimId, address, { ...body });
console.log(res);
Gets the SIWBB requests for a specific developer app.
Search collections, badges, accounts, address lists based on a search value.
Optional
payload: GetSearchPayloadGets the current status details about the blockchain / indexer (gas, block height, etc).
Triggers a metadata refresh for a specific collection. BitBadges API uses a refresh queue system for fetching anything off-chain. This will refetch any details for the collection (such as metadata, balances, approval details, etc). Note it will reject if recently refreshed. Uses a cooldown of 5 minutes.
Optional
payload: RefreshMetadataPayloadRevokes an access token for a user.
Rotates a SIWBB request.
Sends claim alert notifications out.
Simulates a claim attempt. A success response means the claim is valid and can be completed.
Simulates a transaction on the blockchain.
POST /api/v0/simulate
await BitBadgesApi.simulateTx(payload);
This means that it will return the gas used and any errors that occur on a dry run. Should be used before broadcasting a transaction. Does not require signatures.
Updates the profile / account information for a user. We will only update the provided fields.
Updates address lists stored by BitBadges centralized servers.
Update a attestation.
Update an claim.
Update Helper Functions for Pagination and Dynamic Fetches
Verifies an attestation.
A generic route for verifying asset ownership requirements. Asset requirements support AND / OR / NOT logic.
A generic route for verifying SIWBB requests. Used as a helper if implementing on your own.
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.
convertFunction is used to convert any responses returned by the API to your desired NumberType.
By default, we use the official API URL (https://api.bitbadges.io). You can override this by passing in a custom apiUrl.
See
BitBadges API Documentation