https://github.com/ujjwalguptaofficial/ethcontracts-web3
Wrapper for web3.js
https://github.com/ujjwalguptaofficial/ethcontracts-web3
Last synced: 3 months ago
JSON representation
Wrapper for web3.js
- Host: GitHub
- URL: https://github.com/ujjwalguptaofficial/ethcontracts-web3
- Owner: ujjwalguptaofficial
- License: mit
- Created: 2022-11-23T14:26:54.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-07T12:09:32.000Z (over 2 years ago)
- Last Synced: 2025-03-06T10:19:20.923Z (7 months ago)
- Language: TypeScript
- Size: 1.14 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ethcontracts-web3
web3.js wrapper for ethcontracts.js> It contains web3js client which can be used inside ethcontracts.js.
# install
```
npm i @ethcontracts/web3
```# Usage
```
import { ERC20 } from "@ethcontracts/core";
import { Web3Client } from "@ethcontracts/web3";
import Web3 from "web3";// create token with token address
const token = new ERC20("0x8f3cf7ad23cd3cadbd9735aff958023239c6a063");// create provider
const provider = new Web3.providers.HttpProvider('https://polygon-rpc.com');// initiate token with provider
await token.init(
new Web3Client(provider)
);// call token balance api
const balance = await token.getBalance("0xd5D3F35Bdd08950CCFE0DeAb638F8B5498297076");
console.log("balance", balance);
```For more documentation, please visit - [https://ujjwalguptaofficial.github.io/ethcontracts-doc/](https://ujjwalguptaofficial.github.io/ethcontracts-doc/)