Skip to content

Releases: near/near-sdk-rs

near-sdk-macros-v5.2.1

05 Jul 13:32
5c9eaea
Compare
Choose a tag to compare
chore: Release package near-sdk-macros version 5.2.1

near-contract-standards-v5.2.1

05 Jul 13:32
5c9eaea
Compare
Choose a tag to compare

Added

  • Exported ext_storage_management Promise shortcuts, so Storage Management interfaces can be used in contracts to call external contracts using the high-level cross-contract call interfaces (#1208)
  • Exported ext_nft_* Promise shortcuts, so NFT interfaces can be re-used in contracts to call external NFT contracts using the high-level cross-contract call interfaces (#1206)

near-sys-v0.2.2

04 Jul 22:08
Compare
Choose a tag to compare

Other

  • add yield execution host functions (#1183)

near-sdk-v5.2.0

04 Jul 22:09
Compare
Choose a tag to compare

Added

  • New yield execution host functions (#1183), learn more in this blog post
  • New near_sdk::store::IterableMap and near_sdk::store::IterableSet that address the iteration performance issue of store::UnorderedMap (#1164) (#1175)
  • Added BorshSchema trait impl to all near_sdk::store collections!
    • store::TreeMap<K, V, H> and UnorderedSet<T, H> (#1213)
    • store::IterableSet and store::IterableMap and refactored and added ABI defiintions tests (#1212)
    • store::UnorderedMap (#1209)
  • NEP-330 1.2.0 support - added build info field in contract metadata (#1178)

Fixed

  • [technically breaking] Make log macro fully compatible with std::format (string interpolation is now supported) (#1189)
  • use FQDNs when calling contract methods to avoid method names collision (#1186)

Other

  • Added performance tests for 'store' collections (#1195)
  • Full tests coverage for store::Vector + coverage for all the collections relevant to IterableMap implementation (#1173)
  • Full tests coverage for store collections (#1172)
  • Documented #[init], #[payable], #[handle_result], #[private], #[result_serializer] attributes for docs.rs discoverability (#1185)
  • Enabled unit-testing feature for docs.rs
  • Replaced manual borsh trait impl-s with derives and correct bounds in near_sdk::store and near_sdk::collections (#1176)
  • Proxy JsonSchema::schema_name to the original implementation (#1210)
  • Fixed Rust 1.79 linter warnings (#1202)
  • Fixed Rust 1.78 linter warnings (#1181)
  • Updated near-* dependencies to 0.23 version (#1207)

near-sdk-macros-v5.2.0

04 Jul 22:08
Compare
Choose a tag to compare
chore: Release package near-sdk-macros version 5.2.0

near-contract-standards-v5.2.0

04 Jul 22:09
Compare
Choose a tag to compare

Added

  • Exported ext_storage_management Promise shortcuts, so Storage Management interfaces can be used in contracts to call external contracts using the high-level cross-contract call interfaces (#1208)
  • Exported ext_nft_* Promise shortcuts, so NFT interfaces can be re-used in contracts to call external NFT contracts using the high-level cross-contract call interfaces (#1206)

near-sdk-v5.1.0

28 Mar 19:21
9aa5eb0
Compare
Choose a tag to compare

Hightlights

Reduce your boilerpate and enable ABI support out of the box with the new #[near] macro-attribute.

BEFORE (still valid, not breaking changes or deprecation in this release): AFTER
use near_sdk::serde::{Deserialize, Serialize}
use near_sdk::borsh::{BorshDeserialize, BorshSerialize};
use near_sdk::schemars::JsonSchema;

#[derive(Deserialize, Serialize, JsonSchema, BorshDeserlialize, BorshSerialize)]
#[serde(crate = "near_sdk::serde")]
#[schemars(crate = "near_sdk::schemars")]
#[borsh(crate = "near_sdk::borsh")]
struct ...
use near_sdk::near;

#[near(serializers = [borsh, json])]
struct ...
use near_sdk::{near_bindgen, env};

#[near_bindgen]
#[derive(Default, BorshDeserialize, BorshSerialize)]
#[borsh(crate = "near_sdk::borsh")]
pub struct StatusMessage {
    records: HashMap<AccountId, String>,
}

#[near]
impl StatusMessage { ... }
use near_sdk::{near, env};

#[near(contract_state)]
#[derive(Default)]
pub struct StatusMessage {
    records: HashMap<AccountId, String>,
}

#[near]
impl StatusMessage { ... }

If you want to have an example, look no further, DevHub Contract is already migrated

Added

  • Finalize #[near] attribute-macro implementation with the support for custom parameters passing to serializer attributes #[near(serializers = [borsh(...)])] (#1158)
  • Introduce #[near] macro to further streamline contracts development reducing the boilerplate! (#1142)

Other

  • add typo checker in ci (#1159)

near-sdk-macros-v5.1.0

28 Mar 19:21
9aa5eb0
Compare
Choose a tag to compare
chore: Release package near-sdk-macros version 5.1.0

near-contract-standards-v5.1.0

28 Mar 19:22
9aa5eb0
Compare
Choose a tag to compare

Added

  • Finalize #[near] attribute-macro implementation with the support for custom parameters passing to serializer attributes #[near(serializers = [borsh(...)])] (#1158)
  • Introduce #[near] macro to further streamline contracts development reducing the boilerplate! (#1142)

near-sdk-v5.0.0

23 Feb 00:56
9bb16c2
Compare
Choose a tag to compare

Highlights

This release mostly maintains backwards compatibility with the previous version, but it also includes several breaking changes that improve developer experience and bring security and performance fixes. The most notable changes are:

  • Contract source metadata (NEP-330) is now implemented by default for all the contracts out of the box, which means that you can call contract_source_metadata() function and receive { version?: string, link?: string, standards?: { standard: string, version: string }[] } (#1106)
  • Type-safe NEAR balance, gas amounts, and account ids were implemented:
  • Update borsh to 1.0.0 (#1075)
    • You will have to be explicit about the borsh re-export with #[borsh(crate = "near_sdk::borsh")], see the example in the README
  • New host functions exposed:
  • Slimmed down the dependencies by default, most notably, you may still need to explicitly enable legacy feature for near_sdk::collections and unit-testing feature for near_sdk::testing_env and near_sdk::mock (#1149)
  • Updated nearcore crates from 0.17 -> 0.20, but contracts rarely use these directly so no breaking changes are expected (#1130)
  • Support Result types in #[handle_result] regardless of how they're referred to (#1099)
  • Self is now prohibited in non-init methods to prevent common footguns (#1073)
  • Require explicit Unlimited or Limited when specifying allowances to prevent 0 to be silently treated as unlimited allowance (#976)
  • Performance improvement to TreeMap.range (#964)
  • Deprecated near_sdk::store::UnorderedMap and near_sdk::store::UnorderedSet due to not meeting the original requirements (iteration over a collection of more than 2k elements runs out of gas) (#1139)
  • Deprecated near_sdk::collections::LegacyTreeMap (#963)

The best way to develop NEAR contracts in Rust is by using cargo-near CLI.
It provides a convenient way to create, build, test, and deploy contracts!

Get your fully configured development environment in under 1 minute using GitHub CodeSpaces configured for NEAR!