state_change

To Share and +4 nLEARNs

import Tabs from ‘@theme/Tabs’;
import TabItem from ‘@theme/TabItem’;

StateChange Structure

Definition

This entitiy from nearcore describes how account’s state has changed and the reason

StateChangeWithCauseView


“`rust links=1
pub struct StateChangeWithCauseView {
pub cause: StateChangeCauseView,
#[serde(flatten)]
pub value: StateChangeValueView,
}

pub enum StateChangeCauseView {
NotWritableToDisk,
InitialState,
TransactionProcessing { tx_hash: CryptoHash },
ActionReceiptProcessingStarted { receipt_hash: CryptoHash },
ActionReceiptGasReward { receipt_hash: CryptoHash },
ReceiptProcessing { receipt_hash: CryptoHash },
PostponedReceipt { receipt_hash: CryptoHash },
UpdatedDelayedReceipts,
ValidatorAccountsUpdate,
Migration,
Resharding,
}

pub enum StateChangeValueView {
AccountUpdate {
account_id: AccountId,
#[serde(flatten)]
account: AccountView,
},
AccountDeletion {
account_id: AccountId,
},
AccessKeyUpdate {
account_id: AccountId,
public_key: PublicKey,
access_key: AccessKeyView,
},
AccessKeyDeletion {
account_id: AccountId,
public_key: PublicKey,
},
DataUpdate {
account_id: AccountId,
#[serde(rename = “key_base64”, with = “base64_format”)]
key: StoreKey,
#[serde(rename = “value_base64”, with = “base64_format”)]
value: StoreValue,
},
DataDeletion {
account_id: AccountId,
#[serde(rename = “key_base64”, with = “base64_format”)]
key: StoreKey,
},
ContractCodeUpdate {
account_id: AccountId,
#[serde(rename = “code_base64”, with = “base64_format”)]
code: Vec,
},
ContractCodeDeletion {
account_id: AccountId,
},
}
“`

“`ts links=1
export type StateChange = {
cause: {
receiptHash: string;
type: string;
};
change: {
accountId: string;
keyBase64: string;
valueBase64: string;
},
type: string;
};
“`


Generate comment with AI 2 nL
Scroll to Top
Report a bug👀