evm-blockchain-tools
Version:
This is a collection of resuseable tools to support development for EVM-powered blockchains
52 lines • 2.14 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 });
exports.ERC20Service = void 0;
const contract_service_1 = require("./contract-service");
class ERC20Service extends contract_service_1.ContractService {
constructor(contract) {
super(contract);
this.contract = contract;
}
balanceOf(address) {
return __awaiter(this, void 0, void 0, function* () {
const bn = yield this.contract.balanceOf(address);
return bn.toString();
});
}
transfer(address, amount) {
return __awaiter(this, void 0, void 0, function* () {
const tx = yield this.contract.transfer(address, amount);
return tx.wait();
});
}
mint(address, amount) {
return __awaiter(this, void 0, void 0, function* () {
const tx = yield this.contract.mint(address, amount);
yield tx.wait();
});
}
burn(amount) {
return __awaiter(this, void 0, void 0, function* () {
const tx = yield this.contract.burn(amount);
yield tx.wait();
});
}
burnFrom(address, amount) {
return __awaiter(this, void 0, void 0, function* () {
const tx = yield this.contract.burnFrom(address, amount);
yield tx.wait();
});
}
}
ERC20Service.TRANSFER_FN_SIG = "transfer()";
exports.ERC20Service = ERC20Service;
//# sourceMappingURL=erc20-service.js.map