Skip to content

Configuration ​

MIDL JS SDK 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 | { enabled: boolean; storageKey?: string } (optional)If true, the config will persist in local storage
providerAbstractProvider (optional)The provider to use for the network
runesProviderAbstractRunesProvider (optional)The runes data provider to use
defaultPurposeAddressPurpose (optional)The default address to use for signing transactions, etc.

NOTE

runesProvider defaults to MaestroSymphonyProvider. When using the object form for persist, storageKey controls the local storage key (defaults to midl-js).

Available Networks ​

MIDL JS SDK 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 SDK 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,
  okxConnector,
  magicEdenConnector,
 } from "@midl/connectors";

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

Released under the MIT License