Closed drewstone closed 4 years ago
Psbt doesn't know how to make CLTVs so you must do it manually via the Transaction API. See our integration tests for examples.
As for Error:
"Incorrect argument type" is better?
Your arguments are formatted for Transaction API, not Psbt. See the integration tests. But again, it does not support CLTV.
@junderw even if I'm only trying to send money to a P2SH CTLV contract? This is not the redeem script but rather the funding of the address.
Sending to is fine.
you can specify the scriptPubkey in the script parameter or specify the address in the address parameter.
@junderw I must be not-very proficient at this. I am now getting
(node:18800) UnhandledPromiseRejectionWarning: Error: 2MyE9w28eB8iT9omT2VxcmZQymxKhkr3h86 has no matching Script
Is there any way you can provide me an example of what I am doing wrong? I am only trying to fund a P2SH address. I have changed for adding the output below:
const redeemScript = createScript(locktime, key.publicKey);
const { address } = bitcoin.payments.p2sh({
redeem: {
output: redeemScript,
network: network,
},
network: network,
});
.
.
.
// Send amount of satoshis to the P2SH time lock transaction
psbt.addOutput({
address: address,
value: Number(amount),
network: network,
});
EDIT: Using both script
and address
properties seemed to solve it.
to use address you must pass the network object to Psbt when creating it.
script does not need a network object, so when you pass both, it will just ignore the address.
You pass the network when making const psbt = new Psbt({ network });
or const psbt = Psbt.fromBase64(text, { network })
etc
I'm trying to create a raw bitcoin tx using this library, a simple CTLV p2sh where I fund the p2sh address. Yet, I am getting uninformative errors about why it can't add this final output.
The error I get is: