( pubkey: Buffer, network: bitcoin.Network )
| 51 | |
| 52 | // Pay to Witness Script Hash, where the redeem script is NOTE protocol script |
| 53 | export function generateP2SHNoteAddress( |
| 54 | pubkey: Buffer, |
| 55 | network: bitcoin.Network |
| 56 | ): IAddressObject { |
| 57 | // Create redeem script |
| 58 | const redeemScript = bitcoin.script.fromASM(buildNoteScript(pubkey)); |
| 59 | |
| 60 | // Create P2WSH-NOTE address |
| 61 | const {output, address} = bitcoin.payments.p2sh({ |
| 62 | redeem: {output: redeemScript, network}, |
| 63 | network, |
| 64 | }); |
| 65 | |
| 66 | const script = output!.toString("hex"); |
| 67 | // with SHA256 hash |
| 68 | const scriptHash = calcScriptHash(output!); |
| 69 | |
| 70 | const type: AddressType = "P2SH-NOTE"; |
| 71 | |
| 72 | return { |
| 73 | address: address!, |
| 74 | script, |
| 75 | scriptHash, |
| 76 | type, |
| 77 | }; |
| 78 | } |
| 79 | |
| 80 | // Pay to Witness Public Key Hash address |
| 81 | export function generateP2WPHKAddress( |
nothing calls this directly
no test coverage detected