pub struct Message {
pub chain: Chain,
pub sender: Address,
pub signature: Signature,
pub content_source: ContentSource,
pub item_hash: ItemHash,
pub confirmations: Vec<MessageConfirmation>,
pub time: Timestamp,
pub channel: Option<Channel>,
pub message_type: MessageType,
pub content: MessageContent,
}Fields§
§chain: ChainBlockchain used for this message.
sender: AddressSender address.
signature: SignatureCryptographic signature of the message by the sender.
content_source: ContentSourceContent of the message as created by the sender. Can either be inline or stored on Aleph Cloud.
item_hash: ItemHashHash of the content (SHA2-256).
confirmations: Vec<MessageConfirmation>List of confirmations for the message.
time: TimestampUnix timestamp or datetime when the message was published.
channel: Option<Channel>Channel of the message, one application ideally has one channel.
message_type: MessageTypeMessage type. (aggregate, forget, instance, post, program, store).
content: MessageContentMessage content.
Implementations§
Source§impl Message
impl Message
pub fn content(&self) -> &MessageContentEnum
pub fn confirmed(&self) -> bool
Sourcepub fn sender(&self) -> &Address
pub fn sender(&self) -> &Address
Returns the address of the sender of the message. Note that the sender is not necessarily the owner of the resources, as the owner may have delegated their authority to create specific resources through the permission system.
Sourcepub fn sent_at(&self) -> &Timestamp
pub fn sent_at(&self) -> &Timestamp
Returns the time at which the message was sent. Notes:
- This value is signed by the sender and should not be trusted accordingly.
- We prefer
content.timeovertimeastimeis not part of the signed payload.
Sourcepub fn confirmed_at(&self) -> Option<&Timestamp>
pub fn confirmed_at(&self) -> Option<&Timestamp>
Returns the earliest confirmation time of the message.
Sourcepub fn verify_item_hash(&self) -> Result<(), MessageVerificationError>
pub fn verify_item_hash(&self) -> Result<(), MessageVerificationError>
Verifies that the item hash of an inline message matches its content.
For inline messages, the item hash is the SHA-256 hash of the item_content string.
For non-inline messages (storage/ipfs), use the client’s verify_message() method
instead, which downloads the raw content from /storage/raw/ for verification.
Sourcepub fn verify_signature(&self) -> Result<(), SignatureVerificationError>
pub fn verify_signature(&self) -> Result<(), SignatureVerificationError>
Verifies that the message signature was produced by the sender.
Constructs the verification buffer from the message fields, then dispatches to the chain-specific verification algorithm. Currently supports EVM-compatible chains (Ethereum, Arbitrum, etc.) and SVM chains (Solana, Eclipse).