FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

51
node_modules/viem/actions/public/getChainId.ts generated vendored Normal file
View File

@@ -0,0 +1,51 @@
import type { Account } from '../../accounts/types.js'
import type { Client } from '../../clients/createClient.js'
import type { Transport } from '../../clients/transports/createTransport.js'
import type { ErrorType } from '../../errors/utils.js'
import type { Chain } from '../../types/chain.js'
import type { RequestErrorType } from '../../utils/buildRequest.js'
import {
type HexToNumberErrorType,
hexToNumber,
} from '../../utils/encoding/fromHex.js'
export type GetChainIdReturnType = number
export type GetChainIdErrorType =
| HexToNumberErrorType
| RequestErrorType
| ErrorType
/**
* Returns the chain ID associated with the current network.
*
* - Docs: https://viem.sh/docs/actions/public/getChainId
* - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid)
*
* @param client - Client to use
* @returns The current chain ID. {@link GetChainIdReturnType}
*
* @example
* import { createPublicClient, http } from 'viem'
* import { mainnet } from 'viem/chains'
* import { getChainId } from 'viem/public'
*
* const client = createPublicClient({
* chain: mainnet,
* transport: http(),
* })
* const chainId = await getChainId(client)
* // 1
*/
export async function getChainId<
chain extends Chain | undefined,
account extends Account | undefined,
>(client: Client<Transport, chain, account>): Promise<GetChainIdReturnType> {
const chainIdHex = await client.request(
{
method: 'eth_chainId',
},
{ dedupe: true },
)
return hexToNumber(chainIdHex)
}