/build/rpc / contracts / repo
repo.build_repay_release
- workflowrepo-lifecycle·step 8 of 10Workflow: repo-lifecycle · step 8 of 10
repo.build_repay_release "id" ( {"vault_txid":"hex","vault_vout":n,"vault_amount":n,"collateral_address":"str","manual_inputs":bool,"inputs":[{"txid":"hex","vout":n},...],"locktime":n,"fee_rate":n} ) Construct the repayment PSBT for an accepted repo contract. The PSBT spends the vault via the repay leaf, pays the lender the fixed repay amount, and releases collateral back to the borrower. Arguments: 1. id (string, required) Repo offer identifier 2. options (json object, optional) Optional builder settings { "vault_txid": "hex", (string, optional) Override vault outpoint txid (used if wallet registry is unaware) "vault_vout": n, (numeric, optional) Override vault outpoint index "vault_amount": n, (numeric, optional) Vault amount (BTC) when tx not yet known to wallet "collateral_address": "str", (string, optional) Destination for released collateral (defaults to fresh wallet address) "manual_inputs": bool, (boolean, optional) Disable automatic asset input selection and use options.inputs "inputs": [ (json array, optional) Manual additional inputs (requires manual_inputs=true) { (json object, required) "txid": "hex", (string, required) Input txid "vout": n, (numeric, required) Input vout }, ... ], "locktime": n, (numeric, optional) Override transaction nLockTime "fee_rate": n, (numeric, optional) Override fee rate in sat/vB (wallet estimate if omitted) } Result: { (json object) "psbt" : "str", (string) Base64-encoded PSBT "fee" : n, (numeric) Wallet-computed fee (in BTC) "changepos" : n, (numeric) Index of wallet change output or -1 if none "vault_input_index" : n, (numeric) Index of the covenant input within the PSBT "principal_output_index" : n, (numeric) Index of the principal payment output to lender "interest_output_index" : n, (numeric) Index of the interest payment output to lender "repay_output_index" : n, (numeric) Index of the repay output (legacy, points to principal) "collateral_output_index" : n, (numeric) Index of the collateral release output "asset_change_output_index" : n, (numeric) Index of the asset change output or -1 if none "taproot" : { (json object) Taproot spend data "output_key" : "hex", (string) Tweaked Taproot output key "internal_key" : "hex", (string) Internal Taproot key "script_pubkey" : "hex", (string) Hex-encoded covenant scriptPubKey "tree" : [ (json array) Taproot script tree { (json object) "depth" : n, (numeric) Depth of the leaf "leaf_version" : n, (numeric) Taproot leaf version "script" : "hex" (string) Hex-encoded leaf script }, ... ] }, "complete" : true|false, (boolean) Whether the PSBT already contains all signatures "hex" : "hex", (string, optional) Signed transaction hex (present when complete=true) "txid" : "hex" (string, optional) Transaction identifier (present when complete=true) } Examples: > bitcoin-cli repo.build_repay_release "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Signature
repo.build_repay_release(id: string, options?: object) → any Code samples
curl --user "$RPC_USER:$RPC_PASS" \
--data-binary '{"jsonrpc":"1.0","id":"docs","method":"repo.build_repay_release","params":["\"<id>\"",{}]}' \
-H 'content-type: text/plain;' \
http://127.0.0.1:8332/ Parameters
| Name | Type | Req. | Description |
|---|---|---|---|
| id | string | yes | Repo offer identifier |
| options | object | — | Optional builder settings { "vault_txid": "hex", (string, optional) Override vault outpoint txid (used if wallet registry is unaware) "vault_vout": n, (numeric, optional) Override vault outpoint index "vault_amount": n, (numeric, optional) Vault amount (BTC) when tx not yet known to wallet "collateral_address": "str", (string, optional) Destination for released collateral (defaults to fresh wallet address) "manual_inputs": bool, (boolean, optional) Disable automatic asset input selection and use options.inputs "inputs": [ (json array, optional) Manual additional inputs (requires manual_inputs=true) { (json object, required) "txid": "hex", (string, required) Input txid "vout": n, (numeric, required) Input vout }, ... ], "locktime": n, (numeric, optional) Override transaction nLockTime "fee_rate": n, (numeric, optional) Override fee rate in sat/vB (wallet estimate if omitted) } |
Result
Type: any
{ (json object) "psbt" : "str", (string) Base64-encoded PSBT "fee" : n, (numeric) Wallet-computed fee (in BTC) "changepos" : n, (numeric) Index of wallet change output or -1 if none "vault_input_index" : n, (numeric) Index of the covenant input within the PSBT "principal_output_index" : n, (numeric) Index of the principal payment output to lender "interest_output_index" : n, (numeric) Index of the interest payment output to lender "repay_output_index" : n, (numeric) Index of the repay output (legacy, points to principal) "collateral_output_index" : n, (numeric) Index of the collateral release output "asset_change_output_index" : n, (numeric) Index of the asset change output or -1 if none "taproot" : { (json object) Taproot spend data "output_key" : "hex", (string) Tweaked Taproot output key "internal_key" : "hex", (string) Internal Taproot key "script_pubkey" : "hex", (string) Hex-encoded covenant scriptPubKey "tree" : [ (json array) Taproot script tree { (json object) "depth" : n, (numeric) Depth of the leaf "leaf_version" : n, (numeric) Taproot leaf version "script" : "hex" (string) Hex-encoded leaf script }, ... ] }, "complete" : true|false, (boolean) Whether the PSBT already contains all signatures "hex" : "hex", (string, optional) Signed transaction hex (present when complete=true) "txid" : "hex" (string, optional) Transaction identifier (present when complete=true) }
Source: services/core-node/bcore/src/wallet/rpc/contracts.cpp:5199
C++ symbol: repo_build_repay_release