Docs / wallet / Wallet Module

Wallet Module

guidenot for built apps

Separate flowstack-sdk/wallet entry point for the two token systems (AGENT build credits, INFER query credits): reading balances, accepting payments, and accessing wallet addresses.

import { useWalletAuth, useInferBalance, useAgentBalance, useDeposit, useBuyInfer } from 'flowstack-sdk/wallet'

The wallet module lives at its own entry point, flowstack-sdk/wallet, and is imported only when an app needs INFER token payments. It requires peer dependencies (@privy-io/react-auth, wagmi, viem, @tanstack/react-query) and needs Privy running on the page's origin — which is only possible on casino.flowstack.fun, not on *.casino.flowstack.fun built-app subdomains.

Built apps must NOT use this module for authentication — use BrokeredLoginButton from flowstack-sdk instead. Use the wallet module only when your app needs to read/display INFER token balances, accept token payments, or access wallet addresses directly.

Tokens & credits. Flowstack has two token systems: - INFERquery/inference credits. Read via useInferBalance(){ balance, available, queryCredits } (GET /billing/infer/balance, on-chain). Spent on agent queries/inference. Top up with useBuyInfer() (fiat on-ramp) / BuyInferModal / InferBalanceBadge. - AGENTbuild/compute credits. Read via useAgentBalance(){ balance, available, buildCredits } (GET /billing/agent/balance). Spent on builds/compute. Surfaced by AgentBalanceBadge; NeedsAgent gates content behind a balance and links to the OIF /buy on-ramp.

Rule of thumb: INFER = `queryCredits` (asking the agent things), AGENT = `buildCredits` (building/running compute). They are separate balances with separate endpoints and on-ramps.

Examples

Required peer dependencies
{
  "dependencies": {
    "@privy-io/react-auth": ">=2.0.0",
    "wagmi": ">=2.0.0",
    "viem": ">=2.0.0",
    "@tanstack/react-query": ">=5.0.0"
  }
}
WarningNOT for built apps: this entry statically imports the wagmi optional peer dependency. Built apps that only need monetization gating import AppPaywall/useAppAccess from flowstack-sdk/paywall (0.3.2+) instead.
WarningBuilt apps: do not use this module for authentication. The wallet module needs Privy running on the page's origin, which is only possible on casino.flowstack.fun, not on *.casino.flowstack.fun built-app subdomains. Use `BrokeredLoginButton` for auth in built apps.

See also

useWalletAuth · useInferBalance · useAgentBalance · useDeposit · useBuyInfer · BrokeredLoginButton

Source: README.md#wallet-module · Also available in llms-full.txt and registry.json.