Skip to content

Commit 86e8159

Browse files
committed
Updated dist files.
1 parent a2306f7 commit 86e8159

File tree

10 files changed

+98
-8
lines changed

10 files changed

+98
-8
lines changed

dist/ethers.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10380,7 +10380,15 @@ var formatFilter = {
1038010380
address: allowNull(address_1.getAddress, undefined),
1038110381
topics: allowNull(checkTopics, undefined),
1038210382
};
10383+
var formatFilterByBlock = {
10384+
blockHash: allowNull(checkHash, undefined),
10385+
address: allowNull(address_1.getAddress, undefined),
10386+
topics: allowNull(checkTopics, undefined),
10387+
};
1038310388
function checkFilter(filter) {
10389+
if (filter && filter.blockHash) {
10390+
return check(formatFilterByBlock, filter);
10391+
}
1038410392
return check(formatFilter, filter);
1038510393
}
1038610394
var formatLog = {
@@ -11360,6 +11368,9 @@ var EtherscanProvider = /** @class */ (function (_super) {
1136011368
case 'kovan':
1136111369
baseUrl = 'https://api-kovan.etherscan.io';
1136211370
break;
11371+
case 'goerli':
11372+
baseUrl = 'https://api-goerli.etherscan.io';
11373+
break;
1136311374
default:
1136411375
throw new Error('unsupported network');
1136511376
}
@@ -11482,6 +11493,16 @@ var EtherscanProvider = /** @class */ (function (_super) {
1148211493
if (params.filter.toBlock) {
1148311494
url += '&toBlock=' + checkLogTag(params.filter.toBlock);
1148411495
}
11496+
if (params.filter.blockHash) {
11497+
try {
11498+
errors.throwError("Etherscan does not support blockHash filters", errors.UNSUPPORTED_OPERATION, {
11499+
operation: "getLogs(blockHash)"
11500+
});
11501+
}
11502+
catch (error) {
11503+
return Promise.reject(error);
11504+
}
11505+
}
1148511506
if (params.filter.address) {
1148611507
url += '&address=' + params.filter.address;
1148711508
}
@@ -13854,6 +13875,14 @@ function hexlify(value) {
1385413875
if (value < 0) {
1385513876
errors.throwError('cannot hexlify negative value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
1385613877
}
13878+
// @TODO: Roll this into the above error as a numeric fault (overflow); next version, not backward compatible
13879+
// We can about (value == MAX_INT) to as well, since that may indicate we underflowed already
13880+
if (value >= 9007199254740991) {
13881+
errors.throwError("out-of-range", errors.NUMERIC_FAULT, {
13882+
operartion: "hexlify",
13883+
fault: "out-of-safe-range"
13884+
});
13885+
}
1385713886
var hex = '';
1385813887
while (value) {
1385913888
hex = HexCharacters[value & 0x0f] + hex;
@@ -15023,6 +15052,17 @@ var networks = {
1502315052
name: 'rinkeby',
1502415053
_defaultProvider: ethDefaultProvider('rinkeby')
1502515054
},
15055+
goerli: {
15056+
chainId: 5,
15057+
ensAddress: "0x112234455c3a32fd11230c42e7bccd4a84e02010",
15058+
name: "goerli",
15059+
_defaultProvider: function (providers) {
15060+
if (providers.EtherscanProvider) {
15061+
return new providers.EtherscanProvider("goerli");
15062+
}
15063+
return null;
15064+
}
15065+
},
1502615066
kovan: {
1502715067
chainId: 42,
1502815068
name: 'kovan',

dist/ethers.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ethers.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ethers.types.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,11 @@ declare module 'ethers/providers/abstract-provider' {
474474
address?: string;
475475
topics?: Array<string | Array<string>>;
476476
};
477+
export type FilterByBlock = {
478+
blockHash?: string;
479+
address?: string;
480+
topics?: Array<string | Array<string>>;
481+
};
477482
export interface Log {
478483
blockNumber?: number;
479484
blockHash?: string;
@@ -538,7 +543,7 @@ declare module 'ethers/providers/abstract-provider' {
538543
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block>;
539544
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
540545
abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
541-
abstract getLogs(filter: Filter): Promise<Array<Log>>;
546+
abstract getLogs(filter: Filter | FilterByBlock): Promise<Array<Log>>;
542547
abstract resolveName(name: string | Promise<string>): Promise<string>;
543548
abstract lookupAddress(address: string | Promise<string>): Promise<string>;
544549
abstract on(eventName: EventType, listener: Listener): Provider;
@@ -722,7 +727,7 @@ declare module 'ethers/utils/secret-storage' {
722727
declare module 'ethers/providers/base-provider' {
723728
import { BigNumber } from 'ethers/utils/bignumber';
724729
import { Provider } from 'ethers/providers/abstract-provider';
725-
import { Block, BlockTag, EventType, Filter, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from 'ethers/providers/abstract-provider';
730+
import { Block, BlockTag, EventType, Filter, FilterByBlock, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from 'ethers/providers/abstract-provider';
726731
import { BigNumberish } from 'ethers/utils/bignumber';
727732
import { Transaction } from 'ethers/utils/transaction';
728733
import { Network, Networkish } from 'ethers/utils/networks';
@@ -763,7 +768,7 @@ declare module 'ethers/providers/base-provider' {
763768
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block>;
764769
getTransaction(transactionHash: string): Promise<TransactionResponse>;
765770
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
766-
getLogs(filter: Filter): Promise<Array<Log>>;
771+
getLogs(filter: Filter | FilterByBlock): Promise<Array<Log>>;
767772
getEtherPrice(): Promise<number>;
768773
resolveName(name: string | Promise<string>): Promise<string>;
769774
lookupAddress(address: string | Promise<string>): Promise<string>;

providers/abstract-provider.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ export declare type Filter = {
2424
address?: string;
2525
topics?: Array<string | Array<string>>;
2626
};
27+
export declare type FilterByBlock = {
28+
blockHash?: string;
29+
address?: string;
30+
topics?: Array<string | Array<string>>;
31+
};
2732
export interface Log {
2833
blockNumber?: number;
2934
blockHash?: string;
@@ -88,7 +93,7 @@ export declare abstract class Provider implements OnceBlockable {
8893
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block>;
8994
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
9095
abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
91-
abstract getLogs(filter: Filter): Promise<Array<Log>>;
96+
abstract getLogs(filter: Filter | FilterByBlock): Promise<Array<Log>>;
9297
abstract resolveName(name: string | Promise<string>): Promise<string>;
9398
abstract lookupAddress(address: string | Promise<string>): Promise<string>;
9499
abstract on(eventName: EventType, listener: Listener): Provider;

providers/base-provider.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BigNumber } from '../utils/bignumber';
22
import { Provider } from './abstract-provider';
3-
import { Block, BlockTag, EventType, Filter, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from './abstract-provider';
3+
import { Block, BlockTag, EventType, Filter, FilterByBlock, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from './abstract-provider';
44
import { BigNumberish } from '../utils/bignumber';
55
import { Transaction } from '../utils/transaction';
66
import { Network, Networkish } from '../utils/networks';
@@ -51,7 +51,7 @@ export declare class BaseProvider extends Provider {
5151
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block>;
5252
getTransaction(transactionHash: string): Promise<TransactionResponse>;
5353
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
54-
getLogs(filter: Filter): Promise<Array<Log>>;
54+
getLogs(filter: Filter | FilterByBlock): Promise<Array<Log>>;
5555
getEtherPrice(): Promise<number>;
5656
private _resolveNames;
5757
private _getResolver;

providers/base-provider.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,15 @@ var formatFilter = {
326326
address: allowNull(address_1.getAddress, undefined),
327327
topics: allowNull(checkTopics, undefined),
328328
};
329+
var formatFilterByBlock = {
330+
blockHash: allowNull(checkHash, undefined),
331+
address: allowNull(address_1.getAddress, undefined),
332+
topics: allowNull(checkTopics, undefined),
333+
};
329334
function checkFilter(filter) {
335+
if (filter && filter.blockHash) {
336+
return check(formatFilterByBlock, filter);
337+
}
330338
return check(formatFilter, filter);
331339
}
332340
var formatLog = {

providers/etherscan-provider.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ var EtherscanProvider = /** @class */ (function (_super) {
104104
case 'kovan':
105105
baseUrl = 'https://api-kovan.etherscan.io';
106106
break;
107+
case 'goerli':
108+
baseUrl = 'https://api-goerli.etherscan.io';
109+
break;
107110
default:
108111
throw new Error('unsupported network');
109112
}
@@ -226,6 +229,16 @@ var EtherscanProvider = /** @class */ (function (_super) {
226229
if (params.filter.toBlock) {
227230
url += '&toBlock=' + checkLogTag(params.filter.toBlock);
228231
}
232+
if (params.filter.blockHash) {
233+
try {
234+
errors.throwError("Etherscan does not support blockHash filters", errors.UNSUPPORTED_OPERATION, {
235+
operation: "getLogs(blockHash)"
236+
});
237+
}
238+
catch (error) {
239+
return Promise.reject(error);
240+
}
241+
}
229242
if (params.filter.address) {
230243
url += '&address=' + params.filter.address;
231244
}

utils/bytes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ function hexlify(value) {
135135
if (value < 0) {
136136
errors.throwError('cannot hexlify negative value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
137137
}
138+
// @TODO: Roll this into the above error as a numeric fault (overflow); next version, not backward compatible
139+
// We can about (value == MAX_INT) to as well, since that may indicate we underflowed already
140+
if (value >= 9007199254740991) {
141+
errors.throwError("out-of-range", errors.NUMERIC_FAULT, {
142+
operartion: "hexlify",
143+
fault: "out-of-safe-range"
144+
});
145+
}
138146
var hex = '';
139147
while (value) {
140148
hex = HexCharacters[value & 0x0f] + hex;

utils/networks.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ var networks = {
6666
name: 'rinkeby',
6767
_defaultProvider: ethDefaultProvider('rinkeby')
6868
},
69+
goerli: {
70+
chainId: 5,
71+
ensAddress: "0x112234455c3a32fd11230c42e7bccd4a84e02010",
72+
name: "goerli",
73+
_defaultProvider: function (providers) {
74+
if (providers.EtherscanProvider) {
75+
return new providers.EtherscanProvider("goerli");
76+
}
77+
return null;
78+
}
79+
},
6980
kovan: {
7081
chainId: 42,
7182
name: 'kovan',

0 commit comments

Comments
 (0)