@@ -17886,7 +17886,7 @@ var browser$2 = /*#__PURE__*/Object.freeze({
17886
17886
encode: encode$1
17887
17887
});
17888
17888
17889
- const version$l = "web/5.0.8 ";
17889
+ const version$l = "web/5.0.9 ";
17890
17890
17891
17891
"use strict";
17892
17892
var __awaiter$4 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -18010,6 +18010,7 @@ function _fetchData(connection, body, processFunc) {
18010
18010
}
18011
18011
}
18012
18012
}
18013
+ options.allowGzip = !!connection.allowGzip;
18013
18014
if (connection.user != null && connection.password != null) {
18014
18015
if (url.substring(0, 6) !== "https:" && connection.allowInsecureAuthentication !== true) {
18015
18016
logger$p.throwError("basic authentication requires a secure https url", Logger.errors.INVALID_ARGUMENT, { argument: "url", url: url, user: connection.user, password: "[REDACTED]" });
@@ -18849,6 +18850,12 @@ class Formatter {
18849
18850
});
18850
18851
}
18851
18852
}
18853
+ function isCommunityResourcable(value) {
18854
+ return (value && typeof (value.isCommunityResource) === "function");
18855
+ }
18856
+ function isCommunityResource(value) {
18857
+ return (isCommunityResourcable(value) && value.isCommunityResource());
18858
+ }
18852
18859
// Show the throttle message only once
18853
18860
let throttleMessage = false;
18854
18861
function showThrottleMessage() {
@@ -21016,6 +21023,9 @@ class UrlJsonRpcProvider extends StaticJsonRpcProvider {
21016
21023
_startPending() {
21017
21024
logger$u.warn("WARNING: API provider does not support pending filters");
21018
21025
}
21026
+ isCommunityResource() {
21027
+ return false;
21028
+ }
21019
21029
getSigner(address) {
21020
21030
return logger$u.throwError("API provider does not support signing", Logger.errors.UNSUPPORTED_OPERATION, { operation: "getSigner" });
21021
21031
}
@@ -21043,12 +21053,21 @@ const logger$v = new Logger(version$m);
21043
21053
// production environments, that you acquire your own API key at:
21044
21054
// https://dashboard.alchemyapi.io
21045
21055
const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";
21046
- class AlchemyProvider extends UrlJsonRpcProvider {
21047
- static getWebSocketProvider (network, apiKey) {
21056
+ class AlchemyWebSocketProvider extends WebSocketProvider {
21057
+ constructor (network, apiKey) {
21048
21058
const provider = new AlchemyProvider(network, apiKey);
21049
21059
const url = provider.connection.url.replace(/^http/i, "ws")
21050
21060
.replace(".alchemyapi.", ".ws.alchemyapi.");
21051
- return new WebSocketProvider(url, provider.network);
21061
+ super(url, provider.network);
21062
+ defineReadOnly(this, "apiKey", provider.apiKey);
21063
+ }
21064
+ isCommunityResource() {
21065
+ return (this.apiKey === defaultApiKey);
21066
+ }
21067
+ }
21068
+ class AlchemyProvider extends UrlJsonRpcProvider {
21069
+ static getWebSocketProvider(network, apiKey) {
21070
+ return new AlchemyWebSocketProvider(network, apiKey);
21052
21071
}
21053
21072
static getApiKey(apiKey) {
21054
21073
if (apiKey == null) {
@@ -21081,6 +21100,7 @@ class AlchemyProvider extends UrlJsonRpcProvider {
21081
21100
logger$v.throwArgumentError("unsupported network", "network", arguments[0]);
21082
21101
}
21083
21102
return {
21103
+ allowGzip: true,
21084
21104
url: ("https:/" + "/" + host + apiKey),
21085
21105
throttleCallback: (attempt, url) => {
21086
21106
if (apiKey === defaultApiKey) {
@@ -21090,6 +21110,9 @@ class AlchemyProvider extends UrlJsonRpcProvider {
21090
21110
}
21091
21111
};
21092
21112
}
21113
+ isCommunityResource() {
21114
+ return (this.apiKey === defaultApiKey);
21115
+ }
21093
21116
}
21094
21117
21095
21118
"use strict";
@@ -21312,7 +21335,7 @@ class EtherscanProvider extends BaseProvider {
21312
21335
url: url,
21313
21336
throttleSlotInterval: 1000,
21314
21337
throttleCallback: (attempt, url) => {
21315
- if (this.apiKey === defaultApiKey$1 ) {
21338
+ if (this.isCommunityResource() ) {
21316
21339
showThrottleMessage();
21317
21340
}
21318
21341
return Promise.resolve(true);
@@ -21528,6 +21551,9 @@ class EtherscanProvider extends BaseProvider {
21528
21551
});
21529
21552
});
21530
21553
}
21554
+ isCommunityResource() {
21555
+ return (this.apiKey === defaultApiKey$1);
21556
+ }
21531
21557
}
21532
21558
21533
21559
"use strict";
@@ -21877,14 +21903,16 @@ class FallbackProvider extends BaseProvider {
21877
21903
}
21878
21904
const providerConfigs = providers.map((configOrProvider, index) => {
21879
21905
if (Provider.isProvider(configOrProvider)) {
21880
- return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout: 750, priority: 1 });
21906
+ const stallTimeout = isCommunityResource(configOrProvider) ? 2000 : 750;
21907
+ const priority = 1;
21908
+ return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout, priority });
21881
21909
}
21882
21910
const config = shallowCopy(configOrProvider);
21883
21911
if (config.priority == null) {
21884
21912
config.priority = 1;
21885
21913
}
21886
21914
if (config.stallTimeout == null) {
21887
- config.stallTimeout = 750;
21915
+ config.stallTimeout = isCommunityResource(configOrProvider) ? 2000 : 750;
21888
21916
}
21889
21917
if (config.weight == null) {
21890
21918
config.weight = 1;
@@ -22111,8 +22139,8 @@ var browserIpcProvider = {
22111
22139
"use strict";
22112
22140
const logger$z = new Logger(version$m);
22113
22141
const defaultProjectId = "84842078b09946638c03157f83405213";
22114
- class InfuraProvider extends UrlJsonRpcProvider {
22115
- static getWebSocketProvider (network, apiKey) {
22142
+ class InfuraWebSocketProvider extends WebSocketProvider {
22143
+ constructor (network, apiKey) {
22116
22144
const provider = new InfuraProvider(network, apiKey);
22117
22145
const connection = provider.connection;
22118
22146
if (connection.password) {
@@ -22121,7 +22149,18 @@ class InfuraProvider extends UrlJsonRpcProvider {
22121
22149
});
22122
22150
}
22123
22151
const url = connection.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/");
22124
- return new WebSocketProvider(url, network);
22152
+ super(url, network);
22153
+ defineReadOnly(this, "apiKey", provider.projectId);
22154
+ defineReadOnly(this, "projectId", provider.projectId);
22155
+ defineReadOnly(this, "projectSecret", provider.projectSecret);
22156
+ }
22157
+ isCommunityResource() {
22158
+ return (this.projectId === defaultProjectId);
22159
+ }
22160
+ }
22161
+ class InfuraProvider extends UrlJsonRpcProvider {
22162
+ static getWebSocketProvider(network, apiKey) {
22163
+ return new InfuraWebSocketProvider(network, apiKey);
22125
22164
}
22126
22165
static getApiKey(apiKey) {
22127
22166
const apiKeyObj = {
@@ -22172,6 +22211,7 @@ class InfuraProvider extends UrlJsonRpcProvider {
22172
22211
});
22173
22212
}
22174
22213
const connection = {
22214
+ allowGzip: true,
22175
22215
url: ("https:/" + "/" + host + "/v3/" + apiKey.projectId),
22176
22216
throttleCallback: (attempt, url) => {
22177
22217
if (apiKey.projectId === defaultProjectId) {
@@ -22186,6 +22226,9 @@ class InfuraProvider extends UrlJsonRpcProvider {
22186
22226
}
22187
22227
return connection;
22188
22228
}
22229
+ isCommunityResource() {
22230
+ return (this.projectId === defaultProjectId);
22231
+ }
22189
22232
}
22190
22233
22191
22234
/* istanbul ignore file */
@@ -22371,9 +22414,11 @@ var index$2 = /*#__PURE__*/Object.freeze({
22371
22414
UrlJsonRpcProvider: UrlJsonRpcProvider,
22372
22415
FallbackProvider: FallbackProvider,
22373
22416
AlchemyProvider: AlchemyProvider,
22417
+ AlchemyWebSocketProvider: AlchemyWebSocketProvider,
22374
22418
CloudflareProvider: CloudflareProvider,
22375
22419
EtherscanProvider: EtherscanProvider,
22376
22420
InfuraProvider: InfuraProvider,
22421
+ InfuraWebSocketProvider: InfuraWebSocketProvider,
22377
22422
JsonRpcProvider: JsonRpcProvider,
22378
22423
NodesmithProvider: NodesmithProvider,
22379
22424
StaticJsonRpcProvider: StaticJsonRpcProvider,
@@ -22383,6 +22428,9 @@ var index$2 = /*#__PURE__*/Object.freeze({
22383
22428
JsonRpcSigner: JsonRpcSigner,
22384
22429
getDefaultProvider: getDefaultProvider,
22385
22430
getNetwork: getNetwork,
22431
+ isCommunityResource: isCommunityResource,
22432
+ isCommunityResourcable: isCommunityResourcable,
22433
+ showThrottleMessage: showThrottleMessage,
22386
22434
Formatter: Formatter
22387
22435
});
22388
22436
@@ -22469,7 +22517,7 @@ function sha256$1(types, values) {
22469
22517
return browser_3(pack$1(types, values));
22470
22518
}
22471
22519
22472
- const version$n = "units/5.0.5 ";
22520
+ const version$n = "units/5.0.6 ";
22473
22521
22474
22522
"use strict";
22475
22523
const logger$D = new Logger(version$n);
@@ -22534,6 +22582,9 @@ function formatUnits(value, unitName) {
22534
22582
return formatFixed(value, (unitName != null) ? unitName : 18);
22535
22583
}
22536
22584
function parseUnits(value, unitName) {
22585
+ if (typeof (value) !== "string") {
22586
+ logger$D.throwArgumentError("value must be a string", "value", value);
22587
+ }
22537
22588
if (typeof (unitName) === "string") {
22538
22589
const index = names.indexOf(unitName);
22539
22590
if (index !== -1) {
0 commit comments