P2WPKH transaction example
A simple transaction spending four P2WPKH inputs and produces a single P2WPKH output, effectively aggregating the coins from all inputs.
Fee rate is (inaccurately) approximated. To set exact fee rate sign the transaction, calculate fee based on its virtual size and then sign again - changing the value of the output invalidates previous signatures.
This code was used to produce testnet transaction: https://mempool.space/testnet/tx/f8990964483b62a86ad1a5ae445b2d5b3ccd74c3611a857dc794a37eb5c62e3f