Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make external calls more clear for rust #2319

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion docs/2.build/2.smart-contracts/anatomy/crosscontract.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ While making your contract, it is likely that you will want to query information
<Github fname="lib.rs"
url="https://github.com/near-examples/cross-contract-calls/blob/main/contract-simple-rs/src/lib.rs"
start="22" end="51" />
<Github fname="external.rs"

</Language>

</CodeTabs>

Note that in order for that to work in Rust, you have to implement the interface of the contract you call:

<CodeTabs>
<Language value="rust" language="rust">
<Github fname="external.rs"
url="https://github.com/near-examples/cross-contract-calls/blob/main/contract-simple-rs/src/external.rs"
start="2" end="12" />

Expand All @@ -66,6 +75,13 @@ Calling another contract passing information is also a common scenario. Below yo
<Github fname="lib.rs"
url="https://github.com/near-examples/cross-contract-calls/blob/main/contract-simple-rs/src/lib.rs"
start="53" end="80" />

</Language>

</CodeTabs>

<CodeTabs>
<Language value="rust" language="rust">
<Github fname="external.rs"
url="https://github.com/near-examples/cross-contract-calls/blob/main/contract-simple-rs/src/external.rs"
start="2" end="12" />
Expand Down