UNPKG

@bigmi/client

Version:

Reactive primitives for Bitcoin apps.

76 lines (75 loc) 3.53 kB
import { BaseError } from "@bigmi/core"; //#region src/errors/connectors.ts var ProviderNotFoundError = class extends BaseError { constructor() { super("Provider not found."); this.name = "ProviderNotFoundError"; this.message = "Provider not found"; this.code = 243; } }; var ChainNotSupportedError = class extends BaseError { constructor(chainId, connector) { super(`Chain ${chainId.toString()} is not supported by ${connector} `); this.name = "ChainNotSupportedError"; } }; var ConnectorChainIdDetectionError = class extends BaseError { constructor({ connector }) { super(`Chain ID detection failed for connector "${connector}".`, { metaMessages: [ "The connector needs at least one account to analyze the address format and determine the Bitcoin network.", "Please ensure the wallet is connected and has accounts available.", "Try reconnecting the wallet or checking if the wallet extension is properly installed." ] }); this.name = "ConnectorChainIdDetectionError"; } }; var ConnectorAlreadyConnectedError = class extends BaseError { constructor() { super("Connector already connected."); this.name = "ConnectorAlreadyConnectedError"; } }; var ConnectorNotConnectedError = class extends BaseError { constructor() { super("Connector not connected."); this.name = "ConnectorNotConnectedError"; } }; var ConnectorNotFoundError = class extends BaseError { constructor() { super("Connector not found."); this.name = "ConnectorNotFoundError"; } }; var ConnectorAccountNotFoundError = class extends BaseError { constructor({ address, connector }) { super(`Account "${address}" not found for connector "${connector}".`); this.name = "ConnectorAccountNotFoundError"; } }; var ConnectorChainMismatchError = class extends BaseError { constructor({ connectionChainId, connectorChainId }) { super(`The current chain of the connector (id: ${connectorChainId}) does not match the connection's chain (id: ${connectionChainId}).`, { metaMessages: [`Current Chain ID: ${connectorChainId}`, `Expected Chain ID: ${connectionChainId}`] }); this.name = "ConnectorChainMismatchError"; } }; var ConnectorNetworkMismatchError = class extends BaseError { constructor({ connectionNetwork, connectorNetwork }) { super(`The current network of the connector (${connectorNetwork}) does not match the connection's network (${connectionNetwork}).`, { metaMessages: [`Current Network: ${connectorNetwork}`, `Expected Network: ${connectionNetwork}`] }); this.name = "ConnectorNetworkMismatchError"; } }; var ConnectorUnavailableReconnectingError = class extends BaseError { constructor({ connector }) { super(`Connector "${connector.name}" unavailable while reconnecting.`, { details: [ "During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`.", "All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.", "This error commonly occurs for connectors that asynchronously inject after reconnection has already started." ].join(" ") }); this.name = "ConnectorUnavailableReconnectingError"; } }; //#endregion export { ChainNotSupportedError, ConnectorAccountNotFoundError, ConnectorAlreadyConnectedError, ConnectorChainIdDetectionError, ConnectorChainMismatchError, ConnectorNetworkMismatchError, ConnectorNotConnectedError, ConnectorNotFoundError, ConnectorUnavailableReconnectingError, ProviderNotFoundError }; //# sourceMappingURL=connectors.js.map