@monerium/sdk 2.0.17 → 2.0.18

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/index.umd.js CHANGED
@@ -1,35 +1,35 @@
1
- var Be = Object.defineProperty;
2
- var xe = (s, u, g) =>
3
- u in s
4
- ? Be(s, u, { enumerable: !0, configurable: !0, writable: !0, value: g })
5
- : (s[u] = g);
6
- var I = (s, u, g) => (xe(s, typeof u != "symbol" ? u + "" : u, g), g),
7
- N = (s, u, g) => {
8
- if (!u.has(s)) throw TypeError("Cannot " + g);
1
+ var xe = Object.defineProperty;
2
+ var Ce = (a, c, g) =>
3
+ c in a
4
+ ? xe(a, c, { enumerable: !0, configurable: !0, writable: !0, value: g })
5
+ : (a[c] = g);
6
+ var I = (a, c, g) => (Ce(a, typeof c != "symbol" ? c + "" : c, g), g),
7
+ N = (a, c, g) => {
8
+ if (!c.has(a)) throw TypeError("Cannot " + g);
9
9
  };
10
- var D = (s, u, g) => (
11
- N(s, u, "read from private field"), g ? g.call(s) : u.get(s)
10
+ var D = (a, c, g) => (
11
+ N(a, c, "read from private field"), g ? g.call(a) : c.get(a)
12
12
  ),
13
- T = (s, u, g) => {
14
- if (u.has(s))
13
+ $ = (a, c, g) => {
14
+ if (c.has(a))
15
15
  throw TypeError("Cannot add the same private member more than once");
16
- u instanceof WeakSet ? u.add(s) : u.set(s, g);
16
+ c instanceof WeakSet ? c.add(a) : c.set(a, g);
17
17
  },
18
- G = (s, u, g, z) => (
19
- N(s, u, "write to private field"), z ? z.call(s, g) : u.set(s, g), g
18
+ G = (a, c, g, z) => (
19
+ N(a, c, "write to private field"), z ? z.call(a, g) : c.set(a, g), g
20
20
  );
21
- var S = (s, u, g) => (N(s, u, "access private method"), g);
22
- (function (s, u) {
21
+ var S = (a, c, g) => (N(a, c, "access private method"), g);
22
+ (function (a, c) {
23
23
  typeof exports == "object" && typeof module < "u"
24
- ? u(exports)
24
+ ? c(exports)
25
25
  : typeof define == "function" && define.amd
26
- ? define(["exports"], u)
27
- : ((s = typeof globalThis < "u" ? globalThis : s || self),
28
- u((s["monerium-sdk"] = {})));
29
- })(this, function (s) {
30
- var E, W, A, k, q, ae, F, ue, M, ce;
26
+ ? define(["exports"], c)
27
+ : ((a = typeof globalThis < "u" ? globalThis : a || self),
28
+ c((a["monerium-sdk"] = {})));
29
+ })(this, function (a) {
30
+ var E, W, A, k, q, se, M, ce, F, ue;
31
31
  ("use strict");
32
- var u =
32
+ var c =
33
33
  typeof globalThis < "u"
34
34
  ? globalThis
35
35
  : typeof window < "u"
@@ -43,8 +43,8 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
43
43
  if (r.__esModule) return r;
44
44
  var n = r.default;
45
45
  if (typeof n == "function") {
46
- var a = function l() {
47
- if (this instanceof l) {
46
+ var s = function u() {
47
+ if (this instanceof u) {
48
48
  var b = [null];
49
49
  b.push.apply(b, arguments);
50
50
  var p = Function.bind.apply(n, b);
@@ -52,26 +52,26 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
52
52
  }
53
53
  return n.apply(this, arguments);
54
54
  };
55
- a.prototype = n.prototype;
56
- } else a = {};
55
+ s.prototype = n.prototype;
56
+ } else s = {};
57
57
  return (
58
- Object.defineProperty(a, "__esModule", { value: !0 }),
59
- Object.keys(r).forEach(function (l) {
60
- var b = Object.getOwnPropertyDescriptor(r, l);
58
+ Object.defineProperty(s, "__esModule", { value: !0 }),
59
+ Object.keys(r).forEach(function (u) {
60
+ var b = Object.getOwnPropertyDescriptor(r, u);
61
61
  Object.defineProperty(
62
- a,
63
- l,
62
+ s,
63
+ u,
64
64
  b.get
65
65
  ? b
66
66
  : {
67
67
  enumerable: !0,
68
68
  get: function () {
69
- return r[l];
69
+ return r[u];
70
70
  },
71
71
  }
72
72
  );
73
73
  }),
74
- a
74
+ s
75
75
  );
76
76
  }
77
77
  var z = {},
@@ -83,7 +83,7 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
83
83
  z = r;
84
84
  },
85
85
  };
86
- function de(r) {
86
+ function he(r) {
87
87
  throw new Error(
88
88
  'Could not dynamically require "' +
89
89
  r +
@@ -99,7 +99,7 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
99
99
  U = r;
100
100
  },
101
101
  };
102
- const he = g(
102
+ const de = g(
103
103
  Object.freeze(
104
104
  Object.defineProperty(
105
105
  { __proto__: null, default: {} },
@@ -114,12 +114,12 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
114
114
  J ||
115
115
  ((J = 1),
116
116
  (function (r, n) {
117
- (function (a, l) {
118
- r.exports = l();
119
- })(u, function () {
120
- var a =
121
- a ||
122
- (function (l, b) {
117
+ (function (s, u) {
118
+ r.exports = u();
119
+ })(c, function () {
120
+ var s =
121
+ s ||
122
+ (function (u, b) {
123
123
  var p;
124
124
  if (
125
125
  (typeof window < "u" && window.crypto && (p = window.crypto),
@@ -131,11 +131,11 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
131
131
  typeof window < "u" &&
132
132
  window.msCrypto &&
133
133
  (p = window.msCrypto),
134
- !p && typeof u < "u" && u.crypto && (p = u.crypto),
135
- !p && typeof de == "function")
134
+ !p && typeof c < "u" && c.crypto && (p = c.crypto),
135
+ !p && typeof he == "function")
136
136
  )
137
137
  try {
138
- p = he;
138
+ p = de;
139
139
  } catch {}
140
140
  var H = function () {
141
141
  if (p) {
@@ -168,7 +168,7 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
168
168
  })(),
169
169
  B = {},
170
170
  R = (B.lib = {}),
171
- w = (R.Base = (function () {
171
+ _ = (R.Base = (function () {
172
172
  return {
173
173
  extend: function (e) {
174
174
  var t = O(this);
@@ -199,7 +199,7 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
199
199
  },
200
200
  };
201
201
  })()),
202
- v = (R.WordArray = w.extend({
202
+ v = (R.WordArray = _.extend({
203
203
  init: function (e, t) {
204
204
  (e = this.words = e || []),
205
205
  t != b
@@ -207,31 +207,31 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
207
207
  : (this.sigBytes = e.length * 4);
208
208
  },
209
209
  toString: function (e) {
210
- return (e || f).stringify(this);
210
+ return (e || h).stringify(this);
211
211
  },
212
212
  concat: function (e) {
213
213
  var t = this.words,
214
214
  o = e.words,
215
- c = this.sigBytes,
215
+ f = this.sigBytes,
216
216
  y = e.sigBytes;
217
- if ((this.clamp(), c % 4))
218
- for (var _ = 0; _ < y; _++) {
219
- var x = (o[_ >>> 2] >>> (24 - (_ % 4) * 8)) & 255;
220
- t[(c + _) >>> 2] |= x << (24 - ((c + _) % 4) * 8);
217
+ if ((this.clamp(), f % 4))
218
+ for (var w = 0; w < y; w++) {
219
+ var x = (o[w >>> 2] >>> (24 - (w % 4) * 8)) & 255;
220
+ t[(f + w) >>> 2] |= x << (24 - ((f + w) % 4) * 8);
221
221
  }
222
222
  else
223
223
  for (var C = 0; C < y; C += 4)
224
- t[(c + C) >>> 2] = o[C >>> 2];
224
+ t[(f + C) >>> 2] = o[C >>> 2];
225
225
  return (this.sigBytes += y), this;
226
226
  },
227
227
  clamp: function () {
228
228
  var e = this.words,
229
229
  t = this.sigBytes;
230
230
  (e[t >>> 2] &= 4294967295 << (32 - (t % 4) * 8)),
231
- (e.length = l.ceil(t / 4));
231
+ (e.length = u.ceil(t / 4));
232
232
  },
233
233
  clone: function () {
234
- var e = w.clone.call(this);
234
+ var e = _.clone.call(this);
235
235
  return (e.words = this.words.slice(0)), e;
236
236
  },
237
237
  random: function (e) {
@@ -240,58 +240,58 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
240
240
  },
241
241
  })),
242
242
  m = (B.enc = {}),
243
- f = (m.Hex = {
243
+ h = (m.Hex = {
244
244
  stringify: function (e) {
245
245
  for (
246
- var t = e.words, o = e.sigBytes, c = [], y = 0;
246
+ var t = e.words, o = e.sigBytes, f = [], y = 0;
247
247
  y < o;
248
248
  y++
249
249
  ) {
250
- var _ = (t[y >>> 2] >>> (24 - (y % 4) * 8)) & 255;
251
- c.push((_ >>> 4).toString(16)),
252
- c.push((_ & 15).toString(16));
250
+ var w = (t[y >>> 2] >>> (24 - (y % 4) * 8)) & 255;
251
+ f.push((w >>> 4).toString(16)),
252
+ f.push((w & 15).toString(16));
253
253
  }
254
- return c.join("");
254
+ return f.join("");
255
255
  },
256
256
  parse: function (e) {
257
- for (var t = e.length, o = [], c = 0; c < t; c += 2)
258
- o[c >>> 3] |=
259
- parseInt(e.substr(c, 2), 16) << (24 - (c % 8) * 4);
257
+ for (var t = e.length, o = [], f = 0; f < t; f += 2)
258
+ o[f >>> 3] |=
259
+ parseInt(e.substr(f, 2), 16) << (24 - (f % 8) * 4);
260
260
  return new v.init(o, t / 2);
261
261
  },
262
262
  }),
263
- h = (m.Latin1 = {
263
+ d = (m.Latin1 = {
264
264
  stringify: function (e) {
265
265
  for (
266
- var t = e.words, o = e.sigBytes, c = [], y = 0;
266
+ var t = e.words, o = e.sigBytes, f = [], y = 0;
267
267
  y < o;
268
268
  y++
269
269
  ) {
270
- var _ = (t[y >>> 2] >>> (24 - (y % 4) * 8)) & 255;
271
- c.push(String.fromCharCode(_));
270
+ var w = (t[y >>> 2] >>> (24 - (y % 4) * 8)) & 255;
271
+ f.push(String.fromCharCode(w));
272
272
  }
273
- return c.join("");
273
+ return f.join("");
274
274
  },
275
275
  parse: function (e) {
276
- for (var t = e.length, o = [], c = 0; c < t; c++)
277
- o[c >>> 2] |=
278
- (e.charCodeAt(c) & 255) << (24 - (c % 4) * 8);
276
+ for (var t = e.length, o = [], f = 0; f < t; f++)
277
+ o[f >>> 2] |=
278
+ (e.charCodeAt(f) & 255) << (24 - (f % 4) * 8);
279
279
  return new v.init(o, t);
280
280
  },
281
281
  }),
282
282
  i = (m.Utf8 = {
283
283
  stringify: function (e) {
284
284
  try {
285
- return decodeURIComponent(escape(h.stringify(e)));
285
+ return decodeURIComponent(escape(d.stringify(e)));
286
286
  } catch {
287
287
  throw new Error("Malformed UTF-8 data");
288
288
  }
289
289
  },
290
290
  parse: function (e) {
291
- return h.parse(unescape(encodeURIComponent(e)));
291
+ return d.parse(unescape(encodeURIComponent(e)));
292
292
  },
293
293
  }),
294
- d = (R.BufferedBlockAlgorithm = w.extend({
294
+ l = (R.BufferedBlockAlgorithm = _.extend({
295
295
  reset: function () {
296
296
  (this._data = new v.init()), (this._nDataBytes = 0);
297
297
  },
@@ -303,36 +303,36 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
303
303
  _process: function (e) {
304
304
  var t,
305
305
  o = this._data,
306
- c = o.words,
306
+ f = o.words,
307
307
  y = o.sigBytes,
308
- _ = this.blockSize,
309
- x = _ * 4,
308
+ w = this.blockSize,
309
+ x = w * 4,
310
310
  C = y / x;
311
311
  e
312
- ? (C = l.ceil(C))
313
- : (C = l.max((C | 0) - this._minBufferSize, 0));
314
- var j = C * _,
315
- $ = l.min(j * 4, y);
316
- if (j) {
317
- for (var L = 0; L < j; L += _)
318
- this._doProcessBlock(c, L);
319
- (t = c.splice(0, j)), (o.sigBytes -= $);
312
+ ? (C = u.ceil(C))
313
+ : (C = u.max((C | 0) - this._minBufferSize, 0));
314
+ var L = C * w,
315
+ T = u.min(L * 4, y);
316
+ if (L) {
317
+ for (var j = 0; j < L; j += w)
318
+ this._doProcessBlock(f, j);
319
+ (t = f.splice(0, L)), (o.sigBytes -= T);
320
320
  }
321
- return new v.init(t, $);
321
+ return new v.init(t, T);
322
322
  },
323
323
  clone: function () {
324
- var e = w.clone.call(this);
324
+ var e = _.clone.call(this);
325
325
  return (e._data = this._data.clone()), e;
326
326
  },
327
327
  _minBufferSize: 0,
328
328
  }));
329
- R.Hasher = d.extend({
330
- cfg: w.extend(),
329
+ R.Hasher = l.extend({
330
+ cfg: _.extend(),
331
331
  init: function (e) {
332
332
  (this.cfg = this.cfg.extend(e)), this.reset();
333
333
  },
334
334
  reset: function () {
335
- d.reset.call(this), this._doReset();
335
+ l.reset.call(this), this._doReset();
336
336
  },
337
337
  update: function (e) {
338
338
  return this._append(e), this._process(), this;
@@ -357,74 +357,74 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
357
357
  var P = (B.algo = {});
358
358
  return B;
359
359
  })(Math);
360
- return a;
360
+ return s;
361
361
  });
362
362
  })(le)),
363
363
  U
364
364
  );
365
365
  }
366
366
  (function (r, n) {
367
- (function (a, l) {
368
- r.exports = l(Q());
369
- })(u, function (a) {
367
+ (function (s, u) {
368
+ r.exports = u(Q());
369
+ })(c, function (s) {
370
370
  return (
371
371
  (function () {
372
- var l = a,
373
- b = l.lib,
372
+ var u = s,
373
+ b = u.lib,
374
374
  p = b.WordArray,
375
- H = l.enc;
375
+ H = u.enc;
376
376
  H.Base64url = {
377
377
  stringify: function (B, R = !0) {
378
- var w = B.words,
378
+ var _ = B.words,
379
379
  v = B.sigBytes,
380
380
  m = R ? this._safe_map : this._map;
381
381
  B.clamp();
382
- for (var f = [], h = 0; h < v; h += 3)
382
+ for (var h = [], d = 0; d < v; d += 3)
383
383
  for (
384
- var i = (w[h >>> 2] >>> (24 - (h % 4) * 8)) & 255,
385
- d = (w[(h + 1) >>> 2] >>> (24 - ((h + 1) % 4) * 8)) & 255,
386
- P = (w[(h + 2) >>> 2] >>> (24 - ((h + 2) % 4) * 8)) & 255,
387
- e = (i << 16) | (d << 8) | P,
384
+ var i = (_[d >>> 2] >>> (24 - (d % 4) * 8)) & 255,
385
+ l = (_[(d + 1) >>> 2] >>> (24 - ((d + 1) % 4) * 8)) & 255,
386
+ P = (_[(d + 2) >>> 2] >>> (24 - ((d + 2) % 4) * 8)) & 255,
387
+ e = (i << 16) | (l << 8) | P,
388
388
  t = 0;
389
- t < 4 && h + t * 0.75 < v;
389
+ t < 4 && d + t * 0.75 < v;
390
390
  t++
391
391
  )
392
- f.push(m.charAt((e >>> (6 * (3 - t))) & 63));
392
+ h.push(m.charAt((e >>> (6 * (3 - t))) & 63));
393
393
  var o = m.charAt(64);
394
- if (o) for (; f.length % 4; ) f.push(o);
395
- return f.join("");
394
+ if (o) for (; h.length % 4; ) h.push(o);
395
+ return h.join("");
396
396
  },
397
397
  parse: function (B, R = !0) {
398
- var w = B.length,
398
+ var _ = B.length,
399
399
  v = R ? this._safe_map : this._map,
400
400
  m = this._reverseMap;
401
401
  if (!m) {
402
402
  m = this._reverseMap = [];
403
- for (var f = 0; f < v.length; f++) m[v.charCodeAt(f)] = f;
403
+ for (var h = 0; h < v.length; h++) m[v.charCodeAt(h)] = h;
404
404
  }
405
- var h = v.charAt(64);
406
- if (h) {
407
- var i = B.indexOf(h);
408
- i !== -1 && (w = i);
405
+ var d = v.charAt(64);
406
+ if (d) {
407
+ var i = B.indexOf(d);
408
+ i !== -1 && (_ = i);
409
409
  }
410
- return O(B, w, m);
410
+ return O(B, _, m);
411
411
  },
412
412
  _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
413
413
  _safe_map:
414
414
  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
415
415
  };
416
- function O(B, R, w) {
417
- for (var v = [], m = 0, f = 0; f < R; f++)
418
- if (f % 4) {
419
- var h = w[B.charCodeAt(f - 1)] << ((f % 4) * 2),
420
- i = w[B.charCodeAt(f)] >>> (6 - (f % 4) * 2),
421
- d = h | i;
422
- (v[m >>> 2] |= d << (24 - (m % 4) * 8)), m++;
416
+ function O(B, R, _) {
417
+ for (var v = [], m = 0, h = 0; h < R; h++)
418
+ if (h % 4) {
419
+ var d = _[B.charCodeAt(h - 1)] << ((h % 4) * 2),
420
+ i = _[B.charCodeAt(h)] >>> (6 - (h % 4) * 2),
421
+ l = d | i;
422
+ (v[m >>> 2] |= l << (24 - (m % 4) * 8)), m++;
423
423
  }
424
424
  return p.create(v, m);
425
425
  }
426
426
  })(),
427
- a.enc.Base64url
427
+ s.enc.Base64url
428
428
  );
429
429
  });
430
430
  })(fe);
@@ -438,32 +438,32 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
438
438
  },
439
439
  };
440
440
  (function (r, n) {
441
- (function (a, l) {
442
- r.exports = l(Q());
443
- })(u, function (a) {
441
+ (function (s, u) {
442
+ r.exports = u(Q());
443
+ })(c, function (s) {
444
444
  return (
445
- (function (l) {
446
- var b = a,
445
+ (function (u) {
446
+ var b = s,
447
447
  p = b.lib,
448
448
  H = p.WordArray,
449
449
  O = p.Hasher,
450
450
  B = b.algo,
451
451
  R = [],
452
- w = [];
452
+ _ = [];
453
453
  (function () {
454
- function f(P) {
455
- for (var e = l.sqrt(P), t = 2; t <= e; t++)
454
+ function h(P) {
455
+ for (var e = u.sqrt(P), t = 2; t <= e; t++)
456
456
  if (!(P % t)) return !1;
457
457
  return !0;
458
458
  }
459
- function h(P) {
459
+ function d(P) {
460
460
  return ((P - (P | 0)) * 4294967296) | 0;
461
461
  }
462
- for (var i = 2, d = 0; d < 64; )
463
- f(i) &&
464
- (d < 8 && (R[d] = h(l.pow(i, 1 / 2))),
465
- (w[d] = h(l.pow(i, 1 / 3))),
466
- d++),
462
+ for (var i = 2, l = 0; l < 64; )
463
+ h(i) &&
464
+ (l < 8 && (R[l] = d(u.pow(i, 1 / 2))),
465
+ (_[l] = d(u.pow(i, 1 / 3))),
466
+ l++),
467
467
  i++;
468
468
  })();
469
469
  var v = [],
@@ -471,147 +471,155 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
471
471
  _doReset: function () {
472
472
  this._hash = new H.init(R.slice(0));
473
473
  },
474
- _doProcessBlock: function (f, h) {
474
+ _doProcessBlock: function (h, d) {
475
475
  for (
476
476
  var i = this._hash.words,
477
- d = i[0],
477
+ l = i[0],
478
478
  P = i[1],
479
479
  e = i[2],
480
480
  t = i[3],
481
481
  o = i[4],
482
- c = i[5],
482
+ f = i[5],
483
483
  y = i[6],
484
- _ = i[7],
484
+ w = i[7],
485
485
  x = 0;
486
486
  x < 64;
487
487
  x++
488
488
  ) {
489
- if (x < 16) v[x] = f[h + x] | 0;
489
+ if (x < 16) v[x] = h[d + x] | 0;
490
490
  else {
491
491
  var C = v[x - 15],
492
- j =
492
+ L =
493
493
  ((C << 25) | (C >>> 7)) ^
494
494
  ((C << 14) | (C >>> 18)) ^
495
495
  (C >>> 3),
496
- $ = v[x - 2],
497
- L =
498
- (($ << 15) | ($ >>> 17)) ^
499
- (($ << 13) | ($ >>> 19)) ^
500
- ($ >>> 10);
501
- v[x] = j + v[x - 7] + L + v[x - 16];
496
+ T = v[x - 2],
497
+ j =
498
+ ((T << 15) | (T >>> 17)) ^
499
+ ((T << 13) | (T >>> 19)) ^
500
+ (T >>> 10);
501
+ v[x] = L + v[x - 7] + j + v[x - 16];
502
502
  }
503
- var ge = (o & c) ^ (~o & y),
504
- me = (d & P) ^ (d & e) ^ (P & e),
503
+ var me = (o & f) ^ (~o & y),
504
+ we = (l & P) ^ (l & e) ^ (P & e),
505
505
  _e =
506
- ((d << 30) | (d >>> 2)) ^
507
- ((d << 19) | (d >>> 13)) ^
508
- ((d << 10) | (d >>> 22)),
509
- we =
506
+ ((l << 30) | (l >>> 2)) ^
507
+ ((l << 19) | (l >>> 13)) ^
508
+ ((l << 10) | (l >>> 22)),
509
+ be =
510
510
  ((o << 26) | (o >>> 6)) ^
511
511
  ((o << 21) | (o >>> 11)) ^
512
512
  ((o << 7) | (o >>> 25)),
513
- se = _ + we + ge + w[x] + v[x],
514
- be = _e + me;
515
- (_ = y),
516
- (y = c),
517
- (c = o),
518
- (o = (t + se) | 0),
513
+ ae = w + be + me + _[x] + v[x],
514
+ Be = _e + we;
515
+ (w = y),
516
+ (y = f),
517
+ (f = o),
518
+ (o = (t + ae) | 0),
519
519
  (t = e),
520
520
  (e = P),
521
- (P = d),
522
- (d = (se + be) | 0);
521
+ (P = l),
522
+ (l = (ae + Be) | 0);
523
523
  }
524
- (i[0] = (i[0] + d) | 0),
524
+ (i[0] = (i[0] + l) | 0),
525
525
  (i[1] = (i[1] + P) | 0),
526
526
  (i[2] = (i[2] + e) | 0),
527
527
  (i[3] = (i[3] + t) | 0),
528
528
  (i[4] = (i[4] + o) | 0),
529
- (i[5] = (i[5] + c) | 0),
529
+ (i[5] = (i[5] + f) | 0),
530
530
  (i[6] = (i[6] + y) | 0),
531
- (i[7] = (i[7] + _) | 0);
531
+ (i[7] = (i[7] + w) | 0);
532
532
  },
533
533
  _doFinalize: function () {
534
- var f = this._data,
535
- h = f.words,
534
+ var h = this._data,
535
+ d = h.words,
536
536
  i = this._nDataBytes * 8,
537
- d = f.sigBytes * 8;
537
+ l = h.sigBytes * 8;
538
538
  return (
539
- (h[d >>> 5] |= 128 << (24 - (d % 32))),
540
- (h[(((d + 64) >>> 9) << 4) + 14] = l.floor(i / 4294967296)),
541
- (h[(((d + 64) >>> 9) << 4) + 15] = i),
542
- (f.sigBytes = h.length * 4),
539
+ (d[l >>> 5] |= 128 << (24 - (l % 32))),
540
+ (d[(((l + 64) >>> 9) << 4) + 14] = u.floor(i / 4294967296)),
541
+ (d[(((l + 64) >>> 9) << 4) + 15] = i),
542
+ (h.sigBytes = d.length * 4),
543
543
  this._process(),
544
544
  this._hash
545
545
  );
546
546
  },
547
547
  clone: function () {
548
- var f = O.clone.call(this);
549
- return (f._hash = this._hash.clone()), f;
548
+ var h = O.clone.call(this);
549
+ return (h._hash = this._hash.clone()), h;
550
550
  },
551
551
  }));
552
552
  (b.SHA256 = O._createHelper(m)),
553
553
  (b.HmacSHA256 = O._createHmacHelper(m));
554
554
  })(Math),
555
- a.SHA256
555
+ s.SHA256
556
556
  );
557
557
  });
558
558
  })(pe);
559
- const ve = {
560
- environments: {
561
- production: {
562
- api: "https://api.monerium.app",
563
- web: "https://monerium.app",
564
- },
565
- sandbox: {
566
- api: "https://api.monerium.dev",
567
- web: "https://sandbox.monerium.dev",
568
- },
559
+ const ve = () => {
560
+ let r = "";
561
+ const n =
562
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
563
+ s = n.length;
564
+ let u = 0;
565
+ for (; u < 128; )
566
+ (r += n.charAt(Math.floor(Math.random() * s))), (u += 1);
567
+ return r;
569
568
  },
570
- };
571
- class ye {
569
+ ye = {
570
+ environments: {
571
+ production: {
572
+ api: "https://api.monerium.app",
573
+ web: "https://monerium.app",
574
+ },
575
+ sandbox: {
576
+ api: "https://api.monerium.dev",
577
+ web: "https://sandbox.monerium.dev",
578
+ },
579
+ },
580
+ };
581
+ class ge {
572
582
  constructor(n = "sandbox") {
573
- T(this, A);
574
- T(this, q);
575
- T(this, F);
576
- T(this, M);
577
- T(this, E, void 0);
578
- T(this, W, void 0);
583
+ $(this, A);
584
+ $(this, q);
585
+ $(this, M);
586
+ $(this, F);
587
+ $(this, E, void 0);
588
+ $(this, W, void 0);
579
589
  I(this, "codeVerifier");
580
590
  I(this, "bearerProfile");
581
591
  I(this, "pkceRequest", (n) => this.getAuthFlowURI(n));
582
- G(this, E, ve.environments[n]);
592
+ G(this, E, ye.environments[n]);
583
593
  }
584
594
  async auth(n) {
585
- let a;
586
- if (S(this, q, ae).call(this, n))
587
- a = { ...n, grant_type: "authorization_code" };
588
- else if (S(this, F, ue).call(this, n))
589
- a = { ...n, grant_type: "refresh_token" };
595
+ let s;
596
+ if (S(this, q, se).call(this, n))
597
+ s = { ...n, grant_type: "authorization_code" };
590
598
  else if (S(this, M, ce).call(this, n))
591
- a = { ...n, grant_type: "client_credentials" };
599
+ s = { ...n, grant_type: "refresh_token" };
600
+ else if (S(this, F, ue).call(this, n))
601
+ s = { ...n, grant_type: "client_credentials" };
592
602
  else throw new Error("Authentication method could not be detected.");
593
603
  (this.bearerProfile = await S(this, A, k).call(
594
604
  this,
595
605
  "post",
596
606
  "auth/token",
597
- new URLSearchParams(a),
607
+ new URLSearchParams(s),
598
608
  !0
599
609
  )),
600
610
  G(this, W, `Bearer ${this.bearerProfile.access_token}`);
601
611
  }
602
612
  getAuthFlowURI(n) {
603
- this.codeVerifier = new Array(128).join().replace(/(.|$)/g, function () {
604
- return ((Math.random() * 36) | 0).toString(36);
605
- });
606
- const a = z.stringify(V(this.codeVerifier)),
607
- l = {
613
+ this.codeVerifier = ve();
614
+ const s = z.stringify(V(this.codeVerifier)),
615
+ u = {
608
616
  ...n,
609
617
  client_id: n == null ? void 0 : n.client_id,
610
- code_challenge: a,
618
+ code_challenge: s,
611
619
  code_challenge_method: "S256",
612
620
  response_type: "code",
613
621
  };
614
- return `${D(this, E).api}/auth?${new URLSearchParams(l)}`;
622
+ return `${D(this, E).api}/auth?${new URLSearchParams(u)}`;
615
623
  }
616
624
  getAuthContext() {
617
625
  return S(this, A, k).call(this, "get", "auth/context");
@@ -625,8 +633,8 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
625
633
  : S(this, A, k).call(this, "get", "balances");
626
634
  }
627
635
  getOrders(n) {
628
- const a = new URLSearchParams(n);
629
- return S(this, A, k).call(this, "get", `orders?${a}`);
636
+ const s = new URLSearchParams(n);
637
+ return S(this, A, k).call(this, "get", `orders?${s}`);
630
638
  }
631
639
  getOrder(n) {
632
640
  return S(this, A, k).call(this, "get", `orders/${n}`);
@@ -634,31 +642,31 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
634
642
  getTokens() {
635
643
  return S(this, A, k).call(this, "get", "tokens");
636
644
  }
637
- linkAddress(n, a) {
645
+ linkAddress(n, s) {
638
646
  return S(this, A, k).call(
639
647
  this,
640
648
  "post",
641
649
  `profiles/${n}/addresses`,
642
- JSON.stringify(a)
650
+ JSON.stringify(s)
643
651
  );
644
652
  }
645
- placeOrder(n, a) {
646
- return a
653
+ placeOrder(n, s) {
654
+ return s
647
655
  ? S(this, A, k).call(
648
656
  this,
649
657
  "post",
650
- `profiles/${a}/orders`,
658
+ `profiles/${s}/orders`,
651
659
  JSON.stringify(n)
652
660
  )
653
661
  : S(this, A, k).call(this, "post", "orders", JSON.stringify(n));
654
662
  }
655
663
  uploadSupportingDocument(n) {
656
- const a = new URLSearchParams(n);
664
+ const s = new URLSearchParams(n);
657
665
  return S(this, A, k).call(
658
666
  this,
659
667
  "post",
660
668
  "files/supporting-document",
661
- a,
669
+ s,
662
670
  !0
663
671
  );
664
672
  }
@@ -666,31 +674,34 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
666
674
  (E = new WeakMap()),
667
675
  (W = new WeakMap()),
668
676
  (A = new WeakSet()),
669
- (k = async function (n, a, l, b) {
670
- const p = await fetch(`${D(this, E).api}/${a}`, {
671
- method: n,
672
- headers: {
673
- "Content-Type": `application/${
674
- b ? "x-www-form-urlencoded" : "json"
675
- }`,
676
- Authorization: D(this, W) || "",
677
- },
678
- body: l,
679
- }),
677
+ (k = async function (n, s, u, b) {
678
+ const p = await fetch(`${D(this, E).api}/${s}`, {
679
+ method: n,
680
+ headers: {
681
+ "Content-Type": `application/${b ? "x-www-form-urlencoded" : "json"}`,
682
+ Authorization: D(this, W) || "",
683
+ },
684
+ body: u,
685
+ });
686
+ let H;
687
+ try {
680
688
  H = await p.json();
689
+ } catch {
690
+ throw await p.text();
691
+ }
681
692
  if (p.ok) return H;
682
693
  throw H;
683
694
  }),
684
695
  (q = new WeakSet()),
685
- (ae = function (n) {
696
+ (se = function (n) {
686
697
  return n.code != null;
687
698
  }),
688
- (F = new WeakSet()),
689
- (ue = function (n) {
690
- return n.refresh_token != null;
691
- }),
692
699
  (M = new WeakSet()),
693
700
  (ce = function (n) {
701
+ return n.refresh_token != null;
702
+ }),
703
+ (F = new WeakSet()),
704
+ (ue = function (n) {
694
705
  return n.client_secret != null;
695
706
  });
696
707
  var X = ((r) => (
@@ -735,17 +746,17 @@ var S = (s, u, g) => (N(s, u, "access private method"), g);
735
746
  (r.rejected = "rejected"),
736
747
  r
737
748
  ))(oe || {});
738
- (s.Chain = te),
739
- (s.Currency = X),
740
- (s.KYCOutcome = ee),
741
- (s.KYCState = Y),
742
- (s.MoneriumClient = ye),
743
- (s.Network = ne),
744
- (s.OrderKind = ie),
745
- (s.OrderState = oe),
746
- (s.PaymentStandard = re),
747
- (s.Permission = K),
748
- (s.ProfileType = Z),
749
- Object.defineProperty(s, Symbol.toStringTag, { value: "Module" });
749
+ (a.Chain = te),
750
+ (a.Currency = X),
751
+ (a.KYCOutcome = ee),
752
+ (a.KYCState = Y),
753
+ (a.MoneriumClient = ge),
754
+ (a.Network = ne),
755
+ (a.OrderKind = ie),
756
+ (a.OrderState = oe),
757
+ (a.PaymentStandard = re),
758
+ (a.Permission = K),
759
+ (a.ProfileType = Z),
760
+ Object.defineProperty(a, Symbol.toStringTag, { value: "Module" });
750
761
  });
751
762
  //# sourceMappingURL=index.umd.js.map