( psbt: bitcoin.Psbt, totalInput: number, totalOutput: number, fee: number, change: string )
| 176 | |
| 177 | //添加找零输出 |
| 178 | function addChangeOutput( |
| 179 | psbt: bitcoin.Psbt, |
| 180 | totalInput: number, |
| 181 | totalOutput: number, |
| 182 | fee: number, |
| 183 | change: string |
| 184 | ) { |
| 185 | const value = totalInput - totalOutput - fee; |
| 186 | if (value < 0) throw new Error("NoFund"); |
| 187 | // If value is greater than the minimum change, add a change output, otherwise don't add |
| 188 | if (value > MIN_SATOSHIS) { |
| 189 | psbt.addOutput({ |
| 190 | address: change, |
| 191 | value: Number(value), |
| 192 | }); |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | function signInputs( |
| 197 | psbt: bitcoin.Psbt, |
no outgoing calls
no test coverage detected