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

20
node_modules/viem/utils/unit/formatEther.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import { etherUnits } from '../../constants/unit.js'
import { type FormatUnitsErrorType, formatUnits } from './formatUnits.js'
export type FormatEtherErrorType = FormatUnitsErrorType
/**
* Converts numerical wei to a string representation of ether.
*
* - Docs: https://viem.sh/docs/utilities/formatEther
*
* @example
* import { formatEther } from 'viem'
*
* formatEther(1000000000000000000n)
* // '1'
*/
export function formatEther(wei: bigint, unit: 'wei' | 'gwei' = 'wei') {
return formatUnits(wei, etherUnits[unit])
}

20
node_modules/viem/utils/unit/formatGwei.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import { gweiUnits } from '../../constants/unit.js'
import { type FormatUnitsErrorType, formatUnits } from './formatUnits.js'
export type FormatGweiErrorType = FormatUnitsErrorType
/**
* Converts numerical wei to a string representation of gwei.
*
* - Docs: https://viem.sh/docs/utilities/formatGwei
*
* @example
* import { formatGwei } from 'viem'
*
* formatGwei(1000000000n)
* // '1'
*/
export function formatGwei(wei: bigint, unit: 'wei' = 'wei') {
return formatUnits(wei, gweiUnits[unit])
}

32
node_modules/viem/utils/unit/formatUnits.ts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import type { ErrorType } from '../../errors/utils.js'
export type FormatUnitsErrorType = ErrorType
/**
* Divides a number by a given exponent of base 10 (10exponent), and formats it into a string representation of the number..
*
* - Docs: https://viem.sh/docs/utilities/formatUnits
*
* @example
* import { formatUnits } from 'viem'
*
* formatUnits(420000000000n, 9)
* // '420'
*/
export function formatUnits(value: bigint, decimals: number) {
let display = value.toString()
const negative = display.startsWith('-')
if (negative) display = display.slice(1)
display = display.padStart(decimals, '0')
let [integer, fraction] = [
display.slice(0, display.length - decimals),
display.slice(display.length - decimals),
]
fraction = fraction.replace(/(0+)$/, '')
return `${negative ? '-' : ''}${integer || '0'}${
fraction ? `.${fraction}` : ''
}`
}

21
node_modules/viem/utils/unit/parseEther.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import { etherUnits } from '../../constants/unit.js'
import type { ErrorType } from '../../errors/utils.js'
import { type ParseUnitsErrorType, parseUnits } from './parseUnits.js'
export type ParseEtherErrorType = ParseUnitsErrorType | ErrorType
/**
* Converts a string representation of ether to numerical wei.
*
* - Docs: https://viem.sh/docs/utilities/parseEther
*
* @example
* import { parseEther } from 'viem'
*
* parseEther('420')
* // 420000000000000000000n
*/
export function parseEther(ether: string, unit: 'wei' | 'gwei' = 'wei') {
return parseUnits(ether, etherUnits[unit])
}

21
node_modules/viem/utils/unit/parseGwei.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import { gweiUnits } from '../../constants/unit.js'
import type { ErrorType } from '../../errors/utils.js'
import { type ParseUnitsErrorType, parseUnits } from './parseUnits.js'
export type ParseGweiErrorType = ParseUnitsErrorType | ErrorType
/**
* Converts a string representation of gwei to numerical wei.
*
* - Docs: https://viem.sh/docs/utilities/parseGwei
*
* @example
* import { parseGwei } from 'viem'
*
* parseGwei('420')
* // 420000000000n
*/
export function parseGwei(ether: string, unit: 'wei' = 'wei') {
return parseUnits(ether, gweiUnits[unit])
}

57
node_modules/viem/utils/unit/parseUnits.ts generated vendored Normal file
View File

@@ -0,0 +1,57 @@
import { InvalidDecimalNumberError } from '../../errors/unit.js'
import type { ErrorType } from '../../errors/utils.js'
export type ParseUnitsErrorType = ErrorType
/**
* Multiplies a string representation of a number by a given exponent of base 10 (10exponent).
*
* - Docs: https://viem.sh/docs/utilities/parseUnits
*
* @example
* import { parseUnits } from 'viem'
*
* parseUnits('420', 9)
* // 420000000000n
*/
export function parseUnits(value: string, decimals: number) {
if (!/^(-?)([0-9]*)\.?([0-9]*)$/.test(value))
throw new InvalidDecimalNumberError({ value })
let [integer, fraction = '0'] = value.split('.')
const negative = integer.startsWith('-')
if (negative) integer = integer.slice(1)
// trim trailing zeros.
fraction = fraction.replace(/(0+)$/, '')
// round off if the fraction is larger than the number of decimals.
if (decimals === 0) {
if (Math.round(Number(`.${fraction}`)) === 1)
integer = `${BigInt(integer) + 1n}`
fraction = ''
} else if (fraction.length > decimals) {
const [left, unit, right] = [
fraction.slice(0, decimals - 1),
fraction.slice(decimals - 1, decimals),
fraction.slice(decimals),
]
const rounded = Math.round(Number(`${unit}.${right}`))
if (rounded > 9)
fraction = `${BigInt(left) + BigInt(1)}0`.padStart(left.length + 1, '0')
else fraction = `${left}${rounded}`
if (fraction.length > decimals) {
fraction = fraction.slice(1)
integer = `${BigInt(integer) + 1n}`
}
fraction = fraction.slice(0, decimals)
} else {
fraction = fraction.padEnd(decimals, '0')
}
return BigInt(`${negative ? '-' : ''}${integer}${fraction}`)
}