@notabene/javascript-sdk 2.0.0 → 2.0.1
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 +64 -58
- package/package.json +5 -4
- package/src/components/EmbeddedComponent.ts +2 -2
- package/src/locales.ts +2 -1
- package/dist/notabene.d.ts +0 -1565
- package/dist/tsdoc-metadata.json +0 -11
package/README.md
CHANGED
|
@@ -81,14 +81,14 @@ import Notabene from '@notabene/javascript-sdk';
|
|
|
81
81
|
// 1. Create Notabene instance
|
|
82
82
|
const notabene = new Notabene({
|
|
83
83
|
nodeUrl: 'https://api.notabene.id',
|
|
84
|
-
authToken: 'YOUR_CUSTOMER_TOKEN'
|
|
84
|
+
authToken: 'YOUR_CUSTOMER_TOKEN',
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
// 2. Create and mount withdrawal component
|
|
88
88
|
const withdrawal = notabene.createWithdrawalAssist({
|
|
89
89
|
asset: 'ETH',
|
|
90
90
|
destination: '0x1234...',
|
|
91
|
-
amountDecimal: 1.0
|
|
91
|
+
amountDecimal: 1.0,
|
|
92
92
|
});
|
|
93
93
|
withdrawal.mount('#nb-withdrawal');
|
|
94
94
|
|
|
@@ -207,7 +207,6 @@ try {
|
|
|
207
207
|
}
|
|
208
208
|
```
|
|
209
209
|
|
|
210
|
-
|
|
211
210
|
### Linked Component
|
|
212
211
|
|
|
213
212
|
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.
|
|
@@ -231,7 +230,6 @@ The two parameters that should be configured are:
|
|
|
231
230
|
|
|
232
231
|
**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.
|
|
233
232
|
|
|
234
|
-
|
|
235
233
|
## Components
|
|
236
234
|
|
|
237
235
|
## Assisted Withdrawal
|
|
@@ -246,7 +244,7 @@ const withdrawal = notabene.createWithdrawalAssist({
|
|
|
246
244
|
assetPrice: {
|
|
247
245
|
currency: 'USD', // ISO currency code
|
|
248
246
|
price: 1700.12, // Asset price
|
|
249
|
-
}
|
|
247
|
+
},
|
|
250
248
|
});
|
|
251
249
|
```
|
|
252
250
|
|
|
@@ -264,23 +262,26 @@ If any of the required parameters are missing the component will just show the N
|
|
|
264
262
|
Include configuration Options as a second optional parameter:
|
|
265
263
|
|
|
266
264
|
```js
|
|
267
|
-
const withdrawal = notabene.createWithdrawalAssist(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
265
|
+
const withdrawal = notabene.createWithdrawalAssist(
|
|
266
|
+
{
|
|
267
|
+
asset: 'ETH',
|
|
268
|
+
destination: '0x...',
|
|
269
|
+
amountDecimal: 1.23,
|
|
270
|
+
assetPrice: {
|
|
271
|
+
currency: 'USD', // ISO currency code
|
|
272
|
+
price: 1700.12, // Asset price
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
proofs: {
|
|
277
|
+
microTransfer: {
|
|
278
|
+
destination: '0x...',
|
|
279
|
+
amountSubunits: '12344',
|
|
280
|
+
timeout: 86440,
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
);
|
|
284
285
|
```
|
|
285
286
|
|
|
286
287
|
See [Transaction Options](#transaction-options)
|
|
@@ -291,10 +292,10 @@ The Connect Wallet component helps you collect and verify the address of your us
|
|
|
291
292
|
|
|
292
293
|
```js
|
|
293
294
|
const connect = notabene.createConnectWallet({
|
|
294
|
-
asset: 'ETH'
|
|
295
|
+
asset: 'ETH',
|
|
295
296
|
});
|
|
296
297
|
|
|
297
|
-
const { proof, txCreate } = await connect.openModal()
|
|
298
|
+
const { proof, txCreate } = await connect.openModal();
|
|
298
299
|
```
|
|
299
300
|
|
|
300
301
|
### Parameters
|
|
@@ -306,17 +307,20 @@ const { proof, txCreate } = await connect.openModal()
|
|
|
306
307
|
Include configuration Options as a second optional parameter:
|
|
307
308
|
|
|
308
309
|
```js
|
|
309
|
-
const connect = notabene.createConnectWallet(
|
|
310
|
+
const connect = notabene.createConnectWallet(
|
|
311
|
+
{
|
|
310
312
|
asset: 'ETH',
|
|
311
|
-
},
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
proofs: {
|
|
316
|
+
microTransfer: {
|
|
317
|
+
destination: '0x...',
|
|
318
|
+
amountSubunits: '12344',
|
|
319
|
+
timeout: 86440,
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
);
|
|
320
324
|
```
|
|
321
325
|
|
|
322
326
|
## Deposit Request
|
|
@@ -329,8 +333,8 @@ const withdrawal = notabene.createDepositRequest({
|
|
|
329
333
|
destination: '0x...',
|
|
330
334
|
amountDecimal: 1.23,
|
|
331
335
|
customer: {
|
|
332
|
-
name:
|
|
333
|
-
}
|
|
336
|
+
name: 'John Smith',
|
|
337
|
+
},
|
|
334
338
|
});
|
|
335
339
|
```
|
|
336
340
|
|
|
@@ -389,7 +393,6 @@ assetPrice: {
|
|
|
389
393
|
};
|
|
390
394
|
```
|
|
391
395
|
|
|
392
|
-
|
|
393
396
|
## Configuration
|
|
394
397
|
|
|
395
398
|
### Transaction Options
|
|
@@ -416,8 +419,8 @@ const options: TransactionOptions = {
|
|
|
416
419
|
deminimis: {
|
|
417
420
|
threshold: 1000,
|
|
418
421
|
currency: 'EUR',
|
|
419
|
-
proofTypes: [ProofTypes.SelfDeclaration]
|
|
420
|
-
}
|
|
422
|
+
proofTypes: [ProofTypes.SelfDeclaration],
|
|
423
|
+
},
|
|
421
424
|
},
|
|
422
425
|
allowedAgentTypes: [AgentType.PRIVATE, AgentType.VASP], // js ['WALLET','VASP']
|
|
423
426
|
allowedCounterpartyTypes: [
|
|
@@ -451,7 +454,7 @@ const options: TransactionOptions = {
|
|
|
451
454
|
addUnknown: true, // Allow users to add a missing VASP - Defaults to false
|
|
452
455
|
onlyActive: true, // Only list active VASPs - Default false
|
|
453
456
|
},
|
|
454
|
-
hide: [ValidationSections.ASSET, ValidationSections.DESTINATION] // Don't show specific sections of component
|
|
457
|
+
hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
|
|
455
458
|
},
|
|
456
459
|
};
|
|
457
460
|
const withdrawal = notabene.createWithdrawalAssist(tx, options);
|
|
@@ -460,19 +463,22 @@ const withdrawal = notabene.createWithdrawalAssist(tx, options);
|
|
|
460
463
|
The options can additionally be updated dynamically with the `update()` function.
|
|
461
464
|
|
|
462
465
|
```js
|
|
463
|
-
withdrawal.update(
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}
|
|
466
|
+
withdrawal.update(
|
|
467
|
+
{
|
|
468
|
+
asset: 'ETH',
|
|
469
|
+
destination: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
|
|
470
|
+
amountDecimal: 1.12,
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
proofs: {
|
|
474
|
+
microTransfer: {
|
|
475
|
+
destination: '0x...',
|
|
476
|
+
amountSubunits: '12344',
|
|
477
|
+
timeout: 86440,
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
);
|
|
476
482
|
```
|
|
477
483
|
|
|
478
484
|
### Common use cases
|
|
@@ -623,12 +629,12 @@ const options: TransactionOptions = {
|
|
|
623
629
|
|
|
624
630
|
#### Field reference
|
|
625
631
|
|
|
626
|
-
| Field name | Natural | Legal | IVMS101 |
|
|
627
|
-
| ------------------------ | ------- | ----- | ------- |
|
|
632
|
+
| Field name | Natural | Legal | IVMS101 | description |
|
|
633
|
+
| ------------------------ | ------- | ----- | ------- | --------------------------------------------- |
|
|
628
634
|
| `name` | ✅ | ✅ | 🟩 | Full name |
|
|
629
|
-
| `email` | 🟩 | 🟩 | -- |
|
|
630
|
-
| `website` | -- | ✅ | -- |
|
|
631
|
-
| `phone` | 🟩 | 🟩 | -- |
|
|
635
|
+
| `email` | 🟩 | 🟩 | -- | Email (for your internal purposes) |
|
|
636
|
+
| `website` | -- | ✅ | -- | Business Website (for your internal purposes) |
|
|
637
|
+
| `phone` | 🟩 | 🟩 | -- | Mobile Phone (for your internal purposes) |
|
|
632
638
|
| `geographicAddress` | 🟩 | 🟩 | 🟩 | Residencial or business address |
|
|
633
639
|
| `nationalIdentification` | 🟩 | 🟩 | 🟩 | National Identification number |
|
|
634
640
|
| `dateOfBirth` | 🟩 | -- | 🟩 | Date of birth |
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@3.2.2",
|
|
13
|
-
"version": "2.0.
|
|
13
|
+
"version": "2.0.1",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/notabene.js",
|
|
16
16
|
"types": "dist/notabene.d.ts",
|
|
@@ -23,16 +23,17 @@
|
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
25
|
"docs": "typedoc --options typedoc.json",
|
|
26
|
-
"prepare": "husky
|
|
26
|
+
"prepare": "husky",
|
|
27
27
|
"dev": "vite",
|
|
28
28
|
"preview": "vite preview",
|
|
29
29
|
"watch": "parcel watch",
|
|
30
30
|
"build:dev": "yarn build && yarn dev",
|
|
31
|
-
"build:clean": "rimraf dist/ ts-out",
|
|
32
|
-
"build": "yarn lint && vite build &&
|
|
31
|
+
"build:clean": "rimraf dist/ ts-out coverage temp etc",
|
|
32
|
+
"build": "yarn lint && vite build && yarn typecheck && yarn docs",
|
|
33
33
|
"lint": "eslint .",
|
|
34
34
|
"format": "prettier --write .",
|
|
35
35
|
"test": "vitest",
|
|
36
|
+
"typecheck": "tsc --noEmit",
|
|
36
37
|
"coverage": "vitest run --coverage --coverage.extension=.ts",
|
|
37
38
|
"release": "semantic-release",
|
|
38
39
|
"publish": "yarn build && npm publish"
|
|
@@ -102,11 +102,11 @@ export default class EmbeddedComponent<V, O> {
|
|
|
102
102
|
this.removeEmbed();
|
|
103
103
|
this.iframe = document.createElement('iframe');
|
|
104
104
|
this.iframe.src = this.url + (!modal ? '&embedded=true' : '');
|
|
105
|
-
this.iframe.allow = 'web-share';
|
|
105
|
+
this.iframe.allow = 'web-share; clipboard-write';
|
|
106
106
|
this.iframe.style.width = '100%';
|
|
107
|
-
this.iframe.style.height = '100px';
|
|
108
107
|
this.iframe.style.border = 'none';
|
|
109
108
|
this.iframe.style.overflow = 'hidden';
|
|
109
|
+
this.iframe.scrolling = 'no';
|
|
110
110
|
// this.iframe.setAttribute('allowtransparency', 'true');
|
|
111
111
|
// this.iframe.style.backgroundColor = 'transparent';
|
|
112
112
|
parent.appendChild(this.iframe);
|