From 4f71f7d2bb9d5aef4e36c4ba68412ea4a3470a06 Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Mon, 16 Oct 2023 19:53:36 +0300 Subject: [PATCH 1/4] add v3 transaction --- api/starknet_api_openrpc.json | 281 ++++++++++++++++++++++++++++++++-- 1 file changed, 268 insertions(+), 13 deletions(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index 31e4355..7f3d669 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -1,7 +1,7 @@ { "openrpc": "1.0.0-rc1", "info": { - "version": "0.5.0", + "version": "0.6.0", "title": "StarkNet Node API", "license": {} }, @@ -1641,6 +1641,10 @@ { "title": "Declare transaction V2", "$ref": "#/components/schemas/DECLARE_TXN_V2" + }, + { + "title": "Declare transaction V3", + "$ref": "#/components/schemas/DECLARE_TXN_V3" } ] }, @@ -1822,6 +1826,72 @@ } ] }, + "DECLARE_TXN_V3": { + "title": "Declare Transaction V3", + "description": "Declare Contract Transaction V3", + "allOf": [ + { + "type": "object", + "title": "Declare txn v3", + "properties": { + "type": { + "title": "Declare", + "type": "string", + "enum": [ + "DECLARE" + ] + }, + "sender_address": { + "title": "Sender address", + "description": "The address of the account contract sending the declaration transaction", + "$ref": "#/components/schemas/ADDRESS" + }, + "compiled_class_hash": { + "title": "Compiled class hash", + "description": "The hash of the Cairo assembly resulting from the Sierra compilation", + "$ref": "#/components/schemas/FELT" + }, + "version": { + "title": "Version", + "description": "Version of the transaction scheme", + "type": "string", + "enum": [ + "0x3" + ] + }, + "signature": { + "title": "Signature", + "$ref": "#/components/schemas/SIGNATURE" + }, + "nonce": { + "title": "Nonce", + "$ref": "#/components/schemas/FELT" + }, + "class_hash": { + "title": "Class hash", + "description": "The hash of the declared class", + "$ref": "#/components/schemas/FELT" + }, + "l1_gas": { + "title": "L1 Gas", + "description": "The max amount and max price per unit of L1 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + } + }, + "required": [ + "type", + "sender_address", + "compiled_class_hash", + "max_fee", + "version", + "signature", + "nonce", + "class_hash", + "l1_gas" + ] + } + ] + }, "BROADCASTED_TXN": { "oneOf": [ { @@ -1837,16 +1907,7 @@ }, "BROADCASTED_INVOKE_TXN": { "title": "Broadcasted invoke transaction", - "oneOf": [ - { - "title": "Broadcasted invoke transaction V0", - "$ref": "#/components/schemas/INVOKE_TXN_V0" - }, - { - "title": "Broadcasted invoke transaction V1", - "$ref": "#/components/schemas/INVOKE_TXN_V1" - } - ] + "$ref": "#/components/schemas/INVOKE_TXN" }, "BROADCASTED_DEPLOY_ACCOUNT_TXN": { "title": "Broadcasted deploy account transaction", @@ -1862,6 +1923,10 @@ { "title": "Broadcasted declare transaction V2", "$ref": "#/components/schemas/BROADCASTED_DECLARE_TXN_V2" + }, + { + "title": "Broadcasted declare transaction V3", + "$ref": "#/components/schemas/BROADCASTED_DECLARE_TXN_V3" } ] }, @@ -1982,6 +2047,69 @@ } ] }, + "BROADCASTED_DECLARE_TXN_V3": { + "title": "Broadcasted declare Transaction V3", + "description": "Broadcasted declare Contract Transaction V3", + "allOf": [ + { + "type": "object", + "title": "Declare txn v3", + "properties": { + "type": { + "title": "Declare", + "type": "string", + "enum": [ + "DECLARE" + ] + }, + "sender_address": { + "title": "Sender address", + "description": "The address of the account contract sending the declaration transaction", + "$ref": "#/components/schemas/ADDRESS" + }, + "compiled_class_hash": { + "title": "Compiled class hash", + "description": "The hash of the Cairo assembly resulting from the Sierra compilation", + "$ref": "#/components/schemas/FELT" + }, + "version": { + "title": "Version", + "description": "Version of the transaction scheme", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "signature": { + "title": "Signature", + "$ref": "#/components/schemas/SIGNATURE" + }, + "nonce": { + "title": "Nonce", + "$ref": "#/components/schemas/FELT" + }, + "contract_class": { + "title": "Contract class", + "description": "The class to be declared", + "$ref": "#/components/schemas/CONTRACT_CLASS" + }, + "l1_gas": { + "title": "L1 Gas", + "description": "The max amount and max price per unit of L1 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + } + }, + "required": [ + "type", + "sender_address", + "compiled_class_hash", + "max_fee", + "version", + "signature", + "nonce", + "contract_class", + "l1_gas" + ] + } + ] + }, "DEPLOY_ACCOUNT_TXN": { "title": "Deploy account transaction", "description": "deploys a new account contract", @@ -1989,6 +2117,10 @@ { "title": "Deploy account V1", "$ref": "#/components/schemas/DEPLOY_ACCOUNT_TXN_V1" + }, + { + "title": "Deploy account V3", + "$ref": "#/components/schemas/DEPLOY_ACCOUNT_TXN_V3" } ] }, @@ -2051,6 +2183,66 @@ "class_hash" ] }, + "DEPLOY_ACCOUNT_TXN_V3": { + "title": "Deploy account transaction", + "description": "Deploys an account contract, charges fee from the pre-funded account addresses", + "properties": { + "type": { + "title": "Deploy account", + "type": "string", + "enum": [ + "DEPLOY_ACCOUNT" + ] + }, + "version": { + "title": "Version", + "description": "Version of the transaction scheme", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "signature": { + "title": "Signature", + "$ref": "#/components/schemas/SIGNATURE" + }, + "nonce": { + "title": "Nonce", + "$ref": "#/components/schemas/FELT" + }, + "contract_address_salt": { + "title": "Contract address salt", + "description": "The salt for the address of the deployed contract", + "$ref": "#/components/schemas/FELT" + }, + "constructor_calldata": { + "type": "array", + "description": "The parameters passed to the constructor", + "title": "Constructor calldata", + "items": { + "$ref": "#/components/schemas/FELT" + } + }, + "class_hash": { + "title": "Class hash", + "description": "The hash of the deployed contract's class", + "$ref": "#/components/schemas/FELT" + }, + "l1_gas": { + "title": "L1 Gas", + "description": "The max amount and max price per unit of L1 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + } + }, + "required": [ + "max_fee", + "version", + "signature", + "nonce", + "type", + "contract_address_salt", + "constructor_calldata", + "class_hash", + "l1_gas" + ] + }, "DEPLOY_TXN": { "title": "Deploy Contract Transaction", "description": "The structure of a deploy transaction. Note that this transaction type is deprecated and will no longer be supported in future versions", @@ -2212,6 +2404,64 @@ } ] }, + "INVOKE_TXN_V3": { + "title": "Invoke transaction V3", + "description": "initiates a transaction from a given account", + "allOf": [ + { + "type": "object", + "properties": { + "type": { + "title": "Type", + "type": "string", + "enum": [ + "INVOKE" + ] + }, + "sender_address": { + "title": "sender address", + "$ref": "#/components/schemas/ADDRESS" + }, + "calldata": { + "type": "array", + "title": "calldata", + "description": "The data expected by the account's `execute` function (in most usecases, this includes the called contract address and a function selector)", + "items": { + "$ref": "#/components/schemas/FELT" + } + }, + "version": { + "title": "Version", + "description": "Version of the transaction scheme", + "$ref": "#/components/schemas/NUM_AS_HEX" + }, + "signature": { + "title": "Signature", + "$ref": "#/components/schemas/SIGNATURE" + }, + "nonce": { + "title": "Nonce", + "$ref": "#/components/schemas/FELT" + }, + "l1_gas": { + "title": "L1 Gas", + "description": "The max amount and max price per unit of L1 gas used in this tx", + "$ref": "#/components/schemas/RESOURCE_LIMITS" + } + }, + "required": [ + "type", + "sender_address", + "calldata", + "max_fee", + "version", + "signature", + "nonce", + "l1_gas" + ] + } + ] + }, "INVOKE_TXN": { "title": "Invoke transaction", "description": "Initiate a transaction from an account", @@ -2223,6 +2473,10 @@ { "title": "Invoke transaction V1", "$ref": "#/components/schemas/INVOKE_TXN_V1" + }, + { + "title": "Invoke transaction V3", + "$ref": "#/components/schemas/INVOKE_TXN_V3" } ] }, @@ -3267,7 +3521,8 @@ } }, "required": [ - "price_in_wei" + "price_in_wei", + "price_in_strk" ] }, "EXECUTION_RESOURCES": { @@ -3392,4 +3647,4 @@ } } } -} +} \ No newline at end of file From 3bba40be89f7ca410c3f911f98b75984fb3ed99a Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Mon, 23 Oct 2023 14:58:22 +0300 Subject: [PATCH 2/4] remove redundant fields --- api/starknet_api_openrpc.json | 9 --------- api/starknet_trace_api_openrpc.json | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index 7f3d669..cfc1efb 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -1882,7 +1882,6 @@ "type", "sender_address", "compiled_class_hash", - "max_fee", "version", "signature", "nonce", @@ -2100,7 +2099,6 @@ "type", "sender_address", "compiled_class_hash", - "max_fee", "version", "signature", "nonce", @@ -2232,7 +2230,6 @@ } }, "required": [ - "max_fee", "version", "signature", "nonce", @@ -2453,7 +2450,6 @@ "type", "sender_address", "calldata", - "max_fee", "version", "signature", "nonce", @@ -2906,10 +2902,6 @@ "$ref": "#/components/schemas/FELT", "description": "The fee that was charged by the sequencer" }, - "type": { - "title": "Transaction type", - "$ref": "#/components/schemas/TXN_TYPE" - }, "messages_sent": { "type": "array", "title": "Messages sent", @@ -2952,7 +2944,6 @@ "required": [ "transaction_hash", "actual_fee", - "type", "messages_sent", "events", "finality_status", diff --git a/api/starknet_trace_api_openrpc.json b/api/starknet_trace_api_openrpc.json index aca0e06..8300171 100644 --- a/api/starknet_trace_api_openrpc.json +++ b/api/starknet_trace_api_openrpc.json @@ -400,7 +400,7 @@ "order": { "title": "order", "description": "the order of the event within the transaction", - "type": "number" + "type": "integer" } } }, @@ -420,7 +420,7 @@ "order": { "title": "order", "description": "the order of the message within the transaction", - "type": "number" + "type": "integer" } } }, From 04642cc29d38ed55c1a1c3c85dab2fc930c86d11 Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Wed, 1 Nov 2023 07:13:57 +0200 Subject: [PATCH 3/4] change version with to an enum and add query version --- api/starknet_api_openrpc.json | 57 +++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index cfc1efb..e30fa6a 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -1678,7 +1678,8 @@ "description": "Version of the transaction scheme", "type": "string", "enum": [ - "0x0" + "0x0", + "0x100000000000000000000000000000000" ] }, "signature": { @@ -1732,7 +1733,8 @@ "description": "Version of the transaction scheme", "type": "string", "enum": [ - "0x1" + "0x0", + "0x100000000000000000000000000000001" ] }, "signature": { @@ -1796,7 +1798,8 @@ "description": "Version of the transaction scheme", "type": "string", "enum": [ - "0x2" + "0x2", + "0x100000000000000000000000000000002" ] }, "signature": { @@ -1856,7 +1859,8 @@ "description": "Version of the transaction scheme", "type": "string", "enum": [ - "0x3" + "0x3", + "0x100000000000000000000000000000003" ] }, "signature": { @@ -1956,7 +1960,11 @@ "version": { "title": "Version", "description": "Version of the transaction scheme", - "$ref": "#/components/schemas/NUM_AS_HEX" + "type": "string", + "enum": [ + "0x1", + "0x100000000000000000000000000000001" + ] }, "signature": { "title": "Signature", @@ -2017,7 +2025,11 @@ "version": { "title": "Version", "description": "Version of the transaction scheme", - "$ref": "#/components/schemas/NUM_AS_HEX" + "type": "string", + "enum": [ + "0x2", + "0x100000000000000000000000000000002" + ] }, "signature": { "title": "Signature", @@ -2074,7 +2086,11 @@ "version": { "title": "Version", "description": "Version of the transaction scheme", - "$ref": "#/components/schemas/NUM_AS_HEX" + "type": "string", + "enum": [ + "0x3", + "0x100000000000000000000000000000003" + ] }, "signature": { "title": "Signature", @@ -2141,7 +2157,11 @@ "version": { "title": "Version", "description": "Version of the transaction scheme", - "$ref": "#/components/schemas/NUM_AS_HEX" + "type": "string", + "enum": [ + "0x1", + "0x100000000000000000000000000000001" + ] }, "signature": { "title": "Signature", @@ -2195,7 +2215,11 @@ "version": { "title": "Version", "description": "Version of the transaction scheme", - "$ref": "#/components/schemas/NUM_AS_HEX" + "type": "string", + "enum": [ + "0x3", + "0x100000000000000000000000000000003" + ] }, "signature": { "title": "Signature", @@ -2310,7 +2334,8 @@ "description": "Version of the transaction scheme", "type": "string", "enum": [ - "0x0" + "0x0", + "0x100000000000000000000000000000000" ] }, "signature": { @@ -2378,7 +2403,11 @@ "version": { "title": "Version", "description": "Version of the transaction scheme", - "$ref": "#/components/schemas/NUM_AS_HEX" + "type": "string", + "enum": [ + "0x1", + "0x100000000000000000000000000000001" + ] }, "signature": { "title": "Signature", @@ -2430,7 +2459,11 @@ "version": { "title": "Version", "description": "Version of the transaction scheme", - "$ref": "#/components/schemas/NUM_AS_HEX" + "type": "string", + "enum": [ + "0x3", + "0x100000000000000000000000000000003" + ] }, "signature": { "title": "Signature", From 83edf3ceeb5ade0b9878c21e55771b7c2c9ca935 Mon Sep 17 00:00:00 2001 From: Ariel Elperin Date: Wed, 1 Nov 2023 07:24:05 +0200 Subject: [PATCH 4/4] add fee unit to the receipt --- api/starknet_api_openrpc.json | 28 ++++++++++++++++++++++++++-- api/starknet_trace_api_openrpc.json | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/api/starknet_api_openrpc.json b/api/starknet_api_openrpc.json index e30fa6a..3659609 100644 --- a/api/starknet_api_openrpc.json +++ b/api/starknet_api_openrpc.json @@ -2559,7 +2559,7 @@ }, "actual_fee": { "title": "Actual fee", - "$ref": "#/components/schemas/FELT", + "$ref": "#/components/schemas/FEE_PAYMENT", "description": "The fee that was charged by the sequencer" }, "execution_status": { @@ -2932,7 +2932,7 @@ }, "actual_fee": { "title": "Actual fee", - "$ref": "#/components/schemas/FELT", + "$ref": "#/components/schemas/FEE_PAYMENT", "description": "The fee that was charged by the sequencer" }, "messages_sent": { @@ -3502,6 +3502,30 @@ "overall_fee" ] }, + "FEE_PAYMENT": { + "title": "Fee Payment", + "description": "fee payment info as it appears in receipts", + "type": "object", + "properties": { + "amount": { + "title": "Amunt", + "description": "amount paid", + "$ref": "#/components/schemas/FELT" + }, + "unit": { + "title": "fee unit", + "type": "string", + "enum": [ + "WEI", + "STRK" + ] + } + }, + "required": [ + "amount", + "unit" + ] + }, "DA_MODE": { "title": "DA mode", "type": "string", diff --git a/api/starknet_trace_api_openrpc.json b/api/starknet_trace_api_openrpc.json index 8300171..48193a0 100644 --- a/api/starknet_trace_api_openrpc.json +++ b/api/starknet_trace_api_openrpc.json @@ -482,7 +482,7 @@ }, "BLOCK_NOT_FOUND": { "code": 24, - "message": "Invalid block hash" + "message": "Block not found" }, "CONTRACT_ERROR": { "code": 40,