/build/rpc / contracts / repo
repo.build_open
- workflowrepo-lifecycle·step 6 of 10Workflow: repo-lifecycle · step 6 of 10
repo.build_open "id" ( {"locktime":n,"auto_fund_principal":bool,"auto_fund_collateral":bool,"psbt":"str"} ) Construct the opening PSBT for a repo offer, funding the collateral vault and including the lender's principal payout. Two-party workflow: Lender calls with auto_fund_principal=true, borrower receives PSBT and calls with psbt= and auto_fund_collateral=true to add collateral funding. Arguments: 1. id (string, required) Repo offer identifier 2. options (json object, optional) Optional funding overrides { "locktime": n, (numeric, optional) Override transaction nLockTime "auto_fund_principal": bool, (boolean, optional) Lender mode: automatically attach wallet-controlled asset inputs for principal "auto_fund_collateral": bool, (boolean, optional) Borrower mode: automatically attach wallet-controlled BTC inputs for collateral "psbt": "str", (string, optional) Existing PSBT to add funding to (used with auto_fund_collateral) } Result: { (json object) "psbt" : "str", (string) Base64-encoded PSBT containing the funded covenant transaction "fee" : n, (numeric) Fee (in BTC) paid by the wallet to fund this PSBT "changepos" : n, (numeric) Index of the change output or -1 if none "principal_output_index" : n, (numeric) Index of the principal asset output within the PSBT "covenant_output_index" : n, (numeric) Index of the covenant Taproot output within the PSBT "asset_change_output_index" : n, (numeric) Index of the asset change output when auto_fund_principal is used, otherwise -1 "taproot" : { (json object) Taproot construction details "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 } Examples: > bitcoin-cli repo.build_open "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Signature
repo.build_open(id: string, options?: object) → any Code samples
curl --user "$RPC_USER:$RPC_PASS" \
--data-binary '{"jsonrpc":"1.0","id":"docs","method":"repo.build_open","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 funding overrides { "locktime": n, (numeric, optional) Override transaction nLockTime "auto_fund_principal": bool, (boolean, optional) Lender mode: automatically attach wallet-controlled asset inputs for principal "auto_fund_collateral": bool, (boolean, optional) Borrower mode: automatically attach wallet-controlled BTC inputs for collateral "psbt": "str", (string, optional) Existing PSBT to add funding to (used with auto_fund_collateral) } |
Result
Type: any
{ (json object) "psbt" : "str", (string) Base64-encoded PSBT containing the funded covenant transaction "fee" : n, (numeric) Fee (in BTC) paid by the wallet to fund this PSBT "changepos" : n, (numeric) Index of the change output or -1 if none "principal_output_index" : n, (numeric) Index of the principal asset output within the PSBT "covenant_output_index" : n, (numeric) Index of the covenant Taproot output within the PSBT "asset_change_output_index" : n, (numeric) Index of the asset change output when auto_fund_principal is used, otherwise -1 "taproot" : { (json object) Taproot construction details "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 }
Source: services/core-node/bcore/src/wallet/rpc/contracts.cpp:3656
C++ symbol: repo_build_open