Updated dist files.

This commit is contained in:
Richard Moore 2018-08-03 15:26:01 -04:00
parent f63c844c42
commit 4f63b82bbb
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295
10 changed files with 55 additions and 30 deletions

2
_version.d.ts vendored

@ -1 +1 @@
export declare const version = "4.0.0-beta.9"; export declare const version = "4.0.0-beta.10";

@ -1,3 +1,3 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "4.0.0-beta.9"; exports.version = "4.0.0-beta.10";

32
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){ (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"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "4.0.0-beta.9"; exports.version = "4.0.0-beta.10";
},{}],2:[function(require,module,exports){ },{}],2:[function(require,module,exports){
'use strict'; 'use strict';
@ -11540,7 +11540,7 @@ function getLowerCase(value) {
var _constructorGuard = {}; var _constructorGuard = {};
var JsonRpcSigner = /** @class */ (function (_super) { var JsonRpcSigner = /** @class */ (function (_super) {
__extends(JsonRpcSigner, _super); __extends(JsonRpcSigner, _super);
function JsonRpcSigner(constructorGuard, provider, address) { function JsonRpcSigner(constructorGuard, provider, addressOrIndex) {
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
errors.checkNew(_this, JsonRpcSigner); errors.checkNew(_this, JsonRpcSigner);
if (constructorGuard !== _constructorGuard) { if (constructorGuard !== _constructorGuard) {
@ -11548,8 +11548,19 @@ var JsonRpcSigner = /** @class */ (function (_super) {
} }
properties_1.defineReadOnly(_this, 'provider', provider); properties_1.defineReadOnly(_this, 'provider', provider);
// Statically attach to a given address // Statically attach to a given address
if (address) { if (addressOrIndex) {
properties_1.defineReadOnly(_this, '_address', address); if (typeof (addressOrIndex) === 'string') {
properties_1.defineReadOnly(_this, '_address', address_1.getAddress(addressOrIndex));
}
else if (typeof (addressOrIndex) === 'number') {
properties_1.defineReadOnly(_this, '_index', addressOrIndex);
}
else {
errors.throwError('invalid address or index', errors.INVALID_ARGUMENT, { argument: 'addressOrIndex', value: addressOrIndex });
}
}
else {
properties_1.defineReadOnly(_this, '_index', 0);
} }
return _this; return _this;
} }
@ -11564,14 +11575,15 @@ var JsonRpcSigner = /** @class */ (function (_super) {
configurable: true configurable: true
}); });
JsonRpcSigner.prototype.getAddress = function () { JsonRpcSigner.prototype.getAddress = function () {
var _this = this;
if (this._address) { if (this._address) {
return Promise.resolve(this._address); return Promise.resolve(this._address);
} }
return this.provider.send('eth_accounts', []).then(function (accounts) { return this.provider.send('eth_accounts', []).then(function (accounts) {
if (accounts.length === 0) { if (accounts.length <= _this._index) {
errors.throwError('no accounts', errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' }); errors.throwError('unknown account #' + _this._index, errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' });
} }
return address_1.getAddress(accounts[0]); return address_1.getAddress(accounts[_this._index]);
}); });
}; };
JsonRpcSigner.prototype.getBalance = function (blockTag) { JsonRpcSigner.prototype.getBalance = function (blockTag) {
@ -11592,7 +11604,7 @@ var JsonRpcSigner = /** @class */ (function (_super) {
}); });
} }
if (transaction.gasLimit == null) { if (transaction.gasLimit == null) {
tx.gasLimit = this.provider.estimateGas(transaction); tx.gasLimit = this.provider.estimateGas(tx);
} }
return properties_1.resolveProperties(tx).then(function (tx) { return properties_1.resolveProperties(tx).then(function (tx) {
return _this.provider.send('eth_sendTransaction', [JsonRpcProvider.hexlifyTransaction(tx)]).then(function (hash) { return _this.provider.send('eth_sendTransaction', [JsonRpcProvider.hexlifyTransaction(tx)]).then(function (hash) {
@ -11688,8 +11700,8 @@ var JsonRpcProvider = /** @class */ (function (_super) {
} }
return _this; return _this;
} }
JsonRpcProvider.prototype.getSigner = function (address) { JsonRpcProvider.prototype.getSigner = function (addressOrIndex) {
return new JsonRpcSigner(_constructorGuard, this, address); return new JsonRpcSigner(_constructorGuard, this, addressOrIndex);
}; };
JsonRpcProvider.prototype.listAccounts = function () { JsonRpcProvider.prototype.listAccounts = function () {
return this.send('eth_accounts', []).then(function (accounts) { return this.send('eth_accounts', []).then(function (accounts) {

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

@ -138,7 +138,7 @@ declare module 'ethers/utils/shims' {
} }
declare module 'ethers/_version' { declare module 'ethers/_version' {
export const version = "4.0.0-beta.9"; export const version = "4.0.0-beta.10";
} }
declare module 'ethers/contracts/contract' { declare module 'ethers/contracts/contract' {
@ -426,7 +426,7 @@ declare module 'ethers/providers/json-rpc-provider' {
import { BlockTag, TransactionRequest, TransactionResponse } from 'ethers/providers/abstract-provider'; import { BlockTag, TransactionRequest, TransactionResponse } from 'ethers/providers/abstract-provider';
export class JsonRpcSigner extends Signer { export class JsonRpcSigner extends Signer {
readonly provider: JsonRpcProvider; readonly provider: JsonRpcProvider;
constructor(constructorGuard: any, provider: JsonRpcProvider, address?: string); constructor(constructorGuard: any, provider: JsonRpcProvider, addressOrIndex?: string | number);
readonly address: string; readonly address: string;
getAddress(): Promise<string>; getAddress(): Promise<string>;
getBalance(blockTag?: BlockTag): Promise<BigNumber>; getBalance(blockTag?: BlockTag): Promise<BigNumber>;
@ -438,7 +438,7 @@ declare module 'ethers/providers/json-rpc-provider' {
export class JsonRpcProvider extends BaseProvider { export class JsonRpcProvider extends BaseProvider {
readonly connection: ConnectionInfo; readonly connection: ConnectionInfo;
constructor(url?: ConnectionInfo | string, network?: Networkish); constructor(url?: ConnectionInfo | string, network?: Networkish);
getSigner(address?: string): JsonRpcSigner; getSigner(addressOrIndex?: string | number): JsonRpcSigner;
listAccounts(): Promise<Array<string>>; listAccounts(): Promise<Array<string>>;
send(method: string, params: any): Promise<any>; send(method: string, params: any): Promise<any>;
perform(method: string, params: any): Promise<any>; perform(method: string, params: any): Promise<any>;

@ -1,6 +1,6 @@
{ {
"name": "ethers", "name": "ethers",
"version": "4.0.0-beta.9", "version": "4.0.0-beta.10",
"description": "Ethereum wallet library.", "description": "Ethereum wallet library.",
"main": "./index.js", "main": "./index.js",
"types": "./index.d.ts", "types": "./index.d.ts",

@ -7,8 +7,9 @@ import { ConnectionInfo } from '../utils/web';
import { BlockTag, TransactionRequest, TransactionResponse } from '../providers/abstract-provider'; import { BlockTag, TransactionRequest, TransactionResponse } from '../providers/abstract-provider';
export declare class JsonRpcSigner extends Signer { export declare class JsonRpcSigner extends Signer {
readonly provider: JsonRpcProvider; readonly provider: JsonRpcProvider;
private _index;
private _address; private _address;
constructor(constructorGuard: any, provider: JsonRpcProvider, address?: string); constructor(constructorGuard: any, provider: JsonRpcProvider, addressOrIndex?: string | number);
readonly address: string; readonly address: string;
getAddress(): Promise<string>; getAddress(): Promise<string>;
getBalance(blockTag?: BlockTag): Promise<BigNumber>; getBalance(blockTag?: BlockTag): Promise<BigNumber>;
@ -21,7 +22,7 @@ export declare class JsonRpcProvider extends BaseProvider {
readonly connection: ConnectionInfo; readonly connection: ConnectionInfo;
private _pendingFilter; private _pendingFilter;
constructor(url?: ConnectionInfo | string, network?: Networkish); constructor(url?: ConnectionInfo | string, network?: Networkish);
getSigner(address?: string): JsonRpcSigner; getSigner(addressOrIndex?: string | number): JsonRpcSigner;
listAccounts(): Promise<Array<string>>; listAccounts(): Promise<Array<string>>;
send(method: string, params: any): Promise<any>; send(method: string, params: any): Promise<any>;
perform(method: string, params: any): Promise<any>; perform(method: string, params: any): Promise<any>;

@ -53,7 +53,7 @@ function getLowerCase(value) {
var _constructorGuard = {}; var _constructorGuard = {};
var JsonRpcSigner = /** @class */ (function (_super) { var JsonRpcSigner = /** @class */ (function (_super) {
__extends(JsonRpcSigner, _super); __extends(JsonRpcSigner, _super);
function JsonRpcSigner(constructorGuard, provider, address) { function JsonRpcSigner(constructorGuard, provider, addressOrIndex) {
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
errors.checkNew(_this, JsonRpcSigner); errors.checkNew(_this, JsonRpcSigner);
if (constructorGuard !== _constructorGuard) { if (constructorGuard !== _constructorGuard) {
@ -61,8 +61,19 @@ var JsonRpcSigner = /** @class */ (function (_super) {
} }
properties_1.defineReadOnly(_this, 'provider', provider); properties_1.defineReadOnly(_this, 'provider', provider);
// Statically attach to a given address // Statically attach to a given address
if (address) { if (addressOrIndex) {
properties_1.defineReadOnly(_this, '_address', address); if (typeof (addressOrIndex) === 'string') {
properties_1.defineReadOnly(_this, '_address', address_1.getAddress(addressOrIndex));
}
else if (typeof (addressOrIndex) === 'number') {
properties_1.defineReadOnly(_this, '_index', addressOrIndex);
}
else {
errors.throwError('invalid address or index', errors.INVALID_ARGUMENT, { argument: 'addressOrIndex', value: addressOrIndex });
}
}
else {
properties_1.defineReadOnly(_this, '_index', 0);
} }
return _this; return _this;
} }
@ -77,14 +88,15 @@ var JsonRpcSigner = /** @class */ (function (_super) {
configurable: true configurable: true
}); });
JsonRpcSigner.prototype.getAddress = function () { JsonRpcSigner.prototype.getAddress = function () {
var _this = this;
if (this._address) { if (this._address) {
return Promise.resolve(this._address); return Promise.resolve(this._address);
} }
return this.provider.send('eth_accounts', []).then(function (accounts) { return this.provider.send('eth_accounts', []).then(function (accounts) {
if (accounts.length === 0) { if (accounts.length <= _this._index) {
errors.throwError('no accounts', errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' }); errors.throwError('unknown account #' + _this._index, errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' });
} }
return address_1.getAddress(accounts[0]); return address_1.getAddress(accounts[_this._index]);
}); });
}; };
JsonRpcSigner.prototype.getBalance = function (blockTag) { JsonRpcSigner.prototype.getBalance = function (blockTag) {
@ -105,7 +117,7 @@ var JsonRpcSigner = /** @class */ (function (_super) {
}); });
} }
if (transaction.gasLimit == null) { if (transaction.gasLimit == null) {
tx.gasLimit = this.provider.estimateGas(transaction); tx.gasLimit = this.provider.estimateGas(tx);
} }
return properties_1.resolveProperties(tx).then(function (tx) { return properties_1.resolveProperties(tx).then(function (tx) {
return _this.provider.send('eth_sendTransaction', [JsonRpcProvider.hexlifyTransaction(tx)]).then(function (hash) { return _this.provider.send('eth_sendTransaction', [JsonRpcProvider.hexlifyTransaction(tx)]).then(function (hash) {
@ -201,8 +213,8 @@ var JsonRpcProvider = /** @class */ (function (_super) {
} }
return _this; return _this;
} }
JsonRpcProvider.prototype.getSigner = function (address) { JsonRpcProvider.prototype.getSigner = function (addressOrIndex) {
return new JsonRpcSigner(_constructorGuard, this, address); return new JsonRpcSigner(_constructorGuard, this, addressOrIndex);
}; };
JsonRpcProvider.prototype.listAccounts = function () { JsonRpcProvider.prototype.listAccounts = function () {
return this.send('eth_accounts', []).then(function (accounts) { return this.send('eth_accounts', []).then(function (accounts) {

@ -1 +1 @@
export const version = "4.0.0-beta.9"; export const version = "4.0.0-beta.10";