ConnectRequestOptions
Configuration options passed to the request function to control wallet selection, provider behavior, and local storage caching.
Definition
interface ConnectRequestOptions {
provider?: StacksProvider;
forceWalletSelect?: boolean;
persistWalletSelect?: boolean;
enableOverrides?: boolean;
enableLocalStorage?: boolean;
defaultProviders?: WbipProvider[];
approvedProviderIds?: string[];
walletConnect?: Partial<Pick<UniversalConnectorConfig, 'metadata' | 'networks'>> &
Omit<UniversalConnectorConfig, 'metadata' | 'networks'>;
}Properties
provider (optional)
Type:
StacksProviderDefault: Previously selected provider, or
null
The wallet provider to use for the request. If none is provided, the wallet selection modal is displayed to the user (unless a wallet was previously selected and forceWalletSelect is false).
forceWalletSelect (optional)
Type:
booleanDefault:
false
When true, the wallet selection modal is always shown, even if a wallet was previously selected. This is useful when you want to allow the user to switch wallets.
persistWalletSelect (optional)
Type:
booleanDefault:
true
When true, the wallet selected by the user is remembered for subsequent requests. The selected provider ID is stored so future calls to request automatically use the same wallet without prompting again.
enableOverrides (optional)
Type:
booleanDefault:
true
When true, request automatically rewrites method names and parameter formats to normalize behavior across different wallet providers (e.g. Xverse, Leather, Fordefi). This helps ensure consistent behavior regardless of which wallet the user selects.
Examples of overrides:
Converting
getAddressestowallet_connectfor Xverse-like wallets.Normalizing
amounttypes betweennumberandstringdepending on the wallet.Transforming
signPsbtinput formats to match each wallet's expected schema.Normalizing response fields like
txIdvstxidandhexvspsbt.
Set to false if you are handling provider-specific formatting yourself.
enableLocalStorage (optional)
Type:
booleanDefault:
true
When true, address results from getAddresses calls are automatically cached in local storage. This enables the isConnected and getLocalStorage functions to work.
defaultProviders (optional)
Type:
WbipProvider[]Default:
DEFAULT_PROVIDERS
The list of wallet providers to display in the wallet selection modal. By default, this includes Leather, Xverse, Asigna, and Fordefi.
approvedProviderIds (optional)
Type:
string[]Default:
undefined(all providers shown)
A whitelist of provider IDs to show in the wallet selection modal. If provided, only providers whose id matches one of the entries in this array will be displayed. Both default and installed providers are filtered.
Notes
If using walletConnect alongside approvedProviderIds, make sure to include "WalletConnectProvider" in the array.
walletConnect (optional)
Type:
Partial<Pick<UniversalConnectorConfig, 'metadata' | 'networks'>> & Omit<UniversalConnectorConfig, 'metadata' | 'networks'>
Configuration for WalletConnect. If provided, the WalletConnect provider is automatically initialized and added to the wallet selection modal.
projectIdis required.metadataandnetworksare optional and will use default values if not provided.
Notes
If using walletConnect alongside approvedProviderIds, include "WalletConnectProvider" in the approvedProviderIds array so the WalletConnect option is visible in the modal.
Last updated
Was this helpful?