@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.umd.js CHANGED
@@ -1,48 +1,48 @@
1
- var xe = Object.defineProperty;
2
- var Ce = (a, c, g) =>
3
- c in a
4
- ? xe(a, c, { enumerable: !0, configurable: !0, writable: !0, value: g })
5
- : (a[c] = g);
6
- var I = (a, c, g) => (Ce(a, typeof c != "symbol" ? c + "" : c, g), g),
7
- N = (a, c, g) => {
8
- if (!c.has(a)) throw TypeError("Cannot " + g);
9
- };
10
- var D = (a, c, g) => (
11
- N(a, c, "read from private field"), g ? g.call(a) : c.get(a)
12
- ),
13
- $ = (a, c, g) => {
14
- if (c.has(a))
15
- throw TypeError("Cannot add the same private member more than once");
16
- c instanceof WeakSet ? c.add(a) : c.set(a, g);
17
- },
18
- G = (a, c, g, z) => (
19
- N(a, c, "write to private field"), z ? z.call(a, g) : c.set(a, g), g
20
- );
21
- var S = (a, c, g) => (N(a, c, "access private method"), g);
22
1
  (function (a, c) {
23
- typeof exports == "object" && typeof module < "u"
2
+ typeof exports == 'object' && typeof module < 'u'
24
3
  ? c(exports)
25
- : typeof define == "function" && define.amd
26
- ? define(["exports"], c)
27
- : ((a = typeof globalThis < "u" ? globalThis : a || self),
28
- c((a["monerium-sdk"] = {})));
4
+ : typeof define == 'function' && define.amd
5
+ ? define(['exports'], c)
6
+ : ((a = typeof globalThis < 'u' ? globalThis : a || self),
7
+ c((a['monerium-sdk'] = {})));
29
8
  })(this, function (a) {
30
9
  var E, W, A, k, q, se, M, ce, F, ue;
31
- ("use strict");
10
+ ('use strict');
11
+ var xe = Object.defineProperty;
12
+ var Ce = (a, c, g) =>
13
+ c in a
14
+ ? xe(a, c, { enumerable: !0, configurable: !0, writable: !0, value: g })
15
+ : (a[c] = g);
16
+ var I = (a, c, g) => (Ce(a, typeof c != 'symbol' ? c + '' : c, g), g),
17
+ N = (a, c, g) => {
18
+ if (!c.has(a)) throw TypeError('Cannot ' + g);
19
+ };
20
+ var D = (a, c, g) => (
21
+ N(a, c, 'read from private field'), g ? g.call(a) : c.get(a)
22
+ ),
23
+ $ = (a, c, g) => {
24
+ if (c.has(a))
25
+ throw TypeError('Cannot add the same private member more than once');
26
+ c instanceof WeakSet ? c.add(a) : c.set(a, g);
27
+ },
28
+ G = (a, c, g, z) => (
29
+ N(a, c, 'write to private field'), z ? z.call(a, g) : c.set(a, g), g
30
+ );
31
+ var S = (a, c, g) => (N(a, c, 'access private method'), g);
32
32
  var c =
33
- typeof globalThis < "u"
33
+ typeof globalThis < 'u'
34
34
  ? globalThis
35
- : typeof window < "u"
35
+ : typeof window < 'u'
36
36
  ? window
37
- : typeof global < "u"
37
+ : typeof global < 'u'
38
38
  ? global
39
- : typeof self < "u"
39
+ : typeof self < 'u'
40
40
  ? self
41
41
  : {};
42
42
  function g(r) {
43
43
  if (r.__esModule) return r;
44
44
  var n = r.default;
45
- if (typeof n == "function") {
45
+ if (typeof n == 'function') {
46
46
  var s = function u() {
47
47
  if (this instanceof u) {
48
48
  var b = [null];
@@ -55,7 +55,7 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
55
55
  s.prototype = n.prototype;
56
56
  } else s = {};
57
57
  return (
58
- Object.defineProperty(s, "__esModule", { value: !0 }),
58
+ Object.defineProperty(s, '__esModule', { value: !0 }),
59
59
  Object.keys(r).forEach(function (u) {
60
60
  var b = Object.getOwnPropertyDescriptor(r, u);
61
61
  Object.defineProperty(
@@ -68,7 +68,7 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
68
68
  get: function () {
69
69
  return r[u];
70
70
  },
71
- }
71
+ },
72
72
  );
73
73
  }),
74
74
  s
@@ -87,7 +87,7 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
87
87
  throw new Error(
88
88
  'Could not dynamically require "' +
89
89
  r +
90
- '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'
90
+ '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.',
91
91
  );
92
92
  }
93
93
  var U = {},
@@ -104,9 +104,9 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
104
104
  Object.defineProperty(
105
105
  { __proto__: null, default: {} },
106
106
  Symbol.toStringTag,
107
- { value: "Module" }
108
- )
109
- )
107
+ { value: 'Module' },
108
+ ),
109
+ ),
110
110
  );
111
111
  var J;
112
112
  function Q() {
@@ -122,34 +122,34 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
122
122
  (function (u, b) {
123
123
  var p;
124
124
  if (
125
- (typeof window < "u" && window.crypto && (p = window.crypto),
126
- typeof self < "u" && self.crypto && (p = self.crypto),
127
- typeof globalThis < "u" &&
125
+ (typeof window < 'u' && window.crypto && (p = window.crypto),
126
+ typeof self < 'u' && self.crypto && (p = self.crypto),
127
+ typeof globalThis < 'u' &&
128
128
  globalThis.crypto &&
129
129
  (p = globalThis.crypto),
130
130
  !p &&
131
- typeof window < "u" &&
131
+ typeof window < 'u' &&
132
132
  window.msCrypto &&
133
133
  (p = window.msCrypto),
134
- !p && typeof c < "u" && c.crypto && (p = c.crypto),
135
- !p && typeof he == "function")
134
+ !p && typeof c < 'u' && c.crypto && (p = c.crypto),
135
+ !p && typeof he == 'function')
136
136
  )
137
137
  try {
138
138
  p = de;
139
139
  } catch {}
140
140
  var H = function () {
141
141
  if (p) {
142
- if (typeof p.getRandomValues == "function")
142
+ if (typeof p.getRandomValues == 'function')
143
143
  try {
144
144
  return p.getRandomValues(new Uint32Array(1))[0];
145
145
  } catch {}
146
- if (typeof p.randomBytes == "function")
146
+ if (typeof p.randomBytes == 'function')
147
147
  try {
148
148
  return p.randomBytes(4).readInt32LE();
149
149
  } catch {}
150
150
  }
151
151
  throw new Error(
152
- "Native crypto module could not be used to get secure random number."
152
+ 'Native crypto module could not be used to get secure random number.',
153
153
  );
154
154
  },
155
155
  O =
@@ -174,7 +174,7 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
174
174
  var t = O(this);
175
175
  return (
176
176
  e && t.mixIn(e),
177
- (!t.hasOwnProperty("init") || this.init === t.init) &&
177
+ (!t.hasOwnProperty('init') || this.init === t.init) &&
178
178
  (t.init = function () {
179
179
  t.$super.init.apply(this, arguments);
180
180
  }),
@@ -191,7 +191,7 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
191
191
  mixIn: function (e) {
192
192
  for (var t in e)
193
193
  e.hasOwnProperty(t) && (this[t] = e[t]);
194
- e.hasOwnProperty("toString") &&
194
+ e.hasOwnProperty('toString') &&
195
195
  (this.toString = e.toString);
196
196
  },
197
197
  clone: function () {
@@ -251,7 +251,7 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
251
251
  f.push((w >>> 4).toString(16)),
252
252
  f.push((w & 15).toString(16));
253
253
  }
254
- return f.join("");
254
+ return f.join('');
255
255
  },
256
256
  parse: function (e) {
257
257
  for (var t = e.length, o = [], f = 0; f < t; f += 2)
@@ -270,7 +270,7 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
270
270
  var w = (t[y >>> 2] >>> (24 - (y % 4) * 8)) & 255;
271
271
  f.push(String.fromCharCode(w));
272
272
  }
273
- return f.join("");
273
+ return f.join('');
274
274
  },
275
275
  parse: function (e) {
276
276
  for (var t = e.length, o = [], f = 0; f < t; f++)
@@ -284,7 +284,7 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
284
284
  try {
285
285
  return decodeURIComponent(escape(d.stringify(e)));
286
286
  } catch {
287
- throw new Error("Malformed UTF-8 data");
287
+ throw new Error('Malformed UTF-8 data');
288
288
  }
289
289
  },
290
290
  parse: function (e) {
@@ -296,7 +296,7 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
296
296
  (this._data = new v.init()), (this._nDataBytes = 0);
297
297
  },
298
298
  _append: function (e) {
299
- typeof e == "string" && (e = i.parse(e)),
299
+ typeof e == 'string' && (e = i.parse(e)),
300
300
  this._data.concat(e),
301
301
  (this._nDataBytes += e.sigBytes);
302
302
  },
@@ -392,7 +392,7 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
392
392
  h.push(m.charAt((e >>> (6 * (3 - t))) & 63));
393
393
  var o = m.charAt(64);
394
394
  if (o) for (; h.length % 4; ) h.push(o);
395
- return h.join("");
395
+ return h.join('');
396
396
  },
397
397
  parse: function (B, R = !0) {
398
398
  var _ = B.length,
@@ -409,9 +409,9 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
409
409
  }
410
410
  return O(B, _, m);
411
411
  },
412
- _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
412
+ _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
413
413
  _safe_map:
414
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
414
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
415
415
  };
416
416
  function O(B, R, _) {
417
417
  for (var v = [], m = 0, h = 0; h < R; h++)
@@ -557,9 +557,9 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
557
557
  });
558
558
  })(pe);
559
559
  const ve = () => {
560
- let r = "";
560
+ let r = '';
561
561
  const n =
562
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
562
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
563
563
  s = n.length;
564
564
  let u = 0;
565
565
  for (; u < 128; )
@@ -569,44 +569,44 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
569
569
  ye = {
570
570
  environments: {
571
571
  production: {
572
- api: "https://api.monerium.app",
573
- web: "https://monerium.app",
572
+ api: 'https://api.monerium.app',
573
+ web: 'https://monerium.app',
574
574
  },
575
575
  sandbox: {
576
- api: "https://api.monerium.dev",
577
- web: "https://sandbox.monerium.dev",
576
+ api: 'https://api.monerium.dev',
577
+ web: 'https://sandbox.monerium.dev',
578
578
  },
579
579
  },
580
580
  };
581
581
  class ge {
582
- constructor(n = "sandbox") {
582
+ constructor(n = 'sandbox') {
583
583
  $(this, A);
584
584
  $(this, q);
585
585
  $(this, M);
586
586
  $(this, F);
587
587
  $(this, E, void 0);
588
588
  $(this, W, void 0);
589
- I(this, "codeVerifier");
590
- I(this, "bearerProfile");
591
- I(this, "pkceRequest", (n) => this.getAuthFlowURI(n));
589
+ I(this, 'codeVerifier');
590
+ I(this, 'bearerProfile');
591
+ I(this, 'pkceRequest', (n) => this.getAuthFlowURI(n));
592
592
  G(this, E, ye.environments[n]);
593
593
  }
594
594
  async auth(n) {
595
595
  let s;
596
596
  if (S(this, q, se).call(this, n))
597
- s = { ...n, grant_type: "authorization_code" };
597
+ s = { ...n, grant_type: 'authorization_code' };
598
598
  else if (S(this, M, ce).call(this, n))
599
- s = { ...n, grant_type: "refresh_token" };
599
+ s = { ...n, grant_type: 'refresh_token' };
600
600
  else if (S(this, F, ue).call(this, n))
601
- s = { ...n, grant_type: "client_credentials" };
602
- else throw new Error("Authentication method could not be detected.");
601
+ s = { ...n, grant_type: 'client_credentials' };
602
+ else throw new Error('Authentication method could not be detected.');
603
603
  return (
604
604
  (this.bearerProfile = await S(this, A, k).call(
605
605
  this,
606
- "post",
607
- "auth/token",
606
+ 'post',
607
+ 'auth/token',
608
608
  new URLSearchParams(s),
609
- !0
609
+ !0,
610
610
  )),
611
611
  G(this, W, `Bearer ${this.bearerProfile.access_token}`),
612
612
  this.bearerProfile
@@ -619,58 +619,58 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
619
619
  ...n,
620
620
  client_id: n == null ? void 0 : n.client_id,
621
621
  code_challenge: s,
622
- code_challenge_method: "S256",
623
- response_type: "code",
622
+ code_challenge_method: 'S256',
623
+ response_type: 'code',
624
624
  };
625
625
  return `${D(this, E).api}/auth?${new URLSearchParams(u)}`;
626
626
  }
627
627
  getAuthContext() {
628
- return S(this, A, k).call(this, "get", "auth/context");
628
+ return S(this, A, k).call(this, 'get', 'auth/context');
629
629
  }
630
630
  getProfile(n) {
631
- return S(this, A, k).call(this, "get", `profiles/${n}`);
631
+ return S(this, A, k).call(this, 'get', `profiles/${n}`);
632
632
  }
633
633
  getBalances(n) {
634
634
  return n
635
- ? S(this, A, k).call(this, "get", `profiles/${n}/balances`)
636
- : S(this, A, k).call(this, "get", "balances");
635
+ ? S(this, A, k).call(this, 'get', `profiles/${n}/balances`)
636
+ : S(this, A, k).call(this, 'get', 'balances');
637
637
  }
638
638
  getOrders(n) {
639
639
  const s = new URLSearchParams(n);
640
- return S(this, A, k).call(this, "get", `orders?${s}`);
640
+ return S(this, A, k).call(this, 'get', `orders?${s}`);
641
641
  }
642
642
  getOrder(n) {
643
- return S(this, A, k).call(this, "get", `orders/${n}`);
643
+ return S(this, A, k).call(this, 'get', `orders/${n}`);
644
644
  }
645
645
  getTokens() {
646
- return S(this, A, k).call(this, "get", "tokens");
646
+ return S(this, A, k).call(this, 'get', 'tokens');
647
647
  }
648
648
  linkAddress(n, s) {
649
649
  return S(this, A, k).call(
650
650
  this,
651
- "post",
651
+ 'post',
652
652
  `profiles/${n}/addresses`,
653
- JSON.stringify(s)
653
+ JSON.stringify(s),
654
654
  );
655
655
  }
656
656
  placeOrder(n, s) {
657
657
  return s
658
658
  ? S(this, A, k).call(
659
659
  this,
660
- "post",
660
+ 'post',
661
661
  `profiles/${s}/orders`,
662
- JSON.stringify(n)
662
+ JSON.stringify(n),
663
663
  )
664
- : S(this, A, k).call(this, "post", "orders", JSON.stringify(n));
664
+ : S(this, A, k).call(this, 'post', 'orders', JSON.stringify(n));
665
665
  }
666
666
  uploadSupportingDocument(n) {
667
667
  const s = new URLSearchParams(n);
668
668
  return S(this, A, k).call(
669
669
  this,
670
- "post",
671
- "files/supporting-document",
670
+ 'post',
671
+ 'files/supporting-document',
672
672
  s,
673
- !0
673
+ !0,
674
674
  );
675
675
  }
676
676
  }
@@ -681,8 +681,8 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
681
681
  const p = await fetch(`${D(this, E).api}/${s}`, {
682
682
  method: n,
683
683
  headers: {
684
- "Content-Type": `application/${b ? "x-www-form-urlencoded" : "json"}`,
685
- Authorization: D(this, W) || "",
684
+ 'Content-Type': `application/${b ? 'x-www-form-urlencoded' : 'json'}`,
685
+ Authorization: D(this, W) || '',
686
686
  },
687
687
  body: u,
688
688
  });
@@ -708,45 +708,45 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
708
708
  return n.client_secret != null;
709
709
  });
710
710
  var X = ((r) => (
711
- (r.eur = "eur"), (r.usd = "usd"), (r.gbp = "gbp"), (r.isk = "isk"), r
711
+ (r.eur = 'eur'), (r.usd = 'usd'), (r.gbp = 'gbp'), (r.isk = 'isk'), r
712
712
  ))(X || {}),
713
- Z = ((r) => ((r.corporate = "corporate"), (r.personal = "personal"), r))(
714
- Z || {}
713
+ Z = ((r) => ((r.corporate = 'corporate'), (r.personal = 'personal'), r))(
714
+ Z || {},
715
715
  ),
716
- K = ((r) => ((r.read = "read"), (r.write = "write"), r))(K || {}),
716
+ K = ((r) => ((r.read = 'read'), (r.write = 'write'), r))(K || {}),
717
717
  Y = ((r) => (
718
- (r.absent = "absent"),
719
- (r.submitted = "submitted"),
720
- (r.pending = "pending"),
721
- (r.confirmed = "confirmed"),
718
+ (r.absent = 'absent'),
719
+ (r.submitted = 'submitted'),
720
+ (r.pending = 'pending'),
721
+ (r.confirmed = 'confirmed'),
722
722
  r
723
723
  ))(Y || {}),
724
724
  ee = ((r) => (
725
- (r.approved = "approved"),
726
- (r.rejected = "rejected"),
727
- (r.unknown = "unknown"),
725
+ (r.approved = 'approved'),
726
+ (r.rejected = 'rejected'),
727
+ (r.unknown = 'unknown'),
728
728
  r
729
729
  ))(ee || {}),
730
- re = ((r) => ((r.iban = "iban"), (r.scan = "scan"), r))(re || {}),
730
+ re = ((r) => ((r.iban = 'iban'), (r.scan = 'scan'), r))(re || {}),
731
731
  te = ((r) => (
732
- (r.polygon = "polygon"),
733
- (r.ethereum = "ethereum"),
734
- (r.gnosis = "gnosis"),
732
+ (r.polygon = 'polygon'),
733
+ (r.ethereum = 'ethereum'),
734
+ (r.gnosis = 'gnosis'),
735
735
  r
736
736
  ))(te || {}),
737
737
  ne = ((r) => (
738
- (r.mainnet = "mainnet"),
739
- (r.chiado = "chiado"),
740
- (r.goerli = "goerli"),
741
- (r.mumbai = "mumbai"),
738
+ (r.mainnet = 'mainnet'),
739
+ (r.chiado = 'chiado'),
740
+ (r.goerli = 'goerli'),
741
+ (r.mumbai = 'mumbai'),
742
742
  r
743
743
  ))(ne || {}),
744
- ie = ((r) => ((r.redeem = "redeem"), (r.issue = "issue"), r))(ie || {}),
744
+ ie = ((r) => ((r.redeem = 'redeem'), (r.issue = 'issue'), r))(ie || {}),
745
745
  oe = ((r) => (
746
- (r.placed = "placed"),
747
- (r.pending = "pending"),
748
- (r.processed = "processed"),
749
- (r.rejected = "rejected"),
746
+ (r.placed = 'placed'),
747
+ (r.pending = 'pending'),
748
+ (r.processed = 'processed'),
749
+ (r.rejected = 'rejected'),
750
750
  r
751
751
  ))(oe || {});
752
752
  (a.Chain = te),
@@ -760,6 +760,6 @@ var S = (a, c, g) => (N(a, c, "access private method"), g);
760
760
  (a.PaymentStandard = re),
761
761
  (a.Permission = K),
762
762
  (a.ProfileType = Z),
763
- Object.defineProperty(a, Symbol.toStringTag, { value: "Module" });
763
+ Object.defineProperty(a, Symbol.toStringTag, { value: 'Module' });
764
764
  });
765
765
  //# sourceMappingURL=index.umd.js.map