Skip to main content

oil_chat_api/state/
user_chat_config.rs

1use serde::{Deserialize, Serialize};
2use steel::*;
3use crate::state::user_chat_config_pda;
4use super::ChatAccount;
5
6#[repr(C)]
7#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
8pub struct UserChatConfig {
9    pub authority: Pubkey, // 32 bytes - User's wallet public key
10    pub next_message_id: u64, // 8 bytes - Per-user message counter
11}
12
13impl UserChatConfig {
14    pub fn pda(&self) -> (Pubkey, u8) {
15        user_chat_config_pda(self.authority)
16    }
17}
18
19account!(ChatAccount, UserChatConfig);