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

View File

@@ -0,0 +1,67 @@
import type { Address } from 'abitype'
import { SignatureErc8010 } from 'ox/erc8010'
import type { ErrorType } from '../../errors/utils.js'
import type { SignedAuthorization } from '../../types/authorization.js'
import type { Hex } from '../../types/misc.js'
import type { OneOf, Prettify } from '../../types/utils.js'
import { numberToHex } from '../encoding/toHex.js'
import {
type IsErc8010SignatureErrorType,
isErc8010Signature,
} from './isErc8010Signature.js'
export type ParseErc8010SignatureParameters = Hex
export type ParseErc8010SignatureReturnType = Prettify<
OneOf<
| {
/** Address of the initializer. */
address?: Address | undefined
/** Authorization signed by the delegatee. */
authorization: SignedAuthorization
/** Data to initialize the delegation. */
data?: Hex | undefined
/** The original signature. */
signature: Hex
}
| {
/** The original signature. */
signature: Hex
}
>
>
export type ParseErc8010SignatureErrorType =
| IsErc8010SignatureErrorType
| ErrorType
/**
* @description Parses a hex-formatted ERC-8010 flavoured signature.
* If the signature is not in ERC-8010 format, then the underlying (original) signature is returned.
*
* @param signature ERC-8010 signature in hex format.
* @returns The parsed ERC-8010 signature.
*/
export function parseErc8010Signature(
signature: ParseErc8010SignatureParameters,
): ParseErc8010SignatureReturnType {
if (!isErc8010Signature(signature)) return { signature }
const {
authorization: authorization_ox,
to,
...rest
} = SignatureErc8010.unwrap(signature)
return {
authorization: {
address: authorization_ox.address,
chainId: authorization_ox.chainId,
nonce: Number(authorization_ox.nonce),
r: numberToHex(authorization_ox.r, { size: 32 }),
s: numberToHex(authorization_ox.s, { size: 32 }),
yParity: authorization_ox.yParity,
},
...(to ? { address: to } : {}),
...rest,
}
}