Updated dist files.

This commit is contained in:
Richard Moore 2020-01-20 19:43:50 -05:00
parent adf56229c6
commit 1ff5f5233e
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
73 changed files with 649 additions and 347 deletions

@ -3,6 +3,14 @@ Changelog
This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
ethers/v5.0.0-beta.169 (2020-01-20 19:42)
-----------------------------------------
- Fixed imports after refactor. ([adf5622](https://github.com/ethers-io/ethers.js/commit/adf56229c6cc83003d319ea9a004677e2555d478))
- Refactor some enum names and add UTF-8 error support to the umbrella package. ([931da2f](https://github.com/ethers-io/ethers.js/commit/931da2f77446fc9266cf07f0d7d78d4376625005))
- Allow arbitrary apiKey for UrlJsonRpcProvider. ([5878b54](https://github.com/ethers-io/ethers.js/commit/5878b54d6eded1329a6dc3b4023f876a87f72b6e))
- Added more general error handling (e.g. error, ignore, replace) for calling toUtf8String. ([a055edb](https://github.com/ethers-io/ethers.js/commit/a055edb5855b96fdf179403458c1694b96fd906c))
ethers/v5.0.0-beta.168 (2020-01-18 21:46)
-----------------------------------------

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -6619,7 +6619,7 @@ class NumberCoder extends Coder {
}
}
const version$6 = "strings/5.0.0-beta.135";
const version$6 = "strings/5.0.0-beta.136";
"use strict";
const logger$8 = new Logger(version$6);
@ -6633,8 +6633,79 @@ var UnicodeNormalizationForm;
UnicodeNormalizationForm["NFKD"] = "NFKD";
})(UnicodeNormalizationForm || (UnicodeNormalizationForm = {}));
;
var Utf8ErrorReason;
(function (Utf8ErrorReason) {
// A continuation byte was present where there was nothing to continue
// - offset = the index the codepoint began in
Utf8ErrorReason["UNEXPECTED_CONTINUE"] = "unexpected continuation byte";
// An invalid (non-continuation) byte to start a UTF-8 codepoint was found
// - offset = the index the codepoint began in
Utf8ErrorReason["BAD_PREFIX"] = "bad codepoint prefix";
// The string is too short to process the expected codepoint
// - offset = the index the codepoint began in
Utf8ErrorReason["OVERRUN"] = "string overrun";
// A missing continuation byte was expected but not found
// - offset = the index the continuation byte was expected at
Utf8ErrorReason["MISSING_CONTINUE"] = "missing continuation byte";
// The computed code point is outside the range for UTF-8
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; outside the UTF-8 range
Utf8ErrorReason["OUT_OF_RANGE"] = "out of UTF-8 range";
// UTF-8 strings may not contain UTF-16 surrogate pairs
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range
Utf8ErrorReason["UTF16_SURROGATE"] = "UTF-16 surrogate";
// The string is an overlong reperesentation
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; already bounds checked
Utf8ErrorReason["OVERLONG"] = "overlong representation";
})(Utf8ErrorReason || (Utf8ErrorReason = {}));
;
function errorFunc(reason, offset, bytes, output, badCodepoint) {
return logger$8.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes);
}
function ignoreFunc(reason, offset, bytes, output, badCodepoint) {
// If there is an invalid prefix (including stray continuation), skip any additional continuation bytes
if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) {
let i = 0;
for (let o = offset + 1; o < bytes.length; o++) {
if (bytes[o] >> 6 !== 0x02) {
break;
}
i++;
}
return i;
}
// This byte runs us past the end of the string, so just jump to the end
// (but the first byte was read already read and therefore skipped)
if (reason === Utf8ErrorReason.OVERRUN) {
return bytes.length - offset - 1;
}
// Nothing to skip
return 0;
}
function replaceFunc(reason, offset, bytes, output, badCodepoint) {
// Overlong representations are otherwise "valid" code points; just non-deistingtished
if (reason === Utf8ErrorReason.OVERLONG) {
output.push(badCodepoint);
return 0;
}
// Put the replacement character into the output
output.push(0xfffd);
// Otherwise, process as if ignoring errors
return ignoreFunc(reason, offset, bytes, output, badCodepoint);
}
// Common error handing strategies
const Utf8ErrorFuncs = Object.freeze({
error: errorFunc,
ignore: ignoreFunc,
replace: replaceFunc
});
// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499
function getUtf8CodePoints(bytes, ignoreErrors) {
function getUtf8CodePoints(bytes, onError) {
if (onError == null) {
onError = Utf8ErrorFuncs.error;
}
bytes = arrayify(bytes);
const result = [];
let i = 0;
@ -6665,25 +6736,17 @@ function getUtf8CodePoints(bytes, ignoreErrors) {
overlongMask = 0xffff;
}
else {
if (!ignoreErrors) {
if ((c & 0xc0) === 0x80) {
throw new Error("invalid utf8 byte sequence; unexpected continuation byte");
}
throw new Error("invalid utf8 byte sequence; invalid prefix");
if ((c & 0xc0) === 0x80) {
i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result);
}
else {
i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result);
}
continue;
}
// Do we have enough bytes in our data?
if (i + extraLength > bytes.length) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; too short");
}
// If there is an invalid unprocessed byte, skip continuation bytes
for (; i < bytes.length; i++) {
if (bytes[i] >> 6 !== 0x02) {
break;
}
}
if (i - 1 + extraLength >= bytes.length) {
i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result);
continue;
}
// Remove the length prefix from the char
@ -6692,6 +6755,7 @@ function getUtf8CodePoints(bytes, ignoreErrors) {
let nextChar = bytes[i];
// Invalid continuation byte
if ((nextChar & 0xc0) != 0x80) {
i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result);
res = null;
break;
}
@ -6699,31 +6763,23 @@ function getUtf8CodePoints(bytes, ignoreErrors) {
res = (res << 6) | (nextChar & 0x3f);
i++;
}
// See above loop for invalid contimuation byte
if (res === null) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; invalid continuation byte");
}
continue;
}
// Check for overlong seuences (more bytes than needed)
if (res <= overlongMask) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; overlong");
}
continue;
}
// Maximum code point
if (res > 0x10ffff) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; out-of-range");
}
i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res);
continue;
}
// Reserved for UTF-16 surrogate halves
if (res >= 0xd800 && res <= 0xdfff) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; utf-16 surrogate");
}
i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res);
continue;
}
// Check for overlong sequences (more bytes than needed)
if (res <= overlongMask) {
i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res);
continue;
}
result.push(res);
@ -6772,8 +6828,8 @@ function escapeChar(value) {
const hex = ("0000" + value.toString(16));
return "\\u" + hex.substring(hex.length - 4);
}
function _toEscapedUtf8String(bytes, ignoreErrors) {
return '"' + getUtf8CodePoints(bytes, ignoreErrors).map((codePoint) => {
function _toEscapedUtf8String(bytes, onError) {
return '"' + getUtf8CodePoints(bytes, onError).map((codePoint) => {
if (codePoint < 256) {
switch (codePoint) {
case 8: return "\\b";
@ -6803,8 +6859,8 @@ function _toUtf8String(codePoints) {
return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00));
}).join("");
}
function toUtf8String(bytes, ignoreErrors) {
return _toUtf8String(getUtf8CodePoints(bytes, ignoreErrors));
function toUtf8String(bytes, onError) {
return _toUtf8String(getUtf8CodePoints(bytes, onError));
}
function toUtf8CodePoints(str, form = UnicodeNormalizationForm.current) {
return getUtf8CodePoints(toUtf8Bytes(str, form));
@ -9856,7 +9912,7 @@ hash.ripemd160 = hash.ripemd.ripemd160;
var _version = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "sha2/5.0.0-beta.133";
exports.version = "sha2/5.0.0-beta.134";
});
var _version$1 = unwrapExports(_version);
@ -9877,11 +9933,11 @@ var hash = __importStar(hash_1);
var logger = new lib_esm.Logger(_version.version);
var SupportedAlgorithms;
(function (SupportedAlgorithms) {
SupportedAlgorithms["sha256"] = "sha256";
SupportedAlgorithms["sha512"] = "sha512";
})(SupportedAlgorithms = exports.SupportedAlgorithms || (exports.SupportedAlgorithms = {}));
var SupportedAlgorithm;
(function (SupportedAlgorithm) {
SupportedAlgorithm["sha256"] = "sha256";
SupportedAlgorithm["sha512"] = "sha512";
})(SupportedAlgorithm = exports.SupportedAlgorithm || (exports.SupportedAlgorithm = {}));
;
function ripemd160(data) {
return "0x" + (hash.ripemd160().update(lib_esm$1.arrayify(data)).digest("hex"));
@ -9896,7 +9952,7 @@ function sha512(data) {
}
exports.sha512 = sha512;
function computeHmac(algorithm, key, data) {
if (!SupportedAlgorithms[algorithm]) {
if (!SupportedAlgorithm[algorithm]) {
logger.throwError("unsupported algorithm " + algorithm, lib_esm.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "hmac",
algorithm: algorithm
@ -9908,7 +9964,7 @@ exports.computeHmac = computeHmac;
});
var browser$1 = unwrapExports(browser);
var browser_1 = browser.SupportedAlgorithms;
var browser_1 = browser.SupportedAlgorithm;
var browser_2 = browser.ripemd160;
var browser_3 = browser.sha256;
var browser_4 = browser.sha512;
@ -12682,7 +12738,7 @@ var browser$5 = unwrapExports(browser$4);
var browser_1$2 = browser$4.Wordlist;
var browser_2$1 = browser$4.wordlists;
const version$e = "hdnode/5.0.0-beta.136";
const version$e = "hdnode/5.0.0-beta.137";
"use strict";
const logger$h = new Logger(version$e);
@ -16160,7 +16216,7 @@ function poll(func, options) {
});
}
const version$j = "providers/5.0.0-beta.149";
const version$j = "providers/5.0.0-beta.150";
"use strict";
const logger$n = new Logger(version$j);
@ -19171,6 +19227,7 @@ var utils$1 = /*#__PURE__*/Object.freeze({
toUtf8Bytes: toUtf8Bytes,
toUtf8CodePoints: toUtf8CodePoints,
toUtf8String: toUtf8String,
Utf8ErrorFuncs: Utf8ErrorFuncs,
formatBytes32String: formatBytes32String,
parseBytes32String: parseBytes32String,
hashMessage: hashMessage,
@ -19207,12 +19264,13 @@ var utils$1 = /*#__PURE__*/Object.freeze({
entropyToMnemonic: entropyToMnemonic,
isValidMnemonic: isValidMnemonic,
mnemonicToSeed: mnemonicToSeed,
SupportedAlgorithms: browser_1,
SupportedAlgorithm: browser_1,
get UnicodeNormalizationForm () { return UnicodeNormalizationForm; },
get Utf8ErrorReason () { return Utf8ErrorReason; },
Indexed: Indexed
});
const version$l = "ethers/5.0.0-beta.168";
const version$l = "ethers/5.0.0-beta.169";
"use strict";
const errors = Logger.errors;

File diff suppressed because one or more lines are too long

@ -7127,7 +7127,7 @@
var _version$c = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "strings/5.0.0-beta.135";
exports.version = "strings/5.0.0-beta.136";
});
var _version$d = unwrapExports(_version$c);
@ -7150,8 +7150,79 @@
UnicodeNormalizationForm["NFKD"] = "NFKD";
})(UnicodeNormalizationForm = exports.UnicodeNormalizationForm || (exports.UnicodeNormalizationForm = {}));
;
var Utf8ErrorReason;
(function (Utf8ErrorReason) {
// A continuation byte was present where there was nothing to continue
// - offset = the index the codepoint began in
Utf8ErrorReason["UNEXPECTED_CONTINUE"] = "unexpected continuation byte";
// An invalid (non-continuation) byte to start a UTF-8 codepoint was found
// - offset = the index the codepoint began in
Utf8ErrorReason["BAD_PREFIX"] = "bad codepoint prefix";
// The string is too short to process the expected codepoint
// - offset = the index the codepoint began in
Utf8ErrorReason["OVERRUN"] = "string overrun";
// A missing continuation byte was expected but not found
// - offset = the index the continuation byte was expected at
Utf8ErrorReason["MISSING_CONTINUE"] = "missing continuation byte";
// The computed code point is outside the range for UTF-8
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; outside the UTF-8 range
Utf8ErrorReason["OUT_OF_RANGE"] = "out of UTF-8 range";
// UTF-8 strings may not contain UTF-16 surrogate pairs
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range
Utf8ErrorReason["UTF16_SURROGATE"] = "UTF-16 surrogate";
// The string is an overlong reperesentation
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; already bounds checked
Utf8ErrorReason["OVERLONG"] = "overlong representation";
})(Utf8ErrorReason = exports.Utf8ErrorReason || (exports.Utf8ErrorReason = {}));
;
function errorFunc(reason, offset, bytes, output, badCodepoint) {
return logger.throwArgumentError("invalid codepoint at offset " + offset + "; " + reason, "bytes", bytes);
}
function ignoreFunc(reason, offset, bytes, output, badCodepoint) {
// If there is an invalid prefix (including stray continuation), skip any additional continuation bytes
if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) {
var i = 0;
for (var o = offset + 1; o < bytes.length; o++) {
if (bytes[o] >> 6 !== 0x02) {
break;
}
i++;
}
return i;
}
// This byte runs us past the end of the string, so just jump to the end
// (but the first byte was read already read and therefore skipped)
if (reason === Utf8ErrorReason.OVERRUN) {
return bytes.length - offset - 1;
}
// Nothing to skip
return 0;
}
function replaceFunc(reason, offset, bytes, output, badCodepoint) {
// Overlong representations are otherwise "valid" code points; just non-deistingtished
if (reason === Utf8ErrorReason.OVERLONG) {
output.push(badCodepoint);
return 0;
}
// Put the replacement character into the output
output.push(0xfffd);
// Otherwise, process as if ignoring errors
return ignoreFunc(reason, offset, bytes, output, badCodepoint);
}
// Common error handing strategies
exports.Utf8ErrorFuncs = Object.freeze({
error: errorFunc,
ignore: ignoreFunc,
replace: replaceFunc
});
// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499
function getUtf8CodePoints(bytes, ignoreErrors) {
function getUtf8CodePoints(bytes, onError) {
if (onError == null) {
onError = exports.Utf8ErrorFuncs.error;
}
bytes = lib$1.arrayify(bytes);
var result = [];
var i = 0;
@ -7182,25 +7253,17 @@
overlongMask = 0xffff;
}
else {
if (!ignoreErrors) {
if ((c & 0xc0) === 0x80) {
throw new Error("invalid utf8 byte sequence; unexpected continuation byte");
}
throw new Error("invalid utf8 byte sequence; invalid prefix");
if ((c & 0xc0) === 0x80) {
i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result);
}
else {
i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result);
}
continue;
}
// Do we have enough bytes in our data?
if (i + extraLength > bytes.length) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; too short");
}
// If there is an invalid unprocessed byte, skip continuation bytes
for (; i < bytes.length; i++) {
if (bytes[i] >> 6 !== 0x02) {
break;
}
}
if (i - 1 + extraLength >= bytes.length) {
i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result);
continue;
}
// Remove the length prefix from the char
@ -7209,6 +7272,7 @@
var nextChar = bytes[i];
// Invalid continuation byte
if ((nextChar & 0xc0) != 0x80) {
i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result);
res = null;
break;
}
@ -7216,31 +7280,23 @@
res = (res << 6) | (nextChar & 0x3f);
i++;
}
// See above loop for invalid contimuation byte
if (res === null) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; invalid continuation byte");
}
continue;
}
// Check for overlong seuences (more bytes than needed)
if (res <= overlongMask) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; overlong");
}
continue;
}
// Maximum code point
if (res > 0x10ffff) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; out-of-range");
}
i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res);
continue;
}
// Reserved for UTF-16 surrogate halves
if (res >= 0xd800 && res <= 0xdfff) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; utf-16 surrogate");
}
i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res);
continue;
}
// Check for overlong sequences (more bytes than needed)
if (res <= overlongMask) {
i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res);
continue;
}
result.push(res);
@ -7291,8 +7347,8 @@
var hex = ("0000" + value.toString(16));
return "\\u" + hex.substring(hex.length - 4);
}
function _toEscapedUtf8String(bytes, ignoreErrors) {
return '"' + getUtf8CodePoints(bytes, ignoreErrors).map(function (codePoint) {
function _toEscapedUtf8String(bytes, onError) {
return '"' + getUtf8CodePoints(bytes, onError).map(function (codePoint) {
if (codePoint < 256) {
switch (codePoint) {
case 8: return "\\b";
@ -7324,8 +7380,8 @@
}).join("");
}
exports._toUtf8String = _toUtf8String;
function toUtf8String(bytes, ignoreErrors) {
return _toUtf8String(getUtf8CodePoints(bytes, ignoreErrors));
function toUtf8String(bytes, onError) {
return _toUtf8String(getUtf8CodePoints(bytes, onError));
}
exports.toUtf8String = toUtf8String;
function toUtf8CodePoints(str, form) {
@ -7337,11 +7393,13 @@
var utf8$1 = unwrapExports(utf8);
var utf8_1 = utf8.UnicodeNormalizationForm;
var utf8_2 = utf8.toUtf8Bytes;
var utf8_3 = utf8._toEscapedUtf8String;
var utf8_4 = utf8._toUtf8String;
var utf8_5 = utf8.toUtf8String;
var utf8_6 = utf8.toUtf8CodePoints;
var utf8_2 = utf8.Utf8ErrorReason;
var utf8_3 = utf8.Utf8ErrorFuncs;
var utf8_4 = utf8.toUtf8Bytes;
var utf8_5 = utf8._toEscapedUtf8String;
var utf8_6 = utf8._toUtf8String;
var utf8_7 = utf8.toUtf8String;
var utf8_8 = utf8.toUtf8CodePoints;
var bytes32 = createCommonjsModule(function (module, exports) {
"use strict";
@ -7599,6 +7657,8 @@
exports.toUtf8CodePoints = utf8.toUtf8CodePoints;
exports.toUtf8String = utf8.toUtf8String;
exports.UnicodeNormalizationForm = utf8.UnicodeNormalizationForm;
exports.Utf8ErrorFuncs = utf8.Utf8ErrorFuncs;
exports.Utf8ErrorReason = utf8.Utf8ErrorReason;
});
var index$8 = unwrapExports(lib$8);
@ -7610,6 +7670,8 @@
var lib_6$3 = lib$8.toUtf8CodePoints;
var lib_7$3 = lib$8.toUtf8String;
var lib_8$2 = lib$8.UnicodeNormalizationForm;
var lib_9$2 = lib$8.Utf8ErrorFuncs;
var lib_10$1 = lib$8.Utf8ErrorReason;
var string = createCommonjsModule(function (module, exports) {
"use strict";
@ -8341,8 +8403,8 @@
var lib_6$4 = lib$a.ParamType;
var lib_7$4 = lib$a.AbiCoder;
var lib_8$3 = lib$a.defaultAbiCoder;
var lib_9$2 = lib$a.Indexed;
var lib_10$1 = lib$a.Interface;
var lib_9$3 = lib$a.Indexed;
var lib_10$2 = lib$a.Interface;
var _version$g = createCommonjsModule(function (module, exports) {
"use strict";
@ -10861,7 +10923,7 @@
var _version$m = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "sha2/5.0.0-beta.133";
exports.version = "sha2/5.0.0-beta.134";
});
var _version$n = unwrapExports(_version$m);
@ -10882,11 +10944,11 @@
var logger = new lib.Logger(_version$m.version);
var SupportedAlgorithms;
(function (SupportedAlgorithms) {
SupportedAlgorithms["sha256"] = "sha256";
SupportedAlgorithms["sha512"] = "sha512";
})(SupportedAlgorithms = exports.SupportedAlgorithms || (exports.SupportedAlgorithms = {}));
var SupportedAlgorithm;
(function (SupportedAlgorithm) {
SupportedAlgorithm["sha256"] = "sha256";
SupportedAlgorithm["sha512"] = "sha512";
})(SupportedAlgorithm = exports.SupportedAlgorithm || (exports.SupportedAlgorithm = {}));
;
function ripemd160(data) {
return "0x" + (hash.ripemd160().update(lib$1.arrayify(data)).digest("hex"));
@ -10901,7 +10963,7 @@
}
exports.sha512 = sha512;
function computeHmac(algorithm, key, data) {
if (!SupportedAlgorithms[algorithm]) {
if (!SupportedAlgorithm[algorithm]) {
logger.throwError("unsupported algorithm " + algorithm, lib.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "hmac",
algorithm: algorithm
@ -10913,7 +10975,7 @@
});
var browser$1 = unwrapExports(browser);
var browser_1 = browser.SupportedAlgorithms;
var browser_1 = browser.SupportedAlgorithm;
var browser_2 = browser.ripemd160;
var browser_3 = browser.sha256;
var browser_4 = browser.sha512;
@ -13751,7 +13813,7 @@
var _version$u = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "hdnode/5.0.0-beta.136";
exports.version = "hdnode/5.0.0-beta.137";
});
var _version$v = unwrapExports(_version$u);
@ -13906,7 +13968,7 @@
for (var i = 24; i >= 0; i -= 8) {
data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff);
}
var I = lib$1.arrayify(browser.computeHmac(browser.SupportedAlgorithms.sha512, this.chainCode, data));
var I = lib$1.arrayify(browser.computeHmac(browser.SupportedAlgorithm.sha512, this.chainCode, data));
var IL = I.slice(0, 32);
var IR = I.slice(32);
// The private key
@ -13967,7 +14029,7 @@
if (seedArray.length < 16 || seedArray.length > 64) {
throw new Error("invalid seed");
}
var I = lib$1.arrayify(browser.computeHmac(browser.SupportedAlgorithms.sha512, MasterSecret, seedArray));
var I = lib$1.arrayify(browser.computeHmac(browser.SupportedAlgorithm.sha512, MasterSecret, seedArray));
return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic);
};
HDNode.fromMnemonic = function (mnemonic, password, wordlist) {
@ -17599,7 +17661,7 @@
var _version$G = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "providers/5.0.0-beta.149";
exports.version = "providers/5.0.0-beta.150";
});
var _version$H = unwrapExports(_version$G);
@ -21311,8 +21373,8 @@
var lib_6$7 = lib$m.EtherscanProvider;
var lib_7$6 = lib$m.FallbackProvider;
var lib_8$4 = lib$m.IpcProvider;
var lib_9$3 = lib$m.InfuraProvider;
var lib_10$2 = lib$m.JsonRpcProvider;
var lib_9$4 = lib$m.InfuraProvider;
var lib_10$3 = lib$m.JsonRpcProvider;
var lib_11$1 = lib$m.JsonRpcSigner;
var lib_12$1 = lib$m.NodesmithProvider;
var lib_13$1 = lib$m.Web3Provider;
@ -21609,6 +21671,7 @@
exports.toUtf8Bytes = lib$8.toUtf8Bytes;
exports.toUtf8CodePoints = lib$8.toUtf8CodePoints;
exports.toUtf8String = lib$8.toUtf8String;
exports.Utf8ErrorFuncs = lib$8.Utf8ErrorFuncs;
exports.computeAddress = lib$g.computeAddress;
exports.parseTransaction = lib$g.parse;
@ -21628,9 +21691,10 @@
////////////////////////
// Enums
var sha2_2 = browser;
exports.SupportedAlgorithms = sha2_2.SupportedAlgorithms;
exports.SupportedAlgorithm = sha2_2.SupportedAlgorithm;
var strings_2 = lib$8;
exports.UnicodeNormalizationForm = strings_2.UnicodeNormalizationForm;
exports.Utf8ErrorReason = strings_2.Utf8ErrorReason;
});
var utils$4 = unwrapExports(utils$3);
@ -21697,25 +21761,27 @@
var utils_61 = utils$3.toUtf8Bytes;
var utils_62 = utils$3.toUtf8CodePoints;
var utils_63 = utils$3.toUtf8String;
var utils_64 = utils$3.computeAddress;
var utils_65 = utils$3.parseTransaction;
var utils_66 = utils$3.recoverAddress;
var utils_67 = utils$3.serializeTransaction;
var utils_68 = utils$3.commify;
var utils_69 = utils$3.formatEther;
var utils_70 = utils$3.parseEther;
var utils_71 = utils$3.formatUnits;
var utils_72 = utils$3.parseUnits;
var utils_73 = utils$3.verifyMessage;
var utils_74 = utils$3.fetchJson;
var utils_75 = utils$3.poll;
var utils_76 = utils$3.SupportedAlgorithms;
var utils_77 = utils$3.UnicodeNormalizationForm;
var utils_64 = utils$3.Utf8ErrorFuncs;
var utils_65 = utils$3.computeAddress;
var utils_66 = utils$3.parseTransaction;
var utils_67 = utils$3.recoverAddress;
var utils_68 = utils$3.serializeTransaction;
var utils_69 = utils$3.commify;
var utils_70 = utils$3.formatEther;
var utils_71 = utils$3.parseEther;
var utils_72 = utils$3.formatUnits;
var utils_73 = utils$3.parseUnits;
var utils_74 = utils$3.verifyMessage;
var utils_75 = utils$3.fetchJson;
var utils_76 = utils$3.poll;
var utils_77 = utils$3.SupportedAlgorithm;
var utils_78 = utils$3.UnicodeNormalizationForm;
var utils_79 = utils$3.Utf8ErrorReason;
var _version$K = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.0-beta.168";
exports.version = "ethers/5.0.0-beta.169";
});
var _version$L = unwrapExports(_version$K);
@ -21833,8 +21899,8 @@
var lib_6$8 = lib$p.providers;
var lib_7$7 = lib$p.Contract;
var lib_8$5 = lib$p.ContractFactory;
var lib_9$4 = lib$p.BigNumber;
var lib_10$3 = lib$p.FixedNumber;
var lib_9$5 = lib$p.BigNumber;
var lib_10$4 = lib$p.FixedNumber;
var lib_11$2 = lib$p.constants;
var lib_12$2 = lib$p.errors;
var lib_13$2 = lib$p.logger;
@ -21843,10 +21909,10 @@
var lib_16$1 = lib$p.version;
var lib_17 = lib$p.Wordlist;
exports.BigNumber = lib_9$4;
exports.BigNumber = lib_9$5;
exports.Contract = lib_7$7;
exports.ContractFactory = lib_8$5;
exports.FixedNumber = lib_10$3;
exports.FixedNumber = lib_10$4;
exports.Signer = lib_2$m;
exports.VoidSigner = lib_4$e;
exports.Wallet = lib_3$h;

File diff suppressed because one or more lines are too long

@ -1 +1 @@
export declare const version = "ethers/5.0.0-beta.168";
export declare const version = "ethers/5.0.0-beta.169";

@ -1 +1 @@
export const version = "ethers/5.0.0-beta.168";
export const version = "ethers/5.0.0-beta.169";

@ -13,16 +13,17 @@ import { randomBytes } from "@ethersproject/random";
import { checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy } from "@ethersproject/properties";
import * as RLP from "@ethersproject/rlp";
import { computePublicKey, recoverPublicKey, SigningKey } from "@ethersproject/signing-key";
import { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String } from "@ethersproject/strings";
import { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs } from "@ethersproject/strings";
import { computeAddress, parse as parseTransaction, recoverAddress, serialize as serializeTransaction } from "@ethersproject/transactions";
import { commify, formatEther, parseEther, formatUnits, parseUnits } from "@ethersproject/units";
import { verifyMessage } from "@ethersproject/wallet";
import { fetchJson, poll } from "@ethersproject/web";
import { SupportedAlgorithms } from "@ethersproject/sha2";
import { UnicodeNormalizationForm } from "@ethersproject/strings";
import { SupportedAlgorithm } from "@ethersproject/sha2";
import { UnicodeNormalizationForm, Utf8ErrorReason } from "@ethersproject/strings";
import { CoerceFunc } from "@ethersproject/abi";
import { Bytes, BytesLike, Hexable } from "@ethersproject/bytes";
import { Mnemonic } from "@ethersproject/hdnode";
import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
import { Utf8ErrorFunc } from "@ethersproject/strings";
import { ConnectionInfo, FetchJsonResponse, OnceBlockable, PollOptions } from "@ethersproject/web";
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithms, UnicodeNormalizationForm, Bytes, BytesLike, Hexable, CoerceFunc, Indexed, Mnemonic, ConnectionInfo, OnceBlockable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, CoerceFunc, Indexed, Mnemonic, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };

@ -14,18 +14,18 @@ import { randomBytes } from "@ethersproject/random";
import { checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy } from "@ethersproject/properties";
import * as RLP from "@ethersproject/rlp";
import { computePublicKey, recoverPublicKey, SigningKey } from "@ethersproject/signing-key";
import { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String } from "@ethersproject/strings";
import { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs } from "@ethersproject/strings";
import { computeAddress, parse as parseTransaction, recoverAddress, serialize as serializeTransaction } from "@ethersproject/transactions";
import { commify, formatEther, parseEther, formatUnits, parseUnits } from "@ethersproject/units";
import { verifyMessage } from "@ethersproject/wallet";
import { fetchJson, poll } from "@ethersproject/web";
////////////////////////
// Enums
import { SupportedAlgorithms } from "@ethersproject/sha2";
import { UnicodeNormalizationForm } from "@ethersproject/strings";
import { SupportedAlgorithm } from "@ethersproject/sha2";
import { UnicodeNormalizationForm, Utf8ErrorReason } from "@ethersproject/strings";
////////////////////////
// Exports
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed,
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed,
////////////////////////
// Enums
SupportedAlgorithms, UnicodeNormalizationForm, Indexed };
SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Indexed };

@ -1 +1 @@
export declare const version = "ethers/5.0.0-beta.168";
export declare const version = "ethers/5.0.0-beta.169";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.0-beta.168";
exports.version = "ethers/5.0.0-beta.169";

@ -13,16 +13,17 @@ import { randomBytes } from "@ethersproject/random";
import { checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy } from "@ethersproject/properties";
import * as RLP from "@ethersproject/rlp";
import { computePublicKey, recoverPublicKey, SigningKey } from "@ethersproject/signing-key";
import { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String } from "@ethersproject/strings";
import { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs } from "@ethersproject/strings";
import { computeAddress, parse as parseTransaction, recoverAddress, serialize as serializeTransaction } from "@ethersproject/transactions";
import { commify, formatEther, parseEther, formatUnits, parseUnits } from "@ethersproject/units";
import { verifyMessage } from "@ethersproject/wallet";
import { fetchJson, poll } from "@ethersproject/web";
import { SupportedAlgorithms } from "@ethersproject/sha2";
import { UnicodeNormalizationForm } from "@ethersproject/strings";
import { SupportedAlgorithm } from "@ethersproject/sha2";
import { UnicodeNormalizationForm, Utf8ErrorReason } from "@ethersproject/strings";
import { CoerceFunc } from "@ethersproject/abi";
import { Bytes, BytesLike, Hexable } from "@ethersproject/bytes";
import { Mnemonic } from "@ethersproject/hdnode";
import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
import { Utf8ErrorFunc } from "@ethersproject/strings";
import { ConnectionInfo, FetchJsonResponse, OnceBlockable, PollOptions } from "@ethersproject/web";
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithms, UnicodeNormalizationForm, Bytes, BytesLike, Hexable, CoerceFunc, Indexed, Mnemonic, ConnectionInfo, OnceBlockable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, CoerceFunc, Indexed, Mnemonic, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };

@ -86,6 +86,7 @@ exports._toEscapedUtf8String = strings_1._toEscapedUtf8String;
exports.toUtf8Bytes = strings_1.toUtf8Bytes;
exports.toUtf8CodePoints = strings_1.toUtf8CodePoints;
exports.toUtf8String = strings_1.toUtf8String;
exports.Utf8ErrorFuncs = strings_1.Utf8ErrorFuncs;
var transactions_1 = require("@ethersproject/transactions");
exports.computeAddress = transactions_1.computeAddress;
exports.parseTransaction = transactions_1.parse;
@ -105,6 +106,7 @@ exports.poll = web_1.poll;
////////////////////////
// Enums
var sha2_2 = require("@ethersproject/sha2");
exports.SupportedAlgorithms = sha2_2.SupportedAlgorithms;
exports.SupportedAlgorithm = sha2_2.SupportedAlgorithm;
var strings_2 = require("@ethersproject/strings");
exports.UnicodeNormalizationForm = strings_2.UnicodeNormalizationForm;
exports.Utf8ErrorReason = strings_2.Utf8ErrorReason;

@ -52,7 +52,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xd2458e8f583078acc6e85b0981829a44296694a4f6f64b3dec48d6ae120a6e2e",
"tarballHash": "0x0be2fd19526c4a53003df509398cf5266a60b9f3792c534e5cb0178af97faa01",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.168"
"version": "5.0.0-beta.169"
}

@ -1 +1 @@
export const version = "ethers/5.0.0-beta.168";
export const version = "ethers/5.0.0-beta.169";

@ -1 +1 @@
export declare const version = "hdnode/5.0.0-beta.136";
export declare const version = "hdnode/5.0.0-beta.137";

@ -1 +1 @@
export const version = "hdnode/5.0.0-beta.136";
export const version = "hdnode/5.0.0-beta.137";

@ -6,7 +6,7 @@ import { toUtf8Bytes, UnicodeNormalizationForm } from "@ethersproject/strings";
import { pbkdf2 } from "@ethersproject/pbkdf2";
import { defineReadOnly } from "@ethersproject/properties";
import { SigningKey } from "@ethersproject/signing-key";
import { computeHmac, ripemd160, sha256, SupportedAlgorithms } from "@ethersproject/sha2";
import { computeHmac, ripemd160, sha256, SupportedAlgorithm } from "@ethersproject/sha2";
import { computeAddress } from "@ethersproject/transactions";
import { wordlists } from "@ethersproject/wordlists";
import { Logger } from "@ethersproject/logger";
@ -140,7 +140,7 @@ export class HDNode {
for (let i = 24; i >= 0; i -= 8) {
data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff);
}
const I = arrayify(computeHmac(SupportedAlgorithms.sha512, this.chainCode, data));
const I = arrayify(computeHmac(SupportedAlgorithm.sha512, this.chainCode, data));
const IL = I.slice(0, 32);
const IR = I.slice(32);
// The private key
@ -201,7 +201,7 @@ export class HDNode {
if (seedArray.length < 16 || seedArray.length > 64) {
throw new Error("invalid seed");
}
const I = arrayify(computeHmac(SupportedAlgorithms.sha512, MasterSecret, seedArray));
const I = arrayify(computeHmac(SupportedAlgorithm.sha512, MasterSecret, seedArray));
return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic);
}
static fromMnemonic(mnemonic, password, wordlist) {

@ -1 +1 @@
export declare const version = "hdnode/5.0.0-beta.136";
export declare const version = "hdnode/5.0.0-beta.137";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "hdnode/5.0.0-beta.136";
exports.version = "hdnode/5.0.0-beta.137";

@ -146,7 +146,7 @@ var HDNode = /** @class */ (function () {
for (var i = 24; i >= 0; i -= 8) {
data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff);
}
var I = bytes_1.arrayify(sha2_1.computeHmac(sha2_1.SupportedAlgorithms.sha512, this.chainCode, data));
var I = bytes_1.arrayify(sha2_1.computeHmac(sha2_1.SupportedAlgorithm.sha512, this.chainCode, data));
var IL = I.slice(0, 32);
var IR = I.slice(32);
// The private key
@ -207,7 +207,7 @@ var HDNode = /** @class */ (function () {
if (seedArray.length < 16 || seedArray.length > 64) {
throw new Error("invalid seed");
}
var I = bytes_1.arrayify(sha2_1.computeHmac(sha2_1.SupportedAlgorithms.sha512, MasterSecret, seedArray));
var I = bytes_1.arrayify(sha2_1.computeHmac(sha2_1.SupportedAlgorithm.sha512, MasterSecret, seedArray));
return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic);
};
HDNode.fromMnemonic = function (mnemonic, password, wordlist) {

@ -34,7 +34,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xa43980246d4b508f2256f933a40f8863cc6556a3ae041f4036ff91531a23b34a",
"tarballHash": "0xbf0a4cf98cdf0fea180c9bfe5faa96d989123e583226c39d6dd069f6e394aefd",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.136"
"version": "5.0.0-beta.137"
}

@ -1 +1 @@
export const version = "hdnode/5.0.0-beta.136";
export const version = "hdnode/5.0.0-beta.137";

@ -1 +1 @@
export declare const version = "pbkdf2/5.0.0-beta.132";
export declare const version = "pbkdf2/5.0.0-beta.133";

@ -1 +1 @@
export const version = "pbkdf2/5.0.0-beta.132";
export const version = "pbkdf2/5.0.0-beta.133";

@ -1 +1 @@
export declare const version = "pbkdf2/5.0.0-beta.132";
export declare const version = "pbkdf2/5.0.0-beta.133";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "pbkdf2/5.0.0-beta.132";
exports.version = "pbkdf2/5.0.0-beta.133";

@ -26,7 +26,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x8d025cc9c546a29ecf25b038a88a7e4f7700f370e312469cad1c4b054b4e9197",
"tarballHash": "0xfed19ad4c14e90e622205417848d4772e6331b3cfd84664776134578a781c485",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.132"
"version": "5.0.0-beta.133"
}

@ -1 +1 @@
export const version = "pbkdf2/5.0.0-beta.132";
export const version = "pbkdf2/5.0.0-beta.133";

@ -1 +1 @@
export declare const version = "providers/5.0.0-beta.149";
export declare const version = "providers/5.0.0-beta.150";

@ -1 +1 @@
export const version = "providers/5.0.0-beta.149";
export const version = "providers/5.0.0-beta.150";

@ -2,7 +2,7 @@ import { Network, Networkish } from "@ethersproject/networks";
import { ConnectionInfo } from "@ethersproject/web";
import { JsonRpcProvider, JsonRpcSigner } from "./json-rpc-provider";
export declare abstract class UrlJsonRpcProvider extends JsonRpcProvider {
readonly apiKey: string;
readonly apiKey: any;
constructor(network?: Networkish, apiKey?: any);
_startPending(): void;
getSigner(address?: string): JsonRpcSigner;

@ -1 +1 @@
export declare const version = "providers/5.0.0-beta.149";
export declare const version = "providers/5.0.0-beta.150";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "providers/5.0.0-beta.149";
exports.version = "providers/5.0.0-beta.150";

@ -2,7 +2,7 @@ import { Network, Networkish } from "@ethersproject/networks";
import { ConnectionInfo } from "@ethersproject/web";
import { JsonRpcProvider, JsonRpcSigner } from "./json-rpc-provider";
export declare abstract class UrlJsonRpcProvider extends JsonRpcProvider {
readonly apiKey: string;
readonly apiKey: any;
constructor(network?: Networkish, apiKey?: any);
_startPending(): void;
getSigner(address?: string): JsonRpcSigner;

@ -44,7 +44,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x17f5c367931769b5f2a2f01413f99c4308a255dc65e779779bf1d75b54fbe30a",
"tarballHash": "0x9b8cc17fb3a150bfaac9db6721a6664786217ef20fc47954aa1bfc94e1b2689e",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.149"
"version": "5.0.0-beta.150"
}

@ -1 +1 @@
export const version = "providers/5.0.0-beta.149";
export const version = "providers/5.0.0-beta.150";

@ -1 +1 @@
export declare const version = "sha2/5.0.0-beta.133";
export declare const version = "sha2/5.0.0-beta.134";

@ -1 +1 @@
export const version = "sha2/5.0.0-beta.133";
export const version = "sha2/5.0.0-beta.134";

@ -4,11 +4,11 @@ import { arrayify } from "@ethersproject/bytes";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
export var SupportedAlgorithms;
(function (SupportedAlgorithms) {
SupportedAlgorithms["sha256"] = "sha256";
SupportedAlgorithms["sha512"] = "sha512";
})(SupportedAlgorithms || (SupportedAlgorithms = {}));
export var SupportedAlgorithm;
(function (SupportedAlgorithm) {
SupportedAlgorithm["sha256"] = "sha256";
SupportedAlgorithm["sha512"] = "sha512";
})(SupportedAlgorithm || (SupportedAlgorithm = {}));
;
export function ripemd160(data) {
return "0x" + (hash.ripemd160().update(arrayify(data)).digest("hex"));
@ -20,7 +20,7 @@ export function sha512(data) {
return "0x" + (hash.sha512().update(arrayify(data)).digest("hex"));
}
export function computeHmac(algorithm, key, data) {
if (!SupportedAlgorithms[algorithm]) {
if (!SupportedAlgorithm[algorithm]) {
logger.throwError("unsupported algorithm " + algorithm, Logger.errors.UNSUPPORTED_OPERATION, {
operation: "hmac",
algorithm: algorithm

@ -1,9 +1,9 @@
import { BytesLike } from '@ethersproject/bytes';
export declare enum SupportedAlgorithms {
export declare enum SupportedAlgorithm {
sha256 = "sha256",
sha512 = "sha512"
}
export declare function ripemd160(data: BytesLike): string;
export declare function sha256(data: BytesLike): string;
export declare function sha512(data: BytesLike): string;
export declare function computeHmac(algorithm: SupportedAlgorithms, key: BytesLike, data: BytesLike): string;
export declare function computeHmac(algorithm: SupportedAlgorithm, key: BytesLike, data: BytesLike): string;

@ -4,11 +4,11 @@ import { arrayify } from '@ethersproject/bytes';
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
export var SupportedAlgorithms;
(function (SupportedAlgorithms) {
SupportedAlgorithms["sha256"] = "sha256";
SupportedAlgorithms["sha512"] = "sha512";
})(SupportedAlgorithms || (SupportedAlgorithms = {}));
export var SupportedAlgorithm;
(function (SupportedAlgorithm) {
SupportedAlgorithm["sha256"] = "sha256";
SupportedAlgorithm["sha512"] = "sha512";
})(SupportedAlgorithm || (SupportedAlgorithm = {}));
;
export function ripemd160(data) {
return "0x" + createHash("ripemd160").update(Buffer.from(arrayify(data))).digest("hex");
@ -20,7 +20,7 @@ export function sha512(data) {
return "0x" + createHash("sha512").update(Buffer.from(arrayify(data))).digest("hex");
}
export function computeHmac(algorithm, key, data) {
if (!SupportedAlgorithms[algorithm]) {
if (!SupportedAlgorithm[algorithm]) {
logger.throwError("unsupported algorithm - " + algorithm, Logger.errors.UNSUPPORTED_OPERATION, {
operation: "computeHmac",
algorithm: algorithm

@ -1 +1 @@
export declare const version = "sha2/5.0.0-beta.133";
export declare const version = "sha2/5.0.0-beta.134";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "sha2/5.0.0-beta.133";
exports.version = "sha2/5.0.0-beta.134";

@ -12,11 +12,11 @@ var bytes_1 = require("@ethersproject/bytes");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
var SupportedAlgorithms;
(function (SupportedAlgorithms) {
SupportedAlgorithms["sha256"] = "sha256";
SupportedAlgorithms["sha512"] = "sha512";
})(SupportedAlgorithms = exports.SupportedAlgorithms || (exports.SupportedAlgorithms = {}));
var SupportedAlgorithm;
(function (SupportedAlgorithm) {
SupportedAlgorithm["sha256"] = "sha256";
SupportedAlgorithm["sha512"] = "sha512";
})(SupportedAlgorithm = exports.SupportedAlgorithm || (exports.SupportedAlgorithm = {}));
;
function ripemd160(data) {
return "0x" + (hash.ripemd160().update(bytes_1.arrayify(data)).digest("hex"));
@ -31,7 +31,7 @@ function sha512(data) {
}
exports.sha512 = sha512;
function computeHmac(algorithm, key, data) {
if (!SupportedAlgorithms[algorithm]) {
if (!SupportedAlgorithm[algorithm]) {
logger.throwError("unsupported algorithm " + algorithm, logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "hmac",
algorithm: algorithm

@ -1,9 +1,9 @@
import { BytesLike } from '@ethersproject/bytes';
export declare enum SupportedAlgorithms {
export declare enum SupportedAlgorithm {
sha256 = "sha256",
sha512 = "sha512"
}
export declare function ripemd160(data: BytesLike): string;
export declare function sha256(data: BytesLike): string;
export declare function sha512(data: BytesLike): string;
export declare function computeHmac(algorithm: SupportedAlgorithms, key: BytesLike, data: BytesLike): string;
export declare function computeHmac(algorithm: SupportedAlgorithm, key: BytesLike, data: BytesLike): string;

@ -5,11 +5,11 @@ var bytes_1 = require("@ethersproject/bytes");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
var SupportedAlgorithms;
(function (SupportedAlgorithms) {
SupportedAlgorithms["sha256"] = "sha256";
SupportedAlgorithms["sha512"] = "sha512";
})(SupportedAlgorithms = exports.SupportedAlgorithms || (exports.SupportedAlgorithms = {}));
var SupportedAlgorithm;
(function (SupportedAlgorithm) {
SupportedAlgorithm["sha256"] = "sha256";
SupportedAlgorithm["sha512"] = "sha512";
})(SupportedAlgorithm = exports.SupportedAlgorithm || (exports.SupportedAlgorithm = {}));
;
function ripemd160(data) {
return "0x" + crypto_1.createHash("ripemd160").update(Buffer.from(bytes_1.arrayify(data))).digest("hex");
@ -24,7 +24,7 @@ function sha512(data) {
}
exports.sha512 = sha512;
function computeHmac(algorithm, key, data) {
if (!SupportedAlgorithms[algorithm]) {
if (!SupportedAlgorithm[algorithm]) {
logger.throwError("unsupported algorithm - " + algorithm, logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "computeHmac",
algorithm: algorithm

@ -26,7 +26,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xe451c587c6d3c247b8a1b3e0f10be6eb689c345ed60bcc33ce0ac263c5bce041",
"tarballHash": "0x31e6321a49abc6e031310288ddab8b6b7fb5fa53899c264eecd28ca05cdbcf7a",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.133"
"version": "5.0.0-beta.134"
}

@ -1 +1 @@
export const version = "sha2/5.0.0-beta.133";
export const version = "sha2/5.0.0-beta.134";

@ -1 +1 @@
export declare const version = "strings/5.0.0-beta.135";
export declare const version = "strings/5.0.0-beta.136";

@ -1 +1 @@
export const version = "strings/5.0.0-beta.135";
export const version = "strings/5.0.0-beta.136";

@ -1,4 +1,4 @@
import { formatBytes32String, parseBytes32String } from "./bytes32";
import { nameprep } from "./idna";
import { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, UnicodeNormalizationForm } from "./utf8";
export { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, UnicodeNormalizationForm, formatBytes32String, parseBytes32String, nameprep };
import { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, UnicodeNormalizationForm, Utf8ErrorFunc, Utf8ErrorFuncs, Utf8ErrorReason } from "./utf8";
export { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFunc, Utf8ErrorFuncs, Utf8ErrorReason, UnicodeNormalizationForm, formatBytes32String, parseBytes32String, nameprep };

@ -1,5 +1,5 @@
"use strict";
import { formatBytes32String, parseBytes32String } from "./bytes32";
import { nameprep } from "./idna";
import { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, UnicodeNormalizationForm } from "./utf8";
export { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, UnicodeNormalizationForm, formatBytes32String, parseBytes32String, nameprep };
import { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, UnicodeNormalizationForm, Utf8ErrorFuncs, Utf8ErrorReason } from "./utf8";
export { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, Utf8ErrorReason, UnicodeNormalizationForm, formatBytes32String, parseBytes32String, nameprep };

@ -6,8 +6,21 @@ export declare enum UnicodeNormalizationForm {
NFKC = "NFKC",
NFKD = "NFKD"
}
export declare enum Utf8ErrorReason {
UNEXPECTED_CONTINUE = "unexpected continuation byte",
BAD_PREFIX = "bad codepoint prefix",
OVERRUN = "string overrun",
MISSING_CONTINUE = "missing continuation byte",
OUT_OF_RANGE = "out of UTF-8 range",
UTF16_SURROGATE = "UTF-16 surrogate",
OVERLONG = "overlong representation"
}
export declare type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: ArrayLike<number>, output: Array<number>, badCodepoint?: number) => number;
export declare const Utf8ErrorFuncs: {
[name: string]: Utf8ErrorFunc;
};
export declare function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array;
export declare function _toEscapedUtf8String(bytes: BytesLike, ignoreErrors?: boolean): string;
export declare function _toEscapedUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string;
export declare function _toUtf8String(codePoints: Array<number>): string;
export declare function toUtf8String(bytes: BytesLike, ignoreErrors?: boolean): string;
export declare function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string;
export declare function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array<number>;

@ -13,8 +13,79 @@ export var UnicodeNormalizationForm;
UnicodeNormalizationForm["NFKD"] = "NFKD";
})(UnicodeNormalizationForm || (UnicodeNormalizationForm = {}));
;
export var Utf8ErrorReason;
(function (Utf8ErrorReason) {
// A continuation byte was present where there was nothing to continue
// - offset = the index the codepoint began in
Utf8ErrorReason["UNEXPECTED_CONTINUE"] = "unexpected continuation byte";
// An invalid (non-continuation) byte to start a UTF-8 codepoint was found
// - offset = the index the codepoint began in
Utf8ErrorReason["BAD_PREFIX"] = "bad codepoint prefix";
// The string is too short to process the expected codepoint
// - offset = the index the codepoint began in
Utf8ErrorReason["OVERRUN"] = "string overrun";
// A missing continuation byte was expected but not found
// - offset = the index the continuation byte was expected at
Utf8ErrorReason["MISSING_CONTINUE"] = "missing continuation byte";
// The computed code point is outside the range for UTF-8
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; outside the UTF-8 range
Utf8ErrorReason["OUT_OF_RANGE"] = "out of UTF-8 range";
// UTF-8 strings may not contain UTF-16 surrogate pairs
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range
Utf8ErrorReason["UTF16_SURROGATE"] = "UTF-16 surrogate";
// The string is an overlong reperesentation
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; already bounds checked
Utf8ErrorReason["OVERLONG"] = "overlong representation";
})(Utf8ErrorReason || (Utf8ErrorReason = {}));
;
function errorFunc(reason, offset, bytes, output, badCodepoint) {
return logger.throwArgumentError(`invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes);
}
function ignoreFunc(reason, offset, bytes, output, badCodepoint) {
// If there is an invalid prefix (including stray continuation), skip any additional continuation bytes
if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) {
let i = 0;
for (let o = offset + 1; o < bytes.length; o++) {
if (bytes[o] >> 6 !== 0x02) {
break;
}
i++;
}
return i;
}
// This byte runs us past the end of the string, so just jump to the end
// (but the first byte was read already read and therefore skipped)
if (reason === Utf8ErrorReason.OVERRUN) {
return bytes.length - offset - 1;
}
// Nothing to skip
return 0;
}
function replaceFunc(reason, offset, bytes, output, badCodepoint) {
// Overlong representations are otherwise "valid" code points; just non-deistingtished
if (reason === Utf8ErrorReason.OVERLONG) {
output.push(badCodepoint);
return 0;
}
// Put the replacement character into the output
output.push(0xfffd);
// Otherwise, process as if ignoring errors
return ignoreFunc(reason, offset, bytes, output, badCodepoint);
}
// Common error handing strategies
export const Utf8ErrorFuncs = Object.freeze({
error: errorFunc,
ignore: ignoreFunc,
replace: replaceFunc
});
// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499
function getUtf8CodePoints(bytes, ignoreErrors) {
function getUtf8CodePoints(bytes, onError) {
if (onError == null) {
onError = Utf8ErrorFuncs.error;
}
bytes = arrayify(bytes);
const result = [];
let i = 0;
@ -45,25 +116,17 @@ function getUtf8CodePoints(bytes, ignoreErrors) {
overlongMask = 0xffff;
}
else {
if (!ignoreErrors) {
if ((c & 0xc0) === 0x80) {
throw new Error("invalid utf8 byte sequence; unexpected continuation byte");
}
throw new Error("invalid utf8 byte sequence; invalid prefix");
if ((c & 0xc0) === 0x80) {
i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result);
}
else {
i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result);
}
continue;
}
// Do we have enough bytes in our data?
if (i + extraLength > bytes.length) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; too short");
}
// If there is an invalid unprocessed byte, skip continuation bytes
for (; i < bytes.length; i++) {
if (bytes[i] >> 6 !== 0x02) {
break;
}
}
if (i - 1 + extraLength >= bytes.length) {
i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result);
continue;
}
// Remove the length prefix from the char
@ -72,6 +135,7 @@ function getUtf8CodePoints(bytes, ignoreErrors) {
let nextChar = bytes[i];
// Invalid continuation byte
if ((nextChar & 0xc0) != 0x80) {
i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result);
res = null;
break;
}
@ -79,31 +143,23 @@ function getUtf8CodePoints(bytes, ignoreErrors) {
res = (res << 6) | (nextChar & 0x3f);
i++;
}
// See above loop for invalid contimuation byte
if (res === null) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; invalid continuation byte");
}
continue;
}
// Check for overlong seuences (more bytes than needed)
if (res <= overlongMask) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; overlong");
}
continue;
}
// Maximum code point
if (res > 0x10ffff) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; out-of-range");
}
i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res);
continue;
}
// Reserved for UTF-16 surrogate halves
if (res >= 0xd800 && res <= 0xdfff) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; utf-16 surrogate");
}
i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res);
continue;
}
// Check for overlong sequences (more bytes than needed)
if (res <= overlongMask) {
i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res);
continue;
}
result.push(res);
@ -152,8 +208,8 @@ function escapeChar(value) {
const hex = ("0000" + value.toString(16));
return "\\u" + hex.substring(hex.length - 4);
}
export function _toEscapedUtf8String(bytes, ignoreErrors) {
return '"' + getUtf8CodePoints(bytes, ignoreErrors).map((codePoint) => {
export function _toEscapedUtf8String(bytes, onError) {
return '"' + getUtf8CodePoints(bytes, onError).map((codePoint) => {
if (codePoint < 256) {
switch (codePoint) {
case 8: return "\\b";
@ -183,8 +239,8 @@ export function _toUtf8String(codePoints) {
return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00));
}).join("");
}
export function toUtf8String(bytes, ignoreErrors) {
return _toUtf8String(getUtf8CodePoints(bytes, ignoreErrors));
export function toUtf8String(bytes, onError) {
return _toUtf8String(getUtf8CodePoints(bytes, onError));
}
export function toUtf8CodePoints(str, form = UnicodeNormalizationForm.current) {
return getUtf8CodePoints(toUtf8Bytes(str, form));

@ -1 +1 @@
export declare const version = "strings/5.0.0-beta.135";
export declare const version = "strings/5.0.0-beta.136";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "strings/5.0.0-beta.135";
exports.version = "strings/5.0.0-beta.136";

@ -1,4 +1,4 @@
import { formatBytes32String, parseBytes32String } from "./bytes32";
import { nameprep } from "./idna";
import { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, UnicodeNormalizationForm } from "./utf8";
export { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, UnicodeNormalizationForm, formatBytes32String, parseBytes32String, nameprep };
import { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, UnicodeNormalizationForm, Utf8ErrorFunc, Utf8ErrorFuncs, Utf8ErrorReason } from "./utf8";
export { _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFunc, Utf8ErrorFuncs, Utf8ErrorReason, UnicodeNormalizationForm, formatBytes32String, parseBytes32String, nameprep };

@ -11,3 +11,5 @@ exports.toUtf8Bytes = utf8_1.toUtf8Bytes;
exports.toUtf8CodePoints = utf8_1.toUtf8CodePoints;
exports.toUtf8String = utf8_1.toUtf8String;
exports.UnicodeNormalizationForm = utf8_1.UnicodeNormalizationForm;
exports.Utf8ErrorFuncs = utf8_1.Utf8ErrorFuncs;
exports.Utf8ErrorReason = utf8_1.Utf8ErrorReason;

@ -6,8 +6,21 @@ export declare enum UnicodeNormalizationForm {
NFKC = "NFKC",
NFKD = "NFKD"
}
export declare enum Utf8ErrorReason {
UNEXPECTED_CONTINUE = "unexpected continuation byte",
BAD_PREFIX = "bad codepoint prefix",
OVERRUN = "string overrun",
MISSING_CONTINUE = "missing continuation byte",
OUT_OF_RANGE = "out of UTF-8 range",
UTF16_SURROGATE = "UTF-16 surrogate",
OVERLONG = "overlong representation"
}
export declare type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: ArrayLike<number>, output: Array<number>, badCodepoint?: number) => number;
export declare const Utf8ErrorFuncs: {
[name: string]: Utf8ErrorFunc;
};
export declare function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array;
export declare function _toEscapedUtf8String(bytes: BytesLike, ignoreErrors?: boolean): string;
export declare function _toEscapedUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string;
export declare function _toUtf8String(codePoints: Array<number>): string;
export declare function toUtf8String(bytes: BytesLike, ignoreErrors?: boolean): string;
export declare function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string;
export declare function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array<number>;

@ -14,8 +14,79 @@ var UnicodeNormalizationForm;
UnicodeNormalizationForm["NFKD"] = "NFKD";
})(UnicodeNormalizationForm = exports.UnicodeNormalizationForm || (exports.UnicodeNormalizationForm = {}));
;
var Utf8ErrorReason;
(function (Utf8ErrorReason) {
// A continuation byte was present where there was nothing to continue
// - offset = the index the codepoint began in
Utf8ErrorReason["UNEXPECTED_CONTINUE"] = "unexpected continuation byte";
// An invalid (non-continuation) byte to start a UTF-8 codepoint was found
// - offset = the index the codepoint began in
Utf8ErrorReason["BAD_PREFIX"] = "bad codepoint prefix";
// The string is too short to process the expected codepoint
// - offset = the index the codepoint began in
Utf8ErrorReason["OVERRUN"] = "string overrun";
// A missing continuation byte was expected but not found
// - offset = the index the continuation byte was expected at
Utf8ErrorReason["MISSING_CONTINUE"] = "missing continuation byte";
// The computed code point is outside the range for UTF-8
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; outside the UTF-8 range
Utf8ErrorReason["OUT_OF_RANGE"] = "out of UTF-8 range";
// UTF-8 strings may not contain UTF-16 surrogate pairs
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range
Utf8ErrorReason["UTF16_SURROGATE"] = "UTF-16 surrogate";
// The string is an overlong reperesentation
// - offset = start of this codepoint
// - badCodepoint = the computed codepoint; already bounds checked
Utf8ErrorReason["OVERLONG"] = "overlong representation";
})(Utf8ErrorReason = exports.Utf8ErrorReason || (exports.Utf8ErrorReason = {}));
;
function errorFunc(reason, offset, bytes, output, badCodepoint) {
return logger.throwArgumentError("invalid codepoint at offset " + offset + "; " + reason, "bytes", bytes);
}
function ignoreFunc(reason, offset, bytes, output, badCodepoint) {
// If there is an invalid prefix (including stray continuation), skip any additional continuation bytes
if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) {
var i = 0;
for (var o = offset + 1; o < bytes.length; o++) {
if (bytes[o] >> 6 !== 0x02) {
break;
}
i++;
}
return i;
}
// This byte runs us past the end of the string, so just jump to the end
// (but the first byte was read already read and therefore skipped)
if (reason === Utf8ErrorReason.OVERRUN) {
return bytes.length - offset - 1;
}
// Nothing to skip
return 0;
}
function replaceFunc(reason, offset, bytes, output, badCodepoint) {
// Overlong representations are otherwise "valid" code points; just non-deistingtished
if (reason === Utf8ErrorReason.OVERLONG) {
output.push(badCodepoint);
return 0;
}
// Put the replacement character into the output
output.push(0xfffd);
// Otherwise, process as if ignoring errors
return ignoreFunc(reason, offset, bytes, output, badCodepoint);
}
// Common error handing strategies
exports.Utf8ErrorFuncs = Object.freeze({
error: errorFunc,
ignore: ignoreFunc,
replace: replaceFunc
});
// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499
function getUtf8CodePoints(bytes, ignoreErrors) {
function getUtf8CodePoints(bytes, onError) {
if (onError == null) {
onError = exports.Utf8ErrorFuncs.error;
}
bytes = bytes_1.arrayify(bytes);
var result = [];
var i = 0;
@ -46,25 +117,17 @@ function getUtf8CodePoints(bytes, ignoreErrors) {
overlongMask = 0xffff;
}
else {
if (!ignoreErrors) {
if ((c & 0xc0) === 0x80) {
throw new Error("invalid utf8 byte sequence; unexpected continuation byte");
}
throw new Error("invalid utf8 byte sequence; invalid prefix");
if ((c & 0xc0) === 0x80) {
i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result);
}
else {
i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result);
}
continue;
}
// Do we have enough bytes in our data?
if (i + extraLength > bytes.length) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; too short");
}
// If there is an invalid unprocessed byte, skip continuation bytes
for (; i < bytes.length; i++) {
if (bytes[i] >> 6 !== 0x02) {
break;
}
}
if (i - 1 + extraLength >= bytes.length) {
i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result);
continue;
}
// Remove the length prefix from the char
@ -73,6 +136,7 @@ function getUtf8CodePoints(bytes, ignoreErrors) {
var nextChar = bytes[i];
// Invalid continuation byte
if ((nextChar & 0xc0) != 0x80) {
i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result);
res = null;
break;
}
@ -80,31 +144,23 @@ function getUtf8CodePoints(bytes, ignoreErrors) {
res = (res << 6) | (nextChar & 0x3f);
i++;
}
// See above loop for invalid contimuation byte
if (res === null) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; invalid continuation byte");
}
continue;
}
// Check for overlong seuences (more bytes than needed)
if (res <= overlongMask) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; overlong");
}
continue;
}
// Maximum code point
if (res > 0x10ffff) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; out-of-range");
}
i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res);
continue;
}
// Reserved for UTF-16 surrogate halves
if (res >= 0xd800 && res <= 0xdfff) {
if (!ignoreErrors) {
throw new Error("invalid utf8 byte sequence; utf-16 surrogate");
}
i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res);
continue;
}
// Check for overlong sequences (more bytes than needed)
if (res <= overlongMask) {
i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res);
continue;
}
result.push(res);
@ -155,8 +211,8 @@ function escapeChar(value) {
var hex = ("0000" + value.toString(16));
return "\\u" + hex.substring(hex.length - 4);
}
function _toEscapedUtf8String(bytes, ignoreErrors) {
return '"' + getUtf8CodePoints(bytes, ignoreErrors).map(function (codePoint) {
function _toEscapedUtf8String(bytes, onError) {
return '"' + getUtf8CodePoints(bytes, onError).map(function (codePoint) {
if (codePoint < 256) {
switch (codePoint) {
case 8: return "\\b";
@ -188,8 +244,8 @@ function _toUtf8String(codePoints) {
}).join("");
}
exports._toUtf8String = _toUtf8String;
function toUtf8String(bytes, ignoreErrors) {
return _toUtf8String(getUtf8CodePoints(bytes, ignoreErrors));
function toUtf8String(bytes, onError) {
return _toUtf8String(getUtf8CodePoints(bytes, onError));
}
exports.toUtf8String = toUtf8String;
function toUtf8CodePoints(str, form) {

@ -27,7 +27,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xe3b6ca6f029aaab94bbde1ad0be3203bfd6ea9be004cb8809d8c43c54086c787",
"tarballHash": "0xfe5085858f0eefb043baba37c2618e003a0cb6c08c866a861709c8e4df4a4f1c",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.135"
"version": "5.0.0-beta.136"
}

@ -1 +1 @@
export const version = "strings/5.0.0-beta.135";
export const version = "strings/5.0.0-beta.136";

@ -1 +1 @@
export declare const version = "tests/5.0.0-beta.147";
export declare const version = "tests/5.0.0-beta.148";

@ -1 +1 @@
export const version = "tests/5.0.0-beta.147";
export const version = "tests/5.0.0-beta.148";

@ -249,34 +249,47 @@ describe('Test Base64 coder', function () {
});
});
describe('Test UTF-8 coder', function () {
const overlong = ethers.utils.Utf8ErrorReason.OVERLONG;
const utf16Surrogate = ethers.utils.Utf8ErrorReason.UTF16_SURROGATE;
const overrun = ethers.utils.Utf8ErrorReason.OVERRUN;
const missingContinue = ethers.utils.Utf8ErrorReason.MISSING_CONTINUE;
const unexpectedContinue = ethers.utils.Utf8ErrorReason.UNEXPECTED_CONTINUE;
const outOfRange = ethers.utils.Utf8ErrorReason.OUT_OF_RANGE;
let BadUTF = [
// See: https://en.wikipedia.org/wiki/UTF-8#Overlong_encodings
{ bytes: [0xF0, 0x82, 0x82, 0xAC], reason: 'overlong', name: 'wikipedia overlong encoded Euro sign' },
{ bytes: [0xc0, 0x80], reason: 'overlong', name: '2-byte overlong - 0xc080' },
{ bytes: [0xc0, 0xbf], reason: 'overlong', name: '2-byte overlong - 0xc0bf' },
{ bytes: [0xc1, 0x80], reason: 'overlong', name: '2-byte overlong - 0xc180' },
{ bytes: [0xc1, 0xbf], reason: 'overlong', name: '2-byte overlong - 0xc1bf' },
{ bytes: [0xF0, 0x82, 0x82, 0xAC], reason: overlong, ignored: "", replaced: "\u20ac", name: 'wikipedia overlong encoded Euro sign' },
{ bytes: [0xc0, 0x80], reason: overlong, ignored: "", replaced: "\u0000", name: '2-byte overlong - 0xc080' },
{ bytes: [0xc0, 0xbf], reason: overlong, ignored: "", replaced: "?", name: '2-byte overlong - 0xc0bf' },
{ bytes: [0xc1, 0x80], reason: overlong, ignored: "", replaced: "@", name: '2-byte overlong - 0xc180' },
{ bytes: [0xc1, 0xbf], reason: overlong, ignored: "", replaced: "\u007f", name: '2-byte overlong - 0xc1bf' },
// Reserved UTF-16 Surrogate halves
{ bytes: [0xed, 0xa0, 0x80], reason: 'utf-16 surrogate', name: 'utf-16 surrogate - U+d800' },
{ bytes: [0xed, 0xbf, 0xbf], reason: 'utf-16 surrogate', name: 'utf-16 surrogate - U+dfff' },
{ bytes: [0xed, 0xa0, 0x80], reason: utf16Surrogate, ignored: "", replaced: "\ufffd", name: 'utf-16 surrogate - U+d800' },
{ bytes: [0xed, 0xbf, 0xbf], reason: utf16Surrogate, ignored: "", replaced: "\ufffd", name: 'utf-16 surrogate - U+dfff' },
// a leading byte not followed by enough continuation bytes
{ bytes: [0xdf], reason: 'too short', name: 'too short - 2-bytes - 0x00' },
{ bytes: [0xe0], reason: 'too short', name: 'too short - 3-bytes' },
{ bytes: [0xe0, 0x80], reason: 'too short', name: 'too short - 3-bytes with 1' },
{ bytes: [0x80], reason: 'unexpected continuation byte', name: 'unexpected continuation byte' },
{ bytes: [0xc2, 0x00], reason: 'invalid continuation byte', name: 'invalid continuation byte - 0xc200' },
{ bytes: [0xc2, 0x40], reason: 'invalid continuation byte', name: 'invalid continuation byte - 0xc240' },
{ bytes: [0xc2, 0xc0], reason: 'invalid continuation byte', name: 'invalid continuation byte - 0xc2c0' },
{ bytes: [0xdf], reason: overrun, ignored: "", replaced: "\ufffd", name: 'too short - 2-bytes - 0x00' },
{ bytes: [0xe0], reason: overrun, ignored: "", replaced: "\ufffd", name: 'too short - 3-bytes' },
{ bytes: [0xe0, 0x80], reason: overrun, ignored: "", replaced: "\ufffd", name: 'too short - 3-bytes with 1' },
{ bytes: [0x80], reason: unexpectedContinue, ignored: "", replaced: "\ufffd", name: 'unexpected continuation byte' },
{ bytes: [0xc2, 0x00], reason: missingContinue, ignored: "\u0000", replaced: "\ufffd\u0000", name: 'invalid continuation byte - 0xc200' },
{ bytes: [0xc2, 0x40], reason: missingContinue, ignored: "@", replaced: "\ufffd@", name: 'invalid continuation byte - 0xc240' },
{ bytes: [0xc2, 0xc0], reason: missingContinue, ignored: "", replaced: "\ufffd\ufffd", name: 'invalid continuation byte - 0xc2c0' },
// Out of range
{ bytes: [0xf4, 0x90, 0x80, 0x80], reason: 'out-of-range', name: 'out of range' },
{ bytes: [0xf4, 0x90, 0x80, 0x80], reason: outOfRange, ignored: "", replaced: "\ufffd", name: 'out of range' },
];
BadUTF.forEach(function (test) {
it('toUtf8String - ' + test.name, function () {
// Check the string using the ignoreErrors conversion
const ignored = ethers.utils.toUtf8String(test.bytes, ethers.utils.Utf8ErrorFuncs.ignore);
assert.equal(ignored, test.ignored, "ignoring errors matches");
// Check the string using the replaceErrors conversion
const replaced = ethers.utils.toUtf8String(test.bytes, ethers.utils.Utf8ErrorFuncs.replace);
assert.equal(replaced, test.replaced, "replaced errors matches");
// Check the string throws the correct error during conversion
assert.throws(function () {
let result = ethers.utils.toUtf8String(test.bytes);
console.log('Result', result);
}, function (error) {
return (error.message.split(';').pop().trim() === test.reason);
return (error.message.split(";").pop().split("(")[0].trim() === test.reason);
}, test.name);
});
});

@ -1 +1 @@
export declare const version = "tests/5.0.0-beta.147";
export declare const version = "tests/5.0.0-beta.148";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "tests/5.0.0-beta.147";
exports.version = "tests/5.0.0-beta.148";

@ -260,34 +260,47 @@ describe('Test Base64 coder', function () {
});
});
describe('Test UTF-8 coder', function () {
var overlong = ethers_1.ethers.utils.Utf8ErrorReason.OVERLONG;
var utf16Surrogate = ethers_1.ethers.utils.Utf8ErrorReason.UTF16_SURROGATE;
var overrun = ethers_1.ethers.utils.Utf8ErrorReason.OVERRUN;
var missingContinue = ethers_1.ethers.utils.Utf8ErrorReason.MISSING_CONTINUE;
var unexpectedContinue = ethers_1.ethers.utils.Utf8ErrorReason.UNEXPECTED_CONTINUE;
var outOfRange = ethers_1.ethers.utils.Utf8ErrorReason.OUT_OF_RANGE;
var BadUTF = [
// See: https://en.wikipedia.org/wiki/UTF-8#Overlong_encodings
{ bytes: [0xF0, 0x82, 0x82, 0xAC], reason: 'overlong', name: 'wikipedia overlong encoded Euro sign' },
{ bytes: [0xc0, 0x80], reason: 'overlong', name: '2-byte overlong - 0xc080' },
{ bytes: [0xc0, 0xbf], reason: 'overlong', name: '2-byte overlong - 0xc0bf' },
{ bytes: [0xc1, 0x80], reason: 'overlong', name: '2-byte overlong - 0xc180' },
{ bytes: [0xc1, 0xbf], reason: 'overlong', name: '2-byte overlong - 0xc1bf' },
{ bytes: [0xF0, 0x82, 0x82, 0xAC], reason: overlong, ignored: "", replaced: "\u20ac", name: 'wikipedia overlong encoded Euro sign' },
{ bytes: [0xc0, 0x80], reason: overlong, ignored: "", replaced: "\u0000", name: '2-byte overlong - 0xc080' },
{ bytes: [0xc0, 0xbf], reason: overlong, ignored: "", replaced: "?", name: '2-byte overlong - 0xc0bf' },
{ bytes: [0xc1, 0x80], reason: overlong, ignored: "", replaced: "@", name: '2-byte overlong - 0xc180' },
{ bytes: [0xc1, 0xbf], reason: overlong, ignored: "", replaced: "\u007f", name: '2-byte overlong - 0xc1bf' },
// Reserved UTF-16 Surrogate halves
{ bytes: [0xed, 0xa0, 0x80], reason: 'utf-16 surrogate', name: 'utf-16 surrogate - U+d800' },
{ bytes: [0xed, 0xbf, 0xbf], reason: 'utf-16 surrogate', name: 'utf-16 surrogate - U+dfff' },
{ bytes: [0xed, 0xa0, 0x80], reason: utf16Surrogate, ignored: "", replaced: "\ufffd", name: 'utf-16 surrogate - U+d800' },
{ bytes: [0xed, 0xbf, 0xbf], reason: utf16Surrogate, ignored: "", replaced: "\ufffd", name: 'utf-16 surrogate - U+dfff' },
// a leading byte not followed by enough continuation bytes
{ bytes: [0xdf], reason: 'too short', name: 'too short - 2-bytes - 0x00' },
{ bytes: [0xe0], reason: 'too short', name: 'too short - 3-bytes' },
{ bytes: [0xe0, 0x80], reason: 'too short', name: 'too short - 3-bytes with 1' },
{ bytes: [0x80], reason: 'unexpected continuation byte', name: 'unexpected continuation byte' },
{ bytes: [0xc2, 0x00], reason: 'invalid continuation byte', name: 'invalid continuation byte - 0xc200' },
{ bytes: [0xc2, 0x40], reason: 'invalid continuation byte', name: 'invalid continuation byte - 0xc240' },
{ bytes: [0xc2, 0xc0], reason: 'invalid continuation byte', name: 'invalid continuation byte - 0xc2c0' },
{ bytes: [0xdf], reason: overrun, ignored: "", replaced: "\ufffd", name: 'too short - 2-bytes - 0x00' },
{ bytes: [0xe0], reason: overrun, ignored: "", replaced: "\ufffd", name: 'too short - 3-bytes' },
{ bytes: [0xe0, 0x80], reason: overrun, ignored: "", replaced: "\ufffd", name: 'too short - 3-bytes with 1' },
{ bytes: [0x80], reason: unexpectedContinue, ignored: "", replaced: "\ufffd", name: 'unexpected continuation byte' },
{ bytes: [0xc2, 0x00], reason: missingContinue, ignored: "\u0000", replaced: "\ufffd\u0000", name: 'invalid continuation byte - 0xc200' },
{ bytes: [0xc2, 0x40], reason: missingContinue, ignored: "@", replaced: "\ufffd@", name: 'invalid continuation byte - 0xc240' },
{ bytes: [0xc2, 0xc0], reason: missingContinue, ignored: "", replaced: "\ufffd\ufffd", name: 'invalid continuation byte - 0xc2c0' },
// Out of range
{ bytes: [0xf4, 0x90, 0x80, 0x80], reason: 'out-of-range', name: 'out of range' },
{ bytes: [0xf4, 0x90, 0x80, 0x80], reason: outOfRange, ignored: "", replaced: "\ufffd", name: 'out of range' },
];
BadUTF.forEach(function (test) {
it('toUtf8String - ' + test.name, function () {
// Check the string using the ignoreErrors conversion
var ignored = ethers_1.ethers.utils.toUtf8String(test.bytes, ethers_1.ethers.utils.Utf8ErrorFuncs.ignore);
assert_1.default.equal(ignored, test.ignored, "ignoring errors matches");
// Check the string using the replaceErrors conversion
var replaced = ethers_1.ethers.utils.toUtf8String(test.bytes, ethers_1.ethers.utils.Utf8ErrorFuncs.replace);
assert_1.default.equal(replaced, test.replaced, "replaced errors matches");
// Check the string throws the correct error during conversion
assert_1.default.throws(function () {
var result = ethers_1.ethers.utils.toUtf8String(test.bytes);
console.log('Result', result);
}, function (error) {
return (error.message.split(';').pop().trim() === test.reason);
return (error.message.split(";").pop().split("(")[0].trim() === test.reason);
}, test.name);
});
});

@ -35,7 +35,7 @@
"scripts": {
"test": "exit 1"
},
"tarballHash": "0xa0454e6a3607fa11b397d501cd5df6f3fb3217f0e129d26244325c2babf0dee4",
"tarballHash": "0x46b13fc88079d777e1d312f876c77f9e333715e74518e7a599bce96336eca5a2",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.147"
"version": "5.0.0-beta.148"
}

@ -1 +1 @@
export const version = "tests/5.0.0-beta.147";
export const version = "tests/5.0.0-beta.148";