@monerium/sdk 2.7.1 → 2.7.3

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,30 +1,30 @@
1
- var G = (e, r, t) => {
2
- if (!r.has(e))
3
- throw TypeError("Cannot " + t);
1
+ var Z = (e, t, r) => {
2
+ if (!t.has(e))
3
+ throw TypeError("Cannot " + r);
4
4
  };
5
- var w = (e, r, t) => (G(e, r, "read from private field"), t ? t.call(e) : r.get(e)), z = (e, r, t) => {
6
- if (r.has(e))
5
+ var w = (e, t, r) => (Z(e, t, "read from private field"), r ? r.call(e) : t.get(e)), $ = (e, t, r) => {
6
+ if (t.has(e))
7
7
  throw TypeError("Cannot add the same private member more than once");
8
- r instanceof WeakSet ? r.add(e) : r.set(e, t);
9
- }, A = (e, r, t, n) => (G(e, r, "write to private field"), n ? n.call(e, t) : r.set(e, t), t);
10
- var I = (e, r, t) => (G(e, r, "access private method"), t);
11
- var he = /* @__PURE__ */ ((e) => (e.eur = "eur", e))(he || {}), de = /* @__PURE__ */ ((e) => (e.corporate = "corporate", e.personal = "personal", e))(de || {}), fe = /* @__PURE__ */ ((e) => (e.read = "read", e.write = "write", e))(fe || {}), le = /* @__PURE__ */ ((e) => (e.absent = "absent", e.submitted = "submitted", e.pending = "pending", e.confirmed = "confirmed", e))(le || {}), pe = /* @__PURE__ */ ((e) => (e.approved = "approved", e.rejected = "rejected", e.unknown = "unknown", e))(pe || {}), ve = /* @__PURE__ */ ((e) => (e.requested = "requested", e.approved = "approved", e.pending = "pending", e))(ve || {}), ge = /* @__PURE__ */ ((e) => (e.iban = "iban", e.scan = "scan", e))(ge || {}), we = /* @__PURE__ */ ((e) => (e.redeem = "redeem", e.issue = "issue", e))(we || {}), ye = /* @__PURE__ */ ((e) => (e.placed = "placed", e.pending = "pending", e.processed = "processed", e.rejected = "rejected", e))(ye || {});
12
- const me = (e) => {
8
+ t instanceof WeakSet ? t.add(e) : t.set(e, r);
9
+ }, I = (e, t, r, n) => (Z(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
10
+ var k = (e, t, r) => (Z(e, t, "access private method"), r);
11
+ var le = /* @__PURE__ */ ((e) => (e.eur = "eur", e))(le || {}), pe = /* @__PURE__ */ ((e) => (e.corporate = "corporate", e.personal = "personal", e))(pe || {}), ve = /* @__PURE__ */ ((e) => (e.read = "read", e.write = "write", e))(ve || {}), ge = /* @__PURE__ */ ((e) => (e.absent = "absent", e.submitted = "submitted", e.pending = "pending", e.confirmed = "confirmed", e))(ge || {}), we = /* @__PURE__ */ ((e) => (e.approved = "approved", e.rejected = "rejected", e.unknown = "unknown", e))(we || {}), ye = /* @__PURE__ */ ((e) => (e.requested = "requested", e.approved = "approved", e.pending = "pending", e))(ye || {}), me = /* @__PURE__ */ ((e) => (e.iban = "iban", e.scan = "scan", e))(me || {}), _e = /* @__PURE__ */ ((e) => (e.redeem = "redeem", e.issue = "issue", e))(_e || {}), be = /* @__PURE__ */ ((e) => (e.placed = "placed", e.pending = "pending", e.processed = "processed", e.rejected = "rejected", e))(be || {});
12
+ const Se = (e) => {
13
13
  if (e.toString() === "Invalid Date")
14
14
  throw e;
15
- const r = (n) => n < 10 ? "0" + n : n, t = (n) => {
15
+ const t = (n) => n < 10 ? "0" + n : n, r = (n) => {
16
16
  if (n === 0)
17
17
  return "Z";
18
18
  const u = n > 0 ? "-" : "+";
19
- return n = Math.abs(n), u + r(Math.floor(n / 60)) + ":" + r(n % 60);
19
+ return n = Math.abs(n), u + t(Math.floor(n / 60)) + ":" + t(n % 60);
20
20
  };
21
- return e.getFullYear() + "-" + r(e.getMonth() + 1) + "-" + r(e.getDate()) + "T" + r(e.getHours()) + ":" + r(e.getMinutes()) + ":" + r(e.getSeconds()) + t(e.getTimezoneOffset());
22
- }, qe = (e, r) => `Send EUR ${e} to ${r} at ${me(/* @__PURE__ */ new Date())}`, D = (e) => {
23
- var r;
24
- return e && ((r = Object.entries(e)) == null ? void 0 : r.length) > 0 ? Object.entries(e).map(
25
- ([t, n]) => `${encodeURIComponent(t)}=${encodeURIComponent(n)}`
21
+ return e.getFullYear() + "-" + t(e.getMonth() + 1) + "-" + t(e.getDate()) + "T" + t(e.getHours()) + ":" + t(e.getMinutes()) + ":" + t(e.getSeconds()) + r(e.getTimezoneOffset());
22
+ }, Fe = (e, t) => `Send EUR ${e} to ${t} at ${Se(/* @__PURE__ */ new Date())}`, Q = (e) => {
23
+ var t;
24
+ return e && ((t = Object.entries(e)) == null ? void 0 : t.length) > 0 ? Object.entries(e).map(
25
+ ([r, n]) => `${encodeURIComponent(r)}=${encodeURIComponent(n)}`
26
26
  ).join("&") : "";
27
- }, _e = (e) => {
27
+ }, Be = (e) => {
28
28
  switch (e) {
29
29
  case 1:
30
30
  case 5:
@@ -38,7 +38,7 @@ const me = (e) => {
38
38
  default:
39
39
  throw new Error(`Chain not supported: ${e}`);
40
40
  }
41
- }, be = (e) => {
41
+ }, ke = (e) => {
42
42
  switch (e) {
43
43
  case 1:
44
44
  case 100:
@@ -53,7 +53,7 @@ const me = (e) => {
53
53
  default:
54
54
  throw new Error(`Network not supported: ${e}`);
55
55
  }
56
- }, J = {
56
+ }, X = {
57
57
  environments: {
58
58
  production: {
59
59
  api: "https://api.monerium.app",
@@ -66,84 +66,78 @@ const me = (e) => {
66
66
  wss: "wss://api.monerium.dev"
67
67
  }
68
68
  }
69
- }, Be = "I hereby declare that I am the address owner.", P = "monerium.sdk.code_verifier", V = "monerium.sdk.refresh_token", Fe = {
70
- LINK_MESSAGE: Be,
71
- STORAGE_CODE_VERIFIER: P,
72
- STORAGE_REFRESH_TOKEN: V
69
+ }, Ce = "I hereby declare that I am the address owner.", M = "monerium.sdk.code_verifier", W = "monerium.sdk.refresh_token", Ne = {
70
+ LINK_MESSAGE: Ce,
71
+ STORAGE_CODE_VERIFIER: M,
72
+ STORAGE_REFRESH_TOKEN: W
73
73
  };
74
- var L = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
75
- function re(e) {
74
+ var F = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
75
+ function se(e) {
76
76
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
77
77
  }
78
- function ke(e) {
78
+ function xe(e) {
79
79
  if (e.__esModule)
80
80
  return e;
81
- var r = e.default;
82
- if (typeof r == "function") {
83
- var t = function n() {
84
- if (this instanceof n) {
85
- var u = [null];
86
- u.push.apply(u, arguments);
87
- var i = Function.bind.apply(r, u);
88
- return new i();
89
- }
90
- return r.apply(this, arguments);
81
+ var t = e.default;
82
+ if (typeof t == "function") {
83
+ var r = function n() {
84
+ return this instanceof n ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
91
85
  };
92
- t.prototype = r.prototype;
86
+ r.prototype = t.prototype;
93
87
  } else
94
- t = {};
95
- return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(n) {
88
+ r = {};
89
+ return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(e).forEach(function(n) {
96
90
  var u = Object.getOwnPropertyDescriptor(e, n);
97
- Object.defineProperty(t, n, u.get ? u : {
91
+ Object.defineProperty(r, n, u.get ? u : {
98
92
  enumerable: !0,
99
93
  get: function() {
100
94
  return e[n];
101
95
  }
102
96
  });
103
- }), t;
97
+ }), r;
104
98
  }
105
- var te = { exports: {} };
106
- function Se(e) {
99
+ var oe = { exports: {} };
100
+ function Ae(e) {
107
101
  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.');
108
102
  }
109
- var Q = { exports: {} };
110
- const Ce = {}, xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
103
+ var K = { exports: {} };
104
+ const Ee = {}, Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
111
105
  __proto__: null,
112
- default: Ce
113
- }, Symbol.toStringTag, { value: "Module" })), Ee = /* @__PURE__ */ ke(xe);
114
- var K;
115
- function ne() {
116
- return K || (K = 1, function(e, r) {
117
- (function(t, n) {
106
+ default: Ee
107
+ }, Symbol.toStringTag, { value: "Module" })), Re = /* @__PURE__ */ xe(Ie);
108
+ var ee;
109
+ function ie() {
110
+ return ee || (ee = 1, function(e, t) {
111
+ (function(r, n) {
118
112
  e.exports = n();
119
- })(L, function() {
120
- var t = t || function(n, u) {
121
- var i;
122
- if (typeof window < "u" && window.crypto && (i = window.crypto), typeof self < "u" && self.crypto && (i = self.crypto), typeof globalThis < "u" && globalThis.crypto && (i = globalThis.crypto), !i && typeof window < "u" && window.msCrypto && (i = window.msCrypto), !i && typeof L < "u" && L.crypto && (i = L.crypto), !i && typeof Se == "function")
113
+ })(F, function() {
114
+ var r = r || function(n, u) {
115
+ var c;
116
+ if (typeof window < "u" && window.crypto && (c = window.crypto), typeof self < "u" && self.crypto && (c = self.crypto), typeof globalThis < "u" && globalThis.crypto && (c = globalThis.crypto), !c && typeof window < "u" && window.msCrypto && (c = window.msCrypto), !c && typeof F < "u" && F.crypto && (c = F.crypto), !c && typeof Ae == "function")
123
117
  try {
124
- i = Ee;
118
+ c = Re;
125
119
  } catch {
126
120
  }
127
121
  var v = function() {
128
- if (i) {
129
- if (typeof i.getRandomValues == "function")
122
+ if (c) {
123
+ if (typeof c.getRandomValues == "function")
130
124
  try {
131
- return i.getRandomValues(new Uint32Array(1))[0];
125
+ return c.getRandomValues(new Uint32Array(1))[0];
132
126
  } catch {
133
127
  }
134
- if (typeof i.randomBytes == "function")
128
+ if (typeof c.randomBytes == "function")
135
129
  try {
136
- return i.randomBytes(4).readInt32LE();
130
+ return c.randomBytes(4).readInt32LE();
137
131
  } catch {
138
132
  }
139
133
  }
140
134
  throw new Error("Native crypto module could not be used to get secure random number.");
141
- }, k = Object.create || function() {
142
- function o() {
135
+ }, B = Object.create || function() {
136
+ function s() {
143
137
  }
144
- return function(s) {
145
- var c;
146
- return o.prototype = s, c = new o(), o.prototype = null, c;
138
+ return function(o) {
139
+ var a;
140
+ return s.prototype = o, a = new s(), s.prototype = null, a;
147
141
  };
148
142
  }(), p = {}, y = p.lib = {}, m = y.Base = function() {
149
143
  return {
@@ -165,11 +159,11 @@ function ne() {
165
159
  * }
166
160
  * });
167
161
  */
168
- extend: function(o) {
169
- var s = k(this);
170
- return o && s.mixIn(o), (!s.hasOwnProperty("init") || this.init === s.init) && (s.init = function() {
171
- s.$super.init.apply(this, arguments);
172
- }), s.init.prototype = s, s.$super = this, s;
162
+ extend: function(s) {
163
+ var o = B(this);
164
+ return s && o.mixIn(s), (!o.hasOwnProperty("init") || this.init === o.init) && (o.init = function() {
165
+ o.$super.init.apply(this, arguments);
166
+ }), o.init.prototype = o, o.$super = this, o;
173
167
  },
174
168
  /**
175
169
  * Extends this object and runs the init method.
@@ -184,8 +178,8 @@ function ne() {
184
178
  * var instance = MyType.create();
185
179
  */
186
180
  create: function() {
187
- var o = this.extend();
188
- return o.init.apply(o, arguments), o;
181
+ var s = this.extend();
182
+ return s.init.apply(s, arguments), s;
189
183
  },
190
184
  /**
191
185
  * Initializes a newly created object.
@@ -212,10 +206,10 @@ function ne() {
212
206
  * field: 'value'
213
207
  * });
214
208
  */
215
- mixIn: function(o) {
216
- for (var s in o)
217
- o.hasOwnProperty(s) && (this[s] = o[s]);
218
- o.hasOwnProperty("toString") && (this.toString = o.toString);
209
+ mixIn: function(s) {
210
+ for (var o in s)
211
+ s.hasOwnProperty(o) && (this[o] = s[o]);
212
+ s.hasOwnProperty("toString") && (this.toString = s.toString);
219
213
  },
220
214
  /**
221
215
  * Creates a copy of this object.
@@ -243,8 +237,8 @@ function ne() {
243
237
  * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
244
238
  * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
245
239
  */
246
- init: function(o, s) {
247
- o = this.words = o || [], s != u ? this.sigBytes = s : this.sigBytes = o.length * 4;
240
+ init: function(s, o) {
241
+ s = this.words = s || [], o != u ? this.sigBytes = o : this.sigBytes = s.length * 4;
248
242
  },
249
243
  /**
250
244
  * Converts this word array to a string.
@@ -259,8 +253,8 @@ function ne() {
259
253
  * var string = wordArray.toString();
260
254
  * var string = wordArray.toString(CryptoJS.enc.Utf8);
261
255
  */
262
- toString: function(o) {
263
- return (o || d).stringify(this);
256
+ toString: function(s) {
257
+ return (s || d).stringify(this);
264
258
  },
265
259
  /**
266
260
  * Concatenates a word array to this word array.
@@ -273,16 +267,16 @@ function ne() {
273
267
  *
274
268
  * wordArray1.concat(wordArray2);
275
269
  */
276
- concat: function(o) {
277
- var s = this.words, c = o.words, h = this.sigBytes, _ = o.sigBytes;
270
+ concat: function(s) {
271
+ var o = this.words, a = s.words, h = this.sigBytes, _ = s.sigBytes;
278
272
  if (this.clamp(), h % 4)
279
- for (var B = 0; B < _; B++) {
280
- var S = c[B >>> 2] >>> 24 - B % 4 * 8 & 255;
281
- s[h + B >>> 2] |= S << 24 - (h + B) % 4 * 8;
273
+ for (var S = 0; S < _; S++) {
274
+ var C = a[S >>> 2] >>> 24 - S % 4 * 8 & 255;
275
+ o[h + S >>> 2] |= C << 24 - (h + S) % 4 * 8;
282
276
  }
283
277
  else
284
- for (var C = 0; C < _; C += 4)
285
- s[h + C >>> 2] = c[C >>> 2];
278
+ for (var x = 0; x < _; x += 4)
279
+ o[h + x >>> 2] = a[x >>> 2];
286
280
  return this.sigBytes += _, this;
287
281
  },
288
282
  /**
@@ -293,8 +287,8 @@ function ne() {
293
287
  * wordArray.clamp();
294
288
  */
295
289
  clamp: function() {
296
- var o = this.words, s = this.sigBytes;
297
- o[s >>> 2] &= 4294967295 << 32 - s % 4 * 8, o.length = n.ceil(s / 4);
290
+ var s = this.words, o = this.sigBytes;
291
+ s[o >>> 2] &= 4294967295 << 32 - o % 4 * 8, s.length = n.ceil(o / 4);
298
292
  },
299
293
  /**
300
294
  * Creates a copy of this word array.
@@ -306,8 +300,8 @@ function ne() {
306
300
  * var clone = wordArray.clone();
307
301
  */
308
302
  clone: function() {
309
- var o = m.clone.call(this);
310
- return o.words = this.words.slice(0), o;
303
+ var s = m.clone.call(this);
304
+ return s.words = this.words.slice(0), s;
311
305
  },
312
306
  /**
313
307
  * Creates a word array filled with random bytes.
@@ -322,10 +316,10 @@ function ne() {
322
316
  *
323
317
  * var wordArray = CryptoJS.lib.WordArray.random(16);
324
318
  */
325
- random: function(o) {
326
- for (var s = [], c = 0; c < o; c += 4)
327
- s.push(v());
328
- return new g.init(s, o);
319
+ random: function(s) {
320
+ for (var o = [], a = 0; a < s; a += 4)
321
+ o.push(v());
322
+ return new g.init(o, s);
329
323
  }
330
324
  }), b = p.enc = {}, d = b.Hex = {
331
325
  /**
@@ -341,10 +335,10 @@ function ne() {
341
335
  *
342
336
  * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
343
337
  */
344
- stringify: function(o) {
345
- for (var s = o.words, c = o.sigBytes, h = [], _ = 0; _ < c; _++) {
346
- var B = s[_ >>> 2] >>> 24 - _ % 4 * 8 & 255;
347
- h.push((B >>> 4).toString(16)), h.push((B & 15).toString(16));
338
+ stringify: function(s) {
339
+ for (var o = s.words, a = s.sigBytes, h = [], _ = 0; _ < a; _++) {
340
+ var S = o[_ >>> 2] >>> 24 - _ % 4 * 8 & 255;
341
+ h.push((S >>> 4).toString(16)), h.push((S & 15).toString(16));
348
342
  }
349
343
  return h.join("");
350
344
  },
@@ -361,10 +355,10 @@ function ne() {
361
355
  *
362
356
  * var wordArray = CryptoJS.enc.Hex.parse(hexString);
363
357
  */
364
- parse: function(o) {
365
- for (var s = o.length, c = [], h = 0; h < s; h += 2)
366
- c[h >>> 3] |= parseInt(o.substr(h, 2), 16) << 24 - h % 8 * 4;
367
- return new g.init(c, s / 2);
358
+ parse: function(s) {
359
+ for (var o = s.length, a = [], h = 0; h < o; h += 2)
360
+ a[h >>> 3] |= parseInt(s.substr(h, 2), 16) << 24 - h % 8 * 4;
361
+ return new g.init(a, o / 2);
368
362
  }
369
363
  }, l = b.Latin1 = {
370
364
  /**
@@ -380,10 +374,10 @@ function ne() {
380
374
  *
381
375
  * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
382
376
  */
383
- stringify: function(o) {
384
- for (var s = o.words, c = o.sigBytes, h = [], _ = 0; _ < c; _++) {
385
- var B = s[_ >>> 2] >>> 24 - _ % 4 * 8 & 255;
386
- h.push(String.fromCharCode(B));
377
+ stringify: function(s) {
378
+ for (var o = s.words, a = s.sigBytes, h = [], _ = 0; _ < a; _++) {
379
+ var S = o[_ >>> 2] >>> 24 - _ % 4 * 8 & 255;
380
+ h.push(String.fromCharCode(S));
387
381
  }
388
382
  return h.join("");
389
383
  },
@@ -400,12 +394,12 @@ function ne() {
400
394
  *
401
395
  * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
402
396
  */
403
- parse: function(o) {
404
- for (var s = o.length, c = [], h = 0; h < s; h++)
405
- c[h >>> 2] |= (o.charCodeAt(h) & 255) << 24 - h % 4 * 8;
406
- return new g.init(c, s);
397
+ parse: function(s) {
398
+ for (var o = s.length, a = [], h = 0; h < o; h++)
399
+ a[h >>> 2] |= (s.charCodeAt(h) & 255) << 24 - h % 4 * 8;
400
+ return new g.init(a, o);
407
401
  }
408
- }, a = b.Utf8 = {
402
+ }, i = b.Utf8 = {
409
403
  /**
410
404
  * Converts a word array to a UTF-8 string.
411
405
  *
@@ -419,9 +413,9 @@ function ne() {
419
413
  *
420
414
  * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
421
415
  */
422
- stringify: function(o) {
416
+ stringify: function(s) {
423
417
  try {
424
- return decodeURIComponent(escape(l.stringify(o)));
418
+ return decodeURIComponent(escape(l.stringify(s)));
425
419
  } catch {
426
420
  throw new Error("Malformed UTF-8 data");
427
421
  }
@@ -439,8 +433,8 @@ function ne() {
439
433
  *
440
434
  * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
441
435
  */
442
- parse: function(o) {
443
- return l.parse(unescape(encodeURIComponent(o)));
436
+ parse: function(s) {
437
+ return l.parse(unescape(encodeURIComponent(s)));
444
438
  }
445
439
  }, f = y.BufferedBlockAlgorithm = m.extend({
446
440
  /**
@@ -463,8 +457,8 @@ function ne() {
463
457
  * bufferedBlockAlgorithm._append('data');
464
458
  * bufferedBlockAlgorithm._append(wordArray);
465
459
  */
466
- _append: function(o) {
467
- typeof o == "string" && (o = a.parse(o)), this._data.concat(o), this._nDataBytes += o.sigBytes;
460
+ _append: function(s) {
461
+ typeof s == "string" && (s = i.parse(s)), this._data.concat(s), this._nDataBytes += s.sigBytes;
468
462
  },
469
463
  /**
470
464
  * Processes available data blocks.
@@ -480,16 +474,16 @@ function ne() {
480
474
  * var processedData = bufferedBlockAlgorithm._process();
481
475
  * var processedData = bufferedBlockAlgorithm._process(!!'flush');
482
476
  */
483
- _process: function(o) {
484
- var s, c = this._data, h = c.words, _ = c.sigBytes, B = this.blockSize, S = B * 4, C = _ / S;
485
- o ? C = n.ceil(C) : C = n.max((C | 0) - this._minBufferSize, 0);
486
- var M = C * B, H = n.min(M * 4, _);
487
- if (M) {
488
- for (var q = 0; q < M; q += B)
489
- this._doProcessBlock(h, q);
490
- s = h.splice(0, M), c.sigBytes -= H;
477
+ _process: function(s) {
478
+ var o, a = this._data, h = a.words, _ = a.sigBytes, S = this.blockSize, C = S * 4, x = _ / C;
479
+ s ? x = n.ceil(x) : x = n.max((x | 0) - this._minBufferSize, 0);
480
+ var q = x * S, P = n.min(q * 4, _);
481
+ if (q) {
482
+ for (var N = 0; N < q; N += S)
483
+ this._doProcessBlock(h, N);
484
+ o = h.splice(0, q), a.sigBytes -= P;
491
485
  }
492
- return new g.init(s, H);
486
+ return new g.init(o, P);
493
487
  },
494
488
  /**
495
489
  * Creates a copy of this object.
@@ -501,8 +495,8 @@ function ne() {
501
495
  * var clone = bufferedBlockAlgorithm.clone();
502
496
  */
503
497
  clone: function() {
504
- var o = m.clone.call(this);
505
- return o._data = this._data.clone(), o;
498
+ var s = m.clone.call(this);
499
+ return s._data = this._data.clone(), s;
506
500
  },
507
501
  _minBufferSize: 0
508
502
  });
@@ -520,8 +514,8 @@ function ne() {
520
514
  *
521
515
  * var hasher = CryptoJS.algo.SHA256.create();
522
516
  */
523
- init: function(o) {
524
- this.cfg = this.cfg.extend(o), this.reset();
517
+ init: function(s) {
518
+ this.cfg = this.cfg.extend(s), this.reset();
525
519
  },
526
520
  /**
527
521
  * Resets this hasher to its initial state.
@@ -545,8 +539,8 @@ function ne() {
545
539
  * hasher.update('message');
546
540
  * hasher.update(wordArray);
547
541
  */
548
- update: function(o) {
549
- return this._append(o), this._process(), this;
542
+ update: function(s) {
543
+ return this._append(s), this._process(), this;
550
544
  },
551
545
  /**
552
546
  * Finalizes the hash computation.
@@ -562,10 +556,10 @@ function ne() {
562
556
  * var hash = hasher.finalize('message');
563
557
  * var hash = hasher.finalize(wordArray);
564
558
  */
565
- finalize: function(o) {
566
- o && this._append(o);
567
- var s = this._doFinalize();
568
- return s;
559
+ finalize: function(s) {
560
+ s && this._append(s);
561
+ var o = this._doFinalize();
562
+ return o;
569
563
  },
570
564
  blockSize: 16,
571
565
  /**
@@ -581,9 +575,9 @@ function ne() {
581
575
  *
582
576
  * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
583
577
  */
584
- _createHelper: function(o) {
585
- return function(s, c) {
586
- return new o.init(c).finalize(s);
578
+ _createHelper: function(s) {
579
+ return function(o, a) {
580
+ return new s.init(a).finalize(o);
587
581
  };
588
582
  },
589
583
  /**
@@ -599,25 +593,25 @@ function ne() {
599
593
  *
600
594
  * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
601
595
  */
602
- _createHmacHelper: function(o) {
603
- return function(s, c) {
604
- return new x.HMAC.init(o, c).finalize(s);
596
+ _createHmacHelper: function(s) {
597
+ return function(o, a) {
598
+ return new A.HMAC.init(s, a).finalize(o);
605
599
  };
606
600
  }
607
601
  });
608
- var x = p.algo = {};
602
+ var A = p.algo = {};
609
603
  return p;
610
604
  }(Math);
611
- return t;
605
+ return r;
612
606
  });
613
- }(Q)), Q.exports;
607
+ }(K)), K.exports;
614
608
  }
615
- (function(e, r) {
616
- (function(t, n) {
617
- e.exports = n(ne());
618
- })(L, function(t) {
609
+ (function(e, t) {
610
+ (function(r, n) {
611
+ e.exports = n(ie());
612
+ })(F, function(r) {
619
613
  return function() {
620
- var n = t, u = n.lib, i = u.WordArray, v = n.enc;
614
+ var n = r, u = n.lib, c = u.WordArray, v = n.enc;
621
615
  v.Base64url = {
622
616
  /**
623
617
  * Converts a word array to a Base64url string.
@@ -639,12 +633,12 @@ function ne() {
639
633
  var m = p.words, g = p.sigBytes, b = y ? this._safe_map : this._map;
640
634
  p.clamp();
641
635
  for (var d = [], l = 0; l < g; l += 3)
642
- for (var a = m[l >>> 2] >>> 24 - l % 4 * 8 & 255, f = m[l + 1 >>> 2] >>> 24 - (l + 1) % 4 * 8 & 255, x = m[l + 2 >>> 2] >>> 24 - (l + 2) % 4 * 8 & 255, o = a << 16 | f << 8 | x, s = 0; s < 4 && l + s * 0.75 < g; s++)
643
- d.push(b.charAt(o >>> 6 * (3 - s) & 63));
644
- var c = b.charAt(64);
645
- if (c)
636
+ for (var i = m[l >>> 2] >>> 24 - l % 4 * 8 & 255, f = m[l + 1 >>> 2] >>> 24 - (l + 1) % 4 * 8 & 255, A = m[l + 2 >>> 2] >>> 24 - (l + 2) % 4 * 8 & 255, s = i << 16 | f << 8 | A, o = 0; o < 4 && l + o * 0.75 < g; o++)
637
+ d.push(b.charAt(s >>> 6 * (3 - o) & 63));
638
+ var a = b.charAt(64);
639
+ if (a)
646
640
  for (; d.length % 4; )
647
- d.push(c);
641
+ d.push(a);
648
642
  return d.join("");
649
643
  },
650
644
  /**
@@ -672,203 +666,210 @@ function ne() {
672
666
  }
673
667
  var l = g.charAt(64);
674
668
  if (l) {
675
- var a = p.indexOf(l);
676
- a !== -1 && (m = a);
669
+ var i = p.indexOf(l);
670
+ i !== -1 && (m = i);
677
671
  }
678
- return k(p, m, b);
672
+ return B(p, m, b);
679
673
  },
680
674
  _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
681
675
  _safe_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
682
676
  };
683
- function k(p, y, m) {
677
+ function B(p, y, m) {
684
678
  for (var g = [], b = 0, d = 0; d < y; d++)
685
679
  if (d % 4) {
686
- var l = m[p.charCodeAt(d - 1)] << d % 4 * 2, a = m[p.charCodeAt(d)] >>> 6 - d % 4 * 2, f = l | a;
680
+ var l = m[p.charCodeAt(d - 1)] << d % 4 * 2, i = m[p.charCodeAt(d)] >>> 6 - d % 4 * 2, f = l | i;
687
681
  g[b >>> 2] |= f << 24 - b % 4 * 8, b++;
688
682
  }
689
- return i.create(g, b);
683
+ return c.create(g, b);
690
684
  }
691
- }(), t.enc.Base64url;
685
+ }(), r.enc.Base64url;
692
686
  });
693
- })(te);
694
- var Ae = te.exports;
695
- const Ie = /* @__PURE__ */ re(Ae);
696
- var oe = { exports: {} };
697
- (function(e, r) {
698
- (function(t, n) {
699
- e.exports = n(ne());
700
- })(L, function(t) {
687
+ })(oe);
688
+ var $e = oe.exports;
689
+ const ze = /* @__PURE__ */ se($e);
690
+ var ae = { exports: {} };
691
+ (function(e, t) {
692
+ (function(r, n) {
693
+ e.exports = n(ie());
694
+ })(F, function(r) {
701
695
  return function(n) {
702
- var u = t, i = u.lib, v = i.WordArray, k = i.Hasher, p = u.algo, y = [], m = [];
696
+ var u = r, c = u.lib, v = c.WordArray, B = c.Hasher, p = u.algo, y = [], m = [];
703
697
  (function() {
704
- function d(x) {
705
- for (var o = n.sqrt(x), s = 2; s <= o; s++)
706
- if (!(x % s))
698
+ function d(A) {
699
+ for (var s = n.sqrt(A), o = 2; o <= s; o++)
700
+ if (!(A % o))
707
701
  return !1;
708
702
  return !0;
709
703
  }
710
- function l(x) {
711
- return (x - (x | 0)) * 4294967296 | 0;
704
+ function l(A) {
705
+ return (A - (A | 0)) * 4294967296 | 0;
712
706
  }
713
- for (var a = 2, f = 0; f < 64; )
714
- d(a) && (f < 8 && (y[f] = l(n.pow(a, 1 / 2))), m[f] = l(n.pow(a, 1 / 3)), f++), a++;
707
+ for (var i = 2, f = 0; f < 64; )
708
+ d(i) && (f < 8 && (y[f] = l(n.pow(i, 1 / 2))), m[f] = l(n.pow(i, 1 / 3)), f++), i++;
715
709
  })();
716
- var g = [], b = p.SHA256 = k.extend({
710
+ var g = [], b = p.SHA256 = B.extend({
717
711
  _doReset: function() {
718
712
  this._hash = new v.init(y.slice(0));
719
713
  },
720
714
  _doProcessBlock: function(d, l) {
721
- for (var a = this._hash.words, f = a[0], x = a[1], o = a[2], s = a[3], c = a[4], h = a[5], _ = a[6], B = a[7], S = 0; S < 64; S++) {
722
- if (S < 16)
723
- g[S] = d[l + S] | 0;
715
+ for (var i = this._hash.words, f = i[0], A = i[1], s = i[2], o = i[3], a = i[4], h = i[5], _ = i[6], S = i[7], C = 0; C < 64; C++) {
716
+ if (C < 16)
717
+ g[C] = d[l + C] | 0;
724
718
  else {
725
- var C = g[S - 15], M = (C << 25 | C >>> 7) ^ (C << 14 | C >>> 18) ^ C >>> 3, H = g[S - 2], q = (H << 15 | H >>> 17) ^ (H << 13 | H >>> 19) ^ H >>> 10;
726
- g[S] = M + g[S - 7] + q + g[S - 16];
719
+ var x = g[C - 15], q = (x << 25 | x >>> 7) ^ (x << 14 | x >>> 18) ^ x >>> 3, P = g[C - 2], N = (P << 15 | P >>> 17) ^ (P << 13 | P >>> 19) ^ P >>> 10;
720
+ g[C] = q + g[C - 7] + N + g[C - 16];
727
721
  }
728
- var se = c & h ^ ~c & _, ie = f & x ^ f & o ^ x & o, ae = (f << 30 | f >>> 2) ^ (f << 19 | f >>> 13) ^ (f << 10 | f >>> 22), ce = (c << 26 | c >>> 6) ^ (c << 21 | c >>> 11) ^ (c << 7 | c >>> 25), X = B + ce + se + m[S] + g[S], ue = ae + ie;
729
- B = _, _ = h, h = c, c = s + X | 0, s = o, o = x, x = f, f = X + ue | 0;
722
+ var ce = a & h ^ ~a & _, ue = f & A ^ f & s ^ A & s, he = (f << 30 | f >>> 2) ^ (f << 19 | f >>> 13) ^ (f << 10 | f >>> 22), de = (a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25), Y = S + de + ce + m[C] + g[C], fe = he + ue;
723
+ S = _, _ = h, h = a, a = o + Y | 0, o = s, s = A, A = f, f = Y + fe | 0;
730
724
  }
731
- a[0] = a[0] + f | 0, a[1] = a[1] + x | 0, a[2] = a[2] + o | 0, a[3] = a[3] + s | 0, a[4] = a[4] + c | 0, a[5] = a[5] + h | 0, a[6] = a[6] + _ | 0, a[7] = a[7] + B | 0;
725
+ i[0] = i[0] + f | 0, i[1] = i[1] + A | 0, i[2] = i[2] + s | 0, i[3] = i[3] + o | 0, i[4] = i[4] + a | 0, i[5] = i[5] + h | 0, i[6] = i[6] + _ | 0, i[7] = i[7] + S | 0;
732
726
  },
733
727
  _doFinalize: function() {
734
- var d = this._data, l = d.words, a = this._nDataBytes * 8, f = d.sigBytes * 8;
735
- return l[f >>> 5] |= 128 << 24 - f % 32, l[(f + 64 >>> 9 << 4) + 14] = n.floor(a / 4294967296), l[(f + 64 >>> 9 << 4) + 15] = a, d.sigBytes = l.length * 4, this._process(), this._hash;
728
+ var d = this._data, l = d.words, i = this._nDataBytes * 8, f = d.sigBytes * 8;
729
+ return l[f >>> 5] |= 128 << 24 - f % 32, l[(f + 64 >>> 9 << 4) + 14] = n.floor(i / 4294967296), l[(f + 64 >>> 9 << 4) + 15] = i, d.sigBytes = l.length * 4, this._process(), this._hash;
736
730
  },
737
731
  clone: function() {
738
- var d = k.clone.call(this);
732
+ var d = B.clone.call(this);
739
733
  return d._hash = this._hash.clone(), d;
740
734
  }
741
735
  });
742
- u.SHA256 = k._createHelper(b), u.HmacSHA256 = k._createHmacHelper(b);
743
- }(Math), t.SHA256;
736
+ u.SHA256 = B._createHelper(b), u.HmacSHA256 = B._createHmacHelper(b);
737
+ }(Math), r.SHA256;
744
738
  });
745
- })(oe);
746
- var Re = oe.exports;
747
- const $e = /* @__PURE__ */ re(Re), Te = (e, r) => {
739
+ })(ae);
740
+ var Ue = ae.exports;
741
+ const He = /* @__PURE__ */ se(Ue), Pe = (e, t) => {
748
742
  const {
749
- client_id: t,
743
+ client_id: r,
750
744
  redirect_uri: n,
751
745
  scope: u,
752
- state: i,
746
+ state: c,
753
747
  chainId: v,
754
- chain: k,
748
+ chain: B,
755
749
  network: p,
756
750
  address: y,
757
751
  signature: m
758
752
  } = e, g = y ? {
759
753
  address: y,
760
754
  ...m !== void 0 ? { signature: m } : {},
761
- ...v !== void 0 || k !== void 0 ? { chain: v ? _e(v) : k } : {},
762
- ...v !== void 0 || p !== void 0 ? { network: v ? be(v) : p } : {}
755
+ ...v !== void 0 || B !== void 0 ? { chain: v ? Be(v) : B } : {},
756
+ ...v !== void 0 || p !== void 0 ? { network: v ? ke(v) : p } : {}
763
757
  } : {};
764
- return D({
765
- client_id: t,
758
+ return Q({
759
+ client_id: r,
766
760
  redirect_uri: n,
767
761
  ...u !== void 0 ? { scope: u } : {},
768
- ...i !== void 0 ? { state: i } : {},
769
- code_challenge: r,
762
+ ...c !== void 0 ? { state: c } : {},
763
+ code_challenge: t,
770
764
  code_challenge_method: "S256",
771
765
  response_type: "code",
772
766
  ...g
773
767
  });
774
- }, ze = () => {
768
+ }, Oe = () => {
775
769
  let e = "";
776
- const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", t = r.length;
770
+ const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", r = t.length;
777
771
  let n = 0;
778
772
  for (; n < 128; )
779
- e += r.charAt(Math.floor(Math.random() * t)), n += 1;
773
+ e += t.charAt(Math.floor(Math.random() * r)), n += 1;
780
774
  return e;
781
- }, Ue = (e) => Ie.stringify($e(e)), Y = (e, r) => {
782
- const t = ze(), n = Ue(t);
783
- return sessionStorage.setItem(P, t || ""), `${e}/auth?${Te(r, n)}`;
784
- }, He = () => {
785
- const e = window.location.href, [r, t] = e.split("?");
786
- t && window.history.replaceState(null, "", r);
787
- }, ee = (e) => e.code != null, Pe = (e) => e.refresh_token != null, Oe = (e) => e.client_secret != null, Me = async (e, r, t, n) => {
775
+ }, Te = (e) => ze.stringify(He(e)), te = (e, t) => {
776
+ const r = Oe(), n = Te(r);
777
+ return sessionStorage.setItem(M, r || ""), `${e}/auth?${Pe(t, n)}`;
778
+ }, re = () => {
779
+ const e = window.location.href;
780
+ if (!e || !(e != null && e.includes("?")))
781
+ return;
782
+ const [t, r] = e.split("?");
783
+ r && window.history.replaceState(null, "", t);
784
+ }, ne = (e) => e.code != null, Me = (e) => e.refresh_token != null, Le = (e) => e.client_secret != null, qe = async (e, t, r, n) => {
788
785
  const u = await fetch(`${e}`, {
789
- method: r,
786
+ method: t,
790
787
  headers: n,
791
- body: t
788
+ body: r
792
789
  });
793
- let i;
790
+ let c;
794
791
  const v = await u.text();
795
792
  try {
796
- i = JSON.parse(v);
793
+ c = JSON.parse(v);
797
794
  } catch {
798
795
  throw v;
799
796
  }
800
797
  if (!u.ok)
801
- throw i;
802
- return i;
803
- }, Z = typeof window > "u";
804
- var $, F, O, U, T, E, R, j, N, W;
805
- class je {
806
- constructor(r) {
798
+ throw c;
799
+ return c;
800
+ }, T = typeof window > "u";
801
+ var z, D, L, H, U, O, j, E, R, V, G, J;
802
+ class We {
803
+ constructor(t) {
804
+ /**
805
+ * {@link https://monerium.dev/api-docs#operation/auth-token}
806
+ */
807
+ $(this, O);
807
808
  // -- Helper Methods
808
- z(this, E);
809
- z(this, $, void 0);
810
- z(this, F, void 0);
809
+ $(this, E);
810
+ $(this, z, void 0);
811
+ $(this, D, void 0);
811
812
  /** The socket will be available after subscribing to an event */
812
- z(this, O, void 0);
813
- z(this, U, void 0);
814
- z(this, T, void 0);
815
- z(this, j, void 0);
816
- z(this, N, void 0);
817
- z(this, W, void 0);
818
- if (A(this, U, /* @__PURE__ */ new Map()), this.isAuthorized = !!this.bearerProfile, A(this, j, async (t, n, u) => {
819
- const i = sessionStorage.getItem(P) || "";
820
- if (!i)
813
+ $(this, L, void 0);
814
+ $(this, H, void 0);
815
+ $(this, U, void 0);
816
+ $(this, V, void 0);
817
+ $(this, G, void 0);
818
+ $(this, J, void 0);
819
+ if (I(this, H, /* @__PURE__ */ new Map()), this.isAuthorized = !!this.bearerProfile, I(this, V, async (r, n, u) => {
820
+ const c = sessionStorage.getItem(M) || "";
821
+ if (!c)
821
822
  throw new Error("Code verifier not found");
822
- return this.codeVerifier = i, sessionStorage.removeItem(P), await this.getBearerToken({
823
+ return this.codeVerifier = c, sessionStorage.removeItem(M), await k(this, O, j).call(this, {
823
824
  code: u,
824
825
  redirect_uri: n,
825
- client_id: t,
826
- code_verifier: i
826
+ client_id: r,
827
+ code_verifier: c
827
828
  });
828
- }), A(this, N, async ({
829
- clientId: t,
829
+ }), I(this, G, async ({
830
+ clientId: r,
830
831
  clientSecret: n
831
- }) => await this.getBearerToken({
832
- client_id: t,
832
+ }) => await k(this, O, j).call(this, {
833
+ client_id: r,
833
834
  client_secret: n
834
- })), A(this, W, async (t, n) => await this.getBearerToken({
835
+ })), I(this, J, async (r, n) => await k(this, O, j).call(this, {
835
836
  refresh_token: n,
836
- client_id: t
837
+ client_id: r
837
838
  })), this.subscribeToOrderNotifications = () => {
838
- var u, i;
839
- const t = `${w(this, $).wss}/profiles/${(u = this.bearerProfile) == null ? void 0 : u.profile}/orders?access_token=${(i = this.bearerProfile) == null ? void 0 : i.access_token}`, n = new WebSocket(t);
839
+ var u, c;
840
+ const r = `${w(this, z).wss}/profiles/${(u = this.bearerProfile) == null ? void 0 : u.profile}/orders?access_token=${(c = this.bearerProfile) == null ? void 0 : c.access_token}`, n = new WebSocket(r);
840
841
  return n.addEventListener("open", () => {
841
- console.info(`Socket connected: ${t}`);
842
+ console.info(`Socket connected: ${r}`);
842
843
  }), n.addEventListener("error", (v) => {
843
- throw console.error(v), new Error(`Socket error: ${t}`);
844
+ throw console.error(v), new Error(`Socket error: ${r}`);
844
845
  }), n.addEventListener("message", (v) => {
845
846
  var p;
846
- const k = JSON.parse(v.data);
847
- (p = w(this, U).get(k.meta.state)) == null || p(
848
- k
847
+ const B = JSON.parse(v.data);
848
+ (p = w(this, H).get(B.meta.state)) == null || p(
849
+ B
849
850
  );
850
851
  }), n.addEventListener("close", () => {
851
- console.info(`Socket connection closed: ${t}`);
852
+ console.info(`Socket connection closed: ${r}`);
852
853
  }), n;
853
- }, this.auth = async (t) => await this.getBearerToken(t), this.getAuthFlowURI = (t) => {
854
- const n = Y(w(this, $).api, t);
855
- return this.codeVerifier = sessionStorage.getItem(P), n;
856
- }, this.pkceRequest = (t) => this.getAuthFlowURI(t), this.getEnvironment = () => w(this, $), !r) {
857
- A(this, $, J.environments.sandbox);
854
+ }, this.auth = async (r) => await k(this, O, j).call(this, r), this.connect = async (r) => await k(this, O, j).call(this, r), this.getAuthFlowURI = (r) => {
855
+ const n = te(w(this, z).api, r);
856
+ return this.codeVerifier = sessionStorage.getItem(M), n;
857
+ }, this.pkceRequest = (r) => this.getAuthFlowURI(r), this.getEnvironment = () => w(this, z), !t) {
858
+ I(this, z, X.environments.sandbox);
858
859
  return;
859
860
  }
860
- if (typeof r == "string")
861
- A(this, $, J.environments[r]);
862
- else if (A(this, $, J.environments[r.environment || "sandbox"]), Z) {
863
- const { clientId: t, clientSecret: n } = r;
864
- A(this, T, {
865
- clientId: t,
861
+ if (typeof t == "string")
862
+ I(this, z, X.environments[t]);
863
+ else if (I(this, z, X.environments[t.environment || "sandbox"]), T) {
864
+ const { clientId: r, clientSecret: n } = t;
865
+ I(this, U, {
866
+ clientId: r,
866
867
  clientSecret: n
867
868
  });
868
869
  } else {
869
- const { clientId: t, redirectUrl: n } = r;
870
- A(this, T, {
871
- clientId: t,
870
+ const { clientId: r, redirectUrl: n } = t;
871
+ I(this, U, {
872
+ clientId: r,
872
873
  redirectUrl: n
873
874
  });
874
875
  }
@@ -880,133 +881,124 @@ class je {
880
881
  * @returns string
881
882
  * {@link https://monerium.dev/api-docs#operation/auth}
882
883
  */
883
- async authorize(r) {
884
- var i, v;
885
- const t = (r == null ? void 0 : r.clientId) || ((i = w(this, T)) == null ? void 0 : i.clientId), n = (r == null ? void 0 : r.redirectUrl) || ((v = w(this, T)) == null ? void 0 : v.redirectUrl);
886
- if (!t)
884
+ async authorize(t) {
885
+ var c, v;
886
+ const r = (t == null ? void 0 : t.clientId) || ((c = w(this, U)) == null ? void 0 : c.clientId), n = (t == null ? void 0 : t.redirectUrl) || ((v = w(this, U)) == null ? void 0 : v.redirectUrl);
887
+ if (!r)
887
888
  throw new Error("Missing ClientId");
888
889
  if (!n)
889
890
  throw new Error("Missing RedirectUrl");
890
- const u = Y(w(this, $).api, {
891
- client_id: t,
891
+ const u = te(w(this, z).api, {
892
+ client_id: r,
892
893
  redirect_uri: n,
893
- address: r == null ? void 0 : r.address,
894
- signature: r == null ? void 0 : r.signature,
895
- chainId: r == null ? void 0 : r.chainId
894
+ address: t == null ? void 0 : t.address,
895
+ signature: t == null ? void 0 : t.signature,
896
+ chainId: t == null ? void 0 : t.chainId
896
897
  });
897
898
  window.location.replace(u);
898
899
  }
899
- async connect(r) {
900
- var k, p, y;
901
- const t = (r == null ? void 0 : r.clientId) || ((k = w(this, T)) == null ? void 0 : k.clientId);
902
- if ((r == null ? void 0 : r.clientSecret) || ((p = w(this, T)) == null ? void 0 : p.clientSecret)) {
903
- if (!Z)
900
+ /**
901
+ * Get access to the API
902
+ * @param {AuthorizationCodeCredentials | ClientCredentials} client - the client credentials
903
+ * @returns boolean to indicate if access has been granted
904
+ */
905
+ async getAccess(t) {
906
+ var B, p, y;
907
+ const r = (t == null ? void 0 : t.clientId) || ((B = w(this, U)) == null ? void 0 : B.clientId);
908
+ if ((t == null ? void 0 : t.clientSecret) || ((p = w(this, U)) == null ? void 0 : p.clientSecret)) {
909
+ if (!T)
904
910
  throw new Error("Only use client credentials on server side");
905
- return await w(this, N).call(this, w(this, T)), !!this.bearerProfile;
911
+ return await w(this, G).call(this, w(this, U)), !!this.bearerProfile;
906
912
  }
907
- const u = (r == null ? void 0 : r.redirectUrl) || ((y = w(this, T)) == null ? void 0 : y.redirectUrl);
908
- if (!t)
913
+ const u = (t == null ? void 0 : t.redirectUrl) || ((y = w(this, U)) == null ? void 0 : y.redirectUrl);
914
+ if (!r)
909
915
  throw new Error("Missing ClientId");
910
- if (Z)
911
- throw new Error("This only works on client side");
912
- const i = new URLSearchParams(window.location.search).get("code") || void 0, v = sessionStorage.getItem(V) || void 0;
913
- return i ? await w(this, j).call(this, t, u, i) : v && await w(this, W).call(this, t, v), !!this.bearerProfile;
914
- }
915
- /**
916
- * {@link https://monerium.dev/api-docs#operation/auth-token}
917
- */
918
- async getBearerToken(r) {
919
- let t;
920
- if (ee(r))
921
- t = { ...r, grant_type: "authorization_code" };
922
- else if (Pe(r))
923
- t = { ...r, grant_type: "refresh_token" };
924
- else if (Oe(r))
925
- t = { ...r, grant_type: "client_credentials" };
926
- else
927
- throw new Error("Authentication method could not be detected.");
928
- return await I(this, E, R).call(this, "post", "auth/token", t, !0).then((n) => {
929
- var u;
930
- this.bearerProfile = n, this.isAuthorized = !!n, A(this, F, `Bearer ${n == null ? void 0 : n.access_token}`), window.sessionStorage.setItem(
931
- V,
932
- ((u = this.bearerProfile) == null ? void 0 : u.refresh_token) || ""
933
- );
934
- }).catch((n) => {
935
- throw sessionStorage.removeItem(P), sessionStorage.removeItem(V), new Error(n == null ? void 0 : n.message);
936
- }), ee(r) && He(), this.bearerProfile;
916
+ if (T)
917
+ throw new Error("This only works client side");
918
+ const c = new URLSearchParams(window.location.search).get("code") || void 0, v = sessionStorage.getItem(W) || void 0;
919
+ return v ? await w(this, J).call(this, r, v) : c && await w(this, V).call(this, r, u, c), !!this.bearerProfile;
937
920
  }
938
921
  // -- Read Methods
939
922
  /**
940
923
  * {@link https://monerium.dev/api-docs#operation/auth-context}
941
924
  */
942
925
  getAuthContext() {
943
- return I(this, E, R).call(this, "get", "auth/context");
926
+ return k(this, E, R).call(this, "get", "auth/context");
944
927
  }
945
928
  /**
946
929
  * {@link https://monerium.dev/api-docs#operation/profile}
947
930
  * @param {string} profileId - the id of the profile to fetch.
948
931
 
949
932
  */
950
- getProfile(r) {
951
- return I(this, E, R).call(this, "get", `profiles/${r}`);
933
+ getProfile(t) {
934
+ return k(this, E, R).call(this, "get", `profiles/${t}`);
952
935
  }
953
936
  /**
954
937
  * {@link https://monerium.dev/api-docs#operation/profile-balances}
955
938
  * @param {string=} profileId - the id of the profile to fetch balances.
956
939
  */
957
- getBalances(r) {
958
- return r ? I(this, E, R).call(this, "get", `profiles/${r}/balances`) : I(this, E, R).call(this, "get", "balances");
940
+ getBalances(t) {
941
+ return t ? k(this, E, R).call(this, "get", `profiles/${t}/balances`) : k(this, E, R).call(this, "get", "balances");
959
942
  }
960
943
  /**
961
944
  * {@link https://monerium.dev/api-docs#operation/orders}
962
945
  */
963
- getOrders(r) {
964
- const t = D(r);
965
- return I(this, E, R).call(this, "get", `orders?${t}`);
946
+ getOrders(t) {
947
+ const r = Q(t);
948
+ return k(this, E, R).call(this, "get", `orders?${r}`);
966
949
  }
967
950
  /**
968
951
  * {@link https://monerium.dev/api-docs#operation/order}
969
952
  */
970
- getOrder(r) {
971
- return I(this, E, R).call(this, "get", `orders/${r}`);
953
+ getOrder(t) {
954
+ return k(this, E, R).call(this, "get", `orders/${t}`);
972
955
  }
973
956
  /**
974
957
  * {@link https://monerium.dev/api-docs#operation/tokens}
975
958
  */
976
959
  getTokens() {
977
- return I(this, E, R).call(this, "get", "tokens");
960
+ return k(this, E, R).call(this, "get", "tokens");
978
961
  }
979
962
  // -- Write Methods
980
963
  /**
981
964
  * {@link https://monerium.dev/api-docs#operation/profile-addresses}
982
965
  */
983
- linkAddress(r, t) {
984
- return I(this, E, R).call(this, "post", `profiles/${r}/addresses`, JSON.stringify(t));
966
+ linkAddress(t, r) {
967
+ return k(this, E, R).call(this, "post", `profiles/${t}/addresses`, JSON.stringify(r));
985
968
  }
986
969
  /**
987
970
  * {@link https://monerium.dev/api-docs#operation/post-orders}
988
971
  */
989
- placeOrder(r, t) {
990
- const n = { ...r, kind: "redeem", currency: "eur" };
991
- return t ? I(this, E, R).call(this, "post", `profiles/${t}/orders`, JSON.stringify(n)) : I(this, E, R).call(this, "post", "orders", JSON.stringify(n));
972
+ placeOrder(t, r) {
973
+ const n = { ...t, kind: "redeem", currency: "eur" };
974
+ return r ? k(this, E, R).call(this, "post", `profiles/${r}/orders`, JSON.stringify(n)) : k(this, E, R).call(this, "post", "orders", JSON.stringify(n));
992
975
  }
993
976
  /**
994
977
  * {@link https://monerium.dev/api-docs#operation/supporting-document}
995
978
  */
996
- uploadSupportingDocument(r) {
997
- const t = D(
998
- r
979
+ uploadSupportingDocument(t) {
980
+ const r = Q(
981
+ t
999
982
  );
1000
- return I(this, E, R).call(this, "post", "files/supporting-document", t, !0);
983
+ return k(this, E, R).call(this, "post", "files/supporting-document", r, !0);
1001
984
  }
1002
985
  // -- Notifications
1003
986
  async connectOrderSocket() {
1004
- var r;
1005
- (r = this.bearerProfile) != null && r.access_token && w(this, U).size > 0 && A(this, O, this.subscribeToOrderNotifications());
987
+ var t;
988
+ (t = this.bearerProfile) != null && t.access_token && w(this, H).size > 0 && I(this, L, this.subscribeToOrderNotifications());
1006
989
  }
990
+ /**
991
+ * Cleanups the socket and the subscriptions
992
+ */
1007
993
  async disconnect() {
1008
- var r;
1009
- sessionStorage.removeItem(P), w(this, U).clear(), (r = w(this, O)) == null || r.close();
994
+ var t;
995
+ T || sessionStorage.removeItem(M), w(this, H).clear(), (t = w(this, L)) == null || t.close();
996
+ }
997
+ /**
998
+ * Revokes access
999
+ */
1000
+ async revokeAccess() {
1001
+ T || sessionStorage.removeItem(W), this.disconnect();
1010
1002
  }
1011
1003
  /**
1012
1004
  * Subscribe to MoneriumEvent to receive notifications using the Monerium API (WebSocket)
@@ -1015,41 +1007,62 @@ class je {
1015
1007
  * @param event The event to subscribe to
1016
1008
  * @param handler The handler to be called when the event is triggered
1017
1009
  */
1018
- subscribeOrders(r, t) {
1019
- w(this, U).set(r, t);
1010
+ subscribeOrders(t, r) {
1011
+ w(this, H).set(t, r);
1020
1012
  }
1021
1013
  /**
1022
1014
  * Unsubscribe from MoneriumEvent and close the socket if there are no more subscriptions
1023
1015
  * @param event The event to unsubscribe from
1024
1016
  */
1025
- unsubscribeOrders(r) {
1026
- var t;
1027
- w(this, U).delete(r), w(this, U).size === 0 && ((t = w(this, O)) == null || t.close(), A(this, O, void 0));
1017
+ unsubscribeOrders(t) {
1018
+ var r;
1019
+ w(this, H).delete(t), w(this, H).size === 0 && ((r = w(this, L)) == null || r.close(), I(this, L, void 0));
1028
1020
  }
1029
1021
  }
1030
- $ = new WeakMap(), F = new WeakMap(), O = new WeakMap(), U = new WeakMap(), T = new WeakMap(), E = new WeakSet(), R = async function(r, t, n, u) {
1031
- return Me(
1032
- `${w(this, $).api}/${t}`,
1033
- r,
1034
- u ? D(n) : n,
1022
+ z = new WeakMap(), D = new WeakMap(), L = new WeakMap(), H = new WeakMap(), U = new WeakMap(), O = new WeakSet(), j = async function(t) {
1023
+ let r;
1024
+ if (ne(t))
1025
+ r = { ...t, grant_type: "authorization_code" };
1026
+ else if (Me(t))
1027
+ r = { ...t, grant_type: "refresh_token" };
1028
+ else if (Le(t))
1029
+ r = { ...t, grant_type: "client_credentials" };
1030
+ else
1031
+ throw new Error("Authorization grant type could not be detected.");
1032
+ return await k(this, E, R).call(this, "post", "auth/token", r, !0).then((n) => {
1033
+ var u;
1034
+ this.bearerProfile = n, this.isAuthorized = !!n, I(this, D, `Bearer ${n == null ? void 0 : n.access_token}`), T || window.sessionStorage.setItem(
1035
+ W,
1036
+ ((u = this.bearerProfile) == null ? void 0 : u.refresh_token) || ""
1037
+ );
1038
+ }).catch((n) => {
1039
+ throw T || (sessionStorage.removeItem(M), sessionStorage.removeItem(W), re()), new Error(n == null ? void 0 : n.message);
1040
+ }), ne(t) && re(), this.bearerProfile;
1041
+ }, E = new WeakSet(), R = async function(t, r, n, u) {
1042
+ return qe(
1043
+ `${w(this, z).api}/${r}`,
1044
+ t,
1045
+ u ? Q(n) : n,
1035
1046
  {
1036
- Authorization: w(this, F) || "",
1047
+ Authorization: w(this, D) || "",
1037
1048
  "Content-Type": `application/${u ? "x-www-form-urlencoded" : "json"}`
1038
1049
  }
1039
1050
  );
1040
- }, j = new WeakMap(), N = new WeakMap(), W = new WeakMap();
1051
+ }, V = new WeakMap(), G = new WeakMap(), J = new WeakMap();
1041
1052
  export {
1042
- ve as AccountState,
1043
- he as Currency,
1044
- pe as KYCOutcome,
1045
- le as KYCState,
1046
- je as MoneriumClient,
1047
- we as OrderKind,
1048
- ye as OrderState,
1049
- ge as PaymentStandard,
1050
- fe as Permission,
1051
- de as ProfileType,
1052
- Fe as constants,
1053
- qe as placeOrderMessage,
1054
- me as rfc3339
1053
+ ye as AccountState,
1054
+ le as Currency,
1055
+ we as KYCOutcome,
1056
+ ge as KYCState,
1057
+ We as MoneriumClient,
1058
+ _e as OrderKind,
1059
+ be as OrderState,
1060
+ me as PaymentStandard,
1061
+ ve as Permission,
1062
+ pe as ProfileType,
1063
+ Ne as constants,
1064
+ Be as getChain,
1065
+ ke as getNetwork,
1066
+ Fe as placeOrderMessage,
1067
+ Se as rfc3339
1055
1068
  };