Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
akorchyn committed Jan 30, 2025
1 parent 98a8133 commit 48f01ce
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions near-sdk/src/environment/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub fn register_len(register_id: u64) -> Option<u64> {
/// use near_sdk::AccountId;
/// use std::str::FromStr;
///
/// assert_eq!(current_account_id(), "alice.near".parse().unwrap());
/// assert_eq!(current_account_id(), "alice.near".parse::<AccountId>().unwrap());
/// ```
pub fn current_account_id() -> AccountId {
assert_valid_account_id(method_into_register!(current_account_id))
Expand All @@ -174,7 +174,7 @@ pub fn current_account_id() -> AccountId {
/// use near_sdk::AccountId;
/// use std::str::FromStr;
///
/// assert_eq!(signer_account_id(), "bob.near".parse().unwrap());
/// assert_eq!(signer_account_id(), "bob.near".parse::<AccountId>().unwrap());
/// ```
pub fn signer_account_id() -> AccountId {
assert_valid_account_id(method_into_register!(signer_account_id))
Expand Down Expand Up @@ -203,7 +203,7 @@ pub fn signer_account_pk() -> PublicKey {
/// use near_sdk::AccountId;
/// use std::str::FromStr;
///
/// assert_eq!(predecessor_account_id(), "bob.near".parse().unwrap());
/// assert_eq!(predecessor_account_id(), "bob.near".parse::<AccountId>().unwrap());
/// ```
pub fn predecessor_account_id() -> AccountId {
assert_valid_account_id(method_into_register!(predecessor_account_id))
Expand Down Expand Up @@ -743,7 +743,7 @@ pub fn alt_bn128_pairing_check(value: &[u8]) -> bool {
/// use std::str::FromStr;
///
/// let promise = promise_create(
/// "counter.near".unwrap(),
/// "counter.near".parse::<AccountId>().unwrap(),
/// "increment",
/// serde_json::json!({
/// "value": 5
Expand Down
9 changes: 4 additions & 5 deletions near-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@
//! Below is an example of a simple counter contract that increments and retrieves a value:
//!
//! ```rust
//! use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize};
//! use near_sdk::{env, near_bindgen};
//! use near_sdk::{env, near};
//!
//! #[near_bindgen]
//! #[derive(Default, BorshDeserialize, BorshSerialize)]
//! #[near(contract_state)]
//! #[derive(Default)]
//! pub struct Counter {
//! value: i32,
//! }
//!
//! #[near_bindgen]
//! #[near]
//! impl Counter {
//! /// Increment the counter by one.
//! pub fn increment(&mut self) {
Expand Down
3 changes: 2 additions & 1 deletion near-sdk/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
//! place of a type [`Option<T>`](Option). Will only be loaded when interacted with and will
//! persist on [`Drop`].
//!
//! More information about collections can be found in [NEAR documentation](https://docs.near.org/build/smart-contracts/anatomy/collections)
//! * More information about collections can be found in [NEAR documentation](https://docs.near.org/build/smart-contracts/anatomy/collections)
//! * Benchmarking results of the NEAR-SDK store collections vs native collections can be found in [github](https://github.com/volodymyr-matselyukh/near-benchmarking)
mod lazy;
pub use lazy::Lazy;
Expand Down
4 changes: 2 additions & 2 deletions near-sdk/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ mod primitives;
pub use self::primitives::*;

pub use near_account_id::{AccountId, AccountIdRef};
/// Same as `NearGas` from crate [`near_gas`](near_gas)
/// A wrapper struct for `u64` that represents gas. And provides helpful methods to convert to and from tera-gas and giga-gas.
pub use near_gas::NearGas as Gas;
/// Same as `NearToken` from crate [`near_token`](near_token)
/// A wrapper struct for `u128` that represents tokens. And provides helpful methods to convert with a proper precision.
pub use near_token::NearToken;

mod error;
Expand Down
7 changes: 4 additions & 3 deletions near-sdk/src/types/vm_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ pub use near_vm_runner::logic::types::{PromiseResult as VmPromiseResult, ReturnD
/// Returned by [`promise_create`](crate::env::promise_create) and can be used to refer this promise in `promise_then`, `promise_batch_create`, and other functions.
/// Example:
/// ```no_run
/// use near_sdk::{env, Gas};
/// use near_sdk::{env, Gas, AccountId, NearToken};
/// use std::str::FromStr;
///
/// let promise_id = env::promise_create(
/// &AccountId::from_str("a.near").unwrap(), "new", b"{}", 0,
/// AccountId::from_str("a.near").unwrap(), "new", b"{}", NearToken::from_yoctonear(0),
/// Gas::from_tgas(1)
/// );
/// env::promise_then(
/// promise_id, &AccountId::from_str("b.near").unwrap(), "callback", b"{}", 0,
/// promise_id, AccountId::from_str("b.near").unwrap(), "callback", b"{}", NearToken::from_yoctonear(0),
/// Gas::from_tgas(1)
/// );
/// ```
Expand Down

0 comments on commit 48f01ce

Please sign in to comment.