Accessing the Ledger
Learn how you can directly access the Stellar ledger from a Zephyr program.
Reading contract data entries
/// Returns the instance object of a certain contract from
/// the host's ledger.
pub fn read_contract_instance(&self, contract: [u8; 32]) -> Result<Option<ContractDataEntry>, SdkError> {}
/// Returns the requested entry object of a certain contract
/// from the host's ledger.
pub fn read_contract_entry_by_key(&self, contract: [u8; 32], key: ScVal) -> Result<Option<ContractDataEntry>, SdkError> {}
/// Returns all the entry objects of a certain contract
/// from the host's ledger.
pub fn read_contract_entries(&self, contract: [u8; 32]) -> Result<Vec<ContractDataEntry>, SdkError> {}
/// Returns all the entry objects of a certain contract from the host's
/// ledger. This function returns an iterator over Soroban host objects,
/// and should be used along with the Soroban SDK. Use this function
/// where you prefer to work with host objects rather than ScVals.
pub fn read_contract_entries_to_env(&self, env: &soroban_sdk::Env, contract: [u8; 32]) -> Result<Map<Val, Val>, SdkError> {}Understanding return types
Examples
read_contract_entries()
read_contract_entries()read_contract_instance
read_contract_instanceread_contract_entry_by_key()
read_contract_entry_by_key()Last updated