Skip to content

Commit fd0cf2c

Browse files
committed
Updated dist files.
1 parent 27a981c commit fd0cf2c

40 files changed

+425
-122
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ Changelog
33

44
This change log is managed by `admin/cmds/update-versions` but may be manually updated.
55

6+
ethers/v5.0.28 (2021-02-02 17:12)
7+
---------------------------------
8+
9+
- Added load balancer support to PocketProvider. ([#1052](https://github.com/ethers-io/ethers.js/issues/1052); [27a981c](https://github.com/ethers-io/ethers.js/commit/27a981c84b578feb762fdb37dd5325d9c335bd59))
10+
611
ethers/v5.0.27 (2021-02-01 15:55)
712
---------------------------------
813

@@ -219,4 +224,4 @@ ethers/v5.0.0 (2020-06-12 19:58)
219224
--------------------------------
220225

221226
- Preserve config canary string. ([7157816](https://github.com/ethers-io/ethers.js/commit/7157816fa53f660d750811b293e3b1d5a2f70bd4))
222-
- Updated docs. ([9e4c7e6](https://github.com/ethers-io/ethers.js/commit/9e4c7e609d9eeb5f2a11d6a90bfa9d32ee696431))
227+
- Updated docs. ([9e4c7e6](https://github.com/ethers-io/ethers.js/commit/9e4c7e609d9eeb5f2a11d6a90bfa9d32ee696431))

package-lock.json

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ethers/dist/ethers.esm.js

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17630,7 +17630,7 @@ var bech32 = {
1763017630
fromWords: fromWords
1763117631
};
1763217632

17633-
const version$m = "providers/5.0.20";
17633+
const version$m = "providers/5.0.21";
1763417634

1763517635
"use strict";
1763617636
const logger$s = new Logger(version$m);
@@ -21499,16 +21499,50 @@ class NodesmithProvider extends UrlJsonRpcProvider {
2149921499

2150021500
"use strict";
2150121501
const logger$D = new Logger(version$m);
21502-
const defaultApplicationId = "5f7f8547b90218002e9ce9dd";
21502+
// These are load-balancer-based applicatoin IDs
21503+
const defaultApplicationIds = {
21504+
homestead: "6004bcd10040261633ade990",
21505+
ropsten: "6004bd4d0040261633ade991",
21506+
rinkeby: "6004bda20040261633ade994",
21507+
goerli: "6004bd860040261633ade992",
21508+
};
2150321509
class PocketProvider extends UrlJsonRpcProvider {
21510+
constructor(network, apiKey) {
21511+
// We need a bit of creativity in the constructor because
21512+
// Pocket uses different default API keys based on the network
21513+
if (apiKey == null) {
21514+
const n = getStatic((new.target), "getNetwork")(network);
21515+
if (n) {
21516+
const applicationId = defaultApplicationIds[n.name];
21517+
if (applicationId) {
21518+
apiKey = {
21519+
applicationId: applicationId,
21520+
loadBalancer: true
21521+
};
21522+
}
21523+
}
21524+
// If there was any issue above, we don't know this network
21525+
if (apiKey == null) {
21526+
logger$D.throwError("unsupported network", Logger.errors.INVALID_ARGUMENT, {
21527+
argument: "network",
21528+
value: network
21529+
});
21530+
}
21531+
}
21532+
super(network, apiKey);
21533+
}
2150421534
static getApiKey(apiKey) {
21535+
// Most API Providers allow null to get the default configuration, but
21536+
// Pocket requires the network to decide the default provider, so we
21537+
// rely on hijacking the constructor to add a sensible default for us
21538+
if (apiKey == null) {
21539+
logger$D.throwArgumentError("PocketProvider.getApiKey does not support null apiKey", "apiKey", apiKey);
21540+
}
2150521541
const apiKeyObj = {
21506-
applicationId: defaultApplicationId,
21542+
applicationId: null,
21543+
loadBalancer: false,
2150721544
applicationSecretKey: null
2150821545
};
21509-
if (apiKey == null) {
21510-
return apiKeyObj;
21511-
}
2151221546
// Parse applicationId and applicationSecretKey
2151321547
if (typeof (apiKey) === "string") {
2151421548
apiKeyObj.applicationId = apiKey;
@@ -21518,9 +21552,15 @@ class PocketProvider extends UrlJsonRpcProvider {
2151821552
logger$D.assertArgument((typeof (apiKey.applicationSecretKey) === "string"), "invalid applicationSecretKey", "applicationSecretKey", "[REDACTED]");
2151921553
apiKeyObj.applicationId = apiKey.applicationId;
2152021554
apiKeyObj.applicationSecretKey = apiKey.applicationSecretKey;
21555+
apiKeyObj.loadBalancer = !!apiKey.loadBalancer;
2152121556
}
2152221557
else if (apiKey.applicationId) {
21558+
logger$D.assertArgument((typeof (apiKey.applicationId) === "string"), "apiKey.applicationId must be a string", "apiKey.applicationId", apiKey.applicationId);
2152321559
apiKeyObj.applicationId = apiKey.applicationId;
21560+
apiKeyObj.loadBalancer = !!apiKey.loadBalancer;
21561+
}
21562+
else {
21563+
logger$D.throwArgumentError("unsupported PocketProvider apiKey", "apiKey", apiKey);
2152421564
}
2152521565
return apiKeyObj;
2152621566
}
@@ -21530,15 +21570,29 @@ class PocketProvider extends UrlJsonRpcProvider {
2153021570
case "homestead":
2153121571
host = "eth-mainnet.gateway.pokt.network";
2153221572
break;
21573+
case "ropsten":
21574+
host = "eth-ropsten.gateway.pokt.network";
21575+
break;
21576+
case "rinkeby":
21577+
host = "eth-rinkeby.gateway.pokt.network";
21578+
break;
21579+
case "goerli":
21580+
host = "eth-goerli.gateway.pokt.network";
21581+
break;
2153321582
default:
2153421583
logger$D.throwError("unsupported network", Logger.errors.INVALID_ARGUMENT, {
2153521584
argument: "network",
2153621585
value: network
2153721586
});
2153821587
}
21539-
const connection = {
21540-
url: (`https:/\/${host}/v1/${apiKey.applicationId}`),
21541-
};
21588+
let url = null;
21589+
if (apiKey.loadBalancer) {
21590+
url = `https:/\/${host}/v1/lb/${apiKey.applicationId}`;
21591+
}
21592+
else {
21593+
url = `https:/\/${host}/v1/${apiKey.applicationId}`;
21594+
}
21595+
const connection = { url };
2154221596
// Initialize empty headers
2154321597
connection.headers = {};
2154421598
// Apply application secret key
@@ -21549,7 +21603,7 @@ class PocketProvider extends UrlJsonRpcProvider {
2154921603
return connection;
2155021604
}
2155121605
isCommunityResource() {
21552-
return (this.applicationId === defaultApplicationId);
21606+
return (this.applicationId === defaultApplicationIds[this.network.name]);
2155321607
}
2155421608
}
2155521609

@@ -21986,7 +22040,7 @@ var utils$1 = /*#__PURE__*/Object.freeze({
2198622040
Indexed: Indexed
2198722041
});
2198822042

21989-
const version$o = "ethers/5.0.27";
22043+
const version$o = "ethers/5.0.28";
2199022044

2199122045
"use strict";
2199222046
const logger$H = new Logger(version$o);

packages/ethers/dist/ethers.esm.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.

packages/ethers/dist/ethers.esm.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.

packages/ethers/dist/ethers.esm.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.

packages/ethers/dist/ethers.umd.js

Lines changed: 68 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19701,7 +19701,7 @@
1970119701
var _version$I = createCommonjsModule(function (module, exports) {
1970219702
"use strict";
1970319703
Object.defineProperty(exports, "__esModule", { value: true });
19704-
exports.version = "providers/5.0.20";
19704+
exports.version = "providers/5.0.21";
1970519705

1970619706
});
1970719707

@@ -24752,22 +24752,57 @@
2475224752
Object.defineProperty(exports, "__esModule", { value: true });
2475324753

2475424754

24755+
2475524756
var logger = new lib.Logger(_version$I.version);
2475624757

24757-
var defaultApplicationId = "5f7f8547b90218002e9ce9dd";
24758+
// These are load-balancer-based applicatoin IDs
24759+
var defaultApplicationIds = {
24760+
homestead: "6004bcd10040261633ade990",
24761+
ropsten: "6004bd4d0040261633ade991",
24762+
rinkeby: "6004bda20040261633ade994",
24763+
goerli: "6004bd860040261633ade992",
24764+
};
2475824765
var PocketProvider = /** @class */ (function (_super) {
2475924766
__extends(PocketProvider, _super);
24760-
function PocketProvider() {
24761-
return _super !== null && _super.apply(this, arguments) || this;
24767+
function PocketProvider(network, apiKey) {
24768+
// We need a bit of creativity in the constructor because
24769+
// Pocket uses different default API keys based on the network
24770+
var _newTarget = this.constructor;
24771+
var _this = this;
24772+
if (apiKey == null) {
24773+
var n = lib$3.getStatic((_newTarget), "getNetwork")(network);
24774+
if (n) {
24775+
var applicationId = defaultApplicationIds[n.name];
24776+
if (applicationId) {
24777+
apiKey = {
24778+
applicationId: applicationId,
24779+
loadBalancer: true
24780+
};
24781+
}
24782+
}
24783+
// If there was any issue above, we don't know this network
24784+
if (apiKey == null) {
24785+
logger.throwError("unsupported network", lib.Logger.errors.INVALID_ARGUMENT, {
24786+
argument: "network",
24787+
value: network
24788+
});
24789+
}
24790+
}
24791+
_this = _super.call(this, network, apiKey) || this;
24792+
return _this;
2476224793
}
2476324794
PocketProvider.getApiKey = function (apiKey) {
24795+
// Most API Providers allow null to get the default configuration, but
24796+
// Pocket requires the network to decide the default provider, so we
24797+
// rely on hijacking the constructor to add a sensible default for us
24798+
if (apiKey == null) {
24799+
logger.throwArgumentError("PocketProvider.getApiKey does not support null apiKey", "apiKey", apiKey);
24800+
}
2476424801
var apiKeyObj = {
24765-
applicationId: defaultApplicationId,
24802+
applicationId: null,
24803+
loadBalancer: false,
2476624804
applicationSecretKey: null
2476724805
};
24768-
if (apiKey == null) {
24769-
return apiKeyObj;
24770-
}
2477124806
// Parse applicationId and applicationSecretKey
2477224807
if (typeof (apiKey) === "string") {
2477324808
apiKeyObj.applicationId = apiKey;
@@ -24777,9 +24812,15 @@
2477724812
logger.assertArgument((typeof (apiKey.applicationSecretKey) === "string"), "invalid applicationSecretKey", "applicationSecretKey", "[REDACTED]");
2477824813
apiKeyObj.applicationId = apiKey.applicationId;
2477924814
apiKeyObj.applicationSecretKey = apiKey.applicationSecretKey;
24815+
apiKeyObj.loadBalancer = !!apiKey.loadBalancer;
2478024816
}
2478124817
else if (apiKey.applicationId) {
24818+
logger.assertArgument((typeof (apiKey.applicationId) === "string"), "apiKey.applicationId must be a string", "apiKey.applicationId", apiKey.applicationId);
2478224819
apiKeyObj.applicationId = apiKey.applicationId;
24820+
apiKeyObj.loadBalancer = !!apiKey.loadBalancer;
24821+
}
24822+
else {
24823+
logger.throwArgumentError("unsupported PocketProvider apiKey", "apiKey", apiKey);
2478324824
}
2478424825
return apiKeyObj;
2478524826
};
@@ -24789,15 +24830,29 @@
2478924830
case "homestead":
2479024831
host = "eth-mainnet.gateway.pokt.network";
2479124832
break;
24833+
case "ropsten":
24834+
host = "eth-ropsten.gateway.pokt.network";
24835+
break;
24836+
case "rinkeby":
24837+
host = "eth-rinkeby.gateway.pokt.network";
24838+
break;
24839+
case "goerli":
24840+
host = "eth-goerli.gateway.pokt.network";
24841+
break;
2479224842
default:
2479324843
logger.throwError("unsupported network", lib.Logger.errors.INVALID_ARGUMENT, {
2479424844
argument: "network",
2479524845
value: network
2479624846
});
2479724847
}
24798-
var connection = {
24799-
url: ("https://" + host + "/v1/" + apiKey.applicationId),
24800-
};
24848+
var url = null;
24849+
if (apiKey.loadBalancer) {
24850+
url = "https://" + host + "/v1/lb/" + apiKey.applicationId;
24851+
}
24852+
else {
24853+
url = "https://" + host + "/v1/" + apiKey.applicationId;
24854+
}
24855+
var connection = { url: url };
2480124856
// Initialize empty headers
2480224857
connection.headers = {};
2480324858
// Apply application secret key
@@ -24808,7 +24863,7 @@
2480824863
return connection;
2480924864
};
2481024865
PocketProvider.prototype.isCommunityResource = function () {
24811-
return (this.applicationId === defaultApplicationId);
24866+
return (this.applicationId === defaultApplicationIds[this.network.name]);
2481224867
};
2481324868
return PocketProvider;
2481424869
}(urlJsonRpcProvider.UrlJsonRpcProvider));
@@ -25372,7 +25427,7 @@
2537225427
var _version$M = createCommonjsModule(function (module, exports) {
2537325428
"use strict";
2537425429
Object.defineProperty(exports, "__esModule", { value: true });
25375-
exports.version = "ethers/5.0.27";
25430+
exports.version = "ethers/5.0.28";
2537625431

2537725432
});
2537825433

packages/ethers/dist/ethers.umd.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.

packages/ethers/dist/ethers.umd.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.

packages/ethers/dist/ethers.umd.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.

0 commit comments

Comments
 (0)