|
| 1 | +pub use crate::v0_9_0::{ |
| 2 | + AddDeclareTransactionParams, AddDeployAccountTransactionParams, AddInvokeTransactionParams, |
| 3 | + AddInvokeTransactionResult, Address, BlockHash, BlockHashAndNumber, BlockHashAndNumberParams, BlockHashHelper, |
| 4 | + BlockHeader, BlockNumber, BlockNumberHelper, BlockNumberParams, BlockStatus, BlockTag, BlockWithReceipts, |
| 5 | + BlockWithTxHashes, BlockWithTxs, BroadcastedDeclareTxn, BroadcastedDeclareTxnV1, BroadcastedDeclareTxnV2, |
| 6 | + BroadcastedDeclareTxnV3, BroadcastedDeployAccountTxn, BroadcastedInvokeTxn, BroadcastedTxn, CallParams, |
| 7 | + ChainId, ChainIdParams, ClassAndTxnHash, CommonReceiptProperties, ContractAbi, ContractAbiEntry, |
| 8 | + ContractAndTxnHash, ContractClass, ContractLeavesDataItem, ContractStorageDiffItem, |
| 9 | + ContractsProof, DaMode, DataAvailability, DeclareTxn, DeclareTxnReceipt, DeclareTxnV0, DeclareTxnV1, |
| 10 | + DeclareTxnV2, DeclareTxnV3, DeployAccountTxn, DeployAccountTxnReceipt, DeployAccountTxnV1, DeployAccountTxnV3, |
| 11 | + DeployTxn, DeployTxnReceipt, DeployedContractItem, DeprecatedCairoEntryPoint, DeprecatedContractClass, |
| 12 | + DeprecatedEntryPointsByType, EntryPointsByType, EstimateFeeParams, EstimateMessageFeeParams, EthAddress, |
| 13 | + Event, EventAbiEntry, EventAbiType, EventContent, EventFilterWithPageRequest, EventsChunk, ExecutionResources, |
| 14 | + ExecutionStatus, FeeEstimate, FeeEstimateCommon, FeePayment, FunctionAbiEntry, FunctionAbiType, FunctionCall, FunctionStateMutability, |
| 15 | + GetBlockTransactionCountParams, GetBlockWithReceiptsParams, GetBlockWithTxHashesParams, GetBlockWithTxsParams, |
| 16 | + GetClassAtParams, GetClassHashAtParams, GetClassParams, GetEventsParams, GetNonceParams, GetStateUpdateParams, |
| 17 | + GetStorageAtParams, GetStorageProofResult, GetTransactionByBlockIdAndIndexParams, GetTransactionByHashParams, |
| 18 | + GetTransactionReceiptParams, GetTransactionStatusParams, GlobalRoots, InvokeTxn, InvokeTxnReceipt, |
| 19 | + InvokeTxnV0, InvokeTxnV1, InvokeTxnV3, KeyValuePair, L1DaMode, L1HandlerTxn, L1HandlerTxnReceipt, |
| 20 | + MaybeDeprecatedContractClass, MaybePreConfirmedBlockWithTxHashes, MaybePreConfirmedBlockWithTxs, |
| 21 | + MessageFeeEstimate, |
| 22 | + MerkleNode, MsgFromL1, MsgToL1, NewClasses, NodeHashToNodeMappingItem, NonceUpdate, PriceUnitFri, PriceUnitWei, |
| 23 | + PreConfirmedBlockHeader, PreConfirmedBlockWithReceipts, PreConfirmedBlockWithTxHashes, |
| 24 | + PreConfirmedBlockWithTxs, ReplacedClass, ResourceBounds, ResourceBoundsMapping, ResourcePrice, |
| 25 | + SierraEntryPoint, Signature, SimulationFlagForEstimateFee, SpecVersionParams, StateUpdate, StorageKey, |
| 26 | + StarknetGetBlockWithTxsAndReceiptsResult, StructAbiEntry, StructAbiType, StructMember, SyncStatus, |
| 27 | + SyncingParams, SyncingStatus, TransactionAndReceipt, Txn, TxnExecutionStatus, TxnFinalityAndExecutionStatus, |
| 28 | + TxnFinalityStatus, TxnHash, TxnReceipt, TxnReceiptWithBlockInfo, TxnStatus, TxnWithHash, TypedParameter, |
| 29 | +}; |
| 30 | +use serde::{Deserialize, Serialize}; |
| 31 | +use starknet_types_core::felt::Felt; |
| 32 | + |
| 33 | +/// RPC 0.10.0 Changes: |
| 34 | +/// 1. StateDiff: Added `migrated_compiled_classes` field |
| 35 | +/// 2. PreConfirmedStateUpdate: Removed `old_root` field |
| 36 | +/// 3. EmittedEvent: Added `transaction_index` and `event_index` fields |
| 37 | +/// 4. ContractStorageKeysItem: Changed `storage_keys` type from `Vec<Felt>` to `Vec<StorageKey>` |
| 38 | +
|
| 39 | +/// The change in state applied in this block, given as a mapping of addresses to the new values and/or new contracts |
| 40 | +#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] |
| 41 | +pub struct StateDiff { |
| 42 | + /// The declared class hash and compiled class hash |
| 43 | + pub declared_classes: Vec<NewClasses>, |
| 44 | + /// The deployed contracts |
| 45 | + pub deployed_contracts: Vec<DeployedContractItem>, |
| 46 | + /// The hash of the declared class |
| 47 | + pub deprecated_declared_classes: Vec<Felt>, |
| 48 | + /// The nonce updates |
| 49 | + pub nonces: Vec<NonceUpdate>, |
| 50 | + /// The replaced classes |
| 51 | + pub replaced_classes: Vec<ReplacedClass>, |
| 52 | + /// The storage diffs |
| 53 | + pub storage_diffs: Vec<ContractStorageDiffItem>, |
| 54 | + /// The migrated compiled classes (NEW in v0.10.0) |
| 55 | + pub migrated_compiled_classes: Vec<MigratedClassItem>, |
| 56 | +} |
| 57 | + |
| 58 | +/// A migrated class item representing a class that was migrated from Poseidon to BLAKE hash |
| 59 | +#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] |
| 60 | +pub struct MigratedClassItem { |
| 61 | + /// The hash of the declared class |
| 62 | + pub class_hash: Felt, |
| 63 | + /// The new BLAKE hash (post-SNIP-34) |
| 64 | + pub compiled_class_hash: Felt, |
| 65 | +} |
| 66 | + |
| 67 | +#[derive(Eq, Hash, PartialEq, Serialize, Deserialize, Clone, Debug)] |
| 68 | +#[serde(untagged)] |
| 69 | +pub enum MaybePreConfirmedStateUpdate { |
| 70 | + Block(StateUpdate), |
| 71 | + PreConfirmed(PreConfirmedStateUpdate), |
| 72 | +} |
| 73 | + |
| 74 | +/// Pre-confirmed state update (v0.10.0: removed `old_root` field) |
| 75 | +#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] |
| 76 | +pub struct PreConfirmedStateUpdate { |
| 77 | + /// The state diff |
| 78 | + pub state_diff: StateDiff, |
| 79 | +} |
| 80 | + |
| 81 | +/// An event emitted as part of a transaction (v0.10.0: added transaction_index and event_index) |
| 82 | +#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] |
| 83 | +pub struct EmittedEvent { |
| 84 | + /// The event information |
| 85 | + #[serde(flatten)] |
| 86 | + pub event: Event, |
| 87 | + /// The hash of the block in which the event was emitted |
| 88 | + #[serde(default)] |
| 89 | + pub block_hash: Option<BlockHash>, |
| 90 | + /// The number of the block in which the event was emitted |
| 91 | + #[serde(default)] |
| 92 | + pub block_number: Option<BlockNumber>, |
| 93 | + /// The transaction that emitted the event |
| 94 | + pub transaction_hash: TxnHash, |
| 95 | + /// The index of the transaction within the block |
| 96 | + pub transaction_index: u64, |
| 97 | + /// The index of the event within the transaction |
| 98 | + pub event_index: u64, |
| 99 | +} |
| 100 | + |
| 101 | +/// Contract storage keys item (v0.10.0: changed storage_keys type from Vec<Felt> to Vec<StorageKey>) |
| 102 | +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] |
| 103 | +pub struct ContractStorageKeysItem { |
| 104 | + /// The address of the contract |
| 105 | + pub contract_address: Felt, |
| 106 | + /// The storage keys (changed from Vec<Felt> to Vec<StorageKey> in v0.10.0) |
| 107 | + pub storage_keys: Vec<StorageKey>, |
| 108 | +} |
0 commit comments