From 4967cb7a30675dda2922bd3e5694cf7a37f93fa2 Mon Sep 17 00:00:00 2001 From: "Rene V. Vergara" Date: Tue, 19 Mar 2024 15:14:44 -0400 Subject: [PATCH 1/2] First commit from dev041 --- .gitignore | 3 +- zcash-haskell | 2 +- zebra_openapi.yaml | 1007 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1010 insertions(+), 2 deletions(-) create mode 100644 zebra_openapi.yaml diff --git a/.gitignore b/.gitignore index c368d45..1c231fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .stack-work/ -*~ \ No newline at end of file +*~ +dist-newstyle/ diff --git a/zcash-haskell b/zcash-haskell index a52d223..477817f 160000 --- a/zcash-haskell +++ b/zcash-haskell @@ -1 +1 @@ -Subproject commit a52d2231f1a4f85a6504bfb9228a1475a0773088 +Subproject commit 477817f37f414a459d70b1f89e950f85438ca267 diff --git a/zebra_openapi.yaml b/zebra_openapi.yaml new file mode 100644 index 0000000..86fff2a --- /dev/null +++ b/zebra_openapi.yaml @@ -0,0 +1,1007 @@ +openapi: 3.0.3 +info: + title: Swagger Zebra API - OpenAPI 3.0 + version: 0.0.1 + description: |- + This is the Zebra API. It is a JSON-RPC 2.0 API that allows you to interact with the Zebra node. + + Useful links: + - [The Zebra repository](https://github.com/ZcashFoundation/zebra) + - [The latests API spec](https://github.com/ZcashFoundation/zebra/blob/main/openapi.yaml) +servers: + - url: http://localhost:18232 +paths: + /sendrawtransaction: + post: + tags: + - transaction + description: |- + Sends the raw bytes of a signed transaction to the local node''s mempool, if the transaction is valid."] + + **Request body `params` arguments:** + + - `raw_transaction_hex` - The hex-encoded raw transaction bytes. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + params: + type: array + items: {} + default: '["signedhex"]' + method: + type: string + default: sendrawtransaction + id: + type: number + default: '123' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + /getinfo: + post: + tags: + - control + description: Returns software information from the RPC server, as a [`GetInfo`] JSON struct."] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + method: + type: string + default: getinfo + id: + type: number + default: '123' + params: + type: array + items: {} + default: '[]' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{"build":"some build version","subversion":"some subversion"}' + /getblockhash: + post: + tags: + - blockchain + description: |- + Returns the hash of the block of a given height iff the index argument correspond"] + + **Request body `params` arguments:** + + - `index` - The block index. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + params: + type: array + items: {} + default: '[1]' + method: + type: string + default: getblockhash + id: + type: number + default: '123' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '"0000000000000000000000000000000000000000000000000000000000000000"' + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + /getmininginfo: + post: + tags: + - mining + description: Returns mining-related information."] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + method: + type: string + default: getmininginfo + id: + type: number + default: '123' + params: + type: array + items: {} + default: '[]' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /validateaddress: + post: + tags: + - util + description: |- + Checks if a zcash address is valid."] + + **Request body `params` arguments:** + + - `address` - The zcash address to validate. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + method: + type: string + default: validateaddress + params: + type: array + items: {} + default: '[]' + id: + type: number + default: '123' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /getblocksubsidy: + post: + tags: + - mining + description: |- + Returns the block subsidy reward of the block at `height`, taking into account the mining slow start."] + + **Request body `params` arguments:** + + - `height` - Can be any valid current or future height. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: number + default: '123' + params: + type: array + items: {} + default: '[1]' + method: + type: string + default: getblocksubsidy + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + /submitblock: + post: + tags: + - mining + description: |- + Submits block to the node to be validated and committed."] + + **Request body `params` arguments:** + + - `jsonparametersobject` - - currently ignored + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: number + default: '123' + params: + type: array + items: {} + default: '[]' + method: + type: string + default: submitblock + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /z_listunifiedreceivers: + post: + tags: + - wallet + description: |- + Returns the list of individual payment addresses given a unified address."] + + **Request body `params` arguments:** + + - `address` - The zcash unified address to get the list from. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + method: + type: string + default: z_listunifiedreceivers + id: + type: number + default: '123' + params: + type: array + items: {} + default: '[]' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /getblockcount: + post: + tags: + - blockchain + description: Returns the height of the most recent block in the best valid block chain (equivalently,"] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: number + default: '123' + params: + type: array + items: {} + default: '[]' + method: + type: string + default: getblockcount + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /getaddressutxos: + post: + tags: + - address + description: |- + Returns all unspent outputs for a list of addresses."] + + **Request body `params` arguments:** + + - `addresses` - The addresses to get outputs from. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: number + default: '123' + method: + type: string + default: getaddressutxos + params: + type: array + items: {} + default: '[{"addresses": ["tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ"]}]' + responses: + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /getaddresstxids: + post: + tags: + - address + description: |- + Returns the transaction ids made by the provided transparent addresses."] + + **Request body `params` arguments:** + + - `request` - A struct with the following named fields: + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + method: + type: string + default: getaddresstxids + id: + type: number + default: '123' + params: + type: array + items: {} + default: '[{"addresses": ["tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ"], "start": 1000, "end": 2000}]' + responses: + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /z_getsubtreesbyindex: + post: + tags: + - blockchain + description: |- + Returns information about a range of Sapling or Orchard subtrees."] + + **Request body `params` arguments:** + + - `pool` - The pool from which subtrees should be returned. Either \"sapling\" or \"orchard\". + - `start_index` - The index of the first 2^16-leaf subtree to return. + - `limit` - The maximum number of subtree values to return. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + params: + type: array + items: {} + default: '[]' + method: + type: string + default: z_getsubtreesbyindex + id: + type: number + default: '123' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /getpeerinfo: + post: + tags: + - network + description: Returns data about each connected network node."] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: number + default: '123' + params: + type: array + items: {} + default: '[]' + method: + type: string + default: getpeerinfo + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /getbestblockhash: + post: + tags: + - blockchain + description: Returns the hash of the current best blockchain tip block, as a [`GetBlockHash`] JSON string."] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: number + default: '123' + method: + type: string + default: getbestblockhash + params: + type: array + items: {} + default: '[]' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '"0000000000000000000000000000000000000000000000000000000000000000"' + /getblocktemplate: + post: + tags: + - mining + description: |- + Returns a block template for mining new Zcash blocks."] + + **Request body `params` arguments:** + + - `jsonrequestobject` - A JSON object containing arguments. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: number + default: '123' + params: + type: array + items: {} + default: '[]' + method: + type: string + default: getblocktemplate + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /getdifficulty: + post: + tags: + - blockchain + description: Returns the proof-of-work difficulty as a multiple of the minimum difficulty."] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: number + default: '123' + params: + type: array + items: {} + default: '[]' + method: + type: string + default: getdifficulty + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /getrawmempool: + post: + tags: + - blockchain + description: Returns all transaction ids in the memory pool, as a JSON array."] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + params: + type: array + items: {} + default: '[]' + id: + type: number + default: '123' + method: + type: string + default: getrawmempool + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /getaddressbalance: + post: + tags: + - address + description: |- + Returns the total balance of a provided `addresses` in an [`AddressBalance`] instance."] + + **Request body `params` arguments:** + + - `address_strings` - A JSON map with a single entry + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: number + default: '123' + method: + type: string + default: getaddressbalance + params: + type: array + items: {} + default: '[{"addresses": ["tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ"]}]' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + /getnetworksolps: + post: + tags: + - mining + description: Returns the estimated network solutions per second based on the last `num_blocks` before"] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + params: + type: array + items: {} + default: '[]' + id: + type: number + default: '123' + method: + type: string + default: getnetworksolps + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /z_gettreestate: + post: + tags: + - blockchain + description: |- + Returns information about the given block''s Sapling & Orchard tree state."] + + **Request body `params` arguments:** + + - `hash | height` - The block hash or height. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: number + default: '123' + params: + type: array + items: {} + default: '["00000000febc373a1da2bd9f887b105ad79ddc26ac26c2b28652d64e5207c5b5"]' + method: + type: string + default: z_gettreestate + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{"hash":"0000000000000000000000000000000000000000000000000000000000000000","height":0,"time":0}' + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + /getrawtransaction: + post: + tags: + - transaction + description: |- + Returns the raw transaction data, as a [`GetRawTransaction`] JSON string or structure."] + + **Request body `params` arguments:** + + - `txid` - The transaction ID of the transaction to be returned. + - `verbose` - If 0, return a string of hex-encoded data, otherwise return a JSON object. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + method: + type: string + default: getrawtransaction + id: + type: number + default: '123' + params: + type: array + items: {} + default: '["mytxid", 1]' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + /z_validateaddress: + post: + tags: + - util + description: |- + Checks if a zcash address is valid."] + + **Request body `params` arguments:** + + - `address` - The zcash address to validate. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + params: + type: array + items: {} + default: '[]' + id: + type: number + default: '123' + method: + type: string + default: z_validateaddress + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /getblock: + post: + tags: + - blockchain + description: |- + Returns the requested block by hash or height, as a [`GetBlock`] JSON string."] + + **Request body `params` arguments:** + + - `hash_or_height` - The hash or height for the block to be returned. + - `verbosity` - 0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + method: + type: string + default: getblock + params: + type: array + items: {} + default: '["1", 1]' + id: + type: number + default: '123' + responses: + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{"hash":"0000000000000000000000000000000000000000000000000000000000000000","confirmations":0,"tx":[],"trees":{}}' + /getnetworkhashps: + post: + tags: + - mining + description: Returns the estimated network solutions per second based on the last `num_blocks` before"] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + params: + type: array + items: {} + default: '[]' + method: + type: string + default: getnetworkhashps + id: + type: number + default: '123' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{}' + /getblockchaininfo: + post: + tags: + - blockchain + description: Returns blockchain state information, as a [`GetBlockChainInfo`] JSON struct."] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + method: + type: string + default: getblockchaininfo + id: + type: number + default: '123' + params: + type: array + items: {} + default: '[]' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + result: + type: object + default: '{"chain":"main","blocks":1,"bestblockhash":"0000000000000000000000000000000000000000000000000000000000000000","estimatedheight":1,"upgrades":{},"consensus":{"chaintip":"00000000","nextblock":"00000000"}}' \ No newline at end of file -- 2.34.1 From 3057db9aef945b40d37efb889daadf5fbf2f9957 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 19 Mar 2024 15:50:54 -0500 Subject: [PATCH 2/2] Update to latest ZH --- zcash-haskell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zcash-haskell b/zcash-haskell index 477817f..f228eff 160000 --- a/zcash-haskell +++ b/zcash-haskell @@ -1 +1 @@ -Subproject commit 477817f37f414a459d70b1f89e950f85438ca267 +Subproject commit f228eff367c776469455adc4d443102cc53e5538 -- 2.34.1