post https://api.infstones.com/starknet/mainnet/
Submit a new class declaration transaction
Parameters
-
Mempool representation of a declare transaction
Declare v0 is no longer supported.
v1 used to declare Cairo 0 classes are deprecated and will be removed in a future Starknet version.
New Cairo 1.0 classes can only be declared via the declare v2 transaction.
Key | Required | Type | Detail |
---|---|---|---|
contract_class | โ | ContractClass | The (Cairo 1.0) class |
compiled_class_hash | โ | String | The hash of the compiled class |
sender_address | โ | String | Address the transaction is sent from |
max_fee | โ | String | The maximum fee that the sender is willing to pay for the transaction |
nonce | โ | String | The transaction nonce |
version | โ | String | The transactionโs version. The value is 1 |
signature | โ | List<String> | Additional information given by the sender, used to validate the transaction |
"params": [
{
"max_fee": "string",
"version": "string",
"signature": [
"string"
],
"nonce": "string",
"type": "DECLARE",
"contract_class": {
"sierraProgram": [
"string"
],
"contractClassVersion": "string",
"entryPointsByType": {
"CONSTRUCTOR": [
{
"selector": "string",
"functionIdx": 0
}
],
"EXTERNAL": [
{
"selector": "string",
"functionIdx": 0
}
],
"L1_HANDLER": [
{
"selector": "string",
"functionIdx": 0
}
]
},
"abi": "string"
},
"sender_address": "0x044e5b3f0471a26bc749ffa1d8dd8e43640e05f1b33cf05cef6adee6f5b1b4cf",
"compiled_class_hash": "string"
}
]
Result
The transaction hash, as assigned in StarkNet.
The class hash, represented by at most 63 hex digits.
Example
Request
curl <your-endpoint> \
-X POST \
-H "Content-Type: application/json" \
-d '
{
"id": 1,
"jsonrpc": "2.0",
"method": "starknet_addDeclareTransaction",
"params": [
{
"max_fee": "string",
"version": "string",
"signature": [
"string"
],
"nonce": "string",
"type": "DECLARE",
"contract_class": {
"sierraProgram": [
"string"
],
"contractClassVersion": "string",
"entryPointsByType": {
"CONSTRUCTOR": [
{
"selector": "string",
"functionIdx": 0
}
],
"EXTERNAL": [
{
"selector": "string",
"functionIdx": 0
}
],
"L1_HANDLER": [
{
"selector": "string",
"functionIdx": 0
}
]
},
"abi": "string"
},
"sender_address": "0x044e5b3f0471a26bc749ffa1d8dd8e43640e05f1b33cf05cef6adee6f5b1b4cf",
"compiled_class_hash": "string"
}
]
}
'
Return
{
"jsonrpc": "2.0",
"result": {
"transaction_hash": "0x3cf80e627fc2c2512fbf84133af6e3542e739206efb26067f56bbffc1f76f23",
"class_hash": "0x601407cf04ab1fbab155f913db64891dc749f4343bc9e535bd012234a46dc61"
},
"id": 1
}