@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.
Files changed (64) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +289 -233
  3. package/dist/js/notabene.js +1 -0
  4. package/dist/notabene.cjs +1 -1
  5. package/dist/notabene.d.ts +1092 -214
  6. package/dist/notabene.js +284 -113
  7. package/dist/tsdoc-metadata.json +1 -1
  8. package/package.json +36 -26
  9. package/src/__tests__/notabene.test.ts +43 -0
  10. package/src/components/EmbeddedComponent.ts +141 -22
  11. package/src/components/__tests__/EmbeddedComponent.test.ts +73 -20
  12. package/src/ivms/types.ts +230 -152
  13. package/src/locales.ts +47 -0
  14. package/src/notabene.ts +247 -90
  15. package/src/types.ts +769 -152
  16. package/src/utils/MessageEventManager.ts +70 -12
  17. package/src/utils/__tests__/MessageEventManager.test.ts +13 -5
  18. package/src/utils/arbitraries.ts +9 -4
  19. package/.editorconfig +0 -10
  20. package/.gitlab-ci.yml +0 -85
  21. package/.husky/commit-msg +0 -4
  22. package/.husky/pre-commit +0 -4
  23. package/.husky/pre-push +0 -4
  24. package/.prettierrc +0 -4
  25. package/.releaserc.json +0 -16
  26. package/.vscode/extensions.json +0 -3
  27. package/.vscode/settings.json +0 -11
  28. package/.yarn/releases/yarn-berry.cjs +0 -925
  29. package/.yarnrc.yml +0 -3
  30. package/CODEOWNERS +0 -1
  31. package/api-extractor.json +0 -434
  32. package/eslint.config.js +0 -24
  33. package/etc/javascript-sdk.api.md +0 -363
  34. package/index.html +0 -137
  35. package/temp/javascript-sdk.api.json +0 -3509
  36. package/temp/javascript-sdk.api.md +0 -363
  37. package/ts-out/src/__tests__/notabene.test.d.ts +0 -1
  38. package/ts-out/src/__tests__/notabene.test.js +0 -88
  39. package/ts-out/src/arbitraries.d.ts +0 -4
  40. package/ts-out/src/arbitraries.js +0 -8
  41. package/ts-out/src/components/EmbeddedComponent.d.ts +0 -25
  42. package/ts-out/src/components/EmbeddedComponent.js +0 -87
  43. package/ts-out/src/components/__tests__/EmbeddedComponent.test.d.ts +0 -1
  44. package/ts-out/src/components/__tests__/EmbeddedComponent.test.js +0 -132
  45. package/ts-out/src/ivms/types.d.ts +0 -252
  46. package/ts-out/src/ivms/types.js +0 -1
  47. package/ts-out/src/notabene.d.ts +0 -35
  48. package/ts-out/src/notabene.js +0 -59
  49. package/ts-out/src/types.d.ts +0 -357
  50. package/ts-out/src/types.js +0 -85
  51. package/ts-out/src/utils/MessageEventManager.d.ts +0 -12
  52. package/ts-out/src/utils/MessageEventManager.js +0 -45
  53. package/ts-out/src/utils/__tests__/MessageEventManager.test.d.ts +0 -1
  54. package/ts-out/src/utils/__tests__/MessageEventManager.test.js +0 -73
  55. package/ts-out/src/utils/arbitraries.d.ts +0 -6
  56. package/ts-out/src/utils/arbitraries.js +0 -7
  57. package/ts-out/src/utils/caip.d.ts +0 -13
  58. package/ts-out/src/utils/caip.js +0 -15
  59. package/ts-out/src/utils/urls.d.ts +0 -1
  60. package/ts-out/src/utils/urls.js +0 -14
  61. package/ts-out/tsconfig.tsbuildinfo +0 -1
  62. package/tsconfig.json +0 -22
  63. package/tsconfig.tsbuildinfo +0 -1
  64. package/vite.config.js +0 -13
package/src/types.ts CHANGED
@@ -1,38 +1,234 @@
1
1
  import {
2
- DateAndPlaceOfBirth,
2
+ Address,
3
+ Beneficiary,
4
+ ISOCountryCode,
5
+ ISODate,
3
6
  IVMS101,
4
7
  NationalIdentification,
8
+ Originator,
5
9
  } from './ivms/types';
6
10
 
11
+ export type {
12
+ BeneficiaryVASP,
13
+ OriginatingVASP,
14
+ PayloadMetadata,
15
+ TransferPath,
16
+ } from './ivms/types';
17
+ export type {
18
+ Address,
19
+ Beneficiary,
20
+ ISOCountryCode,
21
+ ISODate,
22
+ NationalIdentification,
23
+ Originator,
24
+ };
25
+ /**
26
+ * Interoperable Virtual Asset Service Provider (VASP) Messaging Standard
27
+ * @public
28
+ */
7
29
  export type { IVMS101 };
8
30
 
9
- export type CAIP2 = string;
10
- export type CAIP10 = string;
11
- export type CAIP19 = string;
31
+ /**
32
+ * UUID v4 string identifier
33
+ * A universally unique identifier that follows RFC 4122 format
34
+ * Format: 8-4-4-4-12 hexadecimal digits
35
+ * @example "550e8400-e29b-41d4-a716-446655440000"
36
+ * @see {@link https://tools.ietf.org/html/rfc4122 | RFC4122}
37
+ * @public
38
+ */
39
+ export type UUID = string;
40
+
41
+ /**
42
+ * Chain Agnostic Blockchain Identifier (CAIP-2)
43
+ * Represents a blockchain in a chain-agnostic way following the CAIP-2 specification.
44
+ * The identifier consists of a namespace and reference separated by a colon.
45
+ *
46
+ * Format: `namespace:reference`
47
+ * - namespace: Represents the blockchain namespace (e.g. 'eip155', 'bip122', 'cosmos')
48
+ * - reference: Chain-specific identifier within that namespace
49
+ *
50
+ * @example "eip155:1" // Ethereum Mainnet
51
+ * @example "bip122:000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" // Bitcoin Mainnet
52
+ * @example "cosmos:cosmoshub-3" // Cosmos Hub Mainnet
53
+ * @see {@link https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md | CAIP-2 Specification}
54
+ * @public
55
+ */
56
+ export type CAIP2 = `${string}:${string}`;
57
+
58
+ /**
59
+ * Chain Agnostic Account Identifier (CAIP-10)
60
+ * Represents an account/address on a specific blockchain following the CAIP-10 specification.
61
+ * Extends CAIP-2 by adding the account address specific to that chain.
62
+ *
63
+ * Format: `{caip2}:{address}`
64
+ * - caip2: The CAIP-2 chain identifier (e.g. 'eip155:1')
65
+ * - address: Chain-specific account address format
66
+ *
67
+ * @example "eip155:1:0x742d35Cc6634C0532925a3b844Bc454e4438f44e" // Ethereum account on mainnet
68
+ * @example "bip122:000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f:128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6" // Bitcoin account on mainnet
69
+ * @example "cosmos:cosmoshub-3:cosmos1t2uflqwqe0fsj0shcfkrvpukewcw40yjj6hdc0" // Cosmos account
70
+ * @see {@link https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md | CAIP-10 Specification}
71
+ * @public
72
+ */
73
+ export type CAIP10 = `${CAIP2}:${string}`;
74
+
75
+ /**
76
+ * Chain Agnostic Asset Identifier (CAIP-19)
77
+ * Represents an asset/token on a specific blockchain following the CAIP-19 specification.
78
+ * Extends CAIP-2 by adding asset type and identifier information.
79
+ *
80
+ * Format: `{caip2}/{asset_namespace}:{asset_reference}`
81
+ * - caip2: The CAIP-2 chain identifier (e.g. 'eip155:1')
82
+ * - asset_namespace: The asset standard (e.g. 'erc20', 'erc721', 'slip44')
83
+ * - asset_reference: Chain/standard-specific asset identifier
84
+ *
85
+ * @example "eip155:1/erc20:0x6b175474e89094c44da98b954eedeac495271d0f" // DAI token on Ethereum mainnet
86
+ * @example "eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d" // CryptoKitties NFT contract
87
+ * @example "cosmos:cosmoshub-3/slip44:118" // ATOM token on Cosmos Hub
88
+ * @see {@link https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-19.md | CAIP-19 Specification}
89
+ * @public
90
+ */
91
+ export type CAIP19 = `${CAIP2}/${string}:${string}`;
92
+
93
+ /**
94
+ * Chain Agnostic Payload Identifier
95
+ * @public
96
+ */
12
97
  export type CAIP220 = string;
13
98
 
99
+ /**
100
+ * Digital Token Identifier (DTI) following ISO 24165 standard
101
+ *
102
+ * @remarks
103
+ * A standardized identifier for digital assets and cryptocurrencies. The DTI system
104
+ * provides unique and unambiguous identification of digital tokens, supporting interoperability
105
+ * and clarity in financial markets.
106
+ *
107
+ * Format: `DTI[NNNNN]` where N is a digit
108
+ *
109
+ * @example "DTI00001" // Example DTI for Bitcoin
110
+ * @example "DTI00002" // Example DTI for Ethereum
111
+ *
112
+ * @see {@link https://dtif.org/ | Digital Token Identifier Foundation}
113
+ * @see {@link https://www.iso.org/standard/77895.html | ISO 24165}
114
+ * @public
115
+ */
116
+
14
117
  export type DTI = string;
15
- export type NotabeneAsset = string;
16
118
 
17
119
  /**
18
- * The asset of a transaction either a Notabene asset, a CAIP-19 asset, or a DTI.
120
+ * Notabene Asset Identifier
121
+ * @public
122
+ */
123
+
124
+ /**
125
+ * Internal identifier for assets in the Notabene system
126
+ *
127
+ * @remarks
128
+ * A standardized string format used within Notabene to identify cryptocurrencies,
129
+ * tokens, and other digital assets. This is Notabene's legacy asset identification
130
+ * system that may be used alongside CAIP-19 and DTI identifiers.
19
131
  *
132
+ * @example "ETH_USDT" // USDT token on Ethereum
133
+ * @example "BTC" // Bitcoin
134
+ * @see {@link CAIP19} For chain-agnostic asset identifiers
135
+ * @see {@link DTI} For ISO standardized identifiers
20
136
  * @public
21
137
  */
22
138
 
139
+ export type NotabeneAsset = string;
140
+
141
+ /**
142
+ * The asset of a transaction either a Notabene asset, a CAIP-19 asset, or a DTI.
143
+ * @public
144
+ */
23
145
  export type TransactionAsset = NotabeneAsset | CAIP19 | DTI;
24
146
 
147
+ /**
148
+ * A blockchain address
149
+ * @public
150
+ */
151
+
152
+ /**
153
+ * A native blockchain address string
154
+ *
155
+ * @remarks
156
+ * Represents a blockchain address in the native format specific to a particular chain.
157
+ * This could be an Ethereum address, Bitcoin address, or other chain-specific format.
158
+ * The address format and validation rules depend on the underlying blockchain.
159
+ *
160
+ * @example "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" // Ethereum address
161
+ * @example "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" // Bitcoin address
162
+ * @example "cosmos1t2uflqwqe0fsj0shcfkrvpukewcw40yjj6hdc0" // Cosmos address
163
+ * @public
164
+ */
165
+
25
166
  export type BlockchainAddress = string;
26
- export type TravelAddress = string;
167
+
168
+ /**
169
+ * A travel address
170
+ * @public
171
+
172
+ * A standardized travel rule address format
173
+ *
174
+ * @remarks
175
+ * Represents a special address format used for travel rule compliance. Travel addresses
176
+ * are prefixed with 'ta' and contain encoded information about the transaction
177
+ * and counterparty details required for travel rule reporting.
178
+ *
179
+ * The format ensures consistent handling of travel rule data across different
180
+ * VASPs and blockchain networks while maintaining privacy.
181
+ *
182
+ * @example "ta1234abcd..." // Example travel rule address
183
+ * @see {@link BlockchainAddress} For native chain addresses
184
+ * @see {@link CAIP10} For chain-agnostic addresses
185
+
186
+ */ export type TravelAddress = `ta${string}`;
187
+
188
+ /**
189
+ * A crypto credential
190
+ * @public
191
+ */ export type CryptoCredential = `${string}.${string}.mastercard`;
27
192
 
28
193
  /**
29
194
  * The destination of a transaction either a blockchain address, a CAIP-19 address, or a travel address.
30
195
  * @public
31
196
  */
32
- export type Destination = BlockchainAddress | CAIP19 | TravelAddress;
33
- export type Source = BlockchainAddress | CAIP19;
197
+ export type Destination =
198
+ | BlockchainAddress
199
+ | CAIP10
200
+ | CryptoCredential
201
+ | TravelAddress;
202
+
203
+ /**
204
+ * The source of a transaction
205
+ * @public
206
+ */
207
+ export type Source = BlockchainAddress | CAIP10;
208
+
209
+ /**
210
+ * A Uniform Resource Identifier
211
+ * @public
212
+ */
34
213
  export type URI = string;
35
- export type DID = string;
214
+
215
+ /**
216
+ * A Decentralized Identifier
217
+ * @public
218
+ */
219
+ export type DID = `did:${string}:${string}`;
220
+
221
+ /**
222
+ * A LEI Legal Entity Identifier
223
+ * @public
224
+ */
225
+ export type LEI = string;
226
+
227
+ /**
228
+ * 3 letter ISO currency code
229
+ * @public
230
+ */
231
+ export type ISOCurrency = string;
36
232
 
37
233
  /**
38
234
  * The theme of the Notabene SDK
@@ -45,27 +241,10 @@ export type Theme = {
45
241
  logo: string;
46
242
  };
47
243
 
48
- export enum ComponentTypes {
49
- WITHDRAW_ASSIST = 'WITHDRAW_ASSIST',
50
- }
51
-
52
- export type TransactionType = 'VASP_2_VASP' | 'SELF_HOSTED';
53
-
54
- export type TransactionTypeAllowed =
55
- | 'ALL'
56
- | 'VASP_2_VASP_ONLY'
57
- | 'FIRST_PARTY_ONLY';
58
-
59
- export type NonCustodialDeclarationType =
60
- | 'SIGNATURE'
61
- | 'DECLARATION'
62
- | 'SIGNATURE_AND_DECLARATION';
63
-
64
244
  /**
65
245
  * The type of Agent. Either a wallet or a VASP
66
246
  * @public
67
247
  */
68
-
69
248
  export enum AgentType {
70
249
  PRIVATE = 'WALLET',
71
250
  VASP = 'VASP',
@@ -75,33 +254,36 @@ export enum AgentType {
75
254
  * Who is the agent acting on behalf of the counterparty
76
255
  * @public
77
256
  */
78
- export declare interface Agent {
257
+ export interface Agent {
79
258
  did: DID;
80
259
  type: AgentType;
81
- logo?: string;
82
- url?: string;
260
+ logo?: URI;
261
+ url?: URI;
83
262
  name?: string;
84
263
  verified?: boolean;
85
264
  }
86
- export type OwnershipProofInput = {
87
- type?: string | null;
88
- proof?: string | null;
89
- };
90
-
91
- export type TransactionBlockchainInfo = {
92
- destination?: string | null;
93
- origin?: string | null;
94
- };
95
-
96
- export type CountryType = {
97
- id: string;
98
- name: string;
99
- };
100
265
 
101
266
  /**
102
267
  * The type of counterparty. Either a natural person or a legal person. If the customer is the same as the counterparty then the counterparty is a self.
103
268
  * @public
104
269
  */
270
+ /**
271
+ * Enum defining the types of persons/entities in a transaction
272
+ *
273
+ * @remarks
274
+ * This classification system aligns with FATF travel rule requirements and defines:
275
+ * - NATURAL: Individual human persons acting in their own capacity
276
+ * - LEGAL: Registered organizations, companies, or other legal entities
277
+ * - SELF: When the counterparty is the same as the customer (first party transaction)
278
+ *
279
+ * The type affects what information must be collected and transmitted as part of
280
+ * travel rule compliance. Different verification and due diligence requirements
281
+ * apply to each type.
282
+ *
283
+ * @see {@link NaturalPerson} For natural person data requirements
284
+ * @see {@link LegalPerson} For legal person data requirements
285
+ * @public
286
+ */
105
287
  export enum PersonType {
106
288
  NATURAL = 'natural',
107
289
  LEGAL = 'legal',
@@ -113,9 +295,12 @@ export enum PersonType {
113
295
  * @public
114
296
  */
115
297
  export interface VASP extends Agent {
116
- url?: string;
117
- name?: string;
298
+ lei?: LEI;
299
+ logo?: URI;
300
+ website?: URI;
301
+ countryOfRegistration?: ISOCountryCode;
118
302
  }
303
+
119
304
  /**
120
305
  * A wallet agent acting on behalf of the counterparty
121
306
  * @public
@@ -129,59 +314,217 @@ export interface Wallet extends Agent {
129
314
  * The counterparty of a transaction.
130
315
  * @public
131
316
  */
317
+ /**
318
+ * Interface representing a party involved in a transaction other than the initiator
319
+ *
320
+ * @remarks
321
+ fines the core properties that identify and describe a counterparty:
322
+ * - name: The display or legal name of the counterparty
323
+ * - accountNumber: An account identifier/reference number
324
+ * - did: Decentralized identifier for the counterparty
325
+ * - type: Classification as natural person, legal entity, or self
326
+ * - verified: Whether the counterparty's identity has been verified
327
+ * - geographicAddress: Physical/mailing address information
328
+ * - nationalIdentification: Government-issued ID details
329
+ * - website: Official web presence
330
+ * - phone: Contact phone number
331
+ * - email: Contact email address
332
+ *
333
+ * This interface serves as the base for more specific counterparty types:
334
+ * @see {@link NaturalPerson} For individual person properties
335
+ * @see {@link LegalPerson} For organization/entity properties
336
+ *
337
+ * @public
338
+ */
132
339
  export interface Counterparty {
133
340
  name?: string;
134
341
  accountNumber?: string;
135
- did?: string;
136
- geographicAddress?: string;
342
+ did?: DID;
137
343
  type?: PersonType;
138
344
  verified?: boolean;
345
+ geographicAddress?: Address;
346
+ nationalIdentification?: NationalIdentification;
347
+ website?: URI;
348
+ phone?: string;
349
+ email?: string;
139
350
  }
351
+
140
352
  /**
141
- * A counterparty object representing a natural person
353
+ * Interface representing a natural person (individual) involved in a transaction
354
+ *
355
+ * @remarks
356
+ * Extends the baseinterface to add properties specific to individual persons:
357
+ * - type: Must be PersonType.NATURAL to identify as an individual
358
+ * - dateOfBirth: Optional ISO format birth date for identity verification
359
+ * - placeOfBirth: Optional birth place for identity verification
360
+ * - countryOfResidence: Optional ISO country code of current residence
361
+ * - name: Required full legal name of the individual
362
+ *
363
+ * This interface captures the additional identifying information required for
364
+ * natural persons under FATF Travel Rule requirements. The properties align
365
+ * with standard KYC (Know Your Customer) data collection practices.
366
+ *
367
+ * @see {@link Counterparty} For base properties common to all counterparties
368
+ * @see {@link PersonType} For person type classification
142
369
  * @public
143
370
  */
144
371
  export interface NaturalPerson extends Counterparty {
145
372
  type: PersonType.NATURAL;
146
- nationalIdentification?: NationalIdentification;
147
- dateAndPlaceOfBirth?: DateAndPlaceOfBirth;
373
+ dateOfBirth?: ISODate;
374
+ placeOfBirth?: string;
375
+ countryOfResidence?: ISOCountryCode;
148
376
  name: string;
149
377
  }
378
+ /**
379
+ * Field names for NaturalPerson
380
+ * @public
381
+ */
382
+ export type NaturalPersonFieldName =
383
+ | 'name' // Full legal name
384
+ | 'website' // Primary website of entity
385
+ | 'email' // Contact email
386
+ | 'phone' // Contact mobile phone
387
+ | 'geographicAddress' // Address string
388
+ | 'nationalIdentification' // National Identification number
389
+ | 'dateOfBirth' // Date of Birty YYYY-MM-DD
390
+ | 'placeOfBirth' // Place of Birth
391
+ | 'countryOfResidence'; // ISO Country code of residence of Natural Person
150
392
 
151
393
  /**
152
- * A counterparty object representing a legal person
394
+ * Field properties by field name for Natural persons
395
+ * @public
396
+ */
397
+ export type NaturalPersonFields = {
398
+ [name in NaturalPersonFieldName]?: FieldOptions;
399
+ };
400
+
401
+ /**
402
+ * Interface representing a legal entity (organization/company) involved in a transaction
403
+ *
404
+ * @remarks
405
+ * Extends the baseface to add properties specific to legal entities:
406
+ * - type: MustPersonType.LEGAL to identify as an organization
407
+ * - name: Required registered legal name of the entity
408
+ * - lei: Optional Legal Entity Identifier for regulated entities
409
+ * - logo: Optional URI to the organization's logo image
410
+ * - countryOfRegistration: Optional ISO country code where entity is registered
411
+ *
412
+ * This interface captures the additional identifying information required for
413
+ * legal persons under FATF Travel Rule requirements. The properties align with
414
+ * standard business KYC (Know Your Businessta collection practices.
415
+ *
416
+ * @see {@link Counterparty} For base properties common to all counterparties
417
+ * @see {@link PersonType} For person type classification
418
+ * @see {@link LEI} For Legal Entity Identifier format
153
419
  * @public
154
420
  */
155
421
  export interface LegalPerson extends Counterparty {
156
422
  type: PersonType.LEGAL;
157
423
  name: string;
158
- lei?: string;
159
- url?: string;
160
- logo?: string;
424
+ lei?: LEI;
425
+ logo?: URI;
426
+ countryOfRegistration?: ISOCountryCode;
161
427
  }
162
428
 
163
- export type OriginatorFields = {
429
+ type LegalPersonFieldName =
430
+ | 'name' // Full legal name
431
+ | 'lei' // Legal Entity Identifier
432
+ | 'website' // Primary website of entity
433
+ | 'email' // Contact email
434
+ | 'phone' // Contact mobile phone
435
+ | 'geographicAddress' // Address string
436
+ | 'nationalIdentification' // National Identification number
437
+ | 'countryOfRegistration'; // ISO Country code of registration of Legal Person
438
+
439
+ /**
440
+ * Field properties by field name
441
+ * @public
442
+ */
443
+ export type LegalPersonFields = {
444
+ [name in LegalPersonFieldName]?: FieldOptions;
445
+ };
446
+
447
+ /**
448
+ * Fields specific to the originator of a transaction
449
+ * @public
450
+ */
451
+ type OriginatorFields = {
164
452
  source?: Source;
165
453
  };
166
454
 
167
- export type BeneficiaryFields = {
455
+ /**
456
+ * Fields specific to the beneficiary of a transaction
457
+ * @public
458
+ */
459
+ type BeneficiaryFields = {
168
460
  destination?: Destination;
169
461
  };
170
462
 
171
463
  /**
172
- * An abstract transaction object
464
+ * Fields specific to a deposit request
173
465
  * @public
174
466
  */
175
- export interface Transaction {
176
- agent: Agent;
467
+ type DepositRequestFields = {
468
+ destination: BlockchainAddress | CAIP10;
469
+ travelAddress?: TravelAddress;
470
+ cryptoCredential?: CryptoCredential;
471
+ };
472
+
473
+ type RequestID = UUID;
474
+
475
+ /**
476
+ * Base interface for requests sent to SDK components
477
+ *
478
+ * @remarks
479
+ * Defines core properties that all component requests share:
480
+ * - Optional unique request ID for tracking/correlating requests and responses
481
+ * - Optional customer detailsfor pre-filling component data
482
+ *
483
+ * This interface is extended by specific request types like:
484
+ * - Transaction requests for sending/receiving assets
485
+ * - Connection requests for establishing VASP to VASP communication
486
+ *
487
+ * @see {@link Transaction} For transaction-specific request properties
488
+ * @see {@link ConnectionRequest} For connection-specific request properties
489
+ * @public
490
+ */
491
+ export interface ComponentRequest {
492
+ requestId?: RequestID;
177
493
  customer?: Counterparty;
494
+ }
495
+
496
+ /**
497
+ * Core transaction interface representing a crypto asset transfer between parties
498
+ *
499
+ * @remarks
500
+ * Extends ComponentRequest to add transaction-specific properties:
501
+ * - agent: The entity facilitating/executing the transaction
502
+ * - counterparty: The other party involved in the transaction
503
+ * - asset: The cryptocurrency or token being transferred
504
+ * - amountDecimal: The amount to transfer in decimal format
505
+ * - proof: Optional ownership proof verifying control of involved addresses
506
+ * - assetPrice: Optional price information in a fiat currency
507
+ *
508
+ * This interface serves as the base for specific transaction types like:
509
+ * - Withdrawals for sending assets out
510
+ * - Deposits for receiving assets
511
+ * - Deposit requests for requesting asset transfers
512
+ *
513
+ * @see {@link Withdrawal} For withdrawal-specific transaction properties
514
+ * @see {@link Deposit} For deposit-specific transaction properties
515
+ * @see {@link Agent} For agent details
516
+ * @see {@link Counterparty} For counterparty information
517
+ * @public
518
+ */
519
+ export interface Transaction extends ComponentRequest {
520
+ agent: Agent;
178
521
  counterparty: Counterparty;
179
522
  asset: TransactionAsset;
180
523
  amountDecimal: number;
181
- // transactionBlockchainInfo?: TransactionBlockchainInfo;
182
- customAssetPrice?: {
524
+ proof?: OwnershipProof;
525
+ assetPrice?: {
183
526
  price: number;
184
- currency: string;
527
+ currency: ISOCurrency;
185
528
  };
186
529
  }
187
530
 
@@ -190,12 +533,27 @@ export interface Transaction {
190
533
  * @public
191
534
  */
192
535
  export interface Withdrawal extends BeneficiaryFields, Transaction {}
536
+
193
537
  /**
194
538
  * An object representing a deposit transaction
195
539
  * @public
196
540
  */
197
541
  export interface Deposit extends OriginatorFields, Transaction {}
198
542
 
543
+ /**
544
+ * An object representing a request for a deposit
545
+ * @public
546
+ */
547
+ export interface DepositRequest extends DepositRequestFields, Transaction {}
548
+
549
+ /**
550
+ * An object representing a connection request
551
+ * @public
552
+ */
553
+ export interface ConnectionRequest extends ComponentRequest {
554
+ asset: TransactionAsset;
555
+ }
556
+
199
557
  /**
200
558
  * The verification status of a transaction
201
559
  * @public
@@ -209,54 +567,188 @@ export enum Status {
209
567
  }
210
568
 
211
569
  /**
212
- * The response of a transaction
570
+ * Represents a legacy V1 API asset format supporting both Notabene and CAIP-19 identifiers
571
+ *
572
+ * @remarks
573
+ * Used for backwards compatibility with V1 API transaction payloads:
574
+ * - Can be either a simple Notabene asset string
575
+ * - Or an object containing a CAIP-19 identifier
576
+ *
577
+ * @example "ETH_USDT" // Notabene asset format
578
+ * @example \{ caip19: "eip155:1/erc20:0x6b175474e89094c44da98b954eedeac495271d0f" \} // CAIP-19 format
579
+ * @see {@link NotabeneAsset} For Notabene asset format
580
+ * @see {@link CAIP19} For CAIP-19 asset format
213
581
  * @public
214
582
  */
583
+ export type V1Asset = NotabeneAsset | { caip19: CAIP19 };
215
584
 
216
- export type TransactionResponse = {
217
- value: Transaction;
218
- ivms: IVMS101;
219
- proof?: OwnershipProof;
585
+ /**
586
+ * Transaction payload suitable for calling Notabene v1 tx/create
587
+ * @public
588
+ */
589
+ export type V1Transaction = {
590
+ transactionAsset: V1Asset;
591
+ transactionAmount: string;
592
+ originatorEqualsBeneficiary?: boolean;
593
+ originatorVASPdid: DID;
594
+ beneficiaryVASPdid: DID;
595
+ beneficiaryProof?: OwnershipProof;
596
+ originator?: Originator;
597
+ beneficiary: Beneficiary;
598
+ };
599
+
600
+ /**
601
+ * Base response interface for all SDK component operations
602
+ *
603
+ * @remarks
604
+ * Provides standardized response propertiesfor component interactions:
605
+ * - requestID: Links response back to the originating request
606
+ * - valid: Boolean indicating if the operation was valid/successful
607
+ * - status: Current verification status of the operation
608
+ * - errors: Array of validation errors if any occurred
609
+ *
610
+ * This interface is extended by specific response types like:
611
+ * - TransResponse for transaction operations
612
+ * - ConnectionResponse for VASP connection operations
613
+ *
614
+ * @see {@link Status} For possible status values
615
+ * @see {@link ValidationError} For error structure
616
+ * @see {@link TransactionResponse} For transaction-specific responses
617
+ * @public
618
+ */
619
+ export interface ComponentResponse {
620
+ requestID: RequestID;
220
621
  valid: boolean;
221
622
  status: Status;
222
623
  errors: ValidationError[];
223
- };
624
+ }
224
625
 
626
+ /**
627
+ * Response interface for transaction-related operations
628
+ *
629
+ * @remarks
630
+ * Extends ComponentResponse to add transaction-specific response data:
631
+ * - value: The resulting transaction value of generic type V
632
+ * - ivms101: IVMS 101 travel rule data for the transaction
633
+ * - proof: Optional ownership proof details if required
634
+ * - txCreate: Optional V1 transaction payload for legacy API compatibility
635
+ *
636
+ * @typeParam V - Type of the transaction value being returned
637
+ *
638
+ * @see {@link ComponentResponse} For base response properties
639
+ * @see {@link IVMS101} For travel rule data structure
640
+ * @see {@link OwnershipProof} For proof details
641
+ * @see {@link V1Transaction} For legacy transaction format
642
+ * @public
643
+ */
644
+ export interface TransactionResponse<V> extends ComponentResponse {
645
+ value: V;
646
+ ivms101: IVMS101;
647
+ proof?: OwnershipProof;
648
+ txCreate?: V1Transaction;
649
+ }
650
+
651
+ /**
652
+ * Validation error
653
+ * @public
654
+ */
225
655
  export type ValidationError = {
226
656
  attribute: string;
227
657
  message: string;
228
658
  };
229
659
 
230
- export type FieldProps = {
231
- forceDisplay?: boolean; // instead of beneficiaryDetails - defaults to false
232
- optional?: boolean; // bypass the jurisdiction rules validation - defaults to false
233
- };
660
+ /**
661
+ * Field properties
662
+ * @public
663
+ */
664
+ export type FieldOptions =
665
+ | boolean
666
+ | {
667
+ optional: boolean; // Shown but optional
668
+ transmit: boolean; // Transmit as part of IVMS 101 to counterparty
669
+ };
234
670
 
235
- export type FieldName =
236
- | 'counterparty'
237
- | 'geographicAddress'
238
- | 'firstName'
239
- | 'name'
240
- | 'nationalIdentification'
241
- | 'dateAndPlaceOfBirth';
671
+ /**
672
+ * Field type configuration
673
+ * @public
674
+ */
242
675
 
243
- export type FieldsProps = {
244
- [name in FieldName]?: FieldProps;
676
+ export type FieldTypes = {
677
+ naturalPerson?: NaturalPersonFields;
678
+ legalPerson?: LegalPersonFields;
245
679
  };
246
680
 
247
- export type WalletNotSupportedFlow = {
248
- flow: 'WALLET_NOT_SUPPORTED';
249
- action: 'DECLARATION' | 'REJECT';
681
+ /**
682
+ * Options for which VASPs to be searchable
683
+ * @public
684
+ */
685
+ export type VASPOptions = {
686
+ addUnknown?: boolean;
687
+ onlyActive?: boolean;
250
688
  };
251
689
 
252
- // This is going to be union type
253
- export type Fallback = WalletNotSupportedFlow;
690
+ /**
691
+ * Sections in a WithdrawalAssist screen
692
+ *
693
+ * @alpha
694
+ */
695
+ export enum ValidationSections {
696
+ ASSET = 'asset',
697
+ DESTINATION = 'destination',
698
+ COUNTERPARTY = 'counterparty',
699
+ AGENT = 'agent',
700
+ }
701
+ /**
702
+ * Specify what to do under the provided threshold.
703
+ *
704
+ * Eg. to allow self-declaration for all transactions under 1000 EUR
705
+ *
706
+ * Note to support threshold you MUST include the Asset Price in the Transaction
707
+ *
708
+ * @see {@link Transaction} Transaction object
709
+ *
710
+ * @public
711
+ */
254
712
 
255
- export type OptInFeature = 'REUSE_ADDRESS_OWNERSHIP_PROOF';
713
+ export interface ThresholdOptions {
714
+ threshold: number; // The threshold amount eg 1000
715
+ currency: ISOCurrency; // Currency of threshold
716
+ proofTypes?: ProofTypes[]; // If left empty no proof will be required under threshold
717
+ }
718
+ /**
719
+ * Configuration options for Transaction components
720
+ * @public
721
+ */
722
+ export interface TransactionOptions {
723
+ proofs?: {
724
+ microTransfer?: {
725
+ destination: BlockchainAddress;
726
+ amountSubunits: string;
727
+ timeout?: number; // Time to verify in seconds
728
+ };
729
+ fallbacks?: ProofTypes[];
730
+ deminimis?: ThresholdOptions;
731
+ };
732
+ allowedAgentTypes?: AgentType[]; // Defaults to All
733
+ allowedCounterpartyTypes?: PersonType[]; // Defaults to All
734
+ fields?: FieldTypes;
735
+ vasps?: VASPOptions;
736
+ hide?: ValidationSections[]; // You can hide a specific section of the component by listing it here
737
+ }
256
738
 
257
739
  /**
258
- * Component Message Types
259
- * @internal
740
+ * Component Message Type enum representing different message types that can be sent
741
+ * between the host and component.
742
+ *
743
+ * @remarks
744
+ * - COMPLETE: Indicates a completed operation with response data
745
+ * - RESIZE: Request to adjust component size/dimensions
746
+ * - RESULT: Operation result notification
747
+ * - READY: Component is initialized and ready
748
+ * - INVALID: Validation failed with errors
749
+ * - ERROR: Operation encountered an error
750
+ * - CANCEL: Operation was cancelled
751
+ * @public
260
752
  */
261
753
  export const enum CMType {
262
754
  COMPLETE = 'complete',
@@ -264,109 +756,176 @@ export const enum CMType {
264
756
  RESULT = 'result',
265
757
  READY = 'ready',
266
758
  INVALID = 'invalid',
267
- MODAL = 'openModal',
268
759
  ERROR = 'error',
269
- CLOSE = 'closeModal',
270
760
  CANCEL = 'cancel',
271
761
  }
272
762
 
273
- export type Completed = {
763
+ /**
764
+ * Represents a completed component message
765
+ * @typeParam T - The overall Value type being returned
766
+ * @param response - The Response object which wraps T
767
+ * @public
768
+ */
769
+ export type Completed<T> = {
274
770
  type: CMType.COMPLETE;
275
- response: TransactionResponse;
276
- };
277
-
278
- export type Result = {
279
- type: CMType.RESULT;
280
- reqid: RequestID;
281
- response: TransactionResponse;
771
+ response: TransactionResponse<T>;
282
772
  };
283
773
 
774
+ /**
775
+ * Represents a ready component message
776
+ * @public
777
+ */
284
778
  export type Ready = {
285
779
  type: CMType.READY;
286
780
  };
287
781
 
782
+ /**
783
+ * Represents a resize request component message. This is handled by the library.
784
+ * @internal
785
+ */
288
786
  export type ResizeRequest = {
289
787
  type: CMType.RESIZE;
290
788
  height: number;
291
789
  };
292
790
 
791
+ /**
792
+ * Represents an error component message
793
+ * @param message - Error message
794
+ * @public
795
+ */
293
796
  export type Error = {
294
797
  type: CMType.ERROR;
295
798
  message: string;
296
799
  };
297
800
 
298
- export type ModalRequest = {
299
- type: CMType.MODAL;
300
- url: string;
301
- reqid: RequestID;
302
- };
303
-
304
- export type CloseModal = {
305
- type: CMType.CLOSE;
306
- reqid: RequestID;
307
- };
308
-
801
+ /**
802
+ * Represents a cancel component message
803
+ * @internal
804
+ */
309
805
  export type Cancel = {
310
806
  type: CMType.CANCEL;
311
807
  };
312
808
 
313
- export type InvalidValue = {
809
+ /**
810
+ * Represents an invalid value component message
811
+ * @typeParam T - The overall Value type being returned
812
+ * @param value - The current Partial value
813
+ * @param errors - Array of validation errors
814
+ * @internal
815
+ */
816
+ export type InvalidValue<T> = {
314
817
  type: CMType.INVALID;
315
- value: any;
818
+ value: Partial<T>;
316
819
  errors: ValidationError[];
317
820
  };
318
821
 
319
822
  /**
320
- * Component Message
321
- * @internal
823
+ * Union type representing all possible messages that can be sent from a component
824
+ *
825
+ * @remarks
826
+ * Components communicate their state and results back to the host application
827
+ * through these message types:
828
+ * - Completed: Operation finished successfully with response data
829
+ * - Cancel: User cancelled the operation
830
+ * - Error: Operation failed with error message
831
+ * - Ready: Component initialized and ready for use
832
+ * - ResizeRequest: Component needs to adjust its dimensions
833
+ * - InvalidValue: Validation failed with current partial value
834
+ *
835
+ * @typeParam T - The value type that will be returned in Completed messages
836
+ *
837
+ * @see {@link Completed} For successful completion message format
838
+ * @see {@link Cancel} For cancellation message format
839
+ * @see {@link Error} For error message format
840
+ * @see {@link Ready} For ready message format
841
+ * @see {@link ResizeRequest} For resize message format
842
+ * @see {@link InvalidValue} For validation failure message format
843
+ * @public
322
844
  */
323
- export type ComponentMessage =
324
- | Completed
845
+ export type ComponentMessage<T> =
846
+ | Completed<T>
325
847
  | Cancel
326
848
  | Error
327
- | Result
328
849
  | Ready
329
850
  | ResizeRequest
330
- | ModalRequest
331
- | InvalidValue
332
- | CloseModal;
333
-
334
- export type RequestID = string;
851
+ | InvalidValue<T>;
335
852
 
336
853
  /**
337
- * Host Message Types
338
- * @internal
854
+ * Host Message Type enum representing different message types that can be sent
855
+ * from the host application.
856
+ *
857
+ * @remarks
858
+ * - UPDATE: Message to update component value/state
859
+ * - REQUEST_RESPONSE: Message requesting a response from component
860
+ * @public
339
861
  */
340
-
341
862
  export const enum HMType {
342
863
  UPDATE = 'update',
343
864
  REQUEST_RESPONSE = 'requestResponse',
344
865
  }
345
866
 
346
- export type UpdateValue = {
867
+ /**
868
+ * Message type for updating component state and configuration from host application
869
+ *
870
+ * @remarks
871
+ * Defines the structure of update messages sent from host to component:
872
+ * - type: Identifies this as an update message
873
+ * - value: New partial state/data to update the component with
874
+ * - options: Optional configuration parameters to modify component behavior
875
+ *
876
+ * The host can use this to dynamically update both the component's data
877
+ * and its configuration without requiring a full reload/reinitialize.
878
+ *
879
+ * @typeParam T - The type of the value being updated
880
+ * @typeParam O - The type of the optional configuration parameters
881
+ *
882
+ * @see {@link HMType} For message type constants
883
+ * @see {@link HostMessage} For full host message type union
884
+ * @public
885
+ */
886
+ export type UpdateValue<T, O> = {
347
887
  type: HMType.UPDATE;
348
- value: Partial<Transaction>;
349
- };
350
-
351
- export type RequestResponse = {
352
- type: HMType.REQUEST_RESPONSE;
353
- reqid: RequestID;
888
+ value: Partial<T>;
889
+ options?: O;
354
890
  };
355
891
 
356
892
  /**
357
- * Host Messages
358
- * @internal
893
+ * Union type representing all possible messages that can be sent from the host application
894
+ * to a component
895
+ *
896
+ * @remarks
897
+ * Currently only supports update messages which allow the host to modify component
898
+ * and configuration. The host uses these messages to communicate changes to the component
899
+ * without requiring full reinitialization.
900
+ *
901
+ * @typeParam T - The value type that components operate on
902
+ * @typeParam O - The options type used to configure component behavior
903
+ *
904
+ * @see {@link UpdateValue} For the structure of update messages
905
+ * @see {@link HMType} For message type constants
906
+ * @public
359
907
  */
908
+ export type HostMessage<T, O> = UpdateValue<T, O>;
360
909
 
361
- export type HostMessage = UpdateValue | RequestResponse;
362
-
910
+ /**
911
+ * Options for callback and redirect URIs
912
+ * @public
913
+ */
363
914
  export interface CallbackOptions {
364
915
  callback?: URI;
365
916
  redirectUri?: URI;
366
917
  }
367
918
 
368
919
  /**
369
- * Status of the proof
920
+ * Status of the ownership proof verification process
921
+ *
922
+ * @remarks
923
+ * Represents the different states that an ownership proof can be in during and after verification:
924
+ * - PENDING: Initial state where verification is in progress or awaiting processing
925
+ * - FAILED: The proof was rejected due to failing verification checks
926
+ * - FLAGGED: The proof requires manual review due to suspicious or unclear verification results
927
+ * - VERIFIED: The proof has passed all verification checks successfully
928
+ *
370
929
  * @public
371
930
  */
372
931
  export enum ProofStatus {
@@ -377,20 +936,58 @@ export enum ProofStatus {
377
936
  }
378
937
 
379
938
  /**
380
- * The type of Proofs supported
939
+ * Types of ownership proofs supported by the system
940
+ *
941
+ * @remarks
942
+ * Supported proof types:
943
+ * - SelfDeclaration: User self-declares ownership without cryptographic proof
944
+ * - EIP191: Ethereum personal signature following EIP-191 standard
945
+ * - SIWE: Sign-In with Ethereum message signature (EIP-4361)
946
+ * - EIP712: Ethereum typed data signature following EIP-712 standard
947
+ * - BIP137: Bitcoin message signature following BIP-137
948
+ * - XPUB: Extended public key signature for HD wallets
949
+ * - MicroTransfer: Proof via small blockchain transaction
950
+ * - Screenshot: Image proof of ownership/access
951
+ *
952
+ * @see {@link SignatureProof} For signature-based proofs
953
+ * @see {@link DeclarationProof} For self-declaration proofs
954
+ * @see {@link MicroTransferProof} For transaction-based proofs
955
+ * @see {@link ScreenshotProof} For screenshot proofs
381
956
  * @public
382
- **/
957
+ */
383
958
  export enum ProofTypes {
384
959
  SelfDeclaration = 'self-declaration',
385
- PersonalSignEIP191 = 'eip-191',
386
- PersonalSignEIP712 = 'eip-712',
387
- PersonalSignBIP137 = 'bip-137',
388
- PersonalSignXPUB = 'xpub',
960
+ SIWE = 'siwe',
961
+ SIWX = 'siwx',
962
+ EIP191 = 'eip-191',
963
+ EIP712 = 'eip-712',
964
+ EIP1271 = 'eip-1271',
965
+ BIP137 = 'bip-137',
966
+ BIP137_XPUB = 'xpub',
967
+ ED25519 = 'ed25519',
389
968
  MicroTransfer = 'microtransfer',
390
969
  Screenshot = 'screenshot',
391
970
  }
971
+
392
972
  /**
393
- * Ownership Proof
973
+ * Base interface for proving ownership of an account or address
974
+ *
975
+ * @remarks
976
+ * TheOwnershipProof interface provides a common structure for different types of ownership verification:
977
+ * - All proofs must specify their type from the supported ProofTypes enum
978
+ * - Current verification status is tracked via ProofStatus
979
+ * - Links the proof to a decentralized identifier (DID)
980
+ * - Specifies the blockchain account/address being proven using CAIP-10 format
981
+ *
982
+ * This interface is extended by specific proof types like:
983
+ * - SignatureProof for cryptographic signatures
984
+ * - DeclarationProof for self-declarations
985
+ * - MicroTransferProof for transaction-based proof
986
+ * - ScreenshotProof for image-based verification
987
+ *
988
+ * @see {@link ProofTypes} For supported proof methods
989
+ * @see {@link ProofStatus} For possible verification states
990
+ * @see {@link CAIP10} For address format specification
394
991
  * @public
395
992
  */
396
993
  export interface OwnershipProof {
@@ -401,15 +998,33 @@ export interface OwnershipProof {
401
998
  }
402
999
 
403
1000
  /**
404
- * Ownership Proof using Message Signature
1001
+ * Interface for signature-based ownership proofs that use cryptographic message signing
1002
+ *
1003
+ * @remarks
1004
+ * Extends the base OwnershipProface to add signature-specific properties:
1005
+ * - Supports multiple signature standards like EIP-191, EIP-712, BIP-137, SIWE
1006
+ * - Includes the cryptographic proof signature string
1007
+ * - Contains an attestation message that was signed
1008
+ * - Records which wallet provider was used for signing
1009
+ *
1010
+ * The signature proves ownership by demonstrating control of the private keys
1011
+ * associated with the claimed address.
1012
+ *
1013
+ * @see {@link ProofTypes} For supported signature types
1014
+ * @see {@link OwnershipProof} For base proof properties
405
1015
  * @public
406
1016
  */
407
1017
  export interface SignatureProof extends OwnershipProof {
408
1018
  type:
409
- | ProofTypes.PersonalSignEIP191
410
- | ProofTypes.PersonalSignEIP712
411
- | ProofTypes.PersonalSignBIP137
412
- | ProofTypes.PersonalSignXPUB;
1019
+ | ProofTypes.EIP191
1020
+ | ProofTypes.EIP712
1021
+ | ProofTypes.EIP1271
1022
+ | ProofTypes.BIP137
1023
+ | ProofTypes.BIP137_XPUB
1024
+ | ProofTypes.ED25519
1025
+ | ProofTypes.SIWX
1026
+ | ProofTypes.SIWE;
1027
+
413
1028
  proof: string;
414
1029
  attestation: string;
415
1030
  wallet_provider: string;
@@ -431,9 +1046,11 @@ export interface DeclarationProof extends OwnershipProof {
431
1046
  */
432
1047
  export interface MicroTransferProof extends OwnershipProof {
433
1048
  type: ProofTypes.MicroTransfer;
434
- txhash: string;
1049
+ proof: string;
435
1050
  chain: CAIP2;
436
- amount: number;
1051
+ asset: CAIP19;
1052
+ destination: BlockchainAddress;
1053
+ amountSubunits: string;
437
1054
  }
438
1055
 
439
1056
  /**