From ab4160c96ad0b8d96c6d4b07b3a8e4103df9440d Mon Sep 17 00:00:00 2001 From: Shahak Shama Date: Mon, 26 Feb 2024 12:09:01 +0200 Subject: [PATCH] fix receipt and pending receipt schema --- api/starknet_api_openrpc.json | 239 ++++------------------------------ 1 file changed, 23 insertions(+), 216 deletions(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index 14f96ae..cc01814 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -381,16 +381,8 @@ "result": { "name": "result", "schema": { - "oneOf": [ - { - "title": "Transaction receipt", - "$ref": "#/components/schemas/TXN_RECEIPT" - }, - { - "title": "Pending transaction receipt", - "$ref": "#/components/schemas/PENDING_TXN_RECEIPT" - } - ] + "title": "Transaction receipt with block info", + "$ref": "#/components/schemas/TXN_RECEIPT_WITH_BLOCK_INFO" } }, "errors": [ @@ -1427,7 +1419,7 @@ }, "receipt": { "title": "receipt", - "$ref": "#/components/schemas/TXN_RECEIPT_IN_BLOCK" + "$ref": "#/components/schemas/TXN_RECEIPT" } }, "required": [ @@ -2854,17 +2846,9 @@ }, "finality_status": { "title": "Finality status", - "description": "finality status of the tx, which is ACCEPTED_ON_L2 when included in a pending receipt, and can be ACCEPTED_ON_L1 when part of a getBlockWithReceipts response", + "description": "finality status of the tx", "$ref": "#/components/schemas/TXN_FINALITY_STATUS" }, - "block_hash": { - "title": "Block hash", - "$ref": "#/components/schemas/BLOCK_HASH" - }, - "block_number": { - "title": "Block number", - "$ref": "#/components/schemas/BLOCK_NUMBER" - }, "messages_sent": { "type": "array", "title": "Messages sent", @@ -2897,8 +2881,6 @@ "actual_fee", "finality_status", "execution_status", - "block_hash", - "block_number", "messages_sent", "events", "execution_resources" @@ -2929,31 +2911,6 @@ } ] }, - "PENDING_INVOKE_TXN_RECEIPT": { - "title": "Invoke Transaction Receipt", - "allOf": [ - { - "title": "Type", - "type": "object", - "properties": { - "type": { - "title": "Type", - "type": "string", - "enum": [ - "INVOKE" - ] - } - }, - "required": [ - "type" - ] - }, - { - "title": "Common receipt properties", - "$ref": "#/components/schemas/PENDING_COMMON_RECEIPT_PROPERTIES" - } - ] - }, "DECLARE_TXN_RECEIPT": { "title": "Declare Transaction Receipt", "allOf": [ @@ -2979,31 +2936,6 @@ } ] }, - "PENDING_DECLARE_TXN_RECEIPT": { - "title": "Declare Transaction Receipt", - "allOf": [ - { - "title": "Declare txn receipt", - "type": "object", - "properties": { - "type": { - "title": "Declare", - "type": "string", - "enum": [ - "DECLARE" - ] - } - }, - "required": [ - "type" - ] - }, - { - "title": "Common receipt properties", - "$ref": "#/components/schemas/PENDING_COMMON_RECEIPT_PROPERTIES" - } - ] - }, "DEPLOY_ACCOUNT_TXN_RECEIPT": { "title": "Deploy Account Transaction Receipt", "allOf": [ @@ -3035,37 +2967,6 @@ } ] }, - "PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT": { - "title": "Deploy Account Transaction Receipt", - "allOf": [ - { - "title": "Common receipt properties", - "$ref": "#/components/schemas/PENDING_COMMON_RECEIPT_PROPERTIES" - }, - { - "title": "DeployAccount txn receipt", - "type": "object", - "properties": { - "type": { - "title": "Deploy account", - "type": "string", - "enum": [ - "DEPLOY_ACCOUNT" - ] - }, - "contract_address": { - "title": "Contract address", - "description": "The address of the deployed contract", - "$ref": "#/components/schemas/FELT" - } - }, - "required": [ - "type", - "contract_address" - ] - } - ] - }, "DEPLOY_TXN_RECEIPT": { "title": "Deploy Transaction Receipt", "allOf": [ @@ -3129,38 +3030,6 @@ } ] }, - "PENDING_L1_HANDLER_TXN_RECEIPT": { - "title": "L1 Handler Transaction Receipt", - "description": "receipt for l1 handler transaction", - "allOf": [ - { - "title": "Transaction type", - "type": "object", - "properties": { - "type": { - "title": "type", - "type": "string", - "enum": [ - "L1_HANDLER" - ] - }, - "message_hash": { - "title": "Message hash", - "description": "The message hash as it appears on the L1 core contract", - "$ref": "#/components/schemas/NUM_AS_HEX" - } - }, - "required": [ - "type", - "message_hash" - ] - }, - { - "title": "Common receipt properties", - "$ref": "#/components/schemas/PENDING_COMMON_RECEIPT_PROPERTIES" - } - ] - }, "TXN_RECEIPT": { "title": "Transaction Receipt", "oneOf": [ @@ -3186,91 +3055,29 @@ } ] }, - "PENDING_TXN_RECEIPT": { - "title": "Transaction Receipt", - "oneOf": [ - { - "title": "Pending Invoke transaction receipt", - "$ref": "#/components/schemas/PENDING_INVOKE_TXN_RECEIPT" - }, - { - "title": "Pending L1 handler transaction receipt", - "$ref": "#/components/schemas/PENDING_L1_HANDLER_TXN_RECEIPT" - }, + "TXN_RECEIPT_WITH_BLOCK_INFO": { + "title": "Transaction receipt with block info", + "allOf": [ { - "title": "Pending Declare transaction receipt", - "$ref": "#/components/schemas/PENDING_DECLARE_TXN_RECEIPT" + "title": "Transaction receipt", + "$ref": "#/components/schemas/TXN_RECEIPT" }, { - "title": "Pending Deploy account transaction receipt", - "$ref": "#/components/schemas/PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT" - } - ] - }, - "TXN_RECEIPT_IN_BLOCK": { - "title": "receipt in block", - "$ref": "#/components/schemas/PENDING_TXN_RECEIPT" - }, - "PENDING_COMMON_RECEIPT_PROPERTIES": { - "title": "Pending common receipt properties", - "description": "Common properties for a pending transaction receipt", - "type": "object", - "properties": { - "transaction_hash": { - "title": "Transaction hash", - "$ref": "#/components/schemas/TXN_HASH", - "description": "The hash identifying the transaction" - }, - "actual_fee": { - "title": "Actual fee", - "$ref": "#/components/schemas/FEE_PAYMENT", - "description": "The fee that was charged by the sequencer" - }, - "messages_sent": { - "type": "array", - "title": "Messages sent", - "items": { - "$ref": "#/components/schemas/MSG_TO_L1" - } - }, - "events": { - "description": "The events emitted as part of this transaction", - "title": "Events", - "type": "array", - "items": { - "$ref": "#/components/schemas/EVENT" + "type": "object", + "properties": { + "block_hash": { + "title": "Block hash", + "$ref": "#/components/schemas/BLOCK_HASH", + "description": "If this field is missing, it means the receipt belongs to the pending block" + }, + "block_number": { + "title": "Block number", + "$ref": "#/components/schemas/BLOCK_NUMBER", + "description": "If this field is missing, it means the receipt belongs to the pending block" + } } - }, - "revert_reason": { - "title": "Revert reason", - "name": "revert reason", - "description": "the revert reason for the failed execution", - "type": "string" - }, - "finality_status": { - "title": "Finality status", - "$ref": "#/components/schemas/TXN_FINALITY_STATUS" - }, - "execution_status": { - "title": "Execution status", - "$ref": "#/components/schemas/TXN_EXECUTION_STATUS" - }, - "execution_resources": { - "title": "Execution resources", - "description": "The resources consumed by the transaction", - "$ref": "#/components/schemas/EXECUTION_RESOURCES" } - }, - "required": [ - "transaction_hash", - "actual_fee", - "messages_sent", - "events", - "finality_status", - "execution_status", - "execution_resources" - ], - "additionalProperties": false + ] }, "MSG_TO_L1": { "title": "Message to L1", @@ -4124,4 +3931,4 @@ } } } -} \ No newline at end of file +}