PHP WebShell

Текущая директория: /usr/lib/node_modules/bitgo/node_modules/@celo/contractkit/lib/wrappers

Просмотр файла: Erc20Wrapper.js

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Erc20Wrapper = void 0;
var BaseWrapper_1 = require("./BaseWrapper");
/**
 * ERC-20 contract only containing the non-optional functions
 */
var Erc20Wrapper = /** @class */ (function (_super) {
    __extends(Erc20Wrapper, _super);
    function Erc20Wrapper() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        /**
         * Querying allowance.
         * @param from Account who has given the allowance.
         * @param to Address of account to whom the allowance was given.
         * @returns Amount of allowance.
         */
        _this.allowance = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.allowance, undefined, BaseWrapper_1.valueToBigNumber);
        /**
         * Returns the total supply of the token, that is, the amount of tokens currently minted.
         * @returns Total supply.
         */
        _this.totalSupply = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.totalSupply, undefined, BaseWrapper_1.valueToBigNumber);
        /**
         * Approve a user to transfer the token on behalf of another user.
         * @param spender The address which is being approved to spend the token.
         * @param value The amount of the token approved to the spender.
         * @return True if the transaction succeeds.
         */
        _this.approve = (0, BaseWrapper_1.proxySend)(_this.connection, _this.contract.methods.approve);
        /**
         * Transfers the token from one address to another.
         * @param to The address to transfer the token to.
         * @param value The amount of the token to transfer.
         * @return True if the transaction succeeds.
         */
        _this.transfer = (0, BaseWrapper_1.proxySend)(_this.connection, _this.contract.methods.transfer);
        /**
         * Transfers the token from one address to another on behalf of a user.
         * @param from The address to transfer the token from.
         * @param to The address to transfer the token to.
         * @param value The amount of the token to transfer.
         * @return True if the transaction succeeds.
         */
        _this.transferFrom = (0, BaseWrapper_1.proxySend)(_this.connection, _this.contract.methods.transferFrom);
        /**
         * Gets the balance of the specified address.
         * @param owner The address to query the balance of.
         * @return The balance of the specified address.
         */
        _this.balanceOf = (0, BaseWrapper_1.proxyCall)(_this.contract.methods.balanceOf, undefined, BaseWrapper_1.valueToBigNumber);
        return _this;
    }
    return Erc20Wrapper;
}(BaseWrapper_1.BaseWrapper));
exports.Erc20Wrapper = Erc20Wrapper;
//# sourceMappingURL=Erc20Wrapper.js.map

Выполнить команду


Для локальной разработки. Не используйте в интернете!