Updated dist files.

This commit is contained in:
Richard Moore 2019-01-23 16:30:12 -05:00
parent 700dd34137
commit 9f201c386e
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295
9 changed files with 73 additions and 26 deletions

37
dist/ethers.js vendored
View File

@ -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),
@ -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;
@ -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([]);
@ -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 });

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

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

View File

@ -37,6 +37,8 @@ export interface Log {
logIndex?: number;
}
export interface TransactionReceipt {
to?: string;
from?: string;
contractAddress?: string;
transactionIndex?: number;
root?: string;

View File

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

View File

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

View File

@ -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;
@ -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([]);

View File

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