@monerium/sdk 2.3.0 → 2.4.0

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.mjs CHANGED
@@ -1,27 +1,27 @@
1
- var ie = Object.defineProperty;
2
- var se = (e, r, n) => r in e ? ie(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
3
- var L = (e, r, n) => (se(e, typeof r != "symbol" ? r + "" : r, n), n), q = (e, r, n) => {
1
+ var se = Object.defineProperty;
2
+ var ae = (e, r, n) => r in e ? se(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
3
+ var j = (e, r, n) => (ae(e, typeof r != "symbol" ? r + "" : r, n), n), D = (e, r, n) => {
4
4
  if (!r.has(e))
5
5
  throw TypeError("Cannot " + n);
6
6
  };
7
- var T = (e, r, n) => (q(e, r, "read from private field"), n ? n.call(e) : r.get(e)), k = (e, r, n) => {
7
+ var I = (e, r, n) => (D(e, r, "read from private field"), n ? n.call(e) : r.get(e)), $ = (e, r, n) => {
8
8
  if (r.has(e))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  r instanceof WeakSet ? r.add(e) : r.set(e, n);
11
- }, F = (e, r, n, i) => (q(e, r, "write to private field"), i ? i.call(e, n) : r.set(e, n), n);
12
- var B = (e, r, n) => (q(e, r, "access private method"), n);
13
- var $ = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
14
- function ae(e) {
11
+ }, F = (e, r, n, i) => (D(e, r, "write to private field"), i ? i.call(e, n) : r.set(e, n), n);
12
+ var B = (e, r, n) => (D(e, r, "access private method"), n);
13
+ var P = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
14
+ function ce(e) {
15
15
  if (e.__esModule)
16
16
  return e;
17
17
  var r = e.default;
18
18
  if (typeof r == "function") {
19
19
  var n = function i() {
20
20
  if (this instanceof i) {
21
- var d = [null];
22
- d.push.apply(d, arguments);
23
- var l = Function.bind.apply(r, d);
24
- return new l();
21
+ var p = [null];
22
+ p.push.apply(p, arguments);
23
+ var h = Function.bind.apply(r, p);
24
+ return new h();
25
25
  }
26
26
  return r.apply(this, arguments);
27
27
  };
@@ -29,8 +29,8 @@ function ae(e) {
29
29
  } else
30
30
  n = {};
31
31
  return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(i) {
32
- var d = Object.getOwnPropertyDescriptor(e, i);
33
- Object.defineProperty(n, i, d.get ? d : {
32
+ var p = Object.getOwnPropertyDescriptor(e, i);
33
+ Object.defineProperty(n, i, p.get ? p : {
34
34
  enumerable: !0,
35
35
  get: function() {
36
36
  return e[i];
@@ -38,52 +38,52 @@ function ae(e) {
38
38
  });
39
39
  }), n;
40
40
  }
41
- var D = {}, ce = {
41
+ var G = {}, ue = {
42
42
  get exports() {
43
- return D;
43
+ return G;
44
44
  },
45
45
  set exports(e) {
46
- D = e;
46
+ G = e;
47
47
  }
48
48
  };
49
- function ue(e) {
49
+ function fe(e) {
50
50
  throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
51
51
  }
52
- var U = {}, fe = {
52
+ var W = {}, le = {
53
53
  get exports() {
54
- return U;
54
+ return W;
55
55
  },
56
56
  set exports(e) {
57
- U = e;
57
+ W = e;
58
58
  }
59
59
  };
60
- const he = {}, le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
60
+ const he = {}, pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
61
61
  __proto__: null,
62
62
  default: he
63
- }, Symbol.toStringTag, { value: "Module" })), pe = /* @__PURE__ */ ae(le);
64
- var V;
65
- function J() {
66
- return V || (V = 1, function(e, r) {
63
+ }, Symbol.toStringTag, { value: "Module" })), de = /* @__PURE__ */ ce(pe);
64
+ var J;
65
+ function Z() {
66
+ return J || (J = 1, function(e, r) {
67
67
  (function(n, i) {
68
68
  e.exports = i();
69
- })($, function() {
70
- var n = n || function(i, d) {
71
- var l;
72
- if (typeof window < "u" && window.crypto && (l = window.crypto), typeof self < "u" && self.crypto && (l = self.crypto), typeof globalThis < "u" && globalThis.crypto && (l = globalThis.crypto), !l && typeof window < "u" && window.msCrypto && (l = window.msCrypto), !l && typeof $ < "u" && $.crypto && (l = $.crypto), !l && typeof ue == "function")
69
+ })(P, function() {
70
+ var n = n || function(i, p) {
71
+ var h;
72
+ if (typeof window < "u" && window.crypto && (h = window.crypto), typeof self < "u" && self.crypto && (h = self.crypto), typeof globalThis < "u" && globalThis.crypto && (h = globalThis.crypto), !h && typeof window < "u" && window.msCrypto && (h = window.msCrypto), !h && typeof P < "u" && P.crypto && (h = P.crypto), !h && typeof fe == "function")
73
73
  try {
74
- l = pe;
74
+ h = de;
75
75
  } catch {
76
76
  }
77
- var P = function() {
78
- if (l) {
79
- if (typeof l.getRandomValues == "function")
77
+ var O = function() {
78
+ if (h) {
79
+ if (typeof h.getRandomValues == "function")
80
80
  try {
81
- return l.getRandomValues(new Uint32Array(1))[0];
81
+ return h.getRandomValues(new Uint32Array(1))[0];
82
82
  } catch {
83
83
  }
84
- if (typeof l.randomBytes == "function")
84
+ if (typeof h.randomBytes == "function")
85
85
  try {
86
- return l.randomBytes(4).readInt32LE();
86
+ return h.randomBytes(4).readInt32LE();
87
87
  } catch {
88
88
  }
89
89
  }
@@ -95,7 +95,7 @@ function J() {
95
95
  var a;
96
96
  return t.prototype = o, a = new t(), t.prototype = null, a;
97
97
  };
98
- }(), w = {}, A = w.lib = {}, _ = A.Base = function() {
98
+ }(), w = {}, S = w.lib = {}, _ = S.Base = function() {
99
99
  return {
100
100
  /**
101
101
  * Creates a new object that inherits from this object.
@@ -180,7 +180,7 @@ function J() {
180
180
  return this.init.prototype.extend(this);
181
181
  }
182
182
  };
183
- }(), p = A.WordArray = _.extend({
183
+ }(), d = S.WordArray = _.extend({
184
184
  /**
185
185
  * Initializes a newly created word array.
186
186
  *
@@ -194,7 +194,7 @@ function J() {
194
194
  * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
195
195
  */
196
196
  init: function(t, o) {
197
- t = this.words = t || [], o != d ? this.sigBytes = o : this.sigBytes = t.length * 4;
197
+ t = this.words = t || [], o != p ? this.sigBytes = o : this.sigBytes = t.length * 4;
198
198
  },
199
199
  /**
200
200
  * Converts this word array to a string.
@@ -274,8 +274,8 @@ function J() {
274
274
  */
275
275
  random: function(t) {
276
276
  for (var o = [], a = 0; a < t; a += 4)
277
- o.push(P());
278
- return new p.init(o, t);
277
+ o.push(O());
278
+ return new d.init(o, t);
279
279
  }
280
280
  }), g = w.enc = {}, u = g.Hex = {
281
281
  /**
@@ -314,9 +314,9 @@ function J() {
314
314
  parse: function(t) {
315
315
  for (var o = t.length, a = [], c = 0; c < o; c += 2)
316
316
  a[c >>> 3] |= parseInt(t.substr(c, 2), 16) << 24 - c % 8 * 4;
317
- return new p.init(a, o / 2);
317
+ return new d.init(a, o / 2);
318
318
  }
319
- }, h = g.Latin1 = {
319
+ }, l = g.Latin1 = {
320
320
  /**
321
321
  * Converts a word array to a Latin1 string.
322
322
  *
@@ -353,7 +353,7 @@ function J() {
353
353
  parse: function(t) {
354
354
  for (var o = t.length, a = [], c = 0; c < o; c++)
355
355
  a[c >>> 2] |= (t.charCodeAt(c) & 255) << 24 - c % 4 * 8;
356
- return new p.init(a, o);
356
+ return new d.init(a, o);
357
357
  }
358
358
  }, s = g.Utf8 = {
359
359
  /**
@@ -371,7 +371,7 @@ function J() {
371
371
  */
372
372
  stringify: function(t) {
373
373
  try {
374
- return decodeURIComponent(escape(h.stringify(t)));
374
+ return decodeURIComponent(escape(l.stringify(t)));
375
375
  } catch {
376
376
  throw new Error("Malformed UTF-8 data");
377
377
  }
@@ -390,9 +390,9 @@ function J() {
390
390
  * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
391
391
  */
392
392
  parse: function(t) {
393
- return h.parse(unescape(encodeURIComponent(t)));
393
+ return l.parse(unescape(encodeURIComponent(t)));
394
394
  }
395
- }, f = A.BufferedBlockAlgorithm = _.extend({
395
+ }, f = S.BufferedBlockAlgorithm = _.extend({
396
396
  /**
397
397
  * Resets this block algorithm's data buffer to its initial state.
398
398
  *
@@ -401,7 +401,7 @@ function J() {
401
401
  * bufferedBlockAlgorithm.reset();
402
402
  */
403
403
  reset: function() {
404
- this._data = new p.init(), this._nDataBytes = 0;
404
+ this._data = new d.init(), this._nDataBytes = 0;
405
405
  },
406
406
  /**
407
407
  * Adds new data to this block algorithm's buffer.
@@ -433,13 +433,13 @@ function J() {
433
433
  _process: function(t) {
434
434
  var o, a = this._data, c = a.words, v = a.sigBytes, y = this.blockSize, m = y * 4, b = v / m;
435
435
  t ? b = i.ceil(b) : b = i.max((b | 0) - this._minBufferSize, 0);
436
- var O = b * y, H = i.min(O * 4, v);
437
- if (O) {
438
- for (var M = 0; M < O; M += y)
436
+ var k = b * y, H = i.min(k * 4, v);
437
+ if (k) {
438
+ for (var M = 0; M < k; M += y)
439
439
  this._doProcessBlock(c, M);
440
- o = c.splice(0, O), a.sigBytes -= H;
440
+ o = c.splice(0, k), a.sigBytes -= H;
441
441
  }
442
- return new p.init(o, H);
442
+ return new d.init(o, H);
443
443
  },
444
444
  /**
445
445
  * Creates a copy of this object.
@@ -456,7 +456,7 @@ function J() {
456
456
  },
457
457
  _minBufferSize: 0
458
458
  });
459
- A.Hasher = f.extend({
459
+ S.Hasher = f.extend({
460
460
  /**
461
461
  * Configuration options.
462
462
  */
@@ -560,15 +560,15 @@ function J() {
560
560
  }(Math);
561
561
  return n;
562
562
  });
563
- }(fe)), U;
563
+ }(le)), W;
564
564
  }
565
565
  (function(e, r) {
566
566
  (function(n, i) {
567
- e.exports = i(J());
568
- })($, function(n) {
567
+ e.exports = i(Z());
568
+ })(P, function(n) {
569
569
  return function() {
570
- var i = n, d = i.lib, l = d.WordArray, P = i.enc;
571
- P.Base64url = {
570
+ var i = n, p = i.lib, h = p.WordArray, O = i.enc;
571
+ O.Base64url = {
572
572
  /**
573
573
  * Converts a word array to a Base64url string.
574
574
  *
@@ -584,11 +584,11 @@ function J() {
584
584
  *
585
585
  * var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
586
586
  */
587
- stringify: function(w, A = !0) {
588
- var _ = w.words, p = w.sigBytes, g = A ? this._safe_map : this._map;
587
+ stringify: function(w, S = !0) {
588
+ var _ = w.words, d = w.sigBytes, g = S ? this._safe_map : this._map;
589
589
  w.clamp();
590
- for (var u = [], h = 0; h < p; h += 3)
591
- for (var s = _[h >>> 2] >>> 24 - h % 4 * 8 & 255, f = _[h + 1 >>> 2] >>> 24 - (h + 1) % 4 * 8 & 255, x = _[h + 2 >>> 2] >>> 24 - (h + 2) % 4 * 8 & 255, t = s << 16 | f << 8 | x, o = 0; o < 4 && h + o * 0.75 < p; o++)
590
+ for (var u = [], l = 0; l < d; l += 3)
591
+ for (var s = _[l >>> 2] >>> 24 - l % 4 * 8 & 255, f = _[l + 1 >>> 2] >>> 24 - (l + 1) % 4 * 8 & 255, x = _[l + 2 >>> 2] >>> 24 - (l + 2) % 4 * 8 & 255, t = s << 16 | f << 8 | x, o = 0; o < 4 && l + o * 0.75 < d; o++)
592
592
  u.push(g.charAt(t >>> 6 * (3 - o) & 63));
593
593
  var a = g.charAt(64);
594
594
  if (a)
@@ -611,16 +611,16 @@ function J() {
611
611
  *
612
612
  * var wordArray = CryptoJS.enc.Base64url.parse(base64String);
613
613
  */
614
- parse: function(w, A = !0) {
615
- var _ = w.length, p = A ? this._safe_map : this._map, g = this._reverseMap;
614
+ parse: function(w, S = !0) {
615
+ var _ = w.length, d = S ? this._safe_map : this._map, g = this._reverseMap;
616
616
  if (!g) {
617
617
  g = this._reverseMap = [];
618
- for (var u = 0; u < p.length; u++)
619
- g[p.charCodeAt(u)] = u;
618
+ for (var u = 0; u < d.length; u++)
619
+ g[d.charCodeAt(u)] = u;
620
620
  }
621
- var h = p.charAt(64);
622
- if (h) {
623
- var s = w.indexOf(h);
621
+ var l = d.charAt(64);
622
+ if (l) {
623
+ var s = w.indexOf(l);
624
624
  s !== -1 && (_ = s);
625
625
  }
626
626
  return R(w, _, g);
@@ -628,31 +628,31 @@ function J() {
628
628
  _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
629
629
  _safe_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
630
630
  };
631
- function R(w, A, _) {
632
- for (var p = [], g = 0, u = 0; u < A; u++)
631
+ function R(w, S, _) {
632
+ for (var d = [], g = 0, u = 0; u < S; u++)
633
633
  if (u % 4) {
634
- var h = _[w.charCodeAt(u - 1)] << u % 4 * 2, s = _[w.charCodeAt(u)] >>> 6 - u % 4 * 2, f = h | s;
635
- p[g >>> 2] |= f << 24 - g % 4 * 8, g++;
634
+ var l = _[w.charCodeAt(u - 1)] << u % 4 * 2, s = _[w.charCodeAt(u)] >>> 6 - u % 4 * 2, f = l | s;
635
+ d[g >>> 2] |= f << 24 - g % 4 * 8, g++;
636
636
  }
637
- return l.create(p, g);
637
+ return h.create(d, g);
638
638
  }
639
639
  }(), n.enc.Base64url;
640
640
  });
641
- })(ce);
642
- var G = {}, de = {
641
+ })(ue);
642
+ var N = {}, ve = {
643
643
  get exports() {
644
- return G;
644
+ return N;
645
645
  },
646
646
  set exports(e) {
647
- G = e;
647
+ N = e;
648
648
  }
649
649
  };
650
650
  (function(e, r) {
651
651
  (function(n, i) {
652
- e.exports = i(J());
653
- })($, function(n) {
652
+ e.exports = i(Z());
653
+ })(P, function(n) {
654
654
  return function(i) {
655
- var d = n, l = d.lib, P = l.WordArray, R = l.Hasher, w = d.algo, A = [], _ = [];
655
+ var p = n, h = p.lib, O = h.WordArray, R = h.Hasher, w = p.algo, S = [], _ = [];
656
656
  (function() {
657
657
  function u(x) {
658
658
  for (var t = i.sqrt(x), o = 2; o <= t; o++)
@@ -660,82 +660,84 @@ var G = {}, de = {
660
660
  return !1;
661
661
  return !0;
662
662
  }
663
- function h(x) {
663
+ function l(x) {
664
664
  return (x - (x | 0)) * 4294967296 | 0;
665
665
  }
666
666
  for (var s = 2, f = 0; f < 64; )
667
- u(s) && (f < 8 && (A[f] = h(i.pow(s, 1 / 2))), _[f] = h(i.pow(s, 1 / 3)), f++), s++;
667
+ u(s) && (f < 8 && (S[f] = l(i.pow(s, 1 / 2))), _[f] = l(i.pow(s, 1 / 3)), f++), s++;
668
668
  })();
669
- var p = [], g = w.SHA256 = R.extend({
669
+ var d = [], g = w.SHA256 = R.extend({
670
670
  _doReset: function() {
671
- this._hash = new P.init(A.slice(0));
671
+ this._hash = new O.init(S.slice(0));
672
672
  },
673
- _doProcessBlock: function(u, h) {
673
+ _doProcessBlock: function(u, l) {
674
674
  for (var s = this._hash.words, f = s[0], x = s[1], t = s[2], o = s[3], a = s[4], c = s[5], v = s[6], y = s[7], m = 0; m < 64; m++) {
675
675
  if (m < 16)
676
- p[m] = u[h + m] | 0;
676
+ d[m] = u[l + m] | 0;
677
677
  else {
678
- var b = p[m - 15], O = (b << 25 | b >>> 7) ^ (b << 14 | b >>> 18) ^ b >>> 3, H = p[m - 2], M = (H << 15 | H >>> 17) ^ (H << 13 | H >>> 19) ^ H >>> 10;
679
- p[m] = O + p[m - 7] + M + p[m - 16];
678
+ var b = d[m - 15], k = (b << 25 | b >>> 7) ^ (b << 14 | b >>> 18) ^ b >>> 3, H = d[m - 2], M = (H << 15 | H >>> 17) ^ (H << 13 | H >>> 19) ^ H >>> 10;
679
+ d[m] = k + d[m - 7] + M + d[m - 16];
680
680
  }
681
- var ee = a & c ^ ~a & v, re = f & x ^ f & t ^ x & t, te = (f << 30 | f >>> 2) ^ (f << 19 | f >>> 13) ^ (f << 10 | f >>> 22), ne = (a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25), N = y + ne + ee + _[m] + p[m], oe = te + re;
682
- y = v, v = c, c = a, a = o + N | 0, o = t, t = x, x = f, f = N + oe | 0;
681
+ var re = a & c ^ ~a & v, te = f & x ^ f & t ^ x & t, ne = (f << 30 | f >>> 2) ^ (f << 19 | f >>> 13) ^ (f << 10 | f >>> 22), oe = (a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25), V = y + oe + re + _[m] + d[m], ie = ne + te;
682
+ y = v, v = c, c = a, a = o + V | 0, o = t, t = x, x = f, f = V + ie | 0;
683
683
  }
684
684
  s[0] = s[0] + f | 0, s[1] = s[1] + x | 0, s[2] = s[2] + t | 0, s[3] = s[3] + o | 0, s[4] = s[4] + a | 0, s[5] = s[5] + c | 0, s[6] = s[6] + v | 0, s[7] = s[7] + y | 0;
685
685
  },
686
686
  _doFinalize: function() {
687
- var u = this._data, h = u.words, s = this._nDataBytes * 8, f = u.sigBytes * 8;
688
- return h[f >>> 5] |= 128 << 24 - f % 32, h[(f + 64 >>> 9 << 4) + 14] = i.floor(s / 4294967296), h[(f + 64 >>> 9 << 4) + 15] = s, u.sigBytes = h.length * 4, this._process(), this._hash;
687
+ var u = this._data, l = u.words, s = this._nDataBytes * 8, f = u.sigBytes * 8;
688
+ return l[f >>> 5] |= 128 << 24 - f % 32, l[(f + 64 >>> 9 << 4) + 14] = i.floor(s / 4294967296), l[(f + 64 >>> 9 << 4) + 15] = s, u.sigBytes = l.length * 4, this._process(), this._hash;
689
689
  },
690
690
  clone: function() {
691
691
  var u = R.clone.call(this);
692
692
  return u._hash = this._hash.clone(), u;
693
693
  }
694
694
  });
695
- d.SHA256 = R._createHelper(g), d.HmacSHA256 = R._createHmacHelper(g);
695
+ p.SHA256 = R._createHelper(g), p.HmacSHA256 = R._createHmacHelper(g);
696
696
  }(Math), n.SHA256;
697
697
  });
698
- })(de);
699
- const ve = () => {
698
+ })(ve);
699
+ const ge = () => {
700
700
  let e = "";
701
701
  const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", n = r.length;
702
702
  let i = 0;
703
703
  for (; i < 128; )
704
704
  e += r.charAt(Math.floor(Math.random() * n)), i += 1;
705
705
  return e;
706
- }, ge = async (e, r, n, i) => {
707
- const d = await fetch(`${e}`, {
706
+ }, ye = async (e, r, n, i) => {
707
+ const p = await fetch(`${e}`, {
708
708
  method: r,
709
709
  headers: i,
710
710
  body: n
711
711
  });
712
- let l;
713
- const P = await d.text();
712
+ let h;
713
+ const O = await p.text();
714
714
  try {
715
- l = JSON.parse(P);
715
+ h = JSON.parse(O);
716
716
  } catch {
717
- throw P;
717
+ throw O;
718
718
  }
719
- if (!d.ok)
720
- throw l;
721
- return l;
722
- }, ye = (e) => {
719
+ if (!p.ok)
720
+ throw h;
721
+ return h;
722
+ }, _e = (e) => {
723
723
  if (e.toString() === "Invalid Date")
724
724
  throw e;
725
725
  const r = (i) => i < 10 ? "0" + i : i, n = (i) => {
726
726
  if (i === 0)
727
727
  return "Z";
728
- const d = i > 0 ? "-" : "+";
729
- return i = Math.abs(i), d + r(Math.floor(i / 60)) + ":" + r(i % 60);
728
+ const p = i > 0 ? "-" : "+";
729
+ return i = Math.abs(i), p + r(Math.floor(i / 60)) + ":" + r(i % 60);
730
730
  };
731
731
  return e.getFullYear() + "-" + r(e.getMonth() + 1) + "-" + r(e.getDate()) + "T" + r(e.getHours()) + ":" + r(e.getMinutes()) + ":" + r(e.getSeconds()) + n(e.getTimezoneOffset());
732
- }, He = ({
733
- currency: e,
734
- amount: r,
735
- iban: n
736
- }) => `Send ${e.toUpperCase()} ${r} to ${n} at ${ye(
737
- /* @__PURE__ */ new Date()
738
- )}`, _e = {
732
+ }, $e = ({
733
+ amount: e,
734
+ iban: r
735
+ }) => `Send EUR ${e} to ${r} at ${_e(/* @__PURE__ */ new Date())}`, T = (e) => {
736
+ var r;
737
+ return e && ((r = Object.entries(e)) == null ? void 0 : r.length) > 0 ? Object.entries(e).map(
738
+ ([n, i]) => `${encodeURIComponent(n)}=${encodeURIComponent(i)}`
739
+ ).join("&") : "";
740
+ }, we = {
739
741
  environments: {
740
742
  production: {
741
743
  api: "https://api.monerium.app",
@@ -747,37 +749,37 @@ const ve = () => {
747
749
  }
748
750
  }
749
751
  };
750
- var z, E, S, C, W, Z, I, Q, j, X;
752
+ var z, E, C, A, q, Q, U, X, L, K;
751
753
  class ke {
752
754
  constructor(r = "sandbox") {
753
755
  // -- Helper Methods
754
- k(this, S);
755
- k(this, W);
756
- k(this, I);
757
- k(this, j);
758
- k(this, z, void 0);
759
- k(this, E, void 0);
756
+ $(this, C);
757
+ $(this, q);
758
+ $(this, U);
759
+ $(this, L);
760
+ $(this, z, void 0);
761
+ $(this, E, void 0);
760
762
  /** The PKCE code verifier */
761
- L(this, "codeVerifier");
762
- L(this, "bearerProfile");
763
+ j(this, "codeVerifier");
764
+ j(this, "bearerProfile");
763
765
  /**
764
766
  * @deprecated since v2.0.7, use {@link getAuthFlowURI} instead.
765
767
  */
766
- L(this, "pkceRequest", (r) => this.getAuthFlowURI(r));
767
- F(this, z, _e.environments[r]);
768
+ j(this, "pkceRequest", (r) => this.getAuthFlowURI(r));
769
+ F(this, z, we.environments[r]);
768
770
  }
769
771
  // -- Authentication
770
772
  async auth(r) {
771
773
  let n;
772
- if (B(this, W, Z).call(this, r))
774
+ if (B(this, q, Q).call(this, r))
773
775
  n = { ...r, grant_type: "authorization_code" };
774
- else if (B(this, I, Q).call(this, r))
776
+ else if (B(this, U, X).call(this, r))
775
777
  n = { ...r, grant_type: "refresh_token" };
776
- else if (B(this, j, X).call(this, r))
778
+ else if (B(this, L, K).call(this, r))
777
779
  n = { ...r, grant_type: "client_credentials" };
778
780
  else
779
781
  throw new Error("Authentication method could not be detected.");
780
- return this.bearerProfile = await B(this, S, C).call(this, "post", "auth/token", new URLSearchParams(n), !0), F(this, E, `Bearer ${this.bearerProfile.access_token}`), this.bearerProfile;
782
+ return this.bearerProfile = await B(this, C, A).call(this, "post", "auth/token", n, !0), F(this, E, `Bearer ${this.bearerProfile.access_token}`), this.bearerProfile;
781
783
  }
782
784
  /**
783
785
  * Construct the url to the authorization code flow,
@@ -786,9 +788,9 @@ class ke {
786
788
  * @returns string
787
789
  */
788
790
  getAuthFlowURI(r) {
789
- this.codeVerifier = ve();
790
- const n = D.stringify(
791
- G(this.codeVerifier)
791
+ this.codeVerifier = ge();
792
+ const n = G.stringify(
793
+ N(this.codeVerifier)
792
794
  ), i = {
793
795
  ...r,
794
796
  client_id: r == null ? void 0 : r.client_id,
@@ -796,82 +798,86 @@ class ke {
796
798
  code_challenge_method: "S256",
797
799
  response_type: "code"
798
800
  };
799
- return `${T(this, z).api}/auth?${new URLSearchParams(i)}`;
801
+ return `${I(this, z).api}/auth?${T(i)}`;
800
802
  }
801
803
  // -- Read Methods
802
804
  getAuthContext() {
803
- return B(this, S, C).call(this, "get", "auth/context");
805
+ return B(this, C, A).call(this, "get", "auth/context");
804
806
  }
805
807
  /**
806
808
  * @param {string} profileId - the id of the profile to fetch.
807
809
  */
808
810
  getProfile(r) {
809
- return B(this, S, C).call(this, "get", `profiles/${r}`);
811
+ return B(this, C, A).call(this, "get", `profiles/${r}`);
810
812
  }
811
813
  /**
812
814
  * @param {string=} profileId - the id of the profile to fetch balances.
813
815
  */
814
816
  getBalances(r) {
815
- return r ? B(this, S, C).call(this, "get", `profiles/${r}/balances`) : B(this, S, C).call(this, "get", "balances");
817
+ return r ? B(this, C, A).call(this, "get", `profiles/${r}/balances`) : B(this, C, A).call(this, "get", "balances");
816
818
  }
817
819
  getOrders(r) {
818
- const n = new URLSearchParams(
819
- r
820
- );
821
- return B(this, S, C).call(this, "get", `orders?${n}`);
820
+ const n = T(r);
821
+ return B(this, C, A).call(this, "get", `orders?${n}`);
822
822
  }
823
823
  getOrder(r) {
824
- return B(this, S, C).call(this, "get", `orders/${r}`);
824
+ return B(this, C, A).call(this, "get", `orders/${r}`);
825
825
  }
826
826
  getTokens() {
827
- return B(this, S, C).call(this, "get", "tokens");
827
+ return B(this, C, A).call(this, "get", "tokens");
828
828
  }
829
829
  // -- Write Methods
830
830
  linkAddress(r, n) {
831
- return B(this, S, C).call(this, "post", `profiles/${r}/addresses`, JSON.stringify(n));
831
+ return B(this, C, A).call(this, "post", `profiles/${r}/addresses`, JSON.stringify(n));
832
832
  }
833
833
  placeOrder(r, n) {
834
- return n ? B(this, S, C).call(this, "post", `profiles/${n}/orders`, JSON.stringify(r)) : B(this, S, C).call(this, "post", "orders", JSON.stringify(r));
834
+ const i = { ...r, kind: "redeem", currency: "eur" };
835
+ return n ? B(this, C, A).call(this, "post", `profiles/${n}/orders`, JSON.stringify(i)) : B(this, C, A).call(this, "post", "orders", JSON.stringify(i));
835
836
  }
836
837
  uploadSupportingDocument(r) {
837
- const n = new URLSearchParams(
838
+ const n = T(
838
839
  r
839
840
  );
840
- return B(this, S, C).call(this, "post", "files/supporting-document", n, !0);
841
+ return B(this, C, A).call(this, "post", "files/supporting-document", n, !0);
841
842
  }
842
843
  }
843
- z = new WeakMap(), E = new WeakMap(), S = new WeakSet(), C = async function(r, n, i, d) {
844
- return ge(`${T(this, z).api}/${n}`, r, i, {
845
- Authorization: T(this, E) || "",
846
- "Content-Type": `application/${d ? "x-www-form-urlencoded" : "json"}`
847
- });
848
- }, W = new WeakSet(), Z = function(r) {
844
+ z = new WeakMap(), E = new WeakMap(), C = new WeakSet(), A = async function(r, n, i, p) {
845
+ return ye(
846
+ `${I(this, z).api}/${n}`,
847
+ r,
848
+ p ? T(i) : i,
849
+ {
850
+ Authorization: I(this, E) || "",
851
+ "Content-Type": `application/${p ? "x-www-form-urlencoded" : "json"}`
852
+ }
853
+ );
854
+ }, q = new WeakSet(), Q = function(r) {
849
855
  return r.code != null;
850
- }, I = new WeakSet(), Q = function(r) {
856
+ }, U = new WeakSet(), X = function(r) {
851
857
  return r.refresh_token != null;
852
- }, j = new WeakSet(), X = function(r) {
858
+ }, L = new WeakSet(), K = function(r) {
853
859
  return r.client_secret != null;
854
860
  };
855
- var we = /* @__PURE__ */ ((e) => (e.eur = "eur", e.usd = "usd", e.gbp = "gbp", e.isk = "isk", e))(we || {}), me = /* @__PURE__ */ ((e) => (e.corporate = "corporate", e.personal = "personal", e))(me || {}), be = /* @__PURE__ */ ((e) => (e.read = "read", e.write = "write", e))(be || {}), Be = /* @__PURE__ */ ((e) => (e.absent = "absent", e.submitted = "submitted", e.pending = "pending", e.confirmed = "confirmed", e))(Be || {}), xe = /* @__PURE__ */ ((e) => (e.approved = "approved", e.rejected = "rejected", e.unknown = "unknown", e))(xe || {}), Se = /* @__PURE__ */ ((e) => (e.iban = "iban", e.scan = "scan", e))(Se || {}), Ae = /* @__PURE__ */ ((e) => (e.redeem = "redeem", e.issue = "issue", e))(Ae || {}), Ce = /* @__PURE__ */ ((e) => (e.placed = "placed", e.pending = "pending", e.processed = "processed", e.rejected = "rejected", e))(Ce || {});
856
- const Re = "I hereby declare that I am the address owner.";
857
- var K = /* @__PURE__ */ ((e) => (e.Goerli = "goerli", e.Chiado = "chiado", e.Mumbai = "mumbai", e.Mainnet = "mainnet", e))(K || {}), Y = /* @__PURE__ */ ((e) => (e.Ethereum = "ethereum", e.Gnosis = "gnosis", e.Polygon = "polygon", e))(Y || {});
858
- const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
861
+ var me = /* @__PURE__ */ ((e) => (e.eur = "eur", e))(me || {}), be = /* @__PURE__ */ ((e) => (e.corporate = "corporate", e.personal = "personal", e))(be || {}), Be = /* @__PURE__ */ ((e) => (e.read = "read", e.write = "write", e))(Be || {}), xe = /* @__PURE__ */ ((e) => (e.absent = "absent", e.submitted = "submitted", e.pending = "pending", e.confirmed = "confirmed", e))(xe || {}), Ce = /* @__PURE__ */ ((e) => (e.approved = "approved", e.rejected = "rejected", e.unknown = "unknown", e))(Ce || {}), Se = /* @__PURE__ */ ((e) => (e.iban = "iban", e.scan = "scan", e))(Se || {}), Ae = /* @__PURE__ */ ((e) => (e.redeem = "redeem", e.issue = "issue", e))(Ae || {}), Re = /* @__PURE__ */ ((e) => (e.placed = "placed", e.pending = "pending", e.processed = "processed", e.rejected = "rejected", e))(Re || {});
862
+ const Oe = "I hereby declare that I am the address owner.";
863
+ var Y = /* @__PURE__ */ ((e) => (e.Goerli = "goerli", e.Chiado = "chiado", e.Mumbai = "mumbai", e.Mainnet = "mainnet", e))(Y || {}), ee = /* @__PURE__ */ ((e) => (e.Ethereum = "ethereum", e.Gnosis = "gnosis", e.Polygon = "polygon", e))(ee || {});
864
+ const Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
859
865
  __proto__: null,
860
- Chain: Y,
861
- LINK_MESSAGE: Re,
862
- Network: K
866
+ Chain: ee,
867
+ LINK_MESSAGE: Oe,
868
+ Network: Y
863
869
  }, Symbol.toStringTag, { value: "Module" }));
864
870
  export {
865
- we as Currency,
866
- xe as KYCOutcome,
867
- Be as KYCState,
871
+ me as Currency,
872
+ Ce as KYCOutcome,
873
+ xe as KYCState,
868
874
  ke as MoneriumClient,
869
875
  Ae as OrderKind,
870
- Ce as OrderState,
876
+ Re as OrderState,
871
877
  Se as PaymentStandard,
872
- be as Permission,
873
- me as ProfileType,
874
- Oe as constants,
875
- He as placeOrderMessage
878
+ Be as Permission,
879
+ be as ProfileType,
880
+ Pe as constants,
881
+ $e as placeOrderMessage
876
882
  };
877
883
  //# sourceMappingURL=index.mjs.map