교차 컨트랙트 호출
Your contract can interact with other deployed contracts, querying information and executing functions on them.
Since NEAR is a sharded blockchain, its cross-contract calls behave differently than calls do in other chains. In NEAR. cross-contract calls are asynchronous and independent.
You will need two independent functions: one to make the call, and another to receive the result
There is a delay between the call and the callback execution, usually of 1 or 2 blocks. During this time, the contract is still active and can receive other calls.
스니펫: 정보 조회
While making your contract, it is likely that you will want to query information from another contract. Below, you can see a basic example in which we query the greeting message from our Hello NEAR example.
- 🌐 Javascript
- 🦀 Rust
Loading...
- lib.rs
- external.rs
Loading...
Loading...
Snippet: Sending Information
Calling another contract passing information is also a common scenario. Below you can see a function that interacts with the Hello NEAR example to change its greeting message.
- 🌐 Javascript
- 🦀 Rust
Loading...