@monerium/sdk 2.1.23 → 2.2.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
@@ -3,36 +3,36 @@ var oe = (e, t, o) =>
3
3
  t in e
4
4
  ? ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o })
5
5
  : (e[t] = o);
6
- var E = (e, t, o) => (oe(e, typeof t != "symbol" ? t + "" : t, o), o),
6
+ var E = (e, t, o) => (oe(e, typeof t != 'symbol' ? t + '' : t, o), o),
7
7
  I = (e, t, o) => {
8
- if (!t.has(e)) throw TypeError("Cannot " + o);
8
+ if (!t.has(e)) throw TypeError('Cannot ' + o);
9
9
  };
10
10
  var U = (e, t, o) => (
11
- I(e, t, "read from private field"), o ? o.call(e) : t.get(e)
11
+ I(e, t, 'read from private field'), o ? o.call(e) : t.get(e)
12
12
  ),
13
13
  H = (e, t, o) => {
14
14
  if (t.has(e))
15
- throw TypeError("Cannot add the same private member more than once");
15
+ throw TypeError('Cannot add the same private member more than once');
16
16
  t instanceof WeakSet ? t.add(e) : t.set(e, o);
17
17
  },
18
18
  M = (e, t, o, a) => (
19
- I(e, t, "write to private field"), a ? a.call(e, o) : t.set(e, o), o
19
+ I(e, t, 'write to private field'), a ? a.call(e, o) : t.set(e, o), o
20
20
  );
21
- var B = (e, t, o) => (I(e, t, "access private method"), o);
21
+ var B = (e, t, o) => (I(e, t, 'access private method'), o);
22
22
  var O =
23
- typeof globalThis < "u"
23
+ typeof globalThis < 'u'
24
24
  ? globalThis
25
- : typeof window < "u"
25
+ : typeof window < 'u'
26
26
  ? window
27
- : typeof global < "u"
27
+ : typeof global < 'u'
28
28
  ? global
29
- : typeof self < "u"
29
+ : typeof self < 'u'
30
30
  ? self
31
31
  : {};
32
32
  function ie(e) {
33
33
  if (e.__esModule) return e;
34
34
  var t = e.default;
35
- if (typeof t == "function") {
35
+ if (typeof t == 'function') {
36
36
  var o = function a() {
37
37
  if (this instanceof a) {
38
38
  var w = [null];
@@ -45,7 +45,7 @@ function ie(e) {
45
45
  o.prototype = t.prototype;
46
46
  } else o = {};
47
47
  return (
48
- Object.defineProperty(o, "__esModule", { value: !0 }),
48
+ Object.defineProperty(o, '__esModule', { value: !0 }),
49
49
  Object.keys(e).forEach(function (a) {
50
50
  var w = Object.getOwnPropertyDescriptor(e, a);
51
51
  Object.defineProperty(
@@ -58,7 +58,7 @@ function ie(e) {
58
58
  get: function () {
59
59
  return e[a];
60
60
  },
61
- }
61
+ },
62
62
  );
63
63
  }),
64
64
  o
@@ -77,7 +77,7 @@ function ae(e) {
77
77
  throw new Error(
78
78
  'Could not dynamically require "' +
79
79
  e +
80
- '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'
80
+ '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.',
81
81
  );
82
82
  }
83
83
  var q = {},
@@ -97,8 +97,8 @@ const ue = {},
97
97
  default: ue,
98
98
  },
99
99
  Symbol.toStringTag,
100
- { value: "Module" }
101
- )
100
+ { value: 'Module' },
101
+ ),
102
102
  ),
103
103
  he = /* @__PURE__ */ ie(fe);
104
104
  var G;
@@ -115,34 +115,34 @@ function J() {
115
115
  (function (a, w) {
116
116
  var l;
117
117
  if (
118
- (typeof window < "u" && window.crypto && (l = window.crypto),
119
- typeof self < "u" && self.crypto && (l = self.crypto),
120
- typeof globalThis < "u" &&
118
+ (typeof window < 'u' && window.crypto && (l = window.crypto),
119
+ typeof self < 'u' && self.crypto && (l = self.crypto),
120
+ typeof globalThis < 'u' &&
121
121
  globalThis.crypto &&
122
122
  (l = globalThis.crypto),
123
123
  !l &&
124
- typeof window < "u" &&
124
+ typeof window < 'u' &&
125
125
  window.msCrypto &&
126
126
  (l = window.msCrypto),
127
- !l && typeof O < "u" && O.crypto && (l = O.crypto),
128
- !l && typeof ae == "function")
127
+ !l && typeof O < 'u' && O.crypto && (l = O.crypto),
128
+ !l && typeof ae == 'function')
129
129
  )
130
130
  try {
131
131
  l = he;
132
132
  } catch {}
133
133
  var S = function () {
134
134
  if (l) {
135
- if (typeof l.getRandomValues == "function")
135
+ if (typeof l.getRandomValues == 'function')
136
136
  try {
137
137
  return l.getRandomValues(new Uint32Array(1))[0];
138
138
  } catch {}
139
- if (typeof l.randomBytes == "function")
139
+ if (typeof l.randomBytes == 'function')
140
140
  try {
141
141
  return l.randomBytes(4).readInt32LE();
142
142
  } catch {}
143
143
  }
144
144
  throw new Error(
145
- "Native crypto module could not be used to get secure random number."
145
+ 'Native crypto module could not be used to get secure random number.',
146
146
  );
147
147
  },
148
148
  P =
@@ -163,11 +163,29 @@ function J() {
163
163
  C = (_.lib = {}),
164
164
  y = (C.Base = (function () {
165
165
  return {
166
+ /**
167
+ * Creates a new object that inherits from this object.
168
+ *
169
+ * @param {Object} overrides Properties to copy into the new object.
170
+ *
171
+ * @return {Object} The new object.
172
+ *
173
+ * @static
174
+ *
175
+ * @example
176
+ *
177
+ * var MyType = CryptoJS.lib.Base.extend({
178
+ * field: 'value',
179
+ *
180
+ * method: function () {
181
+ * }
182
+ * });
183
+ */
166
184
  extend: function (r) {
167
185
  var n = P(this);
168
186
  return (
169
187
  r && n.mixIn(r),
170
- (!n.hasOwnProperty("init") || this.init === n.init) &&
188
+ (!n.hasOwnProperty('init') || this.init === n.init) &&
171
189
  (n.init = function () {
172
190
  n.$super.init.apply(this, arguments);
173
191
  }),
@@ -176,31 +194,111 @@ function J() {
176
194
  n
177
195
  );
178
196
  },
197
+ /**
198
+ * Extends this object and runs the init method.
199
+ * Arguments to create() will be passed to init().
200
+ *
201
+ * @return {Object} The new object.
202
+ *
203
+ * @static
204
+ *
205
+ * @example
206
+ *
207
+ * var instance = MyType.create();
208
+ */
179
209
  create: function () {
180
210
  var r = this.extend();
181
211
  return r.init.apply(r, arguments), r;
182
212
  },
213
+ /**
214
+ * Initializes a newly created object.
215
+ * Override this method to add some logic when your objects are created.
216
+ *
217
+ * @example
218
+ *
219
+ * var MyType = CryptoJS.lib.Base.extend({
220
+ * init: function () {
221
+ * // ...
222
+ * }
223
+ * });
224
+ */
183
225
  init: function () {},
226
+ /**
227
+ * Copies properties into this object.
228
+ *
229
+ * @param {Object} properties The properties to mix in.
230
+ *
231
+ * @example
232
+ *
233
+ * MyType.mixIn({
234
+ * field: 'value'
235
+ * });
236
+ */
184
237
  mixIn: function (r) {
185
238
  for (var n in r) r.hasOwnProperty(n) && (this[n] = r[n]);
186
- r.hasOwnProperty("toString") &&
239
+ r.hasOwnProperty('toString') &&
187
240
  (this.toString = r.toString);
188
241
  },
242
+ /**
243
+ * Creates a copy of this object.
244
+ *
245
+ * @return {Object} The clone.
246
+ *
247
+ * @example
248
+ *
249
+ * var clone = instance.clone();
250
+ */
189
251
  clone: function () {
190
252
  return this.init.prototype.extend(this);
191
253
  },
192
254
  };
193
255
  })()),
194
256
  d = (C.WordArray = y.extend({
257
+ /**
258
+ * Initializes a newly created word array.
259
+ *
260
+ * @param {Array} words (Optional) An array of 32-bit words.
261
+ * @param {number} sigBytes (Optional) The number of significant bytes in the words.
262
+ *
263
+ * @example
264
+ *
265
+ * var wordArray = CryptoJS.lib.WordArray.create();
266
+ * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
267
+ * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
268
+ */
195
269
  init: function (r, n) {
196
270
  (r = this.words = r || []),
197
271
  n != w
198
272
  ? (this.sigBytes = n)
199
273
  : (this.sigBytes = r.length * 4);
200
274
  },
275
+ /**
276
+ * Converts this word array to a string.
277
+ *
278
+ * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
279
+ *
280
+ * @return {string} The stringified word array.
281
+ *
282
+ * @example
283
+ *
284
+ * var string = wordArray + '';
285
+ * var string = wordArray.toString();
286
+ * var string = wordArray.toString(CryptoJS.enc.Utf8);
287
+ */
201
288
  toString: function (r) {
202
289
  return (r || u).stringify(this);
203
290
  },
291
+ /**
292
+ * Concatenates a word array to this word array.
293
+ *
294
+ * @param {WordArray} wordArray The word array to append.
295
+ *
296
+ * @return {WordArray} This word array.
297
+ *
298
+ * @example
299
+ *
300
+ * wordArray1.concat(wordArray2);
301
+ */
204
302
  concat: function (r) {
205
303
  var n = this.words,
206
304
  s = r.words,
@@ -216,16 +314,45 @@ function J() {
216
314
  n[(c + b) >>> 2] = s[b >>> 2];
217
315
  return (this.sigBytes += p), this;
218
316
  },
317
+ /**
318
+ * Removes insignificant bits.
319
+ *
320
+ * @example
321
+ *
322
+ * wordArray.clamp();
323
+ */
219
324
  clamp: function () {
220
325
  var r = this.words,
221
326
  n = this.sigBytes;
222
327
  (r[n >>> 2] &= 4294967295 << (32 - (n % 4) * 8)),
223
328
  (r.length = a.ceil(n / 4));
224
329
  },
330
+ /**
331
+ * Creates a copy of this word array.
332
+ *
333
+ * @return {WordArray} The clone.
334
+ *
335
+ * @example
336
+ *
337
+ * var clone = wordArray.clone();
338
+ */
225
339
  clone: function () {
226
340
  var r = y.clone.call(this);
227
341
  return (r.words = this.words.slice(0)), r;
228
342
  },
343
+ /**
344
+ * Creates a word array filled with random bytes.
345
+ *
346
+ * @param {number} nBytes The number of random bytes to generate.
347
+ *
348
+ * @return {WordArray} The random word array.
349
+ *
350
+ * @static
351
+ *
352
+ * @example
353
+ *
354
+ * var wordArray = CryptoJS.lib.WordArray.random(16);
355
+ */
229
356
  random: function (r) {
230
357
  for (var n = [], s = 0; s < r; s += 4) n.push(S());
231
358
  return new d.init(n, r);
@@ -233,6 +360,19 @@ function J() {
233
360
  })),
234
361
  v = (_.enc = {}),
235
362
  u = (v.Hex = {
363
+ /**
364
+ * Converts a word array to a hex string.
365
+ *
366
+ * @param {WordArray} wordArray The word array.
367
+ *
368
+ * @return {string} The hex string.
369
+ *
370
+ * @static
371
+ *
372
+ * @example
373
+ *
374
+ * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
375
+ */
236
376
  stringify: function (r) {
237
377
  for (
238
378
  var n = r.words, s = r.sigBytes, c = [], p = 0;
@@ -243,8 +383,21 @@ function J() {
243
383
  c.push((g >>> 4).toString(16)),
244
384
  c.push((g & 15).toString(16));
245
385
  }
246
- return c.join("");
386
+ return c.join('');
247
387
  },
388
+ /**
389
+ * Converts a hex string to a word array.
390
+ *
391
+ * @param {string} hexStr The hex string.
392
+ *
393
+ * @return {WordArray} The word array.
394
+ *
395
+ * @static
396
+ *
397
+ * @example
398
+ *
399
+ * var wordArray = CryptoJS.enc.Hex.parse(hexString);
400
+ */
248
401
  parse: function (r) {
249
402
  for (var n = r.length, s = [], c = 0; c < n; c += 2)
250
403
  s[c >>> 3] |=
@@ -253,6 +406,19 @@ function J() {
253
406
  },
254
407
  }),
255
408
  h = (v.Latin1 = {
409
+ /**
410
+ * Converts a word array to a Latin1 string.
411
+ *
412
+ * @param {WordArray} wordArray The word array.
413
+ *
414
+ * @return {string} The Latin1 string.
415
+ *
416
+ * @static
417
+ *
418
+ * @example
419
+ *
420
+ * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
421
+ */
256
422
  stringify: function (r) {
257
423
  for (
258
424
  var n = r.words, s = r.sigBytes, c = [], p = 0;
@@ -262,8 +428,21 @@ function J() {
262
428
  var g = (n[p >>> 2] >>> (24 - (p % 4) * 8)) & 255;
263
429
  c.push(String.fromCharCode(g));
264
430
  }
265
- return c.join("");
431
+ return c.join('');
266
432
  },
433
+ /**
434
+ * Converts a Latin1 string to a word array.
435
+ *
436
+ * @param {string} latin1Str The Latin1 string.
437
+ *
438
+ * @return {WordArray} The word array.
439
+ *
440
+ * @static
441
+ *
442
+ * @example
443
+ *
444
+ * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
445
+ */
267
446
  parse: function (r) {
268
447
  for (var n = r.length, s = [], c = 0; c < n; c++)
269
448
  s[c >>> 2] |=
@@ -272,26 +451,83 @@ function J() {
272
451
  },
273
452
  }),
274
453
  i = (v.Utf8 = {
454
+ /**
455
+ * Converts a word array to a UTF-8 string.
456
+ *
457
+ * @param {WordArray} wordArray The word array.
458
+ *
459
+ * @return {string} The UTF-8 string.
460
+ *
461
+ * @static
462
+ *
463
+ * @example
464
+ *
465
+ * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
466
+ */
275
467
  stringify: function (r) {
276
468
  try {
277
469
  return decodeURIComponent(escape(h.stringify(r)));
278
470
  } catch {
279
- throw new Error("Malformed UTF-8 data");
471
+ throw new Error('Malformed UTF-8 data');
280
472
  }
281
473
  },
474
+ /**
475
+ * Converts a UTF-8 string to a word array.
476
+ *
477
+ * @param {string} utf8Str The UTF-8 string.
478
+ *
479
+ * @return {WordArray} The word array.
480
+ *
481
+ * @static
482
+ *
483
+ * @example
484
+ *
485
+ * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
486
+ */
282
487
  parse: function (r) {
283
488
  return h.parse(unescape(encodeURIComponent(r)));
284
489
  },
285
490
  }),
286
491
  f = (C.BufferedBlockAlgorithm = y.extend({
492
+ /**
493
+ * Resets this block algorithm's data buffer to its initial state.
494
+ *
495
+ * @example
496
+ *
497
+ * bufferedBlockAlgorithm.reset();
498
+ */
287
499
  reset: function () {
288
500
  (this._data = new d.init()), (this._nDataBytes = 0);
289
501
  },
502
+ /**
503
+ * Adds new data to this block algorithm's buffer.
504
+ *
505
+ * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
506
+ *
507
+ * @example
508
+ *
509
+ * bufferedBlockAlgorithm._append('data');
510
+ * bufferedBlockAlgorithm._append(wordArray);
511
+ */
290
512
  _append: function (r) {
291
- typeof r == "string" && (r = i.parse(r)),
513
+ typeof r == 'string' && (r = i.parse(r)),
292
514
  this._data.concat(r),
293
515
  (this._nDataBytes += r.sigBytes);
294
516
  },
517
+ /**
518
+ * Processes available data blocks.
519
+ *
520
+ * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
521
+ *
522
+ * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
523
+ *
524
+ * @return {WordArray} The processed data.
525
+ *
526
+ * @example
527
+ *
528
+ * var processedData = bufferedBlockAlgorithm._process();
529
+ * var processedData = bufferedBlockAlgorithm._process(!!'flush');
530
+ */
295
531
  _process: function (r) {
296
532
  var n,
297
533
  s = this._data,
@@ -311,6 +547,15 @@ function J() {
311
547
  }
312
548
  return new d.init(n, k);
313
549
  },
550
+ /**
551
+ * Creates a copy of this object.
552
+ *
553
+ * @return {Object} The clone.
554
+ *
555
+ * @example
556
+ *
557
+ * var clone = bufferedBlockAlgorithm.clone();
558
+ */
314
559
  clone: function () {
315
560
  var r = y.clone.call(this);
316
561
  return (r._data = this._data.clone()), r;
@@ -318,27 +563,98 @@ function J() {
318
563
  _minBufferSize: 0,
319
564
  }));
320
565
  C.Hasher = f.extend({
566
+ /**
567
+ * Configuration options.
568
+ */
321
569
  cfg: y.extend(),
570
+ /**
571
+ * Initializes a newly created hasher.
572
+ *
573
+ * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
574
+ *
575
+ * @example
576
+ *
577
+ * var hasher = CryptoJS.algo.SHA256.create();
578
+ */
322
579
  init: function (r) {
323
580
  (this.cfg = this.cfg.extend(r)), this.reset();
324
581
  },
582
+ /**
583
+ * Resets this hasher to its initial state.
584
+ *
585
+ * @example
586
+ *
587
+ * hasher.reset();
588
+ */
325
589
  reset: function () {
326
590
  f.reset.call(this), this._doReset();
327
591
  },
592
+ /**
593
+ * Updates this hasher with a message.
594
+ *
595
+ * @param {WordArray|string} messageUpdate The message to append.
596
+ *
597
+ * @return {Hasher} This hasher.
598
+ *
599
+ * @example
600
+ *
601
+ * hasher.update('message');
602
+ * hasher.update(wordArray);
603
+ */
328
604
  update: function (r) {
329
605
  return this._append(r), this._process(), this;
330
606
  },
607
+ /**
608
+ * Finalizes the hash computation.
609
+ * Note that the finalize operation is effectively a destructive, read-once operation.
610
+ *
611
+ * @param {WordArray|string} messageUpdate (Optional) A final message update.
612
+ *
613
+ * @return {WordArray} The hash.
614
+ *
615
+ * @example
616
+ *
617
+ * var hash = hasher.finalize();
618
+ * var hash = hasher.finalize('message');
619
+ * var hash = hasher.finalize(wordArray);
620
+ */
331
621
  finalize: function (r) {
332
622
  r && this._append(r);
333
623
  var n = this._doFinalize();
334
624
  return n;
335
625
  },
336
626
  blockSize: 16,
627
+ /**
628
+ * Creates a shortcut function to a hasher's object interface.
629
+ *
630
+ * @param {Hasher} hasher The hasher to create a helper for.
631
+ *
632
+ * @return {Function} The shortcut function.
633
+ *
634
+ * @static
635
+ *
636
+ * @example
637
+ *
638
+ * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
639
+ */
337
640
  _createHelper: function (r) {
338
641
  return function (n, s) {
339
642
  return new r.init(s).finalize(n);
340
643
  };
341
644
  },
645
+ /**
646
+ * Creates a shortcut function to the HMAC's object interface.
647
+ *
648
+ * @param {Hasher} hasher The hasher to use in this HMAC helper.
649
+ *
650
+ * @return {Function} The shortcut function.
651
+ *
652
+ * @static
653
+ *
654
+ * @example
655
+ *
656
+ * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
657
+ */
342
658
  _createHmacHelper: function (r) {
343
659
  return function (n, s) {
344
660
  return new x.HMAC.init(r, s).finalize(n);
@@ -365,6 +681,21 @@ function J() {
365
681
  l = w.WordArray,
366
682
  S = a.enc;
367
683
  S.Base64url = {
684
+ /**
685
+ * Converts a word array to a Base64url string.
686
+ *
687
+ * @param {WordArray} wordArray The word array.
688
+ *
689
+ * @param {boolean} urlSafe Whether to use url safe
690
+ *
691
+ * @return {string} The Base64url string.
692
+ *
693
+ * @static
694
+ *
695
+ * @example
696
+ *
697
+ * var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
698
+ */
368
699
  stringify: function (_, C = !0) {
369
700
  var y = _.words,
370
701
  d = _.sigBytes,
@@ -383,8 +714,23 @@ function J() {
383
714
  u.push(v.charAt((r >>> (6 * (3 - n))) & 63));
384
715
  var s = v.charAt(64);
385
716
  if (s) for (; u.length % 4; ) u.push(s);
386
- return u.join("");
717
+ return u.join('');
387
718
  },
719
+ /**
720
+ * Converts a Base64url string to a word array.
721
+ *
722
+ * @param {string} base64Str The Base64url string.
723
+ *
724
+ * @param {boolean} urlSafe Whether to use url safe
725
+ *
726
+ * @return {WordArray} The word array.
727
+ *
728
+ * @static
729
+ *
730
+ * @example
731
+ *
732
+ * var wordArray = CryptoJS.enc.Base64url.parse(base64String);
733
+ */
388
734
  parse: function (_, C = !0) {
389
735
  var y = _.length,
390
736
  d = C ? this._safe_map : this._map,
@@ -400,9 +746,9 @@ function J() {
400
746
  }
401
747
  return P(_, y, v);
402
748
  },
403
- _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
749
+ _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
404
750
  _safe_map:
405
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
751
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
406
752
  };
407
753
  function P(_, C, y) {
408
754
  for (var d = [], v = 0, u = 0; u < C; u++)
@@ -547,8 +893,8 @@ var V = {},
547
893
  });
548
894
  })(le);
549
895
  const de = () => {
550
- let e = "";
551
- const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
896
+ let e = '';
897
+ const t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
552
898
  o = t.length;
553
899
  let a = 0;
554
900
  for (; a < 128; ) (e += t.charAt(Math.floor(Math.random() * o))), (a += 1);
@@ -557,50 +903,62 @@ const de = () => {
557
903
  pe = {
558
904
  environments: {
559
905
  production: {
560
- api: "https://api.monerium.app",
561
- web: "https://monerium.app",
906
+ api: 'https://api.monerium.app',
907
+ web: 'https://monerium.app',
562
908
  },
563
909
  sandbox: {
564
- api: "https://api.monerium.dev",
565
- web: "https://sandbox.monerium.dev",
910
+ api: 'https://api.monerium.dev',
911
+ web: 'https://sandbox.monerium.dev',
566
912
  },
567
913
  },
568
914
  };
569
915
  var $, W, A, R, T, Q, j, X, F, Z;
570
916
  class Re {
571
- constructor(t = "sandbox") {
917
+ constructor(t = 'sandbox') {
918
+ // -- Helper Methods
572
919
  H(this, A);
573
920
  H(this, T);
574
921
  H(this, j);
575
922
  H(this, F);
576
923
  H(this, $, void 0);
577
924
  H(this, W, void 0);
578
- E(this, "codeVerifier");
579
- E(this, "bearerProfile");
580
- E(this, "pkceRequest", (t) => this.getAuthFlowURI(t));
925
+ /** The PKCE code verifier */
926
+ E(this, 'codeVerifier');
927
+ E(this, 'bearerProfile');
928
+ /**
929
+ * @deprecated since v2.0.7, use {@link getAuthFlowURI} instead.
930
+ */
931
+ E(this, 'pkceRequest', (t) => this.getAuthFlowURI(t));
581
932
  M(this, $, pe.environments[t]);
582
933
  }
934
+ // -- Authentication
583
935
  async auth(t) {
584
936
  let o;
585
937
  if (B(this, T, Q).call(this, t))
586
- o = { ...t, grant_type: "authorization_code" };
938
+ o = { ...t, grant_type: 'authorization_code' };
587
939
  else if (B(this, j, X).call(this, t))
588
- o = { ...t, grant_type: "refresh_token" };
940
+ o = { ...t, grant_type: 'refresh_token' };
589
941
  else if (B(this, F, Z).call(this, t))
590
- o = { ...t, grant_type: "client_credentials" };
591
- else throw new Error("Authentication method could not be detected.");
942
+ o = { ...t, grant_type: 'client_credentials' };
943
+ else throw new Error('Authentication method could not be detected.');
592
944
  return (
593
945
  (this.bearerProfile = await B(this, A, R).call(
594
946
  this,
595
- "post",
596
- "auth/token",
947
+ 'post',
948
+ 'auth/token',
597
949
  new URLSearchParams(o),
598
- !0
950
+ !0,
599
951
  )),
600
952
  M(this, W, `Bearer ${this.bearerProfile.access_token}`),
601
953
  this.bearerProfile
602
954
  );
603
955
  }
956
+ /**
957
+ * Construct the url to the authorization code flow,
958
+ * the code verifier is needed afterwards to obtain an access token and is therefore stored in `this.codeVerifier`
959
+ * For automatic wallet link, add the following properties: `address`, `signature`, `chain` & `network`
960
+ * @returns string
961
+ */
604
962
  getAuthFlowURI(t) {
605
963
  this.codeVerifier = de();
606
964
  const o = D.stringify(V(this.codeVerifier)),
@@ -608,53 +966,61 @@ class Re {
608
966
  ...t,
609
967
  client_id: t == null ? void 0 : t.client_id,
610
968
  code_challenge: o,
611
- code_challenge_method: "S256",
612
- response_type: "code",
969
+ code_challenge_method: 'S256',
970
+ response_type: 'code',
613
971
  };
614
972
  return `${U(this, $).api}/auth?${new URLSearchParams(a)}`;
615
973
  }
974
+ // -- Read Methods
616
975
  getAuthContext() {
617
- return B(this, A, R).call(this, "get", "auth/context");
976
+ return B(this, A, R).call(this, 'get', 'auth/context');
618
977
  }
978
+ /**
979
+ * @param {string} profileId - the id of the profile to fetch.
980
+ */
619
981
  getProfile(t) {
620
- return B(this, A, R).call(this, "get", `profiles/${t}`);
982
+ return B(this, A, R).call(this, 'get', `profiles/${t}`);
621
983
  }
984
+ /**
985
+ * @param {string=} profileId - the id of the profile to fetch balances.
986
+ */
622
987
  getBalances(t) {
623
988
  return t
624
- ? B(this, A, R).call(this, "get", `profiles/${t}/balances`)
625
- : B(this, A, R).call(this, "get", "balances");
989
+ ? B(this, A, R).call(this, 'get', `profiles/${t}/balances`)
990
+ : B(this, A, R).call(this, 'get', 'balances');
626
991
  }
627
992
  getOrders(t) {
628
993
  const o = new URLSearchParams(t);
629
- return B(this, A, R).call(this, "get", `orders?${o}`);
994
+ return B(this, A, R).call(this, 'get', `orders?${o}`);
630
995
  }
631
996
  getOrder(t) {
632
- return B(this, A, R).call(this, "get", `orders/${t}`);
997
+ return B(this, A, R).call(this, 'get', `orders/${t}`);
633
998
  }
634
999
  getTokens() {
635
- return B(this, A, R).call(this, "get", "tokens");
1000
+ return B(this, A, R).call(this, 'get', 'tokens');
636
1001
  }
1002
+ // -- Write Methods
637
1003
  linkAddress(t, o) {
638
1004
  return B(this, A, R).call(
639
1005
  this,
640
- "post",
1006
+ 'post',
641
1007
  `profiles/${t}/addresses`,
642
- JSON.stringify(o)
1008
+ JSON.stringify(o),
643
1009
  );
644
1010
  }
645
1011
  placeOrder(t, o) {
646
1012
  return o
647
1013
  ? B(this, A, R).call(
648
1014
  this,
649
- "post",
1015
+ 'post',
650
1016
  `profiles/${o}/orders`,
651
- JSON.stringify(t)
1017
+ JSON.stringify(t),
652
1018
  )
653
- : B(this, A, R).call(this, "post", "orders", JSON.stringify(t));
1019
+ : B(this, A, R).call(this, 'post', 'orders', JSON.stringify(t));
654
1020
  }
655
1021
  uploadSupportingDocument(t) {
656
1022
  const o = new URLSearchParams(t);
657
- return B(this, A, R).call(this, "post", "files/supporting-document", o, !0);
1023
+ return B(this, A, R).call(this, 'post', 'files/supporting-document', o, !0);
658
1024
  }
659
1025
  }
660
1026
  ($ = new WeakMap()),
@@ -664,8 +1030,9 @@ class Re {
664
1030
  const l = await fetch(`${U(this, $).api}/${o}`, {
665
1031
  method: t,
666
1032
  headers: {
667
- "Content-Type": `application/${w ? "x-www-form-urlencoded" : "json"}`,
668
- Authorization: U(this, W) || "",
1033
+ 'Content-Type': `application/${w ? 'x-www-form-urlencoded' : 'json'}`,
1034
+ Authorization: U(this, W) || '',
1035
+ // "User-Agent": "sdk/" + pjson.version,
669
1036
  },
670
1037
  body: a,
671
1038
  });
@@ -691,48 +1058,48 @@ class Re {
691
1058
  return t.client_secret != null;
692
1059
  });
693
1060
  var ve = /* @__PURE__ */ ((e) => (
694
- (e.eur = "eur"), (e.usd = "usd"), (e.gbp = "gbp"), (e.isk = "isk"), e
1061
+ (e.eur = 'eur'), (e.usd = 'usd'), (e.gbp = 'gbp'), (e.isk = 'isk'), e
695
1062
  ))(ve || {}),
696
1063
  ge = /* @__PURE__ */ ((e) => (
697
- (e.corporate = "corporate"), (e.personal = "personal"), e
1064
+ (e.corporate = 'corporate'), (e.personal = 'personal'), e
698
1065
  ))(ge || {}),
699
- ye = /* @__PURE__ */ ((e) => ((e.read = "read"), (e.write = "write"), e))(
700
- ye || {}
1066
+ ye = /* @__PURE__ */ ((e) => ((e.read = 'read'), (e.write = 'write'), e))(
1067
+ ye || {},
701
1068
  ),
702
1069
  we = /* @__PURE__ */ ((e) => (
703
- (e.absent = "absent"),
704
- (e.submitted = "submitted"),
705
- (e.pending = "pending"),
706
- (e.confirmed = "confirmed"),
1070
+ (e.absent = 'absent'),
1071
+ (e.submitted = 'submitted'),
1072
+ (e.pending = 'pending'),
1073
+ (e.confirmed = 'confirmed'),
707
1074
  e
708
1075
  ))(we || {}),
709
1076
  _e = /* @__PURE__ */ ((e) => (
710
- (e.approved = "approved"),
711
- (e.rejected = "rejected"),
712
- (e.unknown = "unknown"),
1077
+ (e.approved = 'approved'),
1078
+ (e.rejected = 'rejected'),
1079
+ (e.unknown = 'unknown'),
713
1080
  e
714
1081
  ))(_e || {}),
715
- me = /* @__PURE__ */ ((e) => ((e.iban = "iban"), (e.scan = "scan"), e))(
716
- me || {}
1082
+ me = /* @__PURE__ */ ((e) => ((e.iban = 'iban'), (e.scan = 'scan'), e))(
1083
+ me || {},
717
1084
  ),
718
1085
  be = /* @__PURE__ */ ((e) => (
719
- (e.polygon = "polygon"), (e.ethereum = "ethereum"), (e.gnosis = "gnosis"), e
1086
+ (e.polygon = 'polygon'), (e.ethereum = 'ethereum'), (e.gnosis = 'gnosis'), e
720
1087
  ))(be || {}),
721
1088
  Be = /* @__PURE__ */ ((e) => (
722
- (e.mainnet = "mainnet"),
723
- (e.chiado = "chiado"),
724
- (e.goerli = "goerli"),
725
- (e.mumbai = "mumbai"),
1089
+ (e.mainnet = 'mainnet'),
1090
+ (e.chiado = 'chiado'),
1091
+ (e.goerli = 'goerli'),
1092
+ (e.mumbai = 'mumbai'),
726
1093
  e
727
1094
  ))(Be || {}),
728
- xe = /* @__PURE__ */ ((e) => ((e.redeem = "redeem"), (e.issue = "issue"), e))(
729
- xe || {}
1095
+ xe = /* @__PURE__ */ ((e) => ((e.redeem = 'redeem'), (e.issue = 'issue'), e))(
1096
+ xe || {},
730
1097
  ),
731
1098
  Ae = /* @__PURE__ */ ((e) => (
732
- (e.placed = "placed"),
733
- (e.pending = "pending"),
734
- (e.processed = "processed"),
735
- (e.rejected = "rejected"),
1099
+ (e.placed = 'placed'),
1100
+ (e.pending = 'pending'),
1101
+ (e.processed = 'processed'),
1102
+ (e.rejected = 'rejected'),
736
1103
  e
737
1104
  ))(Ae || {});
738
1105
  export {