Skip to content

Commit 5b8781d

Browse files
committed
admin: updated dist files
1 parent e97ca3b commit 5b8781d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+424
-163
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ Change Log
33

44
This change log is maintained by `src.ts/_admin/update-changelog.ts` but may also be manually updated.
55

6+
ethers/v6.13.0 (2024-06-04 00:24)
7+
---------------------------------
8+
9+
- Added Options for BrowserProvider ([#4707](https://github.com/ethers-io/ethers.js/issues/4707); [33bb0bf](https://github.com/ethers-io/ethers.js/commit/33bb0bf30e1e6a699c24415a1edf0fa4ed28b6aa)).
10+
- Fix Result deep toObject when a parent is an Array ([#4681](https://github.com/ethers-io/ethers.js/issues/4681); [d8cb849](https://github.com/ethers-io/ethers.js/commit/d8cb84957078985f5449fa26c6fd8087dbd17aec)).
11+
- Added consistent timeout and cancel behaviour to FetchRequest ([#4122](https://github.com/ethers-io/ethers.js/issues/4122); [a12a739](https://github.com/ethers-io/ethers.js/commit/a12a7391fba39b5c114fa658590fae305dcedd17)).
12+
613
ethers/v6.12.2 (2024-05-30 17:24)
714
---------------------------------
815

dist/ethers.js

Lines changed: 77 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
33
/**
44
* The current version of Ethers.
55
*/
6-
const version = "6.12.2";
6+
const version = "6.13.0";
77

88
/**
99
* Property helper functions.
@@ -999,9 +999,9 @@ function toUtf8CodePoints(str, form) {
999999
return getUtf8CodePoints(toUtf8Bytes(str, form));
10001000
}
10011001

1002-
// @TODO: timeout is completely ignored; start a Promise.any with a reject?
10031002
function createGetUrl(options) {
10041003
async function getUrl(req, _signal) {
1004+
assert(_signal == null || !_signal.cancelled, "request cancelled before sending", "CANCELLED");
10051005
const protocol = req.url.split(":")[0].toLowerCase();
10061006
assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", {
10071007
info: { protocol },
@@ -1010,19 +1010,36 @@ function createGetUrl(options) {
10101010
assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", {
10111011
operation: "request"
10121012
});
1013-
let signal = undefined;
1013+
let error = null;
1014+
const controller = new AbortController();
1015+
const timer = setTimeout(() => {
1016+
error = makeError("request timeout", "TIMEOUT");
1017+
controller.abort();
1018+
}, req.timeout);
10141019
if (_signal) {
1015-
const controller = new AbortController();
1016-
signal = controller.signal;
1017-
_signal.addListener(() => { controller.abort(); });
1020+
_signal.addListener(() => {
1021+
error = makeError("request cancelled", "CANCELLED");
1022+
controller.abort();
1023+
});
10181024
}
10191025
const init = {
10201026
method: req.method,
10211027
headers: new Headers(Array.from(req)),
10221028
body: req.body || undefined,
1023-
signal
1029+
signal: controller.signal
10241030
};
1025-
const resp = await fetch(req.url, init);
1031+
let resp;
1032+
try {
1033+
resp = await fetch(req.url, init);
1034+
}
1035+
catch (_error) {
1036+
clearTimeout(timer);
1037+
if (error) {
1038+
throw error;
1039+
}
1040+
throw _error;
1041+
}
1042+
clearTimeout(timer);
10261043
const headers = {};
10271044
resp.headers.forEach((value, key) => {
10281045
headers[key.toLowerCase()] = value;
@@ -2643,11 +2660,38 @@ const Padding = new Uint8Array(WordSize);
26432660
// - `then` is used to detect if an object is a Promise for await
26442661
const passProperties$1 = ["then"];
26452662
const _guard$4 = {};
2663+
const resultNames = new WeakMap();
2664+
function getNames(result) {
2665+
return resultNames.get(result);
2666+
}
2667+
function setNames(result, names) {
2668+
resultNames.set(result, names);
2669+
}
26462670
function throwError(name, error) {
26472671
const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`);
26482672
wrapped.error = error;
26492673
throw wrapped;
26502674
}
2675+
function toObject(names, items, deep) {
2676+
if (names.indexOf(null) >= 0) {
2677+
return items.map((item, index) => {
2678+
if (item instanceof Result) {
2679+
return toObject(getNames(item), item, deep);
2680+
}
2681+
return item;
2682+
});
2683+
}
2684+
return names.reduce((accum, name, index) => {
2685+
let item = items.getValue(name);
2686+
if (!(name in accum)) {
2687+
if (deep && item instanceof Result) {
2688+
item = toObject(getNames(item), item, deep);
2689+
}
2690+
accum[name] = item;
2691+
}
2692+
return accum;
2693+
}, {});
2694+
}
26512695
/**
26522696
* A [[Result]] is a sub-class of Array, which allows accessing any
26532697
* of its values either positionally by its index or, if keys are
@@ -2656,6 +2700,9 @@ function throwError(name, error) {
26562700
* @_docloc: api/abi
26572701
*/
26582702
class Result extends Array {
2703+
// No longer used; but cannot be removed as it will remove the
2704+
// #private field from the .d.ts which may break backwards
2705+
// compatibility
26592706
#names;
26602707
/**
26612708
* @private
@@ -2688,20 +2735,25 @@ class Result extends Array {
26882735
return accum;
26892736
}, (new Map()));
26902737
// Remove any key thats not unique
2691-
this.#names = Object.freeze(items.map((item, index) => {
2738+
setNames(this, Object.freeze(items.map((item, index) => {
26922739
const name = names[index];
26932740
if (name != null && nameCounts.get(name) === 1) {
26942741
return name;
26952742
}
26962743
return null;
2697-
}));
2744+
})));
2745+
// Dummy operations to prevent TypeScript from complaining
2746+
this.#names = [];
2747+
if (this.#names == null) {
2748+
void (this.#names);
2749+
}
26982750
if (!wrap) {
26992751
return;
27002752
}
27012753
// A wrapped Result is immutable
27022754
Object.freeze(this);
27032755
// Proxy indices and names so we can trap deferred errors
2704-
return new Proxy(this, {
2756+
const proxy = new Proxy(this, {
27052757
get: (target, prop, receiver) => {
27062758
if (typeof (prop) === "string") {
27072759
// Index accessor
@@ -2736,6 +2788,7 @@ class Result extends Array {
27362788
return Reflect.get(target, prop, receiver);
27372789
}
27382790
});
2791+
setNames(proxy, getNames(this));
27392792
}
27402793
/**
27412794
* Returns the Result as a normal Array. If %%deep%%, any children
@@ -2766,19 +2819,12 @@ class Result extends Array {
27662819
* any outstanding deferred errors.
27672820
*/
27682821
toObject(deep) {
2769-
return this.#names.reduce((accum, name, index) => {
2770-
assert(name != null, "value at index ${ index } unnamed", "UNSUPPORTED_OPERATION", {
2822+
const names = getNames(this);
2823+
return names.reduce((accum, name, index) => {
2824+
assert(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", {
27712825
operation: "toObject()"
27722826
});
2773-
// Add values for names that don't conflict
2774-
if (!(name in accum)) {
2775-
let child = this.getValue(name);
2776-
if (deep && child instanceof Result) {
2777-
child = child.toObject(deep);
2778-
}
2779-
accum[name] = child;
2780-
}
2781-
return accum;
2827+
return toObject(names, this, deep);
27822828
}, {});
27832829
}
27842830
/**
@@ -2806,17 +2852,19 @@ class Result extends Array {
28062852
if (end > this.length) {
28072853
end = this.length;
28082854
}
2855+
const _names = getNames(this);
28092856
const result = [], names = [];
28102857
for (let i = start; i < end; i++) {
28112858
result.push(this[i]);
2812-
names.push(this.#names[i]);
2859+
names.push(_names[i]);
28132860
}
28142861
return new Result(_guard$4, result, names);
28152862
}
28162863
/**
28172864
* @_ignore
28182865
*/
28192866
filter(callback, thisArg) {
2867+
const _names = getNames(this);
28202868
const result = [], names = [];
28212869
for (let i = 0; i < this.length; i++) {
28222870
const item = this[i];
@@ -2825,7 +2873,7 @@ class Result extends Array {
28252873
}
28262874
if (callback.call(thisArg, item, i, this)) {
28272875
result.push(item);
2828-
names.push(this.#names[i]);
2876+
names.push(_names[i]);
28292877
}
28302878
}
28312879
return new Result(_guard$4, result, names);
@@ -2853,7 +2901,7 @@ class Result extends Array {
28532901
* accessible by name.
28542902
*/
28552903
getValue(name) {
2856-
const index = this.#names.indexOf(name);
2904+
const index = getNames(this).indexOf(name);
28572905
if (index === -1) {
28582906
return undefined;
28592907
}
@@ -23268,9 +23316,11 @@ class BrowserProvider extends JsonRpcApiPollingProvider {
2326823316
* Connnect to the %%ethereum%% provider, optionally forcing the
2326923317
* %%network%%.
2327023318
*/
23271-
constructor(ethereum, network) {
23319+
constructor(ethereum, network, _options) {
23320+
// Copy the options
23321+
const options = Object.assign({}, ((_options != null) ? _options : {}), { batchMaxCount: 1 });
2327223322
assertArgument(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum);
23273-
super(network, { batchMaxCount: 1 });
23323+
super(network, options);
2327423324
this.#request = async (method, params) => {
2327523325
const payload = { method, params };
2327623326
this.emit("debug", { action: "sendEip1193Request", payload });

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

0 commit comments

Comments
 (0)