( script: Script, network: string, addressType: AddressType, tokenSupport: boolean, )
| 285 | } |
| 286 | |
| 287 | export function scriptToAddress( |
| 288 | script: Script, network: string, addressType: AddressType, tokenSupport: boolean, |
| 289 | ): string { |
| 290 | const bytecode = scriptToP2SHLockingBytecode(script, addressType); |
| 291 | const prefix = getNetworkPrefix(network); |
| 292 | |
| 293 | const result = lockingBytecodeToCashAddress({ bytecode, prefix, tokenSupport }); |
| 294 | if (typeof result === 'string') throw new Error(result); |
| 295 | |
| 296 | return result.address; |
| 297 | } |
| 298 | |
| 299 | export function scriptToP2SHLockingBytecode(script: Script, addressType: AddressType): Uint8Array { |
| 300 | const scriptBytecode = scriptToBytecode(script); |
no test coverage detected