From e74726d1cace67c51423bcec6714372f1dc3a2a1 Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Wed, 23 Oct 2019 10:30:50 +1300 Subject: [PATCH] Bufferify the return from cashaddr.decode --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index b35c3674..543bf3ec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -147,9 +147,9 @@ function encodeCashAddr(data: Buffer): string { function decodeCashAddr(data: string): Buffer { const { prefix, type, hash } = cashaddr.decode(data); if (type === 'P2PKH') { - return Buffer.concat([Buffer.from([0x76, 0xa9, 0x14]), hash, Buffer.from([0x88, 0xac])]); + return Buffer.concat([Buffer.from([0x76, 0xa9, 0x14]), Buffer.from(hash), Buffer.from([0x88, 0xac])]); } else if (type === 'P2SH') { - return Buffer.concat([Buffer.from([0xa9, 0x14]), hash, Buffer.from([0x87])]); + return Buffer.concat([Buffer.from([0xa9, 0x14]), Buffer.from(hash), Buffer.from([0x87])]); } throw Error('Unrecognised address format'); }