Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 1.92 KB

File metadata and controls

57 lines (40 loc) · 1.92 KB

📞 Cross-Contract Hello

The smart contract implements the simplest form of cross-contract calls: it calls the Hello NEAR example to get and set a greeting.

What This Example Shows

  1. How to query information from an external contract.
  2. How to interact with an external contract.

Quickstart

Clone this repository locally or open it in gitpod. Then follow these steps:

1. Install Dependencies

npm install

2. Test the Contract

Deploy your contract in a sandbox and simulate interactions from users.

npm test

3. Deploy the Contract

Build the contract and deploy it in a testnet account

npm run deploy

4. Interact With the Contract

Ask the contract to perform a cross-contract call to query or change the greeting in Hello NEAR.

# Use near-cli to ask the contract to query te greeting
near call <dev-account> query_greeting --accountId <dev-account>

# Use near-cli to set increment the counter
near call <dev-account> change_greeting '{"new_greeting":"XCC Hi"}' --accountId <dev-account>

Learn More

  1. Learn more about the contract through its README.
  2. Check our documentation.