forked from tornado-packages/ethers.js
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
427e16826e | ||
|
|
fab14f8f5a | ||
|
|
e8c89d7ca9 | ||
|
|
b1c6575a1b | ||
|
|
3b7176f322 | ||
|
|
5f7ddcd5d7 | ||
|
|
4c9d740cdf | ||
|
|
a930047a10 | ||
|
|
4e41871fa4 | ||
|
|
9947acc349 |
20
CHANGELOG.md
20
CHANGELOG.md
@@ -1,6 +1,26 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
ethers/v4.0.47 (2020-04-21 23:15)
|
||||
---------------------------------
|
||||
|
||||
- Fixed typo in error message. ([#778](https://github.com/ethers-io/ethers.js/issues/778); [fab14f8](https://github.com/ethers-io/ethers.js/commit/fab14f8f5a16091810bbe4d35f38e0b976adab7c)).
|
||||
- Allow receive type in ABI without warning. ([#746](https://github.com/ethers-io/ethers.js/issues/746); [e8c89d7](https://github.com/ethers-io/ethers.js/commit/e8c89d7ca9cea6e20281f614c4fb22f180114622)).
|
||||
|
||||
ethers/v4.0.46 (2020-03-14 16:56)
|
||||
---------------------------------
|
||||
|
||||
- Fixed typo in error. ([#722](https://github.com/ethers-io/ethers.js/issues/722); [3b7176f](https://github.com/ethers-io/ethers.js/commit/3b7176f322376f8f42c333082388ef56d1720bae)).
|
||||
- Fix EtherscanProvider from throwing outside async context. ([#729](https://github.com/ethers-io/ethers.js/issues/729); [5f7ddcd](https://github.com/ethers-io/ethers.js/commit/5f7ddcd5d71d8a1c9efbeef1232c34ef93f92e5a)).
|
||||
|
||||
ethers/v4.0.45 (2020-02-16 16:16)
|
||||
---------------------------------
|
||||
|
||||
- Added default API key for EtherscanProvider. ([a930047](https://github.com/ethers-io/ethers.js/commit/a930047a102d3369c4e847d7ef43bd850704cf00)).
|
||||
- Fixed typo in arguments name for waitForTransaction. ([#477](https://github.com/ethers-io/ethers.js/issues/477); [4e41871](https://github.com/ethers-io/ethers.js/commit/4e41871fa4cf701d714ad73527a367e9ca1d3431)).
|
||||
- Partial support for non-English mnemonics for encrypted JSON wallets. ([#685](https://github.com/ethers-io/ethers.js/issues/685); [9947acc](https://github.com/ethers-io/ethers.js/commit/9947acc349691734bce8b33d870ab48944a7962f)).
|
||||
- Updated expected balance in test cases. ([748f896](https://github.com/ethers-io/ethers.js/commit/748f89660ac4bf60175f936da755cf1a0d370f46)).
|
||||
|
||||
ethers/v4.0.44 (2020-01-29 22:01)
|
||||
---------------------------------
|
||||
|
||||
|
||||
2
_version.d.ts
vendored
2
_version.d.ts
vendored
@@ -1 +1 @@
|
||||
export declare const version = "4.0.44";
|
||||
export declare const version = "4.0.47";
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "4.0.44";
|
||||
exports.version = "4.0.47";
|
||||
|
||||
20
dist/ethers.js
vendored
20
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.44";
|
||||
exports.version = "4.0.47";
|
||||
|
||||
},{}],2:[function(require,module,exports){
|
||||
"use strict";
|
||||
@@ -11404,6 +11404,7 @@ function checkLogTag(blockTag) {
|
||||
}
|
||||
return parseInt(blockTag.substring(2), 16);
|
||||
}
|
||||
var defaultApiKey = "8FG3JMZ9USS4NTA6YKEKHINU56SEPPVBJR";
|
||||
var EtherscanProvider = /** @class */ (function (_super) {
|
||||
__extends(EtherscanProvider, _super);
|
||||
function EtherscanProvider(network, apiKey) {
|
||||
@@ -11434,7 +11435,7 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
||||
throw new Error('unsupported network');
|
||||
}
|
||||
properties_1.defineReadOnly(_this, 'baseUrl', baseUrl);
|
||||
properties_1.defineReadOnly(_this, 'apiKey', apiKey);
|
||||
properties_1.defineReadOnly(_this, 'apiKey', apiKey || defaultApiKey);
|
||||
return _this;
|
||||
}
|
||||
EtherscanProvider.prototype.perform = function (method, params) {
|
||||
@@ -11512,7 +11513,7 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
||||
url += apiKey;
|
||||
return get(url);
|
||||
}
|
||||
throw new Error('getBlock by blockHash not implmeneted');
|
||||
return Promise.reject(new Error('getBlock by blockHash not implemeneted'));
|
||||
case 'getTransaction':
|
||||
url += '/api?module=proxy&action=eth_getTransactionByHash&txhash=' + params.transactionHash;
|
||||
url += apiKey;
|
||||
@@ -11529,7 +11530,7 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
||||
url += '/api?module=proxy&action=eth_call' + transaction;
|
||||
//url += '&tag=' + params.blockTag + apiKey;
|
||||
if (params.blockTag !== 'latest') {
|
||||
throw new Error('EtherscanProvider does not support blockTag for call');
|
||||
return Promise.reject(new Error('EtherscanProvider does not support blockTag for call'));
|
||||
}
|
||||
url += apiKey;
|
||||
return get(url);
|
||||
@@ -12900,7 +12901,7 @@ var CoderAddress = /** @class */ (function (_super) {
|
||||
};
|
||||
CoderAddress.prototype.decode = function (data, offset) {
|
||||
if (data.length < offset + 32) {
|
||||
errors.throwError('insufficuent data for address type', errors.INVALID_ARGUMENT, {
|
||||
errors.throwError('insufficient data for address type', errors.INVALID_ARGUMENT, {
|
||||
arg: this.localName,
|
||||
coderType: 'address',
|
||||
value: bytes_1.hexlify(data.slice(offset, offset + 32))
|
||||
@@ -14935,6 +14936,7 @@ function addMethod(method) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "receive":
|
||||
case 'fallback':
|
||||
// Nothing to do for fallback
|
||||
break;
|
||||
@@ -15833,7 +15835,8 @@ function decrypt(json, password, progressCallback) {
|
||||
return null;
|
||||
}
|
||||
// Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase
|
||||
if (searchPath(data, 'x-ethers/version') === '0.1') {
|
||||
var locale = searchPath(data, 'x-ethers/locale');
|
||||
if (searchPath(data, 'x-ethers/version') === '0.1' && (locale == null || locale === "en")) {
|
||||
var mnemonicCiphertext = looseArrayify(searchPath(data, 'x-ethers/mnemonicCiphertext'));
|
||||
var mnemonicIv = looseArrayify(searchPath(data, 'x-ethers/mnemonicCounter'));
|
||||
var mnemonicCounter = new aes_js_1.default.Counter(mnemonicIv);
|
||||
@@ -15965,7 +15968,7 @@ function encrypt(privateKey, password, options, progressCallback) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
entropy = bytes_1.arrayify(HDNode.mnemonicToEntropy(options.mnemonic));
|
||||
entropy = bytes_1.arrayify(HDNode.mnemonicToEntropy(options.mnemonic, options.wordlist));
|
||||
}
|
||||
}
|
||||
var path = options.path;
|
||||
@@ -16090,6 +16093,9 @@ function encrypt(privateKey, password, options, progressCallback) {
|
||||
path: path,
|
||||
version: "0.1"
|
||||
};
|
||||
if (options.wordlist && typeof (options.wordlist.locale) === "string") {
|
||||
data['x-ethers'].locale = options.wordlist.locale;
|
||||
}
|
||||
}
|
||||
if (progressCallback) {
|
||||
progressCallback(1);
|
||||
|
||||
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
5
dist/ethers.types.txt
vendored
5
dist/ethers.types.txt
vendored
@@ -266,7 +266,7 @@ declare module 'ethers/utils/shims' {
|
||||
}
|
||||
|
||||
declare module 'ethers/_version' {
|
||||
export const version = "4.0.44";
|
||||
export const version = "4.0.47";
|
||||
}
|
||||
|
||||
declare module 'ethers/utils/bignumber' {
|
||||
@@ -553,7 +553,7 @@ declare module 'ethers/providers/abstract-provider' {
|
||||
abstract listeners(eventName: EventType): Array<Listener>;
|
||||
abstract removeAllListeners(eventName: EventType): Provider;
|
||||
abstract removeListener(eventName: EventType, listener: Listener): Provider;
|
||||
abstract waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
|
||||
abstract waitForTransaction(transactionHash: string, confirmations?: number): Promise<TransactionReceipt>;
|
||||
constructor();
|
||||
static isProvider(value: any): value is Provider;
|
||||
}
|
||||
@@ -710,6 +710,7 @@ declare module 'ethers/utils/secret-storage' {
|
||||
entropy?: Arrayish;
|
||||
mnemonic?: string;
|
||||
path?: string;
|
||||
wordlist?: any;
|
||||
client?: string;
|
||||
salt?: Arrayish;
|
||||
uuid?: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ethers",
|
||||
"version": "4.0.44",
|
||||
"version": "4.0.47",
|
||||
"description": "Ethereum wallet library.",
|
||||
"main": "./index.js",
|
||||
"types": "./index.d.ts",
|
||||
|
||||
2
providers/abstract-provider.d.ts
vendored
2
providers/abstract-provider.d.ts
vendored
@@ -102,7 +102,7 @@ export declare abstract class Provider implements OnceBlockable {
|
||||
abstract listeners(eventName: EventType): Array<Listener>;
|
||||
abstract removeAllListeners(eventName: EventType): Provider;
|
||||
abstract removeListener(eventName: EventType, listener: Listener): Provider;
|
||||
abstract waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
|
||||
abstract waitForTransaction(transactionHash: string, confirmations?: number): Promise<TransactionReceipt>;
|
||||
constructor();
|
||||
static isProvider(value: any): value is Provider;
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ function checkLogTag(blockTag) {
|
||||
}
|
||||
return parseInt(blockTag.substring(2), 16);
|
||||
}
|
||||
var defaultApiKey = "8FG3JMZ9USS4NTA6YKEKHINU56SEPPVBJR";
|
||||
var EtherscanProvider = /** @class */ (function (_super) {
|
||||
__extends(EtherscanProvider, _super);
|
||||
function EtherscanProvider(network, apiKey) {
|
||||
@@ -111,7 +112,7 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
||||
throw new Error('unsupported network');
|
||||
}
|
||||
properties_1.defineReadOnly(_this, 'baseUrl', baseUrl);
|
||||
properties_1.defineReadOnly(_this, 'apiKey', apiKey);
|
||||
properties_1.defineReadOnly(_this, 'apiKey', apiKey || defaultApiKey);
|
||||
return _this;
|
||||
}
|
||||
EtherscanProvider.prototype.perform = function (method, params) {
|
||||
@@ -189,7 +190,7 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
||||
url += apiKey;
|
||||
return get(url);
|
||||
}
|
||||
throw new Error('getBlock by blockHash not implmeneted');
|
||||
return Promise.reject(new Error('getBlock by blockHash not implemeneted'));
|
||||
case 'getTransaction':
|
||||
url += '/api?module=proxy&action=eth_getTransactionByHash&txhash=' + params.transactionHash;
|
||||
url += apiKey;
|
||||
@@ -206,7 +207,7 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
||||
url += '/api?module=proxy&action=eth_call' + transaction;
|
||||
//url += '&tag=' + params.blockTag + apiKey;
|
||||
if (params.blockTag !== 'latest') {
|
||||
throw new Error('EtherscanProvider does not support blockTag for call');
|
||||
return Promise.reject(new Error('EtherscanProvider does not support blockTag for call'));
|
||||
}
|
||||
url += apiKey;
|
||||
return get(url);
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const version = "4.0.44";
|
||||
export const version = "4.0.47";
|
||||
|
||||
@@ -156,7 +156,7 @@ export abstract class Provider implements OnceBlockable {
|
||||
abstract removeListener(eventName: EventType, listener: Listener): Provider;
|
||||
|
||||
// @TODO: This *could* be implemented here, but would pull in events...
|
||||
abstract waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
|
||||
abstract waitForTransaction(transactionHash: string, confirmations?: number): Promise<TransactionReceipt>;
|
||||
|
||||
constructor() {
|
||||
setType(this, 'Provider');
|
||||
|
||||
@@ -73,6 +73,7 @@ function checkLogTag(blockTag: string): number | "latest" {
|
||||
return parseInt(blockTag.substring(2), 16);
|
||||
}
|
||||
|
||||
const defaultApiKey = "8FG3JMZ9USS4NTA6YKEKHINU56SEPPVBJR";
|
||||
|
||||
export class EtherscanProvider extends BaseProvider{
|
||||
readonly baseUrl: string;
|
||||
@@ -106,7 +107,7 @@ export class EtherscanProvider extends BaseProvider{
|
||||
}
|
||||
|
||||
defineReadOnly(this, 'baseUrl', baseUrl);
|
||||
defineReadOnly(this, 'apiKey', apiKey);
|
||||
defineReadOnly(this, 'apiKey', apiKey || defaultApiKey);
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +194,7 @@ export class EtherscanProvider extends BaseProvider{
|
||||
url += apiKey;
|
||||
return get(url);
|
||||
}
|
||||
throw new Error('getBlock by blockHash not implmeneted');
|
||||
return Promise.reject(new Error('getBlock by blockHash not implemeneted'));
|
||||
|
||||
case 'getTransaction':
|
||||
url += '/api?module=proxy&action=eth_getTransactionByHash&txhash=' + params.transactionHash;
|
||||
@@ -212,7 +213,7 @@ export class EtherscanProvider extends BaseProvider{
|
||||
url += '/api?module=proxy&action=eth_call' + transaction;
|
||||
//url += '&tag=' + params.blockTag + apiKey;
|
||||
if (params.blockTag !== 'latest') {
|
||||
throw new Error('EtherscanProvider does not support blockTag for call');
|
||||
return Promise.reject(new Error('EtherscanProvider does not support blockTag for call'));
|
||||
}
|
||||
url += apiKey;
|
||||
return get(url);
|
||||
|
||||
@@ -607,7 +607,7 @@ class CoderAddress extends Coder {
|
||||
}
|
||||
decode(data: Uint8Array, offset: number): DecodedResult {
|
||||
if (data.length < offset + 32) {
|
||||
errors.throwError('insufficuent data for address type', errors.INVALID_ARGUMENT, {
|
||||
errors.throwError('insufficient data for address type', errors.INVALID_ARGUMENT, {
|
||||
arg: this.localName,
|
||||
coderType: 'address',
|
||||
value: hexlify(data.slice(offset, offset + 32))
|
||||
|
||||
@@ -374,6 +374,7 @@ function addMethod(method: any): void {
|
||||
break;
|
||||
}
|
||||
|
||||
case "receive":
|
||||
case 'fallback':
|
||||
// Nothing to do for fallback
|
||||
break;
|
||||
|
||||
@@ -26,6 +26,7 @@ export type EncryptOptions = {
|
||||
entropy?: Arrayish;
|
||||
mnemonic?: string;
|
||||
path?: string;
|
||||
wordlist?: any; // Should be a wordlist, but don't want to create the dependency
|
||||
client?: string;
|
||||
salt?: Arrayish;
|
||||
uuid?: string;
|
||||
@@ -177,7 +178,8 @@ export function decrypt(json: string, password: Arrayish, progressCallback?: Pro
|
||||
}
|
||||
|
||||
// Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase
|
||||
if (searchPath(data, 'x-ethers/version') === '0.1') {
|
||||
const locale = searchPath(data, 'x-ethers/locale');
|
||||
if (searchPath(data, 'x-ethers/version') === '0.1' && (locale == null || locale === "en")) {
|
||||
var mnemonicCiphertext = looseArrayify(searchPath(data, 'x-ethers/mnemonicCiphertext'));
|
||||
var mnemonicIv = looseArrayify(searchPath(data, 'x-ethers/mnemonicCounter'));
|
||||
|
||||
@@ -318,7 +320,7 @@ export function encrypt(privateKey: Arrayish | SigningKey, password: Arrayish |
|
||||
throw new Error('entropy and mnemonic mismatch');
|
||||
}
|
||||
} else {
|
||||
entropy = arrayify(HDNode.mnemonicToEntropy(options.mnemonic));
|
||||
entropy = arrayify(HDNode.mnemonicToEntropy(options.mnemonic, options.wordlist));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,6 +443,9 @@ export function encrypt(privateKey: Arrayish | SigningKey, password: Arrayish |
|
||||
path: path,
|
||||
version: "0.1"
|
||||
};
|
||||
if (options.wordlist && typeof(options.wordlist.locale) === "string") {
|
||||
data['x-ethers'].locale = options.wordlist.locale;
|
||||
}
|
||||
}
|
||||
|
||||
if (progressCallback) { progressCallback(1); }
|
||||
|
||||
@@ -514,7 +514,7 @@ var CoderAddress = /** @class */ (function (_super) {
|
||||
};
|
||||
CoderAddress.prototype.decode = function (data, offset) {
|
||||
if (data.length < offset + 32) {
|
||||
errors.throwError('insufficuent data for address type', errors.INVALID_ARGUMENT, {
|
||||
errors.throwError('insufficient data for address type', errors.INVALID_ARGUMENT, {
|
||||
arg: this.localName,
|
||||
coderType: 'address',
|
||||
value: bytes_1.hexlify(data.slice(offset, offset + 32))
|
||||
|
||||
@@ -294,6 +294,7 @@ function addMethod(method) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "receive":
|
||||
case 'fallback':
|
||||
// Nothing to do for fallback
|
||||
break;
|
||||
|
||||
1
utils/secret-storage.d.ts
vendored
1
utils/secret-storage.d.ts
vendored
@@ -6,6 +6,7 @@ export declare type EncryptOptions = {
|
||||
entropy?: Arrayish;
|
||||
mnemonic?: string;
|
||||
path?: string;
|
||||
wordlist?: any;
|
||||
client?: string;
|
||||
salt?: Arrayish;
|
||||
uuid?: string;
|
||||
|
||||
@@ -130,7 +130,8 @@ function decrypt(json, password, progressCallback) {
|
||||
return null;
|
||||
}
|
||||
// Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase
|
||||
if (searchPath(data, 'x-ethers/version') === '0.1') {
|
||||
var locale = searchPath(data, 'x-ethers/locale');
|
||||
if (searchPath(data, 'x-ethers/version') === '0.1' && (locale == null || locale === "en")) {
|
||||
var mnemonicCiphertext = looseArrayify(searchPath(data, 'x-ethers/mnemonicCiphertext'));
|
||||
var mnemonicIv = looseArrayify(searchPath(data, 'x-ethers/mnemonicCounter'));
|
||||
var mnemonicCounter = new aes_js_1.default.Counter(mnemonicIv);
|
||||
@@ -262,7 +263,7 @@ function encrypt(privateKey, password, options, progressCallback) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
entropy = bytes_1.arrayify(HDNode.mnemonicToEntropy(options.mnemonic));
|
||||
entropy = bytes_1.arrayify(HDNode.mnemonicToEntropy(options.mnemonic, options.wordlist));
|
||||
}
|
||||
}
|
||||
var path = options.path;
|
||||
@@ -387,6 +388,9 @@ function encrypt(privateKey, password, options, progressCallback) {
|
||||
path: path,
|
||||
version: "0.1"
|
||||
};
|
||||
if (options.wordlist && typeof (options.wordlist.locale) === "string") {
|
||||
data['x-ethers'].locale = options.wordlist.locale;
|
||||
}
|
||||
}
|
||||
if (progressCallback) {
|
||||
progressCallback(1);
|
||||
|
||||
Reference in New Issue
Block a user