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
Name | Type | Description |
---|---|---|
networks | BitcoinNetwork[] | The bitcoin networks to use |
connectors | ConnectorWithMetadata[] | The connectors to use |
persist | boolean (optional) | If true, the config will persist in local storage |
provider | AbstractProvider (optional) | The provider to use for the network |
defaultPurpose | AddressPurpose (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";