@monerium/sdk 2.6.4 → 2.7.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 +507 -49
- package/README.md +303 -66
- package/dist/client.d.ts +99 -0
- package/dist/config.d.ts +3 -0
- package/dist/constants.d.ts +9 -0
- package/dist/helpers/auth.helpers.d.ts +23 -0
- package/dist/helpers/index.d.ts +2 -0
- package/dist/helpers/service.helpers.d.ts +1 -0
- package/dist/index.d.ts +4 -334
- package/dist/index.js +1 -0
- package/dist/index.mjs +542 -364
- package/dist/package.json +41 -0
- package/dist/types.d.ts +348 -0
- package/dist/utils.d.ts +27 -0
- package/package.json +16 -46
- package/dist/index.mjs.map +0 -1
- package/dist/index.umd.js +0 -2
- package/dist/index.umd.js.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,101 +1,151 @@
|
|
|
1
|
-
var
|
|
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) => {
|
|
1
|
+
var G = (e, r, t) => {
|
|
4
2
|
if (!r.has(e))
|
|
5
|
-
throw TypeError("Cannot " +
|
|
3
|
+
throw TypeError("Cannot " + t);
|
|
6
4
|
};
|
|
7
|
-
var
|
|
5
|
+
var w = (e, r, t) => (G(e, r, "read from private field"), t ? t.call(e) : r.get(e)), z = (e, r, t) => {
|
|
8
6
|
if (r.has(e))
|
|
9
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
|
-
r instanceof WeakSet ? r.add(e) : r.set(e,
|
|
11
|
-
},
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
|
|
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) => {
|
|
13
|
+
if (e.toString() === "Invalid Date")
|
|
14
|
+
throw e;
|
|
15
|
+
const r = (n) => n < 10 ? "0" + n : n, t = (n) => {
|
|
16
|
+
if (n === 0)
|
|
17
|
+
return "Z";
|
|
18
|
+
const u = n > 0 ? "-" : "+";
|
|
19
|
+
return n = Math.abs(n), u + r(Math.floor(n / 60)) + ":" + r(n % 60);
|
|
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)}`
|
|
26
|
+
).join("&") : "";
|
|
27
|
+
}, _e = (e) => {
|
|
28
|
+
switch (e) {
|
|
29
|
+
case 1:
|
|
30
|
+
case 5:
|
|
31
|
+
return "ethereum";
|
|
32
|
+
case 100:
|
|
33
|
+
case 10200:
|
|
34
|
+
return "gnosis";
|
|
35
|
+
case 137:
|
|
36
|
+
case 80001:
|
|
37
|
+
return "polygon";
|
|
38
|
+
default:
|
|
39
|
+
throw new Error(`Chain not supported: ${e}`);
|
|
40
|
+
}
|
|
41
|
+
}, be = (e) => {
|
|
42
|
+
switch (e) {
|
|
43
|
+
case 1:
|
|
44
|
+
case 100:
|
|
45
|
+
case 137:
|
|
46
|
+
return "mainnet";
|
|
47
|
+
case 5:
|
|
48
|
+
return "goerli";
|
|
49
|
+
case 10200:
|
|
50
|
+
return "chiado";
|
|
51
|
+
case 80001:
|
|
52
|
+
return "mumbai";
|
|
53
|
+
default:
|
|
54
|
+
throw new Error(`Network not supported: ${e}`);
|
|
55
|
+
}
|
|
56
|
+
}, J = {
|
|
57
|
+
environments: {
|
|
58
|
+
production: {
|
|
59
|
+
api: "https://api.monerium.app",
|
|
60
|
+
web: "https://monerium.app",
|
|
61
|
+
wss: "wss://api.monerium.app"
|
|
62
|
+
},
|
|
63
|
+
sandbox: {
|
|
64
|
+
api: "https://api.monerium.dev",
|
|
65
|
+
web: "https://sandbox.monerium.dev",
|
|
66
|
+
wss: "wss://api.monerium.dev"
|
|
67
|
+
}
|
|
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
|
|
73
|
+
};
|
|
74
|
+
var L = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
75
|
+
function re(e) {
|
|
76
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
77
|
+
}
|
|
78
|
+
function ke(e) {
|
|
15
79
|
if (e.__esModule)
|
|
16
80
|
return e;
|
|
17
81
|
var r = e.default;
|
|
18
82
|
if (typeof r == "function") {
|
|
19
|
-
var
|
|
20
|
-
if (this instanceof
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
return new
|
|
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();
|
|
25
89
|
}
|
|
26
90
|
return r.apply(this, arguments);
|
|
27
91
|
};
|
|
28
|
-
|
|
92
|
+
t.prototype = r.prototype;
|
|
29
93
|
} else
|
|
30
|
-
|
|
31
|
-
return Object.defineProperty(
|
|
32
|
-
var
|
|
33
|
-
Object.defineProperty(
|
|
94
|
+
t = {};
|
|
95
|
+
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(n) {
|
|
96
|
+
var u = Object.getOwnPropertyDescriptor(e, n);
|
|
97
|
+
Object.defineProperty(t, n, u.get ? u : {
|
|
34
98
|
enumerable: !0,
|
|
35
99
|
get: function() {
|
|
36
|
-
return e[
|
|
100
|
+
return e[n];
|
|
37
101
|
}
|
|
38
102
|
});
|
|
39
|
-
}),
|
|
103
|
+
}), t;
|
|
40
104
|
}
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
return N;
|
|
44
|
-
},
|
|
45
|
-
set exports(e) {
|
|
46
|
-
N = e;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
function ce(e) {
|
|
105
|
+
var te = { exports: {} };
|
|
106
|
+
function Se(e) {
|
|
50
107
|
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
108
|
}
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
return W;
|
|
55
|
-
},
|
|
56
|
-
set exports(e) {
|
|
57
|
-
W = e;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const fe = {}, he = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
109
|
+
var Q = { exports: {} };
|
|
110
|
+
const Ce = {}, xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
61
111
|
__proto__: null,
|
|
62
|
-
default:
|
|
63
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
64
|
-
var
|
|
65
|
-
function
|
|
66
|
-
return
|
|
67
|
-
(function(
|
|
68
|
-
e.exports =
|
|
69
|
-
})(
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
if (typeof window < "u" && window.crypto && (
|
|
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) {
|
|
118
|
+
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")
|
|
73
123
|
try {
|
|
74
|
-
|
|
124
|
+
i = Ee;
|
|
75
125
|
} catch {
|
|
76
126
|
}
|
|
77
|
-
var
|
|
78
|
-
if (
|
|
79
|
-
if (typeof
|
|
127
|
+
var v = function() {
|
|
128
|
+
if (i) {
|
|
129
|
+
if (typeof i.getRandomValues == "function")
|
|
80
130
|
try {
|
|
81
|
-
return
|
|
131
|
+
return i.getRandomValues(new Uint32Array(1))[0];
|
|
82
132
|
} catch {
|
|
83
133
|
}
|
|
84
|
-
if (typeof
|
|
134
|
+
if (typeof i.randomBytes == "function")
|
|
85
135
|
try {
|
|
86
|
-
return
|
|
136
|
+
return i.randomBytes(4).readInt32LE();
|
|
87
137
|
} catch {
|
|
88
138
|
}
|
|
89
139
|
}
|
|
90
140
|
throw new Error("Native crypto module could not be used to get secure random number.");
|
|
91
|
-
},
|
|
92
|
-
function
|
|
141
|
+
}, k = Object.create || function() {
|
|
142
|
+
function o() {
|
|
93
143
|
}
|
|
94
|
-
return function(
|
|
95
|
-
var
|
|
96
|
-
return
|
|
144
|
+
return function(s) {
|
|
145
|
+
var c;
|
|
146
|
+
return o.prototype = s, c = new o(), o.prototype = null, c;
|
|
97
147
|
};
|
|
98
|
-
}(),
|
|
148
|
+
}(), p = {}, y = p.lib = {}, m = y.Base = function() {
|
|
99
149
|
return {
|
|
100
150
|
/**
|
|
101
151
|
* Creates a new object that inherits from this object.
|
|
@@ -115,11 +165,11 @@ function Z() {
|
|
|
115
165
|
* }
|
|
116
166
|
* });
|
|
117
167
|
*/
|
|
118
|
-
extend: function(
|
|
119
|
-
var
|
|
120
|
-
return
|
|
121
|
-
|
|
122
|
-
}),
|
|
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;
|
|
123
173
|
},
|
|
124
174
|
/**
|
|
125
175
|
* Extends this object and runs the init method.
|
|
@@ -134,8 +184,8 @@ function Z() {
|
|
|
134
184
|
* var instance = MyType.create();
|
|
135
185
|
*/
|
|
136
186
|
create: function() {
|
|
137
|
-
var
|
|
138
|
-
return
|
|
187
|
+
var o = this.extend();
|
|
188
|
+
return o.init.apply(o, arguments), o;
|
|
139
189
|
},
|
|
140
190
|
/**
|
|
141
191
|
* Initializes a newly created object.
|
|
@@ -162,10 +212,10 @@ function Z() {
|
|
|
162
212
|
* field: 'value'
|
|
163
213
|
* });
|
|
164
214
|
*/
|
|
165
|
-
mixIn: function(
|
|
166
|
-
for (var
|
|
167
|
-
|
|
168
|
-
|
|
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);
|
|
169
219
|
},
|
|
170
220
|
/**
|
|
171
221
|
* Creates a copy of this object.
|
|
@@ -180,7 +230,7 @@ function Z() {
|
|
|
180
230
|
return this.init.prototype.extend(this);
|
|
181
231
|
}
|
|
182
232
|
};
|
|
183
|
-
}(),
|
|
233
|
+
}(), g = y.WordArray = m.extend({
|
|
184
234
|
/**
|
|
185
235
|
* Initializes a newly created word array.
|
|
186
236
|
*
|
|
@@ -193,8 +243,8 @@ function Z() {
|
|
|
193
243
|
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
|
|
194
244
|
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
|
|
195
245
|
*/
|
|
196
|
-
init: function(
|
|
197
|
-
|
|
246
|
+
init: function(o, s) {
|
|
247
|
+
o = this.words = o || [], s != u ? this.sigBytes = s : this.sigBytes = o.length * 4;
|
|
198
248
|
},
|
|
199
249
|
/**
|
|
200
250
|
* Converts this word array to a string.
|
|
@@ -209,8 +259,8 @@ function Z() {
|
|
|
209
259
|
* var string = wordArray.toString();
|
|
210
260
|
* var string = wordArray.toString(CryptoJS.enc.Utf8);
|
|
211
261
|
*/
|
|
212
|
-
toString: function(
|
|
213
|
-
return (
|
|
262
|
+
toString: function(o) {
|
|
263
|
+
return (o || d).stringify(this);
|
|
214
264
|
},
|
|
215
265
|
/**
|
|
216
266
|
* Concatenates a word array to this word array.
|
|
@@ -223,17 +273,17 @@ function Z() {
|
|
|
223
273
|
*
|
|
224
274
|
* wordArray1.concat(wordArray2);
|
|
225
275
|
*/
|
|
226
|
-
concat: function(
|
|
227
|
-
var
|
|
228
|
-
if (this.clamp(),
|
|
229
|
-
for (var
|
|
230
|
-
var
|
|
231
|
-
|
|
276
|
+
concat: function(o) {
|
|
277
|
+
var s = this.words, c = o.words, h = this.sigBytes, _ = o.sigBytes;
|
|
278
|
+
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;
|
|
232
282
|
}
|
|
233
283
|
else
|
|
234
|
-
for (var
|
|
235
|
-
|
|
236
|
-
return this.sigBytes +=
|
|
284
|
+
for (var C = 0; C < _; C += 4)
|
|
285
|
+
s[h + C >>> 2] = c[C >>> 2];
|
|
286
|
+
return this.sigBytes += _, this;
|
|
237
287
|
},
|
|
238
288
|
/**
|
|
239
289
|
* Removes insignificant bits.
|
|
@@ -243,8 +293,8 @@ function Z() {
|
|
|
243
293
|
* wordArray.clamp();
|
|
244
294
|
*/
|
|
245
295
|
clamp: function() {
|
|
246
|
-
var
|
|
247
|
-
|
|
296
|
+
var o = this.words, s = this.sigBytes;
|
|
297
|
+
o[s >>> 2] &= 4294967295 << 32 - s % 4 * 8, o.length = n.ceil(s / 4);
|
|
248
298
|
},
|
|
249
299
|
/**
|
|
250
300
|
* Creates a copy of this word array.
|
|
@@ -256,8 +306,8 @@ function Z() {
|
|
|
256
306
|
* var clone = wordArray.clone();
|
|
257
307
|
*/
|
|
258
308
|
clone: function() {
|
|
259
|
-
var
|
|
260
|
-
return
|
|
309
|
+
var o = m.clone.call(this);
|
|
310
|
+
return o.words = this.words.slice(0), o;
|
|
261
311
|
},
|
|
262
312
|
/**
|
|
263
313
|
* Creates a word array filled with random bytes.
|
|
@@ -272,12 +322,12 @@ function Z() {
|
|
|
272
322
|
*
|
|
273
323
|
* var wordArray = CryptoJS.lib.WordArray.random(16);
|
|
274
324
|
*/
|
|
275
|
-
random: function(
|
|
276
|
-
for (var
|
|
277
|
-
|
|
278
|
-
return new
|
|
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);
|
|
279
329
|
}
|
|
280
|
-
}),
|
|
330
|
+
}), b = p.enc = {}, d = b.Hex = {
|
|
281
331
|
/**
|
|
282
332
|
* Converts a word array to a hex string.
|
|
283
333
|
*
|
|
@@ -291,12 +341,12 @@ function Z() {
|
|
|
291
341
|
*
|
|
292
342
|
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
|
|
293
343
|
*/
|
|
294
|
-
stringify: function(
|
|
295
|
-
for (var
|
|
296
|
-
var
|
|
297
|
-
|
|
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));
|
|
298
348
|
}
|
|
299
|
-
return
|
|
349
|
+
return h.join("");
|
|
300
350
|
},
|
|
301
351
|
/**
|
|
302
352
|
* Converts a hex string to a word array.
|
|
@@ -311,12 +361,12 @@ function Z() {
|
|
|
311
361
|
*
|
|
312
362
|
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
|
|
313
363
|
*/
|
|
314
|
-
parse: function(
|
|
315
|
-
for (var
|
|
316
|
-
|
|
317
|
-
return new
|
|
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);
|
|
318
368
|
}
|
|
319
|
-
},
|
|
369
|
+
}, l = b.Latin1 = {
|
|
320
370
|
/**
|
|
321
371
|
* Converts a word array to a Latin1 string.
|
|
322
372
|
*
|
|
@@ -330,12 +380,12 @@ function Z() {
|
|
|
330
380
|
*
|
|
331
381
|
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
|
|
332
382
|
*/
|
|
333
|
-
stringify: function(
|
|
334
|
-
for (var
|
|
335
|
-
var
|
|
336
|
-
|
|
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));
|
|
337
387
|
}
|
|
338
|
-
return
|
|
388
|
+
return h.join("");
|
|
339
389
|
},
|
|
340
390
|
/**
|
|
341
391
|
* Converts a Latin1 string to a word array.
|
|
@@ -350,12 +400,12 @@ function Z() {
|
|
|
350
400
|
*
|
|
351
401
|
* var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
|
|
352
402
|
*/
|
|
353
|
-
parse: function(
|
|
354
|
-
for (var
|
|
355
|
-
|
|
356
|
-
return new
|
|
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);
|
|
357
407
|
}
|
|
358
|
-
},
|
|
408
|
+
}, a = b.Utf8 = {
|
|
359
409
|
/**
|
|
360
410
|
* Converts a word array to a UTF-8 string.
|
|
361
411
|
*
|
|
@@ -369,9 +419,9 @@ function Z() {
|
|
|
369
419
|
*
|
|
370
420
|
* var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
|
|
371
421
|
*/
|
|
372
|
-
stringify: function(
|
|
422
|
+
stringify: function(o) {
|
|
373
423
|
try {
|
|
374
|
-
return decodeURIComponent(escape(
|
|
424
|
+
return decodeURIComponent(escape(l.stringify(o)));
|
|
375
425
|
} catch {
|
|
376
426
|
throw new Error("Malformed UTF-8 data");
|
|
377
427
|
}
|
|
@@ -389,10 +439,10 @@ function Z() {
|
|
|
389
439
|
*
|
|
390
440
|
* var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
|
|
391
441
|
*/
|
|
392
|
-
parse: function(
|
|
393
|
-
return
|
|
442
|
+
parse: function(o) {
|
|
443
|
+
return l.parse(unescape(encodeURIComponent(o)));
|
|
394
444
|
}
|
|
395
|
-
}, f =
|
|
445
|
+
}, f = y.BufferedBlockAlgorithm = m.extend({
|
|
396
446
|
/**
|
|
397
447
|
* Resets this block algorithm's data buffer to its initial state.
|
|
398
448
|
*
|
|
@@ -401,7 +451,7 @@ function Z() {
|
|
|
401
451
|
* bufferedBlockAlgorithm.reset();
|
|
402
452
|
*/
|
|
403
453
|
reset: function() {
|
|
404
|
-
this._data = new
|
|
454
|
+
this._data = new g.init(), this._nDataBytes = 0;
|
|
405
455
|
},
|
|
406
456
|
/**
|
|
407
457
|
* Adds new data to this block algorithm's buffer.
|
|
@@ -413,8 +463,8 @@ function Z() {
|
|
|
413
463
|
* bufferedBlockAlgorithm._append('data');
|
|
414
464
|
* bufferedBlockAlgorithm._append(wordArray);
|
|
415
465
|
*/
|
|
416
|
-
_append: function(
|
|
417
|
-
typeof
|
|
466
|
+
_append: function(o) {
|
|
467
|
+
typeof o == "string" && (o = a.parse(o)), this._data.concat(o), this._nDataBytes += o.sigBytes;
|
|
418
468
|
},
|
|
419
469
|
/**
|
|
420
470
|
* Processes available data blocks.
|
|
@@ -430,16 +480,16 @@ function Z() {
|
|
|
430
480
|
* var processedData = bufferedBlockAlgorithm._process();
|
|
431
481
|
* var processedData = bufferedBlockAlgorithm._process(!!'flush');
|
|
432
482
|
*/
|
|
433
|
-
_process: function(
|
|
434
|
-
var
|
|
435
|
-
|
|
436
|
-
var
|
|
437
|
-
if (
|
|
438
|
-
for (var
|
|
439
|
-
this._doProcessBlock(
|
|
440
|
-
|
|
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;
|
|
441
491
|
}
|
|
442
|
-
return new
|
|
492
|
+
return new g.init(s, H);
|
|
443
493
|
},
|
|
444
494
|
/**
|
|
445
495
|
* Creates a copy of this object.
|
|
@@ -451,16 +501,16 @@ function Z() {
|
|
|
451
501
|
* var clone = bufferedBlockAlgorithm.clone();
|
|
452
502
|
*/
|
|
453
503
|
clone: function() {
|
|
454
|
-
var
|
|
455
|
-
return
|
|
504
|
+
var o = m.clone.call(this);
|
|
505
|
+
return o._data = this._data.clone(), o;
|
|
456
506
|
},
|
|
457
507
|
_minBufferSize: 0
|
|
458
508
|
});
|
|
459
|
-
|
|
509
|
+
y.Hasher = f.extend({
|
|
460
510
|
/**
|
|
461
511
|
* Configuration options.
|
|
462
512
|
*/
|
|
463
|
-
cfg:
|
|
513
|
+
cfg: m.extend(),
|
|
464
514
|
/**
|
|
465
515
|
* Initializes a newly created hasher.
|
|
466
516
|
*
|
|
@@ -470,8 +520,8 @@ function Z() {
|
|
|
470
520
|
*
|
|
471
521
|
* var hasher = CryptoJS.algo.SHA256.create();
|
|
472
522
|
*/
|
|
473
|
-
init: function(
|
|
474
|
-
this.cfg = this.cfg.extend(
|
|
523
|
+
init: function(o) {
|
|
524
|
+
this.cfg = this.cfg.extend(o), this.reset();
|
|
475
525
|
},
|
|
476
526
|
/**
|
|
477
527
|
* Resets this hasher to its initial state.
|
|
@@ -495,8 +545,8 @@ function Z() {
|
|
|
495
545
|
* hasher.update('message');
|
|
496
546
|
* hasher.update(wordArray);
|
|
497
547
|
*/
|
|
498
|
-
update: function(
|
|
499
|
-
return this._append(
|
|
548
|
+
update: function(o) {
|
|
549
|
+
return this._append(o), this._process(), this;
|
|
500
550
|
},
|
|
501
551
|
/**
|
|
502
552
|
* Finalizes the hash computation.
|
|
@@ -512,10 +562,10 @@ function Z() {
|
|
|
512
562
|
* var hash = hasher.finalize('message');
|
|
513
563
|
* var hash = hasher.finalize(wordArray);
|
|
514
564
|
*/
|
|
515
|
-
finalize: function(
|
|
516
|
-
|
|
517
|
-
var
|
|
518
|
-
return
|
|
565
|
+
finalize: function(o) {
|
|
566
|
+
o && this._append(o);
|
|
567
|
+
var s = this._doFinalize();
|
|
568
|
+
return s;
|
|
519
569
|
},
|
|
520
570
|
blockSize: 16,
|
|
521
571
|
/**
|
|
@@ -531,9 +581,9 @@ function Z() {
|
|
|
531
581
|
*
|
|
532
582
|
* var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
|
|
533
583
|
*/
|
|
534
|
-
_createHelper: function(
|
|
535
|
-
return function(
|
|
536
|
-
return new
|
|
584
|
+
_createHelper: function(o) {
|
|
585
|
+
return function(s, c) {
|
|
586
|
+
return new o.init(c).finalize(s);
|
|
537
587
|
};
|
|
538
588
|
},
|
|
539
589
|
/**
|
|
@@ -549,26 +599,26 @@ function Z() {
|
|
|
549
599
|
*
|
|
550
600
|
* var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
|
|
551
601
|
*/
|
|
552
|
-
_createHmacHelper: function(
|
|
553
|
-
return function(
|
|
554
|
-
return new x.HMAC.init(
|
|
602
|
+
_createHmacHelper: function(o) {
|
|
603
|
+
return function(s, c) {
|
|
604
|
+
return new x.HMAC.init(o, c).finalize(s);
|
|
555
605
|
};
|
|
556
606
|
}
|
|
557
607
|
});
|
|
558
|
-
var x =
|
|
559
|
-
return
|
|
608
|
+
var x = p.algo = {};
|
|
609
|
+
return p;
|
|
560
610
|
}(Math);
|
|
561
|
-
return
|
|
611
|
+
return t;
|
|
562
612
|
});
|
|
563
|
-
}(
|
|
613
|
+
}(Q)), Q.exports;
|
|
564
614
|
}
|
|
565
615
|
(function(e, r) {
|
|
566
|
-
(function(
|
|
567
|
-
e.exports =
|
|
568
|
-
})(
|
|
616
|
+
(function(t, n) {
|
|
617
|
+
e.exports = n(ne());
|
|
618
|
+
})(L, function(t) {
|
|
569
619
|
return function() {
|
|
570
|
-
var
|
|
571
|
-
|
|
620
|
+
var n = t, u = n.lib, i = u.WordArray, v = n.enc;
|
|
621
|
+
v.Base64url = {
|
|
572
622
|
/**
|
|
573
623
|
* Converts a word array to a Base64url string.
|
|
574
624
|
*
|
|
@@ -584,17 +634,18 @@ function Z() {
|
|
|
584
634
|
*
|
|
585
635
|
* var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
|
|
586
636
|
*/
|
|
587
|
-
stringify: function(
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
637
|
+
stringify: function(p, y) {
|
|
638
|
+
y === void 0 && (y = !0);
|
|
639
|
+
var m = p.words, g = p.sigBytes, b = y ? this._safe_map : this._map;
|
|
640
|
+
p.clamp();
|
|
641
|
+
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)
|
|
646
|
+
for (; d.length % 4; )
|
|
647
|
+
d.push(c);
|
|
648
|
+
return d.join("");
|
|
598
649
|
},
|
|
599
650
|
/**
|
|
600
651
|
* Converts a Base64url string to a word array.
|
|
@@ -611,267 +662,394 @@ function Z() {
|
|
|
611
662
|
*
|
|
612
663
|
* var wordArray = CryptoJS.enc.Base64url.parse(base64String);
|
|
613
664
|
*/
|
|
614
|
-
parse: function(
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
665
|
+
parse: function(p, y) {
|
|
666
|
+
y === void 0 && (y = !0);
|
|
667
|
+
var m = p.length, g = y ? this._safe_map : this._map, b = this._reverseMap;
|
|
668
|
+
if (!b) {
|
|
669
|
+
b = this._reverseMap = [];
|
|
670
|
+
for (var d = 0; d < g.length; d++)
|
|
671
|
+
b[g.charCodeAt(d)] = d;
|
|
620
672
|
}
|
|
621
|
-
var
|
|
622
|
-
if (
|
|
623
|
-
var
|
|
624
|
-
|
|
673
|
+
var l = g.charAt(64);
|
|
674
|
+
if (l) {
|
|
675
|
+
var a = p.indexOf(l);
|
|
676
|
+
a !== -1 && (m = a);
|
|
625
677
|
}
|
|
626
|
-
return
|
|
678
|
+
return k(p, m, b);
|
|
627
679
|
},
|
|
628
680
|
_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
629
681
|
_safe_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
|
|
630
682
|
};
|
|
631
|
-
function
|
|
632
|
-
for (var
|
|
633
|
-
if (
|
|
634
|
-
var
|
|
635
|
-
|
|
683
|
+
function k(p, y, m) {
|
|
684
|
+
for (var g = [], b = 0, d = 0; d < y; d++)
|
|
685
|
+
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;
|
|
687
|
+
g[b >>> 2] |= f << 24 - b % 4 * 8, b++;
|
|
636
688
|
}
|
|
637
|
-
return
|
|
689
|
+
return i.create(g, b);
|
|
638
690
|
}
|
|
639
|
-
}(),
|
|
691
|
+
}(), t.enc.Base64url;
|
|
640
692
|
});
|
|
641
|
-
})(
|
|
642
|
-
var
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
},
|
|
646
|
-
set exports(e) {
|
|
647
|
-
V = e;
|
|
648
|
-
}
|
|
649
|
-
};
|
|
693
|
+
})(te);
|
|
694
|
+
var Ae = te.exports;
|
|
695
|
+
const Ie = /* @__PURE__ */ re(Ae);
|
|
696
|
+
var oe = { exports: {} };
|
|
650
697
|
(function(e, r) {
|
|
651
|
-
(function(
|
|
652
|
-
e.exports =
|
|
653
|
-
})(
|
|
654
|
-
return function(
|
|
655
|
-
var
|
|
698
|
+
(function(t, n) {
|
|
699
|
+
e.exports = n(ne());
|
|
700
|
+
})(L, function(t) {
|
|
701
|
+
return function(n) {
|
|
702
|
+
var u = t, i = u.lib, v = i.WordArray, k = i.Hasher, p = u.algo, y = [], m = [];
|
|
656
703
|
(function() {
|
|
657
|
-
function
|
|
658
|
-
for (var
|
|
659
|
-
if (!(x %
|
|
704
|
+
function d(x) {
|
|
705
|
+
for (var o = n.sqrt(x), s = 2; s <= o; s++)
|
|
706
|
+
if (!(x % s))
|
|
660
707
|
return !1;
|
|
661
708
|
return !0;
|
|
662
709
|
}
|
|
663
|
-
function
|
|
710
|
+
function l(x) {
|
|
664
711
|
return (x - (x | 0)) * 4294967296 | 0;
|
|
665
712
|
}
|
|
666
|
-
for (var
|
|
667
|
-
|
|
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++;
|
|
668
715
|
})();
|
|
669
|
-
var
|
|
716
|
+
var g = [], b = p.SHA256 = k.extend({
|
|
670
717
|
_doReset: function() {
|
|
671
|
-
this._hash = new
|
|
718
|
+
this._hash = new v.init(y.slice(0));
|
|
672
719
|
},
|
|
673
|
-
_doProcessBlock: function(
|
|
674
|
-
for (var
|
|
675
|
-
if (
|
|
676
|
-
|
|
720
|
+
_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;
|
|
677
724
|
else {
|
|
678
|
-
var
|
|
679
|
-
|
|
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];
|
|
680
727
|
}
|
|
681
|
-
var
|
|
682
|
-
|
|
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;
|
|
683
730
|
}
|
|
684
|
-
|
|
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;
|
|
685
732
|
},
|
|
686
733
|
_doFinalize: function() {
|
|
687
|
-
var
|
|
688
|
-
return
|
|
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;
|
|
689
736
|
},
|
|
690
737
|
clone: function() {
|
|
691
|
-
var
|
|
692
|
-
return
|
|
738
|
+
var d = k.clone.call(this);
|
|
739
|
+
return d._hash = this._hash.clone(), d;
|
|
693
740
|
}
|
|
694
741
|
});
|
|
695
|
-
|
|
696
|
-
}(Math),
|
|
742
|
+
u.SHA256 = k._createHelper(b), u.HmacSHA256 = k._createHmacHelper(b);
|
|
743
|
+
}(Math), t.SHA256;
|
|
744
|
+
});
|
|
745
|
+
})(oe);
|
|
746
|
+
var Re = oe.exports;
|
|
747
|
+
const $e = /* @__PURE__ */ re(Re), Te = (e, r) => {
|
|
748
|
+
const {
|
|
749
|
+
client_id: t,
|
|
750
|
+
redirect_uri: n,
|
|
751
|
+
scope: u,
|
|
752
|
+
state: i,
|
|
753
|
+
chainId: v,
|
|
754
|
+
chain: k,
|
|
755
|
+
network: p,
|
|
756
|
+
address: y,
|
|
757
|
+
signature: m
|
|
758
|
+
} = e, g = y ? {
|
|
759
|
+
address: y,
|
|
760
|
+
...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 } : {}
|
|
763
|
+
} : {};
|
|
764
|
+
return D({
|
|
765
|
+
client_id: t,
|
|
766
|
+
redirect_uri: n,
|
|
767
|
+
...u !== void 0 ? { scope: u } : {},
|
|
768
|
+
...i !== void 0 ? { state: i } : {},
|
|
769
|
+
code_challenge: r,
|
|
770
|
+
code_challenge_method: "S256",
|
|
771
|
+
response_type: "code",
|
|
772
|
+
...g
|
|
697
773
|
});
|
|
698
|
-
}
|
|
699
|
-
const de = () => {
|
|
774
|
+
}, ze = () => {
|
|
700
775
|
let e = "";
|
|
701
|
-
const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
|
702
|
-
let
|
|
703
|
-
for (;
|
|
704
|
-
e += r.charAt(Math.floor(Math.random() *
|
|
776
|
+
const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", t = r.length;
|
|
777
|
+
let n = 0;
|
|
778
|
+
for (; n < 128; )
|
|
779
|
+
e += r.charAt(Math.floor(Math.random() * t)), n += 1;
|
|
705
780
|
return e;
|
|
706
|
-
},
|
|
707
|
-
const
|
|
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) => {
|
|
788
|
+
const u = await fetch(`${e}`, {
|
|
708
789
|
method: r,
|
|
709
|
-
headers:
|
|
710
|
-
body:
|
|
790
|
+
headers: n,
|
|
791
|
+
body: t
|
|
711
792
|
});
|
|
712
|
-
let
|
|
713
|
-
const
|
|
793
|
+
let i;
|
|
794
|
+
const v = await u.text();
|
|
714
795
|
try {
|
|
715
|
-
|
|
796
|
+
i = JSON.parse(v);
|
|
716
797
|
} catch {
|
|
717
|
-
throw
|
|
718
|
-
}
|
|
719
|
-
if (!p.ok)
|
|
720
|
-
throw l;
|
|
721
|
-
return l;
|
|
722
|
-
}, ge = (e) => {
|
|
723
|
-
if (e.toString() === "Invalid Date")
|
|
724
|
-
throw e;
|
|
725
|
-
const r = (i) => i < 10 ? "0" + i : i, n = (i) => {
|
|
726
|
-
if (i === 0)
|
|
727
|
-
return "Z";
|
|
728
|
-
const p = i > 0 ? "-" : "+";
|
|
729
|
-
return i = Math.abs(i), p + r(Math.floor(i / 60)) + ":" + r(i % 60);
|
|
730
|
-
};
|
|
731
|
-
return e.getFullYear() + "-" + r(e.getMonth() + 1) + "-" + r(e.getDate()) + "T" + r(e.getHours()) + ":" + r(e.getMinutes()) + ":" + r(e.getSeconds()) + n(e.getTimezoneOffset());
|
|
732
|
-
}, He = (e, r) => `Send EUR ${e} to ${r} at ${ge(/* @__PURE__ */ new Date())}`, T = (e) => {
|
|
733
|
-
var r;
|
|
734
|
-
return e && ((r = Object.entries(e)) == null ? void 0 : r.length) > 0 ? Object.entries(e).map(
|
|
735
|
-
([n, i]) => `${encodeURIComponent(n)}=${encodeURIComponent(i)}`
|
|
736
|
-
).join("&") : "";
|
|
737
|
-
}, ye = {
|
|
738
|
-
environments: {
|
|
739
|
-
production: {
|
|
740
|
-
api: "https://api.monerium.app",
|
|
741
|
-
web: "https://monerium.app"
|
|
742
|
-
},
|
|
743
|
-
sandbox: {
|
|
744
|
-
api: "https://api.monerium.dev",
|
|
745
|
-
web: "https://sandbox.monerium.dev"
|
|
746
|
-
}
|
|
798
|
+
throw v;
|
|
747
799
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
800
|
+
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) {
|
|
752
807
|
// -- Helper Methods
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
808
|
+
z(this, E);
|
|
809
|
+
z(this, $, void 0);
|
|
810
|
+
z(this, F, void 0);
|
|
811
|
+
/** 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)
|
|
821
|
+
throw new Error("Code verifier not found");
|
|
822
|
+
return this.codeVerifier = i, sessionStorage.removeItem(P), await this.getBearerToken({
|
|
823
|
+
code: u,
|
|
824
|
+
redirect_uri: n,
|
|
825
|
+
client_id: t,
|
|
826
|
+
code_verifier: i
|
|
827
|
+
});
|
|
828
|
+
}), A(this, N, async ({
|
|
829
|
+
clientId: t,
|
|
830
|
+
clientSecret: n
|
|
831
|
+
}) => await this.getBearerToken({
|
|
832
|
+
client_id: t,
|
|
833
|
+
client_secret: n
|
|
834
|
+
})), A(this, W, async (t, n) => await this.getBearerToken({
|
|
835
|
+
refresh_token: n,
|
|
836
|
+
client_id: t
|
|
837
|
+
})), 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);
|
|
840
|
+
return n.addEventListener("open", () => {
|
|
841
|
+
console.info(`Socket connected: ${t}`);
|
|
842
|
+
}), n.addEventListener("error", (v) => {
|
|
843
|
+
throw console.error(v), new Error(`Socket error: ${t}`);
|
|
844
|
+
}), n.addEventListener("message", (v) => {
|
|
845
|
+
var p;
|
|
846
|
+
const k = JSON.parse(v.data);
|
|
847
|
+
(p = w(this, U).get(k.meta.state)) == null || p(
|
|
848
|
+
k
|
|
849
|
+
);
|
|
850
|
+
}), n.addEventListener("close", () => {
|
|
851
|
+
console.info(`Socket connection closed: ${t}`);
|
|
852
|
+
}), 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);
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
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,
|
|
866
|
+
clientSecret: n
|
|
867
|
+
});
|
|
868
|
+
} else {
|
|
869
|
+
const { clientId: t, redirectUrl: n } = r;
|
|
870
|
+
A(this, T, {
|
|
871
|
+
clientId: t,
|
|
872
|
+
redirectUrl: n
|
|
873
|
+
});
|
|
874
|
+
}
|
|
780
875
|
}
|
|
781
876
|
/**
|
|
782
877
|
* Construct the url to the authorization code flow,
|
|
783
|
-
*
|
|
784
|
-
* For automatic wallet link, add the following properties: `address`, `signature
|
|
878
|
+
* Code Verifier needed for the code challenge is stored in session storage
|
|
879
|
+
* For automatic wallet link, add the following properties: `address`, `signature` & `chainId`
|
|
785
880
|
* @returns string
|
|
881
|
+
* {@link https://monerium.dev/api-docs#operation/auth}
|
|
786
882
|
*/
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
const n =
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
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)
|
|
887
|
+
throw new Error("Missing ClientId");
|
|
888
|
+
if (!n)
|
|
889
|
+
throw new Error("Missing RedirectUrl");
|
|
890
|
+
const u = Y(w(this, $).api, {
|
|
891
|
+
client_id: t,
|
|
892
|
+
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
|
|
896
|
+
});
|
|
897
|
+
window.location.replace(u);
|
|
898
|
+
}
|
|
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)
|
|
904
|
+
throw new Error("Only use client credentials on server side");
|
|
905
|
+
return await w(this, N).call(this, w(this, T)), !!this.bearerProfile;
|
|
906
|
+
}
|
|
907
|
+
const u = (r == null ? void 0 : r.redirectUrl) || ((y = w(this, T)) == null ? void 0 : y.redirectUrl);
|
|
908
|
+
if (!t)
|
|
909
|
+
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;
|
|
799
937
|
}
|
|
800
938
|
// -- Read Methods
|
|
939
|
+
/**
|
|
940
|
+
* {@link https://monerium.dev/api-docs#operation/auth-context}
|
|
941
|
+
*/
|
|
801
942
|
getAuthContext() {
|
|
802
|
-
return
|
|
943
|
+
return I(this, E, R).call(this, "get", "auth/context");
|
|
803
944
|
}
|
|
804
945
|
/**
|
|
805
|
-
|
|
806
|
-
|
|
946
|
+
* {@link https://monerium.dev/api-docs#operation/profile}
|
|
947
|
+
* @param {string} profileId - the id of the profile to fetch.
|
|
948
|
+
|
|
949
|
+
*/
|
|
807
950
|
getProfile(r) {
|
|
808
|
-
return
|
|
951
|
+
return I(this, E, R).call(this, "get", `profiles/${r}`);
|
|
809
952
|
}
|
|
810
953
|
/**
|
|
954
|
+
* {@link https://monerium.dev/api-docs#operation/profile-balances}
|
|
811
955
|
* @param {string=} profileId - the id of the profile to fetch balances.
|
|
812
956
|
*/
|
|
813
957
|
getBalances(r) {
|
|
814
|
-
return r ?
|
|
958
|
+
return r ? I(this, E, R).call(this, "get", `profiles/${r}/balances`) : I(this, E, R).call(this, "get", "balances");
|
|
815
959
|
}
|
|
960
|
+
/**
|
|
961
|
+
* {@link https://monerium.dev/api-docs#operation/orders}
|
|
962
|
+
*/
|
|
816
963
|
getOrders(r) {
|
|
817
|
-
const
|
|
818
|
-
return
|
|
964
|
+
const t = D(r);
|
|
965
|
+
return I(this, E, R).call(this, "get", `orders?${t}`);
|
|
819
966
|
}
|
|
967
|
+
/**
|
|
968
|
+
* {@link https://monerium.dev/api-docs#operation/order}
|
|
969
|
+
*/
|
|
820
970
|
getOrder(r) {
|
|
821
|
-
return
|
|
971
|
+
return I(this, E, R).call(this, "get", `orders/${r}`);
|
|
822
972
|
}
|
|
973
|
+
/**
|
|
974
|
+
* {@link https://monerium.dev/api-docs#operation/tokens}
|
|
975
|
+
*/
|
|
823
976
|
getTokens() {
|
|
824
|
-
return
|
|
977
|
+
return I(this, E, R).call(this, "get", "tokens");
|
|
825
978
|
}
|
|
826
979
|
// -- Write Methods
|
|
827
|
-
|
|
828
|
-
|
|
980
|
+
/**
|
|
981
|
+
* {@link https://monerium.dev/api-docs#operation/profile-addresses}
|
|
982
|
+
*/
|
|
983
|
+
linkAddress(r, t) {
|
|
984
|
+
return I(this, E, R).call(this, "post", `profiles/${r}/addresses`, JSON.stringify(t));
|
|
829
985
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
986
|
+
/**
|
|
987
|
+
* {@link https://monerium.dev/api-docs#operation/post-orders}
|
|
988
|
+
*/
|
|
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));
|
|
833
992
|
}
|
|
993
|
+
/**
|
|
994
|
+
* {@link https://monerium.dev/api-docs#operation/supporting-document}
|
|
995
|
+
*/
|
|
834
996
|
uploadSupportingDocument(r) {
|
|
835
|
-
const
|
|
997
|
+
const t = D(
|
|
836
998
|
r
|
|
837
999
|
);
|
|
838
|
-
return
|
|
1000
|
+
return I(this, E, R).call(this, "post", "files/supporting-document", t, !0);
|
|
1001
|
+
}
|
|
1002
|
+
// -- Notifications
|
|
1003
|
+
async connectOrderSocket() {
|
|
1004
|
+
var r;
|
|
1005
|
+
(r = this.bearerProfile) != null && r.access_token && w(this, U).size > 0 && A(this, O, this.subscribeToOrderNotifications());
|
|
1006
|
+
}
|
|
1007
|
+
async disconnect() {
|
|
1008
|
+
var r;
|
|
1009
|
+
sessionStorage.removeItem(P), w(this, U).clear(), (r = w(this, O)) == null || r.close();
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Subscribe to MoneriumEvent to receive notifications using the Monerium API (WebSocket)
|
|
1013
|
+
* We are setting a subscription map because we need the user to have a token to start the WebSocket connection
|
|
1014
|
+
* {@link https://monerium.dev/api-docs#operation/profile-orders-notifications}
|
|
1015
|
+
* @param event The event to subscribe to
|
|
1016
|
+
* @param handler The handler to be called when the event is triggered
|
|
1017
|
+
*/
|
|
1018
|
+
subscribeOrders(r, t) {
|
|
1019
|
+
w(this, U).set(r, t);
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Unsubscribe from MoneriumEvent and close the socket if there are no more subscriptions
|
|
1023
|
+
* @param event The event to unsubscribe from
|
|
1024
|
+
*/
|
|
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));
|
|
839
1028
|
}
|
|
840
1029
|
}
|
|
841
|
-
|
|
842
|
-
return
|
|
843
|
-
`${
|
|
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}`,
|
|
844
1033
|
r,
|
|
845
|
-
|
|
1034
|
+
u ? D(n) : n,
|
|
846
1035
|
{
|
|
847
|
-
Authorization:
|
|
848
|
-
"Content-Type": `application/${
|
|
1036
|
+
Authorization: w(this, F) || "",
|
|
1037
|
+
"Content-Type": `application/${u ? "x-www-form-urlencoded" : "json"}`
|
|
849
1038
|
}
|
|
850
1039
|
);
|
|
851
|
-
}, j = new
|
|
852
|
-
return r.code != null;
|
|
853
|
-
}, U = new WeakSet(), X = function(r) {
|
|
854
|
-
return r.refresh_token != null;
|
|
855
|
-
}, L = new WeakSet(), K = function(r) {
|
|
856
|
-
return r.client_secret != null;
|
|
857
|
-
};
|
|
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 || {});
|
|
1040
|
+
}, j = new WeakMap(), N = new WeakMap(), W = new WeakMap();
|
|
862
1041
|
export {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
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
|
|
876
1055
|
};
|
|
877
|
-
//# sourceMappingURL=index.mjs.map
|