@celo/contractkit
Version:
Celo's ContractKit to interact with Celo network
39 lines • 1.95 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.GoldTokenWrapper = void 0;
require("bignumber.js");
const BaseWrapper_1 = require("./BaseWrapper");
const CeloTokenWrapper_1 = require("./CeloTokenWrapper");
/**
* ERC-20 contract for Celo native currency.
*/
class GoldTokenWrapper extends CeloTokenWrapper_1.CeloTokenWrapper {
constructor() {
super(...arguments);
/**
* Increases the allowance of another user.
* @param spender The address which is being approved to spend CELO.
* @param value The increment of the amount of CELO approved to the spender.
* @returns true if success.
*/
this.increaseAllowance = (0, BaseWrapper_1.proxySend)(this.connection, this.contract.methods.increaseAllowance, (0, BaseWrapper_1.tupleParser)(BaseWrapper_1.stringIdentity, BaseWrapper_1.valueToString));
/**
* Decreases the allowance of another user.
* @param spender The address which is being approved to spend CELO.
* @param value The decrement of the amount of CELO approved to the spender.
* @returns true if success.
*/
this.decreaseAllowance = (0, BaseWrapper_1.proxySend)(this.connection, this.contract.methods.decreaseAllowance);
/**
* Gets the balance of the specified address.
* WARNING: The actual call to the Gold contract of the balanceOf:
* `balanceOf = proxyCall(this.contract.methods.balanceOf, undefined, valueToBigNumber)`
* has issues with web3. Keep the one calling getBalance
* @param owner The address to query the balance of.
* @return The balance of the specified address.
*/
this.balanceOf = (account) => this.connection.web3.eth.getBalance(account).then(BaseWrapper_1.valueToBigNumber);
}
}
exports.GoldTokenWrapper = GoldTokenWrapper;
//# sourceMappingURL=GoldTokenWrapper.js.map
;