UNPKG

dp-contract-proxy-kit

Version:

Enable batched transactions and contract account interactions using a unique deterministic Gnosis Safe.

36 lines 1.76 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import { normalizeGasLimit } from '../../utils/transactions'; import { toTxResult } from './'; class Web3ContractAdapter { constructor(contract) { this.contract = contract; } get address() { return this.contract.options.address; } call(methodName, params, options) { return this.contract.methods[methodName](...params).call(options && normalizeGasLimit(options)); } send(methodName, params, options) { const promiEvent = this.contract.methods[methodName](...params).send(options && normalizeGasLimit(options)); return toTxResult(promiEvent, options); } estimateGas(methodName, params, options) { return __awaiter(this, void 0, void 0, function* () { return Number(yield this.contract.methods[methodName](...params).estimateGas(options && normalizeGasLimit(options))); }); } encode(methodName, params) { return this.contract.methods[methodName](...params).encodeABI(); } } export default Web3ContractAdapter; //# sourceMappingURL=Web3ContractAdapter.js.map