getConnectors
Action for getting all available Starknet wallet connectors.
Import
import { getConnectors } from "starkweb/core";
Usage
index.ts
import { getConnectors } from "starkweb/core";
import { config } from "./config";
const connectors = getConnectors(config);
// Access available connectors
connectors.forEach(connector => {
console.log("Connector ID:", connector.id);
console.log("Connector Name:", connector.name);
});
Return Type
import { type GetConnectorsReturnType } from "starkweb/core";
readonly Connector[]
Array of available connector instances that can be used to connect to wallets.
Example
example.ts
import { getConnectors } from "starkweb/core";
import { config } from "./config";
const connectors = getConnectors(config);
// Find a specific connector
const injectedConnector = connectors.find(
connector => connector.id === 'injected'
);
// Check available connectors
if (connectors.length > 0) {
console.log("Available connectors:");
connectors.forEach(connector => {
console.log({
id: connector.id,
name: connector.name,
ready: connector.ready,
});
});
}