diff --git a/README.md b/README.md index 857fef70e..179f2f8f6 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Mistakes and bugs happen, but with your help in resolving and reporting [issues] - Easy to audit and verify, - Tested, with test coverage >95%, - Advanced and feature rich, -- Standardized, using [prettier](https://github.com/prettier/prettier) and Node `Buffer`'s throughout, and +- Standardized, using [prettier](https://github.com/prettier/prettier) and Uint8Array (with node `Buffer` supported as a Uint8Array subclass) throughout, and - Friendly, with a strong and helpful community, ready to answer questions. ## Documentation diff --git a/ts_src/address.ts b/ts_src/address.ts index 9b551e0d5..b1c94f4c6 100644 --- a/ts_src/address.ts +++ b/ts_src/address.ts @@ -171,7 +171,7 @@ export function toBech32( /** * Converts an output script to a Bitcoin address. - * @param output - The output script as a Buffer. + * @param output - The output script as a Uint8Array (node Buffer is also accepted). * @param network - The Bitcoin network (optional). * @returns The Bitcoin address corresponding to the output script. * @throws If the output script has no matching address. @@ -209,7 +209,7 @@ export function fromOutputScript( * Converts a Bitcoin address to its corresponding output script. * @param address - The Bitcoin address to convert. * @param network - The Bitcoin network to use. Defaults to the Bitcoin network. - * @returns The corresponding output script as a Buffer. + * @returns The corresponding output script as a Uint8Array. * @throws If the address has an invalid prefix or no matching script. */ export function toOutputScript(address: string, network?: Network): Uint8Array { diff --git a/ts_src/payments/bip341.ts b/ts_src/payments/bip341.ts index 5e6b4e7e5..7b823f2b6 100644 --- a/ts_src/payments/bip341.ts +++ b/ts_src/payments/bip341.ts @@ -110,7 +110,7 @@ export function findScriptPath( /** * Calculates the tapleaf hash for a given Tapleaf object. * @param leaf - The Tapleaf object to calculate the hash for. - * @returns The tapleaf hash as a Buffer. + * @returns The tapleaf hash as a Uint8Array. */ export function tapleafHash(leaf: Tapleaf): Uint8Array { const version = leaf.version || LEAF_VERSION_TAPSCRIPT; @@ -178,7 +178,7 @@ function tapBranchHash(a: Uint8Array, b: Uint8Array): Uint8Array { * Serializes a script by encoding its length as a varint and concatenating it with the script. * * @param s - The script to be serialized. - * @returns The serialized script as a Buffer. + * @returns The serialized script as a Uint8Array. */ function serializeScript(s: Uint8Array): Uint8Array { /* global BigInt */ diff --git a/ts_src/psbt/bip371.ts b/ts_src/psbt/bip371.ts index 4fd5271a5..96722cd7b 100644 --- a/ts_src/psbt/bip371.ts +++ b/ts_src/psbt/bip371.ts @@ -510,7 +510,7 @@ function isTapLeafInTree( * * @param input - The PsbtInput object. * @param tapLeaf - The TapLeafScript object. - * @returns An array of sorted signatures as Buffers. + * @returns An array of sorted signatures as Uint8Arrays. */ function sortSignatures( input: PsbtInput, diff --git a/ts_src/psbt/psbtutils.ts b/ts_src/psbt/psbtutils.ts index 298f4769c..34a1cf533 100644 --- a/ts_src/psbt/psbtutils.ts +++ b/ts_src/psbt/psbtutils.ts @@ -33,7 +33,7 @@ export const isP2TR = isPaymentFactory(payments.p2tr); /** * Converts a witness stack to a script witness. * @param witness The witness stack to convert. - * @returns The script witness as a Buffer. + * @returns The script witness as a Uint8Array. */ export function witnessStackToScriptWitness(witness: Uint8Array[]): Uint8Array { let buffer = new Uint8Array(0); diff --git a/ts_src/script.ts b/ts_src/script.ts index 6e6f8580c..cb51b65b4 100644 --- a/ts_src/script.ts +++ b/ts_src/script.ts @@ -244,9 +244,9 @@ export function toASM(chunks: Uint8Array | Array): string { } /** - * Converts an ASM string to a Buffer. + * Converts an ASM string to a Uint8Array. * @param asm The ASM string to convert. - * @returns The converted Buffer. + * @returns The converted Uint8Array. */ export function fromASM(asm: string): Uint8Array { v.parse(v.string(), asm); diff --git a/ts_src/types.ts b/ts_src/types.ts index 975f408c8..b77690d0c 100644 --- a/ts_src/types.ts +++ b/ts_src/types.ts @@ -10,9 +10,9 @@ export const NBufferSchemaFactory = (size: number) => v.pipe(v.instance(Uint8Array), v.length(size)); /** - * Checks if two arrays of Buffers are equal. - * @param a - The first array of Buffers. - * @param b - The second array of Buffers. + * Checks if two arrays of Uint8Arrays are equal. + * @param a - The first array of Uint8Arrays. + * @param b - The second array of Uint8Arrays. * @returns True if the arrays are equal, false otherwise. */ export function stacksEqual(a: Uint8Array[], b: Uint8Array[]): boolean {