(chunks: OpOrData[])
| 129 | |
| 130 | // For encoding OP_RETURN data (doesn't require BIP62.3 / MINIMALDATA) |
| 131 | export function encodeNullDataScript(chunks: OpOrData[]): Uint8Array { |
| 132 | return flattenBinArray( |
| 133 | chunks.map((chunk) => { |
| 134 | if (typeof chunk === 'number') { |
| 135 | return new Uint8Array([chunk]); |
| 136 | } |
| 137 | |
| 138 | const pushdataOpcode = getPushDataOpcode(chunk); |
| 139 | return new Uint8Array([...pushdataOpcode, ...chunk]); |
| 140 | }), |
| 141 | ); |
| 142 | } |
| 143 | |
| 144 | function getPushDataOpcode(data: Uint8Array): Uint8Array { |
| 145 | const { byteLength } = data; |
no test coverage detected