Prerequisites
As well as understanding JavaScript, it might be helpful to understand the Parallax stack and Parallax clients.Why use a library?
These libraries abstract away much of the complexity of interacting directly with a Parallax node. They also provide utility functions (e.g. converting LAX to Gwei) so as a developer you can spend less time dealing with the intricacies of Parallax clients and more time focused on the unique functionality of your application.Library features
Connect to Parallax nodes
Using providers, these libraries allow you to connect to Parallax and read its data, whether that’s over JSON-RPC or MetaMask. Ethers example- block numbers
- gas estimates
- smart contract events
- network id
- and more…
Wallet functionality
These libraries give you functionality to create wallets, manage keys and sign transactions. Here’s an example from Ethers- create accounts
- send transactions
- sign transactions
- and more…
Interact with smart contract functions
JavaScript client libraries allow your application to call smart contract functions by reading the Application Binary Interface (ABI) of a compiled contract. The ABI essentially explains the contract’s functions in a JSON format and allows you to use it like a normal JavaScript object. So the following Solidity contract:- Send a transaction to the smart contract and execute its method
- Call to estimate the gas a method execution will take when executed in the PVM
- Deploy a contract
- And more…
Utility functions
Utility functions give you handy shortcuts that make building with Parallax a little easier. LAX values are in Wei by default. 1 LAX = 1,000,000,000,000,000,000 WEI – this means you’re dealing with a lot of numbers!web3.utils.toWei
converts LAX to Wei for you.
And in ethers it looks like this: