Subxt should be able to do anything that makes sense in this area.
For your first function, Subxt can help to construct the "call data" part of an extrinsic (check out the examples in general to see how we can build a transaction, eg here: https://github.com/paritytech/subxt/blob/33a9ec91afd16c459871e24ae18576f7afbb87c1/examples/examples/balance_transfer.rs#L34, and then with that you can call
api.tx().call_data(the_tx) to get the call data bytes from it).
For your second function, I'm not exactly clear what the "signature" is that you're referring to (ie is it in fact a combination of signature and extra params?). To step back, a signed extrinsic consists roughly of the following, in order (SCALE encoded):
- compact encoded length in bytes of the extrinsic
- 1 byte:
0b10000000 + 4u8 (for "this is signed" + "version 4 format")
- Address that extrinsic is sent from
- Signature (not only the call data but additional and extra params are also signed)
- The call data.
So depending on what you actually have already, it should be fairly straightforward to piece the parts together. The subxt source on building an extrinsic is, IMO, very readable too, and might help:
And finally, just to say that the "standard" approach here would be that you would construct and sign an extrinsic all via Subxt (by providing any
Signer implementation to do the actual signing), optionally entirely offline, and then use Subxt to then submit those bytes from a network enabled device.