Add support for compressed p2pk addresses

This commit is contained in:
Mononaut
2023-07-28 16:35:42 +09:00
parent 63ccecf410
commit 2c613195cc
6 changed files with 19 additions and 15 deletions

View File

@@ -67,7 +67,8 @@ export class ElectrsApiService {
}
getPubKeyAddress$(pubkey: string): Observable<Address> {
return this.getScriptHash$('41' + pubkey + 'ac').pipe(
const scriptpubkey = (pubkey.length === 130 ? '41' : '21') + pubkey + 'ac';
return this.getScriptHash$(scriptpubkey).pipe(
switchMap((scripthash: ScriptHash) => {
return of({
...scripthash,