B3 SDK

A comprehensive TypeScript SDK for AnySpend cross-chain operations and B3 Global Accounts authentication. Provides both React components for easy integration and headless TypeScript services for custom implementations.

B3 SDK

What is the B3 SDK?

The B3 SDK (@b3dotfun/sdk) is a unified TypeScript SDK that provides everything you need to build applications on the B3 ecosystem. It combines powerful cross-chain payment infrastructure with seamless authentication, all wrapped in developer-friendly React components and headless services.

Architecture

The SDK is organized into focused modules designed for maximum flexibility and ease of use:

AnySpend Module

Cross-chain execution engine for payments, swaps, and NFT minting across multiple blockchains.

Learn More
Global Account Module

B3 Global Accounts authentication and user management with social login and session keys.

Learn More

Module Structure

Each module contains organized, purpose-built components:

  • react/ - React components and hooks for easy integration
  • services/ - Headless TypeScript services for custom implementations
  • types/ - Comprehensive TypeScript definitions
  • utils/ - Utility functions and helpers
  • constants/ - Configuration and constants

Platform Support

FeatureReact WebReact NativeHeadless
AnySpend
Global Accounts
Shared Utils

Installation

npm install @b3dotfun/sdk

CSS Styles

Import the default styles for the best visual experience:

typescript
import "@b3dotfun/sdk/index.css";

Quick Start

Cross-Chain Payments with AnySpend

tsx
import { AnySpend } from "@b3dotfun/sdk/anyspend/react"; function PaymentPage() { return <AnySpend mode="page" />; }

Authentication with Global Accounts

tsx
import { B3Provider, SignInWithB3 } from "@b3dotfun/sdk/global-account/react"; function App() { return ( <B3Provider environment="production" partnerId="your-awesome-partner-id"> <SignInWithB3 provider={{ strategy: "google" }} partnerId="your-partner-id" onLoginSuccess={(globalAccount) => { console.log("Authenticated:", globalAccount); }} /> </B3Provider> ); }

NFT Minting

tsx
import { AnySpendNFTButton } from "@b3dotfun/sdk/anyspend/react"; function NFTMinting() { const nftContract = { address: "0x9c275ff1634519E9B5449ec79cd939B5F900564d", chainId: 8333, name: "Example NFT Collection", imageUrl: "https://example.com/nft.jpg", price: "1000000000000000000", // 1 ETH in wei currency: { symbol: "ETH", decimals: 18 } }; return ( <AnySpendNFTButton nftContract={nftContract} recipientAddress="0x..." /> ); }

Key Features

Universal Payment Infrastructure

Any Token Payments

Accept payments in any cryptocurrency with automatic conversion to your preferred token.

Cross-Chain Swaps

Enable seamless token swaps across 20+ supported blockchains with optimal routing.

NFT Minting

One-click NFT minting buttons that accept payments in any token from any chain.

Fiat Onramps

Integrated fiat-to-crypto onramps for users without existing cryptocurrency.

Seamless Authentication

Social Login

Google, Discord, and other social providers with instant onboarding.

Session Keys

Secure session management with granular permissions for enhanced UX.

Cross-Platform Identity

Single identity that works across all B3 applications and games.

Smart Accounts

Built-in smart account abstraction for gasless transactions.

Headless TypeScript Services

For developers who need maximum control, all functionality is available through headless services:

AnySpend Services

typescript
import { anyspendService } from "@b3dotfun/sdk/anyspend/services/anyspend"; // Get quote for cross-chain swap const quote = await anyspendService.getQuote({ srcChain: 1, dstChain: 8333, srcTokenAddress: "0x...", dstTokenAddress: "0x...", srcAmount: "1000000", recipientAddress: "0x...", type: "swap" }); // Create and execute order const order = await anyspendService.createOrder({ // ... order parameters });

Global Account Services

typescript
import { authenticate } from "@b3dotfun/sdk/global-account/app"; // Authenticate user const authResult = await authenticate( "access-token", "identity-token" ); if (authResult) { console.log("Authentication successful:", authResult); }

Support & Community

Developer Support

Get help integrating the B3 SDK into your project.

Discord Community

Join the B3 developer community for support and discussions.

GitHub

View source code, report issues, and contribute to the SDK.

What's Next?

  1. Install the SDK and import the styles
  2. Set up AnySpend for cross-chain payments
  3. Configure Global Accounts for user authentication
  4. Explore examples and implementation patterns
  5. Join the community for support and updates

The B3 SDK provides everything you need to build the next generation of cross-chain applications with seamless user experiences. Start building today!

Ask a question... ⌘I