Skip to main content

Execute the Contract in Frontend

September 8, 2022
Suji Yoon
Software Engineer, DSRV


In the previous tutorial, we wrote, deployed, and executed a simple counter smart contract in NEAR using Rust and WELLDONE Code. In this tutorial, we will practice how the frontend and smart contract communicate using the WELLDONE Wallet.

Using Universal Provider

Universal Provider is a middleware that communicates with WELLDONE Wallet, abstracting the requirements of different libraries by blockchain. With Universal Provider, builders developing dApps on a multi-chain do not have to manage separate libraries, allowing them to focus entirely on development. For more information and instructions on using Universal Provider, please refer to the following link.

The code below is an example of executing the increment method for the contract deployed in the previous tutorial. First, click the Get Account button to connect to the WELLDONE Wallet, and then enter the ID of the contract you deployed. You can search for transaction hashes in explorer to see if they are successful.

Live Editor

Using Wallet Selector

Wallet Selector is an officially supported project by NEAR that provides abstractions of key features of the wallet for easy communication with dApp users with various wallets that support the NEAR protocol. Users can select the wallet they want and communicate with it using the abstraction method provided by Wallet Selector.
Press the Log in button to connect to the WELLDONE Wallet, then click the Send a Transaction button to run theincrement method. Press the Get Count button to view the current count value of the contract.

WELLDONE Wallet is an officially supported wallet by Wallet Selector. If you are curious about the complete example code for sending transactions using Wallet Selector, please check GitHub.