Updated dist files.
This commit is contained in:
parent
700dd34137
commit
9f201c386e
37
dist/ethers.js
vendored
37
dist/ethers.js
vendored
@ -10188,6 +10188,8 @@ function checkTransactionReceiptLog(log) {
|
|||||||
return check(formatTransactionReceiptLog, log);
|
return check(formatTransactionReceiptLog, log);
|
||||||
}
|
}
|
||||||
var formatTransactionReceipt = {
|
var formatTransactionReceipt = {
|
||||||
|
to: allowNull(address_1.getAddress, null),
|
||||||
|
from: address_1.getAddress,
|
||||||
contractAddress: allowNull(address_1.getAddress, null),
|
contractAddress: allowNull(address_1.getAddress, null),
|
||||||
transactionIndex: checkNumber,
|
transactionIndex: checkNumber,
|
||||||
root: allowNull(checkHash),
|
root: allowNull(checkHash),
|
||||||
@ -11592,16 +11594,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
var json_rpc_provider_1 = require("./json-rpc-provider");
|
var json_rpc_provider_1 = require("./json-rpc-provider");
|
||||||
|
var bytes_1 = require("../utils/bytes");
|
||||||
var networks_1 = require("../utils/networks");
|
var networks_1 = require("../utils/networks");
|
||||||
var properties_1 = require("../utils/properties");
|
var properties_1 = require("../utils/properties");
|
||||||
var errors = __importStar(require("../errors"));
|
var errors = __importStar(require("../errors"));
|
||||||
|
var defaultProjectId = "7d0d81d0919f4f05b9ab6634be01ee73";
|
||||||
var InfuraProvider = /** @class */ (function (_super) {
|
var InfuraProvider = /** @class */ (function (_super) {
|
||||||
__extends(InfuraProvider, _super);
|
__extends(InfuraProvider, _super);
|
||||||
function InfuraProvider(network, apiAccessToken) {
|
function InfuraProvider(network, projectId) {
|
||||||
var _this = this;
|
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;
|
var host = null;
|
||||||
switch (network.name) {
|
switch (standard.name) {
|
||||||
case 'homestead':
|
case 'homestead':
|
||||||
host = 'mainnet.infura.io';
|
host = 'mainnet.infura.io';
|
||||||
break;
|
break;
|
||||||
@ -11615,19 +11622,31 @@ var InfuraProvider = /** @class */ (function (_super) {
|
|||||||
host = 'kovan.infura.io';
|
host = 'kovan.infura.io';
|
||||||
break;
|
break;
|
||||||
default:
|
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);
|
errors.checkNew(_this, InfuraProvider);
|
||||||
properties_1.defineReadOnly(_this, 'apiAccessToken', apiAccessToken || null);
|
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
InfuraProvider.prototype._startPending = function () {
|
InfuraProvider.prototype._startPending = function () {
|
||||||
errors.warn('WARNING: INFURA does not support pending filters');
|
errors.warn('WARNING: INFURA does not support pending filters');
|
||||||
};
|
};
|
||||||
InfuraProvider.prototype.getSigner = function (address) {
|
InfuraProvider.prototype.getSigner = function (address) {
|
||||||
errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });
|
return errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
InfuraProvider.prototype.listAccounts = function () {
|
InfuraProvider.prototype.listAccounts = function () {
|
||||||
return Promise.resolve([]);
|
return Promise.resolve([]);
|
||||||
@ -11636,7 +11655,7 @@ var InfuraProvider = /** @class */ (function (_super) {
|
|||||||
}(json_rpc_provider_1.JsonRpcProvider));
|
}(json_rpc_provider_1.JsonRpcProvider));
|
||||||
exports.InfuraProvider = InfuraProvider;
|
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";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
|
||||||
|
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
@ -487,6 +487,8 @@ declare module 'ethers/providers/abstract-provider' {
|
|||||||
logIndex?: number;
|
logIndex?: number;
|
||||||
}
|
}
|
||||||
export interface TransactionReceipt {
|
export interface TransactionReceipt {
|
||||||
|
to?: string;
|
||||||
|
from?: string;
|
||||||
contractAddress?: string;
|
contractAddress?: string;
|
||||||
transactionIndex?: number;
|
transactionIndex?: number;
|
||||||
root?: string;
|
root?: string;
|
||||||
@ -815,7 +817,8 @@ declare module 'ethers/providers/infura-provider' {
|
|||||||
import { Networkish } from 'ethers/utils/networks';
|
import { Networkish } from 'ethers/utils/networks';
|
||||||
export class InfuraProvider extends JsonRpcProvider {
|
export class InfuraProvider extends JsonRpcProvider {
|
||||||
readonly apiAccessToken: string;
|
readonly apiAccessToken: string;
|
||||||
constructor(network?: Networkish, apiAccessToken?: string);
|
readonly projectId: string;
|
||||||
|
constructor(network?: Networkish, projectId?: string);
|
||||||
protected _startPending(): void;
|
protected _startPending(): void;
|
||||||
getSigner(address?: string): JsonRpcSigner;
|
getSigner(address?: string): JsonRpcSigner;
|
||||||
listAccounts(): Promise<Array<string>>;
|
listAccounts(): Promise<Array<string>>;
|
||||||
|
2
providers/abstract-provider.d.ts
vendored
2
providers/abstract-provider.d.ts
vendored
@ -37,6 +37,8 @@ export interface Log {
|
|||||||
logIndex?: number;
|
logIndex?: number;
|
||||||
}
|
}
|
||||||
export interface TransactionReceipt {
|
export interface TransactionReceipt {
|
||||||
|
to?: string;
|
||||||
|
from?: string;
|
||||||
contractAddress?: string;
|
contractAddress?: string;
|
||||||
transactionIndex?: number;
|
transactionIndex?: number;
|
||||||
root?: string;
|
root?: string;
|
||||||
|
@ -280,6 +280,8 @@ function checkTransactionReceiptLog(log) {
|
|||||||
return check(formatTransactionReceiptLog, log);
|
return check(formatTransactionReceiptLog, log);
|
||||||
}
|
}
|
||||||
var formatTransactionReceipt = {
|
var formatTransactionReceipt = {
|
||||||
|
to: allowNull(address_1.getAddress, null),
|
||||||
|
from: address_1.getAddress,
|
||||||
contractAddress: allowNull(address_1.getAddress, null),
|
contractAddress: allowNull(address_1.getAddress, null),
|
||||||
transactionIndex: checkNumber,
|
transactionIndex: checkNumber,
|
||||||
root: allowNull(checkHash),
|
root: allowNull(checkHash),
|
||||||
|
3
providers/infura-provider.d.ts
vendored
3
providers/infura-provider.d.ts
vendored
@ -2,7 +2,8 @@ import { JsonRpcProvider, JsonRpcSigner } from './json-rpc-provider';
|
|||||||
import { Networkish } from '../utils/networks';
|
import { Networkish } from '../utils/networks';
|
||||||
export declare class InfuraProvider extends JsonRpcProvider {
|
export declare class InfuraProvider extends JsonRpcProvider {
|
||||||
readonly apiAccessToken: string;
|
readonly apiAccessToken: string;
|
||||||
constructor(network?: Networkish, apiAccessToken?: string);
|
readonly projectId: string;
|
||||||
|
constructor(network?: Networkish, projectId?: string);
|
||||||
protected _startPending(): void;
|
protected _startPending(): void;
|
||||||
getSigner(address?: string): JsonRpcSigner;
|
getSigner(address?: string): JsonRpcSigner;
|
||||||
listAccounts(): Promise<Array<string>>;
|
listAccounts(): Promise<Array<string>>;
|
||||||
|
@ -18,16 +18,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
var json_rpc_provider_1 = require("./json-rpc-provider");
|
var json_rpc_provider_1 = require("./json-rpc-provider");
|
||||||
|
var bytes_1 = require("../utils/bytes");
|
||||||
var networks_1 = require("../utils/networks");
|
var networks_1 = require("../utils/networks");
|
||||||
var properties_1 = require("../utils/properties");
|
var properties_1 = require("../utils/properties");
|
||||||
var errors = __importStar(require("../errors"));
|
var errors = __importStar(require("../errors"));
|
||||||
|
var defaultProjectId = "7d0d81d0919f4f05b9ab6634be01ee73";
|
||||||
var InfuraProvider = /** @class */ (function (_super) {
|
var InfuraProvider = /** @class */ (function (_super) {
|
||||||
__extends(InfuraProvider, _super);
|
__extends(InfuraProvider, _super);
|
||||||
function InfuraProvider(network, apiAccessToken) {
|
function InfuraProvider(network, projectId) {
|
||||||
var _this = this;
|
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;
|
var host = null;
|
||||||
switch (network.name) {
|
switch (standard.name) {
|
||||||
case 'homestead':
|
case 'homestead':
|
||||||
host = 'mainnet.infura.io';
|
host = 'mainnet.infura.io';
|
||||||
break;
|
break;
|
||||||
@ -41,19 +46,31 @@ var InfuraProvider = /** @class */ (function (_super) {
|
|||||||
host = 'kovan.infura.io';
|
host = 'kovan.infura.io';
|
||||||
break;
|
break;
|
||||||
default:
|
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);
|
errors.checkNew(_this, InfuraProvider);
|
||||||
properties_1.defineReadOnly(_this, 'apiAccessToken', apiAccessToken || null);
|
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
InfuraProvider.prototype._startPending = function () {
|
InfuraProvider.prototype._startPending = function () {
|
||||||
errors.warn('WARNING: INFURA does not support pending filters');
|
errors.warn('WARNING: INFURA does not support pending filters');
|
||||||
};
|
};
|
||||||
InfuraProvider.prototype.getSigner = function (address) {
|
InfuraProvider.prototype.getSigner = function (address) {
|
||||||
errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });
|
return errors.throwError('INFURA does not support signing', errors.UNSUPPORTED_OPERATION, { operation: 'getSigner' });
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
InfuraProvider.prototype.listAccounts = function () {
|
InfuraProvider.prototype.listAccounts = function () {
|
||||||
return Promise.resolve([]);
|
return Promise.resolve([]);
|
||||||
|
@ -29,7 +29,9 @@ var IpcProvider = /** @class */ (function (_super) {
|
|||||||
function IpcProvider(path, network) {
|
function IpcProvider(path, network) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
if (path == null) {
|
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;
|
_this = _super.call(this, 'ipc://' + path, network) || this;
|
||||||
errors.checkNew(_this, IpcProvider);
|
errors.checkNew(_this, IpcProvider);
|
||||||
@ -50,10 +52,14 @@ var IpcProvider = /** @class */ (function (_super) {
|
|||||||
jsonrpc: "2.0"
|
jsonrpc: "2.0"
|
||||||
});
|
});
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
var response = Buffer.alloc(0);
|
||||||
var stream = net_1.default.connect(_this.path);
|
var stream = net_1.default.connect(_this.path);
|
||||||
stream.on('data', function (data) {
|
stream.on('data', function (data) {
|
||||||
|
response = Buffer.concat([response, data]);
|
||||||
|
});
|
||||||
|
stream.on("end", function () {
|
||||||
try {
|
try {
|
||||||
resolve(JSON.parse(data.toString('utf8')).result);
|
resolve(JSON.parse(response.toString('utf8')).result);
|
||||||
// @TODO: Better pull apart the error
|
// @TODO: Better pull apart the error
|
||||||
stream.destroy();
|
stream.destroy();
|
||||||
}
|
}
|
||||||
@ -62,9 +68,6 @@ var IpcProvider = /** @class */ (function (_super) {
|
|||||||
stream.destroy();
|
stream.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
stream.on('end', function () {
|
|
||||||
stream.destroy();
|
|
||||||
});
|
|
||||||
stream.on('error', function (error) {
|
stream.on('error', function (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
stream.destroy();
|
stream.destroy();
|
||||||
|
Loading…
Reference in New Issue
Block a user