@notabene/javascript-sdk 2.9.0-next.1 → 2.9.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/notabene.cjs +1 -1
- package/dist/cjs/notabene.d.ts +29 -2
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +29 -2
- package/dist/esm/notabene.js +148 -115
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +29 -2
- package/dist/notabene.js +148 -115
- package/package.json +1 -1
- package/src/notabene.ts +7 -0
- package/src/types.ts +13 -0
- package/src/utils/__tests__/connections.test.ts +184 -31
- package/src/utils/connections.ts +74 -2
- package/src/utils/encryption.ts +5 -3
package/dist/esm/notabene.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (t, e, n) =>
|
|
4
|
-
var A = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(A || {}),
|
|
5
|
-
class
|
|
1
|
+
var v = Object.defineProperty;
|
|
2
|
+
var g = (t, e, n) => e in t ? v(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var a = (t, e, n) => g(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
var A = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(A || {}), y = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(y || {}), I = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(I || {}), L = /* @__PURE__ */ ((t) => (t.ALLOWED = "allowed", t.PENDING = "pending", t))(L || {}), b = /* @__PURE__ */ ((t) => (t.ASSET = "asset", t.DESTINATION = "destination", t.COUNTERPARTY = "counterparty", t.AGENT = "agent", t))(b || {}), l = /* @__PURE__ */ ((t) => (t.COMPLETE = "complete", t.RESIZE = "resize", t.RESULT = "result", t.READY = "ready", t.INVALID = "invalid", t.ERROR = "error", t.CANCEL = "cancel", t))(l || {}), C = /* @__PURE__ */ ((t) => (t.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", t.WALLET_CONNECTION_FAILED = "WALLET_CONNECTION_FAILED", t.WALLET_NOT_SUPPORTED = "WALLET_NOT_SUPPORTED", t.TOKEN_INVALID = "TOKEN_INVALID", t))(C || {}), E = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(E || {}), N = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(N || {}), U = /* @__PURE__ */ ((t) => (t.SelfDeclaration = "self-declaration", t.SIWE = "siwe", t.SIWX = "siwx", t.EIP191 = "eip-191", t.EIP712 = "eip-712", t.EIP1271 = "eip-1271", t.BIP137 = "bip-137", t.BIP322 = "bip-322", t.BIP137_XPUB = "xpub", t.TIP191 = "tip-191", t.ED25519 = "ed25519", t.XRP_ED25519 = "xrp-ed25519", t.XLM_ED25519 = "xlm-ed25519", t.CIP8 = "cip-8", t.MicroTransfer = "microtransfer", t.Screenshot = "screenshot", t.Connect = "connect", t))(U || {});
|
|
5
|
+
class _ {
|
|
6
6
|
constructor() {
|
|
7
7
|
a(this, "listeners", /* @__PURE__ */ new Map());
|
|
8
8
|
a(this, "port");
|
|
@@ -42,8 +42,8 @@ class U {
|
|
|
42
42
|
* @param callback - The callback function to remove
|
|
43
43
|
*/
|
|
44
44
|
off(e, n) {
|
|
45
|
-
const
|
|
46
|
-
|
|
45
|
+
const s = this.listeners.get(e);
|
|
46
|
+
s && (s.delete(n), s.size === 0 && this.listeners.delete(e));
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Internal message handler for processing received messages.
|
|
@@ -56,8 +56,8 @@ class U {
|
|
|
56
56
|
handleMessage(e) {
|
|
57
57
|
const n = e.data;
|
|
58
58
|
if (typeof n == "object" && n !== null && "type" in n) {
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
const s = n.type, r = this.listeners.get(s);
|
|
60
|
+
r && r.forEach((i) => i(n));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
@@ -68,13 +68,13 @@ class U {
|
|
|
68
68
|
this.port && this.port.postMessage(e);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
class
|
|
71
|
+
class x {
|
|
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(e, n,
|
|
77
|
+
constructor(e, n, s) {
|
|
78
78
|
a(this, "_url");
|
|
79
79
|
a(this, "_value");
|
|
80
80
|
a(this, "_options");
|
|
@@ -82,10 +82,10 @@ class _ {
|
|
|
82
82
|
a(this, "iframe");
|
|
83
83
|
a(this, "eventManager");
|
|
84
84
|
a(this, "modal");
|
|
85
|
-
this._url = e, this._value = n, this._options =
|
|
86
|
-
|
|
87
|
-
}), this.on(l.RESIZE, (
|
|
88
|
-
|
|
85
|
+
this._url = e, this._value = n, this._options = s, this.eventManager = new _(), this.on(l.INVALID, (r) => {
|
|
86
|
+
r.type === l.INVALID && (this._errors = r.errors, this._value = r.value);
|
|
87
|
+
}), this.on(l.RESIZE, (r) => {
|
|
88
|
+
r.type === l.RESIZE && this.iframe && (this.iframe.style.height = `${r.height}px`);
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
@@ -129,11 +129,11 @@ class _ {
|
|
|
129
129
|
* @param parent - The parent element to embed the component into
|
|
130
130
|
*/
|
|
131
131
|
embed(e, n = !1) {
|
|
132
|
-
var
|
|
133
|
-
this.removeEmbed(), this.iframe = document.createElement("iframe"), this.iframe.src = this.url + (n ? "" : "&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", e.appendChild(this.iframe), window.addEventListener("message", (
|
|
132
|
+
var s, r;
|
|
133
|
+
this.removeEmbed(), this.iframe = document.createElement("iframe"), this.iframe.src = this.url + (n ? "" : "&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", e.appendChild(this.iframe), window.addEventListener("message", (i) => {
|
|
134
134
|
var o, c;
|
|
135
|
-
|
|
136
|
-
}), (
|
|
135
|
+
i.source === ((o = this.iframe) == null ? void 0 : o.contentWindow) && ((c = this.eventManager) == null || c.setPort(i.ports[0]));
|
|
136
|
+
}), (r = (s = this.iframe) == null ? void 0 : s.contentWindow) == null || r.focus();
|
|
137
137
|
}
|
|
138
138
|
removeEmbed() {
|
|
139
139
|
this.iframe && this.iframe.remove();
|
|
@@ -166,7 +166,7 @@ class _ {
|
|
|
166
166
|
* @param value - The new transaction value
|
|
167
167
|
*/
|
|
168
168
|
update(e, n) {
|
|
169
|
-
this._value = e, n && (this._options = n), this.send({ type:
|
|
169
|
+
this._value = e, n && (this._options = n), this.send({ type: E.UPDATE, value: e, options: this._options });
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* Waits for the component to complete and returns the transaction response
|
|
@@ -174,15 +174,15 @@ class _ {
|
|
|
174
174
|
*/
|
|
175
175
|
completion() {
|
|
176
176
|
return new Promise((e, n) => {
|
|
177
|
-
let r, i
|
|
177
|
+
let s, r, i;
|
|
178
178
|
function o() {
|
|
179
|
-
|
|
179
|
+
s && s(), r && r(), i && i();
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
s = this.on(l.COMPLETE, (c) => {
|
|
182
182
|
e(c.response), o();
|
|
183
|
-
}),
|
|
183
|
+
}), r = this.on(l.CANCEL, () => {
|
|
184
184
|
n(new Error("User cancelled")), o();
|
|
185
|
-
}),
|
|
185
|
+
}), i = this.on("error", (c) => {
|
|
186
186
|
n(new Error(c.message)), o();
|
|
187
187
|
});
|
|
188
188
|
});
|
|
@@ -223,87 +223,115 @@ class _ {
|
|
|
223
223
|
"_blank",
|
|
224
224
|
"popup=true,width=600,height=600"
|
|
225
225
|
);
|
|
226
|
-
window.addEventListener("message", (
|
|
227
|
-
var
|
|
228
|
-
|
|
226
|
+
window.addEventListener("message", (r) => {
|
|
227
|
+
var i;
|
|
228
|
+
r.source === e && (console.log("received message from popup", r.data), (i = this.eventManager) == null || i.setPort(r.ports[0]));
|
|
229
229
|
});
|
|
230
230
|
const n = this.on(l.CANCEL, () => {
|
|
231
231
|
e == null || e.close();
|
|
232
|
-
}),
|
|
232
|
+
}), s = this.on(l.COMPLETE, () => {
|
|
233
233
|
e == null || e.close();
|
|
234
234
|
});
|
|
235
235
|
return this.completion().finally(() => {
|
|
236
|
-
n(),
|
|
236
|
+
n(), s();
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function D(t) {
|
|
241
241
|
return Object.entries(t).map(([e, n]) => {
|
|
242
242
|
if (n == null) return;
|
|
243
|
-
const
|
|
243
|
+
const s = encodeURIComponent(e), r = encodeURIComponent(
|
|
244
244
|
typeof n == "object" ? JSON.stringify(n) : String(n)
|
|
245
245
|
// Use String() to handle all primitive types
|
|
246
246
|
);
|
|
247
|
-
return `${
|
|
247
|
+
return `${s}=${r}`;
|
|
248
248
|
}).filter((e) => e !== void 0).join("&");
|
|
249
249
|
}
|
|
250
250
|
function O(t) {
|
|
251
251
|
const e = t.slice(1);
|
|
252
252
|
return e ? e.split("&").filter(Boolean).reduce(
|
|
253
|
-
(
|
|
254
|
-
const [
|
|
255
|
-
return
|
|
253
|
+
(s, r) => {
|
|
254
|
+
const [i, o] = r.split("=");
|
|
255
|
+
return i && (s[decodeURIComponent(i)] = o ? decodeURIComponent(o) : ""), s;
|
|
256
256
|
},
|
|
257
257
|
{}
|
|
258
258
|
) : {};
|
|
259
259
|
}
|
|
260
|
-
async function
|
|
261
|
-
const
|
|
260
|
+
async function p(t, e) {
|
|
261
|
+
const n = JSON.stringify(t), s = new TextEncoder(), r = e ? m(e) : crypto.getRandomValues(new Uint8Array(32)), i = await crypto.subtle.importKey(
|
|
262
262
|
"raw",
|
|
263
263
|
r,
|
|
264
264
|
{ name: "AES-GCM" },
|
|
265
265
|
!1,
|
|
266
266
|
["encrypt"]
|
|
267
|
-
),
|
|
268
|
-
{ name: "AES-GCM", iv:
|
|
267
|
+
), o = crypto.getRandomValues(new Uint8Array(12)), c = await crypto.subtle.encrypt(
|
|
268
|
+
{ name: "AES-GCM", iv: o },
|
|
269
269
|
i,
|
|
270
|
-
|
|
270
|
+
s.encode(n)
|
|
271
271
|
);
|
|
272
272
|
return {
|
|
273
|
-
ciphertext: `${
|
|
274
|
-
key:
|
|
273
|
+
ciphertext: `${u(o)}-${u(c)}`,
|
|
274
|
+
key: u(r)
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
|
-
async function
|
|
278
|
-
const [n,
|
|
279
|
-
atob(e).split("").map((
|
|
280
|
-
),
|
|
277
|
+
async function f({ ciphertext: t, key: e }) {
|
|
278
|
+
const [n, s] = t.split("-"), r = new Uint8Array(
|
|
279
|
+
atob(e).split("").map((w) => w.charCodeAt(0))
|
|
280
|
+
), i = m(n), o = m(s), c = await crypto.subtle.importKey(
|
|
281
281
|
"raw",
|
|
282
|
-
|
|
282
|
+
r,
|
|
283
283
|
{ name: "AES-GCM" },
|
|
284
284
|
!1,
|
|
285
285
|
["decrypt"]
|
|
286
|
-
),
|
|
287
|
-
{ name: "AES-GCM", iv: new Uint8Array(
|
|
286
|
+
), h = new TextDecoder(), d = await crypto.subtle.decrypt(
|
|
287
|
+
{ name: "AES-GCM", iv: new Uint8Array(i) },
|
|
288
288
|
c,
|
|
289
289
|
o
|
|
290
290
|
);
|
|
291
|
-
return JSON.parse(
|
|
291
|
+
return JSON.parse(h.decode(d));
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function u(t) {
|
|
294
294
|
const e = new Uint8Array(t);
|
|
295
295
|
let n = "";
|
|
296
|
-
for (let
|
|
297
|
-
n += String.fromCharCode(e[
|
|
296
|
+
for (let s = 0; s < e.length; s++)
|
|
297
|
+
n += String.fromCharCode(e[s]);
|
|
298
298
|
return btoa(n);
|
|
299
299
|
}
|
|
300
300
|
function m(t) {
|
|
301
301
|
const e = atob(t), n = new Uint8Array(e.length);
|
|
302
|
-
for (let
|
|
303
|
-
n[
|
|
302
|
+
for (let s = 0; s < e.length; s++)
|
|
303
|
+
n[s] = e.charCodeAt(s);
|
|
304
304
|
return n;
|
|
305
305
|
}
|
|
306
|
-
|
|
306
|
+
async function M(t) {
|
|
307
|
+
const e = await fetch(t.url, {
|
|
308
|
+
method: "GET"
|
|
309
|
+
});
|
|
310
|
+
if (!e.ok)
|
|
311
|
+
throw new Error(`Failed to get connection: ${await e.text()}`);
|
|
312
|
+
const n = await e.json();
|
|
313
|
+
if (!n.id || !n.metadata || !n.status || !n.sealed)
|
|
314
|
+
throw new Error("Data missing from server response");
|
|
315
|
+
const s = {
|
|
316
|
+
id: n.id,
|
|
317
|
+
metadata: n.metadata,
|
|
318
|
+
status: n.status
|
|
319
|
+
};
|
|
320
|
+
if (n.status === "closed")
|
|
321
|
+
return s;
|
|
322
|
+
const r = n.sealed[n.sealed.length - 1], i = await f({
|
|
323
|
+
ciphertext: r,
|
|
324
|
+
key: t.key
|
|
325
|
+
});
|
|
326
|
+
return n.status === "completed" ? {
|
|
327
|
+
...s,
|
|
328
|
+
result: i.result
|
|
329
|
+
} : {
|
|
330
|
+
...s,
|
|
331
|
+
tx: i.tx
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
class S {
|
|
307
335
|
constructor(e) {
|
|
308
336
|
a(this, "endpoint");
|
|
309
337
|
this.endpoint = e;
|
|
@@ -315,25 +343,26 @@ class M {
|
|
|
315
343
|
* @returns Promise resolving to connection details including ID, version, and encryption key
|
|
316
344
|
*/
|
|
317
345
|
async create(e, n) {
|
|
318
|
-
const
|
|
346
|
+
const s = await p(e), r = {
|
|
319
347
|
metadata: n,
|
|
320
|
-
sealed:
|
|
321
|
-
},
|
|
348
|
+
sealed: s.ciphertext
|
|
349
|
+
}, i = await fetch(this.endpoint, {
|
|
322
350
|
method: "POST",
|
|
323
351
|
headers: {
|
|
324
352
|
"Content-Type": "application/json"
|
|
325
353
|
},
|
|
326
|
-
body: JSON.stringify(
|
|
354
|
+
body: JSON.stringify(r)
|
|
327
355
|
});
|
|
328
|
-
if (!
|
|
329
|
-
throw new Error(`Failed to create connection: ${await
|
|
330
|
-
const o = await
|
|
356
|
+
if (!i.ok)
|
|
357
|
+
throw new Error(`Failed to create connection: ${await i.text()}`);
|
|
358
|
+
const o = await i.json();
|
|
331
359
|
return {
|
|
332
360
|
id: o.id,
|
|
333
361
|
version: o.version,
|
|
362
|
+
status: o.status,
|
|
334
363
|
metadata: n,
|
|
335
364
|
data: e,
|
|
336
|
-
key:
|
|
365
|
+
key: s.key
|
|
337
366
|
};
|
|
338
367
|
}
|
|
339
368
|
/**
|
|
@@ -343,26 +372,28 @@ class M {
|
|
|
343
372
|
* @param version Current version number
|
|
344
373
|
* @returns Promise resolving to updated connection details including new encryption key
|
|
345
374
|
*/
|
|
346
|
-
async update(e, n, r) {
|
|
347
|
-
const
|
|
348
|
-
sealed:
|
|
349
|
-
version:
|
|
350
|
-
|
|
375
|
+
async update(e, n, s, r, i) {
|
|
376
|
+
const o = await p(n, i), c = {
|
|
377
|
+
sealed: o.ciphertext,
|
|
378
|
+
version: s,
|
|
379
|
+
status: r
|
|
380
|
+
}, h = await fetch(`${this.endpoint}/${e}`, {
|
|
351
381
|
method: "PATCH",
|
|
352
382
|
headers: {
|
|
353
383
|
"Content-Type": "application/json"
|
|
354
384
|
},
|
|
355
|
-
body: JSON.stringify(
|
|
385
|
+
body: JSON.stringify(c)
|
|
356
386
|
});
|
|
357
|
-
if (!
|
|
358
|
-
throw new Error(`Failed to update connection: ${await
|
|
359
|
-
const
|
|
387
|
+
if (!h.ok)
|
|
388
|
+
throw new Error(`Failed to update connection: ${await h.text()}`);
|
|
389
|
+
const d = await h.json();
|
|
360
390
|
return {
|
|
361
|
-
id:
|
|
362
|
-
metadata:
|
|
363
|
-
version:
|
|
391
|
+
id: d.id,
|
|
392
|
+
metadata: d.metadata,
|
|
393
|
+
version: d.version,
|
|
394
|
+
status: d.status,
|
|
364
395
|
data: n,
|
|
365
|
-
key:
|
|
396
|
+
key: o.key
|
|
366
397
|
};
|
|
367
398
|
}
|
|
368
399
|
/**
|
|
@@ -372,19 +403,20 @@ class M {
|
|
|
372
403
|
* @returns Promise resolving to connection details including decrypted data
|
|
373
404
|
*/
|
|
374
405
|
async get(e, n) {
|
|
375
|
-
const
|
|
406
|
+
const s = await fetch(`${this.endpoint}/${e}`, {
|
|
376
407
|
method: "GET"
|
|
377
408
|
});
|
|
378
|
-
if (!
|
|
379
|
-
throw new Error(`Failed to get connection: ${await
|
|
380
|
-
const
|
|
381
|
-
ciphertext:
|
|
409
|
+
if (!s.ok)
|
|
410
|
+
throw new Error(`Failed to get connection: ${await s.text()}`);
|
|
411
|
+
const r = await s.json(), i = r.sealed[r.sealed.length - 1], o = await f({
|
|
412
|
+
ciphertext: i,
|
|
382
413
|
key: n
|
|
383
414
|
});
|
|
384
415
|
return {
|
|
385
|
-
id:
|
|
386
|
-
|
|
387
|
-
|
|
416
|
+
id: r.id,
|
|
417
|
+
status: r.status,
|
|
418
|
+
version: r.version,
|
|
419
|
+
metadata: r.metadata,
|
|
388
420
|
data: o,
|
|
389
421
|
key: n
|
|
390
422
|
};
|
|
@@ -401,7 +433,7 @@ class M {
|
|
|
401
433
|
throw new Error(`Failed to close connection: ${await n.text()}`);
|
|
402
434
|
}
|
|
403
435
|
}
|
|
404
|
-
class
|
|
436
|
+
class k {
|
|
405
437
|
/**
|
|
406
438
|
* Creates a new instance of the Notabene SDK
|
|
407
439
|
*
|
|
@@ -425,15 +457,15 @@ class S {
|
|
|
425
457
|
* @returns component URL
|
|
426
458
|
* @internal
|
|
427
459
|
*/
|
|
428
|
-
componentUrl(e, n,
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
const o =
|
|
460
|
+
componentUrl(e, n, s, r) {
|
|
461
|
+
const i = new URL(this.uxUrl);
|
|
462
|
+
i.pathname = e;
|
|
463
|
+
const o = D({
|
|
432
464
|
authToken: this.authToken,
|
|
433
465
|
value: n,
|
|
434
|
-
configuration:
|
|
466
|
+
configuration: s
|
|
435
467
|
});
|
|
436
|
-
return
|
|
468
|
+
return i.hash = o, this.nodeUrl && i.searchParams.set("nodeUrl", this.nodeUrl), this.theme && i.searchParams.set("theme", JSON.stringify(this.theme)), this.locale && i.searchParams.set("locale", this.locale), r && (r.callback && i.searchParams.set("callback_url", r.callback), r.redirectUri && i.searchParams.set("redirect_uri", r.redirectUri)), i.toString();
|
|
437
469
|
}
|
|
438
470
|
/**
|
|
439
471
|
* Creates a new embedded component
|
|
@@ -445,11 +477,11 @@ class S {
|
|
|
445
477
|
* @returns A new EmbeddedComponent instance
|
|
446
478
|
* @internal
|
|
447
479
|
*/
|
|
448
|
-
createComponent(e, n,
|
|
449
|
-
return new
|
|
450
|
-
this.componentUrl(e, n,
|
|
480
|
+
createComponent(e, n, s, r) {
|
|
481
|
+
return new x(
|
|
482
|
+
this.componentUrl(e, n, s, r),
|
|
451
483
|
n,
|
|
452
|
-
|
|
484
|
+
s
|
|
453
485
|
);
|
|
454
486
|
}
|
|
455
487
|
/**
|
|
@@ -460,12 +492,12 @@ class S {
|
|
|
460
492
|
* @param callbacks - Optional callback configuration
|
|
461
493
|
* @returns A new EmbeddedComponent instance for withdrawal assistance
|
|
462
494
|
*/
|
|
463
|
-
createWithdrawalAssist(e, n,
|
|
495
|
+
createWithdrawalAssist(e, n, s) {
|
|
464
496
|
return this.createComponent(
|
|
465
497
|
"withdrawal-assist",
|
|
466
498
|
e,
|
|
467
499
|
n,
|
|
468
|
-
|
|
500
|
+
s
|
|
469
501
|
);
|
|
470
502
|
}
|
|
471
503
|
/**
|
|
@@ -477,12 +509,12 @@ class S {
|
|
|
477
509
|
* @returns A new EmbeddedComponent instance for connection
|
|
478
510
|
* @alpha
|
|
479
511
|
*/
|
|
480
|
-
createConnectWallet(e, n,
|
|
512
|
+
createConnectWallet(e, n, s) {
|
|
481
513
|
return this.createComponent(
|
|
482
514
|
"connect",
|
|
483
515
|
e,
|
|
484
516
|
n,
|
|
485
|
-
|
|
517
|
+
s
|
|
486
518
|
);
|
|
487
519
|
}
|
|
488
520
|
/**
|
|
@@ -494,12 +526,12 @@ class S {
|
|
|
494
526
|
* @returns A new EmbeddedComponent instance for deposit requests
|
|
495
527
|
* @public
|
|
496
528
|
*/
|
|
497
|
-
createDepositRequest(e, n,
|
|
529
|
+
createDepositRequest(e, n, s) {
|
|
498
530
|
return this.createComponent(
|
|
499
531
|
"deposit-request",
|
|
500
532
|
e,
|
|
501
533
|
n,
|
|
502
|
-
|
|
534
|
+
s
|
|
503
535
|
);
|
|
504
536
|
}
|
|
505
537
|
/**
|
|
@@ -511,28 +543,29 @@ class S {
|
|
|
511
543
|
* @returns A new EmbeddedComponent instance for deposit assistance
|
|
512
544
|
* @public
|
|
513
545
|
*/
|
|
514
|
-
createDepositAssist(e, n,
|
|
546
|
+
createDepositAssist(e, n, s) {
|
|
515
547
|
return this.createComponent(
|
|
516
548
|
"deposit-assist",
|
|
517
549
|
e,
|
|
518
550
|
n,
|
|
519
|
-
|
|
551
|
+
s
|
|
520
552
|
);
|
|
521
553
|
}
|
|
522
554
|
}
|
|
523
555
|
export {
|
|
524
556
|
A as AgentType,
|
|
525
557
|
l as CMType,
|
|
526
|
-
|
|
527
|
-
|
|
558
|
+
S as ConnectionManager,
|
|
559
|
+
x as EmbeddedComponent,
|
|
528
560
|
C as ErrorIdentifierCode,
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
561
|
+
E as HMType,
|
|
562
|
+
y as PersonType,
|
|
563
|
+
N as ProofStatus,
|
|
564
|
+
U as ProofTypes,
|
|
565
|
+
I as Status,
|
|
566
|
+
L as VASPSearchControl,
|
|
567
|
+
b as ValidationSections,
|
|
536
568
|
O as decodeFragmentToObject,
|
|
537
|
-
|
|
569
|
+
k as default,
|
|
570
|
+
M as getRefreshResult
|
|
538
571
|
};
|
package/dist/esm/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.9.0-next.
|
|
13
|
+
"version": "2.9.0-next.3",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
package/dist/notabene.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A blockchain account
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare interface Account {
|
|
6
|
+
did?: DID;
|
|
7
|
+
blockchainAddress?: BlockchainAddress;
|
|
8
|
+
chain?: CAIP2;
|
|
9
|
+
caip10?: CAIP10;
|
|
10
|
+
identifier?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
1
13
|
/**
|
|
2
14
|
* Address
|
|
3
15
|
* Represents a physical address
|
|
@@ -294,6 +306,7 @@ export declare interface ConnectionData<T extends ComponentRequest> {
|
|
|
294
306
|
tx: T;
|
|
295
307
|
authToken?: string;
|
|
296
308
|
txOptions?: TransactionOptions;
|
|
309
|
+
result?: TransactionResponse<T>;
|
|
297
310
|
}
|
|
298
311
|
|
|
299
312
|
/**
|
|
@@ -316,7 +329,7 @@ export declare class ConnectionManager {
|
|
|
316
329
|
* @param version Current version number
|
|
317
330
|
* @returns Promise resolving to updated connection details including new encryption key
|
|
318
331
|
*/
|
|
319
|
-
update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number): Promise<ConnectionResponse<T>>;
|
|
332
|
+
update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number, status: ConnectionStatus, key: string): Promise<ConnectionResponse<T>>;
|
|
320
333
|
/**
|
|
321
334
|
* Retrieves and decrypts connection data
|
|
322
335
|
* @param id Connection ID
|
|
@@ -354,11 +367,22 @@ export declare interface ConnectionRequest extends ComponentRequest {
|
|
|
354
367
|
export declare interface ConnectionResponse<T extends ComponentRequest> {
|
|
355
368
|
id: UUID;
|
|
356
369
|
version: number;
|
|
370
|
+
status: ConnectionStatus;
|
|
357
371
|
metadata: ConnectionMetadata;
|
|
358
372
|
data: ConnectionData<T>;
|
|
359
373
|
key: string;
|
|
360
374
|
}
|
|
361
375
|
|
|
376
|
+
export declare interface ConnectionResult<T extends ComponentRequest> {
|
|
377
|
+
id: UUID;
|
|
378
|
+
metadata: ConnectionMetadata;
|
|
379
|
+
status: ConnectionStatus;
|
|
380
|
+
tx?: T;
|
|
381
|
+
result?: TransactionResponse<T>;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export declare type ConnectionStatus = 'active' | 'completed' | 'closed';
|
|
385
|
+
|
|
362
386
|
/**
|
|
363
387
|
* The counterparty of a transaction.
|
|
364
388
|
* @public
|
|
@@ -642,6 +666,8 @@ export declare type FieldTypes = {
|
|
|
642
666
|
legalPerson?: LegalPersonFields;
|
|
643
667
|
};
|
|
644
668
|
|
|
669
|
+
export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: RefreshSource): Promise<ConnectionResult<T>>;
|
|
670
|
+
|
|
645
671
|
/**
|
|
646
672
|
* Host Message Type enum representing different message types that can be sent
|
|
647
673
|
* from the host application.
|
|
@@ -1352,7 +1378,7 @@ declare interface Refreshable {
|
|
|
1352
1378
|
refreshSource?: RefreshSource;
|
|
1353
1379
|
}
|
|
1354
1380
|
|
|
1355
|
-
declare interface RefreshSource {
|
|
1381
|
+
export declare interface RefreshSource {
|
|
1356
1382
|
url: URI;
|
|
1357
1383
|
key: string;
|
|
1358
1384
|
}
|
|
@@ -1485,6 +1511,7 @@ export declare interface Transaction extends ComponentRequest {
|
|
|
1485
1511
|
price: number;
|
|
1486
1512
|
currency: ISOCurrency;
|
|
1487
1513
|
};
|
|
1514
|
+
account?: Account;
|
|
1488
1515
|
}
|
|
1489
1516
|
|
|
1490
1517
|
/**
|