UNPKG

@nomiclabs/buidler

Version:

Buidler is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.

38 lines 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const ethereumjs_util_1 = require("ethereumjs-util"); const errors_1 = require("../errors"); const input_1 = require("../input"); const output_1 = require("../output"); // tslint:disable only-buidler-error class Web3Module { async processRequest(method, params = []) { switch (method) { case "web3_clientVersion": return this._clientVersionAction(...this._clientVersionParams(params)); case "web3_sha3": return this._sha3Action(...this._sha3Params(params)); } throw new errors_1.MethodNotFoundError(`Method ${method} not found`); } // web3_clientVersion _clientVersionParams(params) { return input_1.validateParams(params); } async _clientVersionAction() { // TODO: This is a temporal fix because of https://github.com/OpenZeppelin/openzeppelin-test-helpers/pull/73 return "EthereumJS TestRPC/v2.8.0/ethereum-js"; // const buidlerPackage = await getPackageJson(); // const ethereumjsVMPackage = require("@nomiclabs/ethereumjs-vm/package.json"); // return `BuidlerEVM/${buidlerPackage.version}/ethereumjs-vm/${ethereumjsVMPackage.version}`; } // web3_sha3 _sha3Params(params) { return input_1.validateParams(params, input_1.rpcData); } async _sha3Action(buffer) { return output_1.bufferToRpcData(ethereumjs_util_1.keccak256(buffer)); } } exports.Web3Module = Web3Module; //# sourceMappingURL=web3.js.map