Skip to content

Commit

Permalink
Updated dist files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Dec 27, 2018
1 parent f3ec27b commit c2ce59f
Show file tree
Hide file tree
Showing 17 changed files with 113 additions and 33 deletions.
2 changes: 1 addition & 1 deletion _version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "4.0.20";
export declare const version = "4.0.21";
2 changes: 1 addition & 1 deletion _version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "4.0.20";
exports.version = "4.0.21";
3 changes: 1 addition & 2 deletions contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ var Contract = /** @class */ (function () {
}
return address;
}).catch(function (error) {
console.log('ERROR: Cannot find Contract - ' + addressOrName);
throw error;
}));
}
Expand All @@ -323,7 +322,7 @@ var Contract = /** @class */ (function () {
properties_1.defineReadOnly(_this, name, run);
}
else {
console.log('WARNING: Multiple definitions for ' + name);
errors.warn('WARNING: Multiple definitions for ' + name);
}
if (_this.functions[name] == null) {
properties_1.defineReadOnly(_this.functions, name, run);
Expand Down
63 changes: 50 additions & 13 deletions dist/ethers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "4.0.20";
exports.version = "4.0.21";

},{}],2:[function(require,module,exports){
"use strict";
Expand Down Expand Up @@ -352,7 +352,6 @@ var Contract = /** @class */ (function () {
}
return address;
}).catch(function (error) {
console.log('ERROR: Cannot find Contract - ' + addressOrName);
throw error;
}));
}
Expand All @@ -371,7 +370,7 @@ var Contract = /** @class */ (function () {
properties_1.defineReadOnly(_this, name, run);
}
else {
console.log('WARNING: Multiple definitions for ' + name);
errors.warn('WARNING: Multiple definitions for ' + name);
}
if (_this.functions[name] == null) {
properties_1.defineReadOnly(_this.functions, name, run);
Expand Down Expand Up @@ -880,6 +879,39 @@ function checkNormalize() {
}
}
exports.checkNormalize = checkNormalize;
var LogLevels = { debug: 1, "default": 2, info: 2, warn: 3, error: 4, off: 5 };
var LogLevel = LogLevels["default"];
function setLogLevel(logLevel) {
var level = LogLevels[logLevel];
if (level == null) {
warn("invliad log level - " + logLevel);
return;
}
LogLevel = level;
}
exports.setLogLevel = setLogLevel;
function log(logLevel, args) {
if (LogLevel > LogLevels[logLevel]) {
return;
}
console.log.apply(console, args);
}
function warn() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
log("warn", args);
}
exports.warn = warn;
function info() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
log("info", args);
}
exports.info = info;

},{"./_version":1}],6:[function(require,module,exports){
'use strict';
Expand Down Expand Up @@ -10957,7 +10989,7 @@ var BaseProvider = /** @class */ (function (_super) {
return null;
};
BaseProvider.prototype._startPending = function () {
console.log('WARNING: this provider does not support pending events');
errors.warn('WARNING: this provider does not support pending events');
};
BaseProvider.prototype._stopPending = function () {
};
Expand Down Expand Up @@ -11584,7 +11616,7 @@ var InfuraProvider = /** @class */ (function (_super) {
return _this;
}
InfuraProvider.prototype._startPending = function () {
console.log('WARNING: INFURA does not support pending filters');
errors.warn('WARNING: INFURA does not support pending filters');
};
InfuraProvider.prototype.getSigner = function (address) {
errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });
Expand Down Expand Up @@ -12283,7 +12315,7 @@ function parseSignatureEvent(fragment) {
case '':
break;
default:
console.log('unknown modifier: ' + modifier);
errors.info('unknown modifier: ' + modifier);
}
});
if (abi.name && !abi.name.match(regexIdentifier)) {
Expand Down Expand Up @@ -12347,7 +12379,7 @@ function parseSignatureFunction(fragment) {
case '':
break;
default:
console.log('unknown modifier: ' + modifier);
errors.info('unknown modifier: ' + modifier);
}
});
// We have outputs
Expand Down Expand Up @@ -14344,9 +14376,14 @@ function addMethod(method) {
signature: signature,
sighash: sighash,
});
// Expose the first (and hopefully unique named function
if (method.name && this.functions[method.name] == null) {
properties_1.defineReadOnly(this.functions, method.name, description);
// Expose the first (and hopefully unique named function)
if (method.name) {
if (this.functions[method.name] == null) {
properties_1.defineReadOnly(this.functions, method.name, description);
}
else {
errors.warn('WARNING: Multiple definitions for ' + method.name);
}
}
// Expose all methods by their signature, for overloaded functions
if (this.functions[description.signature] == null) {
Expand Down Expand Up @@ -14377,7 +14414,7 @@ function addMethod(method) {
// Nothing to do for fallback
break;
default:
console.log('WARNING: unsupported ABI type - ' + method.type);
errors.warn('WARNING: unsupported ABI type - ' + method.type);
break;
}
}
Expand Down Expand Up @@ -15827,7 +15864,7 @@ function parse(rawTransaction) {
tx.v = bignumber_1.bigNumberify(transaction[6]).toNumber();
}
catch (error) {
console.log(error);
errors.info(error);
return tx;
}
tx.r = bytes_1.hexZeroPad(transaction[7], 32);
Expand Down Expand Up @@ -15856,7 +15893,7 @@ function parse(rawTransaction) {
tx.from = secp256k1_1.recoverAddress(digest, { r: bytes_1.hexlify(tx.r), s: bytes_1.hexlify(tx.s), recoveryParam: recoveryParam });
}
catch (error) {
console.log(error);
errors.info(error);
}
tx.hash = keccak256_1.keccak256(rawTransaction);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/ethers.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethers.min.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion dist/ethers.types.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ declare module 'ethers/errors' {
export function checkArgumentCount(count: number, expectedCount: number, suffix?: string): void;
export function setCensorship(censorship: boolean, permanent?: boolean): void;
export function checkNormalize(): void;
export function setLogLevel(logLevel: string): void;
export function warn(...args: Array<any>): void;
export function info(...args: Array<any>): void;
}

declare module 'ethers/providers' {
Expand Down Expand Up @@ -262,7 +265,7 @@ declare module 'ethers/utils/shims' {
}

declare module 'ethers/_version' {
export const version = "4.0.20";
export const version = "4.0.21";
}

declare module 'ethers/utils/bignumber' {
Expand Down
3 changes: 3 additions & 0 deletions errors.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ export declare function checkNew(self: any, kind: any): void;
export declare function checkArgumentCount(count: number, expectedCount: number, suffix?: string): void;
export declare function setCensorship(censorship: boolean, permanent?: boolean): void;
export declare function checkNormalize(): void;
export declare function setLogLevel(logLevel: string): void;
export declare function warn(...args: Array<any>): void;
export declare function info(...args: Array<any>): void;
33 changes: 33 additions & 0 deletions errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,36 @@ function checkNormalize() {
}
}
exports.checkNormalize = checkNormalize;
var LogLevels = { debug: 1, "default": 2, info: 2, warn: 3, error: 4, off: 5 };
var LogLevel = LogLevels["default"];
function setLogLevel(logLevel) {
var level = LogLevels[logLevel];
if (level == null) {
warn("invliad log level - " + logLevel);
return;
}
LogLevel = level;
}
exports.setLogLevel = setLogLevel;
function log(logLevel, args) {
if (LogLevel > LogLevels[logLevel]) {
return;
}
console.log.apply(console, args);
}
function warn() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
log("warn", args);
}
exports.warn = warn;
function info() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
log("info", args);
}
exports.info = info;
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethers",
"version": "4.0.20",
"version": "4.0.21",
"description": "Ethereum wallet library.",
"main": "./index.js",
"types": "./index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion providers/base-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ var BaseProvider = /** @class */ (function (_super) {
return null;
};
BaseProvider.prototype._startPending = function () {
console.log('WARNING: this provider does not support pending events');
errors.warn('WARNING: this provider does not support pending events');
};
BaseProvider.prototype._stopPending = function () {
};
Expand Down
2 changes: 1 addition & 1 deletion providers/infura-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var InfuraProvider = /** @class */ (function (_super) {
return _this;
}
InfuraProvider.prototype._startPending = function () {
console.log('WARNING: INFURA does not support pending filters');
errors.warn('WARNING: INFURA does not support pending filters');
};
InfuraProvider.prototype.getSigner = function (address) {
errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });
Expand Down
2 changes: 1 addition & 1 deletion src.ts/_version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "4.0.20";
export const version = "4.0.21";
4 changes: 2 additions & 2 deletions utils/abi-coder.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function parseSignatureEvent(fragment) {
case '':
break;
default:
console.log('unknown modifier: ' + modifier);
errors.info('unknown modifier: ' + modifier);
}
});
if (abi.name && !abi.name.match(regexIdentifier)) {
Expand Down Expand Up @@ -260,7 +260,7 @@ function parseSignatureFunction(fragment) {
case '':
break;
default:
console.log('unknown modifier: ' + modifier);
errors.info('unknown modifier: ' + modifier);
}
});
// We have outputs
Expand Down
13 changes: 9 additions & 4 deletions utils/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,14 @@ function addMethod(method) {
signature: signature,
sighash: sighash,
});
// Expose the first (and hopefully unique named function
if (method.name && this.functions[method.name] == null) {
properties_1.defineReadOnly(this.functions, method.name, description);
// Expose the first (and hopefully unique named function)
if (method.name) {
if (this.functions[method.name] == null) {
properties_1.defineReadOnly(this.functions, method.name, description);
}
else {
errors.warn('WARNING: Multiple definitions for ' + method.name);
}
}
// Expose all methods by their signature, for overloaded functions
if (this.functions[description.signature] == null) {
Expand Down Expand Up @@ -286,7 +291,7 @@ function addMethod(method) {
// Nothing to do for fallback
break;
default:
console.log('WARNING: unsupported ABI type - ' + method.type);
errors.warn('WARNING: unsupported ABI type - ' + method.type);
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions utils/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function parse(rawTransaction) {
tx.v = bignumber_1.bigNumberify(transaction[6]).toNumber();
}
catch (error) {
console.log(error);
errors.info(error);
return tx;
}
tx.r = bytes_1.hexZeroPad(transaction[7], 32);
Expand Down Expand Up @@ -138,7 +138,7 @@ function parse(rawTransaction) {
tx.from = secp256k1_1.recoverAddress(digest, { r: bytes_1.hexlify(tx.r), s: bytes_1.hexlify(tx.s), recoveryParam: recoveryParam });
}
catch (error) {
console.log(error);
errors.info(error);
}
tx.hash = keccak256_1.keccak256(rawTransaction);
}
Expand Down

0 comments on commit c2ce59f

Please sign in to comment.