@notabene/javascript-sdk 2.0.0-next.17 → 2.0.0-next.19
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 +19 -0
- package/dist/notabene.cjs +1 -1
- package/dist/notabene.d.ts +456 -76
- package/dist/notabene.js +62 -16
- package/package.json +1 -1
- package/src/components/EmbeddedComponent.ts +20 -8
- package/src/components/__tests__/EmbeddedComponent.test.ts +61 -16
- package/src/notabene.ts +88 -33
- package/src/types.ts +414 -40
- package/src/utils/MessageEventManager.ts +62 -3
- package/src/utils/__tests__/MessageEventManager.test.ts +12 -4
package/src/types.ts
CHANGED
|
@@ -8,6 +8,20 @@ import {
|
|
|
8
8
|
Originator,
|
|
9
9
|
} from './ivms/types';
|
|
10
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
|
+
};
|
|
11
25
|
/**
|
|
12
26
|
* Interoperable Virtual Asset Service Provider (VASP) Messaging Standard
|
|
13
27
|
* @public
|
|
@@ -15,34 +29,63 @@ import {
|
|
|
15
29
|
export type { IVMS101 };
|
|
16
30
|
|
|
17
31
|
/**
|
|
18
|
-
* UUID v4
|
|
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}
|
|
19
37
|
* @public
|
|
20
38
|
*/
|
|
21
39
|
export type UUID = string;
|
|
22
40
|
|
|
23
41
|
/**
|
|
24
|
-
* Chain Agnostic Blockchain Identifier
|
|
25
|
-
* Represents a blockchain in a chain-agnostic way
|
|
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
|
+
*
|
|
26
46
|
* Format: `namespace:reference`
|
|
27
|
-
*
|
|
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}
|
|
28
54
|
* @public
|
|
29
55
|
*/
|
|
30
56
|
export type CAIP2 = `${string}:${string}`;
|
|
31
57
|
|
|
32
58
|
/**
|
|
33
|
-
* Chain Agnostic Account Identifier
|
|
34
|
-
* Represents an account on a specific blockchain
|
|
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
|
+
*
|
|
35
63
|
* Format: `{caip2}:{address}`
|
|
36
|
-
*
|
|
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}
|
|
37
71
|
* @public
|
|
38
72
|
*/
|
|
39
73
|
export type CAIP10 = `${CAIP2}:${string}`;
|
|
40
74
|
|
|
41
75
|
/**
|
|
42
|
-
* Chain Agnostic Asset Identifier
|
|
43
|
-
* Represents an asset on a specific blockchain
|
|
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
|
+
*
|
|
44
80
|
* Format: `{caip2}/{asset_namespace}:{asset_reference}`
|
|
45
|
-
*
|
|
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}
|
|
46
89
|
* @public
|
|
47
90
|
*/
|
|
48
91
|
export type CAIP19 = `${CAIP2}/${string}:${string}`;
|
|
@@ -54,15 +97,45 @@ export type CAIP19 = `${CAIP2}/${string}:${string}`;
|
|
|
54
97
|
export type CAIP220 = string;
|
|
55
98
|
|
|
56
99
|
/**
|
|
57
|
-
* Digital Token Identifier
|
|
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}
|
|
58
114
|
* @public
|
|
59
115
|
*/
|
|
116
|
+
|
|
60
117
|
export type DTI = string;
|
|
61
118
|
|
|
62
119
|
/**
|
|
63
120
|
* Notabene Asset Identifier
|
|
64
121
|
* @public
|
|
65
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.
|
|
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
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
|
|
66
139
|
export type NotabeneAsset = string;
|
|
67
140
|
|
|
68
141
|
/**
|
|
@@ -75,19 +148,47 @@ export type TransactionAsset = NotabeneAsset | CAIP19 | DTI;
|
|
|
75
148
|
* A blockchain address
|
|
76
149
|
* @public
|
|
77
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
|
+
|
|
78
166
|
export type BlockchainAddress = string;
|
|
79
167
|
|
|
80
168
|
/**
|
|
81
169
|
* A travel address
|
|
82
170
|
* @public
|
|
83
|
-
|
|
84
|
-
|
|
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}`;
|
|
85
187
|
|
|
86
188
|
/**
|
|
87
189
|
* A crypto credential
|
|
88
190
|
* @public
|
|
89
|
-
*/
|
|
90
|
-
export type CryptoCredential = `${string}.${string}.mastercard`;
|
|
191
|
+
*/ export type CryptoCredential = `${string}.${string}.mastercard`;
|
|
91
192
|
|
|
92
193
|
/**
|
|
93
194
|
* The destination of a transaction either a blockchain address, a CAIP-19 address, or a travel address.
|
|
@@ -166,6 +267,23 @@ export interface Agent {
|
|
|
166
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.
|
|
167
268
|
* @public
|
|
168
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
|
+
*/
|
|
169
287
|
export enum PersonType {
|
|
170
288
|
NATURAL = 'natural',
|
|
171
289
|
LEGAL = 'legal',
|
|
@@ -196,6 +314,28 @@ export interface Wallet extends Agent {
|
|
|
196
314
|
* The counterparty of a transaction.
|
|
197
315
|
* @public
|
|
198
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
|
+
*/
|
|
199
339
|
export interface Counterparty {
|
|
200
340
|
name?: string;
|
|
201
341
|
accountNumber?: string;
|
|
@@ -210,7 +350,22 @@ export interface Counterparty {
|
|
|
210
350
|
}
|
|
211
351
|
|
|
212
352
|
/**
|
|
213
|
-
*
|
|
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
|
|
214
369
|
* @public
|
|
215
370
|
*/
|
|
216
371
|
export interface NaturalPerson extends Counterparty {
|
|
@@ -234,8 +389,9 @@ export type NaturalPersonFieldName =
|
|
|
234
389
|
| 'dateOfBirth' // Date of Birty YYYY-MM-DD
|
|
235
390
|
| 'placeOfBirth' // Place of Birth
|
|
236
391
|
| 'countryOfResidence'; // ISO Country code of residence of Natural Person
|
|
392
|
+
|
|
237
393
|
/**
|
|
238
|
-
* Field properties by field name
|
|
394
|
+
* Field properties by field name for Natural persons
|
|
239
395
|
* @public
|
|
240
396
|
*/
|
|
241
397
|
export type NaturalPersonFields = {
|
|
@@ -243,7 +399,23 @@ export type NaturalPersonFields = {
|
|
|
243
399
|
};
|
|
244
400
|
|
|
245
401
|
/**
|
|
246
|
-
*
|
|
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
|
|
247
419
|
* @public
|
|
248
420
|
*/
|
|
249
421
|
export interface LegalPerson extends Counterparty {
|
|
@@ -253,12 +425,8 @@ export interface LegalPerson extends Counterparty {
|
|
|
253
425
|
logo?: URI;
|
|
254
426
|
countryOfRegistration?: ISOCountryCode;
|
|
255
427
|
}
|
|
256
|
-
/**
|
|
257
|
-
* Field names for LegalPerson
|
|
258
|
-
* @public
|
|
259
|
-
*/
|
|
260
428
|
|
|
261
|
-
|
|
429
|
+
type LegalPersonFieldName =
|
|
262
430
|
| 'name' // Full legal name
|
|
263
431
|
| 'lei' // Legal Entity Identifier
|
|
264
432
|
| 'website' // Primary website of entity
|
|
@@ -305,7 +473,19 @@ type DepositRequestFields = {
|
|
|
305
473
|
type RequestID = UUID;
|
|
306
474
|
|
|
307
475
|
/**
|
|
308
|
-
*
|
|
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
|
|
309
489
|
* @public
|
|
310
490
|
*/
|
|
311
491
|
export interface ComponentRequest {
|
|
@@ -314,7 +494,26 @@ export interface ComponentRequest {
|
|
|
314
494
|
}
|
|
315
495
|
|
|
316
496
|
/**
|
|
317
|
-
*
|
|
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
|
|
318
517
|
* @public
|
|
319
518
|
*/
|
|
320
519
|
export interface Transaction extends ComponentRequest {
|
|
@@ -367,7 +566,22 @@ export enum Status {
|
|
|
367
566
|
BANNED = 'banned',
|
|
368
567
|
}
|
|
369
568
|
|
|
370
|
-
|
|
569
|
+
/**
|
|
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
|
|
581
|
+
* @public
|
|
582
|
+
*/
|
|
583
|
+
export type V1Asset = NotabeneAsset | { caip19: CAIP19 };
|
|
584
|
+
|
|
371
585
|
/**
|
|
372
586
|
* Transaction payload suitable for calling Notabene v1 tx/create
|
|
373
587
|
* @public
|
|
@@ -383,19 +597,53 @@ export type V1Transaction = {
|
|
|
383
597
|
beneficiary: Beneficiary;
|
|
384
598
|
};
|
|
385
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
|
+
*/
|
|
386
619
|
export interface ComponentResponse {
|
|
387
620
|
requestID: RequestID;
|
|
388
621
|
valid: boolean;
|
|
389
622
|
status: Status;
|
|
390
623
|
errors: ValidationError[];
|
|
391
624
|
}
|
|
625
|
+
|
|
392
626
|
/**
|
|
393
|
-
*
|
|
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
|
|
394
642
|
* @public
|
|
395
643
|
*/
|
|
396
644
|
export interface TransactionResponse<V> extends ComponentResponse {
|
|
397
645
|
value: V;
|
|
398
|
-
|
|
646
|
+
ivms101: IVMS101;
|
|
399
647
|
proof?: OwnershipProof;
|
|
400
648
|
txCreate?: V1Transaction;
|
|
401
649
|
}
|
|
@@ -420,15 +668,25 @@ export type FieldOptions =
|
|
|
420
668
|
transmit: boolean; // Transmit as part of IVMS 101 to counterparty
|
|
421
669
|
};
|
|
422
670
|
|
|
671
|
+
/**
|
|
672
|
+
* Field type configuration
|
|
673
|
+
* @public
|
|
674
|
+
*/
|
|
675
|
+
|
|
423
676
|
export type FieldTypes = {
|
|
424
677
|
naturalPerson?: NaturalPersonFields;
|
|
425
678
|
legalPerson?: LegalPersonFields;
|
|
426
679
|
};
|
|
427
680
|
|
|
681
|
+
/**
|
|
682
|
+
* Options for which VASPs to be searchable
|
|
683
|
+
* @public
|
|
684
|
+
*/
|
|
428
685
|
export type VASPOptions = {
|
|
429
686
|
addUnknown?: boolean;
|
|
430
687
|
onlyActive?: boolean;
|
|
431
688
|
};
|
|
689
|
+
|
|
432
690
|
/**
|
|
433
691
|
* Configuration options for Transaction components
|
|
434
692
|
* @public
|
|
@@ -449,7 +707,17 @@ export interface TransactionOptions {
|
|
|
449
707
|
}
|
|
450
708
|
|
|
451
709
|
/**
|
|
452
|
-
* Component Message
|
|
710
|
+
* Component Message Type enum representing different message types that can be sent
|
|
711
|
+
* between the host and component.
|
|
712
|
+
*
|
|
713
|
+
* @remarks
|
|
714
|
+
* - COMPLETE: Indicates a completed operation with response data
|
|
715
|
+
* - RESIZE: Request to adjust component size/dimensions
|
|
716
|
+
* - RESULT: Operation result notification
|
|
717
|
+
* - READY: Component is initialized and ready
|
|
718
|
+
* - INVALID: Validation failed with errors
|
|
719
|
+
* - ERROR: Operation encountered an error
|
|
720
|
+
* - CANCEL: Operation was cancelled
|
|
453
721
|
* @public
|
|
454
722
|
*/
|
|
455
723
|
export const enum CMType {
|
|
@@ -522,7 +790,26 @@ export type InvalidValue<T> = {
|
|
|
522
790
|
};
|
|
523
791
|
|
|
524
792
|
/**
|
|
525
|
-
*
|
|
793
|
+
* Union type representing all possible messages that can be sent from a component
|
|
794
|
+
*
|
|
795
|
+
* @remarks
|
|
796
|
+
* Components communicate their state and results back to the host application
|
|
797
|
+
* through these message types:
|
|
798
|
+
* - Completed: Operation finished successfully with response data
|
|
799
|
+
* - Cancel: User cancelled the operation
|
|
800
|
+
* - Error: Operation failed with error message
|
|
801
|
+
* - Ready: Component initialized and ready for use
|
|
802
|
+
* - ResizeRequest: Component needs to adjust its dimensions
|
|
803
|
+
* - InvalidValue: Validation failed with current partial value
|
|
804
|
+
*
|
|
805
|
+
* @typeParam T - The value type that will be returned in Completed messages
|
|
806
|
+
*
|
|
807
|
+
* @see {@link Completed} For successful completion message format
|
|
808
|
+
* @see {@link Cancel} For cancellation message format
|
|
809
|
+
* @see {@link Error} For error message format
|
|
810
|
+
* @see {@link Ready} For ready message format
|
|
811
|
+
* @see {@link ResizeRequest} For resize message format
|
|
812
|
+
* @see {@link InvalidValue} For validation failure message format
|
|
526
813
|
* @public
|
|
527
814
|
*/
|
|
528
815
|
export type ComponentMessage<T> =
|
|
@@ -534,29 +821,61 @@ export type ComponentMessage<T> =
|
|
|
534
821
|
| InvalidValue<T>;
|
|
535
822
|
|
|
536
823
|
/**
|
|
537
|
-
* Host Message
|
|
824
|
+
* Host Message Type enum representing different message types that can be sent
|
|
825
|
+
* from the host application.
|
|
826
|
+
*
|
|
827
|
+
* @remarks
|
|
828
|
+
* - UPDATE: Message to update component value/state
|
|
829
|
+
* - REQUEST_RESPONSE: Message requesting a response from component
|
|
538
830
|
* @public
|
|
539
831
|
*/
|
|
540
|
-
|
|
541
832
|
export const enum HMType {
|
|
542
833
|
UPDATE = 'update',
|
|
543
834
|
REQUEST_RESPONSE = 'requestResponse',
|
|
544
835
|
}
|
|
545
836
|
|
|
546
837
|
/**
|
|
547
|
-
*
|
|
838
|
+
* Message type for updating component state and configuration from host application
|
|
839
|
+
*
|
|
840
|
+
* @remarks
|
|
841
|
+
* Defines the structure of update messages sent from host to component:
|
|
842
|
+
* - type: Identifies this as an update message
|
|
843
|
+
* - value: New partial state/data to update the component with
|
|
844
|
+
* - options: Optional configuration parameters to modify component behavior
|
|
845
|
+
*
|
|
846
|
+
* The host can use this to dynamically update both the component's data
|
|
847
|
+
* and its configuration without requiring a full reload/reinitialize.
|
|
848
|
+
*
|
|
849
|
+
* @typeParam T - The type of the value being updated
|
|
850
|
+
* @typeParam O - The type of the optional configuration parameters
|
|
851
|
+
*
|
|
852
|
+
* @see {@link HMType} For message type constants
|
|
853
|
+
* @see {@link HostMessage} For full host message type union
|
|
548
854
|
* @public
|
|
549
855
|
*/
|
|
550
|
-
export type UpdateValue<T> = {
|
|
856
|
+
export type UpdateValue<T, O> = {
|
|
551
857
|
type: HMType.UPDATE;
|
|
552
858
|
value: Partial<T>;
|
|
859
|
+
options?: O;
|
|
553
860
|
};
|
|
554
861
|
|
|
555
862
|
/**
|
|
556
|
-
*
|
|
863
|
+
* Union type representing all possible messages that can be sent from the host application
|
|
864
|
+
* to a component
|
|
865
|
+
*
|
|
866
|
+
* @remarks
|
|
867
|
+
* Currently only supports update messages which allow the host to modify component
|
|
868
|
+
* and configuration. The host uses these messages to communicate changes to the component
|
|
869
|
+
* without requiring full reinitialization.
|
|
870
|
+
*
|
|
871
|
+
* @typeParam T - The value type that components operate on
|
|
872
|
+
* @typeParam O - The options type used to configure component behavior
|
|
873
|
+
*
|
|
874
|
+
* @see {@link UpdateValue} For the structure of update messages
|
|
875
|
+
* @see {@link HMType} For message type constants
|
|
557
876
|
* @public
|
|
558
877
|
*/
|
|
559
|
-
export type HostMessage<T> = UpdateValue<T>;
|
|
878
|
+
export type HostMessage<T, O> = UpdateValue<T, O>;
|
|
560
879
|
|
|
561
880
|
/**
|
|
562
881
|
* Options for callback and redirect URIs
|
|
@@ -568,7 +887,15 @@ export interface CallbackOptions {
|
|
|
568
887
|
}
|
|
569
888
|
|
|
570
889
|
/**
|
|
571
|
-
* Status of the proof
|
|
890
|
+
* Status of the ownership proof verification process
|
|
891
|
+
*
|
|
892
|
+
* @remarks
|
|
893
|
+
* Represents the different states that an ownership proof can be in during and after verification:
|
|
894
|
+
* - PENDING: Initial state where verification is in progress or awaiting processing
|
|
895
|
+
* - FAILED: The proof was rejected due to failing verification checks
|
|
896
|
+
* - FLAGGED: The proof requires manual review due to suspicious or unclear verification results
|
|
897
|
+
* - VERIFIED: The proof has passed all verification checks successfully
|
|
898
|
+
*
|
|
572
899
|
* @public
|
|
573
900
|
*/
|
|
574
901
|
export enum ProofStatus {
|
|
@@ -579,7 +906,23 @@ export enum ProofStatus {
|
|
|
579
906
|
}
|
|
580
907
|
|
|
581
908
|
/**
|
|
582
|
-
*
|
|
909
|
+
* Types of ownership proofs supported by the system
|
|
910
|
+
*
|
|
911
|
+
* @remarks
|
|
912
|
+
* Supported proof types:
|
|
913
|
+
* - SelfDeclaration: User self-declares ownership without cryptographic proof
|
|
914
|
+
* - PersonalSignEIP191: Ethereum personal signature following EIP-191 standard
|
|
915
|
+
* - SIWE: Sign-In with Ethereum message signature (EIP-4361)
|
|
916
|
+
* - PersonalSignEIP712: Ethereum typed data signature following EIP-712 standard
|
|
917
|
+
* - PersonalSignBIP137: Bitcoin message signature following BIP-137
|
|
918
|
+
* - PersonalSignXPUB: Extended public key signature for HD wallets
|
|
919
|
+
* - MicroTransfer: Proof via small blockchain transaction
|
|
920
|
+
* - Screenshot: Image proof of ownership/access
|
|
921
|
+
*
|
|
922
|
+
* @see {@link SignatureProof} For signature-based proofs
|
|
923
|
+
* @see {@link DeclarationProof} For self-declaration proofs
|
|
924
|
+
* @see {@link MicroTransferProof} For transaction-based proofs
|
|
925
|
+
* @see {@link ScreenshotProof} For screenshot proofs
|
|
583
926
|
* @public
|
|
584
927
|
*/
|
|
585
928
|
export enum ProofTypes {
|
|
@@ -594,7 +937,24 @@ export enum ProofTypes {
|
|
|
594
937
|
}
|
|
595
938
|
|
|
596
939
|
/**
|
|
597
|
-
*
|
|
940
|
+
* Base interface for proving ownership of an account or address
|
|
941
|
+
*
|
|
942
|
+
* @remarks
|
|
943
|
+
* TheOwnershipProof interface provides a common structure for different types of ownership verification:
|
|
944
|
+
* - All proofs must specify their type from the supported ProofTypes enum
|
|
945
|
+
* - Current verification status is tracked via ProofStatus
|
|
946
|
+
* - Links the proof to a decentralized identifier (DID)
|
|
947
|
+
* - Specifies the blockchain account/address being proven using CAIP-10 format
|
|
948
|
+
*
|
|
949
|
+
* This interface is extended by specific proof types like:
|
|
950
|
+
* - SignatureProof for cryptographic signatures
|
|
951
|
+
* - DeclarationProof for self-declarations
|
|
952
|
+
* - MicroTransferProof for transaction-based proof
|
|
953
|
+
* - ScreenshotProof for image-based verification
|
|
954
|
+
*
|
|
955
|
+
* @see {@link ProofTypes} For supported proof methods
|
|
956
|
+
* @see {@link ProofStatus} For possible verification states
|
|
957
|
+
* @see {@link CAIP10} For address format specification
|
|
598
958
|
* @public
|
|
599
959
|
*/
|
|
600
960
|
export interface OwnershipProof {
|
|
@@ -605,7 +965,20 @@ export interface OwnershipProof {
|
|
|
605
965
|
}
|
|
606
966
|
|
|
607
967
|
/**
|
|
608
|
-
*
|
|
968
|
+
* Interface for signature-based ownership proofs that use cryptographic message signing
|
|
969
|
+
*
|
|
970
|
+
* @remarks
|
|
971
|
+
* Extends the base OwnershipProface to add signature-specific properties:
|
|
972
|
+
* - Supports multiple signature standards like EIP-191, EIP-712, BIP-137, SIWE
|
|
973
|
+
* - Includes the cryptographic proof signature string
|
|
974
|
+
* - Contains an attestation message that was signed
|
|
975
|
+
* - Records which wallet provider was used for signing
|
|
976
|
+
*
|
|
977
|
+
* The signature proves ownership by demonstrating control of the private keys
|
|
978
|
+
* associated with the claimed address.
|
|
979
|
+
*
|
|
980
|
+
* @see {@link ProofTypes} For supported signature types
|
|
981
|
+
* @see {@link OwnershipProof} For base proof properties
|
|
609
982
|
* @public
|
|
610
983
|
*/
|
|
611
984
|
export interface SignatureProof extends OwnershipProof {
|
|
@@ -638,6 +1011,7 @@ export interface MicroTransferProof extends OwnershipProof {
|
|
|
638
1011
|
type: ProofTypes.MicroTransfer;
|
|
639
1012
|
txhash: string;
|
|
640
1013
|
chain: CAIP2;
|
|
1014
|
+
destination: BlockchainAddress;
|
|
641
1015
|
amountSubunits: string;
|
|
642
1016
|
}
|
|
643
1017
|
|