4/21 Rust SDK tools community update #797
Replies: 3 comments 3 replies
-
We can build an entire social media platform with that ACI feature. Looking forward to the new release! |
Beta Was this translation helpful? Give feedback.
-
Also, any possibility of ACI to display the hash value of the contract's wasm file? That way we can make sure that the contract we are interacting with in the blockchain is the same as the one we want. |
Beta Was this translation helpful? Give feedback.
-
Regarding ACI, it looks like it requires a derive macro |
Beta Was this translation helpful? Give feedback.
-
4.0
near-sdk-rs
changesCollections updates
4.0.0-pre.8
), using theunstable
feature flag on the SDKlegacy
feature flagCore differences from
near_sdk::collections
std::collections
UnorderedMap
,TreeMap
,UnorderedSet
and non-state breaking optimizations for othersAvoids manual patterns such as manually moving values, modifying, and re-inserting back into data structures:
Can now be replaced with:
Known downsides
near-contract-standards
are still currently usingnear_sdk::collections
UnorderedMap
,TreeMap
,UnorderedSet
)Function call error handling
Avoid unwrapping and panic patterns in favor of cleaner error handling:
This desugars to calling
env::panic_str
on error or serializing and returningOk
value.#[handle_result]
annotation will only be temporarily required for version4.0
to avoid breaking changes for people usingResult
types as function returns. The annotation will not be needed in5.0
when that comes.Callback result error handling
Avoid having to manually check the success of promises by using
Result
types with#[callback_result]
annotation:Validated
AccountId
by defaultPreviously was
AccountId
, which was an alias toString
, andValidAccountId
was a wrapper around this for validation. Now there is just one type.If you want to skip the validation, you can use
AccountId::new_unchecked
.Removed need for
near_sdk::setup_alloc!()
It is now initialized by default. Disable the
wee_alloc
feature on the SDK to remove.Cleaner low-level syscall interface
Removed need to go through
BLOCKCHAIN_INTERFACE
:is now:
NEP264
protocol change and proposed APINEP264 allows for utilizing unspent gas for future async cross-contract calls. This enables gas to be used more efficiently but also enables a much cleaner API design.
This PR enables avoiding having to provide a static amount of gas to fund transactions with, based on the motivation from the API proposal issue.
The benefits to this are more optimized cross-contract calls, more concise and intuitive code, and less error-prone cross-contract execution.
4.0.0 stable release plan
NEP264
implementation was just released totestnet
.near-sdk
version4.0.0
stable will be released once this update gets released on mainnet, as the above API change relies on the newpromise_batch_action_function_call_weight
host function on the NEAR runtime.Tracking issue here
ACI (Application Contract Interface)
Name not final but roughly equivalent to Solidity ABI. Intended to be a generated, human-readable schema to be able to identify a contract's API to be able to interact with it externally or from another contract more easily.
Schema format
Early stages of iterating through possible designs. Will publish a document once this stabilizes to get input.
Example schema (not final)
Schema generation from SDK(s)
Currently, work on a PoC is done by @itegulov on a branch, but updates will be shared once this is ready to be used generally.
Client generation from ACI schema
The benefit to this is to connect all interfaces of a full-stack dapp at compile time to increase developer velocity, reduce bugs, and unlock new possibilities.
Beta Was this translation helpful? Give feedback.
All reactions