Skip to content

Commit

Permalink
refactor: create filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Aug 29, 2023
1 parent 776ff25 commit 74823b1
Show file tree
Hide file tree
Showing 79 changed files with 111 additions and 108 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/actions/connect.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ResourceUnavailableRpcError, UserRejectedRequestError } from 'viem'
import { type Address } from 'viem'

import { type Config, type Connector } from '../config.js'
import { type CreateConnectorFn } from '../connector.js'
import { type Config, type Connector } from '../createConfig.js'
import { type CreateConnectorFn } from '../createConnector.js'
import type { BaseError } from '../errors/base.js'
import { ConnectorAlreadyConnectedError } from '../errors/config.js'
import type { ChainIdParameter } from '../types/properties.js'
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/actions/disconnect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { type Config, type Connection, type Connector } from '../config.js'
import {
type Config,
type Connection,
type Connector,
} from '../createConfig.js'
import { ConnectorNotFoundError } from '../errors/config.js'

export type DisconnectParameters = {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getAccount.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { config } from '@wagmi/test'
import type { Address } from 'viem'
import { expectTypeOf, test } from 'vitest'

import type { Connector } from '../config.js'
import type { Connector } from '../createConfig.js'
import { getAccount } from './getAccount.js'

test('states', () => {
Expand Down
18 changes: 7 additions & 11 deletions packages/core/src/actions/getAccount.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Address } from 'viem'

import { type Config, type Connector } from '../config.js'
import { type Config, type Connector } from '../createConfig.js'
import { deepEqual } from '../utils/deepEqual.js'

export type GetAccountReturnType =
Expand Down Expand Up @@ -125,17 +125,13 @@ export function watchAccount(
): WatchAccountReturnType {
return config.subscribe(() => getAccount(config), onChange, {
equalityFn(a, b) {
const { connector: aConnector, ...aRest } = a
const { connector: bConnector, ...bRest } = b
return (
// check addresses
a.address === b.address &&
deepEqual(a.addresses, b.addresses) &&
// check chain
a.chainId === b.chainId &&
// check stable connector id properties
a.connector?.id === b.connector?.id &&
a.connector?.uid === b.connector?.uid &&
// check status
a.status === b.status
deepEqual(aRest, bRest) &&
// check connector separately
aConnector?.id === bConnector?.id &&
aConnector?.uid === bConnector?.uid
)
},
})
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
getBalance as viem_getBalance,
} from 'viem/actions'

import type { Config } from '../config.js'
import type { Config } from '../createConfig.js'
import type { ChainIdParameter } from '../types/properties.js'
import { type Unit } from '../types/unit.js'
import { type Evaluate } from '../types/utils.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getBlockNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
watchBlockNumber as viem_watchBlockNumber,
} from 'viem/actions'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { ChainIdParameter } from '../types/properties.js'
import type { Evaluate } from '../types/utils.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getChainId.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Config } from '../config.js'
import type { Config } from '../createConfig.js'

export type GetChainIdReturnType<config extends Config = Config> =
config['chains'][number]['id']
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getConnections.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { config } from '@wagmi/test'
import { describe, expect, test } from 'vitest'

import type { Connection } from '../config.js'
import type { Connection } from '../createConfig.js'
import { connect } from './connect.js'
import { disconnect } from './disconnect.js'
import { getConnections, watchConnections } from './getConnections.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getConnections.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Config, Connection } from '../config.js'
import type { Config, Connection } from '../createConfig.js'
import type { Evaluate } from '../types/utils.js'
import { deepEqual } from '../utils/deepEqual.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getConnectorClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
custom,
} from 'viem'

import type { Config, Connection, Connector } from '../config.js'
import type { Config, Connection, Connector } from '../createConfig.js'
import { ConnectorNotFoundError } from '../errors/config.js'
import type { ChainIdParameter } from '../types/properties.js'
import type { Evaluate } from '../types/utils.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getEnsAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getEnsAddress as viem_getEnsAddress,
} from 'viem/actions'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { ChainIdParameter } from '../types/properties.js'
import type { Evaluate } from '../types/utils.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getEnsAvatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getEnsAvatar as viem_getEnsAvatar,
} from 'viem/actions'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { ChainIdParameter } from '../types/properties.js'
import type { Evaluate } from '../types/utils.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getEnsName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getEnsName as viem_getEnsName,
} from 'viem/actions'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { ChainIdParameter } from '../types/properties.js'
import type { Evaluate } from '../types/utils.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getEnsResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getEnsResolver as viem_getEnsResolver,
} from 'viem/actions'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { ChainIdParameter } from '../types/properties.js'
import type { Evaluate } from '../types/utils.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getFeeData.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { formatUnits, parseGwei } from 'viem'
import { getBlock, getGasPrice } from 'viem/actions'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { ChainIdParameter } from '../types/properties.js'
import type { Unit } from '../types/unit.js'
import type { Evaluate } from '../types/utils.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
trim,
} from 'viem'

import type { Config } from '../config.js'
import type { Config } from '../createConfig.js'
import type { ChainIdParameter } from '../types/properties.js'
import type { Unit } from '../types/unit.js'
import type { Evaluate } from '../types/utils.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getTransaction.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { http } from 'viem'
import { celo, mainnet } from 'viem/chains'
import { expectTypeOf, test } from 'vitest'

import { createConfig } from '../config.js'
import { createConfig } from '../createConfig.js'
import { getTransaction } from './getTransaction.js'

test('chain formatters', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/getTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
getTransaction as viem_getTransaction,
} from 'viem/actions'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { SelectChains } from '../types/chain.js'
import type { ChainIdParameter } from '../types/properties.js'
import { type Evaluate } from '../types/utils.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/multicall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
} from 'viem'
import { multicall as viem_multicall } from 'viem/actions'

import type { Config } from '../config.js'
import type { Config } from '../createConfig.js'
import type { ChainIdParameter } from '../types/properties.js'

export type MulticallParameters<
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/prepareSendTransaction.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { http } from 'viem'
import { celo, mainnet } from 'viem/chains'
import { expectTypeOf, test } from 'vitest'

import { createConfig } from '../config.js'
import { createConfig } from '../createConfig.js'
import {
type PrepareSendTransactionParameters,
prepareSendTransaction,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/prepareSendTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Account, Address, Chain, SendTransactionParameters } from 'viem'
import { estimateGas } from 'viem/actions'

import type { Config } from '../config.js'
import type { Config } from '../createConfig.js'
import type { SelectChains } from '../types/chain.js'
import type {
ChainIdParameter,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/readContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
readContract as viem_readContract,
} from 'viem/actions'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { ChainIdParameter } from '../types/properties.js'

export type ReadContractParameters<
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/readContracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { abi, address, chain } from '@wagmi/test'
import { http, type MulticallResponse } from 'viem'
import { expect, expectTypeOf, test, vi } from 'vitest'

import { createConfig } from '../config.js'
import { createConfig } from '../createConfig.js'
import * as multicall from './multicall.js'
import * as readContract from './readContract.js'
import { readContracts } from './readContracts.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/readContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
} from 'viem'
import { ContractFunctionExecutionError } from 'viem'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import { type ChainIdParameter } from '../types/properties.js'
import { multicall } from './multicall.js'
import { readContract } from './readContract.js'
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/actions/reconnect.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Address } from 'viem'

import type { Config, Connection, Connector } from '../config.js'
import { type CreateConnectorFn } from '../connector.js'
import type { Config, Connection, Connector } from '../createConfig.js'
import { type CreateConnectorFn } from '../createConnector.js'
import type { Evaluate } from '../types/utils.js'

export type ReconnectParameters = {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/sendTransaction.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { http, parseEther } from 'viem'
import { celo, mainnet } from 'viem/chains'
import { expectTypeOf, test } from 'vitest'

import { createConfig } from '../config.js'
import { createConfig } from '../createConfig.js'
import { prepareSendTransaction } from './prepareSendTransaction.js'
import {
type SendTransactionParameters,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/sendTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
} from 'viem'
import { sendTransaction as viem_sendTransaction } from 'viem/actions'

import type { Config } from '../config.js'
import type { Config } from '../createConfig.js'
import type { SelectChains } from '../types/chain.js'
import type {
ChainIdParameter,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/signMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
signMessage as viem_signMessage,
} from 'viem/actions'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { ConnectorParameter } from '../types/properties.js'
import type { Evaluate, Omit } from '../types/utils.js'
import { getConnectorClient } from './getConnectorClient.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/signTypedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
signTypedData as viem_signTypedData,
} from 'viem/actions'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { ConnectorParameter } from '../types/properties.js'
import { getConnectorClient } from './getConnectorClient.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/simulateContract.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { http, type Address } from 'viem'
import { celo, mainnet } from 'viem/chains'
import { expectTypeOf, test } from 'vitest'

import { createConfig } from '../config.js'
import { createConfig } from '../createConfig.js'
import {
type SimulateContractParameters,
type SimulateContractReturnType,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/simulateContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
simulateContract as viem_simulateContract,
} from 'viem/actions'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { SelectChains } from '../types/chain.js'
import type {
ChainIdParameter,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/switchAccount.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Address } from 'viem'

import { type Config, type Connector } from '../config.js'
import { type Config, type Connector } from '../createConfig.js'
import { ConnectorNotFoundError } from '../errors/config.js'

export type SwitchAccountParameters = {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/switchChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
UserRejectedRequestError,
} from 'viem'

import { type Config } from '../config.js'
import { type Config } from '../createConfig.js'
import type { BaseError } from '../errors/base.js'
import { ChainNotConfiguredError } from '../errors/config.js'
import { SwitchChainNotSupportedError } from '../errors/connector.js'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { http } from 'viem'
import { celo, mainnet } from 'viem/chains'
import { expectTypeOf, test } from 'vitest'

import { createConfig } from '../config.js'
import { createConfig } from '../createConfig.js'
import { waitForTransactionReceipt } from './waitForTransactionReceipt.js'

test('chain formatters', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/waitForTransactionReceipt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
waitForTransactionReceipt as viem_waitForTransactionReceipt,
} from 'viem/actions'

import type { Config } from '../config.js'
import type { Config } from '../createConfig.js'
import type { SelectChains } from '../types/chain.js'
import type { ChainIdParameter } from '../types/properties.js'
import type { Evaluate } from '../types/utils.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/watchPendingTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
watchPendingTransactions as viem_watchPendingTransactions,
} from 'viem/actions'

import type { Config } from '../config.js'
import type { Config } from '../createConfig.js'
import type { ChainIdParameter } from '../types/properties.js'
import type { Evaluate } from '../types/utils.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/writeContract.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { http, type Address } from 'viem'
import { celo, mainnet } from 'viem/chains'
import { expectTypeOf, test } from 'vitest'

import { createConfig } from '../config.js'
import { createConfig } from '../createConfig.js'
import { simulateContract } from './simulateContract.js'
import { type WriteContractParameters, writeContract } from './writeContract.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/actions/writeContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
} from 'viem'
import { writeContract as viem_writeContract } from 'viem/actions'

import type { Config } from '../config.js'
import type { Config } from '../createConfig.js'
import type { SelectChains } from '../types/chain.js'
import type {
ChainIdParameter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { http, createClient } from 'viem'
import { mainnet, sepolia } from 'viem/chains'
import { expectTypeOf, test } from 'vitest'

import { createConfig } from './config.js'
import { createConfig } from './createConfig.js'

test('high-level config', () => {
// Create config without needing to import viem modules.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { http } from 'viem'
import { mainnet } from 'viem/chains'
import { expect, test } from 'vitest'

import { createConfig } from './config.js'
import { createConfig } from './createConfig.js'

test('exports', () => {
const config = createConfig({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import {
import { persist, subscribeWithSelector } from 'zustand/middleware'
import { createStore } from 'zustand/vanilla'

import { type ConnectorEventMap, type CreateConnectorFn } from './connector.js'
import { Emitter, type EventData, createEmitter } from './emitter.js'
import {
type ConnectorEventMap,
type CreateConnectorFn,
} from './createConnector.js'
import { Emitter, type EventData, createEmitter } from './createEmitter.js'
import { type Storage, createStorage, noopStorage } from './createStorage.js'
import { ChainNotConfiguredError } from './errors/config.js'
import { type Storage, createStorage, noopStorage } from './storage.js'
import type { Evaluate, OneOf } from './types/utils.js'
import { uid } from './utils/uid.js'

Expand Down
Loading

1 comment on commit 74823b1

@vercel
Copy link

@vercel vercel bot commented on 74823b1 Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wagmi-v2 – ./docs

wagmi-v2.vercel.app
wagmi-v2-git-alpha-wagmi-dev.vercel.app
wagmi-v2-wagmi-dev.vercel.app
alpha.wagmi.sh

Please sign in to comment.