{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "rpc": "setpsbtversion",
  "title": "Command for setting PSBT version",
  "description": [
    "The **setpsbtversion** RPC command converts the provided PSBT to the given version, and returns the base64 result of the conversion. Returns an error if version is invalid."
  ],
  "request": {
    "required": [
      "psbt",
      "version"
    ],
    "additionalProperties": false,
    "properties": {
      "psbt": {
        "type": "string",
        "description": [
          "The PSBT to change versions."
        ]
      },
      "version": {
        "type": "u32",
        "description": [
          "The version to set."
        ]
      }
    }
  },
  "response": {
    "required": [
      "psbt"
    ],
    "additionalProperties": false,
    "properties": {
      "psbt": {
        "type": "string",
        "description": [
          "A converted PSBT of the requested version."
        ]
      }
    }
  },
  "errors": [
    "The following error codes may occur:",
    "",
    "- -32602: Parameter missed or malformed."
  ],
  "author": [
    "Gregory Sanders [gsanders87@gmail.com](mailto:gsanders87@gmail.com) is mainly responsible."
  ],
  "see_also": [
    "lightning-fundpsbt(7)",
    "lightning-utxopsbt(7)",
    "lightning-signpsbt(7)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "request": {
        "id": "example:setpsbtversion#1",
        "method": "setpsbtversion",
        "params": {
          "psbt": "cHNidP8BAgpsbt1001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101",
          "version": 0
        }
      },
      "response": {
        "psbt": "cHNidP8BADUCAAAAAAFAQg8AAAAAACJRIO7yw3zIUblRUcdhCLSjdFxJsYHu2s0Y29bT0bGAGdcbbwAAAAAA"
      }
    },
    {
      "request": {
        "id": "example:setpsbtversion#2",
        "method": "setpsbtversion",
        "params": [
          "cHNidP8BAgpsbt20020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202",
          2
        ]
      },
      "response": {
        "psbt": "cHNidP8BAgpsbt20020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202"
      }
    }
  ]
}
