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, leather } from "@midl-xyz/midl-js-core";

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

Configuration Options

NameTypeDescription
networksBitcoinNetwork[]The bitcoin networks to use
connectorsCreateConnectorFn[]The connectors to use
persistboolean (optional)If true, the config will persist in local storage

Available Networks

MIDL.js supports the following networks:

  • mainnet
  • testnet
  • regtest
  • testnet4

Importing Networks

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

Supported Connectors (Wallets)

MIDL.js supports the following connectors:

You can also create your own custom connector by implementing the CreateConnectorFn interface.

Importing Connectors

ts
import { leather, satsConnect, unisat, keyPair } from "@midl-xyz/midl-js-core";