The smart contract implements the simplest form of cross-contract calls: it calls the Hello NEAR example to get and set a greeting.
You can automatically compile and test the contract by running:
# To solely build the contract
npm run build
# To build and execute the contract's tests
npm run test
You can create a new account and deploy the contract by running:
near create-account <your-account.testnet> --useFaucet
near deploy <your-account.testnet> ./build/cross_contract.wasm init '{"hello_account":"hello.near-example.testnet"}'
To interact with the contract through the console, you can use the following commands
# Get message from the hello-near contract
# Replace <your-account.testnet> with your account ID
near call <your-account.testnet> query_greeting --accountId <your-account.testnet>
# Set a new message for the hello-near contract
# Replace <your-account.testnet> with your account ID
near call <your-account.testnet> change_greeting '{"new_greeting":"XCC Hi"}' --accountId <your-account.testnet>
- near CLI - Interact with NEAR blockchain from command line
- NEAR Documentation
- NEAR StackOverflow
- NEAR Discord
- NEAR Telegram Developers Community Group
- NEAR DevHub: Telegram, Twitter