@notabene/javascript-sdk 2.0.0-next.8 → 2.0.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/README.md CHANGED
@@ -2,54 +2,104 @@
2
2
 
3
3
  <img src="https://assets-global.website-files.com/5e68f0772de982756aa8c1a4/5eee5fb470215e6ecdc34b94_Full_transparent_black_1280x413.svg" height=50>
4
4
  <br>
5
-
6
- # JavaScript SDK
5
+ # Notabene SafeConnect Components JavaScript SDK
7
6
 
8
7
  [![pipeline status](https://gitlab.com/notabene/open-source/javascript-sdk/badges/master/pipeline.svg)](https://gitlab.com/notabene/open-source/javascript-sdk/-/commits/master)
9
- [![Latest Release](https://gitlab.com/notabene/open-source/javascript-sdk/-/badges/release.svg)](https://gitlab.com/notabene/open-source/javascript-sdk/-/releases)
8
+ [![npm version](https://img.shields.io/npm/v/@notabene/javascript-sdk.svg)](https://www.npmjs.com/package/@notabene/javascript-sdk)
9
+ [![npm downloads](https://img.shields.io/npm/dm/@notabene/javascript-sdk.svg)](https://www.npmjs.com/package/@notabene/javascript-sdk)
10
+ [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@notabene/javascript-sdk)](https://bundlephobia.com/package/@notabene/javascript-sdk)
11
+ [![Types](https://img.shields.io/npm/types/@notabene/javascript-sdk)](https://www.npmjs.com/package/@notabene/javascript-sdk)
12
+ [![License](https://img.shields.io/npm/l/@notabene/javascript-sdk)](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/main/LICENSE.md)
13
+ [![Dependencies](https://img.shields.io/librariesio/release/npm/@notabene/javascript-sdk)](https://libraries.io/npm/@notabene%2Fjavascript-sdk)
10
14
 
11
15
  This library is the JavaScript SDK for loading the Notabene UX components in the front-end.
12
16
 
13
- [Documentation](https://devx.notabene.id/docs/embedded=ux)
14
- [Installation](#installation)
17
+ [Additional Documentation](https://devx.notabene.id/docs/embedded=ux)
15
18
 
16
19
  </div>
17
20
 
18
- - [JavaScript SDK](#javascript-sdk)
19
- - [Installation](#installation)
20
- - [Usage](#usage)
21
- - [Authentication](#authentication)
21
+ ## Table of Contents
22
+
23
+ - [Installation](#installation)
24
+ - [Quick Start](#quick-start)
25
+ - [Core Concepts](#core-concepts)
26
+ - [Authentication](#authentication)
27
+ - [General Component Usage](#general-component-usage)
28
+ - [Embedded Component](#embedded-component)
29
+ - [Dynamic updates](#dynamic-updates)
30
+ - [Modal](#modal)
31
+ - [Linked Component](#linked-component)
32
+ - [Components](#components)
22
33
  - [Assisted Withdrawal](#assisted-withdrawal)
23
- - [Embedded Component](#embedded-component)
24
- - [Dynamic updates](#dynamic-updates)
25
- - [Linked Component](#linked-component)
26
- - [Transaction parameters](#transaction-parameters)
27
- - [Asset specification](#asset-specification)
28
- - [Transaction amount specification](#transaction-amount-specification)
29
- - [Destination address](#destination-address)
30
- - [Error handling](#error-handling)
31
- - [Customization](#customization)
32
- - [Functionality](#functionality)
33
- - [Pass the variables in the configuration](#pass-the-variables-in-the-configuration)
34
- - [Fields Properties](#fields-properties)
35
- - [Transaction Custom Asset Price](#transaction-custom-asset-price)
36
- - [License](#license)
34
+ - [Connect Wallet](#connect-wallet)
35
+ - [Deposit Request](#deposit-request)
36
+ - [Error handling](#error-handling)
37
+ - [Transaction parameters](#transaction-parameters)
38
+ - [Asset specification](#asset-specification)
39
+ - [Transaction amount](#transaction-amount)
40
+ - [Destination](#destination)
41
+ - [Asset Price](#asset-price)
42
+ - [Configuration](#configuration)
43
+ - [Transaction Options](#transaction-options)
44
+ - [Common use cases](#common-use-cases)
45
+ - [Configuring ownership proofs](#configuring-ownership-proofs)
46
+ - [Counterparty Field Properties](#counterparty-field-properties)
47
+ - [Locales](#locales)
48
+ - [License](#license)
37
49
 
38
50
  ## Installation
39
51
 
40
52
  There are two options for loading the Notabene SDK:
41
53
 
42
54
  ```bash
43
- <script id="notabene" async src="https://unpkg.com/@notabene/javascript-sdk@1.31.0/dist/es/index.js"></script>
55
+ <script id="notabene" async src="https://unpkg.com/@notabene/javascript-sdk@next/dist/notabene.js"></script>
44
56
  ```
45
57
 
46
58
  Or installing the library:
47
59
 
60
+ Using Yarn:
61
+
48
62
  ```bash
49
63
  yarn add @notabene/javascript-sdk
50
64
  ```
51
65
 
52
- ## Usage
66
+ Using NPM:
67
+
68
+ ```bash
69
+ npm install @notabene/javascript-sdk
70
+ ```
71
+
72
+ If you installed the library into your project, you can import it into your project:
73
+
74
+ ```js
75
+ import Notabene from '@notabene/javascript-sdk';
76
+ ```
77
+
78
+ ## Quick Start
79
+
80
+ ```js
81
+ // 1. Create Notabene instance
82
+ const notabene = new Notabene({
83
+ nodeUrl: 'https://api.notabene.id',
84
+ authToken: 'YOUR_CUSTOMER_TOKEN'
85
+ });
86
+
87
+ // 2. Create and mount withdrawal component
88
+ const withdrawal = notabene.createWithdrawalAssist({
89
+ asset: 'ETH',
90
+ destination: '0x1234...',
91
+ amountDecimal: 1.0
92
+ });
93
+ withdrawal.mount('#nb-withdrawal');
94
+
95
+ // 3. Handle completion
96
+ const { valid, value, txCreate } = await withdrawal.completion();
97
+ if (valid) {
98
+ // Submit to your backend
99
+ }
100
+ ```
101
+
102
+ ## Core Concepts
53
103
 
54
104
  ### Authentication
55
105
 
@@ -62,19 +112,18 @@ Use the [customer token endpoint](https://devx.notabene.id/docs/customertoken) w
62
112
  Create a new Notabene instance:
63
113
 
64
114
  ```js
65
-
66
115
  const notabene = new Notabene({
67
- nodeUrl: 'https://api.notabene.id',
116
+ nodeUrl: 'https://api.notabene.id', // use `https://api.notabene.dev` for testing
68
117
  authToken: '{CUSTOMER_TOKEN}',
69
- locale: 'de' // default locale
118
+ locale: 'de', // default locale = `en`
70
119
  });
71
120
  ```
72
121
 
73
122
  Use the same `nodeUrl` that you use to interact with the Notabene API.
74
123
 
75
- ## Assisted Withdrawal
124
+ ## General Component Usage
76
125
 
77
- The Withdrawal Assist component helps you collect additional required information from your user during a standard crypto withdrawal process.
126
+ Each component can be used in various ways depending on your use case.
78
127
 
79
128
  ### Embedded Component
80
129
 
@@ -90,19 +139,20 @@ Instantiate the withdrawal element and mount it using the id from above
90
139
 
91
140
  ```js
92
141
  const withdrawal = notabene.createWithdrawalAssist(tx, options);
93
- withdrawal.mount("nb-withdrawal");
142
+ withdrawal.mount('#nb-withdrawal');
94
143
  ```
95
144
 
96
145
  The simplest way to get the result is to use:
97
146
 
98
147
  ```js
99
148
  try {
100
- const {valid, ivms101} = await withdrawal.completion()
101
- if (valid) {
102
- // Submit result to your backend
103
- }
149
+ const { valid, value, txCreate, ivms101, proof } =
150
+ await withdrawal.completion();
151
+ if (valid) {
152
+ // Submit result to your backend
153
+ }
104
154
  } catch (e) {
105
- console.error(e)
155
+ console.error(e);
106
156
  }
107
157
  ```
108
158
 
@@ -114,22 +164,50 @@ To update the component as users enter transaction details:
114
164
  withdrawal.update({
115
165
  asset: 'ETH',
116
166
  destination: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
117
- amountDecimal: 1.12
167
+ amountDecimal: 1.12,
118
168
  });
119
169
  ```
120
170
 
121
171
  To be notified once the validation is completed so you can submit the withdrawal to your back end:
122
172
 
123
173
  ```js
124
- withdrawal.on('valid', {ivms101} => ...)
174
+ withdrawal.on('complete', { valid, value, txCreate, ivms101, proof } => ...)
125
175
  ```
126
176
 
127
- To be notified of any errors use:
177
+ To be notified of any validation errors use:
128
178
 
129
179
  ```js
130
180
  withdrawal.on('error',error => ...)
131
181
  ```
132
182
 
183
+ Calling `on` returns a function that will allow you to cleanly unsubscribe.
184
+
185
+ ```js
186
+ const unsubscribe = withdrawal.on('complete', { valid, value, txCreate, ivms101, proof } => ...)
187
+
188
+ // Clean up
189
+ unsubscribe()
190
+
191
+ ```
192
+
193
+ ### Modal
194
+
195
+ All components support being opened in a modal using `openModal()`, which returns a promise.
196
+
197
+ ```js
198
+ const withdrawal = notabene.createWithdrawalAssist(tx, options);
199
+ try {
200
+ const { valid, value, txCreate, ivms101, proof } =
201
+ await withdrawal.openModal();
202
+ if (valid) {
203
+ // Submit result to your backend
204
+ }
205
+ } catch (e) {
206
+ console.error(e);
207
+ }
208
+ ```
209
+
210
+
133
211
  ### Linked Component
134
212
 
135
213
  In some cases, in particular institutional or mobile apps you may prefer to link your customers to the component through an email or redirect the user to it in a mobile app.
@@ -153,6 +231,128 @@ The two parameters that should be configured are:
153
231
 
154
232
  **Note** for data privacy reasons the callback will be coming from your users web browser and not from our infrastructure, so no static IP is currently possible. Instead please check the `authToken` provided with the request.
155
233
 
234
+
235
+ ## Components
236
+
237
+ ## Assisted Withdrawal
238
+
239
+ The Withdrawal Assist component helps you collect additional required information from your user during a standard crypto withdrawal process.
240
+
241
+ ```js
242
+ const withdrawal = notabene.createWithdrawalAssist({
243
+ asset: 'ETH',
244
+ destination: '0x...',
245
+ amountDecimal: 1.23,
246
+ assetPrice: {
247
+ currency: 'USD', // ISO currency code
248
+ price: 1700.12, // Asset price
249
+ }
250
+ });
251
+ ```
252
+
253
+ ### Parameters
254
+
255
+ - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
256
+ - `destination`: The destination or blockchain address for the withdrawal. See [Destination](#destination)
257
+ - `amountDecimal`: The amount to transfer in decimal format. See [Transaction Amount](#transaction-amount)
258
+ - `assetPrice`: Optional price information in a fiat currency. See [Asset Price](#asset-price)
259
+
260
+ If any of the required parameters are missing the component will just show the Notabene badge.
261
+
262
+ ### Configuration Options
263
+
264
+ Include configuration Options as a second optional parameter:
265
+
266
+ ```js
267
+ const withdrawal = notabene.createWithdrawalAssist({
268
+ asset: 'ETH',
269
+ destination: '0x...',
270
+ amountDecimal: 1.23,
271
+ assetPrice: {
272
+ currency: 'USD', // ISO currency code
273
+ price: 1700.12, // Asset price
274
+ }
275
+ }, {
276
+ proofs: {
277
+ microTransfer: {
278
+ destination: '0x...',
279
+ amountSubunits: '12344',
280
+ timeout: 86440,
281
+ }
282
+ }
283
+ });
284
+ ```
285
+
286
+ See [Transaction Options](#transaction-options)
287
+
288
+ ## Connect Wallet
289
+
290
+ The Connect Wallet component helps you collect and verify the address of your users self-hosted wallet in one go.
291
+
292
+ ```js
293
+ const connect = notabene.createConnectWallet({
294
+ asset: 'ETH'
295
+ });
296
+
297
+ const { proof, txCreate } = await connect.openModal()
298
+ ```
299
+
300
+ ### Parameters
301
+
302
+ - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
303
+
304
+ ### Configuration Options
305
+
306
+ Include configuration Options as a second optional parameter:
307
+
308
+ ```js
309
+ const connect = notabene.createConnectWallet({
310
+ asset: 'ETH',
311
+ }, {
312
+ proofs: {
313
+ microTransfer: {
314
+ destination: '0x...',
315
+ amountSubunits: '12344',
316
+ timeout: 86440,
317
+ }
318
+ }
319
+ });
320
+ ```
321
+
322
+ ## Deposit Request
323
+
324
+ The Deposit Request lets your customers request deposits that are fully Travel Rule compliant.
325
+
326
+ ```js
327
+ const withdrawal = notabene.createDepositRequest({
328
+ asset: 'ETH',
329
+ destination: '0x...',
330
+ amountDecimal: 1.23,
331
+ customer: {
332
+ name: "John Smith"
333
+ }
334
+ });
335
+ ```
336
+
337
+ ### Parameters
338
+
339
+ - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
340
+ - `destination`: The destination or blockchain address for the withdrawal. See [Destination](#destination)
341
+ - `amountDecimal`: Optional amount to deposit in decimal format. See [Transaction Amount](#transaction-amount)
342
+ - `customer`: Optional Customer object containing their name
343
+
344
+ If any of the required parameters are missing the component will just show the Notabene badge.
345
+
346
+ ---
347
+
348
+ ## Error handling
349
+
350
+ If any error occurs, the `error` event is passed containing a message.
351
+
352
+ ```ts
353
+ withdrawal.on('error', {message} => ...)
354
+ ```
355
+
156
356
  ## Transaction parameters
157
357
 
158
358
  ### Asset specification
@@ -163,14 +363,13 @@ The `asset` field the following types of assets specified:
163
363
  - [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.
164
364
  - [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.
165
365
 
166
- ### Transaction amount specification
366
+ ### Transaction amount
167
367
 
168
368
  Use one of the following
169
369
 
170
370
  - `amountDecimal` A number specifying the amount in decimal format. Eg. `amountDecimal=1.1` would mean 1.1 of for example BTC or ETH.
171
- - `amountSubunits` A string specifying the amount in the native blockchain subunits eg Satoshi for Bitcoin or wei for Ethereum
172
371
 
173
- ### Destination address
372
+ ### Destination
174
373
 
175
374
  Specify the beneficiary address as `destination` using one of the following formats:
176
375
 
@@ -179,108 +378,269 @@ Specify the beneficiary address as `destination` using one of the following form
179
378
  - [BIP-21](https://en.bitcoin.it/wiki/BIP_0021) Bitcoin URI
180
379
  - Native blockchain address
181
380
 
182
- ---
381
+ ### Asset Price
183
382
 
184
- ### Error handling
383
+ The price of the asset is used to determine certain rules based on thresholds. We recommond you pass in your price like this:
185
384
 
186
- If any error occurs, the `onError` function from the Notabene instance will be triggered. The `error` passed as argument contains a `data` property that has the following type `ErrorData`.
385
+ ```ts
386
+ assetPrice: {
387
+ currency: 'USD', // ISO currency code
388
+ price: 1700.12, // Asset price
389
+ };
390
+ ```
187
391
 
188
- > ⚠️ **Note**: These errors are mainly used for debugging internal issues while implementing the widget. They are not meant to be shown directly to the end user.
189
392
 
190
- ```js
191
- type ErrorData = {
192
- title: string;
193
- detail: string;
194
- code: number;
195
- type: string;
196
- };
393
+ ## Configuration
197
394
 
198
- const notabene = new Notabene({
199
- ...,
200
- onError: (err) => {
201
- const errorData = err.data;
395
+ ### Transaction Options
396
+
397
+ Some components can be configured using an optional [TransactionOptions](./docs/types/interfaces/TransactionOptions.md) object.
398
+
399
+ The following shows the full set of options in typescript:
202
400
 
203
- // Do something
401
+ ```ts
402
+ import Notabene, {
403
+ AgentType,
404
+ PersonType,
405
+ ProofTypes,
406
+ } from '@notabene/javascript-sdk';
407
+
408
+ const options: TransactionOptions = {
409
+ proofs: {
410
+ microTransfer: {
411
+ destination: '0x...',
412
+ amountSubunits: '12344',
413
+ timeout: 86440,
414
+ },
415
+ fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
416
+ deminimis: {
417
+ threshold: 1000,
418
+ currency: 'EUR',
419
+ proofTypes: [ProofTypes.SelfDeclaration]
420
+ }
421
+ },
422
+ allowedAgentTypes: [AgentType.PRIVATE, AgentType.VASP], // js ['WALLET','VASP']
423
+ allowedCounterpartyTypes: [
424
+ PersonType.LEGAL, // JS: 'legal'
425
+ PersonType.NATURAL, // JS: 'natural'
426
+ PersonType.SELF, // JS: 'self'
427
+ ],
428
+ fields: {
429
+ naturalPerson: {
430
+ name: true, // Default true
431
+ website: { optional: true },
432
+ email: true,
433
+ phone: true,
434
+ geographicAddress: false,
435
+ nationalIdentification: false,
436
+ dateOfBirth: false,
437
+ placeOfBirth: false,
438
+ countryOfResidence: true,
439
+ },
440
+ legalPerson: {
441
+ name: true, // Default true
442
+ lei: true, // Default true
443
+ website: { optional: true }, // Default true
444
+ email: true,
445
+ phone: true,
446
+ geographicAddress: false,
447
+ nationalIdentification: false,
448
+ countryOfRegistration: true,
449
+ },
450
+ vasps: {
451
+ addUnknown: true, // Allow users to add a missing VASP - Defaults to false
452
+ onlyActive: true, // Only list active VASPs - Default false
453
+ },
454
+ hide: [ValidationSections.ASSET, ValidationSections.DESTINATION] // Don't show specific sections of component
204
455
  },
456
+ };
457
+ const withdrawal = notabene.createWithdrawalAssist(tx, options);
458
+ ```
459
+
460
+ The options can additionally be updated dynamically with the `update()` function.
461
+
462
+ ```js
463
+ withdrawal.update({
464
+ asset: 'ETH',
465
+ destination: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
466
+ amountDecimal: 1.12,
467
+ }, {
468
+ proofs: {
469
+ microTransfer: {
470
+ destination: '0x...',
471
+ amountSubunits: '12344',
472
+ timeout: 86440,
473
+ }
474
+ }
205
475
  });
206
476
  ```
207
477
 
208
- **Notabene Internal Errors**
478
+ ### Common use cases
209
479
 
210
- Type | Code | Title | Detail
211
- -- | -- | -- | --
212
- `BAD_REQUEST` | `400` | `Bad Request` | `NotabeneBadRequest: ...`
213
- `TRANSACTION_INVALID` | `400` | `Transaction Invalid` | `NotabeneTransactionInvalid: ...`
214
- `TOKEN_INVALID` | `401` | `Token Invalid` | `NotabeneTokenInvalid: ...`
215
- `ASSET_NOT_SUPPORTED` | `404` | `Asset Not Supported` | `NotabeneAssetNotSupported: ...`
216
- `SERVICE_UNAVAILABLE` | `500` | `Service Unavailable` | `NotabeneServiceUnavailable: ...`
217
- `WALLET_CONNECTED_FAILED` | `500` | `Wallet Connection Failed` | `NotabeneWalletConnectionFailed: ...`
218
- `WALLET_NOT_SUPPORTED` | `501` | `Wallet Not Supported` | `NotabeneWalletNotSupported: ...`
480
+ #### Only allow first party transactions
219
481
 
220
- ## Customization
482
+ ```ts
483
+ const firstParty: TransactionOptions = {
484
+ allowedCounterpartyTypes: [
485
+ PersonType.SELF, // JS: 'self'
486
+ ],
487
+ };
488
+ ```
221
489
 
222
- `nonCustodialDeclarationType`: `SIGNATURE` | `DECLARATION`
490
+ #### Only VASP to VASP transactions
223
491
 
224
- For deciding which ownership proof type you want to use.
492
+ ```ts
493
+ const vasp2vasp: TransactionOptions = {
494
+ allowedAgentTypes: [AgentType.VASP], // js ['VASP']
495
+ };
496
+ ```
225
497
 
226
- `SIGNATURE`: The ownership proof will be signed by the originator using a wallet. (DEFAULT)
227
- `DECLARATION`: The ownership proof will be declared by the originator using a checkbox.
498
+ #### Only Self-hosted wallet transactions
228
499
 
229
- ---
500
+ ```ts
501
+ const options: TransactionOptions = {
502
+ allowedAgentTypes: [AgentType.PRIVATE], // js ['WALLET']
503
+ };
504
+ ```
230
505
 
231
- `counterpartyManualEntry`: `TRUE` | `FALSE`
506
+ ### Configuring ownership proofs
232
507
 
233
- For deciding if you would like to allow your customer to provide a manual counterparty vasp name in the counterparty field.
508
+ By default components support message signing proofs.
234
509
 
235
- ---
510
+ #### Supporting Micro Transactions (aka Satoshi tests)
236
511
 
237
- ### Fields Properties
512
+ You can support Micro Transfers (aka Satoshi tests) by adding a deposit address for the test.
238
513
 
239
- Possible fields customization support:
514
+ Your compliance team will have to determine how to handle and verify these transactions in the rules engine or individually.
240
515
 
241
- | field name | `forceDisplay` | `optional` | description |
242
- | ------------------------ | -------------- | ---------- | ------------------------------------------------------- |
243
- | `dateAndPlaceOfBirth` | ☑️ | -- | Recipient (or Sender) Date and Place of Birth |
244
- | `geographicAddress` | ☑️ | ☑️ | Recipient (or Sender) Address |
245
- | `name` | ☑️ | -- | Recipient (or Sender) Last Name / Company Name |
246
- | `nationalIdentification` | ☑️ | --️ | Recipient (or Sender) National Identification |
247
- | `country` | ☑️ | ☑️ | Recipient (or Sender) Country of Residence (for natural person) / Country of Registration (for legal person) |
516
+ ```ts
517
+ const options: TransactionOptions = {
518
+ proofs: {
519
+ microTransfer: {
520
+ destination: '0x...',
521
+ amountSubunits: '1234',
522
+ timeout: 86440, // Optional timeout in seconds, which is displayed to the user
523
+ },
524
+ fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
525
+ },
526
+ };
527
+ ```
248
528
 
249
- **Field Options**
529
+ Notabene does not currently verify these tests automatically as you likely already have the infrastructure to do so.
250
530
 
251
- - **forceDisplay** - Force a field that is not required by your jurisdiction to be displayed - defaults to **false**
252
- - **optional** - Bypass the jurisdiction rules validation for that specific field - defaults to **false**
531
+ You will receive a response back from the component containing a proof object. For MicroTransfers it will look like this:
253
532
 
254
- ```js
255
- {
256
- counterparty: {
257
- optional: true;
258
- },
259
- geographicAddress: {
260
- forceDisplay: true,
261
- optional: true;
262
- },
533
+ ```ts
534
+ type MicroTransferProof {
535
+ type: ProofTypes.MicroTransfer;
536
+ status: ProofStatus.PENDING;
537
+ did: DID;
538
+ address: CAIP10; // CAIP10 account to be verified
539
+ txhash: string; // Transaction Hash to verify
540
+ chain: CAIP2; // CAIP2 identifier of blockchain
541
+ amountSubunits: string; // Amount in subunits eg (satoshi or wei) to be verified
263
542
  }
264
543
  ```
265
544
 
545
+ #### Fallback Proof Options
266
546
 
547
+ You may accept a few options if none of the other are available. We do not recommend them, as they do not provide sufficient proof. However many VASPs do allow them for now:
267
548
 
268
- ### Transaction Custom Asset Price
549
+ ```ts
550
+ const options: TransactionOptions = {
551
+ proofs: {
552
+ fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
553
+ },
554
+ };
555
+ ```
269
556
 
270
- To use your own asset price as fallback in case an asset is not supported by Notabene, you can provide a `customAssetPrice` object that will be used instead to render the widget with the correct jurisdiction requirements.
557
+ The two options are:
271
558
 
272
- ```js
273
- notabene.setTransaction({
274
- transactionAsset: 'ASSET_UNSUPPORTED_FROM_NOTABENE',
275
- beneficiaryAccountNumber: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
276
- transactionAmount: '2000000000',
277
- customAssetPrice: {
278
- priceUSD: 1700.12, // Asset price in USD
279
- decimals: 10 // Decimals used for the given transactionAmount
280
- };
281
- });
559
+ - `screenshot` Where a user is requested to upload a screenshot of their wallet
560
+ - `self-declaration` Where a user self declares that they control the wallet address
561
+
562
+ ### Counterparty Field Properties
563
+
564
+ The fields requested from a customer about a counterparty can be configured with the fields object. You can configure required and optional fields individually for both natural and legal persons.
565
+
566
+ We recommend working closely with your compliance team for this. Bearing in mind that different jurisdictions have different rules.
567
+
568
+ Each field can be configured like this:
569
+
570
+ - `true` required field
571
+ - `false` don't show
572
+ - `{ optional: true }` show but don't require
573
+
574
+ Eg:
575
+
576
+ ```ts
577
+ {
578
+ naturalPerson: {
579
+ website: { optional: true },
580
+ email: true,
581
+ phone: false,
582
+ }
583
+ }
584
+ ```
585
+
586
+ The above will always ask the user for the following for natural persons:
587
+
588
+ - `name` since it is on by default (you can disable it explicitly by setting it to `false`)
589
+ - `website` is show but is optional
590
+ - `email` is required
591
+
592
+ #### Full Example
593
+
594
+ ```ts
595
+ const options: TransactionOptions = {
596
+ fields: {
597
+ naturalPerson: {
598
+ name: true, // Default true
599
+ website: { optional: true },
600
+ email: true,
601
+ phone: true,
602
+ geographicAddress: false,
603
+ nationalIdentification: false,
604
+ dateOfBirth: {
605
+ transmit: true,
606
+ },
607
+ placeOfBirth: false,
608
+ countryOfResidence: true,
609
+ },
610
+ legalPerson: {
611
+ name: true, // Default true
612
+ lei: true, // Default true
613
+ website: { optional: true }, // Default true
614
+ email: true,
615
+ phone: true,
616
+ geographicAddress: false,
617
+ nationalIdentification: false,
618
+ countryOfRegistration: true,
619
+ },
620
+ },
621
+ };
282
622
  ```
283
623
 
624
+ #### Field reference
625
+
626
+ | Field name | Natural | Legal | IVMS101 | description |
627
+ | ------------------------ | ------- | ----- | ------- | --------------------------------------------- |
628
+ | `name` | ✅ | ✅ | 🟩 | Full name |
629
+ | `email` | 🟩 | 🟩 | -- | Email (for your internal purposes) |
630
+ | `website` | -- | ✅ | -- | Business Website (for your internal purposes) |
631
+ | `phone` | 🟩 | 🟩 | -- | Mobile Phone (for your internal purposes) |
632
+ | `geographicAddress` | 🟩 | 🟩 | 🟩 | Residencial or business address |
633
+ | `nationalIdentification` | 🟩 | 🟩 | 🟩 | National Identification number |
634
+ | `dateOfBirth` | 🟩 | -- | 🟩 | Date of birth |
635
+ | `placeOfBirth` | 🟩 | -- | 🟩 | Place of birth |
636
+ | `countryOfResidence` | 🟩 | -- | 🟩 | Country of Residence |
637
+ | `lei` | -- | ✅ | 🟩 | LEI (Legal Entity Identifier) |
638
+ | `countryOfRegistration` | -- | 🟩 | 🟩 | Country of Registration |
639
+
640
+ ## Locales
641
+
642
+ See [locales](src/locales.ts) for the list of supported locales.
643
+
284
644
  ## [License](LICENSE.md)
285
645
 
286
- BSD 3-Clause © Notabene Inc.
646
+ MIT © Notabene Inc.