@gateway.fm/gtw-dvf-client-js
Version:
DVF client js lib with gateway.fm rpc endpoints
29 lines (20 loc) • 763 B
JavaScript
/**
* Creats a client instance for testing
**/
const HDWalletProvider = require('@truffle/hdwallet-provider')
const Web3 = require('web3')
const DVF = require('../../../dvf')
module.exports = async () => {
const rpcUrl = process.env.RPC_URL
const privateKey = process.env.PRIVATE_ETH_KEY
const provider = new HDWalletProvider(privateKey, rpcUrl)
const web3 = new Web3(provider)
provider.engine.stop()
const gasStationApiKey = process.env.ETH_GAS_STATION_KEY || ''
let config = { gasStationApiKey }
// It's possible to overwrite the API address with the testnet address
// for example like this:
// config.api = 'https://rpc.gateway.fm/v1/starkex/stg'
// config.api = 'http://localhost:7777/v1/trading'
return DVF(web3, config)
}