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

131
node_modules/viem/linea/actions/estimateGas.ts generated vendored Normal file
View File

@@ -0,0 +1,131 @@
import type { Account } from '../../accounts/types.js'
import { parseAccount } from '../../accounts/utils/parseAccount.js'
import type { EstimateGasParameters as EstimateGasParameters_base } from '../../actions/public/estimateGas.js'
import type { Client } from '../../clients/createClient.js'
import type { Transport } from '../../clients/transports/createTransport.js'
import { AccountNotFoundError } from '../../errors/account.js'
import type { BaseError } from '../../errors/base.js'
import type { GetAccountParameter } from '../../types/account.js'
import type { Chain } from '../../types/chain.js'
import type { TransactionRequest } from '../../types/transaction.js'
import type { Filter } from '../../types/utils.js'
import { numberToHex } from '../../utils/encoding/toHex.js'
import { getCallError } from '../../utils/errors/getCallError.js'
import { extract } from '../../utils/formatters/extract.js'
import { formatTransactionRequest } from '../../utils/formatters/transactionRequest.js'
import {
type AssertRequestParameters,
assertRequest,
} from '../../utils/transaction/assertRequest.js'
import type { LineaRpcSchema } from '../types/rpc.js'
export type EstimateGasParameters<
chain extends Chain | undefined = Chain | undefined,
account extends Account | undefined = Account | undefined,
> = EstimateGasParameters_base<chain> & GetAccountParameter<account>
export type EstimateGasReturnType = {
gasLimit: bigint
baseFeePerGas: bigint
priorityFeePerGas: bigint
}
/**
* Estimates the gas and fees per gas necessary to complete a transaction without submitting it to the network.
*
* @param client - Client to use
* @param parameters - {@link EstimateGasParameters}
* @returns A gas estimate and fees per gas (in wei). {@link EstimateGasReturnType}
*
* @example
* import { createPublicClient, http, parseEther } from 'viem'
* import { linea } from 'viem/chains'
* import { estimateGas } from 'viem/linea'
*
* const client = createPublicClient({
* chain: linea,
* transport: http(),
* })
* const gasEstimate = await estimateGas(client, {
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
* value: 0n,
* })
*/
export async function estimateGas<
chain extends Chain | undefined,
account extends Account | undefined,
>(
client: Client<Transport, chain, account>,
args: EstimateGasParameters<chain>,
): Promise<EstimateGasReturnType> {
const { account: account_ = client.account } = args
if (!account_) throw new AccountNotFoundError()
const account = parseAccount(account_)
try {
const {
accessList,
blockNumber,
blockTag,
data,
gas,
gasPrice,
maxFeePerGas,
maxPriorityFeePerGas,
nonce,
to,
value,
...rest
} = args
const blockNumberHex =
typeof blockNumber === 'bigint' ? numberToHex(blockNumber) : undefined
const block = blockNumberHex || blockTag
assertRequest(args as AssertRequestParameters)
const chainFormat = client.chain?.formatters?.transactionRequest?.format
const format = chainFormat || formatTransactionRequest
const request = format(
{
// Pick out extra data that might exist on the chain's transaction request type.
...extract(rest, { format: chainFormat }),
account,
accessList,
data,
gas,
gasPrice,
maxFeePerGas,
maxPriorityFeePerGas,
nonce,
to,
value,
} as TransactionRequest,
'estimateGas',
)
type LineaEstimateGasSchema = Filter<
LineaRpcSchema,
{ Method: 'linea_estimateGas' }
>[0]
const { baseFeePerGas, gasLimit, priorityFeePerGas } =
await client.request<LineaEstimateGasSchema>({
method: 'linea_estimateGas',
params: block ? [request, block] : [request],
})
return {
baseFeePerGas: BigInt(baseFeePerGas),
gasLimit: BigInt(gasLimit),
priorityFeePerGas: BigInt(priorityFeePerGas),
}
} catch (err) {
throw getCallError(err as BaseError, {
...args,
account,
chain: client.chain,
})
}
}

53
node_modules/viem/linea/chainConfig.ts generated vendored Normal file
View File

@@ -0,0 +1,53 @@
import type { ChainConfig, ChainEstimateFeesPerGasFn } from '../types/chain.js'
import { estimateGas } from './actions/estimateGas.js'
export const chainConfig = {
fees: {
estimateFeesPerGas,
async maxPriorityFeePerGas({ block, client, request }) {
const response = await estimateFeesPerGas({
block,
client,
multiply: (x) => x,
request,
type: 'eip1559',
})
// Returning `null` will trigger the base `estimateMaxPriorityFeePerGas` to perform
// fallback mechanisms to estimate priority fee.
if (!response?.maxPriorityFeePerGas) return null
return response.maxPriorityFeePerGas
},
},
} as const satisfies ChainConfig
///////////////////////////////////////////////////////////////////////////
// Internal
///////////////////////////////////////////////////////////////////////////
async function estimateFeesPerGas({
client,
multiply,
request,
type,
}: Parameters<ChainEstimateFeesPerGasFn>[0]): ReturnType<ChainEstimateFeesPerGasFn> {
try {
const response = await estimateGas(client, {
...request,
account: request?.account!,
})
const { priorityFeePerGas: maxPriorityFeePerGas } = response
const baseFeePerGas = multiply(BigInt(response.baseFeePerGas))
const maxFeePerGas = baseFeePerGas + maxPriorityFeePerGas
if (type === 'legacy') return { gasPrice: maxFeePerGas }
return {
maxFeePerGas,
maxPriorityFeePerGas,
}
} catch {
// Returning `null` will trigger the base `estimateFeesPerGas` to perform
// fallback mechanisms to estimate fees.
return null
}
}

3
node_modules/viem/linea/chains.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
// biome-ignore lint/performance/noBarrelFile: entrypoint module
export { linea } from '../chains/definitions/linea.js'
export { lineaSepolia } from '../chains/definitions/lineaSepolia.js'

8
node_modules/viem/linea/index.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
// biome-ignore lint/performance/noBarrelFile: entrypoint module
export {
type EstimateGasParameters,
type EstimateGasReturnType,
estimateGas,
} from './actions/estimateGas.js'
export { linea, lineaSepolia } from './chains.js'

6
node_modules/viem/linea/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/linea/index.d.ts",
"module": "../_esm/linea/index.js",
"main": "../_cjs/linea/index.js"
}

28
node_modules/viem/linea/types/rpc.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import type { BlockNumber, BlockTag } from '../../types/block.js'
import type { Hex } from '../../types/misc.js'
import type {
RpcStateOverride,
RpcTransactionRequest,
} from '../../types/rpc.js'
export type LineaRpcSchema = [
{
Method: 'linea_estimateGas'
Parameters?:
| [transaction: RpcTransactionRequest]
| [
transaction: RpcTransactionRequest,
block: Hex | BlockNumber | BlockTag,
]
| [
transaction: RpcTransactionRequest,
block: BlockNumber | BlockTag,
stateOverride: RpcStateOverride,
]
ReturnType: {
gasLimit: Hex
baseFeePerGas: Hex
priorityFeePerGas: Hex
}
},
]