mirror of
https://github.com/0xbow-io/privacy-pools-core.git
synced 2026-01-10 09:58:00 -05:00
ts-turborepo-boilerplate: sample-lib package
Note: use this lib as reference but preferred way is to re-write package from zero instead of refactoring this one. When you don't need this anymore, you can delete it
Sample library that exposes a Blockchain provider to query account balances on Ethereum mainnet or EVM-compatible blockchains
Setup
- Change package name to your own in
package.json - Install dependencies running
pnpm install
Available Scripts
Available scripts that can be run using pnpm:
| Script | Description |
|---|---|
build |
Build library using tsc |
check-types |
Check types issues using tsc |
clean |
Remove dist folder |
lint |
Run ESLint to check for coding standards |
lint:fix |
Run linter and automatically fix code formatting issues |
format |
Check code formatting and style using Prettier |
format:fix |
Run formatter and automatically fix issues |
test |
Run tests using vitest |
test:cov |
Run tests with coverage report |
Usage
Importing the Package
You can import the package in your TypeScript or JavaScript files as follows:
import { BlockchainProvider } from "@ts-turborepo-boilerplate/sample-lib";
Example
// EVM-provider
const rpcUrl = ""; //non-empty valid url
const address = "0x...";
const provider = new BlockchainProvider(rpcUrl);
const balance = await provider.getBalance(address);
console.log(`Balance of ${address} is ${balance}`);
API
IBlockchainProvider
Available methods
getBalance(address: Address)