Here we share our library to work with Ethereum Virtual Machine RPC Nodes: Ethereum, Polygon, BSC, Arbitrum, etc. We use web3 and ethers to provide new Features and to simplify the API.
BigInt
types and various utility methodsSource-Code
DistributionNot as a library, but as the source code. Clone or fork it and use it as a submodule. Means:
a) you can import
any class
, namespace
and utility
method.
b) you can easily extend and modify any class
, namespace
and utility
method.
c) you get the documentation direct from the code. We don't have much time yet to document all the parts
And path prefix (alias) to your tsconfig.json
{
"compilerOptions": {
"paths": {
"@dequanto/*": [ "your-sub-module-folder/src/*" ],
"@dequanto-contract/*": [ "your-sub-module-folder/contract/*" ]
}
}
}
Before you use the code, you should prepare the configuration for it: Node RPC URLs, Accounts, Blockchain Explorer API Keys, etc.
Provide multiple RPC Node URLs, this will make your application much more reliable. Even if one of the Nodes goes down or for some reason is not in-sync, all your RPC calls will still work.
Web3Client is the base class for all the EVM Platforms. This wraps web3 to provide pool-based communication with nodes. It handles also Gas and Nonce Values.
TxDataBuilder and TxWriter to create and submit transaction.
With auto-generated classes you can
a) type-safe method read and write(transaction) calls to blockchain b) parse receipts of the contract transactions c) easily subscribe to event streams of the contract
Ready to use Etherscan&Co classes to consume their API. Just drop-in the KEYs.
Get Tokens Data (address
, decimals
, etc) by symbol
and platform
One-liners to transfer tokens from A to B, or swap the tokens using popular DEXes
Start listening the blockchain with less code
Lots of Utility methods. BigInt are the first-class citizens in the code.
We prebuild generic OpenZeppelin contracts
import { ERC20 } from '@dequanto-contracts/openzeppelin/ERC20
let erc20 = new ERC20(`0x...`);
let balance = await erc20.balanceOf('0x...');