From a859a6fcd2de7148305c15dcd99caade2d51d3f4 Mon Sep 17 00:00:00 2001 From: garikbesson Date: Mon, 11 Mar 2024 22:41:27 +0100 Subject: [PATCH] updated xcc, advanced-xcc guides --- docs/3.tutorials/examples/advanced-xcc.md | 102 +++++++++++++--------- docs/3.tutorials/examples/xcc.md | 38 +++++--- 2 files changed, 85 insertions(+), 55 deletions(-) diff --git a/docs/3.tutorials/examples/advanced-xcc.md b/docs/3.tutorials/examples/advanced-xcc.md index 18af1276e96..c588c81720b 100644 --- a/docs/3.tutorials/examples/advanced-xcc.md +++ b/docs/3.tutorials/examples/advanced-xcc.md @@ -21,14 +21,17 @@ they **all get reverted**. - - + + @@ -38,17 +41,20 @@ action** from the chain. - - - + + + @@ -61,14 +67,17 @@ all in parallel. If one of them fails the rest **ARE NOT REVERTED**. - - + + @@ -78,17 +87,20 @@ value returned by each call, or an error message. - + - - + + + @@ -103,14 +115,17 @@ In this case, we call multiple contracts that will return the same type: - + - + + @@ -120,16 +135,19 @@ results. - + - - + + + \ No newline at end of file diff --git a/docs/3.tutorials/examples/xcc.md b/docs/3.tutorials/examples/xcc.md index e544f267e63..f29d4efe5ca 100644 --- a/docs/3.tutorials/examples/xcc.md +++ b/docs/3.tutorials/examples/xcc.md @@ -25,7 +25,7 @@ You have two options to start using the project. The first and recommended is to | Gitpod | Clone locally | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- | - | Open in Gitpod | 🌐 `https://github.com/near-examples/cross-contract-hello-js.git` | + | Open in Gitpod | 🌐 `https://github.com/near-examples/cross-contract-calls.git` | @@ -33,7 +33,7 @@ You have two options to start using the project. The first and recommended is to | Gitpod | Clone locally | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- | - | Open in Gitpod | 🦀 `https://github.com/near-examples/cross-contract-hello-rust.git` | + | Open in Gitpod | 🦀 `https://github.com/near-examples/cross-contract-calls.git` | @@ -47,17 +47,24 @@ Since this example does not have a frontend, we will interact with it through th Check the README.md. Briefly, you will need to: -#### 1. Build and Deploy the Contract -You can automatically compile and deploy the contract in the NEAR testnet by running: +#### 1. Create a new account + +In order to deploy the contract you will need to [create a NEAR account](https://docs.near.org/develop/contracts/quickstart#create-a-testnet-account). ```bash -./contract/deploy.sh +# Create an account +near create-account --useFaucet ``` -Once finished, check the `neardev/dev-account` file to find the address in which the contract was deployed: +#### 2. Build and Deploy the Contract +You can automatically compile and deploy the contract in the NEAR testnet by running: ```bash -cat ./contract/neardev/dev-account # e.g. dev-1659899566943-21539992274727 +# Build the contract +cargo near build + +# Deploy the contract +cargo near deploy ``` #### 2. Get the Greeting @@ -68,7 +75,7 @@ cat ./contract/neardev/dev-account # e.g. dev-1659899566943-21539992274727 ```bash # Use near-cli to ask the contract to query the greeting -near call query_greeting --accountId +near call query_greeting --accountId ``` --- @@ -80,12 +87,12 @@ The contract exposes methods to query the greeting and change it. These methods @@ -110,14 +117,19 @@ method works. This is because unit tests are **cannot test** cross-contract call In this project in particular, the integration tests first deploy the `hello-near` contract. Then, they test that the cross-contract call correctly sets and retrieves the message. You will find the integration tests -in `integration-tests/`. +in `sandbox-ts/` for the JavaScript version and in `tests/` for the Rust version. - + + + ---