( contractType: ContractType, contractBytecode: Uint8Array, encodedArgs: Uint8Array[], selector?: number, )
| 232 | |
| 233 | // ////////// BUILD OBJECTS /////////////////////////////////////////////////// |
| 234 | export function createUnlockingBytecode( |
| 235 | contractType: ContractType, |
| 236 | contractBytecode: Uint8Array, |
| 237 | encodedArgs: Uint8Array[], |
| 238 | selector?: number, |
| 239 | ): Uint8Array { |
| 240 | const unlockScript = [...encodedArgs].reverse(); |
| 241 | if (selector !== undefined) unlockScript.push(encodeInt(BigInt(selector))); |
| 242 | |
| 243 | // P2S inputs do not need to provide the redeem script |
| 244 | if (contractType === 'p2s') return scriptToBytecode(unlockScript); |
| 245 | |
| 246 | // Create input script and compile it to bytecode |
| 247 | const inputScript = [...unlockScript, contractBytecode]; |
| 248 | return scriptToBytecode(inputScript); |
| 249 | } |
| 250 | |
| 251 | export function createOpReturnOutput( |
| 252 | opReturnData: string[], |
no test coverage detected