Remix IDE Plugin Integration
This tutorial details how to deploy and run NEAR smart contract on Remix IDE. It is a no-setup tool with a GUI for developing NEAR smart contract.
Connect to Remix IDE
WELLDONE Code is the official Remix IDE Plug-in. Please visit the Remix IDE and follow the guide below.
Click Plugin Manager button in the left bar and search for CODE BY WELLDONE STUDIO and click the Activate button.
Select a Chain
Click on NEAR(NVM) in the list of chains.
If you click the
Documentation button, go to WELL DONE Docs, and if you find a problem or have any questions while using it, click the
Make an issue button to go to the Github Repository and feel free to create an issue.
Install a browser extension wallet
Other wallets will be supported soon, and WELLDONE Wallet can be used now.
After choosing a chain, click the
Connect to WELLDONE button to connect to the WELLDONE Wallet.
If you haven't installed the WELLDONE Wallet yet, please follow the following manual to install and create a wallet and create an account for the selected chain. Finally, go into the Setting tab of your wallet and activate Developer Mode.
And you must click the Refresh button in the upper right corner of the plug-in to apply changes to your wallet.
Create the Project
Select a Template
Create button. More templates may be found at NEAR Samples.
Automatically generate a contract structure based on the smart contract language you want to use. Select the language option, write a name for the project, and click the
Create button to create a contract structure that is appropriate for the language.
You can create your own contract projects without using the features above. However, for the remix plugin to build and deploy the contract, it must be built within the directory
near/. If you start a new project, the structure should look like the following.
1. Writing Contracts in Rust
2. Writing Contracts in TypeScript
Compile the Contract
Six compilation options are now available in WELLDONE Code:
We now only support the AMD compilation server, however, we will shortly add support for the ARM compilation server.
Step 1: Select the project you want to compile in the TARGET PROJECT section.
Step 2: Select a compilation option and click the
Step 3: When the compilation is complete, a wasm file is returned.
You can check the returned wasm file in
If you need to revise the contract and compile again, delete the
out directory and click the compile button.
1. Rust Compile
cargo build command to compile a smart contract written in Rust. Although it offers a stable compile, it is inconvenient to enter the method's parameters directly when executing the contract.
2. CARGO-NEAR Compile (for Rust) -
cargo near which is officially being developed by NEAR. If Compile is successful, an executable wasm binary file and a json file containing the ABI of the contract are created together. If you have deployed and imported a compiled contract using
cargo-near, you can find out the parameter type of the method, making it easier to run the contract.
However, because this feature is still under development, the
near-sdk-rs version must be specified at 4.1.0 or higher in the
Cargo.toml file, and unexpected issues may occur during compilation. Please check out the NEAR's repository for more detail.
3. EMBED-ABI Compile (for Rust) -
-embed-abi option in
cargo-near, generates a wasm file containing ABI inside. For contracts that have deployed the wasm file compiling with this option, you can get ABI information even when importing the contract through
At Address button. See the cargo-near repository for a detailed description of the options.
Deploy the Contract
The WELLDONE Wallet automatically finds and imports networks associated with your wallet address. As a result, before deploying, you should choose whether you want to send a transaction to mainnet or testnet.
Step 1: If you have a compiled contract code, then
Deploy button will be activated.
Step 2: Enter the Account ID for which you want to deployed the contract and click the
Deploy button. If you want to add
init function, click
Deploy Option to add the method name and arguments.
Step 3: If the AccountId already has a deployed contract, confirm once more.
Step 4: Click the
Send Tx button in the WELLDONE Wallet to sign the transaction.
Step 5: A transaction success log will be printed to the terminal and the contract can be executed if contract deployment is successful.
Execute the Contract
There are two ways to import contracts.
- Automatically import contracts deployed through the above process.
- Import existing deployed contracts through
Step 1: Select the method to run.
Step 2: Add parameters as you needed.
Step 3: In the case of the
Call function, You can specify the number of NEAR tokens to attach to a function call and the GAS LIMIT.
Step 4: Run the method via clicking
Call button. If you are sending a transaction, you must sign the transaction by clicking the
Send Tx button in the WELLDONE Wallet.
If you deployed the compiled contract using
EMBED-ABI options, you can execute the contract more easily using the ABI without directly entering the parameters of the method.