@hashgraphonline/standards-sdk 0.0.102 → 0.0.104
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/services/mirror-node.d.ts +1 -1
- package/dist/es/services/mirror-node.d.ts.map +1 -1
- package/dist/es/standards-sdk.es100.js +4 -10
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +39 -18
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +39 -5
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +37 -9
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +77 -12
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +21 -13
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +25 -30
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +25 -14
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +37 -3
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +33 -3
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +32 -15
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +9 -5
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +34 -39
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +3 -40
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +2 -37
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +2 -78
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es116.js +7092 -375
- package/dist/es/standards-sdk.es116.js.map +1 -1
- package/dist/es/standards-sdk.es117.js +101 -2
- package/dist/es/standards-sdk.es117.js.map +1 -1
- package/dist/es/standards-sdk.es118.js +2 -120
- package/dist/es/standards-sdk.es118.js.map +1 -1
- package/dist/es/standards-sdk.es119.js +16 -3
- package/dist/es/standards-sdk.es119.js.map +1 -1
- package/dist/es/standards-sdk.es120.js +409 -2
- package/dist/es/standards-sdk.es120.js.map +1 -1
- package/dist/es/standards-sdk.es121.js +2282 -2
- package/dist/es/standards-sdk.es121.js.map +1 -1
- package/dist/es/standards-sdk.es122.js +9 -33
- package/dist/es/standards-sdk.es122.js.map +1 -1
- package/dist/es/standards-sdk.es123.js +10 -32
- package/dist/es/standards-sdk.es123.js.map +1 -1
- package/dist/es/standards-sdk.es124.js +18 -9
- package/dist/es/standards-sdk.es124.js.map +1 -1
- package/dist/es/standards-sdk.es125.js +5 -33
- package/dist/es/standards-sdk.es125.js.map +1 -1
- package/dist/es/standards-sdk.es126.js +8 -3
- package/dist/es/standards-sdk.es126.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +3 -3
- package/dist/es/standards-sdk.es15.js +1 -1
- package/dist/es/standards-sdk.es19.js +2 -2
- package/dist/es/standards-sdk.es20.js +2 -2
- package/dist/es/standards-sdk.es21.js +10 -14
- package/dist/es/standards-sdk.es21.js.map +1 -1
- package/dist/es/standards-sdk.es24.js +10 -10
- package/dist/es/standards-sdk.es25.js +5 -1769
- package/dist/es/standards-sdk.es25.js.map +1 -1
- package/dist/es/standards-sdk.es27.js +17 -17
- package/dist/es/standards-sdk.es28.js +122 -5543
- package/dist/es/standards-sdk.es28.js.map +1 -1
- package/dist/es/standards-sdk.es29.js +10 -3
- package/dist/es/standards-sdk.es29.js.map +1 -1
- package/dist/es/standards-sdk.es30.js +7189 -8
- package/dist/es/standards-sdk.es30.js.map +1 -1
- package/dist/es/standards-sdk.es31.js +3 -2
- package/dist/es/standards-sdk.es31.js.map +1 -1
- package/dist/es/standards-sdk.es32.js +8 -4167
- package/dist/es/standards-sdk.es32.js.map +1 -1
- package/dist/es/standards-sdk.es33.js +2 -5
- package/dist/es/standards-sdk.es33.js.map +1 -1
- package/dist/es/standards-sdk.es34.js +4166 -8
- package/dist/es/standards-sdk.es34.js.map +1 -1
- package/dist/es/standards-sdk.es35.js +419 -2
- package/dist/es/standards-sdk.es35.js.map +1 -1
- package/dist/es/standards-sdk.es36.js +2 -84
- package/dist/es/standards-sdk.es36.js.map +1 -1
- package/dist/es/standards-sdk.es37.js +119 -22
- package/dist/es/standards-sdk.es37.js.map +1 -1
- package/dist/es/standards-sdk.es38.js +3 -147
- package/dist/es/standards-sdk.es38.js.map +1 -1
- package/dist/es/standards-sdk.es39.js +350 -77
- package/dist/es/standards-sdk.es39.js.map +1 -1
- package/dist/es/standards-sdk.es40.js +5 -173
- package/dist/es/standards-sdk.es40.js.map +1 -1
- package/dist/es/standards-sdk.es41.js +178 -5
- package/dist/es/standards-sdk.es41.js.map +1 -1
- package/dist/es/standards-sdk.es42.js +72 -134
- package/dist/es/standards-sdk.es42.js.map +1 -1
- package/dist/es/standards-sdk.es43.js +105 -186
- package/dist/es/standards-sdk.es43.js.map +1 -1
- package/dist/es/standards-sdk.es44.js +47 -433
- package/dist/es/standards-sdk.es44.js.map +1 -1
- package/dist/es/standards-sdk.es45.js +9 -24
- package/dist/es/standards-sdk.es45.js.map +1 -1
- package/dist/es/standards-sdk.es46.js +84 -126
- package/dist/es/standards-sdk.es46.js.map +1 -1
- package/dist/es/standards-sdk.es47.js +3 -17
- package/dist/es/standards-sdk.es47.js.map +1 -1
- package/dist/es/standards-sdk.es48.js +2 -29
- package/dist/es/standards-sdk.es48.js.map +1 -1
- package/dist/es/standards-sdk.es49.js +107 -23
- package/dist/es/standards-sdk.es49.js.map +1 -1
- package/dist/es/standards-sdk.es5.js +1 -1
- package/dist/es/standards-sdk.es50.js +71 -18
- package/dist/es/standards-sdk.es50.js.map +1 -1
- package/dist/es/standards-sdk.es51.js +5 -43
- package/dist/es/standards-sdk.es51.js.map +1 -1
- package/dist/es/standards-sdk.es52.js +4 -17
- package/dist/es/standards-sdk.es52.js.map +1 -1
- package/dist/es/standards-sdk.es53.js +209 -49
- package/dist/es/standards-sdk.es53.js.map +1 -1
- package/dist/es/standards-sdk.es54.js +49 -1280
- package/dist/es/standards-sdk.es54.js.map +1 -1
- package/dist/es/standards-sdk.es55.js +69 -32
- package/dist/es/standards-sdk.es55.js.map +1 -1
- package/dist/es/standards-sdk.es56.js +2 -159
- package/dist/es/standards-sdk.es56.js.map +1 -1
- package/dist/es/standards-sdk.es57.js +78 -787
- package/dist/es/standards-sdk.es57.js.map +1 -1
- package/dist/es/standards-sdk.es58.js +19 -360
- package/dist/es/standards-sdk.es58.js.map +1 -1
- package/dist/es/standards-sdk.es59.js +147 -5
- package/dist/es/standards-sdk.es59.js.map +1 -1
- package/dist/es/standards-sdk.es60.js +84 -172
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es61.js +3 -81
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +154 -104
- package/dist/es/standards-sdk.es62.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +27 -47
- package/dist/es/standards-sdk.es63.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +62 -9
- package/dist/es/standards-sdk.es64.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +45 -92
- package/dist/es/standards-sdk.es65.js.map +1 -1
- package/dist/es/standards-sdk.es66.js +9 -3
- package/dist/es/standards-sdk.es66.js.map +1 -1
- package/dist/es/standards-sdk.es67.js +65 -2
- package/dist/es/standards-sdk.es67.js.map +1 -1
- package/dist/es/standards-sdk.es68.js +6 -113
- package/dist/es/standards-sdk.es68.js.map +1 -1
- package/dist/es/standards-sdk.es69.js +14 -73
- package/dist/es/standards-sdk.es69.js.map +1 -1
- package/dist/es/standards-sdk.es7.js +4 -4
- package/dist/es/standards-sdk.es70.js +7 -6
- package/dist/es/standards-sdk.es70.js.map +1 -1
- package/dist/es/standards-sdk.es71.js +45 -5
- package/dist/es/standards-sdk.es71.js.map +1 -1
- package/dist/es/standards-sdk.es72.js +2 -221
- package/dist/es/standards-sdk.es72.js.map +1 -1
- package/dist/es/standards-sdk.es73.js +130 -52
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es74.js +170 -67
- package/dist/es/standards-sdk.es74.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +191 -97
- package/dist/es/standards-sdk.es75.js.map +1 -1
- package/dist/es/standards-sdk.es76.js +438 -2
- package/dist/es/standards-sdk.es76.js.map +1 -1
- package/dist/es/standards-sdk.es77.js +24 -15
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +131 -401
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +16 -25
- 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 +26 -23
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +27 -36
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +13 -13
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +44 -2282
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +13 -159
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +61 -3
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +1284 -27
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +27 -58
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +5 -49
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +157 -8
- 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 +787 -59
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +143 -6
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +171 -12
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +10 -4
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +13 -45
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +32 -2
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +14 -135
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +4 -172
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +3 -7135
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +15 -9
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/dist/umd/services/mirror-node.d.ts +1 -1
- package/dist/umd/services/mirror-node.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 +2 -2
|
@@ -1,177 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const _0n = /* @__PURE__ */ BigInt(0);
|
|
6
|
-
const _1n = /* @__PURE__ */ BigInt(1);
|
|
7
|
-
const _2n = /* @__PURE__ */ BigInt(2);
|
|
8
|
-
const _7n = /* @__PURE__ */ BigInt(7);
|
|
9
|
-
const _256n = /* @__PURE__ */ BigInt(256);
|
|
10
|
-
const _0x71n = /* @__PURE__ */ BigInt(113);
|
|
11
|
-
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
|
|
12
|
-
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
13
|
-
SHA3_PI.push(2 * (5 * y + x));
|
|
14
|
-
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
|
|
15
|
-
let t = _0n;
|
|
16
|
-
for (let j = 0; j < 7; j++) {
|
|
17
|
-
R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
|
|
18
|
-
if (R & _2n)
|
|
19
|
-
t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
|
|
20
|
-
}
|
|
21
|
-
_SHA3_IOTA.push(t);
|
|
1
|
+
function bind(fn, thisArg) {
|
|
2
|
+
return function wrap() {
|
|
3
|
+
return fn.apply(thisArg, arguments);
|
|
4
|
+
};
|
|
22
5
|
}
|
|
23
|
-
const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
|
|
24
|
-
const rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
|
|
25
|
-
const rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
|
|
26
|
-
function keccakP(s, rounds = 24) {
|
|
27
|
-
const B = new Uint32Array(5 * 2);
|
|
28
|
-
for (let round = 24 - rounds; round < 24; round++) {
|
|
29
|
-
for (let x = 0; x < 10; x++)
|
|
30
|
-
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
31
|
-
for (let x = 0; x < 10; x += 2) {
|
|
32
|
-
const idx1 = (x + 8) % 10;
|
|
33
|
-
const idx0 = (x + 2) % 10;
|
|
34
|
-
const B0 = B[idx0];
|
|
35
|
-
const B1 = B[idx0 + 1];
|
|
36
|
-
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
37
|
-
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
38
|
-
for (let y = 0; y < 50; y += 10) {
|
|
39
|
-
s[x + y] ^= Th;
|
|
40
|
-
s[x + y + 1] ^= Tl;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
let curH = s[2];
|
|
44
|
-
let curL = s[3];
|
|
45
|
-
for (let t = 0; t < 24; t++) {
|
|
46
|
-
const shift = SHA3_ROTL[t];
|
|
47
|
-
const Th = rotlH(curH, curL, shift);
|
|
48
|
-
const Tl = rotlL(curH, curL, shift);
|
|
49
|
-
const PI = SHA3_PI[t];
|
|
50
|
-
curH = s[PI];
|
|
51
|
-
curL = s[PI + 1];
|
|
52
|
-
s[PI] = Th;
|
|
53
|
-
s[PI + 1] = Tl;
|
|
54
|
-
}
|
|
55
|
-
for (let y = 0; y < 50; y += 10) {
|
|
56
|
-
for (let x = 0; x < 10; x++)
|
|
57
|
-
B[x] = s[y + x];
|
|
58
|
-
for (let x = 0; x < 10; x++)
|
|
59
|
-
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
60
|
-
}
|
|
61
|
-
s[0] ^= SHA3_IOTA_H[round];
|
|
62
|
-
s[1] ^= SHA3_IOTA_L[round];
|
|
63
|
-
}
|
|
64
|
-
B.fill(0);
|
|
65
|
-
}
|
|
66
|
-
class Keccak extends Hash {
|
|
67
|
-
// NOTE: we accept arguments in bytes instead of bits here.
|
|
68
|
-
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
69
|
-
super();
|
|
70
|
-
this.blockLen = blockLen;
|
|
71
|
-
this.suffix = suffix;
|
|
72
|
-
this.outputLen = outputLen;
|
|
73
|
-
this.enableXOF = enableXOF;
|
|
74
|
-
this.rounds = rounds;
|
|
75
|
-
this.pos = 0;
|
|
76
|
-
this.posOut = 0;
|
|
77
|
-
this.finished = false;
|
|
78
|
-
this.destroyed = false;
|
|
79
|
-
number(outputLen);
|
|
80
|
-
if (0 >= this.blockLen || this.blockLen >= 200)
|
|
81
|
-
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
82
|
-
this.state = new Uint8Array(200);
|
|
83
|
-
this.state32 = u32(this.state);
|
|
84
|
-
}
|
|
85
|
-
keccak() {
|
|
86
|
-
keccakP(this.state32, this.rounds);
|
|
87
|
-
this.posOut = 0;
|
|
88
|
-
this.pos = 0;
|
|
89
|
-
}
|
|
90
|
-
update(data) {
|
|
91
|
-
exists(this);
|
|
92
|
-
const { blockLen, state } = this;
|
|
93
|
-
data = toBytes(data);
|
|
94
|
-
const len = data.length;
|
|
95
|
-
for (let pos = 0; pos < len; ) {
|
|
96
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
|
97
|
-
for (let i = 0; i < take; i++)
|
|
98
|
-
state[this.pos++] ^= data[pos++];
|
|
99
|
-
if (this.pos === blockLen)
|
|
100
|
-
this.keccak();
|
|
101
|
-
}
|
|
102
|
-
return this;
|
|
103
|
-
}
|
|
104
|
-
finish() {
|
|
105
|
-
if (this.finished)
|
|
106
|
-
return;
|
|
107
|
-
this.finished = true;
|
|
108
|
-
const { state, suffix, pos, blockLen } = this;
|
|
109
|
-
state[pos] ^= suffix;
|
|
110
|
-
if ((suffix & 128) !== 0 && pos === blockLen - 1)
|
|
111
|
-
this.keccak();
|
|
112
|
-
state[blockLen - 1] ^= 128;
|
|
113
|
-
this.keccak();
|
|
114
|
-
}
|
|
115
|
-
writeInto(out) {
|
|
116
|
-
exists(this, false);
|
|
117
|
-
bytes(out);
|
|
118
|
-
this.finish();
|
|
119
|
-
const bufferOut = this.state;
|
|
120
|
-
const { blockLen } = this;
|
|
121
|
-
for (let pos = 0, len = out.length; pos < len; ) {
|
|
122
|
-
if (this.posOut >= blockLen)
|
|
123
|
-
this.keccak();
|
|
124
|
-
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
125
|
-
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
126
|
-
this.posOut += take;
|
|
127
|
-
pos += take;
|
|
128
|
-
}
|
|
129
|
-
return out;
|
|
130
|
-
}
|
|
131
|
-
xofInto(out) {
|
|
132
|
-
if (!this.enableXOF)
|
|
133
|
-
throw new Error("XOF is not possible for this instance");
|
|
134
|
-
return this.writeInto(out);
|
|
135
|
-
}
|
|
136
|
-
xof(bytes2) {
|
|
137
|
-
number(bytes2);
|
|
138
|
-
return this.xofInto(new Uint8Array(bytes2));
|
|
139
|
-
}
|
|
140
|
-
digestInto(out) {
|
|
141
|
-
output(out, this);
|
|
142
|
-
if (this.finished)
|
|
143
|
-
throw new Error("digest() was already called");
|
|
144
|
-
this.writeInto(out);
|
|
145
|
-
this.destroy();
|
|
146
|
-
return out;
|
|
147
|
-
}
|
|
148
|
-
digest() {
|
|
149
|
-
return this.digestInto(new Uint8Array(this.outputLen));
|
|
150
|
-
}
|
|
151
|
-
destroy() {
|
|
152
|
-
this.destroyed = true;
|
|
153
|
-
this.state.fill(0);
|
|
154
|
-
}
|
|
155
|
-
_cloneInto(to) {
|
|
156
|
-
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
157
|
-
to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
158
|
-
to.state32.set(this.state32);
|
|
159
|
-
to.pos = this.pos;
|
|
160
|
-
to.posOut = this.posOut;
|
|
161
|
-
to.finished = this.finished;
|
|
162
|
-
to.rounds = rounds;
|
|
163
|
-
to.suffix = suffix;
|
|
164
|
-
to.outputLen = outputLen;
|
|
165
|
-
to.enableXOF = enableXOF;
|
|
166
|
-
to.destroyed = this.destroyed;
|
|
167
|
-
return to;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
|
|
171
|
-
const keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8);
|
|
172
6
|
export {
|
|
173
|
-
|
|
174
|
-
keccakP,
|
|
175
|
-
keccak_256
|
|
7
|
+
bind as default
|
|
176
8
|
};
|
|
177
9
|
//# sourceMappingURL=standards-sdk.es40.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es40.js","sources":["../../node_modules/@noble/hashes/esm/sha3.js"],"sourcesContent":["import { bytes, exists, number, output } from './_assert.js';\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';\nimport { Hash, u32, toBytes, wrapConstructor, wrapXOFConstructorWithOpts, } from './utils.js';\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It's called a sponge function.\n// Various per round constants calculations\nconst [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n// Same as keccakf1600, but allows to skip some rounds\nexport function keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\nexport class Keccak extends Hash {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n super();\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n // Can be passed from user as dkLen\n number(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error('Sha3 supports only keccak-f1600 function');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n keccak() {\n keccakP(this.state32, this.rounds);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n exists(this);\n const { blockLen, state } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n exists(this, false);\n bytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes) {\n number(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n output(out, this);\n if (this.finished)\n throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nconst gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));\nexport const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexport const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);\nexport const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);\nexport const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);\nexport const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexport const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);\nexport const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8);\nexport const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8);\nconst genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));\nexport const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);\nexport const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);\n//# sourceMappingURL=sha3.js.map"],"names":["bytes"],"mappings":";;;AAMA,MAAM,CAAC,SAAS,WAAW,UAAU,IAAI,CAAC,CAAE,GAAE,CAAE,GAAE,EAAE;AACpD,MAAM,MAAsB,uBAAO,CAAC;AACpC,MAAM,MAAsB,uBAAO,CAAC;AACpC,MAAM,MAAsB,uBAAO,CAAC;AACpC,MAAM,MAAsB,uBAAO,CAAC;AACpC,MAAM,QAAwB,uBAAO,GAAG;AACxC,MAAM,SAAyB,uBAAO,GAAI;AAC1C,SAAS,QAAQ,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,QAAQ,IAAI,SAAS;AAE5D,GAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,KAAK,CAAC;AAChC,UAAQ,KAAK,KAAK,IAAI,IAAI,EAAE;AAE5B,YAAU,MAAQ,QAAQ,MAAM,QAAQ,KAAM,IAAK,EAAE;AAErD,MAAI,IAAI;AACR,W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IAAIA,QAAO;AACP,WAAOA,MAAK;AACZ,WAAO,KAAK,QAAQ,IAAI,WAAWA,MAAK,CAAC;AAAA,EACjD;AAAA,EACI,WAAW,KAAK;AACZ,WAAO,KAAK,IAAI;AAChB,QAAI,KAAK;AACL,YAAM,IAAI,MAAM,6BAA6B;AACjD,SAAK,UAAU,GAAG;AAClB,SAAK,QAAS;AACd,WAAO;AAAA,EACf;AAAA,EACI,SAAS;AACL,WAAO,KAAK,WAAW,IAAI,WAAW,KAAK,SAAS,CAAC;AAAA,EAC7D;AAAA,EACI,UAAU;AACN,SAAK,YAAY;AACjB,SAAK,MAAM,KAAK,CAAC;AAAA,EACzB;AAAA,EACI,WAAW,IAAI;AACX,UAAM,EAAE,UAAU,QAAQ,WAAW,QAAQ,UAAS,IAAK;AAC3D,WAAO,KAAK,IAAI,OAAO,UAAU,QAAQ,WAAW,WAAW,MAAM;AACrE,OAAG,QAAQ,IAAI,KAAK,OAAO;AAC3B,OAAG,MAAM,KAAK;AACd,OAAG,SAAS,KAAK;AACjB,OAAG,WAAW,KAAK;AACnB,OAAG,SAAS;AAEZ,OAAG,SAAS;AACZ,OAAG,YAAY;AACf,OAAG,YAAY;AACf,OAAG,YAAY,KAAK;AACpB,WAAO;AAAA,EACf;AACA;AACA,MAAM,MAAM,CAAC,QAAQ,UAAU,cAAc,gBAAgB,MAAM,IAAI,OAAO,UAAU,QAAQ,SAAS,CAAC;AAc9F,MAAC,aAA6B,oBAAI,GAAM,KAAK,MAAM,CAAC;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es40.js","sources":["../../node_modules/axios/lib/helpers/bind.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n"],"names":[],"mappings":"AAEe,SAAS,KAAK,IAAI,SAAS;AACxC,SAAO,SAAS,OAAO;AACrB,WAAO,GAAG,MAAM,SAAS,SAAS;AAAA,EACnC;AACH;","x_google_ignoreList":[0]}
|
|
@@ -1,9 +1,182 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import utils from "./standards-sdk.es39.js";
|
|
2
|
+
import buildURL from "./standards-sdk.es63.js";
|
|
3
|
+
import InterceptorManager from "./standards-sdk.es64.js";
|
|
4
|
+
import dispatchRequest from "./standards-sdk.es65.js";
|
|
5
|
+
import mergeConfig from "./standards-sdk.es42.js";
|
|
6
|
+
import buildFullPath from "./standards-sdk.es66.js";
|
|
7
|
+
import validator from "./standards-sdk.es67.js";
|
|
8
|
+
import AxiosHeaders from "./standards-sdk.es53.js";
|
|
9
|
+
const validators = validator.validators;
|
|
10
|
+
class Axios {
|
|
11
|
+
constructor(instanceConfig) {
|
|
12
|
+
this.defaults = instanceConfig;
|
|
13
|
+
this.interceptors = {
|
|
14
|
+
request: new InterceptorManager(),
|
|
15
|
+
response: new InterceptorManager()
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Dispatch a request
|
|
20
|
+
*
|
|
21
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
22
|
+
* @param {?Object} config
|
|
23
|
+
*
|
|
24
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
25
|
+
*/
|
|
26
|
+
async request(configOrUrl, config) {
|
|
27
|
+
try {
|
|
28
|
+
return await this._request(configOrUrl, config);
|
|
29
|
+
} catch (err) {
|
|
30
|
+
if (err instanceof Error) {
|
|
31
|
+
let dummy = {};
|
|
32
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
33
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
|
|
34
|
+
try {
|
|
35
|
+
if (!err.stack) {
|
|
36
|
+
err.stack = stack;
|
|
37
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
|
|
38
|
+
err.stack += "\n" + stack;
|
|
39
|
+
}
|
|
40
|
+
} catch (e) {
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
_request(configOrUrl, config) {
|
|
47
|
+
if (typeof configOrUrl === "string") {
|
|
48
|
+
config = config || {};
|
|
49
|
+
config.url = configOrUrl;
|
|
50
|
+
} else {
|
|
51
|
+
config = configOrUrl || {};
|
|
52
|
+
}
|
|
53
|
+
config = mergeConfig(this.defaults, config);
|
|
54
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
55
|
+
if (transitional !== void 0) {
|
|
56
|
+
validator.assertOptions(transitional, {
|
|
57
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
58
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
59
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
60
|
+
}, false);
|
|
61
|
+
}
|
|
62
|
+
if (paramsSerializer != null) {
|
|
63
|
+
if (utils.isFunction(paramsSerializer)) {
|
|
64
|
+
config.paramsSerializer = {
|
|
65
|
+
serialize: paramsSerializer
|
|
66
|
+
};
|
|
67
|
+
} else {
|
|
68
|
+
validator.assertOptions(paramsSerializer, {
|
|
69
|
+
encode: validators.function,
|
|
70
|
+
serialize: validators.function
|
|
71
|
+
}, true);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (config.allowAbsoluteUrls !== void 0) ;
|
|
75
|
+
else if (this.defaults.allowAbsoluteUrls !== void 0) {
|
|
76
|
+
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
77
|
+
} else {
|
|
78
|
+
config.allowAbsoluteUrls = true;
|
|
79
|
+
}
|
|
80
|
+
validator.assertOptions(config, {
|
|
81
|
+
baseUrl: validators.spelling("baseURL"),
|
|
82
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
83
|
+
}, true);
|
|
84
|
+
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
85
|
+
let contextHeaders = headers && utils.merge(
|
|
86
|
+
headers.common,
|
|
87
|
+
headers[config.method]
|
|
88
|
+
);
|
|
89
|
+
headers && utils.forEach(
|
|
90
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
91
|
+
(method) => {
|
|
92
|
+
delete headers[method];
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
|
96
|
+
const requestInterceptorChain = [];
|
|
97
|
+
let synchronousRequestInterceptors = true;
|
|
98
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
99
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
103
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
104
|
+
});
|
|
105
|
+
const responseInterceptorChain = [];
|
|
106
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
107
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
108
|
+
});
|
|
109
|
+
let promise;
|
|
110
|
+
let i = 0;
|
|
111
|
+
let len;
|
|
112
|
+
if (!synchronousRequestInterceptors) {
|
|
113
|
+
const chain = [dispatchRequest.bind(this), void 0];
|
|
114
|
+
chain.unshift.apply(chain, requestInterceptorChain);
|
|
115
|
+
chain.push.apply(chain, responseInterceptorChain);
|
|
116
|
+
len = chain.length;
|
|
117
|
+
promise = Promise.resolve(config);
|
|
118
|
+
while (i < len) {
|
|
119
|
+
promise = promise.then(chain[i++], chain[i++]);
|
|
120
|
+
}
|
|
121
|
+
return promise;
|
|
122
|
+
}
|
|
123
|
+
len = requestInterceptorChain.length;
|
|
124
|
+
let newConfig = config;
|
|
125
|
+
i = 0;
|
|
126
|
+
while (i < len) {
|
|
127
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
128
|
+
const onRejected = requestInterceptorChain[i++];
|
|
129
|
+
try {
|
|
130
|
+
newConfig = onFulfilled(newConfig);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
onRejected.call(this, error);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
return Promise.reject(error);
|
|
140
|
+
}
|
|
141
|
+
i = 0;
|
|
142
|
+
len = responseInterceptorChain.length;
|
|
143
|
+
while (i < len) {
|
|
144
|
+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
145
|
+
}
|
|
146
|
+
return promise;
|
|
147
|
+
}
|
|
148
|
+
getUri(config) {
|
|
149
|
+
config = mergeConfig(this.defaults, config);
|
|
150
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
151
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
152
|
+
}
|
|
5
153
|
}
|
|
154
|
+
utils.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
155
|
+
Axios.prototype[method] = function(url, config) {
|
|
156
|
+
return this.request(mergeConfig(config || {}, {
|
|
157
|
+
method,
|
|
158
|
+
url,
|
|
159
|
+
data: (config || {}).data
|
|
160
|
+
}));
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
utils.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
164
|
+
function generateHTTPMethod(isForm) {
|
|
165
|
+
return function httpMethod(url, data, config) {
|
|
166
|
+
return this.request(mergeConfig(config || {}, {
|
|
167
|
+
method,
|
|
168
|
+
headers: isForm ? {
|
|
169
|
+
"Content-Type": "multipart/form-data"
|
|
170
|
+
} : {},
|
|
171
|
+
url,
|
|
172
|
+
data
|
|
173
|
+
}));
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
Axios.prototype[method] = generateHTTPMethod();
|
|
177
|
+
Axios.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
178
|
+
});
|
|
6
179
|
export {
|
|
7
|
-
|
|
180
|
+
Axios as default
|
|
8
181
|
};
|
|
9
182
|
//# sourceMappingURL=standards-sdk.es41.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es41.js","sources":["../../node_modules/ethers/lib.esm/hash/id.js"],"sourcesContent":["import { keccak256 } from \"../crypto/index.js\";\nimport { toUtf8Bytes } from \"../utils/index.js\";\n/**\n * A simple hashing function which operates on UTF-8 strings to\n * compute an 32-byte identifier.\n *\n * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes\n * the [[keccak256]].\n *\n * @example:\n * id(\"hello world\")\n * //_result:\n */\nexport function id(value) {\n return keccak256(toUtf8Bytes(value));\n}\n//# sourceMappingURL=id.js.map"],"names":[],"mappings":";;AAaO,SAAS,GAAG,OAAO;AACtB,SAAO,UAAU,YAAY,KAAK,CAAC;AACvC;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es41.js","sources":["../../node_modules/axios/lib/core/Axios.js"],"sourcesContent":["'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy = {};\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.allowAbsoluteUrls\n if (config.allowAbsoluteUrls !== undefined) {\n // do nothing\n } else if (this.defaults.allowAbsoluteUrls !== undefined) {\n config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;\n } else {\n config.allowAbsoluteUrls = true;\n }\n\n validator.assertOptions(config, {\n baseUrl: validators.spelling('baseURL'),\n withXsrfToken: validators.spelling('withXSRFToken')\n }, true);\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n"],"names":[],"mappings":";;;;;;;;AAWA,MAAM,aAAa,UAAU;AAS7B,MAAM,MAAM;AAAA,EACV,YAAY,gBAAgB;AAC1B,SAAK,WAAW;AAChB,SAAK,eAAe;AAAA,MAClB,SAAS,IAAI,mBAAoB;AAAA,MACjC,UAAU,IAAI,mBAAkB;AAAA,IACjC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUE,MAAM,QAAQ,aAAa,QAAQ;AACjC,QAAI;AACF,aAAO,MAAM,KAAK,SAAS,aAAa,MAAM;AAAA,IAC/C,SAAQ,KAAK;AACZ,UAAI,eAAe,OAAO;AACxB,YAAI,QAAQ,CAAE;AAEd,cAAM,oBAAoB,MAAM,kBAAkB,KAAK,IAAK,QAAQ,IAAI;AAGxE,cAAM,QAAQ,MAAM,QAAQ,MAAM,MAAM,QAAQ,SAAS,EAAE,IAAI;AAC/D,YAAI;AACF,cAAI,CAAC,IAAI,OAAO;AACd,gBAAI,QAAQ;AAAA,UAEb,WAAU,SAAS,CAAC,OAAO,IAAI,KAAK,EAAE,SAAS,MAAM,QAAQ,aAAa,EAAE,CAAC,GAAG;AAC/E,gBAAI,SAAS,OAAO;AAAA,UAChC;AAAA,QACS,SAAQ,GAAG;AAAA,QAEpB;AAAA,MACA;AAEM,YAAM;AAAA,IACZ;AAAA,EACA;AAAA,E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|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import utils from "./standards-sdk.es39.js";
|
|
2
|
+
import AxiosHeaders from "./standards-sdk.es53.js";
|
|
3
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
|
4
|
+
function mergeConfig(config1, config2) {
|
|
5
|
+
config2 = config2 || {};
|
|
6
|
+
const config = {};
|
|
7
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
8
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
9
|
+
return utils.merge.call({ caseless }, target, source);
|
|
10
|
+
} else if (utils.isPlainObject(source)) {
|
|
11
|
+
return utils.merge({}, source);
|
|
12
|
+
} else if (utils.isArray(source)) {
|
|
13
|
+
return source.slice();
|
|
14
14
|
}
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
if (reason === "OVERRUN") {
|
|
18
|
-
return bytes.length - offset - 1;
|
|
15
|
+
return source;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
output.push(badCodepoint);
|
|
26
|
-
return 0;
|
|
27
|
-
}
|
|
28
|
-
output.push(65533);
|
|
29
|
-
return ignoreFunc(reason, offset, bytes);
|
|
30
|
-
}
|
|
31
|
-
const Utf8ErrorFuncs = Object.freeze({
|
|
32
|
-
error: errorFunc,
|
|
33
|
-
ignore: ignoreFunc,
|
|
34
|
-
replace: replaceFunc
|
|
35
|
-
});
|
|
36
|
-
function getUtf8CodePoints(_bytes, onError) {
|
|
37
|
-
if (onError == null) {
|
|
38
|
-
onError = Utf8ErrorFuncs.error;
|
|
39
|
-
}
|
|
40
|
-
const bytes = getBytes(_bytes, "bytes");
|
|
41
|
-
const result = [];
|
|
42
|
-
let i = 0;
|
|
43
|
-
while (i < bytes.length) {
|
|
44
|
-
const c = bytes[i++];
|
|
45
|
-
if (c >> 7 === 0) {
|
|
46
|
-
result.push(c);
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
let extraLength = null;
|
|
50
|
-
let overlongMask = null;
|
|
51
|
-
if ((c & 224) === 192) {
|
|
52
|
-
extraLength = 1;
|
|
53
|
-
overlongMask = 127;
|
|
54
|
-
} else if ((c & 240) === 224) {
|
|
55
|
-
extraLength = 2;
|
|
56
|
-
overlongMask = 2047;
|
|
57
|
-
} else if ((c & 248) === 240) {
|
|
58
|
-
extraLength = 3;
|
|
59
|
-
overlongMask = 65535;
|
|
60
|
-
} else {
|
|
61
|
-
if ((c & 192) === 128) {
|
|
62
|
-
i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result);
|
|
63
|
-
} else {
|
|
64
|
-
i += onError("BAD_PREFIX", i - 1, bytes, result);
|
|
65
|
-
}
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
if (i - 1 + extraLength >= bytes.length) {
|
|
69
|
-
i += onError("OVERRUN", i - 1, bytes, result);
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
let res = c & (1 << 8 - extraLength - 1) - 1;
|
|
73
|
-
for (let j = 0; j < extraLength; j++) {
|
|
74
|
-
let nextChar = bytes[i];
|
|
75
|
-
if ((nextChar & 192) != 128) {
|
|
76
|
-
i += onError("MISSING_CONTINUE", i, bytes, result);
|
|
77
|
-
res = null;
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
res = res << 6 | nextChar & 63;
|
|
81
|
-
i++;
|
|
17
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
18
|
+
if (!utils.isUndefined(b)) {
|
|
19
|
+
return getMergedValue(a, b, prop, caseless);
|
|
20
|
+
} else if (!utils.isUndefined(a)) {
|
|
21
|
+
return getMergedValue(void 0, a, prop, caseless);
|
|
82
22
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res);
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (res >= 55296 && res <= 57343) {
|
|
91
|
-
i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res);
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
if (res <= overlongMask) {
|
|
95
|
-
i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res);
|
|
96
|
-
continue;
|
|
23
|
+
}
|
|
24
|
+
function valueFromConfig2(a, b) {
|
|
25
|
+
if (!utils.isUndefined(b)) {
|
|
26
|
+
return getMergedValue(void 0, b);
|
|
97
27
|
}
|
|
98
|
-
result.push(res);
|
|
99
28
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
for (let i = 0; i < str.length; i++) {
|
|
106
|
-
const c = str.charCodeAt(i);
|
|
107
|
-
if (c < 128) {
|
|
108
|
-
result.push(c);
|
|
109
|
-
} else if (c < 2048) {
|
|
110
|
-
result.push(c >> 6 | 192);
|
|
111
|
-
result.push(c & 63 | 128);
|
|
112
|
-
} else if ((c & 64512) == 55296) {
|
|
113
|
-
i++;
|
|
114
|
-
const c2 = str.charCodeAt(i);
|
|
115
|
-
assertArgument(i < str.length && (c2 & 64512) === 56320, "invalid surrogate pair", "str", str);
|
|
116
|
-
const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
|
|
117
|
-
result.push(pair >> 18 | 240);
|
|
118
|
-
result.push(pair >> 12 & 63 | 128);
|
|
119
|
-
result.push(pair >> 6 & 63 | 128);
|
|
120
|
-
result.push(pair & 63 | 128);
|
|
121
|
-
} else {
|
|
122
|
-
result.push(c >> 12 | 224);
|
|
123
|
-
result.push(c >> 6 & 63 | 128);
|
|
124
|
-
result.push(c & 63 | 128);
|
|
29
|
+
function defaultToConfig2(a, b) {
|
|
30
|
+
if (!utils.isUndefined(b)) {
|
|
31
|
+
return getMergedValue(void 0, b);
|
|
32
|
+
} else if (!utils.isUndefined(a)) {
|
|
33
|
+
return getMergedValue(void 0, a);
|
|
125
34
|
}
|
|
126
35
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return String.fromCharCode(codePoint);
|
|
36
|
+
function mergeDirectKeys(a, b, prop) {
|
|
37
|
+
if (prop in config2) {
|
|
38
|
+
return getMergedValue(a, b);
|
|
39
|
+
} else if (prop in config1) {
|
|
40
|
+
return getMergedValue(void 0, a);
|
|
133
41
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
42
|
+
}
|
|
43
|
+
const mergeMap = {
|
|
44
|
+
url: valueFromConfig2,
|
|
45
|
+
method: valueFromConfig2,
|
|
46
|
+
data: valueFromConfig2,
|
|
47
|
+
baseURL: defaultToConfig2,
|
|
48
|
+
transformRequest: defaultToConfig2,
|
|
49
|
+
transformResponse: defaultToConfig2,
|
|
50
|
+
paramsSerializer: defaultToConfig2,
|
|
51
|
+
timeout: defaultToConfig2,
|
|
52
|
+
timeoutMessage: defaultToConfig2,
|
|
53
|
+
withCredentials: defaultToConfig2,
|
|
54
|
+
withXSRFToken: defaultToConfig2,
|
|
55
|
+
adapter: defaultToConfig2,
|
|
56
|
+
responseType: defaultToConfig2,
|
|
57
|
+
xsrfCookieName: defaultToConfig2,
|
|
58
|
+
xsrfHeaderName: defaultToConfig2,
|
|
59
|
+
onUploadProgress: defaultToConfig2,
|
|
60
|
+
onDownloadProgress: defaultToConfig2,
|
|
61
|
+
decompress: defaultToConfig2,
|
|
62
|
+
maxContentLength: defaultToConfig2,
|
|
63
|
+
maxBodyLength: defaultToConfig2,
|
|
64
|
+
beforeRedirect: defaultToConfig2,
|
|
65
|
+
transport: defaultToConfig2,
|
|
66
|
+
httpAgent: defaultToConfig2,
|
|
67
|
+
httpsAgent: defaultToConfig2,
|
|
68
|
+
cancelToken: defaultToConfig2,
|
|
69
|
+
socketPath: defaultToConfig2,
|
|
70
|
+
responseEncoding: defaultToConfig2,
|
|
71
|
+
validateStatus: mergeDirectKeys,
|
|
72
|
+
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
73
|
+
};
|
|
74
|
+
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
75
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
76
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
77
|
+
utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
|
|
78
|
+
});
|
|
79
|
+
return config;
|
|
140
80
|
}
|
|
141
81
|
export {
|
|
142
|
-
|
|
143
|
-
toUtf8Bytes,
|
|
144
|
-
toUtf8String
|
|
82
|
+
mergeConfig as default
|
|
145
83
|
};
|
|
146
84
|
//# sourceMappingURL=standards-sdk.es42.js.map
|