From a9a3d37f9ad1c7e6b1861db261ca02a8e67ee44b Mon Sep 17 00:00:00 2001 From: jxom Date: Fri, 25 Oct 2024 15:43:34 +1100 Subject: [PATCH] chore: sync tsdoc --- src/internal/AbiConstructor/decode.ts | 2 +- src/internal/AbiFunction/decodeResult.ts | 3 ++- src/internal/AesGcm/decrypt.ts | 2 +- src/internal/AesGcm/encrypt.ts | 2 +- .../Blobs/commitmentToVersionedHash.ts | 2 +- .../Blobs/commitmentsToVersionedHashes.ts | 2 +- src/internal/Blobs/from.ts | 2 +- .../Blobs/sidecarsToVersionedHashes.ts | 2 +- src/internal/Blobs/to.ts | 20 +++++++++---------- src/internal/Blobs/toCommitments.ts | 16 +++++++-------- src/internal/Blobs/toProofs.ts | 18 ++++++++--------- src/internal/Blobs/toSidecars.ts | 2 +- src/internal/Blobs/toVersionedHashes.ts | 2 +- src/internal/Bytes/fromHex.ts | 2 +- src/internal/Bytes/toBoolean.ts | 14 ++++++------- src/internal/Bytes/toHex.ts | 4 ++-- src/internal/Bytes/toString.ts | 2 +- src/internal/Filter/fromRpc.ts | 6 +++--- src/internal/Hash/keccak256.ts | 2 +- src/internal/Hash/ripemd160.ts | 2 +- src/internal/Hash/sha256.ts | 2 +- src/internal/HdKey/fromExtendedKey.ts | 1 - src/internal/HdKey/fromJson.ts | 1 - src/internal/Hex/assert.ts | 2 +- src/internal/Hex/from.ts | 1 - src/internal/Hex/fromBoolean.ts | 2 +- src/internal/Hex/fromBytes.ts | 2 +- src/internal/Hex/fromNumber.ts | 2 +- src/internal/Hex/fromString.ts | 2 +- src/internal/Hex/slice.ts | 15 +++++++------- src/internal/Hex/toBigInt.ts | 2 +- src/internal/Hex/toBoolean.ts | 2 +- src/internal/Hex/toBytes.ts | 2 +- src/internal/Hex/toNumber.ts | 2 +- src/internal/Hex/toString.ts | 2 +- src/internal/Hex/validate.ts | 2 +- src/internal/Rlp/from.ts | 7 ++++--- .../TransactionEnvelope/eip1559/from.ts | 2 +- .../TransactionEnvelope/eip1559/hash.ts | 2 +- .../TransactionEnvelope/eip1559/serialize.ts | 2 +- .../TransactionEnvelope/eip2930/from.ts | 2 +- .../TransactionEnvelope/eip2930/hash.ts | 2 +- .../TransactionEnvelope/eip2930/serialize.ts | 2 +- .../TransactionEnvelope/eip4844/from.ts | 2 +- .../TransactionEnvelope/eip4844/hash.ts | 2 +- .../TransactionEnvelope/eip4844/serialize.ts | 2 +- .../TransactionEnvelope/eip7702/from.ts | 2 +- .../TransactionEnvelope/eip7702/hash.ts | 2 +- .../TransactionEnvelope/eip7702/serialize.ts | 2 +- .../TransactionEnvelope/isomorphic/from.ts | 7 +++++-- .../TransactionEnvelope/isomorphic/hash.ts | 2 +- .../TransactionEnvelope/isomorphic/toRpc.ts | 4 ++-- .../TransactionEnvelope/legacy/from.ts | 2 +- .../TransactionEnvelope/legacy/hash.ts | 2 +- .../TransactionEnvelope/legacy/serialize.ts | 2 +- src/internal/ValidatorData/encode.ts | 2 +- src/internal/ValidatorData/getSignPayload.ts | 2 +- 57 files changed, 103 insertions(+), 100 deletions(-) diff --git a/src/internal/AbiConstructor/decode.ts b/src/internal/AbiConstructor/decode.ts index 51b36bbd..21137b18 100644 --- a/src/internal/AbiConstructor/decode.ts +++ b/src/internal/AbiConstructor/decode.ts @@ -28,7 +28,7 @@ import type { AbiConstructor } from './types.js' * ``` * * @param abiConstructor - The ABI Constructor to decode. - * @param data - The encoded constructor inputs. + * @param options - Decoding options. * @returns The decoded constructor inputs. */ export function AbiConstructor_decode< diff --git a/src/internal/AbiFunction/decodeResult.ts b/src/internal/AbiFunction/decodeResult.ts index 9b66bab5..6d44f7e6 100644 --- a/src/internal/AbiFunction/decodeResult.ts +++ b/src/internal/AbiFunction/decodeResult.ts @@ -96,8 +96,9 @@ import type { AbiFunction } from './types.js' * * ::: * - * @param abiItem - ABI Function to decode + * @param abiFunction - ABI Function to decode * @param data - ABI-encoded function output + * @param options - Decoding options * @returns Decoded function output */ export function AbiFunction_decodeResult< diff --git a/src/internal/AesGcm/decrypt.ts b/src/internal/AesGcm/decrypt.ts index afe92cd5..36f18d57 100644 --- a/src/internal/AesGcm/decrypt.ts +++ b/src/internal/AesGcm/decrypt.ts @@ -21,7 +21,7 @@ import { AesGcm_ivLength } from './constants.js' * // @log: Hex.fromString('i am a secret message') * ``` * - * @param data - The data to encrypt. + * @param value - The data to encrypt. * @param key - The `CryptoKey` to use for encryption. * @param options - Decryption options. * @returns The decrypted data. diff --git a/src/internal/AesGcm/encrypt.ts b/src/internal/AesGcm/encrypt.ts index 86d012d7..61dece49 100644 --- a/src/internal/AesGcm/encrypt.ts +++ b/src/internal/AesGcm/encrypt.ts @@ -21,7 +21,7 @@ import { AesGcm_ivLength } from './constants.js' * // @log: '0x5e257b25bcf53d5431e54e5a68ca0138306d31bb6154f35a97bb8ea18111e7d82bcf619d3c76c4650688bc5310eed80b8fc86d1e3e' * ``` * - * @param data - The data to encrypt. + * @param value - The data to encrypt. * @param key - The `CryptoKey` to use for encryption. * @param options - Encryption options. * @returns The encrypted data. diff --git a/src/internal/Blobs/commitmentToVersionedHash.ts b/src/internal/Blobs/commitmentToVersionedHash.ts index 54567e30..e54baab2 100644 --- a/src/internal/Blobs/commitmentToVersionedHash.ts +++ b/src/internal/Blobs/commitmentToVersionedHash.ts @@ -54,7 +54,7 @@ import type { Hex } from '../Hex/types.js' * ``` * * @param commitment - The commitment. - * @param as - The return type. + * @param options - Options. * @returns The Blob Versioned Hash. */ export function Blobs_commitmentToVersionedHash< diff --git a/src/internal/Blobs/commitmentsToVersionedHashes.ts b/src/internal/Blobs/commitmentsToVersionedHashes.ts index cc0ccdb5..8cab0330 100644 --- a/src/internal/Blobs/commitmentsToVersionedHashes.ts +++ b/src/internal/Blobs/commitmentsToVersionedHashes.ts @@ -54,7 +54,7 @@ import { Blobs_commitmentToVersionedHash } from './commitmentToVersionedHash.js' * ``` * * @param commitments - A list of commitments. - * @param as - The return type. + * @param options - Options. * @returns A list of Blob Versioned Hashes. */ export function Blobs_commitmentsToVersionedHashes< diff --git a/src/internal/Blobs/from.ts b/src/internal/Blobs/from.ts index 0e9ca175..6cb1edb3 100644 --- a/src/internal/Blobs/from.ts +++ b/src/internal/Blobs/from.ts @@ -49,7 +49,7 @@ import { Blobs_BlobSizeTooLargeError, Blobs_EmptyBlobError } from './errors.js' * ``` * * @param data - The data to convert to {@link ox#Blobs.Blobs}. - * @param options - + * @param options - Options. * @returns The {@link ox#Blobs.Blobs}. */ export function Blobs_from< diff --git a/src/internal/Blobs/sidecarsToVersionedHashes.ts b/src/internal/Blobs/sidecarsToVersionedHashes.ts index 59edc4fd..8a8b7eee 100644 --- a/src/internal/Blobs/sidecarsToVersionedHashes.ts +++ b/src/internal/Blobs/sidecarsToVersionedHashes.ts @@ -53,7 +53,7 @@ import type { BlobSidecars } from './types.js' * ``` * * @param sidecars - The {@link ox#Blobs.BlobSidecars} to transform to Blob Versioned Hashes. - * @param options - + * @param options - Options. * @returns The versioned hashes. */ export function Blobs_sidecarsToVersionedHashes< diff --git a/src/internal/Blobs/to.ts b/src/internal/Blobs/to.ts index 81200440..3db83ad3 100644 --- a/src/internal/Blobs/to.ts +++ b/src/internal/Blobs/to.ts @@ -41,21 +41,21 @@ export function Blobs_to< | (blobs extends Blobs ? 'Hex' : never) | (blobs extends Blobs ? 'Bytes' : never), >( - blobs_: blobs | Blobs | Blobs, - to_?: to | 'Hex' | 'Bytes' | undefined, + blobs: blobs | Blobs | Blobs, + to?: to | 'Hex' | 'Bytes' | undefined, ): Blobs_to.ReturnType { - const to = to_ ?? (typeof blobs_[0] === 'string' ? 'Hex' : 'Bytes') - const blobs = ( - typeof blobs_[0] === 'string' - ? blobs_.map((x) => Bytes_fromHex(x as Hex)) - : blobs_ + const to_ = to ?? (typeof blobs[0] === 'string' ? 'Hex' : 'Bytes') + const blobs_ = ( + typeof blobs[0] === 'string' + ? blobs.map((x) => Bytes_fromHex(x as Hex)) + : blobs ) as Bytes[] - const length = blobs.reduce((length, blob) => length + blob.length, 0) + const length = blobs_.reduce((length, blob) => length + blob.length, 0) const data = createCursor(new Uint8Array(length)) let active = true - for (const blob of blobs) { + for (const blob of blobs_) { const cursor = createCursor(blob) while (active && cursor.position < blob.length) { // First byte will be a zero 0x00 byte – we can skip. @@ -79,7 +79,7 @@ export function Blobs_to< } const trimmedData = data.bytes.slice(0, data.position) - return (to === 'Hex' ? Hex_fromBytes(trimmedData) : trimmedData) as never + return (to_ === 'Hex' ? Hex_fromBytes(trimmedData) : trimmedData) as never } export declare namespace Blobs_to { diff --git a/src/internal/Blobs/toCommitments.ts b/src/internal/Blobs/toCommitments.ts index 976f55a1..66848cb5 100644 --- a/src/internal/Blobs/toCommitments.ts +++ b/src/internal/Blobs/toCommitments.ts @@ -39,7 +39,7 @@ import type { Blobs } from './types.js' * ``` * * @param blobs - The {@link ox#Blobs.Blobs} to transform to commitments. - * @param options - + * @param options - Options. * @returns The commitments. */ export function Blobs_toCommitments< @@ -48,20 +48,20 @@ export function Blobs_toCommitments< | (blobs extends Blobs ? 'Hex' : never) | (blobs extends Blobs ? 'Bytes' : never), >( - blobs_: blobs | Blobs | Blobs, + blobs: blobs | Blobs | Blobs, options: Blobs_toCommitments.Options, ): Blobs_toCommitments.ReturnType { const { kzg } = options - const as = options.as ?? (typeof blobs_[0] === 'string' ? 'Hex' : 'Bytes') - const blobs = ( - typeof blobs_[0] === 'string' - ? blobs_.map((x) => Bytes_fromHex(x as any)) - : blobs_ + const as = options.as ?? (typeof blobs[0] === 'string' ? 'Hex' : 'Bytes') + const blobs_ = ( + typeof blobs[0] === 'string' + ? blobs.map((x) => Bytes_fromHex(x as any)) + : blobs ) as Bytes[] const commitments: Bytes[] = [] - for (const blob of blobs) + for (const blob of blobs_) commitments.push(Uint8Array.from(kzg.blobToKzgCommitment(blob))) return ( diff --git a/src/internal/Blobs/toProofs.ts b/src/internal/Blobs/toProofs.ts index 15288c1b..75c72eb2 100644 --- a/src/internal/Blobs/toProofs.ts +++ b/src/internal/Blobs/toProofs.ts @@ -21,7 +21,7 @@ import type { Blobs } from './types.js' * ``` * * @param blobs - The {@link ox#Blobs.Blobs} to compute proofs for. - * @param options - + * @param options - Options. * @returns The Blob proofs. */ export function Blobs_toProofs< @@ -31,17 +31,17 @@ export function Blobs_toProofs< | (blobs extends readonly Hex[] ? 'Hex' : never) | (blobs extends readonly Bytes[] ? 'Bytes' : never), >( - blobs_: blobs | Blobs | Blobs, + blobs: blobs | Blobs | Blobs, options: Blobs_toProofs.Options, ): Blobs_toProofs.ReturnType { const { kzg } = options - const as = options.as ?? (typeof blobs_[0] === 'string' ? 'Hex' : 'Bytes') + const as = options.as ?? (typeof blobs[0] === 'string' ? 'Hex' : 'Bytes') - const blobs = ( - typeof blobs_[0] === 'string' - ? blobs_.map((x) => Bytes_fromHex(x as any)) - : blobs_ + const blobs_ = ( + typeof blobs[0] === 'string' + ? blobs.map((x) => Bytes_fromHex(x as any)) + : blobs ) as Bytes[] const commitments = ( typeof options.commitments[0] === 'string' @@ -50,8 +50,8 @@ export function Blobs_toProofs< ) as Bytes[] const proofs: Bytes[] = [] - for (let i = 0; i < blobs.length; i++) { - const blob = blobs[i]! + for (let i = 0; i < blobs_.length; i++) { + const blob = blobs_[i]! const commitment = commitments[i]! proofs.push(Uint8Array.from(kzg.computeBlobKzgProof(blob, commitment))) } diff --git a/src/internal/Blobs/toSidecars.ts b/src/internal/Blobs/toSidecars.ts index 1e51efc0..85c2b8fd 100644 --- a/src/internal/Blobs/toSidecars.ts +++ b/src/internal/Blobs/toSidecars.ts @@ -37,7 +37,7 @@ import type { BlobSidecars, Blobs } from './types.js' * ``` * * @param blobs - The {@link ox#Blobs.Blobs} to transform into {@link ox#Blobs.BlobSidecars}. - * @param options - + * @param options - Options. * @returns The {@link ox#Blobs.BlobSidecars}. */ export function Blobs_toSidecars | Blobs>( diff --git a/src/internal/Blobs/toVersionedHashes.ts b/src/internal/Blobs/toVersionedHashes.ts index 2a386630..b9742260 100644 --- a/src/internal/Blobs/toVersionedHashes.ts +++ b/src/internal/Blobs/toVersionedHashes.ts @@ -21,7 +21,7 @@ import type { Blobs } from './types.js' * ``` * * @param blobs - The {@link ox#Blobs.Blobs} to transform into Blob Versioned Hashes. - * @param options - + * @param options - Options. * @returns The Blob Versioned Hashes. */ export function Blobs_toVersionedHashes< diff --git a/src/internal/Bytes/fromHex.ts b/src/internal/Bytes/fromHex.ts index 51d641df..6be640cf 100644 --- a/src/internal/Bytes/fromHex.ts +++ b/src/internal/Bytes/fromHex.ts @@ -45,7 +45,7 @@ function charCodeToBase16(char: number) { * // @log: Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) * ``` * - * @param hex - {@link ox#Hex.Hex} value to encode. + * @param value - {@link ox#Hex.Hex} value to encode. * @param options - Encoding options. * @returns Encoded {@link ox#Bytes.Bytes}. */ diff --git a/src/internal/Bytes/toBoolean.ts b/src/internal/Bytes/toBoolean.ts index 58258f94..763918a6 100644 --- a/src/internal/Bytes/toBoolean.ts +++ b/src/internal/Bytes/toBoolean.ts @@ -20,18 +20,18 @@ import type { Bytes } from './types.js' * @returns Decoded boolean. */ export function Bytes_toBoolean( - bytes_: Bytes, + bytes: Bytes, options: Bytes_toBoolean.Options = {}, ): boolean { const { size } = options - let bytes = bytes_ + let bytes_ = bytes if (typeof size !== 'undefined') { - Bytes_assertSize(bytes, size) - bytes = Bytes_trimLeft(bytes) + Bytes_assertSize(bytes_, size) + bytes_ = Bytes_trimLeft(bytes_) } - if (bytes.length > 1 || bytes[0]! > 1) - throw new Bytes_InvalidBytesBooleanError(bytes) - return Boolean(bytes[0]) + if (bytes_.length > 1 || bytes_[0]! > 1) + throw new Bytes_InvalidBytesBooleanError(bytes_) + return Boolean(bytes_[0]) } export declare namespace Bytes_toBoolean { diff --git a/src/internal/Bytes/toHex.ts b/src/internal/Bytes/toHex.ts index d4d909ab..99ede7b5 100644 --- a/src/internal/Bytes/toHex.ts +++ b/src/internal/Bytes/toHex.ts @@ -14,8 +14,8 @@ import type { Bytes } from './types.js' * // '0x48656c6c6f20576f726c6421' * ``` * - * @param bytes - The {@link ox#Bytes.Bytes} to decode. - * @param options - + * @param value - The {@link ox#Bytes.Bytes} to decode. + * @param options - Options. * @returns Decoded {@link ox#Hex.Hex} value. */ export function Bytes_toHex( diff --git a/src/internal/Bytes/toString.ts b/src/internal/Bytes/toString.ts index 742bf4cb..c568ccca 100644 --- a/src/internal/Bytes/toString.ts +++ b/src/internal/Bytes/toString.ts @@ -17,7 +17,7 @@ const decoder = /*#__PURE__*/ new TextDecoder() * ``` * * @param bytes - The {@link ox#Bytes.Bytes} to decode. - * @param options - + * @param options - Options. * @returns Decoded string. */ export function Bytes_toString( diff --git a/src/internal/Filter/fromRpc.ts b/src/internal/Filter/fromRpc.ts index e54141f3..ab4e578d 100644 --- a/src/internal/Filter/fromRpc.ts +++ b/src/internal/Filter/fromRpc.ts @@ -3,7 +3,7 @@ import { Hex_validate } from '../Hex/validate.js' import type { Filter, Filter_Rpc } from './types.js' /** - * Converts a {@link ox#Log.Rpc} to an {@link ox#Log.Log}. + * Converts a {@link ox#Filter.Rpc} to an {@link ox#Filter.Filter}. * * @example * ```ts twoslash @@ -31,8 +31,8 @@ import type { Filter, Filter_Rpc } from './types.js' * // @log: } * ``` * - * @param log - The RPC log to convert. - * @returns An instantiated {@link ox#Log.Log}. + * @param filter - The RPC filter to convert. + * @returns An instantiated {@link ox#Filter.Filter}. */ export function Filter_fromRpc(filter: Filter_Rpc): Filter { const { address, topics, fromBlock, toBlock } = filter diff --git a/src/internal/Hash/keccak256.ts b/src/internal/Hash/keccak256.ts index 2ce76c2f..5fca57f7 100644 --- a/src/internal/Hash/keccak256.ts +++ b/src/internal/Hash/keccak256.ts @@ -40,7 +40,7 @@ import type { Hex } from '../Hex/types.js' * ``` * * @param value - {@link ox#Bytes.Bytes} or {@link ox#Hex.Hex} value. - * @param to - The return type. + * @param options - Options. * @returns Keccak256 hash. */ export function Hash_keccak256< diff --git a/src/internal/Hash/ripemd160.ts b/src/internal/Hash/ripemd160.ts index 465c9601..a76d980f 100644 --- a/src/internal/Hash/ripemd160.ts +++ b/src/internal/Hash/ripemd160.ts @@ -20,7 +20,7 @@ import type { Hex } from '../Hex/types.js' * ``` * * @param value - {@link ox#Bytes.Bytes} or {@link ox#Hex.Hex} value. - * @param to - The return type. + * @param options - Options. * @returns Ripemd160 hash. */ export function Hash_ripemd160< diff --git a/src/internal/Hash/sha256.ts b/src/internal/Hash/sha256.ts index 81dcbf06..db4f924c 100644 --- a/src/internal/Hash/sha256.ts +++ b/src/internal/Hash/sha256.ts @@ -20,7 +20,7 @@ import type { Hex } from '../Hex/types.js' * ``` * * @param value - {@link ox#Bytes.Bytes} or {@link ox#Hex.Hex} value. - * @param to - The return type. + * @param options - Options. * @returns Sha256 hash. */ export function Hash_sha256< diff --git a/src/internal/HdKey/fromExtendedKey.ts b/src/internal/HdKey/fromExtendedKey.ts index 25b02fb5..d2ee383c 100644 --- a/src/internal/HdKey/fromExtendedKey.ts +++ b/src/internal/HdKey/fromExtendedKey.ts @@ -18,7 +18,6 @@ import type { HdKey } from './types.js' * ``` * * @param extendedKey - The extended private key. - * @param options - Creation options. * @returns The HD Key. */ export function HdKey_fromExtendedKey(extendedKey: string): HdKey { diff --git a/src/internal/HdKey/fromJson.ts b/src/internal/HdKey/fromJson.ts index 364efbb1..f3520a30 100644 --- a/src/internal/HdKey/fromJson.ts +++ b/src/internal/HdKey/fromJson.ts @@ -18,7 +18,6 @@ import type { HdKey } from './types.js' * ``` * * @param json - The JSON object containing an extended private key (`xpriv`). - * @param options - Creation options. * @returns The HD Key. */ export function HdKey_fromJson(json: { xpriv: string }): HdKey { diff --git a/src/internal/Hex/assert.ts b/src/internal/Hex/assert.ts index 919630d2..89ff604c 100644 --- a/src/internal/Hex/assert.ts +++ b/src/internal/Hex/assert.ts @@ -16,7 +16,7 @@ import type { Hex } from './types.js' * ``` * * @param value - The value to assert. - * @param options - + * @param options - Options. */ export function Hex_assert( value: unknown, diff --git a/src/internal/Hex/from.ts b/src/internal/Hex/from.ts index 8d505d47..74284c68 100644 --- a/src/internal/Hex/from.ts +++ b/src/internal/Hex/from.ts @@ -30,7 +30,6 @@ import type { Hex } from './types.js' * ``` * * @param value - The {@link ox#Bytes.Bytes} value to encode. - * @param options - * @returns The encoded {@link ox#Hex.Hex} value. */ export function Hex_from(value: Hex | Bytes | readonly number[]): Hex { diff --git a/src/internal/Hex/fromBoolean.ts b/src/internal/Hex/fromBoolean.ts index 76cfad3c..1e3d03a3 100644 --- a/src/internal/Hex/fromBoolean.ts +++ b/src/internal/Hex/fromBoolean.ts @@ -21,7 +21,7 @@ import type { Hex } from './types.js' * ``` * * @param value - The boolean value to encode. - * @param options - + * @param options - Options. * @returns The encoded {@link ox#Hex.Hex} value. */ export function Hex_fromBoolean( diff --git a/src/internal/Hex/fromBytes.ts b/src/internal/Hex/fromBytes.ts index b49c4c3c..6160868d 100644 --- a/src/internal/Hex/fromBytes.ts +++ b/src/internal/Hex/fromBytes.ts @@ -20,7 +20,7 @@ const hexes = /*#__PURE__*/ Array.from({ length: 256 }, (_v, i) => * ``` * * @param value - The {@link ox#Bytes.Bytes} value to encode. - * @param options - + * @param options - Options. * @returns The encoded {@link ox#Hex.Hex} value. */ export function Hex_fromBytes( diff --git a/src/internal/Hex/fromNumber.ts b/src/internal/Hex/fromNumber.ts index 94e1221d..287fc953 100644 --- a/src/internal/Hex/fromNumber.ts +++ b/src/internal/Hex/fromNumber.ts @@ -18,7 +18,7 @@ import type { Hex } from './types.js' * ``` * * @param value - The number or bigint value to encode. - * @param options - + * @param options - Options. * @returns The encoded {@link ox#Hex.Hex} value. */ export function Hex_fromNumber( diff --git a/src/internal/Hex/fromString.ts b/src/internal/Hex/fromString.ts index 06d1dac4..8b3670c9 100644 --- a/src/internal/Hex/fromString.ts +++ b/src/internal/Hex/fromString.ts @@ -18,7 +18,7 @@ const encoder = /*#__PURE__*/ new TextEncoder() * ``` * * @param value - The string value to encode. - * @param options - + * @param options - Options. * @returns The encoded {@link ox#Hex.Hex} value. */ export function Hex_fromString( diff --git a/src/internal/Hex/slice.ts b/src/internal/Hex/slice.ts index 05212c93..dd232458 100644 --- a/src/internal/Hex/slice.ts +++ b/src/internal/Hex/slice.ts @@ -17,25 +17,26 @@ import type { Hex } from './types.js' * @param value - The {@link ox#Hex.Hex} value to slice. * @param start - The start offset (in bytes). * @param end - The end offset (in bytes). + * @param options - Options. * @returns The sliced {@link ox#Hex.Hex} value. */ export function Hex_slice( - value_: Hex, + value: Hex, start?: number | undefined, end?: number | undefined, options: Hex_slice.Options = {}, ): Hex { const { strict } = options - Hex_assertStartOffset(value_, start) - const value = `0x${value_ + Hex_assertStartOffset(value, start) + const value_ = `0x${value .replace('0x', '') - .slice((start ?? 0) * 2, (end ?? value_.length) * 2)}` as const - if (strict) Hex_assertEndOffset(value, start, end) - return value + .slice((start ?? 0) * 2, (end ?? value.length) * 2)}` as const + if (strict) Hex_assertEndOffset(value_, start, end) + return value_ } export declare namespace Hex_slice { - interface Options { + type Options = { /** Asserts that the sliced value is the same size as the given start/end offsets. */ strict?: boolean | undefined } diff --git a/src/internal/Hex/toBigInt.ts b/src/internal/Hex/toBigInt.ts index b5f3fc60..fc74d88c 100644 --- a/src/internal/Hex/toBigInt.ts +++ b/src/internal/Hex/toBigInt.ts @@ -17,7 +17,7 @@ import type { Hex } from './types.js' * ``` * * @param hex - The {@link ox#Hex.Hex} value to decode. - * @param options - + * @param options - Options. * @returns The decoded BigInt. */ export function Hex_toBigInt( diff --git a/src/internal/Hex/toBoolean.ts b/src/internal/Hex/toBoolean.ts index 98ba2a1b..d0ec724f 100644 --- a/src/internal/Hex/toBoolean.ts +++ b/src/internal/Hex/toBoolean.ts @@ -19,7 +19,7 @@ import type { Hex } from './types.js' * ``` * * @param hex - The {@link ox#Hex.Hex} value to decode. - * @param options - + * @param options - Options. * @returns The decoded boolean. */ export function Hex_toBoolean( diff --git a/src/internal/Hex/toBytes.ts b/src/internal/Hex/toBytes.ts index c32166b9..20d164a3 100644 --- a/src/internal/Hex/toBytes.ts +++ b/src/internal/Hex/toBytes.ts @@ -15,7 +15,7 @@ import type { Hex } from './types.js' * ``` * * @param hex - The {@link ox#Hex.Hex} value to decode. - * @param options - + * @param options - Options. * @returns The decoded {@link ox#Bytes.Bytes}. */ export function Hex_toBytes( diff --git a/src/internal/Hex/toNumber.ts b/src/internal/Hex/toNumber.ts index 24a5e958..08297f37 100644 --- a/src/internal/Hex/toNumber.ts +++ b/src/internal/Hex/toNumber.ts @@ -17,7 +17,7 @@ import type { Hex } from './types.js' * ``` * * @param hex - The {@link ox#Hex.Hex} value to decode. - * @param options - + * @param options - Options. * @returns The decoded number. */ export function Hex_toNumber( diff --git a/src/internal/Hex/toString.ts b/src/internal/Hex/toString.ts index 8447bece..22f42ea4 100644 --- a/src/internal/Hex/toString.ts +++ b/src/internal/Hex/toString.ts @@ -21,7 +21,7 @@ import type { Hex } from './types.js' * ``` * * @param hex - The {@link ox#Hex.Hex} value to decode. - * @param options - + * @param options - Options. * @returns The decoded string. */ export function Hex_toString( diff --git a/src/internal/Hex/validate.ts b/src/internal/Hex/validate.ts index a1576a4d..7d9e31c4 100644 --- a/src/internal/Hex/validate.ts +++ b/src/internal/Hex/validate.ts @@ -17,7 +17,7 @@ import type { Hex } from './types.js' * ``` * * @param value - The value to check. - * @param options - + * @param options - Options. * @returns `true` if the value is a {@link ox#Hex.Hex}, `false` otherwise. */ export function Hex_validate( diff --git a/src/internal/Rlp/from.ts b/src/internal/Rlp/from.ts index 9ed3ead3..0fc70e00 100644 --- a/src/internal/Rlp/from.ts +++ b/src/internal/Rlp/from.ts @@ -27,7 +27,7 @@ type Encodable = { * ``` * * @param value - The {@link ox#Bytes.Bytes} or {@link ox#Hex.Hex} value to encode. - * @param as - The type to convert the RLP value to. + * @param options - Options. * @returns The RLP value. */ export function Rlp_from( @@ -47,6 +47,7 @@ export function Rlp_from( export declare namespace Rlp_from { type Options = { + /** The type to convert the RLP value to. */ as: as | 'Hex' | 'Bytes' } @@ -77,7 +78,7 @@ Rlp_from.parseError = (error: unknown) => * ``` * * @param bytes - The {@link ox#Bytes.Bytes} value to encode. - * @param as - The type to convert the RLP value to. + * @param options - Options. * @returns The RLP value. */ export function Rlp_fromBytes( @@ -115,7 +116,7 @@ Rlp_fromBytes.parseError = (error: unknown) => * ``` * * @param hex - The {@link ox#Hex.Hex} value to encode. - * @param to - The type to convert the RLP value to. + * @param options - Options. * @returns The RLP value. */ export function Rlp_fromHex( diff --git a/src/internal/TransactionEnvelope/eip1559/from.ts b/src/internal/TransactionEnvelope/eip1559/from.ts index 398c2209..b9f57624 100644 --- a/src/internal/TransactionEnvelope/eip1559/from.ts +++ b/src/internal/TransactionEnvelope/eip1559/from.ts @@ -84,7 +84,7 @@ import type { * ``` * * @param envelope - The transaction object to convert. - * @param options - + * @param options - Options. * @returns An EIP-1559 Transaction Envelope. */ export function TransactionEnvelopeEip1559_from< diff --git a/src/internal/TransactionEnvelope/eip1559/hash.ts b/src/internal/TransactionEnvelope/eip1559/hash.ts index 318ec9c6..5e98a956 100644 --- a/src/internal/TransactionEnvelope/eip1559/hash.ts +++ b/src/internal/TransactionEnvelope/eip1559/hash.ts @@ -31,7 +31,7 @@ import type { TransactionEnvelopeEip1559 } from './types.js' * ``` * * @param envelope - The EIP-1559 Transaction Envelope to hash. - * @param options - + * @param options - Options. * @returns The hash of the transaction envelope. */ export function TransactionEnvelopeEip1559_hash< diff --git a/src/internal/TransactionEnvelope/eip1559/serialize.ts b/src/internal/TransactionEnvelope/eip1559/serialize.ts index 11281fc4..09813114 100644 --- a/src/internal/TransactionEnvelope/eip1559/serialize.ts +++ b/src/internal/TransactionEnvelope/eip1559/serialize.ts @@ -61,7 +61,7 @@ import type { * ``` * * @param envelope - The Transaction Envelope to serialize. - * @param options - + * @param options - Options. * @returns The serialized Transaction Envelope. */ export function TransactionEnvelopeEip1559_serialize( diff --git a/src/internal/TransactionEnvelope/eip2930/from.ts b/src/internal/TransactionEnvelope/eip2930/from.ts index 0646dc57..8765f126 100644 --- a/src/internal/TransactionEnvelope/eip2930/from.ts +++ b/src/internal/TransactionEnvelope/eip2930/from.ts @@ -82,7 +82,7 @@ import type { * ``` * * @param envelope - The transaction object to convert. - * @param options - + * @param options - Options. * @returns A {@link ox#TransactionEnvelopeEip2930.TransactionEnvelope} */ export function TransactionEnvelopeEip2930_from< diff --git a/src/internal/TransactionEnvelope/eip2930/hash.ts b/src/internal/TransactionEnvelope/eip2930/hash.ts index 34e2cad4..96d72778 100644 --- a/src/internal/TransactionEnvelope/eip2930/hash.ts +++ b/src/internal/TransactionEnvelope/eip2930/hash.ts @@ -33,7 +33,7 @@ import type { TransactionEnvelopeEip2930 } from './types.js' * ``` * * @param envelope - The EIP-2930 Transaction Envelope to hash. - * @param options - + * @param options - Options. * @returns The hash of the transaction envelope. */ export function TransactionEnvelopeEip2930_hash< diff --git a/src/internal/TransactionEnvelope/eip2930/serialize.ts b/src/internal/TransactionEnvelope/eip2930/serialize.ts index 6f41ceb7..82c3ff9b 100644 --- a/src/internal/TransactionEnvelope/eip2930/serialize.ts +++ b/src/internal/TransactionEnvelope/eip2930/serialize.ts @@ -58,7 +58,7 @@ import type { * ``` * * @param envelope - The Transaction Envelope to serialize. - * @param options - + * @param options - Options. * @returns The serialized Transaction Envelope. */ export function TransactionEnvelopeEip2930_serialize( diff --git a/src/internal/TransactionEnvelope/eip4844/from.ts b/src/internal/TransactionEnvelope/eip4844/from.ts index 815c1c18..3db1e236 100644 --- a/src/internal/TransactionEnvelope/eip4844/from.ts +++ b/src/internal/TransactionEnvelope/eip4844/from.ts @@ -102,7 +102,7 @@ import type { * ``` * * @param envelope - The transaction object to convert. - * @param options - + * @param options - Options. * @returns An EIP-4844 Transaction Envelope. */ export function TransactionEnvelopeEip4844_from< diff --git a/src/internal/TransactionEnvelope/eip4844/hash.ts b/src/internal/TransactionEnvelope/eip4844/hash.ts index 1dc38100..aa871c10 100644 --- a/src/internal/TransactionEnvelope/eip4844/hash.ts +++ b/src/internal/TransactionEnvelope/eip4844/hash.ts @@ -30,7 +30,7 @@ import type { TransactionEnvelopeEip4844 } from './types.js' * ``` * * @param envelope - The EIP-4844 Transaction Envelope to hash. - * @param options - + * @param options - Options. * @returns The hash of the transaction envelope. */ export function TransactionEnvelopeEip4844_hash< diff --git a/src/internal/TransactionEnvelope/eip4844/serialize.ts b/src/internal/TransactionEnvelope/eip4844/serialize.ts index 36d6457a..29965692 100644 --- a/src/internal/TransactionEnvelope/eip4844/serialize.ts +++ b/src/internal/TransactionEnvelope/eip4844/serialize.ts @@ -76,7 +76,7 @@ import type { * ``` * * @param envelope - The Transaction Envelope to serialize. - * @param options - + * @param options - Options. * @returns The serialized Transaction Envelope. */ export function TransactionEnvelopeEip4844_serialize( diff --git a/src/internal/TransactionEnvelope/eip7702/from.ts b/src/internal/TransactionEnvelope/eip7702/from.ts index a5d16dbb..bf12a91d 100644 --- a/src/internal/TransactionEnvelope/eip7702/from.ts +++ b/src/internal/TransactionEnvelope/eip7702/from.ts @@ -101,7 +101,7 @@ import type { * ``` * * @param envelope - The transaction object to convert. - * @param options - + * @param options - Options. * @returns An EIP-7702 Transaction Envelope. */ export function TransactionEnvelopeEip7702_from< diff --git a/src/internal/TransactionEnvelope/eip7702/hash.ts b/src/internal/TransactionEnvelope/eip7702/hash.ts index 04b6245b..a60b7895 100644 --- a/src/internal/TransactionEnvelope/eip7702/hash.ts +++ b/src/internal/TransactionEnvelope/eip7702/hash.ts @@ -33,7 +33,7 @@ import type { TransactionEnvelopeEip7702 } from './types.js' * ``` * * @param envelope - The EIP-7702 Transaction Envelope to hash. - * @param options - + * @param options - Options. * @returns The hash of the transaction envelope. */ export function TransactionEnvelopeEip7702_hash< diff --git a/src/internal/TransactionEnvelope/eip7702/serialize.ts b/src/internal/TransactionEnvelope/eip7702/serialize.ts index 8c4f5d8a..bcfafcb8 100644 --- a/src/internal/TransactionEnvelope/eip7702/serialize.ts +++ b/src/internal/TransactionEnvelope/eip7702/serialize.ts @@ -77,7 +77,7 @@ import type { * ``` * * @param envelope - The Transaction Envelope to serialize. - * @param options - + * @param options - Options. * @returns The serialized Transaction Envelope. */ export function TransactionEnvelopeEip7702_serialize( diff --git a/src/internal/TransactionEnvelope/isomorphic/from.ts b/src/internal/TransactionEnvelope/isomorphic/from.ts index 11c71591..5195ea24 100644 --- a/src/internal/TransactionEnvelope/isomorphic/from.ts +++ b/src/internal/TransactionEnvelope/isomorphic/from.ts @@ -99,7 +99,7 @@ import type { * * * @param value - The arbitrary value to instantiate a {@link ox#TransactionEnvelope.TransactionEnvelope} from. - * @param options - + * @param options - Options. * @returns A {@link ox#TransactionEnvelope.TransactionEnvelope}. */ export function TransactionEnvelope_from< @@ -108,7 +108,10 @@ export function TransactionEnvelope_from< | TransactionEnvelope_Serialized, const signature extends Signature | undefined = undefined, >( - value: value, + value: + | value + | UnionPartialBy + | TransactionEnvelope_Serialized, options: TransactionEnvelope_from.Options = {}, ): TransactionEnvelope_from.ReturnType { const type = TransactionEnvelope_getType(value) diff --git a/src/internal/TransactionEnvelope/isomorphic/hash.ts b/src/internal/TransactionEnvelope/isomorphic/hash.ts index 4bb4e860..c604d521 100644 --- a/src/internal/TransactionEnvelope/isomorphic/hash.ts +++ b/src/internal/TransactionEnvelope/isomorphic/hash.ts @@ -37,7 +37,7 @@ import type { TransactionEnvelope } from './types.js' * ``` * * @param envelope - The Transaction Envelope to hash. - * @param options - + * @param options - Options. * @returns The hash of the transaction envelope. */ export function TransactionEnvelope_hash( diff --git a/src/internal/TransactionEnvelope/isomorphic/toRpc.ts b/src/internal/TransactionEnvelope/isomorphic/toRpc.ts index 02ef41cb..336edeff 100644 --- a/src/internal/TransactionEnvelope/isomorphic/toRpc.ts +++ b/src/internal/TransactionEnvelope/isomorphic/toRpc.ts @@ -37,8 +37,8 @@ import type { TransactionEnvelope } from './types.js' * }) * ``` * - * @param transaction - The transaction to convert. - * @returns An RPC-formatted transaction. + * @param envelope - The transaction envelope to convert. + * @returns An RPC-formatted transaction envelope. */ export function TransactionEnvelope_toRpc( envelope: envelope, diff --git a/src/internal/TransactionEnvelope/legacy/from.ts b/src/internal/TransactionEnvelope/legacy/from.ts index b6d59943..998322ca 100644 --- a/src/internal/TransactionEnvelope/legacy/from.ts +++ b/src/internal/TransactionEnvelope/legacy/from.ts @@ -77,7 +77,7 @@ import type { TransactionEnvelopeLegacy } from './types.js' * ``` * * @param envelope - The transaction object to convert. - * @param options - + * @param options - Options. * @returns A legacy Transaction Envelope. */ export function TransactionEnvelopeLegacy_from< diff --git a/src/internal/TransactionEnvelope/legacy/hash.ts b/src/internal/TransactionEnvelope/legacy/hash.ts index 77d4214c..76f8e941 100644 --- a/src/internal/TransactionEnvelope/legacy/hash.ts +++ b/src/internal/TransactionEnvelope/legacy/hash.ts @@ -31,7 +31,7 @@ import type { TransactionEnvelopeLegacy } from './types.js' * ``` * * @param envelope - The Legacy Transaction Envelope to hash. - * @param options - + * @param options - Options. * @returns The hash of the transaction envelope. */ export function TransactionEnvelopeLegacy_hash( diff --git a/src/internal/TransactionEnvelope/legacy/serialize.ts b/src/internal/TransactionEnvelope/legacy/serialize.ts index c8c7d668..16218c61 100644 --- a/src/internal/TransactionEnvelope/legacy/serialize.ts +++ b/src/internal/TransactionEnvelope/legacy/serialize.ts @@ -58,7 +58,7 @@ import type { * ``` * * @param envelope - The Transaction Envelope to serialize. - * @param options - + * @param options - Options. * @returns The serialized Transaction Envelope. */ export function TransactionEnvelopeLegacy_serialize( diff --git a/src/internal/ValidatorData/encode.ts b/src/internal/ValidatorData/encode.ts index 64bafe8b..d13e62a2 100644 --- a/src/internal/ValidatorData/encode.ts +++ b/src/internal/ValidatorData/encode.ts @@ -20,7 +20,7 @@ import type { Hex } from '../Hex/types.js' * // @log: '0x19 ‖ 0x00 ‖ 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 ‖ "hello world"' * ``` * - * @param data - The data to encode. + * @param value - The data to encode. * @returns The encoded personal sign message. */ export function ValidatorData_encode(value: ValidatorData_encode.Value): Hex { diff --git a/src/internal/ValidatorData/getSignPayload.ts b/src/internal/ValidatorData/getSignPayload.ts index 9f270ae7..300406b4 100644 --- a/src/internal/ValidatorData/getSignPayload.ts +++ b/src/internal/ValidatorData/getSignPayload.ts @@ -20,7 +20,7 @@ import { ValidatorData_encode } from './encode.js' * const signature = Secp256k1.sign({ payload, privateKey: '0x...' }) * ``` * - * @param data - The data to get the sign payload for. + * @param value - The data to get the sign payload for. * @returns The payload to use for signing. */ export function ValidatorData_getSignPayload(