forked from tornado-packages/ethers.js
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a34ca6b3a3 | ||
|
|
ef91dcd757 | ||
|
|
a5296a9258 | ||
|
|
f827ae68e2 | ||
|
|
fbf15c0ffe | ||
|
|
10fdbe7274 | ||
|
|
384fc328f2 | ||
|
|
055694ae61 | ||
|
|
edf59d2c26 | ||
|
|
92c978e5c2 | ||
|
|
34397fa2aa | ||
|
|
19587eea3f | ||
|
|
4a9373e773 | ||
|
|
2997bae935 | ||
|
|
b0bd9ee162 | ||
|
|
7075c8c235 | ||
|
|
a4a532fe8e | ||
|
|
77c771bf76 |
2
_version.d.ts
vendored
2
_version.d.ts
vendored
@@ -1 +1 @@
|
||||
export declare const version = "4.0.27";
|
||||
export declare const version = "4.0.32";
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "4.0.27";
|
||||
exports.version = "4.0.32";
|
||||
|
||||
59
dist/ethers.js
vendored
59
dist/ethers.js
vendored
@@ -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.27";
|
||||
exports.version = "4.0.32";
|
||||
|
||||
},{}],2:[function(require,module,exports){
|
||||
"use strict";
|
||||
@@ -10076,6 +10076,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var address_1 = require("../utils/address");
|
||||
var bignumber_1 = require("../utils/bignumber");
|
||||
var bytes_1 = require("../utils/bytes");
|
||||
var constants_1 = require("../constants");
|
||||
var hash_1 = require("../utils/hash");
|
||||
var networks_1 = require("../utils/networks");
|
||||
var properties_1 = require("../utils/properties");
|
||||
@@ -10754,7 +10755,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getBalance', params).then(function (result) {
|
||||
return bignumber_1.bigNumberify(result);
|
||||
@@ -10768,7 +10769,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getTransactionCount', params).then(function (result) {
|
||||
return bignumber_1.bigNumberify(result).toNumber();
|
||||
@@ -10782,7 +10783,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getCode', params).then(function (result) {
|
||||
return bytes_1.hexlify(result);
|
||||
@@ -10796,7 +10797,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, position: position, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, position = _a.position, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = {
|
||||
address: address,
|
||||
blockTag: checkBlockTag(blockTag),
|
||||
@@ -11039,6 +11040,14 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
});
|
||||
});
|
||||
};
|
||||
BaseProvider.prototype._getAddress = function (addressOrName) {
|
||||
return this.resolveName(addressOrName).then(function (address) {
|
||||
if (address == null) {
|
||||
errors.throwError("ENS name not configured", errors.UNSUPPORTED_OPERATION, { operation: "resolveName(" + JSON.stringify(addressOrName) + ")" });
|
||||
}
|
||||
return address;
|
||||
});
|
||||
};
|
||||
// @TODO: Could probably use resolveProperties instead?
|
||||
BaseProvider.prototype._resolveNames = function (object, keys) {
|
||||
var promises = [];
|
||||
@@ -11047,7 +11056,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
if (result[key] == null) {
|
||||
return;
|
||||
}
|
||||
promises.push(this.resolveName(result[key]).then(function (address) {
|
||||
promises.push(this._getAddress(result[key]).then(function (address) {
|
||||
result[key] = address;
|
||||
return;
|
||||
}));
|
||||
@@ -11070,7 +11079,11 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
if (bytes_1.hexDataLength(data) !== 32) {
|
||||
return null;
|
||||
}
|
||||
return address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
var address = address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
if (address === constants_1.AddressZero) {
|
||||
return null;
|
||||
}
|
||||
return address;
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -11091,6 +11104,9 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
var nodeHash = hash_1.namehash(name);
|
||||
// Get the addr from the resovler
|
||||
return this._getResolver(name).then(function (resolverAddress) {
|
||||
if (resolverAddress == null) {
|
||||
return null;
|
||||
}
|
||||
// keccak256('addr(bytes32)')
|
||||
var data = '0x3b3b57de' + nodeHash.substring(2);
|
||||
var transaction = { to: resolverAddress, data: data };
|
||||
@@ -11101,7 +11117,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return null;
|
||||
}
|
||||
var address = address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
if (address === '0x0000000000000000000000000000000000000000') {
|
||||
if (address === constants_1.AddressZero) {
|
||||
return null;
|
||||
}
|
||||
return address;
|
||||
@@ -11273,7 +11289,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
exports.BaseProvider = BaseProvider;
|
||||
properties_1.defineReadOnly(abstract_provider_1.Provider, 'inherits', properties_1.inheritable(abstract_provider_1.Provider));
|
||||
|
||||
},{"../errors":5,"../utils/address":59,"../utils/bignumber":62,"../utils/bytes":63,"../utils/hash":64,"../utils/networks":71,"../utils/properties":73,"../utils/rlp":75,"../utils/transaction":82,"../utils/utf8":84,"../utils/web":85,"./abstract-provider":49}],51:[function(require,module,exports){
|
||||
},{"../constants":3,"../errors":5,"../utils/address":59,"../utils/bignumber":62,"../utils/bytes":63,"../utils/hash":64,"../utils/networks":71,"../utils/properties":73,"../utils/rlp":75,"../utils/transaction":82,"../utils/utf8":84,"../utils/web":85,"./abstract-provider":49}],51:[function(require,module,exports){
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
@@ -11821,6 +11837,7 @@ var InfuraProvider = /** @class */ (function (_super) {
|
||||
// Legacy API Access Token
|
||||
}
|
||||
else {
|
||||
errors.warn("The legacy INFURA apiAccesToken API is deprecated; please upgrade to a Project ID instead (see INFURA dshboard; https://infura.io)");
|
||||
_this = _super.call(this, 'https://' + host + '/' + projectId, standard) || this;
|
||||
properties_1.defineReadOnly(_this, 'apiAccessToken', projectId);
|
||||
properties_1.defineReadOnly(_this, 'projectId', null);
|
||||
@@ -11899,6 +11916,10 @@ function getLowerCase(value) {
|
||||
return value;
|
||||
}
|
||||
var _constructorGuard = {};
|
||||
// Some environments (Trust Wallet and company) use a global map
|
||||
// to track JSON-RPC ID, so we try to keep IDs unique across all
|
||||
// connections. See #489.
|
||||
var _nextId = 42;
|
||||
var JsonRpcSigner = /** @class */ (function (_super) {
|
||||
__extends(JsonRpcSigner, _super);
|
||||
function JsonRpcSigner(constructorGuard, provider, addressOrIndex) {
|
||||
@@ -12085,7 +12106,7 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
||||
var request = {
|
||||
method: method,
|
||||
params: params,
|
||||
id: 42,
|
||||
id: (_nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
return web_1.fetchJson(this.connection, JSON.stringify(request), getResult).then(function (result) {
|
||||
@@ -12271,6 +12292,7 @@ utils.defineProperty(Web3Signer, 'onchange', {
|
||||
});
|
||||
|
||||
*/
|
||||
var _nextId = 42;
|
||||
var Web3Provider = /** @class */ (function (_super) {
|
||||
__extends(Web3Provider, _super);
|
||||
function Web3Provider(web3Provider, network) {
|
||||
@@ -12304,7 +12326,7 @@ var Web3Provider = /** @class */ (function (_super) {
|
||||
var request = {
|
||||
method: method,
|
||||
params: params,
|
||||
id: 42,
|
||||
id: (_nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
_this._sendAsync(request, function (error, result) {
|
||||
@@ -12314,10 +12336,10 @@ var Web3Provider = /** @class */ (function (_super) {
|
||||
}
|
||||
if (result.error) {
|
||||
// @TODO: not any
|
||||
var error = new Error(result.error.message);
|
||||
error.code = result.error.code;
|
||||
error.data = result.error.data;
|
||||
reject(error);
|
||||
var error_1 = new Error(result.error.message);
|
||||
error_1.code = result.error.code;
|
||||
error_1.data = result.error.data;
|
||||
reject(error_1);
|
||||
return;
|
||||
}
|
||||
resolve(result.result);
|
||||
@@ -12811,7 +12833,7 @@ var CoderFixedBytes = /** @class */ (function (_super) {
|
||||
};
|
||||
CoderFixedBytes.prototype.decode = function (data, offset) {
|
||||
if (data.length < offset + 32) {
|
||||
errors.throwError('insufficient data for ' + name + ' type', errors.INVALID_ARGUMENT, {
|
||||
errors.throwError('insufficient data for ' + this.name + ' type', errors.INVALID_ARGUMENT, {
|
||||
arg: this.localName,
|
||||
coderType: this.name,
|
||||
value: bytes_1.hexlify(data.slice(offset, offset + 32))
|
||||
@@ -14296,7 +14318,7 @@ function fromExtendedKey(extendedKey) {
|
||||
return new HDNode(_constructorGuard, null, bytes_1.hexlify(key), parentFingerprint, chainCode, index, depth, null, null);
|
||||
// Private Key
|
||||
case "0x0488ade4":
|
||||
case "0x04358394 ":
|
||||
case "0x04358394":
|
||||
if (key[0] !== 0) {
|
||||
break;
|
||||
}
|
||||
@@ -14537,6 +14559,7 @@ exports.formatUnits = units_1.formatUnits;
|
||||
exports.parseUnits = units_1.parseUnits;
|
||||
var web_1 = require("./web");
|
||||
exports.fetchJson = web_1.fetchJson;
|
||||
exports.poll = web_1.poll;
|
||||
////////////////////////
|
||||
// Enums
|
||||
var hmac_1 = require("./hmac");
|
||||
@@ -16724,7 +16747,7 @@ function parseBytes32String(bytes) {
|
||||
throw new Error('invalid bytes32 - not 32 bytes long');
|
||||
}
|
||||
if (data[31] !== 0) {
|
||||
throw new Error('invalid bytes32 sdtring - no null terminator');
|
||||
throw new Error('invalid bytes32 string - no null terminator');
|
||||
}
|
||||
// Find the null termination
|
||||
var length = 31;
|
||||
|
||||
2
dist/ethers.min.js
vendored
2
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.min.js.map
vendored
2
dist/ethers.min.js.map
vendored
File diff suppressed because one or more lines are too long
7
dist/ethers.types.txt
vendored
7
dist/ethers.types.txt
vendored
@@ -232,7 +232,7 @@ declare module 'ethers/utils' {
|
||||
import { parse as parseTransaction, serialize as serializeTransaction } from 'ethers/utils/transaction';
|
||||
import { formatBytes32String, parseBytes32String, toUtf8Bytes, toUtf8String } from 'ethers/utils/utf8';
|
||||
import { commify, formatEther, parseEther, formatUnits, parseUnits } from 'ethers/utils/units';
|
||||
import { fetchJson } from 'ethers/utils/web';
|
||||
import { fetchJson, poll } from 'ethers/utils/web';
|
||||
import { SupportedAlgorithms } from 'ethers/utils/hmac';
|
||||
import { UnicodeNormalizationForm } from 'ethers/utils/utf8';
|
||||
import { CoerceFunc, EventFragment, FunctionFragment, ParamType } from 'ethers/utils/abi-coder';
|
||||
@@ -244,7 +244,7 @@ declare module 'ethers/utils' {
|
||||
import { ConnectionInfo, OnceBlockable, PollOptions } from 'ethers/utils/web';
|
||||
import { EncryptOptions, ProgressCallback } from 'ethers/utils/secret-storage';
|
||||
import { Wordlist } from 'ethers/utils/wordlist';
|
||||
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, HDNode, SigningKey, Interface, base64, BigNumber, bigNumberify, hexlify, isHexString, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, populateTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage, SupportedAlgorithms, UnicodeNormalizationForm, CoerceFunc, EventFragment, FunctionFragment, ParamType, BigNumberish, Arrayish, Hexable, Signature, Indexed, DeployDescription, EventDescription, FunctionDescription, LogDescription, TransactionDescription, Network, Networkish, Transaction, UnsignedTransaction, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback, Wordlist, };
|
||||
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, HDNode, SigningKey, Interface, base64, BigNumber, bigNumberify, hexlify, isHexString, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, populateTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage, poll, SupportedAlgorithms, UnicodeNormalizationForm, CoerceFunc, EventFragment, FunctionFragment, ParamType, BigNumberish, Arrayish, Hexable, Signature, Indexed, DeployDescription, EventDescription, FunctionDescription, LogDescription, TransactionDescription, Network, Networkish, Transaction, UnsignedTransaction, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback, Wordlist, };
|
||||
}
|
||||
|
||||
declare module 'ethers/wordlists' {
|
||||
@@ -266,7 +266,7 @@ declare module 'ethers/utils/shims' {
|
||||
}
|
||||
|
||||
declare module 'ethers/_version' {
|
||||
export const version = "4.0.27";
|
||||
export const version = "4.0.32";
|
||||
}
|
||||
|
||||
declare module 'ethers/utils/bignumber' {
|
||||
@@ -771,6 +771,7 @@ declare module 'ethers/providers/base-provider' {
|
||||
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
||||
getLogs(filter: Filter | FilterByBlock): Promise<Array<Log>>;
|
||||
getEtherPrice(): Promise<number>;
|
||||
_getAddress(addressOrName: string): Promise<string>;
|
||||
resolveName(name: string | Promise<string>): Promise<string>;
|
||||
lookupAddress(address: string | Promise<string>): Promise<string>;
|
||||
static checkTransactionResponse(transaction: any): TransactionResponse;
|
||||
|
||||
768
package-lock.json
generated
768
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ethers",
|
||||
"version": "4.0.27",
|
||||
"version": "4.0.32",
|
||||
"description": "Ethereum wallet library.",
|
||||
"main": "./index.js",
|
||||
"types": "./index.d.ts",
|
||||
@@ -34,7 +34,7 @@
|
||||
"browserify": "^16.2.3",
|
||||
"browserify-zlib": "^0.2.0",
|
||||
"dts-bundle": "^0.7.3",
|
||||
"eslint": "^5.0.1",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-promise": "^3.8.0",
|
||||
"ethereumjs-tx": "^1.3.5",
|
||||
"ethereumjs-util": "^5.2.0",
|
||||
|
||||
1
providers/base-provider.d.ts
vendored
1
providers/base-provider.d.ts
vendored
@@ -53,6 +53,7 @@ export declare class BaseProvider extends Provider {
|
||||
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
||||
getLogs(filter: Filter | FilterByBlock): Promise<Array<Log>>;
|
||||
getEtherPrice(): Promise<number>;
|
||||
_getAddress(addressOrName: string): Promise<string>;
|
||||
private _resolveNames;
|
||||
private _getResolver;
|
||||
resolveName(name: string | Promise<string>): Promise<string>;
|
||||
|
||||
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var address_1 = require("../utils/address");
|
||||
var bignumber_1 = require("../utils/bignumber");
|
||||
var bytes_1 = require("../utils/bytes");
|
||||
var constants_1 = require("../constants");
|
||||
var hash_1 = require("../utils/hash");
|
||||
var networks_1 = require("../utils/networks");
|
||||
var properties_1 = require("../utils/properties");
|
||||
@@ -698,7 +699,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getBalance', params).then(function (result) {
|
||||
return bignumber_1.bigNumberify(result);
|
||||
@@ -712,7 +713,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getTransactionCount', params).then(function (result) {
|
||||
return bignumber_1.bigNumberify(result).toNumber();
|
||||
@@ -726,7 +727,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return _this.perform('getCode', params).then(function (result) {
|
||||
return bytes_1.hexlify(result);
|
||||
@@ -740,7 +741,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.ready.then(function () {
|
||||
return properties_1.resolveProperties({ addressOrName: addressOrName, position: position, blockTag: blockTag }).then(function (_a) {
|
||||
var addressOrName = _a.addressOrName, position = _a.position, blockTag = _a.blockTag;
|
||||
return _this.resolveName(addressOrName).then(function (address) {
|
||||
return _this._getAddress(addressOrName).then(function (address) {
|
||||
var params = {
|
||||
address: address,
|
||||
blockTag: checkBlockTag(blockTag),
|
||||
@@ -983,6 +984,14 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
});
|
||||
});
|
||||
};
|
||||
BaseProvider.prototype._getAddress = function (addressOrName) {
|
||||
return this.resolveName(addressOrName).then(function (address) {
|
||||
if (address == null) {
|
||||
errors.throwError("ENS name not configured", errors.UNSUPPORTED_OPERATION, { operation: "resolveName(" + JSON.stringify(addressOrName) + ")" });
|
||||
}
|
||||
return address;
|
||||
});
|
||||
};
|
||||
// @TODO: Could probably use resolveProperties instead?
|
||||
BaseProvider.prototype._resolveNames = function (object, keys) {
|
||||
var promises = [];
|
||||
@@ -991,7 +1000,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
if (result[key] == null) {
|
||||
return;
|
||||
}
|
||||
promises.push(this.resolveName(result[key]).then(function (address) {
|
||||
promises.push(this._getAddress(result[key]).then(function (address) {
|
||||
result[key] = address;
|
||||
return;
|
||||
}));
|
||||
@@ -1014,7 +1023,11 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
if (bytes_1.hexDataLength(data) !== 32) {
|
||||
return null;
|
||||
}
|
||||
return address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
var address = address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
if (address === constants_1.AddressZero) {
|
||||
return null;
|
||||
}
|
||||
return address;
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -1035,6 +1048,9 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
var nodeHash = hash_1.namehash(name);
|
||||
// Get the addr from the resovler
|
||||
return this._getResolver(name).then(function (resolverAddress) {
|
||||
if (resolverAddress == null) {
|
||||
return null;
|
||||
}
|
||||
// keccak256('addr(bytes32)')
|
||||
var data = '0x3b3b57de' + nodeHash.substring(2);
|
||||
var transaction = { to: resolverAddress, data: data };
|
||||
@@ -1045,7 +1061,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return null;
|
||||
}
|
||||
var address = address_1.getAddress(bytes_1.hexDataSlice(data, 12));
|
||||
if (address === '0x0000000000000000000000000000000000000000') {
|
||||
if (address === constants_1.AddressZero) {
|
||||
return null;
|
||||
}
|
||||
return address;
|
||||
|
||||
@@ -62,6 +62,7 @@ var InfuraProvider = /** @class */ (function (_super) {
|
||||
// Legacy API Access Token
|
||||
}
|
||||
else {
|
||||
errors.warn("The legacy INFURA apiAccesToken API is deprecated; please upgrade to a Project ID instead (see INFURA dshboard; https://infura.io)");
|
||||
_this = _super.call(this, 'https://' + host + '/' + projectId, standard) || this;
|
||||
properties_1.defineReadOnly(_this, 'apiAccessToken', projectId);
|
||||
properties_1.defineReadOnly(_this, 'projectId', null);
|
||||
|
||||
@@ -51,6 +51,10 @@ function getLowerCase(value) {
|
||||
return value;
|
||||
}
|
||||
var _constructorGuard = {};
|
||||
// Some environments (Trust Wallet and company) use a global map
|
||||
// to track JSON-RPC ID, so we try to keep IDs unique across all
|
||||
// connections. See #489.
|
||||
var _nextId = 42;
|
||||
var JsonRpcSigner = /** @class */ (function (_super) {
|
||||
__extends(JsonRpcSigner, _super);
|
||||
function JsonRpcSigner(constructorGuard, provider, addressOrIndex) {
|
||||
@@ -237,7 +241,7 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
||||
var request = {
|
||||
method: method,
|
||||
params: params,
|
||||
id: 42,
|
||||
id: (_nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
return web_1.fetchJson(this.connection, JSON.stringify(request), getResult).then(function (result) {
|
||||
|
||||
@@ -27,6 +27,7 @@ utils.defineProperty(Web3Signer, 'onchange', {
|
||||
});
|
||||
|
||||
*/
|
||||
var _nextId = 42;
|
||||
var Web3Provider = /** @class */ (function (_super) {
|
||||
__extends(Web3Provider, _super);
|
||||
function Web3Provider(web3Provider, network) {
|
||||
@@ -60,7 +61,7 @@ var Web3Provider = /** @class */ (function (_super) {
|
||||
var request = {
|
||||
method: method,
|
||||
params: params,
|
||||
id: 42,
|
||||
id: (_nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
_this._sendAsync(request, function (error, result) {
|
||||
@@ -70,10 +71,10 @@ var Web3Provider = /** @class */ (function (_super) {
|
||||
}
|
||||
if (result.error) {
|
||||
// @TODO: not any
|
||||
var error = new Error(result.error.message);
|
||||
error.code = result.error.code;
|
||||
error.data = result.error.data;
|
||||
reject(error);
|
||||
var error_1 = new Error(result.error.message);
|
||||
error_1.code = result.error.code;
|
||||
error_1.data = result.error.data;
|
||||
reject(error_1);
|
||||
return;
|
||||
}
|
||||
resolve(result.result);
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const version = "4.0.27";
|
||||
export const version = "4.0.32";
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { getAddress, getContractAddress } from '../utils/address';
|
||||
import { BigNumber, bigNumberify } from '../utils/bignumber';
|
||||
import { hexDataLength, hexDataSlice, hexlify, hexStripZeros, isHexString, stripZeros } from '../utils/bytes';
|
||||
import { AddressZero } from "../constants";
|
||||
import { namehash } from '../utils/hash';
|
||||
import { getNetwork } from '../utils/networks';
|
||||
import { defineReadOnly, inheritable, resolveProperties, shallowCopy } from '../utils/properties';
|
||||
@@ -816,7 +817,7 @@ export class BaseProvider extends Provider {
|
||||
getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber> {
|
||||
return this.ready.then(() => {
|
||||
return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {
|
||||
return this.resolveName(addressOrName).then((address) => {
|
||||
return this._getAddress(addressOrName).then((address) => {
|
||||
let params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return this.perform('getBalance', params).then((result) => {
|
||||
return bigNumberify(result);
|
||||
@@ -829,7 +830,7 @@ export class BaseProvider extends Provider {
|
||||
getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number> {
|
||||
return this.ready.then(() => {
|
||||
return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {
|
||||
return this.resolveName(addressOrName).then((address) => {
|
||||
return this._getAddress(addressOrName).then((address) => {
|
||||
let params = { address: address, blockTag: checkBlockTag(blockTag) };
|
||||
return this.perform('getTransactionCount', params).then((result) => {
|
||||
return bigNumberify(result).toNumber();
|
||||
@@ -842,7 +843,7 @@ export class BaseProvider extends Provider {
|
||||
getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string> {
|
||||
return this.ready.then(() => {
|
||||
return resolveProperties({ addressOrName: addressOrName, blockTag: blockTag }).then(({ addressOrName, blockTag }) => {
|
||||
return this.resolveName(addressOrName).then((address) => {
|
||||
return this._getAddress(addressOrName).then((address) => {
|
||||
let params = {address: address, blockTag: checkBlockTag(blockTag)};
|
||||
return this.perform('getCode', params).then((result) => {
|
||||
return hexlify(result);
|
||||
@@ -855,7 +856,7 @@ export class BaseProvider extends Provider {
|
||||
getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string> {
|
||||
return this.ready.then(() => {
|
||||
return resolveProperties({ addressOrName: addressOrName, position: position, blockTag: blockTag }).then(({ addressOrName, position, blockTag }) => {
|
||||
return this.resolveName(addressOrName).then((address) => {
|
||||
return this._getAddress(addressOrName).then((address) => {
|
||||
let params = {
|
||||
address: address,
|
||||
blockTag: checkBlockTag(blockTag),
|
||||
@@ -1108,6 +1109,15 @@ export class BaseProvider extends Provider {
|
||||
});
|
||||
}
|
||||
|
||||
_getAddress(addressOrName: string): Promise<string> {
|
||||
return this.resolveName(addressOrName).then((address) => {
|
||||
if (address == null) {
|
||||
errors.throwError("ENS name not configured", errors.UNSUPPORTED_OPERATION, { operation: "resolveName(" + JSON.stringify(addressOrName) + ")" });
|
||||
}
|
||||
return address;
|
||||
});
|
||||
}
|
||||
|
||||
// @TODO: Could probably use resolveProperties instead?
|
||||
private _resolveNames(object: any, keys: Array<string>): Promise<{ [key: string]: string }> {
|
||||
let promises: Array<Promise<void>> = [];
|
||||
@@ -1116,7 +1126,7 @@ export class BaseProvider extends Provider {
|
||||
|
||||
keys.forEach(function(key) {
|
||||
if (result[key] == null) { return; }
|
||||
promises.push(this.resolveName(result[key]).then((address: string) => {
|
||||
promises.push(this._getAddress(result[key]).then((address: string) => {
|
||||
result[key] = address;
|
||||
return;
|
||||
}));
|
||||
@@ -1143,10 +1153,11 @@ export class BaseProvider extends Provider {
|
||||
let transaction = { to: network.ensAddress, data: data };
|
||||
|
||||
return this.call(transaction).then((data) => {
|
||||
|
||||
// extract the address from the data
|
||||
if (hexDataLength(data) !== 32) { return null; }
|
||||
return getAddress(hexDataSlice(data, 12));
|
||||
let address = getAddress(hexDataSlice(data, 12));
|
||||
if (address === AddressZero) { return null; }
|
||||
return address;
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1171,6 +1182,7 @@ export class BaseProvider extends Provider {
|
||||
|
||||
// Get the addr from the resovler
|
||||
return this._getResolver(name).then(function(resolverAddress) {
|
||||
if (resolverAddress == null) { return null; }
|
||||
|
||||
// keccak256('addr(bytes32)')
|
||||
let data = '0x3b3b57de' + nodeHash.substring(2);
|
||||
@@ -1181,7 +1193,7 @@ export class BaseProvider extends Provider {
|
||||
}).then(function(data) {
|
||||
if (hexDataLength(data) !== 32) { return null; }
|
||||
let address = getAddress(hexDataSlice(data, 12));
|
||||
if (address === '0x0000000000000000000000000000000000000000') { return null; }
|
||||
if (address === AddressZero) { return null; }
|
||||
return address;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ export class InfuraProvider extends JsonRpcProvider {
|
||||
|
||||
// Legacy API Access Token
|
||||
} else {
|
||||
errors.warn("The legacy INFURA apiAccesToken API is deprecated; please upgrade to a Project ID instead (see INFURA dshboard; https://infura.io)");
|
||||
super('https://' + host + '/' + projectId, standard);
|
||||
defineReadOnly(this, 'apiAccessToken', projectId);
|
||||
defineReadOnly(this, 'projectId', null);
|
||||
|
||||
@@ -27,6 +27,8 @@ utils.defineProperty(Web3Signer, 'onchange', {
|
||||
|
||||
*/
|
||||
|
||||
let _nextId = 42;
|
||||
|
||||
export class Web3Provider extends JsonRpcProvider {
|
||||
readonly _web3Provider: AsyncSendable;
|
||||
private _sendAsync: (request: any, callback: (error: any, response: any) => void) => void;
|
||||
@@ -65,10 +67,10 @@ export class Web3Provider extends JsonRpcProvider {
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
var request = {
|
||||
let request = {
|
||||
method: method,
|
||||
params: params,
|
||||
id: 42,
|
||||
id: (_nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
|
||||
@@ -80,7 +82,7 @@ export class Web3Provider extends JsonRpcProvider {
|
||||
|
||||
if (result.error) {
|
||||
// @TODO: not any
|
||||
var error: any = new Error(result.error.message);
|
||||
let error: any = new Error(result.error.message);
|
||||
error.code = result.error.code;
|
||||
error.data = result.error.data;
|
||||
reject(error);
|
||||
|
||||
@@ -574,7 +574,7 @@ class CoderFixedBytes extends Coder {
|
||||
|
||||
decode(data: Uint8Array, offset: number): DecodedResult {
|
||||
if (data.length < offset + 32) {
|
||||
errors.throwError('insufficient data for ' + name + ' type', errors.INVALID_ARGUMENT, {
|
||||
errors.throwError('insufficient data for ' + this.name + ' type', errors.INVALID_ARGUMENT, {
|
||||
arg: this.localName,
|
||||
coderType: this.name,
|
||||
value: hexlify(data.slice(offset, offset + 32))
|
||||
|
||||
@@ -240,7 +240,7 @@ export function fromExtendedKey(extendedKey: string): HDNode {
|
||||
return new HDNode(_constructorGuard, null, hexlify(key), parentFingerprint, chainCode, index, depth, null, null);
|
||||
|
||||
// Private Key
|
||||
case "0x0488ade4": case "0x04358394 ":
|
||||
case "0x0488ade4": case "0x04358394":
|
||||
if (key[0] !== 0) { break; }
|
||||
return new HDNode(_constructorGuard, hexlify(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null, null);
|
||||
}
|
||||
@@ -261,8 +261,8 @@ function _fromSeed(seed: Arrayish, mnemonic: string): HDNode {
|
||||
}
|
||||
|
||||
export function fromMnemonic(mnemonic: string, wordlist?: Wordlist, password?: string): HDNode {
|
||||
// Check that the checksum s valid (will throw an error)
|
||||
mnemonicToEntropy(mnemonic, wordlist);
|
||||
// Normalize the mnemonic (also throws if the checksum is invalid)
|
||||
mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist);
|
||||
|
||||
return _fromSeed(mnemonicToSeed(mnemonic, password), mnemonic);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import { populateTransaction } from './transaction';
|
||||
import { parse as parseTransaction, serialize as serializeTransaction } from './transaction';
|
||||
import { formatBytes32String, parseBytes32String, toUtf8Bytes, toUtf8String } from './utf8';
|
||||
import { commify, formatEther, parseEther, formatUnits, parseUnits } from './units';
|
||||
import { fetchJson } from './web';
|
||||
import { fetchJson, poll } from './web';
|
||||
|
||||
|
||||
////////////////////////
|
||||
@@ -136,6 +136,8 @@ export {
|
||||
recoverPublicKey,
|
||||
verifyMessage,
|
||||
|
||||
poll,
|
||||
|
||||
|
||||
////////////////////////
|
||||
// Enums
|
||||
|
||||
@@ -190,7 +190,7 @@ export function parseBytes32String(bytes: Arrayish): string {
|
||||
|
||||
// Must be 32 bytes with a null-termination
|
||||
if (data.length !== 32) { throw new Error('invalid bytes32 - not 32 bytes long'); }
|
||||
if (data[31] !== 0) { throw new Error('invalid bytes32 sdtring - no null terminator'); }
|
||||
if (data[31] !== 0) { throw new Error('invalid bytes32 string - no null terminator'); }
|
||||
|
||||
// Find the null termination
|
||||
let length = 31;
|
||||
|
||||
@@ -128,3 +128,71 @@ testEasySeed(ethers.wordlists.zh_cn, 'zh_cn');
|
||||
testEasySeed(ethers.wordlists.zh_tw, 'zh_tw');
|
||||
testEasySeed(ethers.wordlists.it, 'it');
|
||||
testEasySeed(ethers.wordlists.ko, 'ko');
|
||||
|
||||
describe('Testnet Extended Key (#553)', function testMnemonic() {
|
||||
var tests = [
|
||||
{
|
||||
name: "testnet extended public key",
|
||||
extended: "tpubD6NzVbkrYhZ4Xbv9K5Ajt49a8XEPydLyfyFBNvqt3TRBa9S8L3PVoKBthRS8gimY2ZU2LQ3gXQKpXHRR6fu9W1rWp6jaBToyZ5ar7wbRNYs",
|
||||
node: {
|
||||
publicKey: "0x02ead6f326f28baf5af54ab4a1688d5784f92848bba73c004365da8871b1e8677e",
|
||||
parentFingerprint: "0x00000000",
|
||||
fingerprint: "0x68ff1104",
|
||||
address: "0xc17Ee49BA46A41FBdA2306d00DA5Ce410925a7cb",
|
||||
chainCode: "0x7eee1a867c6938de05f0677d290769a6db3d135d4c1b5ba84c753b56b027cfb7",
|
||||
index: 0,
|
||||
depth: 0
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "testnet extended private key",
|
||||
extended: "tprv8ZgxMBicQKsPe8tMRRW9UeVTZViTpJA56feQ6QoadBcnjfBMheZucpa2XHqF6iuRJSngkasg1yXD7VpGgGafFJwhY5RoETMSbiyEDBzxdCd",
|
||||
node: {
|
||||
privateKey: "0x949219063180d462349e358ec93cec1067fc346b37530e44b592a8a6dbe96d4c",
|
||||
publicKey: "0x02ead6f326f28baf5af54ab4a1688d5784f92848bba73c004365da8871b1e8677e",
|
||||
parentFingerprint: "0x00000000",
|
||||
fingerprint: "0x68ff1104",
|
||||
address: "0xc17Ee49BA46A41FBdA2306d00DA5Ce410925a7cb",
|
||||
chainCode: "0x7eee1a867c6938de05f0677d290769a6db3d135d4c1b5ba84c753b56b027cfb7",
|
||||
index: 0,
|
||||
depth: 0
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
tests.forEach(function(test) {
|
||||
it(test.name, function() {
|
||||
var node = ethers.utils.HDNode.fromExtendedKey(test.extended);
|
||||
Object.keys(test.node).forEach(function(key) {
|
||||
assert.equal(node[key], test.node[key], "does not match " + key);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Test Mnemonic is Case Agnostic", function() {
|
||||
function randomCase(seed, text) {
|
||||
return text.split("").map(function(c, index) {
|
||||
if (utils.randomNumber(seed + "-" + index, 0, 1000) > 500) {
|
||||
return c.toUpperCase();
|
||||
}
|
||||
return c
|
||||
}).join("");
|
||||
}
|
||||
|
||||
function addTest(mnemonic, altMnemonic) {
|
||||
it(altMnemonic, function() {
|
||||
var node = ethers.utils.HDNode.fromMnemonic(mnemonic);
|
||||
var altNode = ethers.utils.HDNode.fromMnemonic(altMnemonic);
|
||||
assert.equal(node.privateKey, altNode.privateKey, altMnemonic);
|
||||
});
|
||||
}
|
||||
|
||||
for (var i = 0; i < 128; i++) {
|
||||
var seed = "test-" + i;
|
||||
var entropy = utils.randomBytes(seed, 16, 16);
|
||||
var mnemonic = ethers.utils.HDNode.entropyToMnemonic(entropy);
|
||||
var altMnemonic = randomCase(seed, mnemonic);
|
||||
addTest(mnemonic, altMnemonic);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -480,7 +480,7 @@ var CoderFixedBytes = /** @class */ (function (_super) {
|
||||
};
|
||||
CoderFixedBytes.prototype.decode = function (data, offset) {
|
||||
if (data.length < offset + 32) {
|
||||
errors.throwError('insufficient data for ' + name + ' type', errors.INVALID_ARGUMENT, {
|
||||
errors.throwError('insufficient data for ' + this.name + ' type', errors.INVALID_ARGUMENT, {
|
||||
arg: this.localName,
|
||||
coderType: this.name,
|
||||
value: bytes_1.hexlify(data.slice(offset, offset + 32))
|
||||
|
||||
@@ -205,7 +205,7 @@ function fromExtendedKey(extendedKey) {
|
||||
return new HDNode(_constructorGuard, null, bytes_1.hexlify(key), parentFingerprint, chainCode, index, depth, null, null);
|
||||
// Private Key
|
||||
case "0x0488ade4":
|
||||
case "0x04358394 ":
|
||||
case "0x04358394":
|
||||
if (key[0] !== 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
4
utils/index.d.ts
vendored
4
utils/index.d.ts
vendored
@@ -20,7 +20,7 @@ import { populateTransaction } from './transaction';
|
||||
import { parse as parseTransaction, serialize as serializeTransaction } from './transaction';
|
||||
import { formatBytes32String, parseBytes32String, toUtf8Bytes, toUtf8String } from './utf8';
|
||||
import { commify, formatEther, parseEther, formatUnits, parseUnits } from './units';
|
||||
import { fetchJson } from './web';
|
||||
import { fetchJson, poll } from './web';
|
||||
import { SupportedAlgorithms } from './hmac';
|
||||
import { UnicodeNormalizationForm } from './utf8';
|
||||
import { CoerceFunc, EventFragment, FunctionFragment, ParamType } from './abi-coder';
|
||||
@@ -32,4 +32,4 @@ import { Transaction, UnsignedTransaction } from './transaction';
|
||||
import { ConnectionInfo, OnceBlockable, PollOptions } from './web';
|
||||
import { EncryptOptions, ProgressCallback } from './secret-storage';
|
||||
import { Wordlist } from './wordlist';
|
||||
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, HDNode, SigningKey, Interface, base64, BigNumber, bigNumberify, hexlify, isHexString, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, populateTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage, SupportedAlgorithms, UnicodeNormalizationForm, CoerceFunc, EventFragment, FunctionFragment, ParamType, BigNumberish, Arrayish, Hexable, Signature, Indexed, DeployDescription, EventDescription, FunctionDescription, LogDescription, TransactionDescription, Network, Networkish, Transaction, UnsignedTransaction, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback, Wordlist, };
|
||||
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, HDNode, SigningKey, Interface, base64, BigNumber, bigNumberify, hexlify, isHexString, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, populateTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage, poll, SupportedAlgorithms, UnicodeNormalizationForm, CoerceFunc, EventFragment, FunctionFragment, ParamType, BigNumberish, Arrayish, Hexable, Signature, Indexed, DeployDescription, EventDescription, FunctionDescription, LogDescription, TransactionDescription, Network, Networkish, Transaction, UnsignedTransaction, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback, Wordlist, };
|
||||
|
||||
@@ -92,6 +92,7 @@ exports.formatUnits = units_1.formatUnits;
|
||||
exports.parseUnits = units_1.parseUnits;
|
||||
var web_1 = require("./web");
|
||||
exports.fetchJson = web_1.fetchJson;
|
||||
exports.poll = web_1.poll;
|
||||
////////////////////////
|
||||
// Enums
|
||||
var hmac_1 = require("./hmac");
|
||||
|
||||
@@ -174,7 +174,7 @@ function parseBytes32String(bytes) {
|
||||
throw new Error('invalid bytes32 - not 32 bytes long');
|
||||
}
|
||||
if (data[31] !== 0) {
|
||||
throw new Error('invalid bytes32 sdtring - no null terminator');
|
||||
throw new Error('invalid bytes32 string - no null terminator');
|
||||
}
|
||||
// Find the null termination
|
||||
var length = 31;
|
||||
|
||||
Reference in New Issue
Block a user