MCPcopy Create free account
hub / github.com/CashScript/cashscript / scriptToP2SHLockingBytecode

Function scriptToP2SHLockingBytecode

packages/cashscript/src/utils.ts:299–305  ·  view source on GitHub ↗
(script: Script, addressType: AddressType)

Source from the content-addressed store, hash-verified

297}
298
299export function scriptToP2SHLockingBytecode(script: Script, addressType: AddressType): Uint8Array {
300 const scriptBytecode = scriptToBytecode(script);
301 const scriptHash = (addressType === 'p2sh20') ? hash160(scriptBytecode) : hash256(scriptBytecode);
302 const addressContents = { payload: scriptHash, type: LockingBytecodeType[addressType] };
303 const lockingBytecode = addressContentsToLockingBytecode(addressContents);
304 return lockingBytecode;
305}
306
307export function publicKeyToP2PKHLockingBytecode(publicKey: Uint8Array): Uint8Array {
308 const pubkeyHash = hash160(publicKey);

Callers 1

scriptToAddressFunction · 0.85

Calls 3

scriptToBytecodeFunction · 0.90
hash160Function · 0.90
hash256Function · 0.90

Tested by

no test coverage detected