Skip to content

NodeFactoryIo/web3-server-wallet

Repository files navigation

Web3-server-wallet

This repository contains TypeScript implementation of monitor service for transactions on the ethereum netowork.

For ethers@4.0.X use web3-server-wallet@0.1.X!

Usage

Install with yarn add @nodefactory/web3-server-wallet or npm i @nodefactory/web3-server-wallet

Example of usage:

import {ServerWeb3Wallet, TxMonitorService} from "@nodefactory/web3-server-wallet";

const wallet = await ServerWeb3Wallet.create(walletSource, walletStorage);
const monitorService = new TxMonitorService(wallet);
monitorService.start()

wallet.sendTransaction(transactionRequest);

Monitor service will automatically check if sent transaction is dropped and resubmit it with higher gas price and track its progress.

This package requires for IWalletTransactionStorage and IWalletSourceStorage interface to be implemented to store sent transactions and available wallets.

Gas Price

This package uses eth gas station api by default and GAS_STATION_API_KEY should be in process.env for it to work. It will fallback to provider.estimateGasPrice if gas station estimation does not work.

License

MIT