Skip to content

Configuration ​

MIDL.js shares a common configuration object across all actions and hooks. This configuration object is used to specify the network, connectors, and other settings.

Creating a Configuration Object ​

To create a configuration object, use the createConfig function:

ts
import {
  createConfig,
  regtest,
} from "@midl/core";
import { xverseConnector } from "@midl/connectors";

export const config = createConfig({
  networks: [regtest],
  connectors: [xverseConnector()],
  persist: true,
});

Configuration Options ​

NameTypeDescription
networksBitcoinNetwork[]The bitcoin networks to use
connectorsConnectorWithMetadata[]The connectors to use
persistboolean (optional)If true, the config will persist in local storage
providerAbstractProvider (optional)The provider to use for the network
defaultPurposeAddressPurpose (optional)The default address to use for signing transactions, etc.

Available Networks ​

MIDL.js supports the following networks:

  • mainnet
  • testnet
  • testnet4
  • signet
  • regtest

Importing Networks ​

ts
import { mainnet, testnet, regtest, testnet4, signet } from "@midl/core";

Supported Connectors (Wallets) ​

MIDL.js supports the following connectors:

You can also create your own custom connector by implementing the CreateConnectorFn interface. You can find an implementation examples in the @midl/connectors package.

Importing Connectors ​

ts
import { 
  xverseConnector,
  leatherConnector,
  unisatConnector,
  phantomConnector,
  bitgetConnector,
  magicEdenConnector,
 } from "@midl/connectors";

 import {  keyPairConnector } from "@midl/node";

Released under the MIT License