@notabene/javascript-sdk 2.0.0-next.16 → 2.0.0-next.18
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 +44 -24
- package/dist/notabene.cjs +1 -1
- package/dist/notabene.d.ts +44 -44
- package/dist/notabene.js +52 -30
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +21 -20
- package/src/components/EmbeddedComponent.ts +30 -20
- package/src/components/__tests__/EmbeddedComponent.test.ts +64 -39
- package/src/notabene.ts +29 -23
- package/src/types.ts +26 -28
- package/src/utils/MessageEventManager.ts +7 -7
- package/src/utils/__tests__/MessageEventManager.test.ts +12 -4
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ Create a new Notabene instance:
|
|
|
83
83
|
const notabene = new Notabene({
|
|
84
84
|
nodeUrl: 'https://api.notabene.id', // use `https://api.notabene.dev` for testing
|
|
85
85
|
authToken: '{CUSTOMER_TOKEN}',
|
|
86
|
-
locale: 'de' // default locale = `en`
|
|
86
|
+
locale: 'de', // default locale = `en`
|
|
87
87
|
});
|
|
88
88
|
```
|
|
89
89
|
|
|
@@ -107,19 +107,20 @@ Instantiate the withdrawal element and mount it using the id from above
|
|
|
107
107
|
|
|
108
108
|
```js
|
|
109
109
|
const withdrawal = notabene.createWithdrawalAssist(tx, options);
|
|
110
|
-
withdrawal.mount(
|
|
110
|
+
withdrawal.mount('nb-withdrawal');
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
The simplest way to get the result is to use:
|
|
114
114
|
|
|
115
115
|
```js
|
|
116
116
|
try {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
const { valid, value, txCreate, ivms101, proof } =
|
|
118
|
+
await withdrawal.completion();
|
|
119
|
+
if (valid) {
|
|
120
|
+
// Submit result to your backend
|
|
121
|
+
}
|
|
121
122
|
} catch (e) {
|
|
122
|
-
|
|
123
|
+
console.error(e);
|
|
123
124
|
}
|
|
124
125
|
```
|
|
125
126
|
|
|
@@ -131,7 +132,7 @@ To update the component as users enter transaction details:
|
|
|
131
132
|
withdrawal.update({
|
|
132
133
|
asset: 'ETH',
|
|
133
134
|
destination: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
|
|
134
|
-
amountDecimal: 1.12
|
|
135
|
+
amountDecimal: 1.12,
|
|
135
136
|
});
|
|
136
137
|
```
|
|
137
138
|
|
|
@@ -218,13 +219,12 @@ The `asset` field the following types of assets specified:
|
|
|
218
219
|
- [CAIP-19](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-19.md_) is a chain agnostic format allows you to support the widest amount of assets and blockchains including NFTs.
|
|
219
220
|
- [DTI](https://www.iso.org/standard/80601.html) is the ISO Digital Token Identifier format. See [DTI registry](https://dtif.org/registry-search/) for supported tokens.
|
|
220
221
|
|
|
221
|
-
|
|
222
222
|
### Modal
|
|
223
223
|
|
|
224
224
|
Instantiate the modal and open it
|
|
225
225
|
|
|
226
226
|
```js
|
|
227
|
-
const connect = notabene.createConnectWallet({asset:'ETH'}, options);
|
|
227
|
+
const connect = notabene.createConnectWallet({ asset: 'ETH' }, options);
|
|
228
228
|
const { valid, value, txCreate, ivms101, proof } = await connect.openModal();
|
|
229
229
|
```
|
|
230
230
|
|
|
@@ -269,10 +269,10 @@ The following shows the full set of options in typescript:
|
|
|
269
269
|
|
|
270
270
|
```ts
|
|
271
271
|
import Notabene, {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
272
|
+
AgentType,
|
|
273
|
+
PersonType,
|
|
274
|
+
ProofTypes,
|
|
275
|
+
} from '@notabene/javascript-sdk';
|
|
276
276
|
|
|
277
277
|
const options: TransactionOptions = {
|
|
278
278
|
proofs: {
|
|
@@ -313,13 +313,32 @@ const options: TransactionOptions = {
|
|
|
313
313
|
},
|
|
314
314
|
vasps: {
|
|
315
315
|
addUnknown: true, // Allow users to add a missing VASP - Defaults to false
|
|
316
|
-
onlyActive: true // Only list active VASPs - Default false
|
|
317
|
-
}
|
|
316
|
+
onlyActive: true, // Only list active VASPs - Default false
|
|
317
|
+
},
|
|
318
318
|
},
|
|
319
319
|
};
|
|
320
320
|
const withdrawal = notabene.createWithdrawalAssist(tx, options);
|
|
321
321
|
```
|
|
322
322
|
|
|
323
|
+
The options can additionally be updated dynamically with the `update()` function.
|
|
324
|
+
|
|
325
|
+
```js
|
|
326
|
+
withdrawal.update({
|
|
327
|
+
asset: 'ETH',
|
|
328
|
+
destination: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
|
|
329
|
+
amountDecimal: 1.12,
|
|
330
|
+
}, {
|
|
331
|
+
proofs: {
|
|
332
|
+
microTransfer: {
|
|
333
|
+
destination: '0x...',
|
|
334
|
+
amountSubunits: '12344',
|
|
335
|
+
timeout: 86440,
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
|
|
323
342
|
### Common use cases
|
|
324
343
|
|
|
325
344
|
#### Only allow first party transactions
|
|
@@ -352,7 +371,6 @@ const options: TransactionOptions = {
|
|
|
352
371
|
|
|
353
372
|
By default components support message signing proofs.
|
|
354
373
|
|
|
355
|
-
|
|
356
374
|
#### Supporting Micro Transactions (aka Satoshi tests)
|
|
357
375
|
|
|
358
376
|
You can support Micro Transfers (aka Satoshi tests) by adding a deposit address for the test.
|
|
@@ -368,8 +386,8 @@ const options: TransactionOptions = {
|
|
|
368
386
|
timeout: 86440, // Optional timeout in seconds, which is displayed to the user
|
|
369
387
|
},
|
|
370
388
|
fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
|
|
371
|
-
}
|
|
372
|
-
}
|
|
389
|
+
},
|
|
390
|
+
};
|
|
373
391
|
```
|
|
374
392
|
|
|
375
393
|
Notabene does not currently verify these tests automatically as you likely already have the infrastructure to do so.
|
|
@@ -396,9 +414,10 @@ You may accept a few options if none of the other are available. We do not recom
|
|
|
396
414
|
const options: TransactionOptions = {
|
|
397
415
|
proofs: {
|
|
398
416
|
fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
|
|
399
|
-
}
|
|
400
|
-
}
|
|
417
|
+
},
|
|
418
|
+
};
|
|
401
419
|
```
|
|
420
|
+
|
|
402
421
|
The two options are:
|
|
403
422
|
|
|
404
423
|
- `screenshot` Where a user is requested to upload a screenshot of their wallet
|
|
@@ -418,6 +437,7 @@ Each field can be configured like this:
|
|
|
418
437
|
- `{ transmit: true }` Include in beneficiary field of IVMS101 to be transmitted to counterparty
|
|
419
438
|
|
|
420
439
|
Eg:
|
|
440
|
+
|
|
421
441
|
```ts
|
|
422
442
|
{
|
|
423
443
|
naturalPerson: {
|
|
@@ -427,13 +447,13 @@ Eg:
|
|
|
427
447
|
}
|
|
428
448
|
}
|
|
429
449
|
```
|
|
450
|
+
|
|
430
451
|
The above will always ask the user for the following for natural persons:
|
|
431
452
|
|
|
432
453
|
- `name` since it is on by default (you can disable it explicitly by setting it to `false`)
|
|
433
454
|
- `website` is show but is optional
|
|
434
455
|
- `email` is required
|
|
435
456
|
|
|
436
|
-
|
|
437
457
|
#### Full Example
|
|
438
458
|
|
|
439
459
|
```ts
|
|
@@ -447,7 +467,7 @@ const options: TransactionOptions = {
|
|
|
447
467
|
geographicAddress: false,
|
|
448
468
|
nationalIdentification: false,
|
|
449
469
|
dateOfBirth: {
|
|
450
|
-
transmit: true
|
|
470
|
+
transmit: true,
|
|
451
471
|
},
|
|
452
472
|
placeOfBirth: false,
|
|
453
473
|
countryOfResidence: true,
|
|
@@ -469,7 +489,7 @@ const options: TransactionOptions = {
|
|
|
469
489
|
#### Field reference
|
|
470
490
|
|
|
471
491
|
| Field name | Natural | Legal | IVMS101 | Transmitted | description |
|
|
472
|
-
|
|
492
|
+
| ------------------------ | ------- | ----- | ------- | ----------- | --------------------------------------------- |
|
|
473
493
|
| `name` | ✅ | ✅ | ✅ | ✅ | Full name |
|
|
474
494
|
| `email` | 🟩 | 🟩 | -- | -- | Email (for your internal purposes) |
|
|
475
495
|
| `website` | -- | ✅ | -- | -- | Business Website (for your internal purposes) |
|
package/dist/notabene.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var v=(t,e,s)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var o=(t,e,s)=>v(t,typeof e!="symbol"?e+"":e,s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var d=(t=>(t.PRIVATE="WALLET",t.VASP="VASP",t))(d||{}),c=(t=>(t.NATURAL="natural",t.LEGAL="legal",t.SELF="self",t))(c||{}),m=(t=>(t.EMPTY="empty",t.VERIFY="verify",t.PENDING="pending",t.VERIFIED="verified",t.BANNED="banned",t))(m||{}),a=(t=>(t.COMPLETE="complete",t.RESIZE="resize",t.RESULT="result",t.READY="ready",t.INVALID="invalid",t.ERROR="error",t.CANCEL="cancel",t))(a||{}),u=(t=>(t.UPDATE="update",t.REQUEST_RESPONSE="requestResponse",t))(u||{}),p=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(p||{}),f=(t=>(t.SelfDeclaration="self-declaration",t.PersonalSignEIP191="eip-191",t.SIWE="siwe",t.PersonalSignEIP712="eip-712",t.PersonalSignBIP137="bip-137",t.PersonalSignXPUB="xpub",t.MicroTransfer="microtransfer",t.Screenshot="screenshot",t))(f||{});class b{constructor(){o(this,"listeners",new Map);o(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(e){this.port=e,this.port.onmessage=this.handleMessage,this.port.start()}on(e,s){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(s)}off(e,s){const r=this.listeners.get(e);r&&(r.delete(s),r.size===0&&this.listeners.delete(e))}handleMessage(e){const s=e.data;if(typeof s=="object"&&s!==null&&"type"in s){const r=s.type,i=this.listeners.get(r);i&&i.forEach(n=>n(s))}}send(e){this.port&&this.port.postMessage(e)}}class E{constructor(e,s,r){o(this,"_url");o(this,"_value");o(this,"_options");o(this,"_errors",[]);o(this,"iframe");o(this,"eventManager");o(this,"modal");this._url=e,this._value=s,this._options=r,this.eventManager=new b,this.on(a.INVALID,i=>{i.type===a.INVALID&&(this._errors=i.errors,this._value=i.value)}),this.on(a.RESIZE,i=>{i.type===a.RESIZE&&this.iframe&&(this.iframe.style.height=`${i.height}px`)})}get url(){return this._url}get value(){return this._value}get options(){return this._options}get errors(){return this._errors}open(){document.location.href=this.url}mount(e){const s=document.querySelector(e);if(!s)throw new Error(`parentID ${e} not found`);this.embed(s)}embed(e,s=!1){var r,i;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(s?"":"&embedded=true"),this.iframe.allow="web-share",this.iframe.style.width="100%",this.iframe.style.height="100px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",e.appendChild(this.iframe),window.addEventListener("message",n=>{var h,l;n.source===((h=this.iframe)==null?void 0:h.contentWindow)&&((l=this.eventManager)==null||l.setPort(n.ports[0]))}),(i=(r=this.iframe)==null?void 0:r.contentWindow)==null||i.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(e){this.eventManager.send(e)}on(e,s){this.eventManager.on(e,s)}off(e,s){this.eventManager.off(e,s)}update(e,s){this._value=e,s&&(this._options=s),this.send({type:u.UPDATE,value:e,options:this._options})}completion(){return new Promise((e,s)=>{this.on(a.COMPLETE,r=>{e(r.response)}),this.on("error",r=>{s(new Error(r.message))})})}openModal(){return 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),this.on(a.CANCEL,()=>{this.closeModal()}),this.on(a.COMPLETE,()=>{this.closeModal()}),this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion()}closeModal(){var e;this.modal&&((e=this.modal)==null||e.close(),this.modal.remove(),this.modal=void 0)}}function w(t){return Object.entries(t).map(([e,s])=>{if(!(e&&s))return;const r=encodeURIComponent(e),i=encodeURIComponent(typeof s=="object"?JSON.stringify(s):s);return`${r}=${i}`}).filter(e=>!!e).join("&")}class I{constructor(e){o(this,"nodeUrl");o(this,"authToken");o(this,"uxUrl");o(this,"theme");o(this,"locale");this.uxUrl=e.uxUrl||"https://connect.notabene.id",this.nodeUrl=e.nodeUrl,this.authToken=e.authToken,this.theme=e.theme,this.locale=e.locale}componentUrl(e,s,r,i){const n=new URL(this.uxUrl);n.pathname=e;const h=w({authToken:this.authToken,value:s,configuration:r});return n.hash=h,this.nodeUrl&&n.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&n.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&n.searchParams.set("locale",this.locale),i&&(i.callback&&n.searchParams.set("callback_url",i.callback),i.redirectUri&&n.searchParams.set("redirect_uri",i.redirectUri)),n.toString()}createComponent(e,s,r,i){return new E(this.componentUrl(e,s,r,i),s,r)}createWithdrawalAssist(e,s,r){return this.createComponent("withdrawal-assist",e,s,r)}createWalletAssist(e,s,r){return this.createComponent("wallet-assist",e,s,r)}createDepositAssist(e,s,r){return this.createComponent("deposit-assist",e,s,r)}createConnectWallet(e,s,r){return this.createComponent("connect",e,s,r)}createDepositRequest(e,s,r){return this.createComponent("deposit-request",e,s,r)}decodeFragmentToObject(e){return e.slice(1).split("&").reduce((r,i)=>{const[n,h]=i.split("=");return r[decodeURIComponent(n)]=decodeURIComponent(h),r},{})}}exports.AgentType=d;exports.CMType=a;exports.EmbeddedComponent=E;exports.PersonType=c;exports.ProofStatus=p;exports.ProofTypes=f;exports.Status=m;exports.default=I;
|
package/dist/notabene.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ export declare interface CallbackOptions {
|
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* Represents a cancel component message
|
|
144
|
-
* @
|
|
144
|
+
* @internal
|
|
145
145
|
*/
|
|
146
146
|
declare type Cancel = {
|
|
147
147
|
type: CMType.CANCEL;
|
|
@@ -157,26 +157,26 @@ export declare const enum CMType {
|
|
|
157
157
|
RESULT = "result",
|
|
158
158
|
READY = "ready",
|
|
159
159
|
INVALID = "invalid",
|
|
160
|
-
MODAL = "openModal",
|
|
161
160
|
ERROR = "error",
|
|
162
|
-
CLOSE = "closeModal",
|
|
163
161
|
CANCEL = "cancel"
|
|
164
162
|
}
|
|
165
163
|
|
|
166
164
|
/**
|
|
167
165
|
* Represents a completed component message
|
|
166
|
+
* @typeParam T - The overall Value type being returned
|
|
167
|
+
* @param response - The Response object which wraps T
|
|
168
168
|
* @public
|
|
169
169
|
*/
|
|
170
|
-
declare type Completed = {
|
|
170
|
+
declare type Completed<T> = {
|
|
171
171
|
type: CMType.COMPLETE;
|
|
172
|
-
response:
|
|
172
|
+
response: TransactionResponse<T>;
|
|
173
173
|
};
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
176
|
* Component Message
|
|
177
177
|
* @public
|
|
178
178
|
*/
|
|
179
|
-
export declare type ComponentMessage = Completed | Cancel | Error_2 | Ready | ResizeRequest | InvalidValue
|
|
179
|
+
export declare type ComponentMessage<T> = Completed<T> | Cancel | Error_2 | Ready | ResizeRequest | InvalidValue<T>;
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
182
|
* An abstract request for communicating with a component
|
|
@@ -202,17 +202,6 @@ export declare interface ConnectionRequest extends ComponentRequest {
|
|
|
202
202
|
asset: TransactionAsset;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
/**
|
|
206
|
-
* An object representing a connection response
|
|
207
|
-
* @public
|
|
208
|
-
*/
|
|
209
|
-
export declare interface ConnectionResponse extends ComponentResponse {
|
|
210
|
-
value: ConnectionRequest;
|
|
211
|
-
ivms: IVMS101;
|
|
212
|
-
proof?: OwnershipProof;
|
|
213
|
-
txCreate?: V1Transaction;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
205
|
/**
|
|
217
206
|
* The counterparty of a transaction.
|
|
218
207
|
* @public
|
|
@@ -304,9 +293,10 @@ declare type DTI = string;
|
|
|
304
293
|
* An embedded Notabene component
|
|
305
294
|
* @public
|
|
306
295
|
*/
|
|
307
|
-
export declare class EmbeddedComponent<V,
|
|
296
|
+
export declare class EmbeddedComponent<V, O> {
|
|
308
297
|
private _url;
|
|
309
298
|
private _value;
|
|
299
|
+
private _options?;
|
|
310
300
|
private _errors;
|
|
311
301
|
private iframe?;
|
|
312
302
|
private eventManager;
|
|
@@ -316,7 +306,7 @@ export declare class EmbeddedComponent<V, R> {
|
|
|
316
306
|
* @param url - The URL of the embedded component
|
|
317
307
|
* @param value - The initial transaction value
|
|
318
308
|
*/
|
|
319
|
-
constructor(url: string, value: V);
|
|
309
|
+
constructor(url: string, value: Partial<V>, options?: O);
|
|
320
310
|
/**
|
|
321
311
|
* Gets the URL of the embedded component
|
|
322
312
|
* @returns The URL of the embedded component
|
|
@@ -326,7 +316,8 @@ export declare class EmbeddedComponent<V, R> {
|
|
|
326
316
|
* Gets the current transaction value
|
|
327
317
|
* @returns The current transaction value
|
|
328
318
|
*/
|
|
329
|
-
get value(): V
|
|
319
|
+
get value(): Partial<V>;
|
|
320
|
+
get options(): O | undefined;
|
|
330
321
|
get errors(): ValidationError[];
|
|
331
322
|
/**
|
|
332
323
|
* Opens the component URL in the current window
|
|
@@ -343,37 +334,38 @@ export declare class EmbeddedComponent<V, R> {
|
|
|
343
334
|
* @param parent - The parent element to embed the component into
|
|
344
335
|
*/
|
|
345
336
|
embed(parent: Element, modal?: boolean): void;
|
|
337
|
+
removeEmbed(): void;
|
|
346
338
|
/**
|
|
347
339
|
* Sends a message to the embedded component
|
|
348
340
|
* @param message - The message to send
|
|
349
341
|
*/
|
|
350
|
-
send(message: HostMessage): void;
|
|
342
|
+
send(message: HostMessage<V, O>): void;
|
|
351
343
|
/**
|
|
352
344
|
* Adds an event listener for a specific message type
|
|
353
345
|
* @param messageType - The type of message to listen for
|
|
354
346
|
* @param callback - The callback function to execute when the message is received
|
|
355
347
|
*/
|
|
356
|
-
on(messageType: string, callback: MessageCallback): void;
|
|
348
|
+
on(messageType: string, callback: MessageCallback<V>): void;
|
|
357
349
|
/**
|
|
358
350
|
* Removes an event listener for a specific message type
|
|
359
351
|
* @param messageType - The type of message to stop listening for
|
|
360
352
|
* @param callback - The callback function to remove
|
|
361
353
|
*/
|
|
362
|
-
off(messageType: string, callback: MessageCallback): void;
|
|
354
|
+
off(messageType: string, callback: MessageCallback<V>): void;
|
|
363
355
|
/**
|
|
364
356
|
* Updates the transaction value and sends an update message to the component
|
|
365
357
|
* @param value - The new transaction value
|
|
366
358
|
*/
|
|
367
|
-
update(value: V): void;
|
|
359
|
+
update(value: Partial<V>, options?: O): void;
|
|
368
360
|
/**
|
|
369
361
|
* Waits for the component to complete and returns the transaction response
|
|
370
362
|
* @returns A promise that resolves with the transaction response
|
|
371
363
|
*/
|
|
372
|
-
completion(): Promise<
|
|
364
|
+
completion(): Promise<TransactionResponse<V>>;
|
|
373
365
|
/**
|
|
374
366
|
* Opens the component in a modal dialog
|
|
375
367
|
*/
|
|
376
|
-
openModal(): Promise<
|
|
368
|
+
openModal(): Promise<TransactionResponse<V>>;
|
|
377
369
|
/**
|
|
378
370
|
* Closes the modal dialog
|
|
379
371
|
*
|
|
@@ -383,6 +375,7 @@ export declare class EmbeddedComponent<V, R> {
|
|
|
383
375
|
|
|
384
376
|
/**
|
|
385
377
|
* Represents an error component message
|
|
378
|
+
* @param message - Error message
|
|
386
379
|
* @public
|
|
387
380
|
*/
|
|
388
381
|
declare type Error_2 = {
|
|
@@ -417,7 +410,7 @@ declare const enum HMType {
|
|
|
417
410
|
* Host Messages
|
|
418
411
|
* @public
|
|
419
412
|
*/
|
|
420
|
-
export declare type HostMessage = UpdateValue
|
|
413
|
+
export declare type HostMessage<T, O> = UpdateValue<T, O>;
|
|
421
414
|
|
|
422
415
|
/**
|
|
423
416
|
* Intermediary VASP
|
|
@@ -433,11 +426,14 @@ declare type IntermediaryVASP = {
|
|
|
433
426
|
|
|
434
427
|
/**
|
|
435
428
|
* Represents an invalid value component message
|
|
436
|
-
* @
|
|
429
|
+
* @typeParam T - The overall Value type being returned
|
|
430
|
+
* @param value - The current Partial value
|
|
431
|
+
* @param errors - Array of validation errors
|
|
432
|
+
* @internal
|
|
437
433
|
*/
|
|
438
|
-
declare type InvalidValue = {
|
|
434
|
+
declare type InvalidValue<T> = {
|
|
439
435
|
type: CMType.INVALID;
|
|
440
|
-
value:
|
|
436
|
+
value: Partial<T>;
|
|
441
437
|
errors: ValidationError[];
|
|
442
438
|
};
|
|
443
439
|
|
|
@@ -573,7 +569,7 @@ declare type LocalNaturalPersonNameID = {
|
|
|
573
569
|
nameIdentifierType?: NaturalPersonNameTypeCode;
|
|
574
570
|
};
|
|
575
571
|
|
|
576
|
-
declare type MessageCallback = (message: ComponentMessage) => void;
|
|
572
|
+
declare type MessageCallback<T> = (message: ComponentMessage<T>) => void;
|
|
577
573
|
|
|
578
574
|
/**
|
|
579
575
|
* Ownership Proof using Micro Transfer
|
|
@@ -710,7 +706,7 @@ declare class Notabene {
|
|
|
710
706
|
* @returns component URL
|
|
711
707
|
* @internal
|
|
712
708
|
*/
|
|
713
|
-
componentUrl<V>(path: string, value: V, configuration?:
|
|
709
|
+
componentUrl<V, O>(path: string, value: V, configuration?: O, callbacks?: CallbackOptions): string;
|
|
714
710
|
/**
|
|
715
711
|
* Creates a new embedded component
|
|
716
712
|
*
|
|
@@ -721,7 +717,7 @@ declare class Notabene {
|
|
|
721
717
|
* @returns A new EmbeddedComponent instance
|
|
722
718
|
* @internal
|
|
723
719
|
*/
|
|
724
|
-
createComponent<V,
|
|
720
|
+
createComponent<V, O>(path: string, value: Partial<V>, options?: O, callbacks?: CallbackOptions): EmbeddedComponent<V, O>;
|
|
725
721
|
/**
|
|
726
722
|
* Creates a withdrawal assist component
|
|
727
723
|
*
|
|
@@ -730,7 +726,7 @@ declare class Notabene {
|
|
|
730
726
|
* @param callbacks - Optional callback configuration
|
|
731
727
|
* @returns A new EmbeddedComponent instance for withdrawal assistance
|
|
732
728
|
*/
|
|
733
|
-
createWithdrawalAssist(value: Partial<Withdrawal>, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<
|
|
729
|
+
createWithdrawalAssist(value: Partial<Withdrawal>, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<Withdrawal, TransactionOptions>;
|
|
734
730
|
/**
|
|
735
731
|
* Creates a wallet assist component
|
|
736
732
|
*
|
|
@@ -740,7 +736,7 @@ declare class Notabene {
|
|
|
740
736
|
* @returns A new EmbeddedComponent instance for withdrawal assistance
|
|
741
737
|
* @alpha
|
|
742
738
|
*/
|
|
743
|
-
createWalletAssist(value: Partial<Withdrawal>, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<
|
|
739
|
+
createWalletAssist(value: Partial<Withdrawal>, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<Withdrawal, TransactionOptions>;
|
|
744
740
|
/**
|
|
745
741
|
* Creates a deposit assist component
|
|
746
742
|
*
|
|
@@ -750,7 +746,7 @@ declare class Notabene {
|
|
|
750
746
|
* @returns A new EmbeddedComponent instance for deposit assistance
|
|
751
747
|
* @alpha
|
|
752
748
|
*/
|
|
753
|
-
createDepositAssist(value: Partial<Deposit>, options?: any, callbacks?: CallbackOptions): EmbeddedComponent<
|
|
749
|
+
createDepositAssist(value: Partial<Deposit>, options?: any, callbacks?: CallbackOptions): EmbeddedComponent<Deposit, any>;
|
|
754
750
|
/**
|
|
755
751
|
* Creates a connect component
|
|
756
752
|
*
|
|
@@ -760,7 +756,7 @@ declare class Notabene {
|
|
|
760
756
|
* @returns A new EmbeddedComponent instance for connection
|
|
761
757
|
* @alpha
|
|
762
758
|
*/
|
|
763
|
-
createConnectWallet(value: ConnectionRequest, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<ConnectionRequest,
|
|
759
|
+
createConnectWallet(value: ConnectionRequest, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<ConnectionRequest, TransactionOptions>;
|
|
764
760
|
/**
|
|
765
761
|
* Creates a deposit request component
|
|
766
762
|
*
|
|
@@ -770,7 +766,7 @@ declare class Notabene {
|
|
|
770
766
|
* @returns A new EmbeddedComponent instance for deposit requests
|
|
771
767
|
* @public
|
|
772
768
|
*/
|
|
773
|
-
createDepositRequest(value: DepositRequest, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<DepositRequest,
|
|
769
|
+
createDepositRequest(value: DepositRequest, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<DepositRequest, TransactionOptions>;
|
|
774
770
|
/**
|
|
775
771
|
* Decodes a URL fragment into an object
|
|
776
772
|
*
|
|
@@ -923,6 +919,7 @@ export declare enum ProofStatus {
|
|
|
923
919
|
export declare enum ProofTypes {
|
|
924
920
|
SelfDeclaration = "self-declaration",
|
|
925
921
|
PersonalSignEIP191 = "eip-191",
|
|
922
|
+
SIWE = "siwe",
|
|
926
923
|
PersonalSignEIP712 = "eip-712",
|
|
927
924
|
PersonalSignBIP137 = "bip-137",
|
|
928
925
|
PersonalSignXPUB = "xpub",
|
|
@@ -941,8 +938,8 @@ declare type Ready = {
|
|
|
941
938
|
declare type RequestID = UUID;
|
|
942
939
|
|
|
943
940
|
/**
|
|
944
|
-
* Represents a resize request component message
|
|
945
|
-
* @
|
|
941
|
+
* Represents a resize request component message. This is handled by the library.
|
|
942
|
+
* @internal
|
|
946
943
|
*/
|
|
947
944
|
declare type ResizeRequest = {
|
|
948
945
|
type: CMType.RESIZE;
|
|
@@ -963,7 +960,7 @@ export declare interface ScreenshotProof extends OwnershipProof {
|
|
|
963
960
|
* @public
|
|
964
961
|
*/
|
|
965
962
|
export declare interface SignatureProof extends OwnershipProof {
|
|
966
|
-
type: ProofTypes.PersonalSignEIP191 | ProofTypes.PersonalSignEIP712 | ProofTypes.PersonalSignBIP137 | ProofTypes.PersonalSignXPUB;
|
|
963
|
+
type: ProofTypes.PersonalSignEIP191 | ProofTypes.PersonalSignEIP712 | ProofTypes.PersonalSignBIP137 | ProofTypes.SIWE | ProofTypes.PersonalSignXPUB;
|
|
967
964
|
proof: string;
|
|
968
965
|
attestation: string;
|
|
969
966
|
wallet_provider: string;
|
|
@@ -1074,12 +1071,15 @@ declare type TransliterationMethodCode = 'arab' | 'aran' | 'armn' | 'cyrl' | 'de
|
|
|
1074
1071
|
declare type TravelAddress = `ta${string}`;
|
|
1075
1072
|
|
|
1076
1073
|
/**
|
|
1077
|
-
* Represents an update value host message
|
|
1074
|
+
* Represents an update value host message. This is sent from Host to component.
|
|
1075
|
+
* @typeParam T - The overall Value type being sent
|
|
1076
|
+
* @typeParam O - The Option type being sent
|
|
1078
1077
|
* @public
|
|
1079
1078
|
*/
|
|
1080
|
-
declare type UpdateValue = {
|
|
1079
|
+
declare type UpdateValue<T, O> = {
|
|
1081
1080
|
type: HMType.UPDATE;
|
|
1082
|
-
value:
|
|
1081
|
+
value: Partial<T>;
|
|
1082
|
+
options?: O;
|
|
1083
1083
|
};
|
|
1084
1084
|
|
|
1085
1085
|
/**
|