UNPKG

web3-zeus-provider

Version:

Reliable web3 provider that uses multiple RPC API connections and switches between them in case of failure

23 lines (21 loc) 810 B
const pk = "55572648561528C5964648FEB815211574A945B439318821602B8C60DF9FF40F"; const rpcApiUrl = "http://dt-api-dev.dreamteam.gg/eth-nw"; const Web3 = require("web3"); const Zeus = require(".."); const web3 = new Web3(new Zeus({ privateKeys: [pk], rpcApis: [rpcApiUrl] })); // const PrivateKeyProvider = require("./src/index2"); // const web3 = new Web3(new PrivateKeyProvider(pk, rpcApi)); async function run () { const result = await web3.eth.sendTransaction({ from: "0x9D889b9c7cc90B7cD2324b3Bb514a2E2ec82aC4e", to: "0x6f8103606b649522aF9687e8f1e7399eff8c4a6B", value: "44", gasPrice: 1000000000, gas: 21000 }); console.log("Result:", result); } run().then(e => console.log("Done", e)).catch(e => console.log("Error!", e));