This contract presents 3 examples on how to do complex cross-contract calls. Particularly, it shows:
- How to batch method calls to a same contract.
- How to call multiple contracts in parallel, each returning a different type.
- Different ways of handling the responses in the callback.
Install cargo-near
and run:
cargo near build
cargo test
To deploy manually, install cargo-near
and run:
# Create a new account
cargo near create-dev-account
# Deploy the contract on it
cargo near deploy <account-id>
To interact with the contract through the console, you can use the following commands
# Replace <your-account.testnet> with your account ID
# Call batch_actions method
near call <your-account.testnet> batch_actions --gas 300000000000000 --accountId <your-account.testnet>
# Call multiple_contracts method
near call <your-account.testnet> multiple_contracts --gas 300000000000000 --accountId <your-account.testnet>
# Call similar_contracts method
near call <your-account.testnet> similar_contracts --gas 300000000000000 --accountId <your-account.testnet>
- cargo-near - NEAR smart contract development toolkit for Rust
- near CLI - Interact with NEAR blockchain from command line
- NEAR Rust SDK Documentation
- NEAR Documentation
- NEAR StackOverflow
- NEAR Discord
- NEAR Telegram Developers Community Group
- NEAR DevHub: Telegram, Twitter