@notabene/javascript-sdk 2.0.0-next.2 → 2.0.0-next.21
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/LICENSE.md +21 -0
- package/README.md +289 -233
- package/dist/js/notabene.js +1 -0
- package/dist/notabene.cjs +1 -1
- package/dist/notabene.d.ts +1092 -214
- package/dist/notabene.js +284 -113
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +36 -26
- package/src/__tests__/notabene.test.ts +43 -0
- package/src/components/EmbeddedComponent.ts +141 -22
- package/src/components/__tests__/EmbeddedComponent.test.ts +73 -20
- package/src/ivms/types.ts +230 -152
- package/src/locales.ts +47 -0
- package/src/notabene.ts +247 -90
- package/src/types.ts +769 -152
- package/src/utils/MessageEventManager.ts +70 -12
- package/src/utils/__tests__/MessageEventManager.test.ts +13 -5
- package/src/utils/arbitraries.ts +9 -4
- package/.editorconfig +0 -10
- package/.gitlab-ci.yml +0 -85
- package/.husky/commit-msg +0 -4
- package/.husky/pre-commit +0 -4
- package/.husky/pre-push +0 -4
- package/.prettierrc +0 -4
- package/.releaserc.json +0 -16
- package/.vscode/extensions.json +0 -3
- package/.vscode/settings.json +0 -11
- package/.yarn/releases/yarn-berry.cjs +0 -925
- package/.yarnrc.yml +0 -3
- package/CODEOWNERS +0 -1
- package/api-extractor.json +0 -434
- package/eslint.config.js +0 -24
- package/etc/javascript-sdk.api.md +0 -363
- package/index.html +0 -137
- package/temp/javascript-sdk.api.json +0 -3509
- package/temp/javascript-sdk.api.md +0 -363
- package/ts-out/src/__tests__/notabene.test.d.ts +0 -1
- package/ts-out/src/__tests__/notabene.test.js +0 -88
- package/ts-out/src/arbitraries.d.ts +0 -4
- package/ts-out/src/arbitraries.js +0 -8
- package/ts-out/src/components/EmbeddedComponent.d.ts +0 -25
- package/ts-out/src/components/EmbeddedComponent.js +0 -87
- package/ts-out/src/components/__tests__/EmbeddedComponent.test.d.ts +0 -1
- package/ts-out/src/components/__tests__/EmbeddedComponent.test.js +0 -132
- package/ts-out/src/ivms/types.d.ts +0 -252
- package/ts-out/src/ivms/types.js +0 -1
- package/ts-out/src/notabene.d.ts +0 -35
- package/ts-out/src/notabene.js +0 -59
- package/ts-out/src/types.d.ts +0 -357
- package/ts-out/src/types.js +0 -85
- package/ts-out/src/utils/MessageEventManager.d.ts +0 -12
- package/ts-out/src/utils/MessageEventManager.js +0 -45
- package/ts-out/src/utils/__tests__/MessageEventManager.test.d.ts +0 -1
- package/ts-out/src/utils/__tests__/MessageEventManager.test.js +0 -73
- package/ts-out/src/utils/arbitraries.d.ts +0 -6
- package/ts-out/src/utils/arbitraries.js +0 -7
- package/ts-out/src/utils/caip.d.ts +0 -13
- package/ts-out/src/utils/caip.js +0 -15
- package/ts-out/src/utils/urls.d.ts +0 -1
- package/ts-out/src/utils/urls.js +0 -14
- package/ts-out/tsconfig.tsbuildinfo +0 -1
- package/tsconfig.json +0 -22
- package/tsconfig.tsbuildinfo +0 -1
- package/vite.config.js +0 -13
package/README.md
CHANGED
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
# JavaScript SDK
|
|
7
7
|
|
|
8
|
-
[](https://gitlab.com/notabene/open-source/javascript-sdk/-/releases)
|
|
8
|
+
[](https://gitlab.com/notabene/open-source/javascript-sdk/-/commits/v2)
|
|
10
9
|
|
|
11
10
|
This library is the JavaScript SDK for loading the Notabene UX components in the front-end.
|
|
12
11
|
|
|
13
|
-
[Documentation](https://devx.notabene.id/docs/
|
|
12
|
+
[Documentation](https://devx.notabene.id/docs/embedded=ux)
|
|
14
13
|
[Installation](#installation)
|
|
15
14
|
|
|
16
15
|
</div>
|
|
@@ -27,17 +26,17 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
|
|
|
27
26
|
- [Asset specification](#asset-specification)
|
|
28
27
|
- [Transaction amount specification](#transaction-amount-specification)
|
|
29
28
|
- [Destination address](#destination-address)
|
|
30
|
-
- [
|
|
31
|
-
- [
|
|
32
|
-
- [
|
|
33
|
-
- [
|
|
34
|
-
- [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- [
|
|
38
|
-
- [
|
|
39
|
-
- [
|
|
40
|
-
|
|
29
|
+
- [Destination address](#destination-address-1)
|
|
30
|
+
- [Connect Wallet](#connect-wallet)
|
|
31
|
+
- [Asset specification](#asset-specification-1)
|
|
32
|
+
- [Modal](#modal)
|
|
33
|
+
- [Linked Component](#linked-component-1)
|
|
34
|
+
- [Error handling](#error-handling)
|
|
35
|
+
- [Transaction Options](#transaction-options)
|
|
36
|
+
- [Common use cases](#common-use-cases)
|
|
37
|
+
- [Configuring ownership proofs](#configuring-ownership-proofs)
|
|
38
|
+
- [Counterparty Field Properties](#counterparty-field-properties)
|
|
39
|
+
- [Locales](#locales)
|
|
41
40
|
- [License](#license)
|
|
42
41
|
|
|
43
42
|
## Installation
|
|
@@ -45,13 +44,27 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
|
|
|
45
44
|
There are two options for loading the Notabene SDK:
|
|
46
45
|
|
|
47
46
|
```bash
|
|
48
|
-
<script id="notabene" async src="https://unpkg.com/@notabene/javascript-sdk@
|
|
47
|
+
<script id="notabene" async src="https://unpkg.com/@notabene/javascript-sdk@next/dist/notabene.js"></script>
|
|
49
48
|
```
|
|
50
49
|
|
|
51
50
|
Or installing the library:
|
|
52
51
|
|
|
52
|
+
Using Yarn:
|
|
53
|
+
|
|
53
54
|
```bash
|
|
54
|
-
yarn add @notabene/javascript-sdk
|
|
55
|
+
yarn add @notabene/javascript-sdk@next
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Using NPM:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install @notabene/javascript-sdk@next
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If you installed the library into your project, you can import it into your project:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import Notabene from '@notabene/javascript-sdk';
|
|
55
68
|
```
|
|
56
69
|
|
|
57
70
|
## Usage
|
|
@@ -67,10 +80,10 @@ Use the [customer token endpoint](https://devx.notabene.id/docs/customertoken) w
|
|
|
67
80
|
Create a new Notabene instance:
|
|
68
81
|
|
|
69
82
|
```js
|
|
70
|
-
|
|
71
83
|
const notabene = new Notabene({
|
|
72
|
-
nodeUrl: 'https://api.notabene.id',
|
|
73
|
-
authToken: '{CUSTOMER_TOKEN}'
|
|
84
|
+
nodeUrl: 'https://api.notabene.id', // use `https://api.notabene.dev` for testing
|
|
85
|
+
authToken: '{CUSTOMER_TOKEN}',
|
|
86
|
+
locale: 'de', // default locale = `en`
|
|
74
87
|
});
|
|
75
88
|
```
|
|
76
89
|
|
|
@@ -94,19 +107,20 @@ Instantiate the withdrawal element and mount it using the id from above
|
|
|
94
107
|
|
|
95
108
|
```js
|
|
96
109
|
const withdrawal = notabene.createWithdrawalAssist(tx, options);
|
|
97
|
-
withdrawal.mount(
|
|
110
|
+
withdrawal.mount('nb-withdrawal');
|
|
98
111
|
```
|
|
99
112
|
|
|
100
113
|
The simplest way to get the result is to use:
|
|
101
114
|
|
|
102
115
|
```js
|
|
103
116
|
try {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
117
|
+
const { valid, value, txCreate, ivms101, proof } =
|
|
118
|
+
await withdrawal.completion();
|
|
119
|
+
if (valid) {
|
|
120
|
+
// Submit result to your backend
|
|
121
|
+
}
|
|
108
122
|
} catch (e) {
|
|
109
|
-
|
|
123
|
+
console.error(e);
|
|
110
124
|
}
|
|
111
125
|
```
|
|
112
126
|
|
|
@@ -118,14 +132,14 @@ To update the component as users enter transaction details:
|
|
|
118
132
|
withdrawal.update({
|
|
119
133
|
asset: 'ETH',
|
|
120
134
|
destination: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
|
|
121
|
-
amountDecimal: 1.12
|
|
135
|
+
amountDecimal: 1.12,
|
|
122
136
|
});
|
|
123
137
|
```
|
|
124
138
|
|
|
125
139
|
To be notified once the validation is completed so you can submit the withdrawal to your back end:
|
|
126
140
|
|
|
127
141
|
```js
|
|
128
|
-
withdrawal.on('
|
|
142
|
+
withdrawal.on('complete', { valid, value, txCreate, ivms101, proof } => ...)
|
|
129
143
|
```
|
|
130
144
|
|
|
131
145
|
To be notified of any errors use:
|
|
@@ -172,7 +186,6 @@ The `asset` field the following types of assets specified:
|
|
|
172
186
|
Use one of the following
|
|
173
187
|
|
|
174
188
|
- `amountDecimal` A number specifying the amount in decimal format. Eg. `amountDecimal=1.1` would mean 1.1 of for example BTC or ETH.
|
|
175
|
-
- `amountSubunits` A string specifying the amount in the native blockchain subunits eg Satoshi for Bitcoin or wei for Ethereum
|
|
176
189
|
|
|
177
190
|
### Destination address
|
|
178
191
|
|
|
@@ -183,279 +196,322 @@ Specify the beneficiary address as `destination` using one of the following form
|
|
|
183
196
|
- [BIP-21](https://en.bitcoin.it/wiki/BIP_0021) Bitcoin URI
|
|
184
197
|
- Native blockchain address
|
|
185
198
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
### Error handling
|
|
189
|
-
|
|
190
|
-
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`.
|
|
199
|
+
### Asset Price
|
|
191
200
|
|
|
192
|
-
|
|
201
|
+
The price of the asset is used to determine certain rules based on thresholds. We recommond you pass in your price like this:
|
|
193
202
|
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
code: number;
|
|
199
|
-
type: string;
|
|
203
|
+
```ts
|
|
204
|
+
assetPrice: {
|
|
205
|
+
currency: 'USD', // ISO currency code
|
|
206
|
+
price: 1700.12, // Asset price
|
|
200
207
|
};
|
|
201
|
-
|
|
202
|
-
const notabene = new Notabene({
|
|
203
|
-
...,
|
|
204
|
-
onError: (err) => {
|
|
205
|
-
const errorData = err.data;
|
|
206
|
-
|
|
207
|
-
// Do something
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
208
|
```
|
|
211
209
|
|
|
212
|
-
|
|
210
|
+
## Connect Wallet
|
|
213
211
|
|
|
214
|
-
|
|
215
|
-
-- | -- | -- | --
|
|
216
|
-
`BAD_REQUEST` | `400` | `Bad Request` | `NotabeneBadRequest: ...`
|
|
217
|
-
`TRANSACTION_INVALID` | `400` | `Transaction Invalid` | `NotabeneTransactionInvalid: ...`
|
|
218
|
-
`TOKEN_INVALID` | `401` | `Token Invalid` | `NotabeneTokenInvalid: ...`
|
|
219
|
-
`ASSET_NOT_SUPPORTED` | `404` | `Asset Not Supported` | `NotabeneAssetNotSupported: ...`
|
|
220
|
-
`SERVICE_UNAVAILABLE` | `500` | `Service Unavailable` | `NotabeneServiceUnavailable: ...`
|
|
221
|
-
`WALLET_CONNECTED_FAILED` | `500` | `Wallet Connection Failed` | `NotabeneWalletConnectionFailed: ...`
|
|
222
|
-
`WALLET_NOT_SUPPORTED` | `501` | `Wallet Not Supported` | `NotabeneWalletNotSupported: ...`
|
|
212
|
+
The Connect Wallet component helps you collect and verify the address of your users self-hosted wallet in one go.
|
|
223
213
|
|
|
224
|
-
|
|
214
|
+
### Asset specification
|
|
225
215
|
|
|
226
|
-
|
|
216
|
+
The `asset` field the following types of assets specified:
|
|
227
217
|
|
|
228
|
-
|
|
218
|
+
- `notabene_asset` code passed as a`string`. See [Notabene Assets Service](https://devx.notabene.id/docs/coins-decimals#assets-service-api).
|
|
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.
|
|
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.
|
|
229
221
|
|
|
230
|
-
|
|
222
|
+
### Modal
|
|
231
223
|
|
|
232
|
-
|
|
233
|
-
`VASP_2_VASP_ONLY`: Only transaction destinations that are VASPs are allowed.
|
|
234
|
-
`FIRST_PARTY_ONLY`: Only transaction destinations that the originator owns are allowed.
|
|
224
|
+
Instantiate the modal and open it
|
|
235
225
|
|
|
236
|
-
|
|
226
|
+
```js
|
|
227
|
+
const connect = notabene.createConnectWallet({ asset: 'ETH' }, options);
|
|
228
|
+
const { valid, value, txCreate, ivms101, proof } = await connect.openModal();
|
|
229
|
+
```
|
|
237
230
|
|
|
238
|
-
|
|
231
|
+
### Linked Component
|
|
239
232
|
|
|
240
|
-
|
|
233
|
+
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.
|
|
241
234
|
|
|
242
|
-
|
|
243
|
-
|
|
235
|
+
```js
|
|
236
|
+
const connect = notabene.createConnectWallet({asset:'ETH'}, options, {
|
|
237
|
+
callback: /// a serverside backend url
|
|
238
|
+
redirectUri: // URI of website or mobile app to redirect user to after completion
|
|
239
|
+
});
|
|
244
240
|
|
|
245
|
-
|
|
241
|
+
// NodeJS redirect. Link also works in an email.
|
|
242
|
+
res.redirect(withdrawal.url);
|
|
243
|
+
```
|
|
246
244
|
|
|
247
|
-
|
|
245
|
+
Bear in mind that this is a full screen view for your users.
|
|
248
246
|
|
|
249
|
-
|
|
247
|
+
The two parameters that should be configured are:
|
|
250
248
|
|
|
251
|
-
|
|
249
|
+
- `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.
|
|
250
|
+
- `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.
|
|
252
251
|
|
|
253
|
-
|
|
254
|
-
const notabene = new Notabene({
|
|
255
|
-
vaspDID: 'did:ethr:0x94c38fd29ef36f5cb2f7bc771f9d5bd9f7d05f27',
|
|
256
|
-
widget: 'https://beta-widget.notabene.id',
|
|
257
|
-
container: '#container',
|
|
258
|
-
authToken: '{CUSTOMER_TOKEN}'
|
|
259
|
-
allowedTransactionTypes: 'VASP_2_VASP_ONLY',
|
|
260
|
-
nonCustodialDeclarationType: 'DECLARATION',
|
|
261
|
-
});
|
|
262
|
-
```
|
|
252
|
+
**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.
|
|
263
253
|
|
|
264
254
|
---
|
|
265
255
|
|
|
266
|
-
|
|
256
|
+
## Error handling
|
|
267
257
|
|
|
268
|
-
|
|
258
|
+
If any error occurs, the `error` event is passed containing a message.
|
|
269
259
|
|
|
270
|
-
|
|
260
|
+
```ts
|
|
261
|
+
withdrawal.on('error', {message} => ...)
|
|
262
|
+
```
|
|
271
263
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
'
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
264
|
+
## Transaction Options
|
|
265
|
+
|
|
266
|
+
All components can be configured using an optional [TransactionOptions](./docs/interfaces/TransactionOptions.md) object.
|
|
267
|
+
|
|
268
|
+
The following shows the full set of options in typescript:
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
import Notabene, {
|
|
272
|
+
AgentType,
|
|
273
|
+
PersonType,
|
|
274
|
+
ProofTypes,
|
|
275
|
+
} from '@notabene/javascript-sdk';
|
|
276
|
+
|
|
277
|
+
const options: TransactionOptions = {
|
|
278
|
+
proofs: {
|
|
279
|
+
microTransfer: {
|
|
280
|
+
destination: '0x...',
|
|
281
|
+
amountSubunits: '12344',
|
|
282
|
+
timeout: 86440,
|
|
283
|
+
},
|
|
284
|
+
fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
|
|
285
|
+
deminimis: {
|
|
286
|
+
threshold: 1000,
|
|
287
|
+
currency: 'EUR',
|
|
288
|
+
proofTypes: [ProofTypes.SelfDeclaration]
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
allowedAgentTypes: [AgentType.PRIVATE, AgentType.VASP], // js ['WALLET','VASP']
|
|
292
|
+
allowedCounterpartyTypes: [
|
|
293
|
+
PersonType.LEGAL, // JS: 'legal'
|
|
294
|
+
PersonType.NATURAL, // JS: 'natural'
|
|
295
|
+
PersonType.SELF, // JS: 'self'
|
|
296
|
+
],
|
|
297
|
+
fields: {
|
|
298
|
+
naturalPerson: {
|
|
299
|
+
name: true, // Default true
|
|
300
|
+
website: { optional: true },
|
|
301
|
+
email: true,
|
|
302
|
+
phone: true,
|
|
303
|
+
geographicAddress: false,
|
|
304
|
+
nationalIdentification: false,
|
|
305
|
+
dateOfBirth: false,
|
|
306
|
+
placeOfBirth: false,
|
|
307
|
+
countryOfResidence: true,
|
|
308
|
+
},
|
|
309
|
+
legalPerson: {
|
|
310
|
+
name: true, // Default true
|
|
311
|
+
lei: true, // Default true
|
|
312
|
+
website: { optional: true }, // Default true
|
|
313
|
+
email: true,
|
|
314
|
+
phone: true,
|
|
315
|
+
geographicAddress: false,
|
|
316
|
+
nationalIdentification: false,
|
|
317
|
+
countryOfRegistration: true,
|
|
318
|
+
},
|
|
319
|
+
vasps: {
|
|
320
|
+
addUnknown: true, // Allow users to add a missing VASP - Defaults to false
|
|
321
|
+
onlyActive: true, // Only list active VASPs - Default false
|
|
322
|
+
},
|
|
323
|
+
hide: [ValidationSections.ASSET, ValidationSections.DESTINATION] // Don't show specific sections of component
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
const withdrawal = notabene.createWithdrawalAssist(tx, options);
|
|
306
327
|
```
|
|
307
328
|
|
|
308
|
-
|
|
329
|
+
The options can additionally be updated dynamically with the `update()` function.
|
|
309
330
|
|
|
310
|
-
|
|
331
|
+
```js
|
|
332
|
+
withdrawal.update({
|
|
333
|
+
asset: 'ETH',
|
|
334
|
+
destination: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
|
|
335
|
+
amountDecimal: 1.12,
|
|
336
|
+
}, {
|
|
337
|
+
proofs: {
|
|
338
|
+
microTransfer: {
|
|
339
|
+
destination: '0x...',
|
|
340
|
+
amountSubunits: '12344',
|
|
341
|
+
timeout: 86440,
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
```
|
|
311
346
|
|
|
312
|
-
---
|
|
313
347
|
|
|
314
|
-
###
|
|
348
|
+
### Common use cases
|
|
315
349
|
|
|
316
|
-
|
|
350
|
+
#### Only allow first party transactions
|
|
317
351
|
|
|
318
|
-
|
|
352
|
+
```ts
|
|
353
|
+
const firstParty: TransactionOptions = {
|
|
354
|
+
allowedCounterpartyTypes: [
|
|
355
|
+
PersonType.SELF, // JS: 'self'
|
|
356
|
+
],
|
|
357
|
+
};
|
|
358
|
+
```
|
|
319
359
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
360
|
+
#### Only VASP to VASP transactions
|
|
361
|
+
|
|
362
|
+
```ts
|
|
363
|
+
const vasp2vasp: TransactionOptions = {
|
|
364
|
+
allowedAgentTypes: [AgentType.VASP], // js ['VASP']
|
|
365
|
+
};
|
|
324
366
|
```
|
|
325
367
|
|
|
326
|
-
|
|
368
|
+
#### Only Self-hosted wallet transactions
|
|
327
369
|
|
|
328
|
-
|
|
370
|
+
```ts
|
|
371
|
+
const options: TransactionOptions = {
|
|
372
|
+
allowedAgentTypes: [AgentType.PRIVATE], // js ['WALLET']
|
|
373
|
+
};
|
|
374
|
+
```
|
|
329
375
|
|
|
330
|
-
###
|
|
376
|
+
### Configuring ownership proofs
|
|
331
377
|
|
|
332
|
-
|
|
378
|
+
By default components support message signing proofs.
|
|
333
379
|
|
|
334
|
-
|
|
335
|
-
| ------------------------ | -------------- | ---------- | ------------------------------------------------------- |
|
|
336
|
-
| `counterparty` | -- | ☑️ | Counterparty VASP or Wallet (destination or originator) |
|
|
337
|
-
| `dateAndPlaceOfBirth` | ☑️ | -- | Recipient (or Sender) Date and Place of Birth |
|
|
338
|
-
| `geographicAddress` | ☑️ | ☑️ | Recipient (or Sender) Address |
|
|
339
|
-
| `firstName` | ☑️ | -- | Recipient (or Sender) First name |
|
|
340
|
-
| `name` | ☑️ | -- | Recipient (or Sender) Last Name / Company Name |
|
|
341
|
-
| `nationalIdentification` | ☑️ | --️ | Recipient (or Sender) National Identification |
|
|
342
|
-
| `country` | ☑️ | ☑️ | Recipient (or Sender) Country of Residence (for natural person) / Country of Registration (for legal person) |
|
|
380
|
+
#### Supporting Micro Transactions (aka Satoshi tests)
|
|
343
381
|
|
|
344
|
-
|
|
382
|
+
You can support Micro Transfers (aka Satoshi tests) by adding a deposit address for the test.
|
|
345
383
|
|
|
346
|
-
|
|
347
|
-
- **optional** - Bypass the jurisdiction rules validation for that specific field - defaults to **false**
|
|
384
|
+
Your compliance team will have to determine how to handle and verify these transactions in the rules engine or individually.
|
|
348
385
|
|
|
349
|
-
```
|
|
350
|
-
{
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
386
|
+
```ts
|
|
387
|
+
const options: TransactionOptions = {
|
|
388
|
+
proofs: {
|
|
389
|
+
microTransfer: {
|
|
390
|
+
destination: '0x...',
|
|
391
|
+
amountSubunits: '1234',
|
|
392
|
+
timeout: 86440, // Optional timeout in seconds, which is displayed to the user
|
|
393
|
+
},
|
|
394
|
+
fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
|
|
357
395
|
},
|
|
358
|
-
}
|
|
396
|
+
};
|
|
359
397
|
```
|
|
360
398
|
|
|
361
|
-
|
|
399
|
+
Notabene does not currently verify these tests automatically as you likely already have the infrastructure to do so.
|
|
362
400
|
|
|
363
|
-
|
|
401
|
+
You will receive a response back from the component containing a proof object. For MicroTransfers it will look like this:
|
|
364
402
|
|
|
365
|
-
|
|
403
|
+
```ts
|
|
404
|
+
type MicroTransferProof {
|
|
405
|
+
type: ProofTypes.MicroTransfer;
|
|
406
|
+
status: ProofStatus.PENDING;
|
|
407
|
+
did: DID;
|
|
408
|
+
address: CAIP10; // CAIP10 account to be verified
|
|
409
|
+
txhash: string; // Transaction Hash to verify
|
|
410
|
+
chain: CAIP2; // CAIP2 identifier of blockchain
|
|
411
|
+
amountSubunits: string; // Amount in subunits eg (satoshi or wei) to be verified
|
|
412
|
+
}
|
|
413
|
+
```
|
|
366
414
|
|
|
367
|
-
|
|
415
|
+
#### Fallback Proof Options
|
|
368
416
|
|
|
369
|
-
|
|
370
|
-
- `beneficiaryGeographicAddress` - Recipient Address
|
|
371
|
-
- `beneficiaryNationalIdentification` - Recipient National Identification
|
|
372
|
-
- `beneficiaryDateAndPlaceOfBirth` - Recipient Date and Place of Birth
|
|
417
|
+
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:
|
|
373
418
|
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
];
|
|
419
|
+
```ts
|
|
420
|
+
const options: TransactionOptions = {
|
|
421
|
+
proofs: {
|
|
422
|
+
fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
|
|
423
|
+
},
|
|
424
|
+
};
|
|
381
425
|
```
|
|
382
426
|
|
|
383
|
-
|
|
427
|
+
The two options are:
|
|
384
428
|
|
|
385
|
-
|
|
429
|
+
- `screenshot` Where a user is requested to upload a screenshot of their wallet
|
|
430
|
+
- `self-declaration` Where a user self declares that they control the wallet address
|
|
386
431
|
|
|
387
|
-
|
|
432
|
+
### Counterparty Field Properties
|
|
388
433
|
|
|
389
|
-
|
|
434
|
+
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.
|
|
390
435
|
|
|
391
|
-
|
|
392
|
-
- `DECLARATION` - Falls back to the self declaration flow
|
|
393
|
-
- `REJECT` - Rejects the transaction and throws an error
|
|
394
|
-
- The error that will be thrown here will have the following structure
|
|
436
|
+
We recommend working closely with your compliance team for this. Bearing in mind that different jurisdictions have different rules.
|
|
395
437
|
|
|
396
|
-
|
|
397
|
-
{
|
|
398
|
-
"type": "WALLET_NOT_SUPPORTED",
|
|
399
|
-
"title": "Wallet Not Supported",
|
|
400
|
-
"status": 501,
|
|
401
|
-
"detail": "We don't support the wallet for the provided asset"
|
|
402
|
-
}
|
|
403
|
-
```
|
|
438
|
+
Each field can be configured like this:
|
|
404
439
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
440
|
+
- `true` required field
|
|
441
|
+
- `false` don't show
|
|
442
|
+
- `{ optional: true }` show but don't require
|
|
443
|
+
- `{ transmit: true }` Include in beneficiary field of IVMS101 to be transmitted to counterparty
|
|
408
444
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
Finally you pass the configuration to a Notabene instance:
|
|
445
|
+
Eg:
|
|
412
446
|
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
});
|
|
447
|
+
```ts
|
|
448
|
+
{
|
|
449
|
+
naturalPerson: {
|
|
450
|
+
website: { optional: true },
|
|
451
|
+
email: true,
|
|
452
|
+
phone: false,
|
|
453
|
+
}
|
|
454
|
+
}
|
|
422
455
|
```
|
|
423
456
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
457
|
+
The above will always ask the user for the following for natural persons:
|
|
458
|
+
|
|
459
|
+
- `name` since it is on by default (you can disable it explicitly by setting it to `false`)
|
|
460
|
+
- `website` is show but is optional
|
|
461
|
+
- `email` is required
|
|
462
|
+
|
|
463
|
+
#### Full Example
|
|
464
|
+
|
|
465
|
+
```ts
|
|
466
|
+
const options: TransactionOptions = {
|
|
467
|
+
fields: {
|
|
468
|
+
naturalPerson: {
|
|
469
|
+
name: true, // Default true
|
|
470
|
+
website: { optional: true },
|
|
471
|
+
email: true,
|
|
472
|
+
phone: true,
|
|
473
|
+
geographicAddress: false,
|
|
474
|
+
nationalIdentification: false,
|
|
475
|
+
dateOfBirth: {
|
|
476
|
+
transmit: true,
|
|
477
|
+
},
|
|
478
|
+
placeOfBirth: false,
|
|
479
|
+
countryOfResidence: true,
|
|
480
|
+
},
|
|
481
|
+
legalPerson: {
|
|
482
|
+
name: true, // Default true
|
|
483
|
+
lei: true, // Default true
|
|
484
|
+
website: { optional: true }, // Default true
|
|
485
|
+
email: true,
|
|
486
|
+
phone: true,
|
|
487
|
+
geographicAddress: false,
|
|
488
|
+
nationalIdentification: false,
|
|
489
|
+
countryOfRegistration: true,
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
};
|
|
437
493
|
```
|
|
438
494
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
- `REUSE_ADDRESS_OWNERSHIP_PROOF`: For a given unique customer (identified by the `customerRef` from the customer token used) + unique wallet address, the widget would not ask for data collection if the customer previously verified the address ownership in a previous first party self-hosted transfer.
|
|
495
|
+
#### Field reference
|
|
442
496
|
|
|
443
|
-
|
|
497
|
+
| Field name | Natural | Legal | IVMS101 | Transmitted | description |
|
|
498
|
+
| ------------------------ | ------- | ----- | ------- | ----------- | --------------------------------------------- |
|
|
499
|
+
| `name` | ✅ | ✅ | ✅ | ✅ | Full name |
|
|
500
|
+
| `email` | 🟩 | 🟩 | -- | -- | Email (for your internal purposes) |
|
|
501
|
+
| `website` | -- | ✅ | -- | -- | Business Website (for your internal purposes) |
|
|
502
|
+
| `phone` | 🟩 | 🟩 | -- | -- | Mobile Phone (for your internal purposes) |
|
|
503
|
+
| `geographicAddress` | 🟩 | 🟩 | ✅ | 🟩 | Residencial or business address |
|
|
504
|
+
| `nationalIdentification` | 🟩 | 🟩 | ✅ | 🟩 | National Identification number |
|
|
505
|
+
| `dateOfBirth` | 🟩 | -- | ✅ | 🟩 | Date of birth |
|
|
506
|
+
| `placeOfBirth` | 🟩 | -- | ✅ | 🟩 | Place of birth |
|
|
507
|
+
| `countryOfResidence` | 🟩 | -- | ✅ | 🟩 | Country of Residence |
|
|
508
|
+
| `lei` | -- | ✅ | ✅ | ✅ | LEI (Legal Entity Identifier) |
|
|
509
|
+
| `countryOfRegistration` | -- | 🟩 | ✅ | 🟩 | Country of Registration |
|
|
444
510
|
|
|
445
|
-
|
|
511
|
+
## Locales
|
|
446
512
|
|
|
447
|
-
|
|
448
|
-
notabene.setTransaction({
|
|
449
|
-
transactionAsset: 'ASSET_UNSUPPORTED_FROM_NOTABENE',
|
|
450
|
-
beneficiaryAccountNumber: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
|
|
451
|
-
transactionAmount: '2000000000',
|
|
452
|
-
customAssetPrice: {
|
|
453
|
-
priceUSD: 1700.12, // Asset price in USD
|
|
454
|
-
decimals: 10 // Decimals used for the given transactionAmount
|
|
455
|
-
};
|
|
456
|
-
});
|
|
457
|
-
```
|
|
513
|
+
See [locales](src/locales.ts) for the list of supported locales.
|
|
458
514
|
|
|
459
515
|
## [License](LICENSE.md)
|
|
460
516
|
|
|
461
|
-
|
|
517
|
+
MIT © Notabene Inc.
|