Skip to content

Commit

Permalink
Update the createOutputScriptFromAddress fn
Browse files Browse the repository at this point in the history
Return `Hex` instead of `string`- we want to operate on `Hex`.
  • Loading branch information
r-czajkowski committed Jul 4, 2023
1 parent 07693eb commit 759cc78
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions typescript/src/bitcoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,6 @@ export function locktimeToNumber(locktimeLE: Buffer | string): number {
* @param address BTC address.
* @returns The un-prefixed and not prepended with length output script.
*/
export function createOutputScriptFromAddress(address: string): string {
return Script.fromAddress(address).toRaw().toString("hex")
export function createOutputScriptFromAddress(address: string): Hex {
return Hex.from(Script.fromAddress(address).toRaw().toString("hex"))
}
2 changes: 1 addition & 1 deletion typescript/test/bitcoin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ describe("Bitcoin", () => {
// Check if we can build the prefixed raw redeemer output script based
// on the result.
// Convert the output script to raw bytes buffer.
const rawRedeemerOutputScript = Buffer.from(result, "hex")
const rawRedeemerOutputScript = Buffer.from(result.toString(), "hex")
// Prefix the output script bytes buffer with 0x and its own length.
const prefixedRawRedeemerOutputScript = `0x${Buffer.concat([
Buffer.from([rawRedeemerOutputScript.length]),
Expand Down

0 comments on commit 759cc78

Please sign in to comment.