From 407dd4c7fc8e883d4c59a12a651912ecdc3bcc79 Mon Sep 17 00:00:00 2001 From: MicaiahReid Date: Fri, 7 Jul 2023 17:45:17 -0400 Subject: [PATCH 01/11] new open api spec --- docs/chainhook-openapi.json | 1570 ++++++++++++++++++----------------- 1 file changed, 789 insertions(+), 781 deletions(-) diff --git a/docs/chainhook-openapi.json b/docs/chainhook-openapi.json index b98aea0fc..e746ba96f 100644 --- a/docs/chainhook-openapi.json +++ b/docs/chainhook-openapi.json @@ -1,876 +1,884 @@ { - "openapi": "3.0.0", - "info": { - "title": "Chainhook", - "description": "Stateless Transaction Indexing Engine for Stacks and Bitcoin", - "version": "1.0.6" - }, - "paths": { - "/v1/chainhooks": { - "get": { - "tags": [ - "Chainhooks" - ], - "operationId": "handle_get_hooks", - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": {} - } + "openapi": "3.0.0", + "info": { + "title": "chainhook", + "version": "0.16.0" + }, + "paths": { + "/ping": { + "get": { + "tags": ["Chainhooks"], + "operationId": "handle_ping", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": {} } } } - }, - "post": { - "tags": [ - "Chainhooks" - ], - "operationId": "handle_create_hook", - "requestBody": { + } + } + }, + "/v1/chainhooks": { + "get": { + "tags": ["Chainhooks"], + "operationId": "handle_get_predicates", + "responses": { + "200": { + "description": "", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/ChainhookFullSpecification" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": {} - } + "schema": {} } } } } }, - "/v1/chainhooks/bitcoin/{hook_uuid}": { - "delete": { - "tags": [ - "Chainhooks" - ], - "operationId": "handle_delete_bitcoin_hook", - "parameters": [ - { - "name": "hook_uuid", - "in": "path", - "required": true, + "post": { + "tags": ["Chainhooks"], + "operationId": "handle_create_predicate", + "requestBody": { + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/ChainhookFullSpecification" } } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": {} - } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": {} } } } } - }, - "/v1/chainhooks/stacks/{hook_uuid}": { - "delete": { - "tags": [ - "Chainhooks" - ], - "operationId": "handle_delete_stacks_hook", - "parameters": [ - { - "name": "hook_uuid", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + } + }, + "/v1/chainhooks/{predicate_uuid}": { + "get": { + "tags": ["Chainhooks"], + "operationId": "handle_get_predicate", + "parameters": [ + { + "name": "predicate_uuid", + "in": "path", + "required": true, + "schema": { + "type": "string" } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": {} - } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": {} } } } } } }, - "components": { - "schemas": { - "ChainhookFullSpecification": { - "oneOf": [ - { - "type": "object", - "required": [ - "chain", - "name", - "networks", - "uuid", - "version" - ], - "properties": { - "chain": { - "type": "string", - "enum": [ - "bitcoin" - ] - }, - "uuid": { - "type": "string" - }, - "owner_uuid": { - "type": "string", - "nullable": true - }, - "name": { - "type": "string" - }, - "version": { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - }, - "networks": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" - } - } - } - }, - { - "type": "object", - "required": [ - "chain", - "name", - "networks", - "uuid", - "version" - ], - "properties": { - "chain": { - "type": "string", - "enum": [ - "stacks" - ] - }, - "uuid": { - "type": "string" - }, - "owner_uuid": { - "type": "string", - "nullable": true - }, - "name": { - "type": "string" - }, - "version": { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - }, - "networks": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" - } - } + "/v1/chainhooks/bitcoin/{predicate_uuid}": { + "delete": { + "tags": ["Chainhooks"], + "operationId": "handle_delete_bitcoin_predicate", + "parameters": [ + { + "name": "predicate_uuid", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": {} } } - ] - }, - "BitcoinChainhookNetworkSpecification": { - "type": "object", - "required": [ - "if_this", - "then_that" - ], - "properties": { - "start_block": { - "type": "integer", - "format": "uint64", - "minimum": 0.0, - "nullable": true - }, - "end_block": { - "type": "integer", - "format": "uint64", - "minimum": 0.0, - "nullable": true - }, - "expire_after_occurrence": { - "type": "integer", - "format": "uint64", - "minimum": 0.0, - "nullable": true - }, - "if_this": { - "$ref": "#/components/schemas/BitcoinPredicateType" - }, - "then_that": { - "$ref": "#/components/schemas/HookAction" + } + } + } + }, + "/v1/chainhooks/stacks/{predicate_uuid}": { + "delete": { + "tags": ["Chainhooks"], + "operationId": "handle_delete_stacks_predicate", + "parameters": [ + { + "name": "predicate_uuid", + "in": "path", + "required": true, + "schema": { + "type": "string" } } - }, - "BitcoinPredicateType": { - "oneOf": [ - { - "type": "object", - "required": [ - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "block" - ] - } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": {} } - }, - { - "type": "object", - "oneOf": [ - { - "type": "object", - "required": [ - "equals" - ], - "properties": { - "equals": { - "type": "string" + } + } + } + } + } + }, + "components": { + "schemas": { + "ChainhookFullSpecification": { + "oneOf": [ + { + "type": "object", + "required": ["chain", "name", "networks", "uuid", "version"], + "properties": { + "chain": { + "type": "string", + "enum": ["bitcoin"] + }, + "uuid": { + "type": "string" + }, + "owner_uuid": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "version": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "networks": { + "oneOf": [ + { + "type": "object", + "required": ["Regtest"], + "properties": { + "Regtest": { + "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" + } } }, - "additionalProperties": false - } - ], - "required": [ - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "txid" - ] - } - } - }, - { - "type": "object", - "oneOf": [ - { - "type": "object", - "required": [ - "txid" - ], - "properties": { - "txid": { - "$ref": "#/components/schemas/TxinPredicate" + { + "type": "object", + "required": ["Testnet"], + "properties": { + "Testnet": { + "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" + } } }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "witness_script" - ], - "properties": { - "witness_script": { - "$ref": "#/components/schemas/MatchingRule" + { + "type": "object", + "required": ["Mainnet"], + "properties": { + "Mainnet": { + "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" + } } - }, - "additionalProperties": false - } - ], - "required": [ - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "inputs" - ] - } + } + ] } - }, - { - "type": "object", - "oneOf": [ - { - "type": "object", - "required": [ - "op_return" - ], - "properties": { - "op_return": { - "$ref": "#/components/schemas/MatchingRule" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "p2pkh" - ], - "properties": { - "p2pkh": { - "$ref": "#/components/schemas/ExactMatchingRule" + } + }, + { + "type": "object", + "required": ["chain", "name", "networks", "uuid", "version"], + "properties": { + "chain": { + "type": "string", + "enum": ["stacks"] + }, + "uuid": { + "type": "string" + }, + "owner_uuid": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "version": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "networks": { + "oneOf": [ + { + "type": "object", + "required": ["Simnet"], + "properties": { + "Simnet": { + "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" + } } }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "p2sh" - ], - "properties": { - "p2sh": { - "$ref": "#/components/schemas/ExactMatchingRule" + { + "type": "object", + "required": ["Devnet"], + "properties": { + "Devnet": { + "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" + } } }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "p2wpkh" - ], - "properties": { - "p2wpkh": { - "$ref": "#/components/schemas/ExactMatchingRule" + { + "type": "object", + "required": ["Testnet"], + "properties": { + "Testnet": { + "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" + } } }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "p2wsh" - ], - "properties": { - "p2wsh": { - "$ref": "#/components/schemas/ExactMatchingRule" + { + "type": "object", + "required": ["Mainnet"], + "properties": { + "Mainnet": { + "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" + } } - }, - "additionalProperties": false - } - ], - "required": [ - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "outputs" - ] - } + } + ] } - }, - { - "type": "object", - "oneOf": [ - { - "type": "object", - "required": [ - "stacks" - ], - "properties": { - "stacks": { - "$ref": "#/components/schemas/StacksOperations" - } - }, - "additionalProperties": false + } + } + ] + }, + "BitcoinChainhookNetworkSpecification": { + "type": "object", + "required": ["if_this", "then_that"], + "properties": { + "start_block": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "end_block": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "expire_after_occurrence": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "include_proof": { + "type": "boolean", + "nullable": true + }, + "include_inputs": { + "type": "boolean", + "nullable": true + }, + "include_outputs": { + "type": "boolean", + "nullable": true + }, + "include_witness": { + "type": "boolean", + "nullable": true + }, + "if_this": { + "$ref": "#/components/schemas/BitcoinPredicateType" + }, + "then_that": { + "$ref": "#/components/schemas/HookAction" + } + } + }, + "BitcoinPredicateType": { + "oneOf": [ + { + "type": "object", + "required": ["scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["block"] + } + } + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": ["equals"], + "properties": { + "equals": { + "type": "string" + } }, - { - "type": "object", - "required": [ - "ordinal" - ], - "properties": { - "ordinal": { - "$ref": "#/components/schemas/OrdinalOperations" - } - }, - "additionalProperties": false - } - ], - "required": [ - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "protocol" - ] - } + "additionalProperties": false + } + ], + "required": ["scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["txid"] } } - ] - }, - "TxinPredicate": { - "type": "object", - "required": [ - "txid", - "vout" - ], - "properties": { - "txid": { - "type": "string" - }, - "vout": { - "type": "integer", - "format": "uint32", - "minimum": 0.0 + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": ["txid"], + "properties": { + "txid": { + "$ref": "#/components/schemas/TxinPredicate" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": ["witness_script"], + "properties": { + "witness_script": { + "$ref": "#/components/schemas/MatchingRule" + } + }, + "additionalProperties": false + } + ], + "required": ["scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["inputs"] + } } - } - }, - "MatchingRule": { - "oneOf": [ - { - "type": "object", - "required": [ - "equals" - ], - "properties": { - "equals": { - "type": "string" - } + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": ["op_return"], + "properties": { + "op_return": { + "$ref": "#/components/schemas/MatchingRule" + } + }, + "additionalProperties": false }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "starts_with" - ], - "properties": { - "starts_with": { - "type": "string" - } + { + "type": "object", + "required": ["p2pkh"], + "properties": { + "p2pkh": { + "$ref": "#/components/schemas/ExactMatchingRule" + } + }, + "additionalProperties": false }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "ends_with" - ], - "properties": { - "ends_with": { - "type": "string" - } + { + "type": "object", + "required": ["p2sh"], + "properties": { + "p2sh": { + "$ref": "#/components/schemas/ExactMatchingRule" + } + }, + "additionalProperties": false }, - "additionalProperties": false + { + "type": "object", + "required": ["p2wpkh"], + "properties": { + "p2wpkh": { + "$ref": "#/components/schemas/ExactMatchingRule" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": ["p2wsh"], + "properties": { + "p2wsh": { + "$ref": "#/components/schemas/ExactMatchingRule" + } + }, + "additionalProperties": false + } + ], + "required": ["scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["outputs"] + } } - ] - }, - "ExactMatchingRule": { - "oneOf": [ - { - "type": "object", - "required": [ - "equals" - ], - "properties": { - "equals": { - "type": "string" + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": ["operation"], + "properties": { + "operation": { + "type": "string", + "enum": ["stacker_rewarded"] + } } }, - "additionalProperties": false - } - ] - }, - "StacksOperations": { - "type": "string", - "enum": [ - "stacker_rewarded", - "block_committed", - "leader_registered", - "stx_transfered", - "stx_locked" - ] - }, - "OrdinalOperations": { - "type": "string", - "enum": [ - "inscription_feed" - ] - }, - "HookAction": { - "oneOf": [ - { - "type": "string", - "enum": [ - "noop" - ] - }, - { - "type": "object", - "required": [ - "http_post" - ], - "properties": { - "http_post": { - "$ref": "#/components/schemas/HttpHook" + { + "type": "object", + "required": ["operation"], + "properties": { + "operation": { + "type": "string", + "enum": ["block_committed"] + } } }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "file_append" - ], - "properties": { - "file_append": { - "$ref": "#/components/schemas/FileHook" + { + "type": "object", + "required": ["operation"], + "properties": { + "operation": { + "type": "string", + "enum": ["leader_registered"] + } + } + }, + { + "type": "object", + "required": ["operation"], + "properties": { + "operation": { + "type": "string", + "enum": ["stx_transferred"] + } } }, - "additionalProperties": false + { + "type": "object", + "required": ["operation"], + "properties": { + "operation": { + "type": "string", + "enum": ["stx_locked"] + } + } + } + ], + "required": ["scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["stacks_protocol"] + } } - ] - }, - "HttpHook": { - "type": "object", - "required": [ - "authorization_header", - "url" - ], - "properties": { - "url": { - "type": "string" - }, - "authorization_header": { - "type": "string" + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": ["operation"], + "properties": { + "operation": { + "type": "string", + "enum": ["inscription_feed"] + } + } + } + ], + "required": ["scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["ordinals_protocol"] + } } } - }, - "FileHook": { - "type": "object", - "required": [ - "path" - ], - "properties": { - "path": { - "type": "string" - } + ] + }, + "TxinPredicate": { + "type": "object", + "required": ["txid", "vout"], + "properties": { + "txid": { + "type": "string" + }, + "vout": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 } - }, - "StacksChainhookNetworkSpecification": { - "type": "object", - "required": [ - "if_this", - "then_that" - ], - "properties": { - "start_block": { - "type": "integer", - "format": "uint64", - "minimum": 0.0, - "nullable": true + } + }, + "MatchingRule": { + "oneOf": [ + { + "type": "object", + "required": ["equals"], + "properties": { + "equals": { + "type": "string" + } }, - "end_block": { - "type": "integer", - "format": "uint64", - "minimum": 0.0, - "nullable": true + "additionalProperties": false + }, + { + "type": "object", + "required": ["starts_with"], + "properties": { + "starts_with": { + "type": "string" + } }, - "expire_after_occurrence": { - "type": "integer", - "format": "uint64", - "minimum": 0.0, - "nullable": true + "additionalProperties": false + }, + { + "type": "object", + "required": ["ends_with"], + "properties": { + "ends_with": { + "type": "string" + } }, - "capture_all_events": { - "type": "boolean", - "nullable": true + "additionalProperties": false + } + ] + }, + "ExactMatchingRule": { + "oneOf": [ + { + "type": "object", + "required": ["equals"], + "properties": { + "equals": { + "type": "string" + } }, - "decode_clarity_values": { - "type": "boolean", - "nullable": true + "additionalProperties": false + } + ] + }, + "HookAction": { + "oneOf": [ + { + "type": "string", + "enum": ["noop"] + }, + { + "type": "object", + "required": ["http_post"], + "properties": { + "http_post": { + "$ref": "#/components/schemas/HttpHook" + } }, - "if_this": { - "$ref": "#/components/schemas/StacksPredicate" + "additionalProperties": false + }, + { + "type": "object", + "required": ["file_append"], + "properties": { + "file_append": { + "$ref": "#/components/schemas/FileHook" + } }, - "then_that": { - "$ref": "#/components/schemas/HookAction" - } + "additionalProperties": false } - }, - "StacksPredicate": { - "oneOf": [ - { - "type": "object", - "oneOf": [ - { - "type": "object", - "required": [ - "equals" - ], - "properties": { - "equals": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false + ] + }, + "HttpHook": { + "type": "object", + "required": ["authorization_header", "url"], + "properties": { + "url": { + "type": "string" + }, + "authorization_header": { + "type": "string" + } + } + }, + "FileHook": { + "type": "object", + "required": ["path"], + "properties": { + "path": { + "type": "string" + } + } + }, + "StacksChainhookNetworkSpecification": { + "type": "object", + "required": ["if_this", "then_that"], + "properties": { + "start_block": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "end_block": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "expire_after_occurrence": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "capture_all_events": { + "type": "boolean", + "nullable": true + }, + "decode_clarity_values": { + "type": "boolean", + "nullable": true + }, + "if_this": { + "$ref": "#/components/schemas/StacksPredicate" + }, + "then_that": { + "$ref": "#/components/schemas/HookAction" + } + } + }, + "StacksPredicate": { + "oneOf": [ + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": ["equals"], + "properties": { + "equals": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } }, - { - "type": "object", - "required": [ - "higher_than" - ], - "properties": { - "higher_than": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false + "additionalProperties": false + }, + { + "type": "object", + "required": ["higher_than"], + "properties": { + "higher_than": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } }, - { - "type": "object", - "required": [ - "lower_than" - ], - "properties": { - "lower_than": { + "additionalProperties": false + }, + { + "type": "object", + "required": ["lower_than"], + "properties": { + "lower_than": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": ["between"], + "properties": { + "between": { + "type": "array", + "items": { "type": "integer", "format": "uint64", "minimum": 0.0 - } - }, - "additionalProperties": false + }, + "maxItems": 2, + "minItems": 2 + } }, - { - "type": "object", - "required": [ - "between" - ], - "properties": { - "between": { - "type": "array", - "items": [ - { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - ], - "maxItems": 2, - "minItems": 2 - } - }, - "additionalProperties": false - } - ], - "required": [ - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "block_height" - ] - } + "additionalProperties": false } - }, - { - "type": "object", - "oneOf": [ - { - "type": "string", - "enum": [ - "implement_sip09", - "implement_sip10" - ] - }, - { - "type": "object", - "required": [ - "deployer" - ], - "properties": { - "deployer": { - "type": "string" - } - }, - "additionalProperties": false - } - ], - "required": [ - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "contract_deployment" - ] - } + ], + "required": ["scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["block_height"] } - }, - { - "type": "object", - "required": [ - "contract_identifier", - "method", - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "contract_call" - ] - }, - "contract_identifier": { - "type": "string" + } + }, + { + "type": "object", + "oneOf": [ + { + "type": "string", + "enum": ["implement_sip09", "implement_sip10"] + }, + { + "type": "object", + "required": ["deployer"], + "properties": { + "deployer": { + "type": "string" + } }, - "method": { - "type": "string" - } + "additionalProperties": false } - }, - { - "type": "object", - "required": [ - "contains", - "contract_identifier", - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "print_event" - ] - }, - "contract_identifier": { - "type": "string" - }, - "contains": { + ], + "required": ["scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["contract_deployment"] + } + } + }, + { + "type": "object", + "required": ["contract_identifier", "method", "scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["contract_call"] + }, + "contract_identifier": { + "type": "string" + }, + "method": { + "type": "string" + } + } + }, + { + "type": "object", + "required": ["contains", "contract_identifier", "scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["print_event"] + }, + "contract_identifier": { + "type": "string" + }, + "contains": { + "type": "string" + } + } + }, + { + "type": "object", + "required": ["actions", "asset_identifier", "scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["ft_event"] + }, + "asset_identifier": { + "type": "string" + }, + "actions": { + "type": "array", + "items": { "type": "string" } } - }, - { - "type": "object", - "required": [ - "actions", - "asset_identifier", - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "ft_event" - ] - }, - "asset_identifier": { + } + }, + { + "type": "object", + "required": ["actions", "asset_identifier", "scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["nft_event"] + }, + "asset_identifier": { + "type": "string" + }, + "actions": { + "type": "array", + "items": { "type": "string" - }, - "actions": { - "type": "array", - "items": { - "type": "string" - } } } - }, - { - "type": "object", - "required": [ - "actions", - "asset_identifier", - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "nft_event" - ] - }, - "asset_identifier": { + } + }, + { + "type": "object", + "required": ["actions", "scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["stx_event"] + }, + "actions": { + "type": "array", + "items": { "type": "string" - }, - "actions": { - "type": "array", - "items": { - "type": "string" - } } } - }, - { - "type": "object", - "required": [ - "actions", - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "stx_event" - ] - }, - "actions": { - "type": "array", - "items": { + } + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": ["equals"], + "properties": { + "equals": { "type": "string" } - } + }, + "additionalProperties": false } - }, - { - "type": [ - "object", - "string" - ], - "required": [ - "scope" - ], - "properties": { - "scope": { - "type": "string", - "enum": [ - "txid" - ] - } + ], + "required": ["scope"], + "properties": { + "scope": { + "type": "string", + "enum": ["txid"] } } - ] - } + } + ] } } - } \ No newline at end of file + } +} From 96ecca1c32ac9b58e2fea838ea3e8814c4b6ced9 Mon Sep 17 00:00:00 2001 From: MicaiahReid Date: Wed, 12 Jul 2023 15:45:54 -0400 Subject: [PATCH 02/11] use schemars/openapi forks --- Cargo.lock | 44 +++++++++++++++++------- components/chainhook-cli/Cargo.toml | 2 +- components/chainhook-sdk/Cargo.toml | 2 +- components/chainhook-types-rs/Cargo.toml | 2 +- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7df124550..2b1a5282b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -514,7 +514,7 @@ dependencies = [ "rocket", "rocksdb", "rusqlite", - "schemars", + "schemars 0.8.12", "serde", "serde-hex", "serde_derive", @@ -533,7 +533,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65268eb9aad0d567865cd13c5a5c7a9a301d99f6301f8f5cac1654744eda0a7c" dependencies = [ "hex", - "schemars", + "schemars 0.8.11", "serde", "serde_derive", "serde_json", @@ -545,7 +545,7 @@ name = "chainhook-types" version = "1.0.7" dependencies = [ "hex", - "schemars", + "schemars 0.8.12", "serde", "serde_derive", "serde_json", @@ -2492,11 +2492,10 @@ dependencies = [ [[package]] name = "okapi" version = "0.7.0-rc.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce66b6366e049880a35c378123fddb630b1a1a3c37fa1ca70caaf4a09f6e2893" +source = "git+https://github.com/MicaiahReid/okapi.git?branch=feat-chainhook-fixes#44f2c4d4aac0c7b16700fe8cddabe7228a41ee3f" dependencies = [ "log", - "schemars", + "schemars 0.8.12", "serde", "serde_json", ] @@ -3224,15 +3223,14 @@ dependencies = [ [[package]] name = "rocket_okapi" version = "0.8.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "742098674565c8f0c35c77444f90344aafedebb71cfee9cdbf0185acc6b9cdb7" +source = "git+https://github.com/MicaiahReid/okapi.git?branch=feat-chainhook-fixes#44f2c4d4aac0c7b16700fe8cddabe7228a41ee3f" dependencies = [ "either", "log", "okapi", "rocket", "rocket_okapi_codegen", - "schemars", + "schemars 0.8.12", "serde", "serde_json", ] @@ -3240,8 +3238,7 @@ dependencies = [ [[package]] name = "rocket_okapi_codegen" version = "0.8.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c43f8edc57d88750a220b0ec1870a36c1106204ec99cc35131b49de3b954a4a" +source = "git+https://github.com/MicaiahReid/okapi.git?branch=feat-chainhook-fixes#44f2c4d4aac0c7b16700fe8cddabe7228a41ee3f" dependencies = [ "darling", "proc-macro2", @@ -3448,12 +3445,24 @@ name = "schemars" version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a5fb6c61f29e723026dc8e923d94c694313212abbecbbe5f55a7748eec5b307" +dependencies = [ + "dyn-clone", + "schemars_derive 0.8.11", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "0.8.12" +source = "git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes#a9d7e6d6f9248693cc83d8d9c8ec3671bba3390e" dependencies = [ "dyn-clone", "indexmap", - "schemars_derive", + "schemars_derive 0.8.12", "serde", "serde_json", + "uuid 1.3.0", ] [[package]] @@ -3468,6 +3477,17 @@ dependencies = [ "syn 1.0.105", ] +[[package]] +name = "schemars_derive" +version = "0.8.12" +source = "git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes#a9d7e6d6f9248693cc83d8d9c8ec3671bba3390e" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 1.0.105", +] + [[package]] name = "scoped-tls" version = "1.0.1" diff --git a/components/chainhook-cli/Cargo.toml b/components/chainhook-cli/Cargo.toml index bca69b03b..f9161895e 100644 --- a/components/chainhook-cli/Cargo.toml +++ b/components/chainhook-cli/Cargo.toml @@ -38,7 +38,7 @@ atty = "0.2.14" crossbeam-channel = "0.5.8" uuid = { version = "1.3.0", features = ["v4", "fast-rng"] } threadpool = "1.8.1" -rocket_okapi = "0.8.0-rc.3" +rocket_okapi = { version = "0.8.0-rc.3", features = ["swagger"], git = "https://github.com/MicaiahReid/okapi.git", branch = "feat-chainhook-fixes"} rocket = { version = "=0.5.0-rc.3", features = ["json"] } diff --git a/components/chainhook-sdk/Cargo.toml b/components/chainhook-sdk/Cargo.toml index c020f2656..28d3a85b1 100644 --- a/components/chainhook-sdk/Cargo.toml +++ b/components/chainhook-sdk/Cargo.toml @@ -36,7 +36,7 @@ clap = { version = "3.1.6", features = ["derive"], optional = true } clap_generate = { version = "3.0.3", optional = true } toml = { version = "0.5.6", features = ["preserve_order"], optional = true } ctrlc = { version = "3.2.2", optional = true } -schemars = { version = "0.8.10" } +schemars = { version = "0.8.10", git = "https://github.com/MicaiahReid/schemars.git", branch = "feat-chainhook-fixes" } crossbeam-channel = "0.5.6" chrono = { version = "0.4.19", optional = true } anyhow = { version = "1.0.56", features = ["backtrace"], optional = true } diff --git a/components/chainhook-types-rs/Cargo.toml b/components/chainhook-types-rs/Cargo.toml index 7aef34adb..e092d4e52 100644 --- a/components/chainhook-types-rs/Cargo.toml +++ b/components/chainhook-types-rs/Cargo.toml @@ -12,5 +12,5 @@ serde = "1" serde_json = "1" serde_derive = "1" strum = { version = "0.23.0", features = ["derive"] } -schemars = { version = "0.8.10" } +schemars = { version = "0.8.10", git = "https://github.com/MicaiahReid/schemars.git", branch = "feat-chainhook-fixes" } hex = "0.4.3" From d1595774f4a634bd0884ddd8270b74575bb1c667 Mon Sep 17 00:00:00 2001 From: MicaiahReid Date: Wed, 12 Jul 2023 15:46:24 -0400 Subject: [PATCH 03/11] add function to get openapi spec --- .../chainhook-cli/src/service/http_api.rs | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/components/chainhook-cli/src/service/http_api.rs b/components/chainhook-cli/src/service/http_api.rs index 1d7d71013..4e9c46a8c 100644 --- a/components/chainhook-cli/src/service/http_api.rs +++ b/components/chainhook-cli/src/service/http_api.rs @@ -14,8 +14,7 @@ use redis::{Commands, Connection}; use rocket::config::{self, Config, LogLevel}; use rocket::serde::json::{json, Json, Value as JsonValue}; use rocket::State; -use rocket_okapi::openapi; -use rocket_okapi::openapi_get_routes; +use rocket_okapi::{okapi::openapi3::OpenApi, openapi, openapi_get_routes_spec}; use std::error::Error; use crate::config::PredicatesApiConfig; @@ -46,14 +45,7 @@ pub async fn start_predicate_api_server( ..Config::default() }; - let routes = openapi_get_routes![ - handle_ping, - handle_get_predicates, - handle_get_predicate, - handle_create_predicate, - handle_delete_bitcoin_predicate, - handle_delete_stacks_predicate - ]; + let (routes, _) = get_routes_spec(); let background_job_tx_mutex = Arc::new(Mutex::new(observer_commands_tx.clone())); @@ -361,3 +353,21 @@ pub fn load_predicates_from_redis( .map_err(|e| format!("unable to connect to redis: {}", e.to_string()))?; get_entries_from_predicates_db(&mut predicate_db_conn, ctx) } + +pub fn document_predicate_api_server() -> Result { + let (_, spec) = get_routes_spec(); + let json_spec = serde_json::to_string_pretty(&spec) + .map_err(|e| format!("failed to serialize openapi spec: {}", e.to_string()))?; + Ok(json_spec) +} + +pub fn get_routes_spec() -> (Vec, OpenApi) { + openapi_get_routes_spec![ + handle_ping, + handle_get_predicates, + handle_get_predicate, + handle_create_predicate, + handle_delete_bitcoin_predicate, + handle_delete_stacks_predicate + ] +} From 802362146ab5ee5b6b4f713a6907d1ab7deccd80 Mon Sep 17 00:00:00 2001 From: MicaiahReid Date: Wed, 12 Jul 2023 15:46:50 -0400 Subject: [PATCH 04/11] add command to generate new api documentation --- components/chainhook-cli/src/cli/mod.rs | 39 +++++++++++++++++++++ components/chainhook-cli/src/service/mod.rs | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/components/chainhook-cli/src/cli/mod.rs b/components/chainhook-cli/src/cli/mod.rs index 41c364551..98fad8d87 100644 --- a/components/chainhook-cli/src/cli/mod.rs +++ b/components/chainhook-cli/src/cli/mod.rs @@ -4,6 +4,7 @@ use crate::config::generator::generate_config; use crate::config::{Config, PredicatesApi}; use crate::scan::bitcoin::scan_bitcoin_chainstate_via_rpc_using_predicate; use crate::scan::stacks::scan_stacks_chainstate_via_csv_using_predicate; +use crate::service::http_api::document_predicate_api_server; use crate::service::Service; use crate::storage::{ get_last_block_height_inserted, get_stacks_block_at_block_height, is_stacks_block_present, @@ -69,6 +70,9 @@ enum Command { /// Stacks related subcommands #[clap(subcommand)] Stacks(StacksCommand), + /// Generate documentation + #[clap(subcommand)] + Docs(DocsCommand), } #[derive(Subcommand, PartialEq, Clone, Debug)] @@ -427,6 +431,22 @@ struct InitHordDbCommand { pub config_path: Option, } +#[derive(Subcommand, PartialEq, Clone, Debug)] +#[clap(bin_name = "docs", aliases=&["doc"])] +enum DocsCommand { + /// Generate new documentation for the predicate registration API. + #[clap(subcommand)] + #[clap(name = "api")] + Api(ApiDocsCommand), +} + +#[derive(Subcommand, PartialEq, Clone, Debug)] +enum ApiDocsCommand { + /// Generate documentation for the predicate registration API. + #[clap(name = "new", bin_name = "new", aliases = &["generate"])] + Generate, +} + pub fn main() { let logger = hiro_system_kit::log::setup_logger(); let _guard = hiro_system_kit::log::setup_global_logger(logger.clone()); @@ -996,6 +1016,25 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> { } } }, + Command::Docs(subcmd) => match subcmd { + DocsCommand::Api(api_docs_cmd) => match api_docs_cmd { + ApiDocsCommand::Generate => { + use std::fs::File; + use std::io::Write; + let spec = document_predicate_api_server() + .map_err(|e| format!("unable to generate API docs: {}", e))?; + let mut file_path = PathBuf::new(); + file_path.push("openapi.json"); + let mut file = File::create(&file_path).map_err(|e| { + format!("unable to open file {}\n{}", file_path.display(), e) + })?; + file.write_all(spec.as_bytes()).map_err(|e| { + format!("unable to write file {}\n{}", file_path.display(), e) + })?; + println!("Created file openapi.json"); + } + }, + }, } Ok(()) } diff --git a/components/chainhook-cli/src/service/mod.rs b/components/chainhook-cli/src/service/mod.rs index e0bade688..5541e6fca 100644 --- a/components/chainhook-cli/src/service/mod.rs +++ b/components/chainhook-cli/src/service/mod.rs @@ -1,4 +1,4 @@ -mod http_api; +pub(crate) mod http_api; mod runloops; use crate::config::{Config, PredicatesApi, PredicatesApiConfig}; From 7116a4631b94870c4f9bfae8b26ac6db7e9ce78e Mon Sep 17 00:00:00 2001 From: MicaiahReid Date: Wed, 12 Jul 2023 15:47:59 -0400 Subject: [PATCH 05/11] update chainhook-openapi.json --- docs/chainhook-openapi.json | 51 ++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/docs/chainhook-openapi.json b/docs/chainhook-openapi.json index e746ba96f..c2f897855 100644 --- a/docs/chainhook-openapi.json +++ b/docs/chainhook-openapi.json @@ -171,27 +171,27 @@ "oneOf": [ { "type": "object", - "required": ["Regtest"], + "required": ["\"regtest\""], "properties": { - "Regtest": { + "\"regtest\"": { "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" } } }, { "type": "object", - "required": ["Testnet"], + "required": ["\"testnet\""], "properties": { - "Testnet": { + "\"testnet\"": { "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" } } }, { "type": "object", - "required": ["Mainnet"], + "required": ["\"mainnet\""], "properties": { - "Mainnet": { + "\"mainnet\"": { "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" } } @@ -227,36 +227,36 @@ "oneOf": [ { "type": "object", - "required": ["Simnet"], + "required": ["\"simnet\""], "properties": { - "Simnet": { + "\"simnet\"": { "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" } } }, { "type": "object", - "required": ["Devnet"], + "required": ["\"devnet\""], "properties": { - "Devnet": { + "\"devnet\"": { "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" } } }, { "type": "object", - "required": ["Testnet"], + "required": ["\"testnet\""], "properties": { - "Testnet": { + "\"testnet\"": { "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" } } }, { "type": "object", - "required": ["Mainnet"], + "required": ["\"mainnet\""], "properties": { - "Mainnet": { + "\"mainnet\"": { "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" } } @@ -267,6 +267,10 @@ } ] }, + "BitcoinNetwork": { + "type": "string", + "enum": ["regtest", "testnet", "mainnet"] + }, "BitcoinChainhookNetworkSpecification": { "type": "object", "required": ["if_this", "then_that"], @@ -638,6 +642,10 @@ } } }, + "StacksNetwork": { + "type": "string", + "enum": ["simnet", "devnet", "testnet", "mainnet"] + }, "StacksChainhookNetworkSpecification": { "type": "object", "required": ["if_this", "then_that"], @@ -724,9 +732,18 @@ "between": { "type": "array", "items": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 + "anyOf": [ + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + ] }, "maxItems": 2, "minItems": 2 From 4d66d3f13fe574e0c431a5d2cf22cd05dc8b381d Mon Sep 17 00:00:00 2001 From: MicaiahReid Date: Wed, 12 Jul 2023 16:06:50 -0400 Subject: [PATCH 06/11] update fork dep --- Cargo.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b1a5282b..9fad75dcb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -514,7 +514,7 @@ dependencies = [ "rocket", "rocksdb", "rusqlite", - "schemars 0.8.12", + "schemars 0.8.12 (git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes)", "serde", "serde-hex", "serde_derive", @@ -533,7 +533,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65268eb9aad0d567865cd13c5a5c7a9a301d99f6301f8f5cac1654744eda0a7c" dependencies = [ "hex", - "schemars 0.8.11", + "schemars 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", "serde", "serde_derive", "serde_json", @@ -545,7 +545,7 @@ name = "chainhook-types" version = "1.0.7" dependencies = [ "hex", - "schemars 0.8.12", + "schemars 0.8.12 (git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes)", "serde", "serde_derive", "serde_json", @@ -2495,7 +2495,7 @@ version = "0.7.0-rc.1" source = "git+https://github.com/MicaiahReid/okapi.git?branch=feat-chainhook-fixes#44f2c4d4aac0c7b16700fe8cddabe7228a41ee3f" dependencies = [ "log", - "schemars 0.8.12", + "schemars 0.8.12 (git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes)", "serde", "serde_json", ] @@ -3230,7 +3230,7 @@ dependencies = [ "okapi", "rocket", "rocket_okapi_codegen", - "schemars 0.8.12", + "schemars 0.8.12 (git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes)", "serde", "serde_json", ] @@ -3442,12 +3442,12 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a5fb6c61f29e723026dc8e923d94c694313212abbecbbe5f55a7748eec5b307" +checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" dependencies = [ "dyn-clone", - "schemars_derive 0.8.11", + "schemars_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", "serde", "serde_json", ] @@ -3455,11 +3455,11 @@ dependencies = [ [[package]] name = "schemars" version = "0.8.12" -source = "git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes#a9d7e6d6f9248693cc83d8d9c8ec3671bba3390e" +source = "git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes#15fdd4711700114d57c090aad62516593bd4ca6d" dependencies = [ "dyn-clone", "indexmap", - "schemars_derive 0.8.12", + "schemars_derive 0.8.12 (git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes)", "serde", "serde_json", "uuid 1.3.0", @@ -3467,9 +3467,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f188d036977451159430f3b8dc82ec76364a42b7e289c2b18a9a18f4470058e9" +checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" dependencies = [ "proc-macro2", "quote", @@ -3480,7 +3480,7 @@ dependencies = [ [[package]] name = "schemars_derive" version = "0.8.12" -source = "git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes#a9d7e6d6f9248693cc83d8d9c8ec3671bba3390e" +source = "git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes#15fdd4711700114d57c090aad62516593bd4ca6d" dependencies = [ "proc-macro2", "quote", From 62663ef8ce3b50560a9a5ac44b1a20b1f235c999 Mon Sep 17 00:00:00 2001 From: MicaiahReid Date: Wed, 12 Jul 2023 16:10:03 -0400 Subject: [PATCH 07/11] fix openapi.json --- docs/chainhook-openapi.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/chainhook-openapi.json b/docs/chainhook-openapi.json index c2f897855..e720b9e3d 100644 --- a/docs/chainhook-openapi.json +++ b/docs/chainhook-openapi.json @@ -171,27 +171,27 @@ "oneOf": [ { "type": "object", - "required": ["\"regtest\""], + "required": ["regtest"], "properties": { - "\"regtest\"": { + "regtest": { "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" } } }, { "type": "object", - "required": ["\"testnet\""], + "required": ["testnet"], "properties": { - "\"testnet\"": { + "testnet": { "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" } } }, { "type": "object", - "required": ["\"mainnet\""], + "required": ["mainnet"], "properties": { - "\"mainnet\"": { + "mainnet": { "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" } } @@ -227,36 +227,36 @@ "oneOf": [ { "type": "object", - "required": ["\"simnet\""], + "required": ["simnet"], "properties": { - "\"simnet\"": { + "simnet": { "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" } } }, { "type": "object", - "required": ["\"devnet\""], + "required": ["devnet"], "properties": { - "\"devnet\"": { + "devnet": { "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" } } }, { "type": "object", - "required": ["\"testnet\""], + "required": ["testnet"], "properties": { - "\"testnet\"": { + "testnet": { "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" } } }, { "type": "object", - "required": ["\"mainnet\""], + "required": ["mainnet"], "properties": { - "\"mainnet\"": { + "mainnet": { "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" } } From 83c937a52d24c1e19df77b4a8a967f8369734090 Mon Sep 17 00:00:00 2001 From: MicaiahReid Date: Wed, 12 Jul 2023 16:10:32 -0400 Subject: [PATCH 08/11] remove unused feature --- components/chainhook-cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/chainhook-cli/Cargo.toml b/components/chainhook-cli/Cargo.toml index f9161895e..9e04d8f66 100644 --- a/components/chainhook-cli/Cargo.toml +++ b/components/chainhook-cli/Cargo.toml @@ -38,7 +38,7 @@ atty = "0.2.14" crossbeam-channel = "0.5.8" uuid = { version = "1.3.0", features = ["v4", "fast-rng"] } threadpool = "1.8.1" -rocket_okapi = { version = "0.8.0-rc.3", features = ["swagger"], git = "https://github.com/MicaiahReid/okapi.git", branch = "feat-chainhook-fixes"} +rocket_okapi = { version = "0.8.0-rc.3", git = "https://github.com/MicaiahReid/okapi.git", branch = "feat-chainhook-fixes"} rocket = { version = "=0.5.0-rc.3", features = ["json"] } From 4ec44ffca64788468b5087a987ee569bc309550a Mon Sep 17 00:00:00 2001 From: MicaiahReid Date: Wed, 12 Jul 2023 17:02:26 -0400 Subject: [PATCH 09/11] use hiro fork --- Cargo.lock | 20 ++++++++++---------- components/chainhook-cli/Cargo.toml | 2 +- components/chainhook-sdk/Cargo.toml | 2 +- components/chainhook-types-rs/Cargo.toml | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9fad75dcb..f6d28d248 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -514,7 +514,7 @@ dependencies = [ "rocket", "rocksdb", "rusqlite", - "schemars 0.8.12 (git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes)", + "schemars 0.8.12 (git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes)", "serde", "serde-hex", "serde_derive", @@ -545,7 +545,7 @@ name = "chainhook-types" version = "1.0.7" dependencies = [ "hex", - "schemars 0.8.12 (git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes)", + "schemars 0.8.12 (git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes)", "serde", "serde_derive", "serde_json", @@ -2492,10 +2492,10 @@ dependencies = [ [[package]] name = "okapi" version = "0.7.0-rc.1" -source = "git+https://github.com/MicaiahReid/okapi.git?branch=feat-chainhook-fixes#44f2c4d4aac0c7b16700fe8cddabe7228a41ee3f" +source = "git+https://github.com/hirosystems/okapi.git?branch=feat-chainhook-fixes#21baab1052426159857572788c3b5774fcb41b91" dependencies = [ "log", - "schemars 0.8.12 (git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes)", + "schemars 0.8.12 (git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes)", "serde", "serde_json", ] @@ -3223,14 +3223,14 @@ dependencies = [ [[package]] name = "rocket_okapi" version = "0.8.0-rc.3" -source = "git+https://github.com/MicaiahReid/okapi.git?branch=feat-chainhook-fixes#44f2c4d4aac0c7b16700fe8cddabe7228a41ee3f" +source = "git+https://github.com/hirosystems/okapi.git?branch=feat-chainhook-fixes#21baab1052426159857572788c3b5774fcb41b91" dependencies = [ "either", "log", "okapi", "rocket", "rocket_okapi_codegen", - "schemars 0.8.12 (git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes)", + "schemars 0.8.12 (git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes)", "serde", "serde_json", ] @@ -3238,7 +3238,7 @@ dependencies = [ [[package]] name = "rocket_okapi_codegen" version = "0.8.0-rc.3" -source = "git+https://github.com/MicaiahReid/okapi.git?branch=feat-chainhook-fixes#44f2c4d4aac0c7b16700fe8cddabe7228a41ee3f" +source = "git+https://github.com/hirosystems/okapi.git?branch=feat-chainhook-fixes#21baab1052426159857572788c3b5774fcb41b91" dependencies = [ "darling", "proc-macro2", @@ -3455,11 +3455,11 @@ dependencies = [ [[package]] name = "schemars" version = "0.8.12" -source = "git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes#15fdd4711700114d57c090aad62516593bd4ca6d" +source = "git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes#15fdd4711700114d57c090aad62516593bd4ca6d" dependencies = [ "dyn-clone", "indexmap", - "schemars_derive 0.8.12 (git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes)", + "schemars_derive 0.8.12 (git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes)", "serde", "serde_json", "uuid 1.3.0", @@ -3480,7 +3480,7 @@ dependencies = [ [[package]] name = "schemars_derive" version = "0.8.12" -source = "git+https://github.com/MicaiahReid/schemars.git?branch=feat-chainhook-fixes#15fdd4711700114d57c090aad62516593bd4ca6d" +source = "git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes#15fdd4711700114d57c090aad62516593bd4ca6d" dependencies = [ "proc-macro2", "quote", diff --git a/components/chainhook-cli/Cargo.toml b/components/chainhook-cli/Cargo.toml index 9e04d8f66..e8bdf9b40 100644 --- a/components/chainhook-cli/Cargo.toml +++ b/components/chainhook-cli/Cargo.toml @@ -38,7 +38,7 @@ atty = "0.2.14" crossbeam-channel = "0.5.8" uuid = { version = "1.3.0", features = ["v4", "fast-rng"] } threadpool = "1.8.1" -rocket_okapi = { version = "0.8.0-rc.3", git = "https://github.com/MicaiahReid/okapi.git", branch = "feat-chainhook-fixes"} +rocket_okapi = { version = "0.8.0-rc.3", git = "https://github.com/hirosystems/okapi.git", branch = "feat-chainhook-fixes"} rocket = { version = "=0.5.0-rc.3", features = ["json"] } diff --git a/components/chainhook-sdk/Cargo.toml b/components/chainhook-sdk/Cargo.toml index 28d3a85b1..42f3f4ede 100644 --- a/components/chainhook-sdk/Cargo.toml +++ b/components/chainhook-sdk/Cargo.toml @@ -36,7 +36,7 @@ clap = { version = "3.1.6", features = ["derive"], optional = true } clap_generate = { version = "3.0.3", optional = true } toml = { version = "0.5.6", features = ["preserve_order"], optional = true } ctrlc = { version = "3.2.2", optional = true } -schemars = { version = "0.8.10", git = "https://github.com/MicaiahReid/schemars.git", branch = "feat-chainhook-fixes" } +schemars = { version = "0.8.10", git = "https://github.com/hirosystems/schemars.git", branch = "feat-chainhook-fixes" } crossbeam-channel = "0.5.6" chrono = { version = "0.4.19", optional = true } anyhow = { version = "1.0.56", features = ["backtrace"], optional = true } diff --git a/components/chainhook-types-rs/Cargo.toml b/components/chainhook-types-rs/Cargo.toml index e092d4e52..ca79561ce 100644 --- a/components/chainhook-types-rs/Cargo.toml +++ b/components/chainhook-types-rs/Cargo.toml @@ -12,5 +12,5 @@ serde = "1" serde_json = "1" serde_derive = "1" strum = { version = "0.23.0", features = ["derive"] } -schemars = { version = "0.8.10", git = "https://github.com/MicaiahReid/schemars.git", branch = "feat-chainhook-fixes" } +schemars = { version = "0.8.10", git = "https://github.com/hirosystems/schemars.git", branch = "feat-chainhook-fixes" } hex = "0.4.3" From b80b4ad4562e6c82109165878d2597ffad5ce26f Mon Sep 17 00:00:00 2001 From: MicaiahReid Date: Wed, 12 Jul 2023 17:03:20 -0400 Subject: [PATCH 10/11] cargo.lock --- Cargo.lock | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f6d28d248..ba9ab85c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -72,9 +72,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.69" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" dependencies = [ "backtrace", ] @@ -514,7 +514,7 @@ dependencies = [ "rocket", "rocksdb", "rusqlite", - "schemars 0.8.12 (git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes)", + "schemars 0.8.12", "serde", "serde-hex", "serde_derive", @@ -533,7 +533,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65268eb9aad0d567865cd13c5a5c7a9a301d99f6301f8f5cac1654744eda0a7c" dependencies = [ "hex", - "schemars 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", + "schemars 0.8.11", "serde", "serde_derive", "serde_json", @@ -545,7 +545,7 @@ name = "chainhook-types" version = "1.0.7" dependencies = [ "hex", - "schemars 0.8.12 (git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes)", + "schemars 0.8.12", "serde", "serde_derive", "serde_json", @@ -1657,9 +1657,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "glob" @@ -2184,9 +2184,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" dependencies = [ "cc", "pkg-config", @@ -2482,9 +2482,9 @@ dependencies = [ [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "memchr", ] @@ -2495,7 +2495,7 @@ version = "0.7.0-rc.1" source = "git+https://github.com/hirosystems/okapi.git?branch=feat-chainhook-fixes#21baab1052426159857572788c3b5774fcb41b91" dependencies = [ "log", - "schemars 0.8.12 (git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes)", + "schemars 0.8.12", "serde", "serde_json", ] @@ -3230,7 +3230,7 @@ dependencies = [ "okapi", "rocket", "rocket_okapi_codegen", - "schemars 0.8.12 (git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes)", + "schemars 0.8.12", "serde", "serde_json", ] @@ -3299,9 +3299,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustc-hash" @@ -3442,12 +3442,12 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.12" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" +checksum = "2a5fb6c61f29e723026dc8e923d94c694313212abbecbbe5f55a7748eec5b307" dependencies = [ "dyn-clone", - "schemars_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", + "schemars_derive 0.8.11", "serde", "serde_json", ] @@ -3459,7 +3459,7 @@ source = "git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook- dependencies = [ "dyn-clone", "indexmap", - "schemars_derive 0.8.12 (git+https://github.com/hirosystems/schemars.git?branch=feat-chainhook-fixes)", + "schemars_derive 0.8.12", "serde", "serde_json", "uuid 1.3.0", @@ -3467,9 +3467,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.12" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" +checksum = "f188d036977451159430f3b8dc82ec76364a42b7e289c2b18a9a18f4470058e9" dependencies = [ "proc-macro2", "quote", From 507e4a31c22bdb351c695f0b062c8564732baeb3 Mon Sep 17 00:00:00 2001 From: Ludo Galabru Date: Wed, 12 Jul 2023 17:43:02 -0400 Subject: [PATCH 11/11] Update components/chainhook-sdk/Cargo.toml --- components/chainhook-sdk/Cargo.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/components/chainhook-sdk/Cargo.toml b/components/chainhook-sdk/Cargo.toml index 9f6062de3..70d73884e 100644 --- a/components/chainhook-sdk/Cargo.toml +++ b/components/chainhook-sdk/Cargo.toml @@ -32,10 +32,6 @@ reqwest = { version = "0.11", default-features = false, features = [ ] } tokio = { version = "1.24", features = ["full"] } base58 = "0.2.0" -clap = { version = "3.1.6", features = ["derive"], optional = true } -clap_generate = { version = "3.0.3", optional = true } -toml = { version = "0.5.6", features = ["preserve_order"], optional = true } -ctrlc = { version = "3.2.2", optional = true } schemars = { version = "0.8.10", git = "https://github.com/hirosystems/schemars.git", branch = "feat-chainhook-fixes" } crossbeam-channel = "0.5.6" futures = "0.3.21"