This package contains React helpers for interacting with Bitte Wallet and other NEAR wallets.
- Installing
- Wallet Selection
- BitteWalletContextProvider
- Available Wallets
- Usage Examples
- Legacy API
- Troubleshooting
npm install @bitte-ai/react
npm install @near-wallet-selector/modal-uiyarn add @bitte-ai/react
yarn add @near-wallet-selector/modal-uipnpm install @bitte-ai/react
pnpm install @near-wallet-selector/modal-uiYou can now easily choose which wallets to display by using the enabledWallets prop. This gives developers full control over the wallet selection experience.
The following wallets are supported:
"intear"- Intear Wallet"hot"- Here Wallet (formerly HOT Wallet)"okx"- OKX Wallet"bitte"- Bitte Wallet"meteor"- Meteor Wallet"mynear"- MyNEAR Wallet
The default way of interacting with Bitte Wallet is using the BitteWalletContextProvider.
network: "mainnet" | "testnet" - The NEAR network to connect to
enabledWallets: WalletName[] - Array of wallet names to display (recommended)
additionalWallets: WalletModuleFactory[] - Extra wallets setup
contractAddress: string - Contract address for wallet connection
onlyBitteWallet: boolean - Legacy prop to show only Bitte Wallet
walletUrl: string - Custom Bitte Wallet URL
import "@near-wallet-selector/modal-ui/styles.css";
import { BitteWalletContextProvider, useBitteWallet, WalletName } from '@bitte-ai/react';
// Select only the wallets you want to show
const enabledWallets: WalletName[] = ['intear', 'hot', 'okx', 'bitte'];
function MyApp() {
return (
<BitteWalletContextProvider
network="mainnet"
enabledWallets={enabledWallets}
contractAddress="your-contract.near"
>
<WalletConnector />
</BitteWalletContextProvider>
);
}
function WalletConnector() {
const { connect, disconnect, isConnected, accounts } = useBitteWallet();
return (
<div>
{!isConnected ? (
<button onClick={connect}>Connect Wallet</button>
) : (
<div>
<p>Connected: {accounts[0]?.accountId}</p>
<button onClick={disconnect}>Disconnect</button>
</div>
)}
</div>
);
}const allWallets: WalletName[] = ['intear', 'hot', 'okx', 'bitte', 'meteor', 'mynear'];
<BitteWalletContextProvider
network="mainnet"
enabledWallets={allWallets}
contractAddress="your-contract.near"
>
<App />
</BitteWalletContextProvider>// Only show Bitte and Intear wallets
const selectedWallets: WalletName[] = ['bitte', 'intear'];
<BitteWalletContextProvider
network="testnet"
enabledWallets={selectedWallets}
contractAddress="your-contract.testnet"
>
<App />
</BitteWalletContextProvider>import { setupCustomWallet } from 'custom-wallet';
const myWallets: WalletName[] = ['bitte', 'intear', 'meteor'];
<BitteWalletContextProvider
network="mainnet"
enabledWallets={myWallets}
additionalWallets={[setupCustomWallet()]}
contractAddress="your-contract.near"
>
<App />
</BitteWalletContextProvider>The WalletName type ensures you only use supported wallet names:
import { WalletName } from '@bitte-ai/react';
// ✅ This works
const validWallets: WalletName[] = ['intear', 'bitte', 'meteor'];
// ❌ TypeScript error - 'invalid' is not a valid wallet name
const invalidWallets: WalletName[] = ['intear', 'invalid'];The previous API is still supported for backwards compatibility:
<BitteWalletContextProvider
network="mainnet"
onlyBitteWallet={true}
contractAddress="your-contract.near"
>
<App />
</BitteWalletContextProvider>import { setupSomeCustomWallet } from 'some-custom-wallet';
<BitteWalletContextProvider
network="mainnet"
additionalWallets={[setupSomeCustomWallet()]}
contractAddress="your-contract.near"
>
<App />
</BitteWalletContextProvider>- If you don't specify
enabledWallets, the default wallets (meteor,mynear,hot) plusbittewill be used - If you specify an empty
enabledWalletsarray, no wallets will be shown - The
enabledWalletsoption takes precedence overonlyBitteWalletwhen both are provided - Additional wallets from
additionalWalletswill always be included regardless of theenabledWalletssetting
The wallet runs only on client-side.
Any other questions or issues you can contact support on our Telegram Channel.
This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0).