Skip to content

This example performs the simplest cross-contract call possible: it calls our Hello NEAR example to set and retrieve a greeting. It is one of the simplest examples on making a cross-contract call, and the perfect gateway to the world of interoperative contracts.

License

Notifications You must be signed in to change notification settings

nearvndev/cross-contract-hello-js

Repository files navigation

📞 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.

About

This example performs the simplest cross-contract call possible: it calls our Hello NEAR example to set and retrieve a greeting. It is one of the simplest examples on making a cross-contract call, and the perfect gateway to the world of interoperative contracts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •