Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: get incoming messages #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

b0xtch
Copy link
Contributor

@b0xtch b0xtch commented Oct 18, 2022

No description provided.

@@ -19,6 +21,12 @@ fn get_messages() -> Vec<OutgoingMessagePair> {
STATE.with(|s| s.get_messages())
}

#[update(name = "get_incoming_messages", guard = "is_authorized")]
#[candid_method(update, rename = "get_incoming_messages")]
fn get_incoming_messages() -> HashMap<String, u32> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think defining pub type MessagesCount = u32 might increase code readability

Copy link
Contributor Author

@b0xtch b0xtch Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I agree, this return type is predicated on an existing structure that wasn't newly introduced. Another PR would best suit this change.

#[derive(CandidType, Deserialize)]
pub struct TerabetiaState {
    /// Incoming messages from L1
    pub messages: RefCell<HashMap<String, u32>>,
    
    ....
}

Copy link
Contributor

@fcavazzoli fcavazzoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants