The hardware wallet stake key registration and delegation certificates must be submitted to the blockchain in a separate transaction. This transaction must be signed with the hardware wallet (for the hardware wallet stake key) and with the payment key (used to pay the transaction fees). Any payment address/key can be used for this. In the scripts below, the pledge wallet (first pool owner) is used.
In a new subfolder in the transactions subfolder, and create and execute the following scripts: