Skip to content

Commit

Permalink
fix: make event emit public (#975)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwpz authored Nov 25, 2022
1 parent b8fc608 commit 2d512eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion near-sdk-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ pub fn derive_event_attributes(item: TokenStream) -> TokenStream {

TokenStream::from(quote! {
impl #impl_generics #name #type_generics #where_clause {
fn emit(&self) {
pub fn emit(&self) {
let (standard, version): (String, String) = match self {
#(#event_meta),*
};
Expand Down
14 changes: 9 additions & 5 deletions near-sdk/tests/event_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ where
LifetimeTestB(&'b str),
}

#[near_bindgen(event_json(standard = "another_standard"))]
pub enum AnotherEvent {
#[event_version("1.0.0")]
Test,
mod private {
use super::*;

#[near_bindgen(event_json(standard = "another_standard"))]
pub enum AnotherEvent {
#[event_version("1.0.0")]
Test,
}
}

#[test]
Expand All @@ -45,7 +49,7 @@ fn test_json_emit() {

TestEvents::LifetimeTestB::<String>("lifetime_b").emit();

AnotherEvent::Test.emit();
private::AnotherEvent::Test.emit();

let logs = get_logs();

Expand Down

0 comments on commit 2d512eb

Please sign in to comment.