@notabene/javascript-sdk 2.0.0-next.2 → 2.0.0-next.20
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 +281 -231
- package/dist/js/notabene.js +1 -0
- package/dist/notabene.cjs +1 -1
- package/dist/notabene.d.ts +1052 -209
- package/dist/notabene.js +275 -105
- 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 +243 -90
- package/src/types.ts +723 -144
- 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,316 @@ 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
|
+
### Destination address
|
|
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
|
-
|
|
271
|
-
|
|
272
|
-
```js
|
|
273
|
-
{
|
|
274
|
-
primaryColor: '#fff',
|
|
275
|
-
secondaryColor: '#fff',
|
|
276
|
-
primaryFontColor: '#fff',
|
|
277
|
-
secondaryFontColor: '#fff',
|
|
278
|
-
backgroundColor: '#fff',
|
|
279
|
-
fontFamily: Arial,
|
|
280
|
-
logo: {LOGO_URL},
|
|
281
|
-
mode: 'dark', // default: 'light'
|
|
282
|
-
|
|
283
|
-
// If you are using the Signature flow, here is the full list of custom theme that can be applied to the WalletConnect Modal.
|
|
284
|
-
'--w3m-font-family',
|
|
285
|
-
'--w3m-font-feature-settings',
|
|
286
|
-
'--w3m-overlay-background-color',
|
|
287
|
-
'--w3m-overlay-backdrop-filter',
|
|
288
|
-
'--w3m-z-index',
|
|
289
|
-
'--w3m-accent-color',
|
|
290
|
-
'--w3m-accent-fill-color',
|
|
291
|
-
'--w3m-background-color',
|
|
292
|
-
'--w3m-background-image-url',
|
|
293
|
-
'--w3m-logo-image-url',
|
|
294
|
-
'--w3m-background-border-radius',
|
|
295
|
-
'--w3m-container-border-radius',
|
|
296
|
-
'--w3m-wallet-icon-border-radius',
|
|
297
|
-
'--w3m-wallet-icon-large-border-radius',
|
|
298
|
-
'--w3m-wallet-icon-small-border-radius',
|
|
299
|
-
'--w3m-input-border-radius',
|
|
300
|
-
'--w3m-notification-border-radius',
|
|
301
|
-
'--w3m-button-border-radius',
|
|
302
|
-
'--w3m-secondary-button-border-radius',
|
|
303
|
-
'--w3m-icon-button-border-radius',
|
|
304
|
-
'--w3m-button-hover-highlight-border-radius',
|
|
305
|
-
}
|
|
260
|
+
```ts
|
|
261
|
+
withdrawal.on('error', {message} => ...)
|
|
306
262
|
```
|
|
307
263
|
|
|
308
|
-
|
|
264
|
+
## Transaction Options
|
|
309
265
|
|
|
310
|
-
|
|
266
|
+
All components can be configured using an optional [TransactionOptions](./docs/interfaces/TransactionOptions.md) object.
|
|
311
267
|
|
|
312
|
-
|
|
268
|
+
The following shows the full set of options in typescript:
|
|
313
269
|
|
|
314
|
-
|
|
270
|
+
```ts
|
|
271
|
+
import Notabene, {
|
|
272
|
+
AgentType,
|
|
273
|
+
PersonType,
|
|
274
|
+
ProofTypes,
|
|
275
|
+
} from '@notabene/javascript-sdk';
|
|
315
276
|
|
|
316
|
-
|
|
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
|
+
},
|
|
286
|
+
allowedAgentTypes: [AgentType.PRIVATE, AgentType.VASP], // js ['WALLET','VASP']
|
|
287
|
+
allowedCounterpartyTypes: [
|
|
288
|
+
PersonType.LEGAL, // JS: 'legal'
|
|
289
|
+
PersonType.NATURAL, // JS: 'natural'
|
|
290
|
+
PersonType.SELF, // JS: 'self'
|
|
291
|
+
],
|
|
292
|
+
fields: {
|
|
293
|
+
naturalPerson: {
|
|
294
|
+
name: true, // Default true
|
|
295
|
+
website: { optional: true },
|
|
296
|
+
email: true,
|
|
297
|
+
phone: true,
|
|
298
|
+
geographicAddress: false,
|
|
299
|
+
nationalIdentification: false,
|
|
300
|
+
dateOfBirth: false,
|
|
301
|
+
placeOfBirth: false,
|
|
302
|
+
countryOfResidence: true,
|
|
303
|
+
},
|
|
304
|
+
legalPerson: {
|
|
305
|
+
name: true, // Default true
|
|
306
|
+
lei: true, // Default true
|
|
307
|
+
website: { optional: true }, // Default true
|
|
308
|
+
email: true,
|
|
309
|
+
phone: true,
|
|
310
|
+
geographicAddress: false,
|
|
311
|
+
nationalIdentification: false,
|
|
312
|
+
countryOfRegistration: true,
|
|
313
|
+
},
|
|
314
|
+
vasps: {
|
|
315
|
+
addUnknown: true, // Allow users to add a missing VASP - Defaults to false
|
|
316
|
+
onlyActive: true, // Only list active VASPs - Default false
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
const withdrawal = notabene.createWithdrawalAssist(tx, options);
|
|
321
|
+
```
|
|
317
322
|
|
|
318
|
-
|
|
323
|
+
The options can additionally be updated dynamically with the `update()` function.
|
|
319
324
|
|
|
320
325
|
```js
|
|
321
|
-
{
|
|
322
|
-
|
|
323
|
-
|
|
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
|
+
});
|
|
324
339
|
```
|
|
325
340
|
|
|
326
|
-
###### The property name must be the same as the text in the widget, for it to be replaced
|
|
327
341
|
|
|
328
|
-
|
|
342
|
+
### Common use cases
|
|
329
343
|
|
|
330
|
-
|
|
344
|
+
#### Only allow first party transactions
|
|
331
345
|
|
|
332
|
-
|
|
346
|
+
```ts
|
|
347
|
+
const firstParty: TransactionOptions = {
|
|
348
|
+
allowedCounterpartyTypes: [
|
|
349
|
+
PersonType.SELF, // JS: 'self'
|
|
350
|
+
],
|
|
351
|
+
};
|
|
352
|
+
```
|
|
333
353
|
|
|
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) |
|
|
354
|
+
#### Only VASP to VASP transactions
|
|
343
355
|
|
|
344
|
-
|
|
356
|
+
```ts
|
|
357
|
+
const vasp2vasp: TransactionOptions = {
|
|
358
|
+
allowedAgentTypes: [AgentType.VASP], // js ['VASP']
|
|
359
|
+
};
|
|
360
|
+
```
|
|
345
361
|
|
|
346
|
-
|
|
347
|
-
- **optional** - Bypass the jurisdiction rules validation for that specific field - defaults to **false**
|
|
362
|
+
#### Only Self-hosted wallet transactions
|
|
348
363
|
|
|
349
|
-
```
|
|
350
|
-
{
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
},
|
|
354
|
-
geographicAddress: {
|
|
355
|
-
forceDisplay: true,
|
|
356
|
-
optional: true;
|
|
357
|
-
},
|
|
358
|
-
}
|
|
364
|
+
```ts
|
|
365
|
+
const options: TransactionOptions = {
|
|
366
|
+
allowedAgentTypes: [AgentType.PRIVATE], // js ['WALLET']
|
|
367
|
+
};
|
|
359
368
|
```
|
|
360
369
|
|
|
361
|
-
|
|
370
|
+
### Configuring ownership proofs
|
|
362
371
|
|
|
363
|
-
|
|
372
|
+
By default components support message signing proofs.
|
|
364
373
|
|
|
365
|
-
|
|
374
|
+
#### Supporting Micro Transactions (aka Satoshi tests)
|
|
366
375
|
|
|
367
|
-
|
|
376
|
+
You can support Micro Transfers (aka Satoshi tests) by adding a deposit address for the test.
|
|
368
377
|
|
|
369
|
-
|
|
370
|
-
- `beneficiaryGeographicAddress` - Recipient Address
|
|
371
|
-
- `beneficiaryNationalIdentification` - Recipient National Identification
|
|
372
|
-
- `beneficiaryDateAndPlaceOfBirth` - Recipient Date and Place of Birth
|
|
378
|
+
Your compliance team will have to determine how to handle and verify these transactions in the rules engine or individually.
|
|
373
379
|
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
380
|
+
```ts
|
|
381
|
+
const options: TransactionOptions = {
|
|
382
|
+
proofs: {
|
|
383
|
+
microTransfer: {
|
|
384
|
+
destination: '0x...',
|
|
385
|
+
amountSubunits: '1234',
|
|
386
|
+
timeout: 86440, // Optional timeout in seconds, which is displayed to the user
|
|
387
|
+
},
|
|
388
|
+
fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
|
|
389
|
+
},
|
|
390
|
+
};
|
|
381
391
|
```
|
|
382
392
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
### Fallbacks
|
|
393
|
+
Notabene does not currently verify these tests automatically as you likely already have the infrastructure to do so.
|
|
386
394
|
|
|
387
|
-
|
|
395
|
+
You will receive a response back from the component containing a proof object. For MicroTransfers it will look like this:
|
|
388
396
|
|
|
389
|
-
|
|
397
|
+
```ts
|
|
398
|
+
type MicroTransferProof {
|
|
399
|
+
type: ProofTypes.MicroTransfer;
|
|
400
|
+
status: ProofStatus.PENDING;
|
|
401
|
+
did: DID;
|
|
402
|
+
address: CAIP10; // CAIP10 account to be verified
|
|
403
|
+
txhash: string; // Transaction Hash to verify
|
|
404
|
+
chain: CAIP2; // CAIP2 identifier of blockchain
|
|
405
|
+
amountSubunits: string; // Amount in subunits eg (satoshi or wei) to be verified
|
|
406
|
+
}
|
|
407
|
+
```
|
|
390
408
|
|
|
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
|
|
409
|
+
#### Fallback Proof Options
|
|
395
410
|
|
|
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
|
-
```
|
|
411
|
+
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:
|
|
404
412
|
|
|
405
|
-
```
|
|
406
|
-
|
|
413
|
+
```ts
|
|
414
|
+
const options: TransactionOptions = {
|
|
415
|
+
proofs: {
|
|
416
|
+
fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration']
|
|
417
|
+
},
|
|
418
|
+
};
|
|
407
419
|
```
|
|
408
420
|
|
|
409
|
-
|
|
421
|
+
The two options are:
|
|
410
422
|
|
|
411
|
-
|
|
423
|
+
- `screenshot` Where a user is requested to upload a screenshot of their wallet
|
|
424
|
+
- `self-declaration` Where a user self declares that they control the wallet address
|
|
412
425
|
|
|
413
|
-
|
|
414
|
-
const notabene = new Notabene({
|
|
415
|
-
widget: 'https://beta-widget.notabene.id',
|
|
416
|
-
container: '#container',
|
|
417
|
-
authToken: '{CUSTOMER_TOKEN}'
|
|
418
|
-
theme: {THEME},
|
|
419
|
-
dictionary: {DICTIONARY},
|
|
420
|
-
fallbacks: [{flow: "WALLET_NOT_SUPPORTED", action: "DECLARATION"}]
|
|
421
|
-
});
|
|
422
|
-
```
|
|
426
|
+
### Counterparty Field Properties
|
|
423
427
|
|
|
424
|
-
|
|
428
|
+
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.
|
|
425
429
|
|
|
426
|
-
|
|
430
|
+
We recommend working closely with your compliance team for this. Bearing in mind that different jurisdictions have different rules.
|
|
427
431
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
432
|
+
Each field can be configured like this:
|
|
433
|
+
|
|
434
|
+
- `true` required field
|
|
435
|
+
- `false` don't show
|
|
436
|
+
- `{ optional: true }` show but don't require
|
|
437
|
+
- `{ transmit: true }` Include in beneficiary field of IVMS101 to be transmitted to counterparty
|
|
438
|
+
|
|
439
|
+
Eg:
|
|
440
|
+
|
|
441
|
+
```ts
|
|
442
|
+
{
|
|
443
|
+
naturalPerson: {
|
|
444
|
+
website: { optional: true },
|
|
445
|
+
email: true,
|
|
446
|
+
phone: false,
|
|
447
|
+
}
|
|
448
|
+
}
|
|
437
449
|
```
|
|
438
450
|
|
|
439
|
-
|
|
451
|
+
The above will always ask the user for the following for natural persons:
|
|
452
|
+
|
|
453
|
+
- `name` since it is on by default (you can disable it explicitly by setting it to `false`)
|
|
454
|
+
- `website` is show but is optional
|
|
455
|
+
- `email` is required
|
|
456
|
+
|
|
457
|
+
#### Full Example
|
|
458
|
+
|
|
459
|
+
```ts
|
|
460
|
+
const options: TransactionOptions = {
|
|
461
|
+
fields: {
|
|
462
|
+
naturalPerson: {
|
|
463
|
+
name: true, // Default true
|
|
464
|
+
website: { optional: true },
|
|
465
|
+
email: true,
|
|
466
|
+
phone: true,
|
|
467
|
+
geographicAddress: false,
|
|
468
|
+
nationalIdentification: false,
|
|
469
|
+
dateOfBirth: {
|
|
470
|
+
transmit: true,
|
|
471
|
+
},
|
|
472
|
+
placeOfBirth: false,
|
|
473
|
+
countryOfResidence: true,
|
|
474
|
+
},
|
|
475
|
+
legalPerson: {
|
|
476
|
+
name: true, // Default true
|
|
477
|
+
lei: true, // Default true
|
|
478
|
+
website: { optional: true }, // Default true
|
|
479
|
+
email: true,
|
|
480
|
+
phone: true,
|
|
481
|
+
geographicAddress: false,
|
|
482
|
+
nationalIdentification: false,
|
|
483
|
+
countryOfRegistration: true,
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
};
|
|
487
|
+
```
|
|
440
488
|
|
|
441
|
-
|
|
489
|
+
#### Field reference
|
|
442
490
|
|
|
443
|
-
|
|
491
|
+
| Field name | Natural | Legal | IVMS101 | Transmitted | description |
|
|
492
|
+
| ------------------------ | ------- | ----- | ------- | ----------- | --------------------------------------------- |
|
|
493
|
+
| `name` | ✅ | ✅ | ✅ | ✅ | Full name |
|
|
494
|
+
| `email` | 🟩 | 🟩 | -- | -- | Email (for your internal purposes) |
|
|
495
|
+
| `website` | -- | ✅ | -- | -- | Business Website (for your internal purposes) |
|
|
496
|
+
| `phone` | 🟩 | 🟩 | -- | -- | Mobile Phone (for your internal purposes) |
|
|
497
|
+
| `geographicAddress` | 🟩 | 🟩 | ✅ | 🟩 | Residencial or business address |
|
|
498
|
+
| `nationalIdentification` | 🟩 | 🟩 | ✅ | 🟩 | National Identification number |
|
|
499
|
+
| `dateOfBirth` | 🟩 | -- | ✅ | 🟩 | Date of birth |
|
|
500
|
+
| `placeOfBirth` | 🟩 | -- | ✅ | 🟩 | Place of birth |
|
|
501
|
+
| `countryOfResidence` | 🟩 | -- | ✅ | 🟩 | Country of Residence |
|
|
502
|
+
| `lei` | -- | ✅ | ✅ | ✅ | LEI (Legal Entity Identifier) |
|
|
503
|
+
| `countryOfRegistration` | -- | 🟩 | ✅ | 🟩 | Country of Registration |
|
|
444
504
|
|
|
445
|
-
|
|
505
|
+
## Locales
|
|
446
506
|
|
|
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
|
-
```
|
|
507
|
+
See [locales](src/locales.ts) for the list of supported locales.
|
|
458
508
|
|
|
459
509
|
## [License](LICENSE.md)
|
|
460
510
|
|
|
461
|
-
|
|
511
|
+
MIT © Notabene Inc.
|