Compare commits

..

7 Commits

Author SHA1 Message Date
Richard Moore
fbf15c0ffe Fixed testnet exteneded private keys (#553). 2019-06-28 15:38:19 -04:00
Richard Moore
10fdbe7274 Updated dist files. 2019-06-21 19:18:49 -04:00
Richard Moore
384fc328f2 No longer use hard-coded id of 42 in Web3Provider. 2019-06-21 19:17:55 -04:00
Richard Moore
055694ae61 Updated dist files. 2019-06-10 02:00:55 -04:00
Richard Moore
edf59d2c26 Updatd dist files. 2019-06-10 01:59:51 -04:00
Richard Moore
92c978e5c2 Fixed error in throwing an error for ABI decode (#539). 2019-06-10 01:57:03 -04:00
Richard Moore
34397fa2aa Updated dist files. 2019-05-24 19:41:38 -04:00
17 changed files with 39 additions and 31 deletions

2
_version.d.ts vendored
View File

@@ -1 +1 @@
export declare const version = "4.0.28";
export declare const version = "4.0.31";

View File

@@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "4.0.28";
exports.version = "4.0.31";

19
dist/ethers.js vendored
View File

@@ -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.28";
exports.version = "4.0.31";
},{}],2:[function(require,module,exports){
"use strict";
@@ -11837,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);
@@ -12291,6 +12292,7 @@ utils.defineProperty(Web3Signer, 'onchange', {
});
*/
var _nextId = 42;
var Web3Provider = /** @class */ (function (_super) {
__extends(Web3Provider, _super);
function Web3Provider(web3Provider, network) {
@@ -12324,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) {
@@ -12334,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);
@@ -12831,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))
@@ -14557,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");
@@ -16744,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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -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.28";
export const version = "4.0.31";
}
declare module 'ethers/utils/bignumber' {

View File

@@ -1,6 +1,6 @@
{
"name": "ethers",
"version": "4.0.28",
"version": "4.0.31",
"description": "Ethereum wallet library.",
"main": "./index.js",
"types": "./index.d.ts",

View File

@@ -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);

View File

@@ -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);

View File

@@ -1 +1 @@
export const version = "4.0.28";
export const version = "4.0.31";

View File

@@ -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);

View File

@@ -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))

View File

@@ -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);
}

View File

@@ -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))

4
utils/index.d.ts vendored
View File

@@ -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, };

View File

@@ -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");

View File

@@ -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;