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

fix: private annotation codegen to include near_sdk prefix #491

Merged
merged 6 commits into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ This is equivalent to:
#[near_bindgen]
impl Contract {
pub fn resolve_transfer(&mut self) {
if env::current_account_id() != env::predecessor_account_id() {
if near_sdk::env::current_account_id() != near_sdk::env::predecessor_account_id() {
near_sdk::env::panic(b"Method resolve_transfer is private");
}
env::log_str("This is a callback");
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pub fn my_method(&mut self) {
/// Which is equivalent to

pub fn my_method(&mut self ) {
if env::current_account_id() != env::predecessor_account_id() {
if near_sdk::env::current_account_id() != near_sdk::env::predecessor_account_id() {
near_sdk::env::panic("Method method is private".as_bytes());
}
...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl ImplItemMethodInfo {
let is_private_check = if *is_private {
let error = format!("Method {} is private", ident.to_string());
quote! {
if env::current_account_id() != env::predecessor_account_id() {
if near_sdk::env::current_account_id() != near_sdk::env::predecessor_account_id() {
near_sdk::env::panic(#error.as_bytes());
}
}
Expand Down
10 changes: 5 additions & 5 deletions near-sdk-macros/src/core_impl/code_generator/item_impl_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ mod tests {
#[no_mangle]
pub extern "C" fn method() {
near_sdk::env::setup_panic_hook();
if env::current_account_id() != env::predecessor_account_id() {
if near_sdk::env::current_account_id() != near_sdk::env::predecessor_account_id() {
near_sdk::env::panic("Method method is private".as_bytes());
}
#[derive(near_sdk :: serde :: Deserialize)]
Expand Down Expand Up @@ -333,7 +333,7 @@ mod tests {
#[no_mangle]
pub extern "C" fn method() {
near_sdk::env::setup_panic_hook();
if env::current_account_id() != env::predecessor_account_id() {
if near_sdk::env::current_account_id() != near_sdk::env::predecessor_account_id() {
near_sdk::env::panic("Method method is private".as_bytes());
}
let data: Vec<u8> = match near_sdk::env::promise_result(0u64) {
Expand Down Expand Up @@ -369,7 +369,7 @@ mod tests {
#[no_mangle]
pub extern "C" fn method() {
near_sdk::env::setup_panic_hook();
if env::current_account_id() != env::predecessor_account_id() {
if near_sdk::env::current_account_id() != near_sdk::env::predecessor_account_id() {
near_sdk::env::panic("Method method is private".as_bytes());
}
#[derive(near_sdk :: serde :: Deserialize)]
Expand Down Expand Up @@ -550,7 +550,7 @@ mod tests {
#[no_mangle]
pub extern "C" fn method() {
near_sdk::env::setup_panic_hook();
if env::current_account_id() != env::predecessor_account_id() {
if near_sdk::env::current_account_id() != near_sdk::env::predecessor_account_id() {
near_sdk::env::panic("Method method is private".as_bytes());
}
#[derive(near_sdk :: borsh :: BorshDeserialize)]
Expand Down Expand Up @@ -610,7 +610,7 @@ mod tests {
#[no_mangle]
pub extern "C" fn private_method() {
near_sdk::env::setup_panic_hook();
if env::current_account_id() != env::predecessor_account_id() {
if near_sdk::env::current_account_id() != near_sdk::env::predecessor_account_id() {
near_sdk::env::panic("Method private_method is private".as_bytes());
}
if near_sdk::env::attached_deposit() != 0 {
Expand Down