dp-contract-proxy-kit
Version:
Enable batched transactions and contract account interactions using a unique deterministic Gnosis Safe.
38 lines • 1.88 kB
JavaScript
;
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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const transactions_1 = require("../../utils/transactions");
const _1 = require("./");
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 && transactions_1.normalizeGasLimit(options));
}
send(methodName, params, options) {
const promiEvent = this.contract.methods[methodName](...params).send(options && transactions_1.normalizeGasLimit(options));
return _1.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 && transactions_1.normalizeGasLimit(options)));
});
}
encode(methodName, params) {
return this.contract.methods[methodName](...params).encodeABI();
}
}
exports.default = Web3ContractAdapter;
//# sourceMappingURL=Web3ContractAdapter.js.map