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