@vechain/connex.driver-nodejs
v1.2.0-beta6
Published
Connex framework driver implementation in NodeJS
Downloads
174
Readme
Connex Driver for NodeJS
It drives Connex Framework to work in NodeJS environment. Now you can use Connex in NodeJS backend project.
Installation
# install driver along with framework
npm i @vechain/connex-framework @vechain/connex.driver-nodejs
Usage
The REPL playground is a good start.
import { Framework } from '@vechain/connex-framework'
import { Driver, SimpleNet, SimpleWallet, options } from '@vechain/connex.driver-nodejs'
const wallet = new SimpleWallet()
// add account by importing private key
wallet.import('<private key>')
const driver = await Driver.connect(new SimpleNet('http://localhost:8669/'), wallet)
const connex = new Framework(driver)
// here get connex object ready to use
...
// config tx parameters, e.g. expiration, gasPriceCoef
driver.txParams.expiration = 18
driver.txParams.gasPriceCoef = 128
// watch committed tx
driver.onTxCommit = txObj => {
//
}
// if feel error logs annoying, you can disable it by
options.disableErrorLog = true