Overview
TheuseBluvoFlow hook from @bluvo/react is powered by a finite state machine that orchestrates the entire withdrawal lifecycle, from exchange selection through OAuth, wallet loading, quoting, and withdrawal execution (including 2FA). Every state transition is deterministic: given a state and an action, the next state is always predictable.
Your UI renders based on the current state. The hook exposes each state as a boolean property (e.g., flow.isOAuthPending, flow.requires2FA), so you never need to inspect raw state strings directly.
Flow Diagram
Happy Path (OAuth)
Happy Path (QR Code Login)
Withdrawal Sub-Flow
States by Phase
Idle
Exchanges
OAuth
Compound booleans:
isOAuthPending=oauth:waitingORoauth:processingisOAuthError=oauth:errorORoauth:fatalisWalletConnectionInvalid=oauth:fatalORqrcode:fatal
QR Code
Used for exchanges that support QR-based login (e.g., Binance mobile app scanning).
Compound booleans:
isQRCodePending= anyqrcode:*state except error, fatal, timeoutisQRCodeError=qrcode:errorORqrcode:fatal
qrCodeUrl, the URL to render as a QR codeqrCodeExpiresAt, Unix timestamp (ms) when the QR code expiresqrCodeStatus, current status string from the exchangeisQRCodeFlow,truewhen using QR code auth instead of OAuth popup
Wallet
Error detection helpers:
hasWalletNotFoundError, wallet ID no longer valid (deleted or expired)hasInvalidCredentialsError, exchange tokens revoked; user must re-authenticate
Quote
Error detection helpers:
hasAmountError, amount below minimum or above maximumhasAddressError, invalid destination address formathasNetworkError, unsupported or invalid network
Withdrawal
Compound booleans:
isWithdrawing= anywithdraw:*state that is active (not completed, fatal, or error states)requiresValid2FAMethod=withdraw:fatalANDerrorDetails.valid2FAMethodsis present
Flow Control
cancel() can be called from any state. It disposes the withdrawal machine and resets to flow:cancelled.
Hook Booleans Quick Reference
General
Exchanges
OAuth
QR Code
Wallet
Quote
Withdrawal
Multi-Step 2FA
Context Data Reference
Theflow.context object (and shortcut properties on the hook return) carry data through the flow:
Multi-Step 2FA Context
Whenrequires2FAMultiStep is true, the multiStep2FA object is populated:
Actions Reference
All actions are async callbacks returned by theuseBluvoFlow hook.
Next Steps
Error Handling & 2FA
Error recovery patterns, exchange-specific 2FA behavior, and multi-step MFA deep dive
OAuth2 Integration
Step-by-step implementation guide with React and Next.js
Code Samples
Full working examples for Next.js, React, and more
Wallet ID
How to generate and manage wallet IDs for your users