Developing on Ethereum L2s and EVM
We leverage the flexibility and power of Ethereum and apply it within DapDap's NEAR development ecosystem. This section is designed to facilitate Ethereum developers in seamlessly integrating, experimenting, and innovating with DapDap.
Interacting with Ethereum dApps
DapDap leverages an environment with NEAR JS where Ethereum dApps and smart contracts become more accessible. The NEAR VM has imported the Ethers.js library, allowing for seamless interaction with Ethereum nodes using JavaScript in a NEAR component.
The Ethers
object exposes the provider connection:
Ethers.provider()
is a read-only connection to the blockchain, which allows querying the blockchain state (e.g., account, block or transaction details), querying event logs or evaluating read-only code using call.Ethers.provider().getSigner()
abstracts the class that interacts with an accountEthers.provider().getSigner().getBalance()
returns a Promise that resolves to the account address.
Ethers.provider().getBlockNumber()
looks up the current block number (i.e. height)Ethers.provider().getFeeData()
gets the best guess at the recommended FeeData
You can see various ways of using Ethers
objects on the Ethers documentation portal).
Furthermore, numerous basic tools can be found in the ethers.utils object (be aware of the lowercase 'e').
ethers.utils.parseUnits(value, unit)
converts the decimal string value to a BigInt, assuming unit decimal places. The unit may the number of decimal places or the name of a unit (e.g. "gwei" for 9 decimal places).ethers.utils.formatEther(wei)
converts value into a decimal string using 18 decimal places.
Example showing the difference between Ethers.provider()
and ethers.utils
:
Examples
Below is a curated list of NEAR components that could potentially be integrated into DapDap, developed by the community:
Swap component (a set of swap dApps for Ethereum Mainnet, Polygon Mainnet, Polygon zkevm, Aurora, NEAR, etc)
Last updated