/build/rpc / contracts / status
contract.list
contract.list ( {"type":"str","state":"str","role":"str"} ) List all contracts in the wallet registry (repo, spot, forward). Arguments: 1. filter (json object, optional) Optional filters { "type": "str", (string, optional) Filter by contract type: 'repo', 'spot', 'forward' "state": "str", (string, optional) Filter by state: 'proposed', 'accepted', 'opened', 'repaid', 'defaulted', 'closed' "role": "str", (string, optional) Filter by role: 'lender', 'borrower', 'alice', 'bob', 'long', 'short' } Result: [ (json array) Array of contract summaries { (json object) "id" : "hex", (string) Contract identifier "type" : "str", (string) Contract type (repo, spot, forward) "role" : "str", (string) User role in this contract "status" : "str", (string) Contract status "maturity_height" : n, (numeric, optional) Maturity block height (repo/forward) "principal_amount" : n, (numeric, optional) Principal amount (repo) "collateral_amount" : n, (numeric, optional) Collateral amount (repo) "created_height" : n (numeric) Block height when contract was created }, ... ] Examples: > bitcoin-cli contract.list > bitcoin-cli contract.list {\"type\":\"repo\",\"status\":\"opened\"} > curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "contract.list", "params": [{\"type\":\"repo\"}]}' -H 'content-type: application/json' http://127.0.0.1:8332/
Signature
contract.list(filter?: object) → any Code samples
curl --user "$RPC_USER:$RPC_PASS" \
--data-binary '{"jsonrpc":"1.0","id":"docs","method":"contract.list","params":[{}]}' \
-H 'content-type: text/plain;' \
http://127.0.0.1:8332/ Parameters
| Name | Type | Req. | Description |
|---|---|---|---|
| filter | object | — | Optional filters { "type": "str", (string, optional) Filter by contract type: 'repo', 'spot', 'forward' "state": "str", (string, optional) Filter by state: 'proposed', 'accepted', 'opened', 'repaid', 'defaulted', 'closed' "role": "str", (string, optional) Filter by role: 'lender', 'borrower', 'alice', 'bob', 'long', 'short' } |
Result
Type: any
[ (json array) Array of contract summaries { (json object) "id" : "hex", (string) Contract identifier "type" : "str", (string) Contract type (repo, spot, forward) "role" : "str", (string) User role in this contract "status" : "str", (string) Contract status "maturity_height" : n, (numeric, optional) Maturity block height (repo/forward) "principal_amount" : n, (numeric, optional) Principal amount (repo) "collateral_amount" : n, (numeric, optional) Collateral amount (repo) "created_height" : n (numeric) Block height when contract was created }, ... ]
Source: services/core-node/bcore/src/wallet/rpc/contracts.cpp:7579
C++ symbol: contract_list