bitbadgesjs-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.19.1 • Public • Published

Overview

The BitBadges SDK is a bundle of TypeScript libraries that provide all the tools and functions needed for you to build your own frontend or interact with the BitBadges API, blockchain, and indexer.

GitHub: https://github.com/bitbadges/bitbadgesjs

Reference repositories that use the SDK:

See full documentation for complete documentation on each library. Also, the BitBadges official indexer source code and BitBadges official frontend code both use the SDK, so please feel free to reference them.

Version Compatibility

This SDK is designed to be compatible with specific BitBadges chain versions. Use the following mapping to ensure compatibility:

BitBadges Chain Version SDK Version Range Status
v12 0.18.x ✅ Current
v13 0.19.x 🔄 Coming Soon

Current SDK Version: 0.18.7

Recommendation: Always use the latest patch version within your compatible major.minor version range. For example, if you're using BitBadges v12, use the latest 0.18.x version.

📖 For detailed version information, see VERSION_COMPATIBILITY.md

Installation

# For BitBadges v12 (current)
npm install bitbadgesjs-sdk@^0.18.0

# For BitBadges v13 (when available)
npm install bitbadgesjs-sdk@^0.19.0

This library provides miscellaneous functionality to help you interact with BitBadges, such as types, API routes, managing metadata requests, logic with ID ranges and balances, etc.

const bitbadgesAddress = convertToBitBadgesAddress(address);
const ethAddress = bitbadgesToEth(bitbadgesAddress);

It also exports functions for broadcasting transactions and interacting with the blockchain. See Broadcasting Txs for how to use.

// Find a node URL from a network endpoint:
// https://docs.evmos.org/develop/api/networks.
const nodeUrl = ...

const postOptions = {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: generatePostBodyBroadcast(signedTx),
}

const broadcastEndpoint = `${nodeUrl}${generateEndpointBroadcast()}`
const broadcastPost = await fetch(
  broadcastEndpoint,
  postOptions,
)

const response = await broadcastPost.json()

For most use cases, you will not need to broadcast transactions. If you do, consider first exploring the helper broadcast tool at https://bitbadges.io/dev/broadcast.

Package Sidebar

Install

npm i bitbadgesjs-sdk

Weekly Downloads

140

Version

0.19.1

License

MIT

Unpacked Size

19.1 MB

Total Files

4286

Last publish

Collaborators

  • trevormil