How can I construct a transaction using a watch only wallet RPC and cold sign using any nodejs library? In the end, I have to send this to the blockchain using the daemon or watch only wallet RPC.
Using the wallet RPC on your view only (hot) wallet, you can call transfer with
get_tx_metadata: true and
do_not_relay: true which will yield an
unsigned_txset in the response.
Then on the spend wallet RPC (your cold wallet), call sign_transfer, passing in the
unsigned_txset from above, which will yield a
signed_txset in the response.
Back on the view only (hot) wallet RPC, call submit_transfer, passing the data from
signed_txset above in the
The linked methods all have examples of these steps using curl. The calls are just simple HTTP POST requests, so libraries are not really needed.