Skip to content
This repository was archived by the owner on Mar 6, 2023. It is now read-only.

Commit 4f63b82

Browse files
committed
Updated dist files.
1 parent f63c844 commit 4f63b82

File tree

10 files changed

+55
-30
lines changed

10 files changed

+55
-30
lines changed

_version.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export declare const version = "4.0.0-beta.9";
1+
export declare const version = "4.0.0-beta.10";

_version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.version = "4.0.0-beta.9";
3+
exports.version = "4.0.0-beta.10";

dist/ethers.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(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){
22
"use strict";
33
Object.defineProperty(exports, "__esModule", { value: true });
4-
exports.version = "4.0.0-beta.9";
4+
exports.version = "4.0.0-beta.10";
55

66
},{}],2:[function(require,module,exports){
77
'use strict';
@@ -11540,16 +11540,27 @@ function getLowerCase(value) {
1154011540
var _constructorGuard = {};
1154111541
var JsonRpcSigner = /** @class */ (function (_super) {
1154211542
__extends(JsonRpcSigner, _super);
11543-
function JsonRpcSigner(constructorGuard, provider, address) {
11543+
function JsonRpcSigner(constructorGuard, provider, addressOrIndex) {
1154411544
var _this = _super.call(this) || this;
1154511545
errors.checkNew(_this, JsonRpcSigner);
1154611546
if (constructorGuard !== _constructorGuard) {
1154711547
throw new Error('do not call the JsonRpcSigner constructor directly; use provider.getSigner');
1154811548
}
1154911549
properties_1.defineReadOnly(_this, 'provider', provider);
1155011550
// Statically attach to a given address
11551-
if (address) {
11552-
properties_1.defineReadOnly(_this, '_address', address);
11551+
if (addressOrIndex) {
11552+
if (typeof (addressOrIndex) === 'string') {
11553+
properties_1.defineReadOnly(_this, '_address', address_1.getAddress(addressOrIndex));
11554+
}
11555+
else if (typeof (addressOrIndex) === 'number') {
11556+
properties_1.defineReadOnly(_this, '_index', addressOrIndex);
11557+
}
11558+
else {
11559+
errors.throwError('invalid address or index', errors.INVALID_ARGUMENT, { argument: 'addressOrIndex', value: addressOrIndex });
11560+
}
11561+
}
11562+
else {
11563+
properties_1.defineReadOnly(_this, '_index', 0);
1155311564
}
1155411565
return _this;
1155511566
}
@@ -11564,14 +11575,15 @@ var JsonRpcSigner = /** @class */ (function (_super) {
1156411575
configurable: true
1156511576
});
1156611577
JsonRpcSigner.prototype.getAddress = function () {
11578+
var _this = this;
1156711579
if (this._address) {
1156811580
return Promise.resolve(this._address);
1156911581
}
1157011582
return this.provider.send('eth_accounts', []).then(function (accounts) {
11571-
if (accounts.length === 0) {
11572-
errors.throwError('no accounts', errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' });
11583+
if (accounts.length <= _this._index) {
11584+
errors.throwError('unknown account #' + _this._index, errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' });
1157311585
}
11574-
return address_1.getAddress(accounts[0]);
11586+
return address_1.getAddress(accounts[_this._index]);
1157511587
});
1157611588
};
1157711589
JsonRpcSigner.prototype.getBalance = function (blockTag) {
@@ -11592,7 +11604,7 @@ var JsonRpcSigner = /** @class */ (function (_super) {
1159211604
});
1159311605
}
1159411606
if (transaction.gasLimit == null) {
11595-
tx.gasLimit = this.provider.estimateGas(transaction);
11607+
tx.gasLimit = this.provider.estimateGas(tx);
1159611608
}
1159711609
return properties_1.resolveProperties(tx).then(function (tx) {
1159811610
return _this.provider.send('eth_sendTransaction', [JsonRpcProvider.hexlifyTransaction(tx)]).then(function (hash) {
@@ -11688,8 +11700,8 @@ var JsonRpcProvider = /** @class */ (function (_super) {
1168811700
}
1168911701
return _this;
1169011702
}
11691-
JsonRpcProvider.prototype.getSigner = function (address) {
11692-
return new JsonRpcSigner(_constructorGuard, this, address);
11703+
JsonRpcProvider.prototype.getSigner = function (addressOrIndex) {
11704+
return new JsonRpcSigner(_constructorGuard, this, addressOrIndex);
1169311705
};
1169411706
JsonRpcProvider.prototype.listAccounts = function () {
1169511707
return this.send('eth_accounts', []).then(function (accounts) {

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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ declare module 'ethers/utils/shims' {
138138
}
139139

140140
declare module 'ethers/_version' {
141-
export const version = "4.0.0-beta.9";
141+
export const version = "4.0.0-beta.10";
142142
}
143143

144144
declare module 'ethers/contracts/contract' {
@@ -426,7 +426,7 @@ declare module 'ethers/providers/json-rpc-provider' {
426426
import { BlockTag, TransactionRequest, TransactionResponse } from 'ethers/providers/abstract-provider';
427427
export class JsonRpcSigner extends Signer {
428428
readonly provider: JsonRpcProvider;
429-
constructor(constructorGuard: any, provider: JsonRpcProvider, address?: string);
429+
constructor(constructorGuard: any, provider: JsonRpcProvider, addressOrIndex?: string | number);
430430
readonly address: string;
431431
getAddress(): Promise<string>;
432432
getBalance(blockTag?: BlockTag): Promise<BigNumber>;
@@ -438,7 +438,7 @@ declare module 'ethers/providers/json-rpc-provider' {
438438
export class JsonRpcProvider extends BaseProvider {
439439
readonly connection: ConnectionInfo;
440440
constructor(url?: ConnectionInfo | string, network?: Networkish);
441-
getSigner(address?: string): JsonRpcSigner;
441+
getSigner(addressOrIndex?: string | number): JsonRpcSigner;
442442
listAccounts(): Promise<Array<string>>;
443443
send(method: string, params: any): Promise<any>;
444444
perform(method: string, params: any): Promise<any>;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ethers",
3-
"version": "4.0.0-beta.9",
3+
"version": "4.0.0-beta.10",
44
"description": "Ethereum wallet library.",
55
"main": "./index.js",
66
"types": "./index.d.ts",

providers/json-rpc-provider.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { ConnectionInfo } from '../utils/web';
77
import { BlockTag, TransactionRequest, TransactionResponse } from '../providers/abstract-provider';
88
export declare class JsonRpcSigner extends Signer {
99
readonly provider: JsonRpcProvider;
10+
private _index;
1011
private _address;
11-
constructor(constructorGuard: any, provider: JsonRpcProvider, address?: string);
12+
constructor(constructorGuard: any, provider: JsonRpcProvider, addressOrIndex?: string | number);
1213
readonly address: string;
1314
getAddress(): Promise<string>;
1415
getBalance(blockTag?: BlockTag): Promise<BigNumber>;
@@ -21,7 +22,7 @@ export declare class JsonRpcProvider extends BaseProvider {
2122
readonly connection: ConnectionInfo;
2223
private _pendingFilter;
2324
constructor(url?: ConnectionInfo | string, network?: Networkish);
24-
getSigner(address?: string): JsonRpcSigner;
25+
getSigner(addressOrIndex?: string | number): JsonRpcSigner;
2526
listAccounts(): Promise<Array<string>>;
2627
send(method: string, params: any): Promise<any>;
2728
perform(method: string, params: any): Promise<any>;

providers/json-rpc-provider.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,27 @@ function getLowerCase(value) {
5353
var _constructorGuard = {};
5454
var JsonRpcSigner = /** @class */ (function (_super) {
5555
__extends(JsonRpcSigner, _super);
56-
function JsonRpcSigner(constructorGuard, provider, address) {
56+
function JsonRpcSigner(constructorGuard, provider, addressOrIndex) {
5757
var _this = _super.call(this) || this;
5858
errors.checkNew(_this, JsonRpcSigner);
5959
if (constructorGuard !== _constructorGuard) {
6060
throw new Error('do not call the JsonRpcSigner constructor directly; use provider.getSigner');
6161
}
6262
properties_1.defineReadOnly(_this, 'provider', provider);
6363
// Statically attach to a given address
64-
if (address) {
65-
properties_1.defineReadOnly(_this, '_address', address);
64+
if (addressOrIndex) {
65+
if (typeof (addressOrIndex) === 'string') {
66+
properties_1.defineReadOnly(_this, '_address', address_1.getAddress(addressOrIndex));
67+
}
68+
else if (typeof (addressOrIndex) === 'number') {
69+
properties_1.defineReadOnly(_this, '_index', addressOrIndex);
70+
}
71+
else {
72+
errors.throwError('invalid address or index', errors.INVALID_ARGUMENT, { argument: 'addressOrIndex', value: addressOrIndex });
73+
}
74+
}
75+
else {
76+
properties_1.defineReadOnly(_this, '_index', 0);
6677
}
6778
return _this;
6879
}
@@ -77,14 +88,15 @@ var JsonRpcSigner = /** @class */ (function (_super) {
7788
configurable: true
7889
});
7990
JsonRpcSigner.prototype.getAddress = function () {
91+
var _this = this;
8092
if (this._address) {
8193
return Promise.resolve(this._address);
8294
}
8395
return this.provider.send('eth_accounts', []).then(function (accounts) {
84-
if (accounts.length === 0) {
85-
errors.throwError('no accounts', errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' });
96+
if (accounts.length <= _this._index) {
97+
errors.throwError('unknown account #' + _this._index, errors.UNSUPPORTED_OPERATION, { operation: 'getAddress' });
8698
}
87-
return address_1.getAddress(accounts[0]);
99+
return address_1.getAddress(accounts[_this._index]);
88100
});
89101
};
90102
JsonRpcSigner.prototype.getBalance = function (blockTag) {
@@ -105,7 +117,7 @@ var JsonRpcSigner = /** @class */ (function (_super) {
105117
});
106118
}
107119
if (transaction.gasLimit == null) {
108-
tx.gasLimit = this.provider.estimateGas(transaction);
120+
tx.gasLimit = this.provider.estimateGas(tx);
109121
}
110122
return properties_1.resolveProperties(tx).then(function (tx) {
111123
return _this.provider.send('eth_sendTransaction', [JsonRpcProvider.hexlifyTransaction(tx)]).then(function (hash) {
@@ -201,8 +213,8 @@ var JsonRpcProvider = /** @class */ (function (_super) {
201213
}
202214
return _this;
203215
}
204-
JsonRpcProvider.prototype.getSigner = function (address) {
205-
return new JsonRpcSigner(_constructorGuard, this, address);
216+
JsonRpcProvider.prototype.getSigner = function (addressOrIndex) {
217+
return new JsonRpcSigner(_constructorGuard, this, addressOrIndex);
206218
};
207219
JsonRpcProvider.prototype.listAccounts = function () {
208220
return this.send('eth_accounts', []).then(function (accounts) {

src.ts/_version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const version = "4.0.0-beta.9";
1+
export const version = "4.0.0-beta.10";

0 commit comments

Comments
 (0)