Skip to content

Commit

Permalink
refactor_declare
Browse files Browse the repository at this point in the history
  • Loading branch information
ArielElp committed Jul 18, 2023
1 parent bede0e3 commit bea0bd1
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 113 deletions.
136 changes: 93 additions & 43 deletions api/starknet_api_openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,34 +499,8 @@
"items": {
"oneOf": [
{
"type": "object",
"title": "declare v1 txn",
"properties": {
"transaction_hash": {
"title": "declare v1 txn properties",
"$ref": "#/components/schemas/DECLARE_TXN_V1"
},
"contract_class": {
"title": "Contract class",
"description": "The class to be declared",
"$ref": "#/components/schemas/DEPRECATED_CONTRACT_CLASS"
}
}
},
{
"type": "object",
"title": "declare v2 txn",
"properties": {
"transaction_hash": {
"title": "declare v2 txn properties",
"$ref": "#/components/schemas/DECLARE_TXN_V2"
},
"contract_class": {
"title": "Contract class",
"description": "The class to be declared",
"$ref": "#/components/schemas/CONTRACT_CLASS"
}
}
"title": "Invoke transaction",
"$ref": "#/components/schemas/DECLARE_TXN"
},
{
"title": "Invoke transaction",
Expand Down Expand Up @@ -1587,11 +1561,6 @@
"DECLARE"
]
},
"class_hash": {
"title": "Class hash",
"description": "The hash of the declared class",
"$ref": "#/components/schemas/FELT"
},
"sender_address": {
"title": "Sender address",
"description": "The address of the account contract sending the declaration transaction",
Expand All @@ -1618,36 +1587,117 @@
},
"required": [
"type",
"class_hash",
"sender_address",
"max_fee",
"version",
"signature",
"nonce"
]
},
{
"oneOf": [
{
"type": "object",
"title": "ContractClass",
"description": "The class to be declared. Expected to be included for all methods involving execution (estimateFee, simulateTransactions)",
"properties": {
"contract_class": {
"title": "Contract class",
"description": "The class to be declared",
"$ref": "#/components/schemas/DEPRECATED_CONTRACT_CLASS"
}
}
},
{
"type": "object",
"title": "ClassHash",
"description": "The hash of the declared class. Responses to getBlock and getTransaction are expected to include the hash rather than the full definition",
"properties": {
"class_hash": {
"title": "Class hash",
"description": "The hash of the declared class",
"$ref": "#/components/schemas/FELT"
}
}
}
]
}
]
},
"DECLARE_TXN_V2": {
"title": "Declare Transaction V2",
"description": "Declare Contract Transaction V2",
"allOf": [
{
"title": "Declare transaction V1",
"$ref": "#/components/schemas/DECLARE_TXN_V1"
},
{
"type": "object",
"title": "declare v2 additional fields",
"title": "Declare txn v2",
"properties": {
"compiled_class_hash": {
"title": "Compiled class hash",
"description": "The hash of the Cairo assembly resulting from the Sierra compilation",
"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"
},
"max_fee": {
"title": "Max fee",
"$ref": "#/components/schemas/FELT",
"description": "The maximal fee that can be charged for including the transaction"
},
"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"
}
},
"required": [
"compiled_class_hash"
"type",
"sender_address",
"max_fee",
"version",
"signature",
"nonce"
]
},
{
"oneOf": [
{
"type": "object",
"title": "ContractClass",
"description": "The class to be declared. Expected to be included for all methods involving execution (estimateFee, simulateTransactions)",
"properties": {
"contract_class": {
"title": "Contract class",
"description": "The class to be declared",
"$ref": "#/components/schemas/CONTRACT_CLASS"
}
}
},
{
"type": "object",
"title": "ClassHash",
"description": "The hash of the declared class. Responses to getBlock and getTransaction are expected to include the hash rather than the full definition",
"properties": {
"class_hash": {
"title": "Class hash",
"description": "The hash of the declared class",
"$ref": "#/components/schemas/FELT"
}
}
}
]
}
]
Expand Down
37 changes: 4 additions & 33 deletions api/starknet_trace_api_openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,34 +59,8 @@
"items": {
"oneOf": [
{
"type": "object",
"title": "Declare v1 txn",
"properties": {
"transaction_hash": {
"title": "declare v1 txn properties",
"$ref": "#/components/schemas/DECLARE_TXN_V1"
},
"contract_class": {
"title": "Contract class",
"description": "The class to be declared",
"$ref": "#/components/schemas/DEPRECATED_CONTRACT_CLASS"
}
}
},
{
"type": "object",
"title": "Declare v2 txn",
"properties": {
"transaction_hash": {
"title": "declare v2 txn properties",
"$ref": "#/components/schemas/DECLARE_TXN_V2"
},
"contract_class": {
"title": "Contract class",
"description": "The class to be declared",
"$ref": "#/components/schemas/CONTRACT_CLASS"
}
}
"title": "Invoke transaction",
"$ref": "#/components/schemas/DECLARE_TXN"
},
{
"title": "Invoke transaction",
Expand Down Expand Up @@ -375,11 +349,8 @@
"INVOKE_TXN": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/INVOKE_TXN"
},
"DECLARE_TXN_V1": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/DECLARE_TXN_V1"
},
"DECLARE_TXN_V2": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/DECLARE_TXN_V2"
"DECLARE_TXN": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/DECLARE_TXN"
},
"DEPLOY_ACCOUNT_TXN": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/DEPLOY_ACCOUNT_TXN"
Expand Down
41 changes: 4 additions & 37 deletions api/starknet_write_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,8 @@
"description": "Declare transaction required to declare a new class on Starknet",
"required": true,
"schema": {
"oneOf": [
{
"type": "object",
"title": "declare v1 txn",
"properties": {
"transaction_hash": {
"title": "declare v1 txn properties",
"$ref": "#/components/schemas/DECLARE_TXN_V1"
},
"contract_class": {
"title": "Contract class",
"description": "The class to be declared",
"$ref": "#/components/schemas/DEPRECATED_CONTRACT_CLASS"
}
}
},
{
"type": "object",
"title": "declare v2 txn",
"properties": {
"transaction_hash": {
"title": "declare v2 txn properties",
"$ref": "#/components/schemas/DECLARE_TXN_V2"
},
"contract_class": {
"title": "Contract class",
"description": "The class to be declared",
"$ref": "#/components/schemas/CONTRACT_CLASS"
}
}
}
]
"title": "Declare transaction",
"$ref": "#/components/schemas/DECLARE_TXN"
}
}
],
Expand Down Expand Up @@ -165,11 +135,8 @@
"INVOKE_TXN": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/INVOKE_TXN"
},
"DECLARE_TXN_V1": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/DECLARE_TXN_V1"
},
"DECLARE_TXN_V2": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/DECLARE_TXN_V2"
"DECLARE_TXN": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/DECLARE_TXN"
},
"DEPLOY_ACCOUNT_TXN": {
"$ref": "./api/starknet_api_openrpc.json#/components/schemas/DEPLOY_ACCOUNT_TXN"
Expand Down

0 comments on commit bea0bd1

Please sign in to comment.