UNPKG

@kadena/hardhat-chainweb

Version:
27 lines 981 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isValidProvider = void 0; exports.getProvider = getProvider; exports.wordToAddress = wordToAddress; const ethers_1 = require("ethers"); const isValidProvider = (provider) => { if (!provider) { return false; } return provider.send !== undefined; }; exports.isValidProvider = isValidProvider; /* *************************************************************************** */ /* Ethers Provider */ function getProvider(rpcUrl) { const provider = new ethers_1.ethers.JsonRpcProvider(rpcUrl); provider.pollingInterval = 100; return provider; // would be nice to use this to subscribe to pending txs. But that seems to be // not reliable. // return new ethers.providers.WebSocketProvider(rpcUrl); } function wordToAddress(hexbytes) { return ethers_1.ethers.getAddress(ethers_1.ethers.dataSlice(hexbytes, 12)); } //# sourceMappingURL=ethers-helpers.js.map