core-lightning/doc/schemas/lightning-txprepare.json
ShahanaFarooqui 9592facf83 doc: Lock example values
Changelog-Added: Test script generates all RPC documentation examples now.
2024-11-26 21:45:19 +10:30

136 lines
4.8 KiB
JSON

{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"rpc": "txprepare",
"title": "Command to prepare to withdraw funds from the internal wallet",
"description": [
"The **txprepare** RPC command creates an unsigned transaction which spends funds from Core Lightning's internal wallet to the outputs specified in *outputs*.",
"",
"**txprepare** is similar to the first part of a **withdraw** command, but supports multiple outputs and uses *outputs* as parameter. The second part is provided by **txsend**."
],
"request": {
"required": [
"outputs"
],
"additionalProperties": false,
"properties": {
"outputs": {
"type": "array",
"description": [
"Format is like: [{destination1: amount1}, {destination2: amount2}] or [{destination: *all*}]. It supports any number of **confirmed** outputs."
],
"items": {
"type": "outputdesc"
}
},
"feerate": {
"type": "feerate",
"description": [
"Used for the transaction as initial feerate."
],
"default": "*normal*"
},
"minconf": {
"type": "u32",
"description": [
"The minimum number of confirmations that used outputs should have."
],
"default": 1
},
"utxos": {
"type": "array",
"description": [
"To be used to fund the transaction, as an array of `txid:vout`. These must be drawn from the node's available UTXO set."
],
"items": {
"type": "outpoint"
}
}
}
},
"response": {
"required": [
"psbt",
"unsigned_tx",
"txid"
],
"additionalProperties": false,
"properties": {
"psbt": {
"type": "string",
"description": [
"The PSBT representing the unsigned transaction."
]
},
"unsigned_tx": {
"type": "hex",
"description": [
"The unsigned transaction."
]
},
"txid": {
"type": "txid",
"description": [
"The transaction id of *unsigned_tx*; you hand this to lightning-txsend(7) or lightning-txdiscard(7), as the inputs of this transaction are reserved."
]
}
}
},
"errors": [
"On failure, an error is reported and the transaction is not created.",
"",
"- -1: Catchall nonspecific error.",
"- 301: There are not enough funds in the internal wallet (including fees) to create the transaction.",
"- 302: The dust limit is not met."
],
"author": [
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
],
"see_also": [
"lightning-withdraw(7)",
"lightning-txsend(7)",
"lightning-txdiscard(7)",
"lightning-feerates(7)"
],
"resources": [
"Main web site: <https://github.com/ElementsProject/lightning>"
],
"examples": [
{
"request": {
"id": "example:txprepare#1",
"method": "txprepare",
"params": [
[
{
"bcrt1p0002020202020202020202020202020202020202020202020202020202": 16777216
}
]
]
},
"response": {
"unsigned_tx": "0200000000000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006",
"txid": "txidtxprep000100001000010000100001000010000100001000010000100001",
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000"
}
},
{
"request": {
"id": "example:txprepare#2",
"method": "txprepare",
"params": {
"outputs": [
{
"bcrt1p0003030303030303030303030303030303030303030303030303030303": 16777216
}
]
}
},
"response": {
"unsigned_tx": "0200000000000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002",
"txid": "txidtxprep000200002000020000200002000020000200002000020000200002",
"psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000201000"
}
}
]
}