Skip to content

Commit

Permalink
Updated dist files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jan 23, 2019
1 parent 700dd34 commit 9f201c3
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 26 deletions.
37 changes: 28 additions & 9 deletions dist/ethers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10188,6 +10188,8 @@ function checkTransactionReceiptLog(log) {
return check(formatTransactionReceiptLog, log);
}
var formatTransactionReceipt = {
to: allowNull(address_1.getAddress, null),
from: address_1.getAddress,
contractAddress: allowNull(address_1.getAddress, null),
transactionIndex: checkNumber,
root: allowNull(checkHash),
Expand Down Expand Up @@ -11592,16 +11594,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
var json_rpc_provider_1 = require("./json-rpc-provider");
var bytes_1 = require("../utils/bytes");
var networks_1 = require("../utils/networks");
var properties_1 = require("../utils/properties");
var errors = __importStar(require("../errors"));
var defaultProjectId = "7d0d81d0919f4f05b9ab6634be01ee73";
var InfuraProvider = /** @class */ (function (_super) {
__extends(InfuraProvider, _super);
function InfuraProvider(network, apiAccessToken) {
function InfuraProvider(network, projectId) {
var _this = this;
network = networks_1.getNetwork((network == null) ? 'homestead' : network);
var standard = networks_1.getNetwork((network == null) ? 'homestead' : network);
if (projectId == null) {
projectId = defaultProjectId;
}
var host = null;
switch (network.name) {
switch (standard.name) {
case 'homestead':
host = 'mainnet.infura.io';
break;
Expand All @@ -11615,19 +11622,31 @@ var InfuraProvider = /** @class */ (function (_super) {
host = 'kovan.infura.io';
break;
default:
throw new Error('unsupported network');
errors.throwError('unsupported network', errors.INVALID_ARGUMENT, {
argument: "network",
value: network
});
}
// New-style Project ID
if (bytes_1.isHexString("0x" + projectId, 16)) {
_this = _super.call(this, 'https://' + host + '/v3/' + projectId, standard) || this;
properties_1.defineReadOnly(_this, 'apiAccessToken', null);
properties_1.defineReadOnly(_this, 'projectId', projectId);
// Legacy API Access Token
}
else {
_this = _super.call(this, 'https://' + host + '/' + projectId, standard) || this;
properties_1.defineReadOnly(_this, 'apiAccessToken', projectId);
properties_1.defineReadOnly(_this, 'projectId', null);
}
_this = _super.call(this, 'https://' + host + '/' + (apiAccessToken || ''), network) || this;
errors.checkNew(_this, InfuraProvider);
properties_1.defineReadOnly(_this, 'apiAccessToken', apiAccessToken || null);
return _this;
}
InfuraProvider.prototype._startPending = function () {
errors.warn('WARNING: INFURA does not support pending filters');
};
InfuraProvider.prototype.getSigner = function (address) {
errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });
return null;
return errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });
};
InfuraProvider.prototype.listAccounts = function () {
return Promise.resolve([]);
Expand All @@ -11636,7 +11655,7 @@ var InfuraProvider = /** @class */ (function (_super) {
}(json_rpc_provider_1.JsonRpcProvider));
exports.InfuraProvider = InfuraProvider;

},{"../errors":5,"../utils/networks":70,"../utils/properties":72,"./json-rpc-provider":56}],55:[function(require,module,exports){
},{"../errors":5,"../utils/bytes":62,"../utils/networks":70,"../utils/properties":72,"./json-rpc-provider":56}],55:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

Expand Down
2 changes: 1 addition & 1 deletion dist/ethers.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethers.min.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion dist/ethers.types.txt
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,8 @@ declare module 'ethers/providers/abstract-provider' {
logIndex?: number;
}
export interface TransactionReceipt {
to?: string;
from?: string;
contractAddress?: string;
transactionIndex?: number;
root?: string;
Expand Down Expand Up @@ -815,7 +817,8 @@ declare module 'ethers/providers/infura-provider' {
import { Networkish } from 'ethers/utils/networks';
export class InfuraProvider extends JsonRpcProvider {
readonly apiAccessToken: string;
constructor(network?: Networkish, apiAccessToken?: string);
readonly projectId: string;
constructor(network?: Networkish, projectId?: string);
protected _startPending(): void;
getSigner(address?: string): JsonRpcSigner;
listAccounts(): Promise<Array<string>>;
Expand Down
2 changes: 2 additions & 0 deletions providers/abstract-provider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export interface Log {
logIndex?: number;
}
export interface TransactionReceipt {
to?: string;
from?: string;
contractAddress?: string;
transactionIndex?: number;
root?: string;
Expand Down
2 changes: 2 additions & 0 deletions providers/base-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ function checkTransactionReceiptLog(log) {
return check(formatTransactionReceiptLog, log);
}
var formatTransactionReceipt = {
to: allowNull(address_1.getAddress, null),
from: address_1.getAddress,
contractAddress: allowNull(address_1.getAddress, null),
transactionIndex: checkNumber,
root: allowNull(checkHash),
Expand Down
3 changes: 2 additions & 1 deletion providers/infura-provider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { JsonRpcProvider, JsonRpcSigner } from './json-rpc-provider';
import { Networkish } from '../utils/networks';
export declare class InfuraProvider extends JsonRpcProvider {
readonly apiAccessToken: string;
constructor(network?: Networkish, apiAccessToken?: string);
readonly projectId: string;
constructor(network?: Networkish, projectId?: string);
protected _startPending(): void;
getSigner(address?: string): JsonRpcSigner;
listAccounts(): Promise<Array<string>>;
Expand Down
33 changes: 25 additions & 8 deletions providers/infura-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
var json_rpc_provider_1 = require("./json-rpc-provider");
var bytes_1 = require("../utils/bytes");
var networks_1 = require("../utils/networks");
var properties_1 = require("../utils/properties");
var errors = __importStar(require("../errors"));
var defaultProjectId = "7d0d81d0919f4f05b9ab6634be01ee73";
var InfuraProvider = /** @class */ (function (_super) {
__extends(InfuraProvider, _super);
function InfuraProvider(network, apiAccessToken) {
function InfuraProvider(network, projectId) {
var _this = this;
network = networks_1.getNetwork((network == null) ? 'homestead' : network);
var standard = networks_1.getNetwork((network == null) ? 'homestead' : network);
if (projectId == null) {
projectId = defaultProjectId;
}
var host = null;
switch (network.name) {
switch (standard.name) {
case 'homestead':
host = 'mainnet.infura.io';
break;
Expand All @@ -41,19 +46,31 @@ var InfuraProvider = /** @class */ (function (_super) {
host = 'kovan.infura.io';
break;
default:
throw new Error('unsupported network');
errors.throwError('unsupported network', errors.INVALID_ARGUMENT, {
argument: "network",
value: network
});
}
// New-style Project ID
if (bytes_1.isHexString("0x" + projectId, 16)) {
_this = _super.call(this, 'https://' + host + '/v3/' + projectId, standard) || this;
properties_1.defineReadOnly(_this, 'apiAccessToken', null);
properties_1.defineReadOnly(_this, 'projectId', projectId);
// Legacy API Access Token
}
else {
_this = _super.call(this, 'https://' + host + '/' + projectId, standard) || this;
properties_1.defineReadOnly(_this, 'apiAccessToken', projectId);
properties_1.defineReadOnly(_this, 'projectId', null);
}
_this = _super.call(this, 'https://' + host + '/' + (apiAccessToken || ''), network) || this;
errors.checkNew(_this, InfuraProvider);
properties_1.defineReadOnly(_this, 'apiAccessToken', apiAccessToken || null);
return _this;
}
InfuraProvider.prototype._startPending = function () {
errors.warn('WARNING: INFURA does not support pending filters');
};
InfuraProvider.prototype.getSigner = function (address) {
errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });
return null;
return errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });
};
InfuraProvider.prototype.listAccounts = function () {
return Promise.resolve([]);
Expand Down
13 changes: 8 additions & 5 deletions providers/ipc-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ var IpcProvider = /** @class */ (function (_super) {
function IpcProvider(path, network) {
var _this = this;
if (path == null) {
errors.throwError('missing path', errors.MISSING_ARGUMENT, { arg: 'path' });
errors.throwError('missing path', errors.MISSING_ARGUMENT, {
argument: 'path'
});
}
_this = _super.call(this, 'ipc://' + path, network) || this;
errors.checkNew(_this, IpcProvider);
Expand All @@ -50,10 +52,14 @@ var IpcProvider = /** @class */ (function (_super) {
jsonrpc: "2.0"
});
return new Promise(function (resolve, reject) {
var response = Buffer.alloc(0);
var stream = net_1.default.connect(_this.path);
stream.on('data', function (data) {
response = Buffer.concat([response, data]);
});
stream.on("end", function () {
try {
resolve(JSON.parse(data.toString('utf8')).result);
resolve(JSON.parse(response.toString('utf8')).result);
// @TODO: Better pull apart the error
stream.destroy();
}
Expand All @@ -62,9 +68,6 @@ var IpcProvider = /** @class */ (function (_super) {
stream.destroy();
}
});
stream.on('end', function () {
stream.destroy();
});
stream.on('error', function (error) {
reject(error);
stream.destroy();
Expand Down

0 comments on commit 9f201c3

Please sign in to comment.