How to use the web3-core-helpers.formatters.inputAddressFormatter function in web3-core-helpers

To help you get started, we’ve selected a few web3-core-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethereum / web3.js / packages / web3-eth-personal / src / index.js View on Github external
set: function (val) {
            if(val) {
                defaultAccount = utils.toChecksumAddress(formatters.inputAddressFormatter(val));
            }

            // update defaultBlock
            methods.forEach(function(method) {
                method.defaultAccount = defaultAccount;
            });

            return val;
        },
        enumerable: true
github ethereum / web3.js / packages / web3-eth-contract / src / index.js View on Github external
Contract.prototype._getOrSetDefaultOptions = function getOrSetDefaultOptions(options) {
    var gasPrice = options.gasPrice ? String(options.gasPrice): null;
    var from = options.from ? utils.toChecksumAddress(formatters.inputAddressFormatter(options.from)) : null;

    options.data = options.data || this.options.data;

    options.from = from || this.options.from;
    options.gasPrice = gasPrice || this.options.gasPrice;
    options.gas = options.gas || options.gasLimit || this.options.gas;

    // TODO replace with only gasLimit?
    delete options.gasLimit;

    return options;
};
github ethereum / web3.js / packages / web3-eth-contract / src / index.js View on Github external
set: function(value){
            if(value) {
                try {
                    _this._address = utils.toChecksumAddress(formatters.inputAddressFormatter(value));
                } catch (error) {
                    if (value.match(/^[a-z]+([\.\-]?[a-z]+)?$/)) {
                        ens.getAddress(value).then(function (address) {
                            _this._address = address;
                        }).catch(function () {
                            throw new Error('Given ENS address "'+ value +'" does not exist.');
                        });
                    } else {
                        throw error;
                    }

                }
            }
        },
        get: function(){
github ethereum / web3.js / packages / web3-eth-abi / src / types / address.js View on Github external
this._inputFormatter = function(){
        var args = Array.prototype.slice.call(arguments);
        args[0] = formatters.inputAddressFormatter(args[0]);
        return f.formatInputInt.apply(this, args);
    };
    this._outputFormatter = f.formatOutputAddress;
github ethereum / web3.js / packages / web3-eth-contract / src / index.js View on Github external
set: function (val) {
            if(val) {
                defaultAccount = utils.toChecksumAddress(formatters.inputAddressFormatter(val));
            }

            return val;
        },
        enumerable: true