@hashgraphonline/standards-sdk 0.0.86 → 0.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/hcs-10/connections-manager.d.ts +4 -2
- package/dist/es/hcs-10/connections-manager.d.ts.map +1 -1
- package/dist/es/standards-sdk.es10.js +18 -10
- package/dist/es/standards-sdk.es10.js.map +1 -1
- package/dist/es/standards-sdk.es100.js +29 -145
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +13 -89
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +3 -83
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +3 -31
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +3 -5
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +13 -156
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +4 -22
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +37 -791
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +35 -138
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +35 -172
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +75 -31
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +3 -33
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +2 -9
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +2 -34
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +33 -20
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +32 -26
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +9 -26
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es117.js +33 -37
- package/dist/es/standards-sdk.es117.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +3 -3
- package/dist/es/standards-sdk.es18.js +2 -2
- package/dist/es/standards-sdk.es19.js +3 -3
- package/dist/es/standards-sdk.es22.js +966 -1692
- package/dist/es/standards-sdk.es22.js.map +1 -1
- package/dist/es/standards-sdk.es23.js +1767 -36
- package/dist/es/standards-sdk.es23.js.map +1 -1
- package/dist/es/standards-sdk.es24.js +3 -48
- package/dist/es/standards-sdk.es24.js.map +1 -1
- package/dist/es/standards-sdk.es25.js +3843 -6866
- package/dist/es/standards-sdk.es25.js.map +1 -1
- package/dist/es/standards-sdk.es26.js +36 -3
- package/dist/es/standards-sdk.es26.js.map +1 -1
- package/dist/es/standards-sdk.es27.js +48 -2
- package/dist/es/standards-sdk.es27.js.map +1 -1
- package/dist/es/standards-sdk.es28.js +7091 -942
- package/dist/es/standards-sdk.es28.js.map +1 -1
- package/dist/es/standards-sdk.es29.js +2 -4167
- package/dist/es/standards-sdk.es29.js.map +1 -1
- package/dist/es/standards-sdk.es30.js +2 -2
- package/dist/es/standards-sdk.es31.js +87 -405
- package/dist/es/standards-sdk.es31.js.map +1 -1
- package/dist/es/standards-sdk.es32.js +2 -2
- package/dist/es/standards-sdk.es33.js +15 -119
- package/dist/es/standards-sdk.es33.js.map +1 -1
- package/dist/es/standards-sdk.es34.js +408 -3
- package/dist/es/standards-sdk.es34.js.map +1 -1
- package/dist/es/standards-sdk.es35.js +2281 -363
- package/dist/es/standards-sdk.es35.js.map +1 -1
- package/dist/es/standards-sdk.es36.js +163 -5
- package/dist/es/standards-sdk.es36.js.map +1 -1
- package/dist/es/standards-sdk.es37.js +2 -179
- package/dist/es/standards-sdk.es37.js.map +1 -1
- package/dist/es/standards-sdk.es38.js +351 -68
- package/dist/es/standards-sdk.es38.js.map +1 -1
- package/dist/es/standards-sdk.es39.js +5 -113
- package/dist/es/standards-sdk.es39.js.map +1 -1
- package/dist/es/standards-sdk.es4.js +1 -1
- package/dist/es/standards-sdk.es40.js +170 -43
- package/dist/es/standards-sdk.es40.js.map +1 -1
- package/dist/es/standards-sdk.es41.js +80 -9
- package/dist/es/standards-sdk.es41.js.map +1 -1
- package/dist/es/standards-sdk.es42.js +104 -87
- package/dist/es/standards-sdk.es42.js.map +1 -1
- package/dist/es/standards-sdk.es43.js +51 -3
- package/dist/es/standards-sdk.es43.js.map +1 -1
- package/dist/es/standards-sdk.es44.js +10 -2
- package/dist/es/standards-sdk.es44.js.map +1 -1
- package/dist/es/standards-sdk.es45.js +86 -102
- package/dist/es/standards-sdk.es45.js.map +1 -1
- package/dist/es/standards-sdk.es46.js +3 -73
- package/dist/es/standards-sdk.es46.js.map +1 -1
- package/dist/es/standards-sdk.es47.js +2 -6
- package/dist/es/standards-sdk.es47.js.map +1 -1
- package/dist/es/standards-sdk.es48.js +112 -4
- package/dist/es/standards-sdk.es48.js.map +1 -1
- package/dist/es/standards-sdk.es49.js +69 -216
- package/dist/es/standards-sdk.es49.js.map +1 -1
- package/dist/es/standards-sdk.es5.js +3 -3
- package/dist/es/standards-sdk.es50.js +6 -58
- package/dist/es/standards-sdk.es50.js.map +1 -1
- package/dist/es/standards-sdk.es51.js +5 -69
- package/dist/es/standards-sdk.es51.js.map +1 -1
- package/dist/es/standards-sdk.es52.js +208 -88
- package/dist/es/standards-sdk.es52.js.map +1 -1
- package/dist/es/standards-sdk.es53.js +58 -2
- package/dist/es/standards-sdk.es53.js.map +1 -1
- package/dist/es/standards-sdk.es54.js +69 -16
- package/dist/es/standards-sdk.es54.js.map +1 -1
- package/dist/es/standards-sdk.es55.js +190 -404
- package/dist/es/standards-sdk.es55.js.map +1 -1
- package/dist/es/standards-sdk.es56.js +437 -2281
- package/dist/es/standards-sdk.es56.js.map +1 -1
- package/dist/es/standards-sdk.es57.js +20 -159
- package/dist/es/standards-sdk.es57.js.map +1 -1
- package/dist/es/standards-sdk.es58.js +139 -3
- package/dist/es/standards-sdk.es58.js.map +1 -1
- package/dist/es/standards-sdk.es59.js +13 -27
- package/dist/es/standards-sdk.es59.js.map +1 -1
- package/dist/es/standards-sdk.es60.js +23 -57
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es61.js +25 -46
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +20 -9
- package/dist/es/standards-sdk.es62.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +37 -58
- package/dist/es/standards-sdk.es63.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +18 -6
- package/dist/es/standards-sdk.es64.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +59 -13
- package/dist/es/standards-sdk.es65.js.map +1 -1
- package/dist/es/standards-sdk.es66.js +1288 -6
- package/dist/es/standards-sdk.es66.js.map +1 -1
- package/dist/es/standards-sdk.es67.js +144 -41
- package/dist/es/standards-sdk.es67.js.map +1 -1
- package/dist/es/standards-sdk.es68.js +91 -2
- package/dist/es/standards-sdk.es68.js.map +1 -1
- package/dist/es/standards-sdk.es69.js +80 -132
- package/dist/es/standards-sdk.es69.js.map +1 -1
- package/dist/es/standards-sdk.es7.js +3 -3
- package/dist/es/standards-sdk.es70.js +28 -168
- package/dist/es/standards-sdk.es70.js.map +1 -1
- package/dist/es/standards-sdk.es71.js +6 -13
- package/dist/es/standards-sdk.es71.js.map +1 -1
- package/dist/es/standards-sdk.es72.js +159 -13
- package/dist/es/standards-sdk.es72.js.map +1 -1
- package/dist/es/standards-sdk.es73.js +22 -7135
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es74.js +793 -2
- package/dist/es/standards-sdk.es74.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +172 -30
- package/dist/es/standards-sdk.es75.js.map +1 -1
- package/dist/es/standards-sdk.es76.js +142 -14
- package/dist/es/standards-sdk.es76.js.map +1 -1
- package/dist/es/standards-sdk.es77.js +3 -4
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +31 -3
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +61 -14
- package/dist/es/standards-sdk.es79.js.map +1 -1
- package/dist/es/standards-sdk.es8.js +3 -3
- package/dist/es/standards-sdk.es80.js +49 -4
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +10 -39
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +58 -33
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +5 -36
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +13 -76
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +7 -3
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +45 -2
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +2 -2
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +131 -190
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +158 -424
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es9.js +1 -1
- package/dist/es/standards-sdk.es90.js +14 -18
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +23 -135
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +24 -16
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +35 -26
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +417 -27
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +2 -21
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +114 -38
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +13 -18
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +13 -61
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +7060 -1213
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/dist/umd/hcs-10/connections-manager.d.ts +4 -2
- package/dist/umd/hcs-10/connections-manager.d.ts.map +1 -1
- package/dist/umd/standards-sdk.umd.js +1 -1
- package/dist/umd/standards-sdk.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,441 +1,175 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const Padding = new Uint8Array(WordSize);
|
|
19
|
-
const passProperties = ["then"];
|
|
20
|
-
const _guard = {};
|
|
21
|
-
const resultNames = /* @__PURE__ */ new WeakMap();
|
|
22
|
-
function getNames(result) {
|
|
23
|
-
return resultNames.get(result);
|
|
24
|
-
}
|
|
25
|
-
function setNames(result, names) {
|
|
26
|
-
resultNames.set(result, names);
|
|
27
|
-
}
|
|
28
|
-
function throwError(name, error) {
|
|
29
|
-
const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`);
|
|
30
|
-
wrapped.error = error;
|
|
31
|
-
throw wrapped;
|
|
32
|
-
}
|
|
33
|
-
function toObject(names, items, deep) {
|
|
34
|
-
if (names.indexOf(null) >= 0) {
|
|
35
|
-
return items.map((item, index) => {
|
|
36
|
-
if (item instanceof Result) {
|
|
37
|
-
return toObject(getNames(item), item, deep);
|
|
38
|
-
}
|
|
39
|
-
return item;
|
|
40
|
-
});
|
|
1
|
+
import platform from "./standards-sdk.es85.js";
|
|
2
|
+
import utils from "./standards-sdk.es38.js";
|
|
3
|
+
import AxiosError from "./standards-sdk.es49.js";
|
|
4
|
+
import composeSignals from "./standards-sdk.es109.js";
|
|
5
|
+
import { trackStream } from "./standards-sdk.es110.js";
|
|
6
|
+
import AxiosHeaders from "./standards-sdk.es52.js";
|
|
7
|
+
import { progressEventDecorator, progressEventReducer, asyncDecorator } from "./standards-sdk.es107.js";
|
|
8
|
+
import resolveConfig from "./standards-sdk.es108.js";
|
|
9
|
+
import settle from "./standards-sdk.es105.js";
|
|
10
|
+
const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
|
|
11
|
+
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
|
|
12
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
|
|
13
|
+
const test = (fn, ...args) => {
|
|
14
|
+
try {
|
|
15
|
+
return !!fn(...args);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
return false;
|
|
41
18
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
names = [];
|
|
65
|
-
wrap = false;
|
|
66
|
-
}
|
|
67
|
-
super(items.length);
|
|
68
|
-
// No longer used; but cannot be removed as it will remove the
|
|
69
|
-
// #private field from the .d.ts which may break backwards
|
|
70
|
-
// compatibility
|
|
71
|
-
__privateAdd(this, _names);
|
|
72
|
-
items.forEach((item, index) => {
|
|
73
|
-
this[index] = item;
|
|
19
|
+
};
|
|
20
|
+
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
21
|
+
let duplexAccessed = false;
|
|
22
|
+
const hasContentType = new Request(platform.origin, {
|
|
23
|
+
body: new ReadableStream(),
|
|
24
|
+
method: "POST",
|
|
25
|
+
get duplex() {
|
|
26
|
+
duplexAccessed = true;
|
|
27
|
+
return "half";
|
|
28
|
+
}
|
|
29
|
+
}).headers.has("Content-Type");
|
|
30
|
+
return duplexAccessed && !hasContentType;
|
|
31
|
+
});
|
|
32
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
33
|
+
const supportsResponseStream = isReadableStreamSupported && test(() => utils.isReadableStream(new Response("").body));
|
|
34
|
+
const resolvers = {
|
|
35
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
36
|
+
};
|
|
37
|
+
isFetchSupported && ((res) => {
|
|
38
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
39
|
+
!resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
|
|
40
|
+
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
74
41
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
__privateSet(this, _names, []);
|
|
89
|
-
if (__privateGet(this, _names) == null) {
|
|
90
|
-
void __privateGet(this, _names);
|
|
91
|
-
}
|
|
92
|
-
if (!wrap) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
Object.freeze(this);
|
|
96
|
-
const proxy = new Proxy(this, {
|
|
97
|
-
get: (target, prop, receiver) => {
|
|
98
|
-
if (typeof prop === "string") {
|
|
99
|
-
if (prop.match(/^[0-9]+$/)) {
|
|
100
|
-
const index = getNumber(prop, "%index");
|
|
101
|
-
if (index < 0 || index >= this.length) {
|
|
102
|
-
throw new RangeError("out of result range");
|
|
103
|
-
}
|
|
104
|
-
const item = target[index];
|
|
105
|
-
if (item instanceof Error) {
|
|
106
|
-
throwError(`index ${index}`, item);
|
|
107
|
-
}
|
|
108
|
-
return item;
|
|
109
|
-
}
|
|
110
|
-
if (passProperties.indexOf(prop) >= 0) {
|
|
111
|
-
return Reflect.get(target, prop, receiver);
|
|
112
|
-
}
|
|
113
|
-
const value = target[prop];
|
|
114
|
-
if (value instanceof Function) {
|
|
115
|
-
return function(...args2) {
|
|
116
|
-
return value.apply(this === receiver ? target : this, args2);
|
|
117
|
-
};
|
|
118
|
-
} else if (!(prop in target)) {
|
|
119
|
-
return target.getValue.apply(this === receiver ? target : this, [prop]);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return Reflect.get(target, prop, receiver);
|
|
123
|
-
}
|
|
42
|
+
});
|
|
43
|
+
})(new Response());
|
|
44
|
+
const getBodyLength = async (body) => {
|
|
45
|
+
if (body == null) {
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
if (utils.isBlob(body)) {
|
|
49
|
+
return body.size;
|
|
50
|
+
}
|
|
51
|
+
if (utils.isSpecCompliantForm(body)) {
|
|
52
|
+
const _request = new Request(platform.origin, {
|
|
53
|
+
method: "POST",
|
|
54
|
+
body
|
|
124
55
|
});
|
|
125
|
-
|
|
126
|
-
return proxy;
|
|
56
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
127
57
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
* which are Result objects are also converted to a normal Array.
|
|
131
|
-
*
|
|
132
|
-
* This will throw if there are any outstanding deferred
|
|
133
|
-
* errors.
|
|
134
|
-
*/
|
|
135
|
-
toArray(deep) {
|
|
136
|
-
const result = [];
|
|
137
|
-
this.forEach((item, index) => {
|
|
138
|
-
if (item instanceof Error) {
|
|
139
|
-
throwError(`index ${index}`, item);
|
|
140
|
-
}
|
|
141
|
-
if (deep && item instanceof _Result) {
|
|
142
|
-
item = item.toArray(deep);
|
|
143
|
-
}
|
|
144
|
-
result.push(item);
|
|
145
|
-
});
|
|
146
|
-
return result;
|
|
58
|
+
if (utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {
|
|
59
|
+
return body.byteLength;
|
|
147
60
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
* %%deep%%, any children which are Result objects are also
|
|
151
|
-
* converted to an Object.
|
|
152
|
-
*
|
|
153
|
-
* This will throw if any value is unnamed, or if there are
|
|
154
|
-
* any outstanding deferred errors.
|
|
155
|
-
*/
|
|
156
|
-
toObject(deep) {
|
|
157
|
-
const names = getNames(this);
|
|
158
|
-
return names.reduce((accum, name, index) => {
|
|
159
|
-
assert(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", {
|
|
160
|
-
operation: "toObject()"
|
|
161
|
-
});
|
|
162
|
-
return toObject(names, this, deep);
|
|
163
|
-
}, {});
|
|
61
|
+
if (utils.isURLSearchParams(body)) {
|
|
62
|
+
body = body + "";
|
|
164
63
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
*/
|
|
168
|
-
slice(start, end) {
|
|
169
|
-
if (start == null) {
|
|
170
|
-
start = 0;
|
|
171
|
-
}
|
|
172
|
-
if (start < 0) {
|
|
173
|
-
start += this.length;
|
|
174
|
-
if (start < 0) {
|
|
175
|
-
start = 0;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (end == null) {
|
|
179
|
-
end = this.length;
|
|
180
|
-
}
|
|
181
|
-
if (end < 0) {
|
|
182
|
-
end += this.length;
|
|
183
|
-
if (end < 0) {
|
|
184
|
-
end = 0;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (end > this.length) {
|
|
188
|
-
end = this.length;
|
|
189
|
-
}
|
|
190
|
-
const _names2 = getNames(this);
|
|
191
|
-
const result = [], names = [];
|
|
192
|
-
for (let i = start; i < end; i++) {
|
|
193
|
-
result.push(this[i]);
|
|
194
|
-
names.push(_names2[i]);
|
|
195
|
-
}
|
|
196
|
-
return new _Result(_guard, result, names);
|
|
64
|
+
if (utils.isString(body)) {
|
|
65
|
+
return (await encodeText(body)).byteLength;
|
|
197
66
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
67
|
+
};
|
|
68
|
+
const resolveBodyLength = async (headers, body) => {
|
|
69
|
+
const length = utils.toFiniteNumber(headers.getContentLength());
|
|
70
|
+
return length == null ? getBodyLength(body) : length;
|
|
71
|
+
};
|
|
72
|
+
const fetchAdapter = isFetchSupported && (async (config) => {
|
|
73
|
+
let {
|
|
74
|
+
url,
|
|
75
|
+
method,
|
|
76
|
+
data,
|
|
77
|
+
signal,
|
|
78
|
+
cancelToken,
|
|
79
|
+
timeout,
|
|
80
|
+
onDownloadProgress,
|
|
81
|
+
onUploadProgress,
|
|
82
|
+
responseType,
|
|
83
|
+
headers,
|
|
84
|
+
withCredentials = "same-origin",
|
|
85
|
+
fetchOptions
|
|
86
|
+
} = resolveConfig(config);
|
|
87
|
+
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
88
|
+
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
89
|
+
let request;
|
|
90
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
91
|
+
composedSignal.unsubscribe();
|
|
92
|
+
});
|
|
93
|
+
let requestContentLength;
|
|
94
|
+
try {
|
|
95
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
96
|
+
let _request = new Request(url, {
|
|
97
|
+
method: "POST",
|
|
98
|
+
body: data,
|
|
99
|
+
duplex: "half"
|
|
100
|
+
});
|
|
101
|
+
let contentTypeHeader;
|
|
102
|
+
if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
|
|
103
|
+
headers.setContentType(contentTypeHeader);
|
|
212
104
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
map(callback, thisArg) {
|
|
220
|
-
const result = [];
|
|
221
|
-
for (let i = 0; i < this.length; i++) {
|
|
222
|
-
const item = this[i];
|
|
223
|
-
if (item instanceof Error) {
|
|
224
|
-
throwError(`index ${i}`, item);
|
|
105
|
+
if (_request.body) {
|
|
106
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
107
|
+
requestContentLength,
|
|
108
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
109
|
+
);
|
|
110
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
225
111
|
}
|
|
226
|
-
result.push(callback.call(thisArg, item, i, this));
|
|
227
|
-
}
|
|
228
|
-
return result;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Returns the value for %%name%%.
|
|
232
|
-
*
|
|
233
|
-
* Since it is possible to have a key whose name conflicts with
|
|
234
|
-
* a method on a [[Result]] or its superclass Array, or any
|
|
235
|
-
* JavaScript keyword, this ensures all named values are still
|
|
236
|
-
* accessible by name.
|
|
237
|
-
*/
|
|
238
|
-
getValue(name) {
|
|
239
|
-
const index = getNames(this).indexOf(name);
|
|
240
|
-
if (index === -1) {
|
|
241
|
-
return void 0;
|
|
242
|
-
}
|
|
243
|
-
const value = this[index];
|
|
244
|
-
if (value instanceof Error) {
|
|
245
|
-
throwError(`property ${JSON.stringify(name)}`, value.error);
|
|
246
112
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
function getValue(value) {
|
|
260
|
-
let bytes = toBeArray(value);
|
|
261
|
-
assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes, length: WordSize, offset: bytes.length });
|
|
262
|
-
if (bytes.length !== WordSize) {
|
|
263
|
-
bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes]));
|
|
264
|
-
}
|
|
265
|
-
return bytes;
|
|
266
|
-
}
|
|
267
|
-
class Coder {
|
|
268
|
-
constructor(name, type, localName, dynamic) {
|
|
269
|
-
// The coder name:
|
|
270
|
-
// - address, uint256, tuple, array, etc.
|
|
271
|
-
__publicField(this, "name");
|
|
272
|
-
// The fully expanded type, including composite types:
|
|
273
|
-
// - address, uint256, tuple(address,bytes), uint256[3][4][], etc.
|
|
274
|
-
__publicField(this, "type");
|
|
275
|
-
// The localName bound in the signature, in this example it is "baz":
|
|
276
|
-
// - tuple(address foo, uint bar) baz
|
|
277
|
-
__publicField(this, "localName");
|
|
278
|
-
// Whether this type is dynamic:
|
|
279
|
-
// - Dynamic: bytes, string, address[], tuple(boolean[]), etc.
|
|
280
|
-
// - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)
|
|
281
|
-
__publicField(this, "dynamic");
|
|
282
|
-
defineProperties(this, { name, type, localName, dynamic }, {
|
|
283
|
-
name: "string",
|
|
284
|
-
type: "string",
|
|
285
|
-
localName: "string",
|
|
286
|
-
dynamic: "boolean"
|
|
113
|
+
if (!utils.isString(withCredentials)) {
|
|
114
|
+
withCredentials = withCredentials ? "include" : "omit";
|
|
115
|
+
}
|
|
116
|
+
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
117
|
+
request = new Request(url, {
|
|
118
|
+
...fetchOptions,
|
|
119
|
+
signal: composedSignal,
|
|
120
|
+
method: method.toUpperCase(),
|
|
121
|
+
headers: headers.normalize().toJSON(),
|
|
122
|
+
body: data,
|
|
123
|
+
duplex: "half",
|
|
124
|
+
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
287
125
|
});
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
constructor() {
|
|
295
|
-
__privateAdd(this, _Writer_instances);
|
|
296
|
-
// An array of WordSize lengthed objects to concatenation
|
|
297
|
-
__privateAdd(this, _data);
|
|
298
|
-
__privateAdd(this, _dataLength);
|
|
299
|
-
__privateSet(this, _data, []);
|
|
300
|
-
__privateSet(this, _dataLength, 0);
|
|
301
|
-
}
|
|
302
|
-
get data() {
|
|
303
|
-
return concat(__privateGet(this, _data));
|
|
304
|
-
}
|
|
305
|
-
get length() {
|
|
306
|
-
return __privateGet(this, _dataLength);
|
|
307
|
-
}
|
|
308
|
-
appendWriter(writer) {
|
|
309
|
-
return __privateMethod(this, _Writer_instances, writeData_fn).call(this, getBytesCopy(writer.data));
|
|
310
|
-
}
|
|
311
|
-
// Arrayish item; pad on the right to *nearest* WordSize
|
|
312
|
-
writeBytes(value) {
|
|
313
|
-
let bytes = getBytesCopy(value);
|
|
314
|
-
const paddingOffset = bytes.length % WordSize;
|
|
315
|
-
if (paddingOffset) {
|
|
316
|
-
bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)]));
|
|
317
|
-
}
|
|
318
|
-
return __privateMethod(this, _Writer_instances, writeData_fn).call(this, bytes);
|
|
319
|
-
}
|
|
320
|
-
// Numeric item; pad on the left *to* WordSize
|
|
321
|
-
writeValue(value) {
|
|
322
|
-
return __privateMethod(this, _Writer_instances, writeData_fn).call(this, getValue(value));
|
|
323
|
-
}
|
|
324
|
-
// Inserts a numeric place-holder, returning a callback that can
|
|
325
|
-
// be used to asjust the value later
|
|
326
|
-
writeUpdatableValue() {
|
|
327
|
-
const offset = __privateGet(this, _data).length;
|
|
328
|
-
__privateGet(this, _data).push(Padding);
|
|
329
|
-
__privateSet(this, _dataLength, __privateGet(this, _dataLength) + WordSize);
|
|
330
|
-
return (value) => {
|
|
331
|
-
__privateGet(this, _data)[offset] = getValue(value);
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
_data = new WeakMap();
|
|
336
|
-
_dataLength = new WeakMap();
|
|
337
|
-
_Writer_instances = new WeakSet();
|
|
338
|
-
writeData_fn = function(data) {
|
|
339
|
-
__privateGet(this, _data).push(data);
|
|
340
|
-
__privateSet(this, _dataLength, __privateGet(this, _dataLength) + data.length);
|
|
341
|
-
return data.length;
|
|
342
|
-
};
|
|
343
|
-
const _Reader = class _Reader {
|
|
344
|
-
constructor(data, allowLoose, maxInflation) {
|
|
345
|
-
__privateAdd(this, _Reader_instances);
|
|
346
|
-
// Allows incomplete unpadded data to be read; otherwise an error
|
|
347
|
-
// is raised if attempting to overrun the buffer. This is required
|
|
348
|
-
// to deal with an old Solidity bug, in which event data for
|
|
349
|
-
// external (not public thoguh) was tightly packed.
|
|
350
|
-
__publicField(this, "allowLoose");
|
|
351
|
-
__privateAdd(this, _data2);
|
|
352
|
-
__privateAdd(this, _offset);
|
|
353
|
-
__privateAdd(this, _bytesRead);
|
|
354
|
-
__privateAdd(this, _parent);
|
|
355
|
-
__privateAdd(this, _maxInflation);
|
|
356
|
-
defineProperties(this, { allowLoose: !!allowLoose });
|
|
357
|
-
__privateSet(this, _data2, getBytesCopy(data));
|
|
358
|
-
__privateSet(this, _bytesRead, 0);
|
|
359
|
-
__privateSet(this, _parent, null);
|
|
360
|
-
__privateSet(this, _maxInflation, maxInflation != null ? maxInflation : 1024);
|
|
361
|
-
__privateSet(this, _offset, 0);
|
|
362
|
-
}
|
|
363
|
-
get data() {
|
|
364
|
-
return hexlify(__privateGet(this, _data2));
|
|
365
|
-
}
|
|
366
|
-
get dataLength() {
|
|
367
|
-
return __privateGet(this, _data2).length;
|
|
368
|
-
}
|
|
369
|
-
get consumed() {
|
|
370
|
-
return __privateGet(this, _offset);
|
|
371
|
-
}
|
|
372
|
-
get bytes() {
|
|
373
|
-
return new Uint8Array(__privateGet(this, _data2));
|
|
374
|
-
}
|
|
375
|
-
// Create a sub-reader with the same underlying data, but offset
|
|
376
|
-
subReader(offset) {
|
|
377
|
-
const reader = new _Reader(__privateGet(this, _data2).slice(__privateGet(this, _offset) + offset), this.allowLoose, __privateGet(this, _maxInflation));
|
|
378
|
-
__privateSet(reader, _parent, this);
|
|
379
|
-
return reader;
|
|
380
|
-
}
|
|
381
|
-
// Read bytes
|
|
382
|
-
readBytes(length, loose) {
|
|
383
|
-
let bytes = __privateMethod(this, _Reader_instances, peekBytes_fn).call(this, 0, length, !!loose);
|
|
384
|
-
__privateMethod(this, _Reader_instances, incrementBytesRead_fn).call(this, length);
|
|
385
|
-
__privateSet(this, _offset, __privateGet(this, _offset) + bytes.length);
|
|
386
|
-
return bytes.slice(0, length);
|
|
387
|
-
}
|
|
388
|
-
// Read a numeric values
|
|
389
|
-
readValue() {
|
|
390
|
-
return toBigInt(this.readBytes(WordSize));
|
|
391
|
-
}
|
|
392
|
-
readIndex() {
|
|
393
|
-
return toNumber(this.readBytes(WordSize));
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
_data2 = new WeakMap();
|
|
397
|
-
_offset = new WeakMap();
|
|
398
|
-
_bytesRead = new WeakMap();
|
|
399
|
-
_parent = new WeakMap();
|
|
400
|
-
_maxInflation = new WeakMap();
|
|
401
|
-
_Reader_instances = new WeakSet();
|
|
402
|
-
incrementBytesRead_fn = function(count) {
|
|
403
|
-
var _a;
|
|
404
|
-
if (__privateGet(this, _parent)) {
|
|
405
|
-
return __privateMethod(_a = __privateGet(this, _parent), _Reader_instances, incrementBytesRead_fn).call(_a, count);
|
|
406
|
-
}
|
|
407
|
-
__privateSet(this, _bytesRead, __privateGet(this, _bytesRead) + count);
|
|
408
|
-
assert(__privateGet(this, _maxInflation) < 1 || __privateGet(this, _bytesRead) <= __privateGet(this, _maxInflation) * this.dataLength, `compressed ABI data exceeds inflation ratio of ${__privateGet(this, _maxInflation)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
|
|
409
|
-
buffer: getBytesCopy(__privateGet(this, _data2)),
|
|
410
|
-
offset: __privateGet(this, _offset),
|
|
411
|
-
length: count,
|
|
412
|
-
info: {
|
|
413
|
-
bytesRead: __privateGet(this, _bytesRead),
|
|
414
|
-
dataLength: this.dataLength
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
};
|
|
418
|
-
peekBytes_fn = function(offset, length, loose) {
|
|
419
|
-
let alignedLength = Math.ceil(length / WordSize) * WordSize;
|
|
420
|
-
if (__privateGet(this, _offset) + alignedLength > __privateGet(this, _data2).length) {
|
|
421
|
-
if (this.allowLoose && loose && __privateGet(this, _offset) + length <= __privateGet(this, _data2).length) {
|
|
422
|
-
alignedLength = length;
|
|
423
|
-
} else {
|
|
424
|
-
assert(false, "data out-of-bounds", "BUFFER_OVERRUN", {
|
|
425
|
-
buffer: getBytesCopy(__privateGet(this, _data2)),
|
|
426
|
-
length: __privateGet(this, _data2).length,
|
|
427
|
-
offset: __privateGet(this, _offset) + alignedLength
|
|
126
|
+
let response = await fetch(request);
|
|
127
|
+
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
128
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
129
|
+
const options = {};
|
|
130
|
+
["status", "statusText", "headers"].forEach((prop) => {
|
|
131
|
+
options[prop] = response[prop];
|
|
428
132
|
});
|
|
133
|
+
const responseContentLength = utils.toFiniteNumber(response.headers.get("content-length"));
|
|
134
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
135
|
+
responseContentLength,
|
|
136
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
137
|
+
) || [];
|
|
138
|
+
response = new Response(
|
|
139
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
140
|
+
flush && flush();
|
|
141
|
+
unsubscribe && unsubscribe();
|
|
142
|
+
}),
|
|
143
|
+
options
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
responseType = responseType || "text";
|
|
147
|
+
let responseData = await resolvers[utils.findKey(resolvers, responseType) || "text"](response, config);
|
|
148
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
149
|
+
return await new Promise((resolve, reject) => {
|
|
150
|
+
settle(resolve, reject, {
|
|
151
|
+
data: responseData,
|
|
152
|
+
headers: AxiosHeaders.from(response.headers),
|
|
153
|
+
status: response.status,
|
|
154
|
+
statusText: response.statusText,
|
|
155
|
+
config,
|
|
156
|
+
request
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
} catch (err) {
|
|
160
|
+
unsubscribe && unsubscribe();
|
|
161
|
+
if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
|
|
162
|
+
throw Object.assign(
|
|
163
|
+
new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request),
|
|
164
|
+
{
|
|
165
|
+
cause: err.cause || err
|
|
166
|
+
}
|
|
167
|
+
);
|
|
429
168
|
}
|
|
169
|
+
throw AxiosError.from(err, err && err.code, config, request);
|
|
430
170
|
}
|
|
431
|
-
|
|
432
|
-
};
|
|
433
|
-
let Reader = _Reader;
|
|
171
|
+
});
|
|
434
172
|
export {
|
|
435
|
-
|
|
436
|
-
Reader,
|
|
437
|
-
Result,
|
|
438
|
-
WordSize,
|
|
439
|
-
Writer
|
|
173
|
+
fetchAdapter as default
|
|
440
174
|
};
|
|
441
175
|
//# sourceMappingURL=standards-sdk.es89.js.map
|