From b006d92790cf88fc9cddd939e6da0c1a4ccbf9c4 Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Thu, 17 Aug 2023 08:59:53 +0300 Subject: [PATCH] add broadcasted txn & allow query version --- api/starknet_api_openrpc.json | 53 ++++++++++++++--------------- api/starknet_trace_api_openrpc.json | 30 +++------------- api/starknet_write_api.json | 28 +++++++++------ 3 files changed, 48 insertions(+), 63 deletions(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index 35f934d..20903c3 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -529,20 +529,7 @@ "description": "a sequence of transactions to estimate, running each transaction on the state resulting from applying all the previous ones", "title": "Transaction", "items": { - "oneOf": [ - { - "title": "Declare transaction", - "$ref": "#/components/schemas/BROADCASTED_DECLARE_TXN" - }, - { - "title": "Invoke transaction", - "$ref": "#/components/schemas/INVOKE_TXN" - }, - { - "title": "Deploy account transaction", - "$ref": "#/components/schemas/DEPLOY_ACCOUNT_TXN" - } - ] + "$ref": "#/components/schemas/BROADCASTED_TXN" } }, "required": true @@ -1782,6 +1769,27 @@ } ] }, + "BROADCASTED_TXN": { + "oneOf": [ + { + "$ref": "#/components/schemas/BROADCASTED_INVOKE_TXN" + }, + { + "$ref": "#/components/schemas/BROADCASTED_DECLARE_TXN" + }, + { + "$ref": "#/components/schemas/BROADCASTED_DEPLOY_ACCOUNT_TXN" + } + ] + }, + "BROADCASTED_INVOKE_TXN": { + "title": "Broadcasted invoke transaction", + "$ref": "#/components/schemas/INVOKE_TXN_V1" + }, + "BROADCASTED_DEPLOY_ACCOUNT_TXN": { + "title": "Broadcasted deploy account transaction", + "$ref": "#/components/schemas/DEPLOY_ACCOUNT_TXN" + }, "BROADCASTED_DECLARE_TXN": { "title": "Broadcasted declare transaction", "oneOf": [ @@ -1817,10 +1825,7 @@ "version": { "title": "Version", "description": "Version of the transaction scheme", - "type": "string", - "enum": [ - "0x1" - ] + "$ref": "#/components/schemas/NUM_AS_HEX" }, "signature": { "title": "Signature", @@ -1875,10 +1880,7 @@ "version": { "title": "Version", "description": "Version of the transaction scheme", - "type": "string", - "enum": [ - "0x2" - ] + "$ref": "#/components/schemas/NUM_AS_HEX" }, "signature": { "title": "Signature", @@ -2104,10 +2106,7 @@ "version": { "title": "Version", "description": "Version of the transaction scheme", - "type": "string", - "enum": [ - "0x1" - ] + "$ref": "#/components/schemas/NUM_AS_HEX" }, "signature": { "title": "Signature", @@ -3065,4 +3064,4 @@ } } } -} +} \ No newline at end of file diff --git a/api/starknet_trace_api_openrpc.json b/api/starknet_trace_api_openrpc.json index 56f411c..2daa475 100644 --- a/api/starknet_trace_api_openrpc.json +++ b/api/starknet_trace_api_openrpc.json @@ -57,20 +57,7 @@ "type": "array", "description": "a sequence of transactions to simulate, running each transaction on the state resulting from applying all the previous ones", "items": { - "oneOf": [ - { - "title": "Declare transaction", - "$ref": "#/components/schemas/BROADCASTED_DECLARE_TXN" - }, - { - "title": "Invoke transaction", - "$ref": "#/components/schemas/INVOKE_TXN" - }, - { - "title": "Deploy account transaction", - "$ref": "#/components/schemas/DEPLOY_ACCOUNT_TXN" - } - ] + "$ref": "#/components/schemas/BROADCASTED_TXN" } } }, @@ -346,17 +333,8 @@ "FEE_ESTIMATE": { "$ref": "./starknet_api_openrpc.json#/components/schemas/FEE_ESTIMATE" }, - "INVOKE_TXN": { - "$ref": "./starknet_api_openrpc.json#/components/schemas/INVOKE_TXN" - }, - "DECLARE_TXN": { - "$ref": "./starknet_api_openrpc.json#/components/schemas/DECLARE_TXN" - }, - "BROADCASTED_DECLARE_TXN": { - "$ref": "./starknet_api_openrpc.json#/components/schemas/BROADCASTED_DECLARE_TXN" - }, - "DEPLOY_ACCOUNT_TXN": { - "$ref": "./starknet_api_openrpc.json#/components/schemas/DEPLOY_ACCOUNT_TXN" + "BROADCASTED_TXN": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BROADCASTED_TXN" } }, "errors": { @@ -399,4 +377,4 @@ } } } -} +} \ No newline at end of file diff --git a/api/starknet_write_api.json b/api/starknet_write_api.json index 9117562..1887628 100644 --- a/api/starknet_write_api.json +++ b/api/starknet_write_api.json @@ -16,7 +16,7 @@ "description": "The information needed to invoke the function (or account, for version 1 transactions)", "required": true, "schema": { - "$ref": "#/components/schemas/INVOKE_TXN_V1" + "$ref": "#/components/schemas/BROADCASTED_INVOKE_TXN" } } ], @@ -31,7 +31,9 @@ "$ref": "#/components/schemas/TXN_HASH" } }, - "required": ["transaction_hash"] + "required": [ + "transaction_hash" + ] } }, "errors": [ @@ -90,7 +92,10 @@ "$ref": "#/components/schemas/FELT" } }, - "required": ["transaction_hash", "class_hash"] + "required": [ + "transaction_hash", + "class_hash" + ] } }, "errors": [ @@ -144,7 +149,7 @@ "description": "The deploy account transaction", "required": true, "schema": { - "$ref": "#/components/schemas/DEPLOY_ACCOUNT_TXN" + "$ref": "#/components/schemas/BROADCASTED_DEPLOY_ACCOUNT_TXN" } } ], @@ -163,7 +168,10 @@ "$ref": "#/components/schemas/FELT" } }, - "required": ["transaction_hash", "contract_address"] + "required": [ + "transaction_hash", + "contract_address" + ] } }, "errors": [ @@ -214,14 +222,14 @@ "TXN_HASH": { "$ref": "./starknet_api_openrpc.json#/components/schemas/TXN_HASH" }, - "INVOKE_TXN_V1": { - "$ref": "./starknet_api_openrpc.json#/components/schemas/INVOKE_TXN_V1" + "BROADCASTED_INVOKE_TXN": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BROADCASTED_INVOKE_TXN" }, "DECLARE_TXN": { "$ref": "./starknet_api_openrpc.json#/components/schemas/DECLARE_TXN" }, - "DEPLOY_ACCOUNT_TXN": { - "$ref": "./starknet_api_openrpc.json#/components/schemas/DEPLOY_ACCOUNT_TXN" + "BROADCASTED_DEPLOY_ACCOUNT_TXN": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BROADCASTED_DEPLOY_ACCOUNT_TXN" }, "FUNCTION_CALL": { "$ref": "./starknet_api_openrpc.json#/components/schemas/FUNCTION_CALL" @@ -287,4 +295,4 @@ } } } -} +} \ No newline at end of file