@notabene/javascript-sdk 2.0.0 → 2.0.2

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.
Files changed (117) hide show
  1. package/README.md +64 -58
  2. package/dist/notabene.cjs +1 -1
  3. package/dist/notabene.js +1 -1
  4. package/docs/README.md +656 -0
  5. package/docs/_media/LICENSE.md +21 -0
  6. package/docs/_media/TransactionOptions.md +93 -0
  7. package/docs/_media/locales.ts +48 -0
  8. package/docs/ivms/types/README.md +46 -0
  9. package/docs/ivms/types/enumerations/PayloadVersionCode.md +33 -0
  10. package/docs/ivms/types/interfaces/PayloadMetadata.md +34 -0
  11. package/docs/ivms/types/type-aliases/Address.md +114 -0
  12. package/docs/ivms/types/type-aliases/AddressTypeCode.md +16 -0
  13. package/docs/ivms/types/type-aliases/Beneficiary.md +30 -0
  14. package/docs/ivms/types/type-aliases/BeneficiaryVASP.md +24 -0
  15. package/docs/ivms/types/type-aliases/DateAndPlaceOfBirth.md +30 -0
  16. package/docs/ivms/types/type-aliases/ISOCountryCode.md +22 -0
  17. package/docs/ivms/types/type-aliases/ISODate.md +23 -0
  18. package/docs/ivms/types/type-aliases/IVMS101.md +41 -0
  19. package/docs/ivms/types/type-aliases/IntermediaryVASP.md +30 -0
  20. package/docs/ivms/types/type-aliases/LegalPerson.md +48 -0
  21. package/docs/ivms/types/type-aliases/LegalPersonName.md +36 -0
  22. package/docs/ivms/types/type-aliases/LegalPersonNameID.md +30 -0
  23. package/docs/ivms/types/type-aliases/LegalPersonNameTypeCode.md +16 -0
  24. package/docs/ivms/types/type-aliases/LocalLegalPersonNameID.md +30 -0
  25. package/docs/ivms/types/type-aliases/LocalNaturalPersonNameID.md +36 -0
  26. package/docs/ivms/types/type-aliases/NationalIdentification.md +42 -0
  27. package/docs/ivms/types/type-aliases/NationalIdentifierTypeCode.md +16 -0
  28. package/docs/ivms/types/type-aliases/NaturalPerson.md +54 -0
  29. package/docs/ivms/types/type-aliases/NaturalPersonName.md +36 -0
  30. package/docs/ivms/types/type-aliases/NaturalPersonNameID.md +36 -0
  31. package/docs/ivms/types/type-aliases/NaturalPersonNameTypeCode.md +16 -0
  32. package/docs/ivms/types/type-aliases/OriginatingVASP.md +24 -0
  33. package/docs/ivms/types/type-aliases/Originator.md +30 -0
  34. package/docs/ivms/types/type-aliases/Person.md +30 -0
  35. package/docs/ivms/types/type-aliases/TransferPath.md +24 -0
  36. package/docs/ivms/types/type-aliases/TransliterationMethodCode.md +16 -0
  37. package/docs/modules.md +11 -0
  38. package/docs/notabene/README.md +368 -0
  39. package/docs/notabene/classes/EmbeddedComponent.md +347 -0
  40. package/docs/notabene/classes/default.md +221 -0
  41. package/docs/notabene/functions/decodeFragmentToObject.md +27 -0
  42. package/docs/notabene/interfaces/NotabeneConfig.md +69 -0
  43. package/docs/notabene/type-aliases/MessageCallback.md +31 -0
  44. package/docs/types/README.md +154 -0
  45. package/docs/types/enumerations/AgentType.md +29 -0
  46. package/docs/types/enumerations/CMType.md +90 -0
  47. package/docs/types/enumerations/HMType.md +35 -0
  48. package/docs/types/enumerations/PersonType.md +55 -0
  49. package/docs/types/enumerations/ProofStatus.md +57 -0
  50. package/docs/types/enumerations/ProofTypes.md +148 -0
  51. package/docs/types/enumerations/Status.md +59 -0
  52. package/docs/types/enumerations/ValidationSections.md +59 -0
  53. package/docs/types/interfaces/Agent.md +74 -0
  54. package/docs/types/interfaces/CallbackOptions.md +29 -0
  55. package/docs/types/interfaces/ComponentRequest.md +50 -0
  56. package/docs/types/interfaces/ComponentResponse.md +71 -0
  57. package/docs/types/interfaces/ConnectionRecord.md +111 -0
  58. package/docs/types/interfaces/ConnectionRequest.md +51 -0
  59. package/docs/types/interfaces/Counterparty.md +135 -0
  60. package/docs/types/interfaces/DeclarationProof.md +89 -0
  61. package/docs/types/interfaces/Deposit.md +147 -0
  62. package/docs/types/interfaces/DepositRequest.md +111 -0
  63. package/docs/types/interfaces/DepositRequestOptions.md +19 -0
  64. package/docs/types/interfaces/LegalPerson.md +202 -0
  65. package/docs/types/interfaces/MicroTransferProof.md +119 -0
  66. package/docs/types/interfaces/NaturalPerson.md +201 -0
  67. package/docs/types/interfaces/OwnershipProof.md +77 -0
  68. package/docs/types/interfaces/ScreenshotProof.md +79 -0
  69. package/docs/types/interfaces/SignatureProof.md +115 -0
  70. package/docs/types/interfaces/ThresholdOptions.md +47 -0
  71. package/docs/types/interfaces/Transaction.md +136 -0
  72. package/docs/types/interfaces/TransactionOptions.md +93 -0
  73. package/docs/types/interfaces/TransactionResponse.md +130 -0
  74. package/docs/types/interfaces/VASP.md +127 -0
  75. package/docs/types/interfaces/Wallet.md +117 -0
  76. package/docs/types/interfaces/Withdrawal.md +147 -0
  77. package/docs/types/type-aliases/BlockchainAddress.md +36 -0
  78. package/docs/types/type-aliases/CAIP10.md +39 -0
  79. package/docs/types/type-aliases/CAIP19.md +40 -0
  80. package/docs/types/type-aliases/CAIP2.md +39 -0
  81. package/docs/types/type-aliases/CAIP220.md +15 -0
  82. package/docs/types/type-aliases/Cancel.md +23 -0
  83. package/docs/types/type-aliases/Completed.md +35 -0
  84. package/docs/types/type-aliases/ComponentMessage.md +41 -0
  85. package/docs/types/type-aliases/ConnectionOptions.md +15 -0
  86. package/docs/types/type-aliases/CryptoCredential.md +15 -0
  87. package/docs/types/type-aliases/DID.md +15 -0
  88. package/docs/types/type-aliases/DTI.md +38 -0
  89. package/docs/types/type-aliases/Destination.md +15 -0
  90. package/docs/types/type-aliases/Error.md +29 -0
  91. package/docs/types/type-aliases/FieldOptions.md +15 -0
  92. package/docs/types/type-aliases/FieldTypes.md +25 -0
  93. package/docs/types/type-aliases/HostMessage.md +37 -0
  94. package/docs/types/type-aliases/ISOCurrency.md +15 -0
  95. package/docs/types/type-aliases/InvalidValue.md +45 -0
  96. package/docs/types/type-aliases/LEI.md +15 -0
  97. package/docs/types/type-aliases/LegalPersonFieldName.md +13 -0
  98. package/docs/types/type-aliases/LegalPersonFields.md +15 -0
  99. package/docs/types/type-aliases/NaturalPersonFieldName.md +15 -0
  100. package/docs/types/type-aliases/NaturalPersonFields.md +15 -0
  101. package/docs/types/type-aliases/NotabeneAsset.md +36 -0
  102. package/docs/types/type-aliases/Ready.md +21 -0
  103. package/docs/types/type-aliases/ResizeRequest.md +27 -0
  104. package/docs/types/type-aliases/Source.md +15 -0
  105. package/docs/types/type-aliases/Theme.md +33 -0
  106. package/docs/types/type-aliases/TransactionAsset.md +15 -0
  107. package/docs/types/type-aliases/TravelAddress.md +37 -0
  108. package/docs/types/type-aliases/URI.md +15 -0
  109. package/docs/types/type-aliases/UUID.md +27 -0
  110. package/docs/types/type-aliases/UpdateValue.md +54 -0
  111. package/docs/types/type-aliases/V1Asset.md +36 -0
  112. package/docs/types/type-aliases/V1Transaction.md +49 -0
  113. package/docs/types/type-aliases/VASPOptions.md +25 -0
  114. package/docs/types/type-aliases/ValidationError.md +25 -0
  115. package/package.json +6 -4
  116. package/src/components/EmbeddedComponent.ts +2 -2
  117. package/src/locales.ts +2 -1
package/docs/README.md ADDED
@@ -0,0 +1,656 @@
1
+ **@notabene/javascript-sdk** • [**Docs**](modules.md)
2
+
3
+ ***
4
+
5
+ <div align="center">
6
+
7
+ <img src="https://assets-global.website-files.com/5e68f0772de982756aa8c1a4/5eee5fb470215e6ecdc34b94_Full_transparent_black_1280x413.svg" height=50>
8
+ <br>
9
+ # Notabene SafeConnect Components JavaScript SDK
10
+
11
+ [![pipeline status](https://gitlab.com/notabene/open-source/javascript-sdk/badges/master/pipeline.svg)](https://gitlab.com/notabene/open-source/javascript-sdk/-/commits/master)
12
+ [![npm version](https://img.shields.io/npm/v/@notabene/javascript-sdk.svg)](https://www.npmjs.com/package/@notabene/javascript-sdk)
13
+ [![npm downloads](https://img.shields.io/npm/dm/@notabene/javascript-sdk.svg)](https://www.npmjs.com/package/@notabene/javascript-sdk)
14
+ [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@notabene/javascript-sdk)](https://bundlephobia.com/package/@notabene/javascript-sdk)
15
+ [![Types](https://img.shields.io/npm/types/@notabene/javascript-sdk)](https://www.npmjs.com/package/@notabene/javascript-sdk)
16
+ [![License](https://img.shields.io/npm/l/@notabene/javascript-sdk)](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/main/LICENSE.md)
17
+ [![Dependencies](https://img.shields.io/librariesio/release/npm/@notabene/javascript-sdk)](https://libraries.io/npm/@notabene%2Fjavascript-sdk)
18
+
19
+ This library is the JavaScript SDK for loading the Notabene UX components in the front-end.
20
+
21
+ [Additional Documentation](https://devx.notabene.id/docs/embedded=ux)
22
+
23
+ </div>
24
+
25
+ ## Table of Contents
26
+
27
+ - [Installation](#installation)
28
+ - [Quick Start](#quick-start)
29
+ - [Core Concepts](#core-concepts)
30
+ - [Authentication](#authentication)
31
+ - [General Component Usage](#general-component-usage)
32
+ - [Embedded Component](#embedded-component)
33
+ - [Dynamic updates](#dynamic-updates)
34
+ - [Modal](#modal)
35
+ - [Linked Component](#linked-component)
36
+ - [Components](#components)
37
+ - [Assisted Withdrawal](#assisted-withdrawal)
38
+ - [Connect Wallet](#connect-wallet)
39
+ - [Deposit Request](#deposit-request)
40
+ - [Error handling](#error-handling)
41
+ - [Transaction parameters](#transaction-parameters)
42
+ - [Asset specification](#asset-specification)
43
+ - [Transaction amount](#transaction-amount)
44
+ - [Destination](#destination)
45
+ - [Asset Price](#asset-price)
46
+ - [Configuration](#configuration)
47
+ - [Transaction Options](#transaction-options)
48
+ - [Common use cases](#common-use-cases)
49
+ - [Configuring ownership proofs](#configuring-ownership-proofs)
50
+ - [Counterparty Field Properties](#counterparty-field-properties)
51
+ - [Locales](#locales)
52
+ - [License](#license)
53
+
54
+ ## Installation
55
+
56
+ There are two options for loading the Notabene SDK:
57
+
58
+ ```bash
59
+ <script id="notabene" async src="https://unpkg.com/@notabene/javascript-sdk@next/dist/notabene.js"></script>
60
+ ```
61
+
62
+ Or installing the library:
63
+
64
+ Using Yarn:
65
+
66
+ ```bash
67
+ yarn add @notabene/javascript-sdk
68
+ ```
69
+
70
+ Using NPM:
71
+
72
+ ```bash
73
+ npm install @notabene/javascript-sdk
74
+ ```
75
+
76
+ If you installed the library into your project, you can import it into your project:
77
+
78
+ ```js
79
+ import Notabene from '@notabene/javascript-sdk';
80
+ ```
81
+
82
+ ## Quick Start
83
+
84
+ ```js
85
+ // 1. Create Notabene instance
86
+ const notabene = new Notabene({
87
+ nodeUrl: 'https://api.notabene.id',
88
+ authToken: 'YOUR_CUSTOMER_TOKEN',
89
+ });
90
+
91
+ // 2. Create and mount withdrawal component
92
+ const withdrawal = notabene.createWithdrawalAssist({
93
+ asset: 'ETH',
94
+ destination: '0x1234...',
95
+ amountDecimal: 1.0,
96
+ });
97
+ withdrawal.mount('#nb-withdrawal');
98
+
99
+ // 3. Handle completion
100
+ const { valid, value, txCreate } = await withdrawal.completion();
101
+ if (valid) {
102
+ // Submit to your backend
103
+ }
104
+ ```
105
+
106
+ ## Core Concepts
107
+
108
+ ### Authentication
109
+
110
+ Use the [customer token endpoint](https://devx.notabene.id/docs/customertoken) with your access token to receive a token with a customer's scope.
111
+
112
+ > ⚠️ **IMPORTANT** ⚠️
113
+ >
114
+ > When requesting the `customer token` you **must pass a unique `customerRef` per customer** for ownership proof reusability, otherwise you might encounter unwanted behavior.
115
+
116
+ Create a new Notabene instance:
117
+
118
+ ```js
119
+ const notabene = new Notabene({
120
+ nodeUrl: 'https://api.notabene.id', // use `https://api.notabene.dev` for testing
121
+ authToken: '{CUSTOMER_TOKEN}',
122
+ locale: 'de', // default locale = `en`
123
+ });
124
+ ```
125
+
126
+ Use the same `nodeUrl` that you use to interact with the Notabene API.
127
+
128
+ ## General Component Usage
129
+
130
+ Each component can be used in various ways depending on your use case.
131
+
132
+ ### Embedded Component
133
+
134
+ This will let you embed the component into your existing withdrawal flow.
135
+
136
+ Create an html element to contain the component:
137
+
138
+ ```html
139
+ <div id="nb-withdrawal/>
140
+ ```
141
+
142
+ Instantiate the withdrawal element and mount it using the id from above
143
+
144
+ ```js
145
+ const withdrawal = notabene.createWithdrawalAssist(tx, options);
146
+ withdrawal.mount('#nb-withdrawal');
147
+ ```
148
+
149
+ The simplest way to get the result is to use:
150
+
151
+ ```js
152
+ try {
153
+ const { valid, value, txCreate, ivms101, proof } =
154
+ await withdrawal.completion();
155
+ if (valid) {
156
+ // Submit result to your backend
157
+ }
158
+ } catch (e) {
159
+ console.error(e);
160
+ }
161
+ ```
162
+
163
+ #### Dynamic updates
164
+
165
+ To update the component as users enter transaction details:
166
+
167
+ ```js
168
+ withdrawal.update({
169
+ asset: 'ETH',
170
+ destination: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
171
+ amountDecimal: 1.12,
172
+ });
173
+ ```
174
+
175
+ To be notified once the validation is completed so you can submit the withdrawal to your back end:
176
+
177
+ ```js
178
+ withdrawal.on('complete', { valid, value, txCreate, ivms101, proof } => ...)
179
+ ```
180
+
181
+ To be notified of any validation errors use:
182
+
183
+ ```js
184
+ withdrawal.on('error',error => ...)
185
+ ```
186
+
187
+ Calling `on` returns a function that will allow you to cleanly unsubscribe.
188
+
189
+ ```js
190
+ const unsubscribe = withdrawal.on('complete', { valid, value, txCreate, ivms101, proof } => ...)
191
+
192
+ // Clean up
193
+ unsubscribe()
194
+
195
+ ```
196
+
197
+ ### Modal
198
+
199
+ All components support being opened in a modal using `openModal()`, which returns a promise.
200
+
201
+ ```js
202
+ const withdrawal = notabene.createWithdrawalAssist(tx, options);
203
+ try {
204
+ const { valid, value, txCreate, ivms101, proof } =
205
+ await withdrawal.openModal();
206
+ if (valid) {
207
+ // Submit result to your backend
208
+ }
209
+ } catch (e) {
210
+ console.error(e);
211
+ }
212
+ ```
213
+
214
+ ### Linked Component
215
+
216
+ 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.
217
+
218
+ ```js
219
+ const withdrawal = notabene.createWithdrawalAssist(tx, options, {
220
+ callback: /// a serverside backend url
221
+ redirectUri: // URI of website or mobile app to redirect user to after completion
222
+ });
223
+
224
+ // NodeJS redirect. Link also works in an email.
225
+ res.redirect(withdrawal.url);
226
+ ```
227
+
228
+ Bear in mind that this is a full screen view for your users.
229
+
230
+ The two parameters that should be configured are:
231
+
232
+ - `callback` - a URL for your serverside. On completion this will receive an HTTP POST with the result as a json body and the `authToken` as an `Authorization: Bearer` header.
233
+ - `redirectUri` - the user will be redirected here on completion. The result parameters will be json encoded in the URL fragment. You can use a mobile app schema to intercept these in your mobile app.
234
+
235
+ **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.
236
+
237
+ ## Components
238
+
239
+ ## Assisted Withdrawal
240
+
241
+ The Withdrawal Assist component helps you collect additional required information from your user during a standard crypto withdrawal process.
242
+
243
+ ```js
244
+ const withdrawal = notabene.createWithdrawalAssist({
245
+ asset: 'ETH',
246
+ destination: '0x...',
247
+ amountDecimal: 1.23,
248
+ assetPrice: {
249
+ currency: 'USD', // ISO currency code
250
+ price: 1700.12, // Asset price
251
+ },
252
+ });
253
+ ```
254
+
255
+ ### Parameters
256
+
257
+ - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
258
+ - `destination`: The destination or blockchain address for the withdrawal. See [Destination](#destination)
259
+ - `amountDecimal`: The amount to transfer in decimal format. See [Transaction Amount](#transaction-amount)
260
+ - `assetPrice`: Optional price information in a fiat currency. See [Asset Price](#asset-price)
261
+
262
+ If any of the required parameters are missing the component will just show the Notabene badge.
263
+
264
+ ### Configuration Options
265
+
266
+ Include configuration Options as a second optional parameter:
267
+
268
+ ```js
269
+ const withdrawal = notabene.createWithdrawalAssist(
270
+ {
271
+ asset: 'ETH',
272
+ destination: '0x...',
273
+ amountDecimal: 1.23,
274
+ assetPrice: {
275
+ currency: 'USD', // ISO currency code
276
+ price: 1700.12, // Asset price
277
+ },
278
+ },
279
+ {
280
+ proofs: {
281
+ microTransfer: {
282
+ destination: '0x...',
283
+ amountSubunits: '12344',
284
+ timeout: 86440,
285
+ },
286
+ },
287
+ },
288
+ );
289
+ ```
290
+
291
+ See [Transaction Options](#transaction-options)
292
+
293
+ ## Connect Wallet
294
+
295
+ The Connect Wallet component helps you collect and verify the address of your users self-hosted wallet in one go.
296
+
297
+ ```js
298
+ const connect = notabene.createConnectWallet({
299
+ asset: 'ETH',
300
+ });
301
+
302
+ const { proof, txCreate } = await connect.openModal();
303
+ ```
304
+
305
+ ### Parameters
306
+
307
+ - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
308
+
309
+ ### Configuration Options
310
+
311
+ Include configuration Options as a second optional parameter:
312
+
313
+ ```js
314
+ const connect = notabene.createConnectWallet(
315
+ {
316
+ asset: 'ETH',
317
+ },
318
+ {
319
+ proofs: {
320
+ microTransfer: {
321
+ destination: '0x...',
322
+ amountSubunits: '12344',
323
+ timeout: 86440,
324
+ },
325
+ },
326
+ },
327
+ );
328
+ ```
329
+
330
+ ## Deposit Request
331
+
332
+ The Deposit Request lets your customers request deposits that are fully Travel Rule compliant.
333
+
334
+ ```js
335
+ const withdrawal = notabene.createDepositRequest({
336
+ asset: 'ETH',
337
+ destination: '0x...',
338
+ amountDecimal: 1.23,
339
+ customer: {
340
+ name: 'John Smith',
341
+ },
342
+ });
343
+ ```
344
+
345
+ ### Parameters
346
+
347
+ - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
348
+ - `destination`: The destination or blockchain address for the withdrawal. See [Destination](#destination)
349
+ - `amountDecimal`: Optional amount to deposit in decimal format. See [Transaction Amount](#transaction-amount)
350
+ - `customer`: Optional Customer object containing their name
351
+
352
+ If any of the required parameters are missing the component will just show the Notabene badge.
353
+
354
+ ---
355
+
356
+ ## Error handling
357
+
358
+ If any error occurs, the `error` event is passed containing a message.
359
+
360
+ ```ts
361
+ withdrawal.on('error', {message} => ...)
362
+ ```
363
+
364
+ ## Transaction parameters
365
+
366
+ ### Asset specification
367
+
368
+ The `asset` field the following types of assets specified:
369
+
370
+ - `notabene_asset` code passed as a`string`. See [Notabene Assets Service](https://devx.notabene.id/docs/coins-decimals#assets-service-api).
371
+ - [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.
372
+ - [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.
373
+
374
+ ### Transaction amount
375
+
376
+ Use one of the following
377
+
378
+ - `amountDecimal` A number specifying the amount in decimal format. Eg. `amountDecimal=1.1` would mean 1.1 of for example BTC or ETH.
379
+
380
+ ### Destination
381
+
382
+ Specify the beneficiary address as `destination` using one of the following formats:
383
+
384
+ - [CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md_) is a chain agnostic format allows you to specify the specific blockchain and address
385
+ - [EIP-3770](https://eips.ethereum.org/EIPS/eip-3770) EVM URI
386
+ - [BIP-21](https://en.bitcoin.it/wiki/BIP_0021) Bitcoin URI
387
+ - Native blockchain address
388
+
389
+ ### Asset Price
390
+
391
+ The price of the asset is used to determine certain rules based on thresholds. We recommond you pass in your price like this:
392
+
393
+ ```ts
394
+ assetPrice: {
395
+ currency: 'USD', // ISO currency code
396
+ price: 1700.12, // Asset price
397
+ };
398
+ ```
399
+
400
+ ## Configuration
401
+
402
+ ### Transaction Options
403
+
404
+ Some components can be configured using an optional [TransactionOptions](_media/TransactionOptions.md) object.
405
+
406
+ The following shows the full set of options in typescript:
407
+
408
+ ```ts
409
+ import Notabene, {
410
+ AgentType,
411
+ PersonType,
412
+ ProofTypes,
413
+ } from '@notabene/javascript-sdk';
414
+
415
+ const options: TransactionOptions = {
416
+ proofs: {
417
+ microTransfer: {
418
+ destination: '0x...',
419
+ amountSubunits: '12344',
420
+ timeout: 86440,
421
+ },
422
+ fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
423
+ deminimis: {
424
+ threshold: 1000,
425
+ currency: 'EUR',
426
+ proofTypes: [ProofTypes.SelfDeclaration],
427
+ },
428
+ },
429
+ allowedAgentTypes: [AgentType.PRIVATE, AgentType.VASP], // js ['WALLET','VASP']
430
+ allowedCounterpartyTypes: [
431
+ PersonType.LEGAL, // JS: 'legal'
432
+ PersonType.NATURAL, // JS: 'natural'
433
+ PersonType.SELF, // JS: 'self'
434
+ ],
435
+ fields: {
436
+ naturalPerson: {
437
+ name: true, // Default true
438
+ website: { optional: true },
439
+ email: true,
440
+ phone: true,
441
+ geographicAddress: false,
442
+ nationalIdentification: false,
443
+ dateOfBirth: false,
444
+ placeOfBirth: false,
445
+ countryOfResidence: true,
446
+ },
447
+ legalPerson: {
448
+ name: true, // Default true
449
+ lei: true, // Default true
450
+ website: { optional: true }, // Default true
451
+ email: true,
452
+ phone: true,
453
+ geographicAddress: false,
454
+ nationalIdentification: false,
455
+ countryOfRegistration: true,
456
+ },
457
+ vasps: {
458
+ addUnknown: true, // Allow users to add a missing VASP - Defaults to false
459
+ onlyActive: true, // Only list active VASPs - Default false
460
+ },
461
+ hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
462
+ },
463
+ };
464
+ const withdrawal = notabene.createWithdrawalAssist(tx, options);
465
+ ```
466
+
467
+ The options can additionally be updated dynamically with the `update()` function.
468
+
469
+ ```js
470
+ withdrawal.update(
471
+ {
472
+ asset: 'ETH',
473
+ destination: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
474
+ amountDecimal: 1.12,
475
+ },
476
+ {
477
+ proofs: {
478
+ microTransfer: {
479
+ destination: '0x...',
480
+ amountSubunits: '12344',
481
+ timeout: 86440,
482
+ },
483
+ },
484
+ },
485
+ );
486
+ ```
487
+
488
+ ### Common use cases
489
+
490
+ #### Only allow first party transactions
491
+
492
+ ```ts
493
+ const firstParty: TransactionOptions = {
494
+ allowedCounterpartyTypes: [
495
+ PersonType.SELF, // JS: 'self'
496
+ ],
497
+ };
498
+ ```
499
+
500
+ #### Only VASP to VASP transactions
501
+
502
+ ```ts
503
+ const vasp2vasp: TransactionOptions = {
504
+ allowedAgentTypes: [AgentType.VASP], // js ['VASP']
505
+ };
506
+ ```
507
+
508
+ #### Only Self-hosted wallet transactions
509
+
510
+ ```ts
511
+ const options: TransactionOptions = {
512
+ allowedAgentTypes: [AgentType.PRIVATE], // js ['WALLET']
513
+ };
514
+ ```
515
+
516
+ ### Configuring ownership proofs
517
+
518
+ By default components support message signing proofs.
519
+
520
+ #### Supporting Micro Transactions (aka Satoshi tests)
521
+
522
+ You can support Micro Transfers (aka Satoshi tests) by adding a deposit address for the test.
523
+
524
+ Your compliance team will have to determine how to handle and verify these transactions in the rules engine or individually.
525
+
526
+ ```ts
527
+ const options: TransactionOptions = {
528
+ proofs: {
529
+ microTransfer: {
530
+ destination: '0x...',
531
+ amountSubunits: '1234',
532
+ timeout: 86440, // Optional timeout in seconds, which is displayed to the user
533
+ },
534
+ fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
535
+ },
536
+ };
537
+ ```
538
+
539
+ Notabene does not currently verify these tests automatically as you likely already have the infrastructure to do so.
540
+
541
+ You will receive a response back from the component containing a proof object. For MicroTransfers it will look like this:
542
+
543
+ ```ts
544
+ type MicroTransferProof {
545
+ type: ProofTypes.MicroTransfer;
546
+ status: ProofStatus.PENDING;
547
+ did: DID;
548
+ address: CAIP10; // CAIP10 account to be verified
549
+ txhash: string; // Transaction Hash to verify
550
+ chain: CAIP2; // CAIP2 identifier of blockchain
551
+ amountSubunits: string; // Amount in subunits eg (satoshi or wei) to be verified
552
+ }
553
+ ```
554
+
555
+ #### Fallback Proof Options
556
+
557
+ 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:
558
+
559
+ ```ts
560
+ const options: TransactionOptions = {
561
+ proofs: {
562
+ fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
563
+ },
564
+ };
565
+ ```
566
+
567
+ The two options are:
568
+
569
+ - `screenshot` Where a user is requested to upload a screenshot of their wallet
570
+ - `self-declaration` Where a user self declares that they control the wallet address
571
+
572
+ ### Counterparty Field Properties
573
+
574
+ 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.
575
+
576
+ We recommend working closely with your compliance team for this. Bearing in mind that different jurisdictions have different rules.
577
+
578
+ Each field can be configured like this:
579
+
580
+ - `true` required field
581
+ - `false` don't show
582
+ - `{ optional: true }` show but don't require
583
+
584
+ Eg:
585
+
586
+ ```ts
587
+ {
588
+ naturalPerson: {
589
+ website: { optional: true },
590
+ email: true,
591
+ phone: false,
592
+ }
593
+ }
594
+ ```
595
+
596
+ The above will always ask the user for the following for natural persons:
597
+
598
+ - `name` since it is on by default (you can disable it explicitly by setting it to `false`)
599
+ - `website` is show but is optional
600
+ - `email` is required
601
+
602
+ #### Full Example
603
+
604
+ ```ts
605
+ const options: TransactionOptions = {
606
+ fields: {
607
+ naturalPerson: {
608
+ name: true, // Default true
609
+ website: { optional: true },
610
+ email: true,
611
+ phone: true,
612
+ geographicAddress: false,
613
+ nationalIdentification: false,
614
+ dateOfBirth: {
615
+ transmit: true,
616
+ },
617
+ placeOfBirth: false,
618
+ countryOfResidence: true,
619
+ },
620
+ legalPerson: {
621
+ name: true, // Default true
622
+ lei: true, // Default true
623
+ website: { optional: true }, // Default true
624
+ email: true,
625
+ phone: true,
626
+ geographicAddress: false,
627
+ nationalIdentification: false,
628
+ countryOfRegistration: true,
629
+ },
630
+ },
631
+ };
632
+ ```
633
+
634
+ #### Field reference
635
+
636
+ | Field name | Natural | Legal | IVMS101 | description |
637
+ | ------------------------ | ------- | ----- | ------- | --------------------------------------------- |
638
+ | `name` | ✅ | ✅ | 🟩 | Full name |
639
+ | `email` | 🟩 | 🟩 | -- | Email (for your internal purposes) |
640
+ | `website` | -- | ✅ | -- | Business Website (for your internal purposes) |
641
+ | `phone` | 🟩 | 🟩 | -- | Mobile Phone (for your internal purposes) |
642
+ | `geographicAddress` | 🟩 | 🟩 | 🟩 | Residencial or business address |
643
+ | `nationalIdentification` | 🟩 | 🟩 | 🟩 | National Identification number |
644
+ | `dateOfBirth` | 🟩 | -- | 🟩 | Date of birth |
645
+ | `placeOfBirth` | 🟩 | -- | 🟩 | Place of birth |
646
+ | `countryOfResidence` | 🟩 | -- | 🟩 | Country of Residence |
647
+ | `lei` | -- | ✅ | 🟩 | LEI (Legal Entity Identifier) |
648
+ | `countryOfRegistration` | -- | 🟩 | 🟩 | Country of Registration |
649
+
650
+ ## Locales
651
+
652
+ See [locales](_media/locales.ts) for the list of supported locales.
653
+
654
+ ## [License](_media/LICENSE.md)
655
+
656
+ MIT © Notabene Inc.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Notabene
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.