Skip to content

Documentation / react-auth / ConnectorManager

Class: ConnectorManager

Extends

  • EventEmitter<ConnectorManagerEvents>

Constructors

new ConnectorManager(privyAppId, walletConnectCloudProjectId, rpcConfig, chains, defaultChain, store, walletList, shouldEnforceDefaultChainOnConnect, externalWalletConfig, privyAppName, privyAppLogo, walletChainType)

new ConnectorManager(privyAppId, walletConnectCloudProjectId, rpcConfig, chains, defaultChain, store, walletList, shouldEnforceDefaultChainOnConnect, externalWalletConfig, privyAppName, privyAppLogo?, walletChainType?): ConnectorManager

Parameters

privyAppId: string

walletConnectCloudProjectId: string

rpcConfig: RpcConfig

chains: Chain[]

defaultChain: Chain

store: Store

walletList: WalletListEntry[]

shouldEnforceDefaultChainOnConnect: boolean

externalWalletConfig: Required<ExternalWalletsConfig>

privyAppName: string

privyAppLogo?: string

walletChainType?: "ethereum-and-solana" | "ethereum-only" | "solana-only"

Returns

ConnectorManager

Overrides

EventEmitter<ConnectorManagerEvents>.constructor

Properties

activeWallet?

private activeWallet?: string


chains

private chains: Chain[]


defaultChain

private defaultChain: Chain


externalWalletConfig

private externalWalletConfig: Required<ExternalWalletsConfig>


initialized

initialized: boolean


privyAppId

private privyAppId: string


private privyAppLogo?: string


privyAppName

private privyAppName: string


rpcConfig

private rpcConfig: RpcConfig


shouldEnforceDefaultChainOnConnect

private shouldEnforceDefaultChainOnConnect: boolean


store

private store: Store


storedConnections

private storedConnections: StoredConnection[]


walletChainType

private walletChainType: "ethereum-and-solana" | "ethereum-only" | "solana-only"


walletConnectCloudProjectId

private walletConnectCloudProjectId: string


walletConnectors

walletConnectors: WalletConnector[]


walletList

private walletList: WalletListEntry[]

Accessors

wallets

get wallets(): BaseConnectedWallet[]

The core wallets array that is exposed to developers. It builds the wallets away with the following logic:

  1. Flatten all wallets from all connectors
  2. Sorted by connectedAt
  3. Active wallet is moved to front of array (if it exists)

Returns

BaseConnectedWallet[]

Methods

activeWalletSign()

activeWalletSign(message): Promise<null | string>

Parameters

message: string

Returns

Promise<null | string>

Deprecated

Deprecated: This feature will be removed and should be replaced by interfacing with wallets directly.

Performing personal_sign with the most recently connected wallet. If there is not a wallet connected, return null. Only supports signing with Ethereum wallets.


createEthereumWalletConnector()

createEthereumWalletConnector(connectorType, walletClientType, providers?): Promise<null | EthereumWalletConnector>

Creates a new wallet connector for the given connector type and wallet client type. If a connector already exists, it will be returned instead.

Parameters

connectorType: string

walletClientType: string

providers?: Object

providers.eip6963InjectedProvider?: EIP6963ProviderDetail<Object, "com.coinbase" | "com.enkrypt" | "io.metamask" | "io.zerion" | string & Object>

providers.legacyInjectedProvider?: any

Returns

Promise<null | EthereumWalletConnector>


findEmbeddedWalletConnectors()

findEmbeddedWalletConnectors(): EmbeddedWalletConnector[]

Helper function to find all embedded HD wallet connectors with connectorType: 'embedded'. Does not include embedded imported wallet connectors, which have connectorType: 'embedded_imported'.

Returns

EmbeddedWalletConnector[]


findSolanaWalletConnector()

findSolanaWalletConnector(connectorType, walletClientType): null | SolanaWalletConnector

Helper function to find a solana wallet connector by connector type and wallet client type.

Parameters

connectorType: string

walletClientType: string

Returns

null | SolanaWalletConnector


findWalletConnector()

findWalletConnector(connectorType, walletClientType): null | EthereumWalletConnector

Helper function to find a wallet connector by connector type and wallet client type.

Parameters

connectorType: string

walletClientType: string

Returns

null | EthereumWalletConnector


getEthereumProvider()

getEthereumProvider(): EIP1193Provider

Returns

EIP1193Provider

Deprecated

Deprecated: This feature will be removed and should be replaced by interfacing with wallets directly (wallets[0].getEthereumProvider()).

Build an Ethereum provider for the most recently connected wallet.


setActiveWallet()

setActiveWallet(address): void

Parameters

address: string

Returns

void

Deprecated

Deprecated: This feature will be removed and should be replaced by interfacing with wallets directly.