(outputs: Output[])
| 207 | } |
| 208 | |
| 209 | export function getTxSizeWithoutInputs(outputs: Output[]): number { |
| 210 | // Transaction format: |
| 211 | // Version (4 Bytes) |
| 212 | // TxIn Count (1 ~ 9B) |
| 213 | // For each TxIn: |
| 214 | // Outpoint (36B) |
| 215 | // Script Length (1 ~ 9B) |
| 216 | // ScriptSig(?) |
| 217 | // Sequence (4B) |
| 218 | // TxOut Count (1 ~ 9B) |
| 219 | // For each TxOut: |
| 220 | // Value (8B) |
| 221 | // Script Length(1 ~ 9B)* |
| 222 | // Script (?)* |
| 223 | // LockTime (4B) |
| 224 | |
| 225 | let size = VERSION_SIZE + LOCKTIME_SIZE; |
| 226 | size += outputs.reduce((acc, output) => acc + getOutputSize(output), 0); |
| 227 | // Add tx-out count (accounting for a potential change output) |
| 228 | size += bigIntToCompactUint(BigInt(outputs.length + 1)).byteLength; |
| 229 | |
| 230 | return size; |
| 231 | } |
| 232 | |
| 233 | // ////////// BUILD OBJECTS /////////////////////////////////////////////////// |
| 234 | export function createUnlockingBytecode( |
nothing calls this directly
no test coverage detected