import { expectTypeOf, test } from 'vitest' import type { JsonRpcAccount } from '../accounts/types.js' import { localhost } from '../chains/index.js' import { type WalletClient, createWalletClient } from './createWalletClient.js' import { http } from './transports/http.js' test('with chain', () => { const client = createWalletClient({ chain: localhost, transport: http(), }) expectTypeOf(client).toMatchTypeOf() expectTypeOf(client.chain).toEqualTypeOf(localhost) }) test('without chain', () => { const client = createWalletClient({ transport: http(), }) expectTypeOf(client).toMatchTypeOf() expectTypeOf(client.chain).toEqualTypeOf(undefined) }) test('with account', () => { const client = createWalletClient({ account: '0x', transport: http(), }) expectTypeOf(client).toMatchTypeOf() expectTypeOf(client.account).toEqualTypeOf>({ address: '0x', type: 'json-rpc', }) }) test('without account', () => { const client = createWalletClient({ transport: http(), }) expectTypeOf(client).toMatchTypeOf() expectTypeOf(client.account).toEqualTypeOf(undefined) })