near-sdk (Rust) 4.0.0-pre.1
Implements new LazyOption type under unstable feature. Similar to Lazy but is optional to set a value. PR 444.; Move type aliases and core types to near-sdk to avoid coupling. PR 415.
- A pre-release, not marked stable on GitHub.
- The newest stable release in the 4.0 line: near-sdk (Rust) 4.0.0
- Newest near-sdk (Rust): near-sdk (Rust) 5.30.0
- Implements new
LazyOptiontype underunstablefeature. Similar toLazybut is optional to set a value. PR 444. - Move type aliases and core types to near-sdk to avoid coupling. PR 415.
- Implements new
Lazytype under the newunstablefeature which is a lazily loaded storage value. PR 409. - fix(promise):
PromiseOrValuenow correctly setsshould_returnflag correctly on serialization. PR 407. - fix(tree_map): Correctly panic when range indices are exluded and
start > end. PR 392. - Implement
FromStrfor json types to allow calling.parse()to convert them. - expose
cur_blockandgenesis_configfromRuntimeStandaloneto configure simulation tests. PR 390. - fix(simulator): failing with long chains. PR 385.
- Make block time configurable to sim contract tests. PR 378.
- Deprecate
env::login favour ofenv::log_str. The logs assume that the bytes are utf8, so this will be a cleaner interface to use. PR 366. - Update syscall interface to no longer go through
BLOCKCHAIN_INTERFACE. Instead usesnear_sdk::syswhich is under theunstablefeature flag if needed. PR 417. - Set up global allocator by default for WASM architectures. PR 429.
- This removes the re-export of
wee_allocbecause if this feature is enabled, the allocator will already be set. - Deprecates
setup_alloc!macro as this will be set up by default, as long as thewee_allocfeature is not specifically disabled. In this case, the allocator can be overridden to a custom one or set manually if intended.
- This removes the re-export of
- Update
TreeMapiterator implementation to avoid unnecessary storage reads. PR 428. - Update
AccountIdto be a newtype with merged functionality fromValidAccountId- Removes
ValidAccountIdto avoid having multiple types for account IDs - This type will have
ValidAccountId's JSON (de)serialization and the borsh serialization will be equivalent to what it was previously
- Removes
- Initializes default for
BLOCKCHAIN_INTERFACEto avoid requiring to initialize testing environment for tests that don't require custom blockchain interface configuration- This default only affects outside of
wasm32environments and is optional/backwards compatible
- This default only affects outside of
- Deprecates
env::block_indexand replaces it withenv::block_heightfor more consistent naming - Updates internal NFT traits to not move the underlying type for methods
- This should not be a breaking change if using the
implmacros, only if implementing manually
- This should not be a breaking change if using the
- Makes
BLOCKCHAIN_INTERFACEa concrete type and no longer exports it.- If for testing you need this mocked blockchain,
near_sdk::mock::with_mocked_blockchaincan be used near_sdk::env::take_blockchain_interfaceis removed, as this interface is no longer optional- removes
BlockchainInterfacetrait, as this interface is only used in mocked contexts now
- If for testing you need this mocked blockchain,
- Updates
Gastype to be a newtype, which makes the API harder to misuse.- This also changes the JSON serialization of this type to a string, to avoid precision loss when deserializing in JavaScript
PublicKeynow utilizesBase58PublicKeyinstead ofVec<u8>directly PR 453. Usage ofBase58PublicKeyis deprecated- Expose
Receiptand respectiveVmActions in mocked contexts through replacing with a local interface and types.