Custom Modal
Programmatically connect crypto wallets
Overview
The directConnectWallet() function allows you to connect a cryptocurrency wallet directly through code, bypassing the standard wallet selection modal. Upon successful connection, the withdrawal process starts automatically.
javascript
await window.directConnectWallet(walletName)walletName
string
Exact wallet name (case-sensitive)
Returns: Promise<void>
Supported Wallets
TronLink
TronLink
Adapter
OKX Wallet
OKX
Adapter
Bitget Wallet
Bitget
Adapter
Ledger
Ledger
Adapter
WalletConnect
WalletConnect
Backend Modal
imToken
imToken
Adapter
TokenPocket
TokenPocket
Adapter
Trust Wallet
Trust Wallet
Adapter / Backend Modal*
Gate.io Wallet
GateWallet
Adapter
Bybit Wallet
Bybit Wallet
Adapter
Binance Web3 Wallet
Binance Web3 Wallet
Adapter
FoxWallet
FoxWallet
Adapter
TomoWallet
TomoWallet
Adapter
Note: Trust Wallet automatically determines the connection type based on platform and browser extension availability.
Important Notes
Case Sensitivity
Wallet names are case-sensitive and must include exact spacing. Incorrect naming will cause connection failures.
javascript
Automatic Flow Initiation
After successful wallet connection, the function automatically:
Updates the connection UI state
Retrieves token data from the server
Initiates the withdrawal process
Usage Examples
Basic Implementation
html
Dynamic Wallet Selection
javascript
Auto-Connect on Page Load
javascript
URL Parameter Connection
javascript
Connection with Fallback
javascript
Framework Integration
React
jsx
Vue.js
vue
Platform-Specific Integration
Mobile App (React Native WebView)
javascript
WalletConnect QR Code
javascript
Telegram Mini App
javascript
Technical Details
Connection Flow
Backend Modal vs Adapter
Backend Modal
WalletConnect, Trust Wallet (mobile/no extension)
Server-side modal handling
Adapter
All others
Direct browser extension connection
Troubleshooting
Common Errors
Error: Unknown wallet in directConnectWallet
Cause: Incorrect wallet name spelling or case
Solution: Use exact wallet names from the supported wallets table
javascript
Error: Adapter not found in directConnectWallet
Cause: Wallet adapter not loaded in ADAPTERS array
Solution: Ensure the adapter is properly initialized before calling {% endtab %}
Log: Already connected to same provider — restarting flow
Behavior: Normal operation — the flow automatically restarts {% endtab %} {% endtabs %}
Debug Commands
javascript
FAQ
Can I connect multiple wallets simultaneously?
No. The system supports only one active wallet connection at a time. Connecting a new wallet automatically disconnects the previous one. {% endhint %}
Last updated