@notabene/javascript-sdk 2.14.0 → 2.14.1-next.1
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/README.md +4 -4
- package/dist/cjs/notabene.cjs +1 -1
- package/dist/cjs/notabene.d.ts +74 -51
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +74 -51
- package/dist/esm/notabene.js +316 -282
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +74 -51
- package/dist/notabene.js +316 -282
- package/package.json +1 -1
- package/src/responseTransformer/__tests__/transformer.test.ts +597 -0
- package/src/responseTransformer/mappers.ts +86 -24
- package/src/responseTransformer/transformer.ts +121 -73
- package/src/responseTransformer/types.ts +11 -1
- package/src/responseTransformer/utils.ts +13 -0
- package/src/types.ts +1 -3
package/dist/esm/notabene.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (e, t,
|
|
4
|
-
var
|
|
5
|
-
class
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var U = (e, t, r) => t in e ? D(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var c = (e, t, r) => U(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
var x = /* @__PURE__ */ ((e) => (e.PRIVATE = "WALLET", e.VASP = "VASP", e))(x || {}), p = /* @__PURE__ */ ((e) => (e.NATURAL = "natural", e.LEGAL = "legal", e.SELF = "self", e))(p || {}), M = /* @__PURE__ */ ((e) => (e.EMPTY = "empty", e.VERIFY = "verify", e.PENDING = "pending", e.VERIFIED = "verified", e.BANNED = "banned", e))(M || {}), V = /* @__PURE__ */ ((e) => (e.ALLOWED = "allowed", e.PENDING = "pending", e))(V || {}), W = /* @__PURE__ */ ((e) => (e.SMS = "sms", e.EMAIL = "email", e))(W || {}), k = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.APPROVED = "approved", e.FAILED = "failed", e.EXPIRED = "expired", e.MAX_ATTEMPTS_REACHED = "max_attempts_reached", e.UNREACHABLE = "unreachable", e))(k || {}), B = /* @__PURE__ */ ((e) => (e.COINBASE = "coinbase", e))(B || {}), F = /* @__PURE__ */ ((e) => (e.ASSET = "asset", e.DESTINATION = "destination", e.COUNTERPARTY = "counterparty", e.AGENT = "agent", e))(F || {}), u = /* @__PURE__ */ ((e) => (e.COMPLETE = "complete", e.RESIZE = "resize", e.RESULT = "result", e.READY = "ready", e.INVALID = "invalid", e.ERROR = "error", e.CANCEL = "cancel", e.WARNING = "warning", e.INFO = "info", e))(u || {}), J = /* @__PURE__ */ ((e) => (e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.WALLET_CONNECTION_FAILED = "WALLET_CONNECTION_FAILED", e.WALLET_NOT_SUPPORTED = "WALLET_NOT_SUPPORTED", e.TOKEN_INVALID = "TOKEN_INVALID", e))(J || {}), $ = /* @__PURE__ */ ((e) => (e.WALLET_ADDRESS_NOT_CONNECTED = "WALLET_ADDRESS_NOT_CONNECTED", e.WALLET_LOCKED = "WALLET_LOCKED", e.WALLET_UNREACHABLE = "WALLET_UNREACHABLE", e.JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE = "JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE", e.IDV_UNAVAILABLE = "IDV_UNAVAILABLE", e))($ || {}), S = /* @__PURE__ */ ((e) => (e.UPDATE = "update", e.REQUEST_RESPONSE = "requestResponse", e))(S || {}), j = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.FAILED = "rejected", e.FLAGGED = "flagged", e.VERIFIED = "verified", e))(j || {}), G = /* @__PURE__ */ ((e) => (e.SelfDeclaration = "self-declaration", e.SIWE = "siwe", e.SIWX = "siwx", e.SOL_SIWX = "sol-siwx", e.EIP191 = "eip-191", e.EIP712 = "eip-712", e.EIP1271 = "eip-1271", e.BIP137 = "bip-137", e.BIP322 = "bip-322", e.TIP191 = "tip-191", e.ED25519 = "ed25519", e.XRP_ED25519 = "xrp-ed25519", e.XLM_ED25519 = "xlm-ed25519", e.CIP8 = "cip-8", e.COSMOS = "cosmos-ecdsa", e.MicroTransfer = "microtransfer", e.Screenshot = "screenshot", e.Connect = "connect", e.CONCORDIUM = "concordium", e))(G || {});
|
|
5
|
+
class q {
|
|
6
6
|
constructor() {
|
|
7
7
|
c(this, "listeners", /* @__PURE__ */ new Map());
|
|
8
8
|
c(this, "port");
|
|
@@ -29,8 +29,8 @@ class k {
|
|
|
29
29
|
* @param callback - The callback function to execute when matching messages are received
|
|
30
30
|
|
|
31
31
|
*/
|
|
32
|
-
on(t,
|
|
33
|
-
return this.listeners.has(t) || this.listeners.set(t, /* @__PURE__ */ new Set()), this.listeners.get(t).add(
|
|
32
|
+
on(t, r) {
|
|
33
|
+
return this.listeners.has(t) || this.listeners.set(t, /* @__PURE__ */ new Set()), this.listeners.get(t).add(r), () => this.off(t, r);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Removes a callback for a specific message type.
|
|
@@ -41,9 +41,9 @@ class k {
|
|
|
41
41
|
* @param messageType - The type of message to remove listener from
|
|
42
42
|
* @param callback - The callback function to remove
|
|
43
43
|
*/
|
|
44
|
-
off(t,
|
|
45
|
-
const
|
|
46
|
-
|
|
44
|
+
off(t, r) {
|
|
45
|
+
const n = this.listeners.get(t);
|
|
46
|
+
n && (n.delete(r), n.size === 0 && this.listeners.delete(t));
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Internal message handler for processing received messages.
|
|
@@ -54,10 +54,10 @@ class k {
|
|
|
54
54
|
* @param event - The message event containing the component message
|
|
55
55
|
*/
|
|
56
56
|
handleMessage(t) {
|
|
57
|
-
const
|
|
58
|
-
if (typeof
|
|
59
|
-
const
|
|
60
|
-
i && i.forEach((o) => o(
|
|
57
|
+
const r = t.data;
|
|
58
|
+
if (typeof r == "object" && r !== null && "type" in r) {
|
|
59
|
+
const n = r.type, i = this.listeners.get(n);
|
|
60
|
+
i && i.forEach((o) => o(r));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
@@ -68,13 +68,13 @@ class k {
|
|
|
68
68
|
this.port && this.port.postMessage(t);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
class
|
|
71
|
+
class K {
|
|
72
72
|
/**
|
|
73
73
|
* Creates an instance of EmbeddedComponent.
|
|
74
74
|
* @param url - The URL of the embedded component
|
|
75
75
|
* @param value - The initial transaction value
|
|
76
76
|
*/
|
|
77
|
-
constructor(t,
|
|
77
|
+
constructor(t, r, n) {
|
|
78
78
|
c(this, "_url");
|
|
79
79
|
c(this, "_value");
|
|
80
80
|
c(this, "_options");
|
|
@@ -82,10 +82,10 @@ class J {
|
|
|
82
82
|
c(this, "iframe");
|
|
83
83
|
c(this, "eventManager");
|
|
84
84
|
c(this, "modal");
|
|
85
|
-
this._url = t, this._value =
|
|
86
|
-
i.type ===
|
|
87
|
-
}), this.on(
|
|
88
|
-
i.type ===
|
|
85
|
+
this._url = t, this._value = r, this._options = n, this.eventManager = new q(), this.on(u.INVALID, (i) => {
|
|
86
|
+
i.type === u.INVALID && (this._errors = i.errors, this._value = i.value);
|
|
87
|
+
}), this.on(u.RESIZE, (i) => {
|
|
88
|
+
i.type === u.RESIZE && this.iframe && (this.iframe.style.height = `${i.height}px`);
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
@@ -120,20 +120,20 @@ class J {
|
|
|
120
120
|
* @throws Will throw an error if the parent element is not found
|
|
121
121
|
*/
|
|
122
122
|
mount(t) {
|
|
123
|
-
const
|
|
124
|
-
if (!
|
|
125
|
-
this.embed(
|
|
123
|
+
const r = document.querySelector(t);
|
|
124
|
+
if (!r) throw new Error(`parentID ${t} not found`);
|
|
125
|
+
this.embed(r);
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Embeds the component into a parent element
|
|
129
129
|
* @param parent - The parent element to embed the component into
|
|
130
130
|
*/
|
|
131
|
-
embed(t,
|
|
132
|
-
var
|
|
133
|
-
this.removeEmbed(), this.iframe = document.createElement("iframe"), this.iframe.src = this.url + (
|
|
131
|
+
embed(t, r = !1) {
|
|
132
|
+
var n, i;
|
|
133
|
+
this.removeEmbed(), this.iframe = document.createElement("iframe"), this.iframe.src = this.url + (r ? "" : "&embedded=true"), this.iframe.allow = "web-share; clipboard-write; hid; bluetooth;", this.iframe.style.width = "100%", this.iframe.style.height = "0px", this.iframe.style.border = "none", this.iframe.style.overflow = "hidden", this.iframe.scrolling = "no", t.appendChild(this.iframe), window.addEventListener("message", (o) => {
|
|
134
134
|
var s, a;
|
|
135
135
|
o.source === ((s = this.iframe) == null ? void 0 : s.contentWindow) && ((a = this.eventManager) == null || a.setPort(o.ports[0]));
|
|
136
|
-
}), (i = (
|
|
136
|
+
}), (i = (n = this.iframe) == null ? void 0 : n.contentWindow) == null || i.focus();
|
|
137
137
|
}
|
|
138
138
|
removeEmbed() {
|
|
139
139
|
this.iframe && this.iframe.remove();
|
|
@@ -150,40 +150,40 @@ class J {
|
|
|
150
150
|
* @param messageType - The type of message to listen for
|
|
151
151
|
* @param callback - The callback function to execute when the message is received
|
|
152
152
|
*/
|
|
153
|
-
on(t,
|
|
154
|
-
return this.eventManager.on(t,
|
|
153
|
+
on(t, r) {
|
|
154
|
+
return this.eventManager.on(t, r);
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
157
|
* Removes an event listener for a specific message type
|
|
158
158
|
* @param messageType - The type of message to stop listening for
|
|
159
159
|
* @param callback - The callback function to remove
|
|
160
160
|
*/
|
|
161
|
-
off(t,
|
|
162
|
-
this.eventManager.off(t,
|
|
161
|
+
off(t, r) {
|
|
162
|
+
this.eventManager.off(t, r);
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
165
|
* Updates the transaction value and sends an update message to the component
|
|
166
166
|
* @param value - The new transaction value
|
|
167
167
|
*/
|
|
168
|
-
update(t,
|
|
169
|
-
this._value = t,
|
|
168
|
+
update(t, r) {
|
|
169
|
+
this._value = t, r && (this._options = r), this.send({ type: S.UPDATE, value: t, options: this._options });
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* Waits for the component to complete and returns the transaction response
|
|
173
173
|
* @returns A promise that resolves with the transaction response
|
|
174
174
|
*/
|
|
175
175
|
completion() {
|
|
176
|
-
return new Promise((t,
|
|
177
|
-
let
|
|
176
|
+
return new Promise((t, r) => {
|
|
177
|
+
let n, i, o;
|
|
178
178
|
function s() {
|
|
179
|
-
|
|
179
|
+
n && n(), i && i(), o && o();
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
n = this.on(u.COMPLETE, (a) => {
|
|
182
182
|
t(a.response), s();
|
|
183
|
-
}), i = this.on(
|
|
184
|
-
|
|
183
|
+
}), i = this.on(u.CANCEL, () => {
|
|
184
|
+
r(new Error("User cancelled")), s();
|
|
185
185
|
}), o = this.on("error", (a) => {
|
|
186
|
-
|
|
186
|
+
r(new Error(a.message)), s();
|
|
187
187
|
});
|
|
188
188
|
});
|
|
189
189
|
}
|
|
@@ -192,15 +192,15 @@ class J {
|
|
|
192
192
|
*/
|
|
193
193
|
async openModal() {
|
|
194
194
|
this.modal && this.closeModal(), this.modal = document.createElement("dialog"), this.modal.style.border = "none", this.modal.style.backgroundColor = "white", this.modal.style.maxWidth = "100vw", this.modal.style.maxHeight = "100vh", this.modal.style.width = "600px", this.modal.style.height = "600px", document.body.appendChild(this.modal), this.embed(this.modal, !0);
|
|
195
|
-
const t = this.on(
|
|
195
|
+
const t = this.on(u.CANCEL, () => {
|
|
196
196
|
this.closeModal();
|
|
197
|
-
}),
|
|
197
|
+
}), r = this.on(u.COMPLETE, () => {
|
|
198
198
|
this.closeModal();
|
|
199
199
|
});
|
|
200
200
|
return this.modal.showModal(), this.modal.addEventListener("click", () => {
|
|
201
201
|
this.closeModal();
|
|
202
202
|
}), this.completion().finally(() => {
|
|
203
|
-
t(),
|
|
203
|
+
t(), r();
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
@@ -227,80 +227,80 @@ class J {
|
|
|
227
227
|
var o;
|
|
228
228
|
i.source === t && (console.log("received message from popup", i.data), (o = this.eventManager) == null || o.setPort(i.ports[0]));
|
|
229
229
|
});
|
|
230
|
-
const
|
|
230
|
+
const r = this.on(u.CANCEL, () => {
|
|
231
231
|
t == null || t.close();
|
|
232
|
-
}),
|
|
232
|
+
}), n = this.on(u.COMPLETE, () => {
|
|
233
233
|
t == null || t.close();
|
|
234
234
|
});
|
|
235
235
|
return this.completion().finally(() => {
|
|
236
|
-
|
|
236
|
+
r(), n();
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
return Object.entries(e).map(([t,
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
-
typeof
|
|
240
|
+
function H(e) {
|
|
241
|
+
return Object.entries(e).map(([t, r]) => {
|
|
242
|
+
if (r == null) return;
|
|
243
|
+
const n = encodeURIComponent(t), i = encodeURIComponent(
|
|
244
|
+
typeof r == "object" ? JSON.stringify(r) : String(r)
|
|
245
245
|
// Use String() to handle all primitive types
|
|
246
246
|
);
|
|
247
|
-
return `${
|
|
247
|
+
return `${n}=${i}`;
|
|
248
248
|
}).filter((t) => t !== void 0).join("&");
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function de(e) {
|
|
251
251
|
const t = e.slice(1);
|
|
252
252
|
return t ? t.split("&").filter(Boolean).reduce(
|
|
253
|
-
(
|
|
253
|
+
(n, i) => {
|
|
254
254
|
const [o, s] = i.split("=");
|
|
255
|
-
return o && (
|
|
255
|
+
return o && (n[decodeURIComponent(o)] = s ? decodeURIComponent(s) : ""), n;
|
|
256
256
|
},
|
|
257
257
|
{}
|
|
258
258
|
) : {};
|
|
259
259
|
}
|
|
260
260
|
new TextEncoder();
|
|
261
|
-
const
|
|
262
|
-
function
|
|
261
|
+
const b = new TextDecoder();
|
|
262
|
+
function X(e) {
|
|
263
263
|
if (Uint8Array.fromBase64)
|
|
264
264
|
return Uint8Array.fromBase64(e);
|
|
265
|
-
const t = atob(e),
|
|
266
|
-
for (let
|
|
267
|
-
n
|
|
268
|
-
return
|
|
265
|
+
const t = atob(e), r = new Uint8Array(t.length);
|
|
266
|
+
for (let n = 0; n < t.length; n++)
|
|
267
|
+
r[n] = t.charCodeAt(n);
|
|
268
|
+
return r;
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function z(e) {
|
|
271
271
|
if (Uint8Array.fromBase64)
|
|
272
|
-
return Uint8Array.fromBase64(typeof e == "string" ? e :
|
|
272
|
+
return Uint8Array.fromBase64(typeof e == "string" ? e : b.decode(e), {
|
|
273
273
|
alphabet: "base64url"
|
|
274
274
|
});
|
|
275
275
|
let t = e;
|
|
276
|
-
t instanceof Uint8Array && (t =
|
|
276
|
+
t instanceof Uint8Array && (t = b.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
277
277
|
try {
|
|
278
|
-
return
|
|
278
|
+
return X(t);
|
|
279
279
|
} catch {
|
|
280
280
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
|
-
class
|
|
284
|
-
constructor(
|
|
283
|
+
class R extends Error {
|
|
284
|
+
constructor(r, n) {
|
|
285
285
|
var i;
|
|
286
|
-
super(
|
|
286
|
+
super(r, n);
|
|
287
287
|
c(this, "code", "ERR_JOSE_GENERIC");
|
|
288
288
|
this.name = this.constructor.name, (i = Error.captureStackTrace) == null || i.call(Error, this, this.constructor);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
c(
|
|
292
|
-
class
|
|
291
|
+
c(R, "code", "ERR_JOSE_GENERIC");
|
|
292
|
+
class h extends R {
|
|
293
293
|
constructor() {
|
|
294
294
|
super(...arguments);
|
|
295
295
|
c(this, "code", "ERR_JWT_INVALID");
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
c(
|
|
299
|
-
function
|
|
298
|
+
c(h, "code", "ERR_JWT_INVALID");
|
|
299
|
+
function Y(e) {
|
|
300
300
|
return typeof e == "object" && e !== null;
|
|
301
301
|
}
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
302
|
+
const Q = (e) => {
|
|
303
|
+
if (!Y(e) || Object.prototype.toString.call(e) !== "[object Object]")
|
|
304
304
|
return !1;
|
|
305
305
|
if (Object.getPrototypeOf(e) === null)
|
|
306
306
|
return !0;
|
|
@@ -309,33 +309,39 @@ const q = (e) => {
|
|
|
309
309
|
t = Object.getPrototypeOf(t);
|
|
310
310
|
return Object.getPrototypeOf(e) === t;
|
|
311
311
|
};
|
|
312
|
-
function
|
|
312
|
+
function Z(e) {
|
|
313
313
|
if (typeof e != "string")
|
|
314
|
-
throw new
|
|
315
|
-
const { 1: t, length:
|
|
316
|
-
if (
|
|
317
|
-
throw new
|
|
318
|
-
if (
|
|
319
|
-
throw new
|
|
314
|
+
throw new h("JWTs must use Compact JWS serialization, JWT must be a string");
|
|
315
|
+
const { 1: t, length: r } = e.split(".");
|
|
316
|
+
if (r === 5)
|
|
317
|
+
throw new h("Only JWTs using Compact JWS serialization can be decoded");
|
|
318
|
+
if (r !== 3)
|
|
319
|
+
throw new h("Invalid JWT");
|
|
320
320
|
if (!t)
|
|
321
|
-
throw new
|
|
322
|
-
let
|
|
321
|
+
throw new h("JWTs must contain a payload");
|
|
322
|
+
let n;
|
|
323
323
|
try {
|
|
324
|
-
|
|
324
|
+
n = z(t);
|
|
325
325
|
} catch {
|
|
326
|
-
throw new
|
|
326
|
+
throw new h("Failed to base64url decode the payload");
|
|
327
327
|
}
|
|
328
328
|
let i;
|
|
329
329
|
try {
|
|
330
|
-
i = JSON.parse(
|
|
330
|
+
i = JSON.parse(b.decode(n));
|
|
331
331
|
} catch {
|
|
332
|
-
throw new
|
|
332
|
+
throw new h("Failed to parse the decoded payload as JSON");
|
|
333
333
|
}
|
|
334
|
-
if (!
|
|
335
|
-
throw new
|
|
334
|
+
if (!Q(i))
|
|
335
|
+
throw new h("Invalid JWT Claims Set");
|
|
336
336
|
return i;
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function N(e) {
|
|
339
|
+
return "source" in e && e.source !== void 0;
|
|
340
|
+
}
|
|
341
|
+
function E(e) {
|
|
342
|
+
return !N(e);
|
|
343
|
+
}
|
|
344
|
+
function g(e, t) {
|
|
339
345
|
if (t != null && t.email)
|
|
340
346
|
return `did:email:${t.email}`;
|
|
341
347
|
if (t != null && t.name)
|
|
@@ -344,27 +350,27 @@ function E(e, t) {
|
|
|
344
350
|
`Unable to generate ${e} ID: missing required ${e} information`
|
|
345
351
|
);
|
|
346
352
|
}
|
|
347
|
-
function
|
|
348
|
-
const { nameIdentifier: t, ...
|
|
353
|
+
function ee(e) {
|
|
354
|
+
const { nameIdentifier: t, ...r } = e;
|
|
349
355
|
return {
|
|
350
|
-
...
|
|
351
|
-
nameIdentifier: t == null ? void 0 : t.map(({ nameIdentifierType:
|
|
356
|
+
...r,
|
|
357
|
+
nameIdentifier: t == null ? void 0 : t.map(({ nameIdentifierType: n, ...i }) => ({
|
|
352
358
|
...i,
|
|
353
|
-
naturalPersonNameIdentifierType:
|
|
359
|
+
naturalPersonNameIdentifierType: n
|
|
354
360
|
}))
|
|
355
361
|
};
|
|
356
362
|
}
|
|
357
|
-
function
|
|
363
|
+
function L(e, t) {
|
|
358
364
|
return {
|
|
359
365
|
naturalPerson: e.naturalPerson ? {
|
|
360
366
|
...e.naturalPerson,
|
|
361
|
-
name:
|
|
367
|
+
name: ee(e.naturalPerson.name)
|
|
362
368
|
} : void 0,
|
|
363
369
|
legalPerson: e.legalPerson,
|
|
364
370
|
accountNumber: [t]
|
|
365
371
|
};
|
|
366
372
|
}
|
|
367
|
-
const
|
|
373
|
+
const I = [
|
|
368
374
|
{
|
|
369
375
|
addressType: "GEOG",
|
|
370
376
|
addressLine: ["1234 Main Street"],
|
|
@@ -372,62 +378,62 @@ const p = [
|
|
|
372
378
|
country: "US"
|
|
373
379
|
}
|
|
374
380
|
];
|
|
375
|
-
function
|
|
381
|
+
function te(e) {
|
|
376
382
|
const t = e.trim();
|
|
377
383
|
if (!t)
|
|
378
384
|
return { primaryIdentifier: "", secondaryIdentifier: "" };
|
|
379
|
-
const
|
|
380
|
-
return { primaryIdentifier:
|
|
385
|
+
const r = t.split(/\s+/), n = r[r.length - 1], i = r.slice(0, -1), o = i.length > 0 ? i.join(" ") : n;
|
|
386
|
+
return { primaryIdentifier: n, secondaryIdentifier: o };
|
|
381
387
|
}
|
|
382
|
-
function
|
|
383
|
-
const
|
|
388
|
+
function re(e, t, r = ["1234567890"]) {
|
|
389
|
+
const n = t == null ? void 0 : t.map((i) => {
|
|
384
390
|
const o = { ...i };
|
|
385
391
|
return o.naturalPerson && (o.naturalPerson = {
|
|
386
392
|
...o.naturalPerson,
|
|
387
|
-
geographicAddress:
|
|
393
|
+
geographicAddress: I
|
|
388
394
|
}), o.legalPerson && (o.legalPerson = {
|
|
389
395
|
...o.legalPerson,
|
|
390
|
-
geographicAddress:
|
|
396
|
+
geographicAddress: I
|
|
391
397
|
}), o;
|
|
392
398
|
});
|
|
393
|
-
return e === "originator" ? { originatorPersons:
|
|
399
|
+
return e === "originator" ? { originatorPersons: n, accountNumber: r } : { beneficiaryPersons: n, accountNumber: r };
|
|
394
400
|
}
|
|
395
|
-
function
|
|
396
|
-
const { primaryIdentifier:
|
|
401
|
+
function ne(e, t = "John Doe") {
|
|
402
|
+
const { primaryIdentifier: r, secondaryIdentifier: n } = te(t), i = {
|
|
397
403
|
naturalPerson: {
|
|
398
404
|
name: [
|
|
399
405
|
{
|
|
400
406
|
nameIdentifier: [
|
|
401
407
|
{
|
|
402
|
-
primaryIdentifier:
|
|
403
|
-
...
|
|
408
|
+
primaryIdentifier: r,
|
|
409
|
+
...n ? { secondaryIdentifier: n } : {},
|
|
404
410
|
nameIdentifierType: "LEGL"
|
|
405
411
|
}
|
|
406
412
|
]
|
|
407
413
|
}
|
|
408
414
|
],
|
|
409
|
-
geographicAddress:
|
|
415
|
+
geographicAddress: I
|
|
410
416
|
}
|
|
411
417
|
};
|
|
412
418
|
return e === "originator" ? { originatorPersons: [i], accountNumber: ["1234567890"] } : { beneficiaryPersons: [i], accountNumber: ["1234567890"] };
|
|
413
419
|
}
|
|
414
|
-
const
|
|
420
|
+
const ie = (e) => ({
|
|
415
421
|
...e,
|
|
416
422
|
// @ts-expect-error Preserving the original logic
|
|
417
423
|
name: e.name ? [e.name] : void 0
|
|
418
|
-
}),
|
|
424
|
+
}), oe = (e) => ({
|
|
419
425
|
...e,
|
|
420
|
-
naturalPerson: e.naturalPerson ?
|
|
421
|
-
}),
|
|
426
|
+
naturalPerson: e.naturalPerson ? ie(e.naturalPerson) : void 0
|
|
427
|
+
}), se = ({ beneficiary: e, originator: t }, r, n, i, o) => {
|
|
422
428
|
var s;
|
|
423
429
|
{
|
|
424
430
|
const a = e && {
|
|
425
431
|
...e,
|
|
426
432
|
...i && { accountNumber: [i] },
|
|
427
|
-
beneficiaryPersons: (s = e.beneficiaryPersons) == null ? void 0 : s.map(
|
|
433
|
+
beneficiaryPersons: (s = e.beneficiaryPersons) == null ? void 0 : s.map(oe)
|
|
428
434
|
};
|
|
429
|
-
if (
|
|
430
|
-
const d =
|
|
435
|
+
if (n && (a != null && a.beneficiaryPersons)) {
|
|
436
|
+
const d = re(
|
|
431
437
|
"originator",
|
|
432
438
|
a == null ? void 0 : a.beneficiaryPersons
|
|
433
439
|
);
|
|
@@ -441,14 +447,14 @@ const Z = (e) => ({
|
|
|
441
447
|
}
|
|
442
448
|
return {
|
|
443
449
|
beneficiary: a,
|
|
444
|
-
originator:
|
|
450
|
+
originator: ne("originator", r)
|
|
445
451
|
};
|
|
446
452
|
}
|
|
447
453
|
};
|
|
448
|
-
function
|
|
454
|
+
function ae(e, t, r) {
|
|
449
455
|
var o, s;
|
|
450
|
-
const { beneficiary:
|
|
451
|
-
|
|
456
|
+
const { beneficiary: n, originator: i } = se(
|
|
457
|
+
r,
|
|
452
458
|
(o = e.customer) == null ? void 0 : o.name,
|
|
453
459
|
t.originatorEqualsBeneficiary,
|
|
454
460
|
e.destination
|
|
@@ -466,108 +472,136 @@ function ne(e, t, n) {
|
|
|
466
472
|
...t.beneficiaryProof && {
|
|
467
473
|
beneficiaryProof: t.beneficiaryProof
|
|
468
474
|
},
|
|
469
|
-
...
|
|
475
|
+
...n && { beneficiary: n },
|
|
470
476
|
...i && { originator: i },
|
|
471
477
|
...t.originatorEqualsBeneficiary && {
|
|
472
478
|
originatorEqualsBeneficiary: t.originatorEqualsBeneficiary
|
|
473
479
|
}
|
|
474
480
|
};
|
|
475
481
|
}
|
|
476
|
-
function
|
|
477
|
-
var
|
|
478
|
-
const
|
|
479
|
-
return t.originatorVASPdid &&
|
|
482
|
+
function C(e, t, r = {}) {
|
|
483
|
+
var m, f, A;
|
|
484
|
+
const n = E(e), i = n ? e.customer : e.counterparty, o = n ? e.counterparty : e.customer, s = (r == null ? void 0 : r.originatorId) || g("originator", i), a = (r == null ? void 0 : r.beneficiaryId) || g("beneficiary", o), d = (r == null ? void 0 : r.referenceId) || t.transactionId || Math.random().toString(36).substring(2, 15), l = [];
|
|
485
|
+
return t.originatorVASPdid && l.push({
|
|
480
486
|
"@id": t.originatorVASPdid,
|
|
481
|
-
for:
|
|
487
|
+
for: s,
|
|
482
488
|
role: "VASP"
|
|
483
|
-
}), t.beneficiaryVASPdid &&
|
|
489
|
+
}), t.beneficiaryVASPdid && l.push({
|
|
484
490
|
"@id": t.beneficiaryVASPdid,
|
|
485
|
-
for:
|
|
491
|
+
for: a,
|
|
486
492
|
role: "VASP"
|
|
487
|
-
}), e.destination && ((
|
|
493
|
+
}), E(e) && e.destination && ((m = e == null ? void 0 : e.account) != null && m.did) && l.push({
|
|
488
494
|
"@id": e.account.did,
|
|
489
|
-
for: t.beneficiaryVASPdid ||
|
|
495
|
+
for: t.beneficiaryVASPdid || a,
|
|
490
496
|
role: "SettlementAddress"
|
|
497
|
+
}), N(e) && e.source && ((f = e.agent) != null && f.did) && l.push({
|
|
498
|
+
"@id": e.agent.did,
|
|
499
|
+
for: t.originatorVASPdid || s,
|
|
500
|
+
role: "SourceAddress"
|
|
491
501
|
}), {
|
|
492
|
-
originator: { "@id":
|
|
493
|
-
beneficiary: { "@id":
|
|
502
|
+
originator: { "@id": s },
|
|
503
|
+
beneficiary: { "@id": a },
|
|
494
504
|
asset: e.asset,
|
|
495
|
-
amount: ((
|
|
496
|
-
agents:
|
|
497
|
-
ref:
|
|
505
|
+
amount: ((A = e.amountDecimal) == null ? void 0 : A.toString()) || t.transactionAmount,
|
|
506
|
+
agents: l,
|
|
507
|
+
ref: d
|
|
498
508
|
};
|
|
499
509
|
}
|
|
500
|
-
function
|
|
501
|
-
var o, s;
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
510
|
+
function T(e, t, r = {}) {
|
|
511
|
+
var o, s, a, d, l, m;
|
|
512
|
+
if (E(e)) {
|
|
513
|
+
const f = r.beneficiaryId || g("beneficiary", e.counterparty), A = (
|
|
514
|
+
// If counterparty type is SELF, reuse originator data for beneficiary
|
|
515
|
+
((o = e.counterparty) == null ? void 0 : o.type) === p.SELF && r.originator ? r.originator.originatorPerson : (
|
|
516
|
+
// Convert all beneficiary persons from V1 to V2 format
|
|
517
|
+
((a = (s = t.beneficiary) == null ? void 0 : s.beneficiaryPersons) == null ? void 0 : a.map(
|
|
518
|
+
(O) => L(O, f)
|
|
519
|
+
)) || []
|
|
520
|
+
)
|
|
521
|
+
);
|
|
522
|
+
return {
|
|
523
|
+
ivms101: {
|
|
524
|
+
originator: r.originator,
|
|
525
|
+
beneficiary: {
|
|
526
|
+
beneficiaryPerson: A
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
const n = r.originatorId || g("originator", e.counterparty);
|
|
505
532
|
return {
|
|
506
533
|
ivms101: {
|
|
507
|
-
originator:
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
534
|
+
originator: {
|
|
535
|
+
originatorPerson: ((d = e.counterparty) == null ? void 0 : d.type) === p.SELF && r.beneficiary ? r.beneficiary.beneficiaryPerson : (
|
|
536
|
+
// Convert all originator persons from V1 to V2 format
|
|
537
|
+
((m = (l = t.originator) == null ? void 0 : l.originatorPersons) == null ? void 0 : m.map(
|
|
538
|
+
(f) => L(f, n)
|
|
539
|
+
)) || []
|
|
540
|
+
)
|
|
541
|
+
},
|
|
542
|
+
beneficiary: r.beneficiary
|
|
511
543
|
}
|
|
512
544
|
};
|
|
513
545
|
}
|
|
514
|
-
function
|
|
515
|
-
var
|
|
516
|
-
const
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
return r.beneficiaryId || (((
|
|
546
|
+
function P(e, t, r) {
|
|
547
|
+
var o, s;
|
|
548
|
+
const n = { ...e };
|
|
549
|
+
let i;
|
|
550
|
+
try {
|
|
551
|
+
const a = Z(t);
|
|
552
|
+
i = a == null ? void 0 : a.sub;
|
|
553
|
+
} catch {
|
|
554
|
+
}
|
|
555
|
+
return E(r) ? (!n.originatorId && i && (n.originatorId = i), n.beneficiaryId || (((o = r.counterparty) == null ? void 0 : o.type) === p.SELF ? n.beneficiaryId = n.originatorId : r.destination && (n.beneficiaryId = `did:key:${r.destination}`))) : N(r) && (!n.beneficiaryId && i && (n.beneficiaryId = i), n.originatorId || (((s = r.counterparty) == null ? void 0 : s.type) === p.SELF ? n.originatorId = n.beneficiaryId : r.source && (n.originatorId = `did:key:${r.source}`))), n;
|
|
524
556
|
}
|
|
525
|
-
function
|
|
557
|
+
function le(e) {
|
|
526
558
|
var s;
|
|
527
559
|
if (!e.txCreate || !e.ivms101)
|
|
528
560
|
throw new Error(
|
|
529
561
|
"Invalid response: missing required txCreate or ivms101 data"
|
|
530
562
|
);
|
|
531
|
-
const { value: t, ivms101:
|
|
563
|
+
const { value: t, ivms101: r, proof: n, txCreate: i } = e, o = {
|
|
532
564
|
destination: (t == null ? void 0 : t.destination) || "",
|
|
533
565
|
counterparty: (t == null ? void 0 : t.counterparty) || {},
|
|
534
566
|
agent: t == null ? void 0 : t.agent,
|
|
535
567
|
account: t == null ? void 0 : t.account,
|
|
536
|
-
proof:
|
|
568
|
+
proof: n,
|
|
537
569
|
asset: (t == null ? void 0 : t.asset) || (typeof i.transactionAsset == "string" ? i.transactionAsset : (s = i.transactionAsset) == null ? void 0 : s.caip19) || "",
|
|
538
570
|
amountDecimal: (t == null ? void 0 : t.amountDecimal) || (i.transactionAmount ? parseFloat(i.transactionAmount) : 0),
|
|
539
571
|
customer: t == null ? void 0 : t.customer
|
|
540
572
|
};
|
|
541
|
-
return
|
|
573
|
+
return ae(o, i, r);
|
|
542
574
|
}
|
|
543
|
-
function
|
|
544
|
-
|
|
575
|
+
function ue(e, t, r = {}) {
|
|
576
|
+
const { value: n, txCreate: i, txUpdate: o, ivms101: s, proof: a } = e, d = E(n) ? i : o;
|
|
577
|
+
if (!d || !s)
|
|
545
578
|
throw new Error(
|
|
546
|
-
"Invalid response: missing required txCreate or ivms101 data"
|
|
579
|
+
"Invalid response: missing required txCreate/txUpdate or ivms101 data"
|
|
547
580
|
);
|
|
548
|
-
const
|
|
581
|
+
const l = P(r, t, n);
|
|
549
582
|
return {
|
|
550
|
-
createTx:
|
|
551
|
-
ivms101:
|
|
552
|
-
...
|
|
583
|
+
createTx: C(n, d, l),
|
|
584
|
+
ivms101: T(n, s, l),
|
|
585
|
+
...a && { confirmRelationship: { proof: a } }
|
|
553
586
|
};
|
|
554
587
|
}
|
|
555
|
-
function
|
|
556
|
-
|
|
588
|
+
function he(e, t, r = {}) {
|
|
589
|
+
const { value: n, txCreate: i, txUpdate: o } = e, s = E(n) ? i : o;
|
|
590
|
+
if (!s || !e.ivms101)
|
|
557
591
|
throw new Error(
|
|
558
|
-
"Invalid response: missing required txCreate or ivms101 data"
|
|
592
|
+
"Invalid response: missing required txCreate/txUpdate or ivms101 data"
|
|
559
593
|
);
|
|
560
|
-
const
|
|
561
|
-
return
|
|
594
|
+
const a = P(r, t, n);
|
|
595
|
+
return C(n, s, a);
|
|
562
596
|
}
|
|
563
|
-
function
|
|
597
|
+
function me(e, t, r = {}) {
|
|
564
598
|
if (!e.ivms101)
|
|
565
599
|
throw new Error("Invalid response: missing required ivms101 data");
|
|
566
|
-
const { value:
|
|
567
|
-
return
|
|
600
|
+
const { value: n, ivms101: i } = e, o = P(r, t, n);
|
|
601
|
+
return T(n, i, o);
|
|
568
602
|
}
|
|
569
|
-
async function
|
|
570
|
-
const
|
|
603
|
+
async function v(e, t) {
|
|
604
|
+
const r = JSON.stringify(e), n = new TextEncoder(), i = t ? w(t) : crypto.getRandomValues(new Uint8Array(32)), o = await crypto.subtle.importKey(
|
|
571
605
|
"raw",
|
|
572
606
|
i,
|
|
573
607
|
{ name: "AES-GCM" },
|
|
@@ -576,71 +610,71 @@ async function b(e, t) {
|
|
|
576
610
|
), s = crypto.getRandomValues(new Uint8Array(12)), a = await crypto.subtle.encrypt(
|
|
577
611
|
{ name: "AES-GCM", iv: s },
|
|
578
612
|
o,
|
|
579
|
-
|
|
613
|
+
n.encode(r)
|
|
580
614
|
);
|
|
581
615
|
return {
|
|
582
|
-
ciphertext: `${
|
|
583
|
-
key:
|
|
616
|
+
ciphertext: `${y(s)}-${y(a)}`,
|
|
617
|
+
key: y(i)
|
|
584
618
|
};
|
|
585
619
|
}
|
|
586
|
-
async function
|
|
587
|
-
const [
|
|
588
|
-
atob(t).split("").map((
|
|
589
|
-
), o =
|
|
620
|
+
async function _({ ciphertext: e, key: t }) {
|
|
621
|
+
const [r, n] = e.split("-"), i = new Uint8Array(
|
|
622
|
+
atob(t).split("").map((m) => m.charCodeAt(0))
|
|
623
|
+
), o = w(r), s = w(n), a = await crypto.subtle.importKey(
|
|
590
624
|
"raw",
|
|
591
625
|
i,
|
|
592
626
|
{ name: "AES-GCM" },
|
|
593
627
|
!1,
|
|
594
628
|
["decrypt"]
|
|
595
|
-
), d = new TextDecoder(),
|
|
629
|
+
), d = new TextDecoder(), l = await crypto.subtle.decrypt(
|
|
596
630
|
{ name: "AES-GCM", iv: new Uint8Array(o) },
|
|
597
631
|
a,
|
|
598
632
|
s
|
|
599
633
|
);
|
|
600
|
-
return JSON.parse(d.decode(
|
|
634
|
+
return JSON.parse(d.decode(l));
|
|
601
635
|
}
|
|
602
|
-
function
|
|
636
|
+
function y(e) {
|
|
603
637
|
const t = new Uint8Array(e);
|
|
604
|
-
let
|
|
605
|
-
for (let
|
|
606
|
-
|
|
607
|
-
return btoa(
|
|
608
|
-
}
|
|
609
|
-
function
|
|
610
|
-
const t = atob(e),
|
|
611
|
-
for (let
|
|
612
|
-
n
|
|
613
|
-
return
|
|
614
|
-
}
|
|
615
|
-
async function
|
|
638
|
+
let r = "";
|
|
639
|
+
for (let n = 0; n < t.length; n++)
|
|
640
|
+
r += String.fromCharCode(t[n]);
|
|
641
|
+
return btoa(r);
|
|
642
|
+
}
|
|
643
|
+
function w(e) {
|
|
644
|
+
const t = atob(e), r = new Uint8Array(t.length);
|
|
645
|
+
for (let n = 0; n < t.length; n++)
|
|
646
|
+
r[n] = t.charCodeAt(n);
|
|
647
|
+
return r;
|
|
648
|
+
}
|
|
649
|
+
async function fe(e) {
|
|
616
650
|
const t = await fetch(e.url, {
|
|
617
651
|
method: "GET"
|
|
618
652
|
});
|
|
619
653
|
if (!t.ok)
|
|
620
654
|
throw new Error(`Failed to get connection: ${await t.text()}`);
|
|
621
|
-
const
|
|
622
|
-
if (!
|
|
655
|
+
const r = await t.json();
|
|
656
|
+
if (!r.id || !r.metadata || !r.status || !r.sealed)
|
|
623
657
|
throw new Error("Data missing from server response");
|
|
624
|
-
const
|
|
625
|
-
id:
|
|
626
|
-
metadata:
|
|
627
|
-
status:
|
|
658
|
+
const n = {
|
|
659
|
+
id: r.id,
|
|
660
|
+
metadata: r.metadata,
|
|
661
|
+
status: r.status
|
|
628
662
|
};
|
|
629
|
-
if (
|
|
630
|
-
return
|
|
631
|
-
const i =
|
|
663
|
+
if (r.status === "closed")
|
|
664
|
+
return n;
|
|
665
|
+
const i = r.sealed[r.sealed.length - 1], o = await _({
|
|
632
666
|
ciphertext: i,
|
|
633
667
|
key: e.key
|
|
634
668
|
});
|
|
635
|
-
return
|
|
636
|
-
...
|
|
669
|
+
return r.status === "completed" ? {
|
|
670
|
+
...n,
|
|
637
671
|
result: o.result
|
|
638
672
|
} : {
|
|
639
|
-
...
|
|
673
|
+
...n,
|
|
640
674
|
tx: o.tx
|
|
641
675
|
};
|
|
642
676
|
}
|
|
643
|
-
class
|
|
677
|
+
class Ee {
|
|
644
678
|
constructor(t) {
|
|
645
679
|
c(this, "endpoint");
|
|
646
680
|
this.endpoint = t;
|
|
@@ -652,10 +686,10 @@ class le {
|
|
|
652
686
|
* @param metadata Connection metadata including participants and transaction type
|
|
653
687
|
* @returns Promise resolving to connection details including ID, version, and encryption key
|
|
654
688
|
*/
|
|
655
|
-
async create(t,
|
|
656
|
-
const
|
|
657
|
-
metadata:
|
|
658
|
-
sealed:
|
|
689
|
+
async create(t, r) {
|
|
690
|
+
const n = await v(t), i = {
|
|
691
|
+
metadata: r,
|
|
692
|
+
sealed: n.ciphertext
|
|
659
693
|
}, o = await fetch(this.endpoint, {
|
|
660
694
|
method: "POST",
|
|
661
695
|
headers: {
|
|
@@ -670,9 +704,9 @@ class le {
|
|
|
670
704
|
id: s.id,
|
|
671
705
|
version: s.version,
|
|
672
706
|
status: s.status,
|
|
673
|
-
metadata:
|
|
707
|
+
metadata: r,
|
|
674
708
|
data: t,
|
|
675
|
-
key:
|
|
709
|
+
key: n.key
|
|
676
710
|
};
|
|
677
711
|
}
|
|
678
712
|
/**
|
|
@@ -685,10 +719,10 @@ class le {
|
|
|
685
719
|
* @param key Current encryption key
|
|
686
720
|
* @returns Promise resolving to updated connection details including new encryption key
|
|
687
721
|
*/
|
|
688
|
-
async update(t,
|
|
689
|
-
const s = await
|
|
722
|
+
async update(t, r, n, i, o) {
|
|
723
|
+
const s = await v(r, o), a = {
|
|
690
724
|
sealed: s.ciphertext,
|
|
691
|
-
version:
|
|
725
|
+
version: n,
|
|
692
726
|
status: i
|
|
693
727
|
}, d = await fetch(`${this.endpoint}/${t}`, {
|
|
694
728
|
method: "PATCH",
|
|
@@ -699,13 +733,13 @@ class le {
|
|
|
699
733
|
});
|
|
700
734
|
if (!d.ok)
|
|
701
735
|
throw new Error(`Failed to update connection: ${await d.text()}`);
|
|
702
|
-
const
|
|
736
|
+
const l = await d.json();
|
|
703
737
|
return {
|
|
704
|
-
id:
|
|
705
|
-
metadata:
|
|
706
|
-
version:
|
|
707
|
-
status:
|
|
708
|
-
data:
|
|
738
|
+
id: l.id,
|
|
739
|
+
metadata: l.metadata,
|
|
740
|
+
version: l.version,
|
|
741
|
+
status: l.status,
|
|
742
|
+
data: r,
|
|
709
743
|
key: s.key
|
|
710
744
|
};
|
|
711
745
|
}
|
|
@@ -716,15 +750,15 @@ class le {
|
|
|
716
750
|
* @param key Encryption key from previous create/update operation
|
|
717
751
|
* @returns Promise resolving to connection details including decrypted data
|
|
718
752
|
*/
|
|
719
|
-
async get(t,
|
|
720
|
-
const
|
|
753
|
+
async get(t, r) {
|
|
754
|
+
const n = await fetch(`${this.endpoint}/${t}`, {
|
|
721
755
|
method: "GET"
|
|
722
756
|
});
|
|
723
|
-
if (!
|
|
724
|
-
throw new Error(`Failed to get connection: ${await
|
|
725
|
-
const i = await
|
|
757
|
+
if (!n.ok)
|
|
758
|
+
throw new Error(`Failed to get connection: ${await n.text()}`);
|
|
759
|
+
const i = await n.json(), o = i.sealed[i.sealed.length - 1], s = await _({
|
|
726
760
|
ciphertext: o,
|
|
727
|
-
key:
|
|
761
|
+
key: r
|
|
728
762
|
});
|
|
729
763
|
return {
|
|
730
764
|
id: i.id,
|
|
@@ -732,7 +766,7 @@ class le {
|
|
|
732
766
|
version: i.version,
|
|
733
767
|
metadata: i.metadata,
|
|
734
768
|
data: s,
|
|
735
|
-
key:
|
|
769
|
+
key: r
|
|
736
770
|
};
|
|
737
771
|
}
|
|
738
772
|
/**
|
|
@@ -741,14 +775,14 @@ class le {
|
|
|
741
775
|
* @returns Promise resolving when the connection is closed
|
|
742
776
|
*/
|
|
743
777
|
async close(t) {
|
|
744
|
-
const
|
|
778
|
+
const r = await fetch(`${this.endpoint}/${t}`, {
|
|
745
779
|
method: "DELETE"
|
|
746
780
|
});
|
|
747
|
-
if (!
|
|
748
|
-
throw new Error(`Failed to close connection: ${await
|
|
781
|
+
if (!r.ok)
|
|
782
|
+
throw new Error(`Failed to close connection: ${await r.text()}`);
|
|
749
783
|
}
|
|
750
784
|
}
|
|
751
|
-
class
|
|
785
|
+
class pe {
|
|
752
786
|
/**
|
|
753
787
|
* Creates a new instance of the Notabene SDK
|
|
754
788
|
*
|
|
@@ -772,13 +806,13 @@ class ue {
|
|
|
772
806
|
* @returns component URL
|
|
773
807
|
* @internal
|
|
774
808
|
*/
|
|
775
|
-
componentUrl(t,
|
|
809
|
+
componentUrl(t, r, n, i) {
|
|
776
810
|
const o = new URL(this.uxUrl);
|
|
777
811
|
o.pathname = t;
|
|
778
|
-
const s =
|
|
812
|
+
const s = H({
|
|
779
813
|
authToken: this.authToken,
|
|
780
|
-
value:
|
|
781
|
-
configuration:
|
|
814
|
+
value: r,
|
|
815
|
+
configuration: n
|
|
782
816
|
});
|
|
783
817
|
return o.hash = s, this.nodeUrl && o.searchParams.set("nodeUrl", this.nodeUrl), this.theme && o.searchParams.set("theme", JSON.stringify(this.theme)), this.locale && o.searchParams.set("locale", this.locale), i && (i.callback && o.searchParams.set("callback_url", i.callback), i.redirectUri && o.searchParams.set("redirect_uri", i.redirectUri)), o.toString();
|
|
784
818
|
}
|
|
@@ -792,11 +826,11 @@ class ue {
|
|
|
792
826
|
* @returns A new EmbeddedComponent instance
|
|
793
827
|
* @internal
|
|
794
828
|
*/
|
|
795
|
-
createComponent(t,
|
|
796
|
-
return new
|
|
797
|
-
this.componentUrl(t,
|
|
798
|
-
|
|
799
|
-
|
|
829
|
+
createComponent(t, r, n, i) {
|
|
830
|
+
return new K(
|
|
831
|
+
this.componentUrl(t, r, n, i),
|
|
832
|
+
r,
|
|
833
|
+
n
|
|
800
834
|
);
|
|
801
835
|
}
|
|
802
836
|
/**
|
|
@@ -807,12 +841,12 @@ class ue {
|
|
|
807
841
|
* @param callbacks - Optional callback configuration
|
|
808
842
|
* @returns A new EmbeddedComponent instance for withdrawal assistance
|
|
809
843
|
*/
|
|
810
|
-
createWithdrawalAssist(t,
|
|
844
|
+
createWithdrawalAssist(t, r, n) {
|
|
811
845
|
return this.createComponent(
|
|
812
846
|
"withdrawal-assist",
|
|
813
847
|
t,
|
|
814
|
-
|
|
815
|
-
|
|
848
|
+
r,
|
|
849
|
+
n
|
|
816
850
|
);
|
|
817
851
|
}
|
|
818
852
|
/**
|
|
@@ -824,12 +858,12 @@ class ue {
|
|
|
824
858
|
* @returns A new EmbeddedComponent instance for connection
|
|
825
859
|
* @alpha
|
|
826
860
|
*/
|
|
827
|
-
createConnectWallet(t,
|
|
861
|
+
createConnectWallet(t, r, n) {
|
|
828
862
|
return this.createComponent(
|
|
829
863
|
"connect",
|
|
830
864
|
t,
|
|
831
|
-
|
|
832
|
-
|
|
865
|
+
r,
|
|
866
|
+
n
|
|
833
867
|
);
|
|
834
868
|
}
|
|
835
869
|
/**
|
|
@@ -841,12 +875,12 @@ class ue {
|
|
|
841
875
|
* @returns A new EmbeddedComponent instance for deposit requests
|
|
842
876
|
* @public
|
|
843
877
|
*/
|
|
844
|
-
createDepositRequest(t,
|
|
878
|
+
createDepositRequest(t, r, n) {
|
|
845
879
|
return this.createComponent(
|
|
846
880
|
"deposit-request",
|
|
847
881
|
t,
|
|
848
|
-
|
|
849
|
-
|
|
882
|
+
r,
|
|
883
|
+
n
|
|
850
884
|
);
|
|
851
885
|
}
|
|
852
886
|
/**
|
|
@@ -858,37 +892,37 @@ class ue {
|
|
|
858
892
|
* @returns A new EmbeddedComponent instance for deposit assistance
|
|
859
893
|
* @public
|
|
860
894
|
*/
|
|
861
|
-
createDepositAssist(t,
|
|
895
|
+
createDepositAssist(t, r, n) {
|
|
862
896
|
return this.createComponent(
|
|
863
897
|
"deposit-assist",
|
|
864
898
|
t,
|
|
865
|
-
|
|
866
|
-
|
|
899
|
+
r,
|
|
900
|
+
n
|
|
867
901
|
);
|
|
868
902
|
}
|
|
869
903
|
}
|
|
870
904
|
export {
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
905
|
+
x as AgentType,
|
|
906
|
+
u as CMType,
|
|
907
|
+
k as CodeVerificationStatus,
|
|
908
|
+
Ee as ConnectionManager,
|
|
909
|
+
K as EmbeddedComponent,
|
|
910
|
+
J as ErrorIdentifierCode,
|
|
911
|
+
S as HMType,
|
|
912
|
+
W as IdentityVerificationMethod,
|
|
913
|
+
B as OAuthProvider,
|
|
914
|
+
p as PersonType,
|
|
915
|
+
j as ProofStatus,
|
|
916
|
+
G as ProofTypes,
|
|
917
|
+
M as Status,
|
|
918
|
+
V as VASPSearchControl,
|
|
919
|
+
F as ValidationSections,
|
|
920
|
+
$ as WarningIdentifierCode,
|
|
921
|
+
me as componentResponseToIVMS101,
|
|
922
|
+
he as componentResponseToTxCreateRequest,
|
|
923
|
+
ue as componentResponseToTxRequests,
|
|
924
|
+
le as componentResponseToV1TxCreateRequest,
|
|
925
|
+
de as decodeFragmentToObject,
|
|
926
|
+
pe as default,
|
|
927
|
+
fe as getRefreshResult
|
|
894
928
|
};
|