0.0002462028
{"result":null,"error":{"code":-3,"message":"Invalid amount"},"id":null}
I'm aware of the other question on this forum that says -3 is a type error that only appears when amount is negative or zero, but that is not the case as you can see above in the call body.
The error message is already telling you what the problem is and it is not just about being negative or zero, it is about being an "invalid" value for amount which could be for many different reasons like not being a number; in this case the problem is that the value has more decimal places than defined in Bitcoin (10 instead of .{"result":null,"error":{"code":-3,"message":"Invalid amount"},"id":null}
I'm aware of the other question on this forum that says -3 is a type error that only appears when amount is negative or zero, but that is not the case as you can see above in the call body.
Thank you, this solved the problem. Here's the new code:
Code:
const response = await bitcoin.send(
[{ [output]: sending.toFixed(8).toString() }],
6, // conf_target
"economical",
undefined, // fee_rate
{
"change_position": 1,
"subtract_fee_from_outputs": [0],
"inputs": [input],
},
);