From 0779ea2ab792f8aade9f40acbd597210df9bab8a Mon Sep 17 00:00:00 2001 From: Tom Meagher Date: Thu, 21 Nov 2024 12:29:15 -0500 Subject: [PATCH] chore: tweaks --- src/Porto.ts | 12 ++++-------- src/internal/provider.ts | 2 +- src/internal/wagmi/core.ts | 6 +++--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Porto.ts b/src/Porto.ts index 79bdd5c..d4e3418 100644 --- a/src/Porto.ts +++ b/src/Porto.ts @@ -37,13 +37,13 @@ export function create< ...Chains.Chain[], ] = typeof defaultConfig.chains, >(config?: Config): Porto -export function create(config?: Config | undefined): Porto { +export function create(config: Config | undefined = {}): Porto { const { announceProvider = defaultConfig.announceProvider, chains = defaultConfig.chains, headless = defaultConfig.headless, transports = defaultConfig.transports, - } = config ?? {} + } = config const keystoreHost = (() => { if (config?.keystoreHost === 'self') return undefined @@ -91,11 +91,7 @@ export function create(config?: Config | undefined): Porto { ...account, keys: account.keys.map((key) => ({ ...key, - ...('raw' in key - ? { - raw: undefined, - } - : {}), + ...('raw' in key ? { raw: undefined } : {}), })), })), chain: state.chain, @@ -115,7 +111,7 @@ export function create(config?: Config | undefined): Porto { headless, keystoreHost, transports, - } as Config, + } satisfies Config, store, }) diff --git a/src/internal/provider.ts b/src/internal/provider.ts index ab28b21..d3f177e 100644 --- a/src/internal/provider.ts +++ b/src/internal/provider.ts @@ -1,4 +1,5 @@ import * as Mipd from 'mipd' +import type { RpcSchema } from 'ox' import * as Address from 'ox/Address' import * as Hex from 'ox/Hex' import * as Json from 'ox/Json' @@ -7,7 +8,6 @@ import * as ox_Provider from 'ox/Provider' import * as PublicKey from 'ox/PublicKey' import * as RpcResponse from 'ox/RpcResponse' import * as TypedData from 'ox/TypedData' -import type { RpcSchema } from 'ox' import type * as Chains from '../Chains.js' import type { Config, Store } from '../Porto.js' diff --git a/src/internal/wagmi/core.ts b/src/internal/wagmi/core.ts index fb96f1a..6b631e4 100644 --- a/src/internal/wagmi/core.ts +++ b/src/internal/wagmi/core.ts @@ -7,17 +7,17 @@ import { type Hex, } from 'viem' import { - ConnectorAlreadyConnectedError, - ProviderNotFoundError, type BaseErrorType, type Config, type Connector, + ConnectorAlreadyConnectedError, type CreateConnectorFn, + ProviderNotFoundError, } from 'wagmi' import { + type ConnectReturnType, getConnectorClient, disconnect as wagmi_disconnect, - type ConnectReturnType, } from 'wagmi/actions' import type {