@notabene/javascript-sdk 2.14.0 → 2.14.1-next.2
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 +4 -4
- package/dist/cjs/notabene.cjs +23 -1
- package/dist/cjs/notabene.d.ts +75 -51
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +75 -51
- package/dist/esm/notabene.js +12115 -449
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +75 -51
- package/dist/notabene.js +12115 -449
- package/package.json +1 -1
- package/src/responseTransformer/__tests__/transformer.test.ts +638 -0
- package/src/responseTransformer/__tests__/utils.test.ts +35 -0
- package/src/responseTransformer/mappers.ts +94 -24
- package/src/responseTransformer/transformer.ts +121 -73
- package/src/responseTransformer/types.ts +12 -1
- package/src/responseTransformer/utils.ts +37 -1
- package/src/types.ts +1 -3
package/dist/cjs/notabene.d.ts
CHANGED
|
@@ -82,6 +82,11 @@ export declare enum AgentType {
|
|
|
82
82
|
VASP = "VASP"
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
declare interface BaseRequestConfig {
|
|
86
|
+
originatorId?: DID_2;
|
|
87
|
+
beneficiaryId?: DID_2;
|
|
88
|
+
}
|
|
89
|
+
|
|
85
90
|
/**
|
|
86
91
|
* Beneficiary
|
|
87
92
|
* Represents the receiver of the requested VA transfer
|
|
@@ -331,32 +336,45 @@ export declare interface ComponentResponse {
|
|
|
331
336
|
/**
|
|
332
337
|
* Transforms a Notabene component response to IVMS101 format
|
|
333
338
|
*
|
|
339
|
+
* ## IVMS101 Config by Transaction Type
|
|
340
|
+
*
|
|
341
|
+
* The `originator` and `beneficiary` config options provide the customer's PII data.
|
|
342
|
+
* Which one to use depends on the transaction type:
|
|
343
|
+
*
|
|
344
|
+
* - **Withdrawals**: Pass `originator` - the customer is sending funds (customer = originator)
|
|
345
|
+
* - **Deposits**: Pass `beneficiary` - the customer is receiving funds (customer = beneficiary)
|
|
346
|
+
*
|
|
347
|
+
* For self-transfers, the provided data is automatically reused for both parties.
|
|
348
|
+
*
|
|
334
349
|
* @param response - The response from the Notabene Embedded Component
|
|
335
|
-
* @param delegateToken - The JWT delegate token for extracting the
|
|
350
|
+
* @param delegateToken - The JWT delegate token for extracting the customer ID
|
|
336
351
|
* @param config - Configuration object with optional IDs
|
|
337
|
-
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken
|
|
338
|
-
* @param config.beneficiaryId - Optional beneficiary ID (auto-
|
|
339
|
-
* @param config.
|
|
340
|
-
* @param config.
|
|
352
|
+
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken for withdrawals)
|
|
353
|
+
* @param config.beneficiaryId - Optional beneficiary ID (auto-extracted from delegateToken for deposits)
|
|
354
|
+
* @param config.originator - Customer's IVMS101 data for withdrawals (customer is the sender)
|
|
355
|
+
* @param config.beneficiary - Customer's IVMS101 data for deposits (customer is the receiver)
|
|
341
356
|
* @returns The transformed request body in IVMS101 format
|
|
342
357
|
*
|
|
343
358
|
* @example
|
|
344
359
|
* ```typescript
|
|
345
360
|
* import { componentResponseToIVMS101 } from '$lib/notabene-tx-transformer';
|
|
346
361
|
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
362
|
+
* // For withdrawals: pass originator (customer is sending)
|
|
363
|
+
* const withdrawalIvms = componentResponseToIVMS101(
|
|
364
|
+
* withdrawalResponse,
|
|
365
|
+
* delegateToken,
|
|
366
|
+
* { originator: customerIvmsData }
|
|
351
367
|
* );
|
|
352
368
|
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
369
|
+
* // For deposits: pass beneficiary (customer is receiving)
|
|
370
|
+
* const depositIvms = componentResponseToIVMS101(
|
|
371
|
+
* depositResponse,
|
|
372
|
+
* delegateToken,
|
|
373
|
+
* { beneficiary: customerIvmsData }
|
|
374
|
+
* );
|
|
357
375
|
* ```
|
|
358
376
|
*/
|
|
359
|
-
export declare function componentResponseToIVMS101(response: TransactionResponse<Withdrawal>, delegateToken: string, config?:
|
|
377
|
+
export declare function componentResponseToIVMS101(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToIVMS101RequestConfig): TransactionIVMS101Request;
|
|
360
378
|
|
|
361
379
|
/**
|
|
362
380
|
* Transforms a Notabene component response to a Version 2 transaction create API request body
|
|
@@ -373,9 +391,11 @@ export declare function componentResponseToIVMS101(response: TransactionResponse
|
|
|
373
391
|
* ```typescript
|
|
374
392
|
* import { componentResponseToTxCreateRequest } from '$lib/notabene-tx-transformer';
|
|
375
393
|
*
|
|
376
|
-
* withdrawal
|
|
394
|
+
* // Works with both withdrawal and deposit responses
|
|
395
|
+
* transaction.on('complete', async (result) => {
|
|
377
396
|
* const requestBody = componentResponseToTxCreateRequest(
|
|
378
397
|
* result.response,
|
|
398
|
+
* delegateToken,
|
|
379
399
|
* {
|
|
380
400
|
* originatorId: 'mailto:user@example.com',
|
|
381
401
|
* beneficiaryId: 'urn:beneficiary:recipient',
|
|
@@ -390,7 +410,7 @@ export declare function componentResponseToIVMS101(response: TransactionResponse
|
|
|
390
410
|
* });
|
|
391
411
|
* ```
|
|
392
412
|
*/
|
|
393
|
-
export declare function componentResponseToTxCreateRequest(response: TransactionResponse<Withdrawal>, delegateToken: string, config?:
|
|
413
|
+
export declare function componentResponseToTxCreateRequest(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToTxCreateRequestConfig): TransactionCreateRequestV2;
|
|
394
414
|
|
|
395
415
|
/**
|
|
396
416
|
* Transforms a Notabene component response into txCreate, IVMS101, and confirmRelationship request bodies
|
|
@@ -400,50 +420,50 @@ export declare function componentResponseToTxCreateRequest(response: Transaction
|
|
|
400
420
|
* which is useful for V2 workflows where you need to create a transaction first,
|
|
401
421
|
* then append IVMS101 data to it, and finally confirm the relationship.
|
|
402
422
|
*
|
|
423
|
+
* ## IVMS101 Config by Transaction Type
|
|
424
|
+
*
|
|
425
|
+
* The `originator` and `beneficiary` config options provide the customer's PII data.
|
|
426
|
+
* Which one to use depends on the transaction type:
|
|
427
|
+
*
|
|
428
|
+
* - **Withdrawals**: Pass `originator` - the customer is sending funds (customer = originator)
|
|
429
|
+
* - **Deposits**: Pass `beneficiary` - the customer is receiving funds (customer = beneficiary)
|
|
430
|
+
*
|
|
431
|
+
* For self-transfers, the provided data is automatically reused for both parties.
|
|
432
|
+
*
|
|
403
433
|
* @param response - The response from the Notabene Embedded Component
|
|
404
|
-
* @param delegateToken - The JWT delegate token for extracting the
|
|
434
|
+
* @param delegateToken - The JWT delegate token for extracting the customer ID
|
|
405
435
|
* @param config - Optional configuration for IDs and reference
|
|
406
|
-
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken
|
|
407
|
-
* @param config.beneficiaryId - Optional beneficiary ID (auto-
|
|
436
|
+
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken for withdrawals)
|
|
437
|
+
* @param config.beneficiaryId - Optional beneficiary ID (auto-extracted from delegateToken for deposits)
|
|
408
438
|
* @param config.referenceId - Optional reference ID (auto-generated if not provided)
|
|
409
|
-
* @param config.originator -
|
|
439
|
+
* @param config.originator - Customer's IVMS101 data for withdrawals (customer is the sender)
|
|
440
|
+
* @param config.beneficiary - Customer's IVMS101 data for deposits (customer is the receiver)
|
|
410
441
|
* @returns Object with `createTx`, `ivms101`, and optional `confirmRelationship` properties containing the respective request bodies
|
|
411
442
|
*
|
|
412
443
|
* @example
|
|
413
444
|
* ```typescript
|
|
414
445
|
* import { componentResponseToTxRequests } from '$lib/notabene-tx-transformer';
|
|
415
446
|
*
|
|
447
|
+
* // For withdrawals: pass originator (customer is sending)
|
|
416
448
|
* withdrawal.on('complete', async (result) => {
|
|
417
|
-
* const { createTx, ivms101
|
|
449
|
+
* const { createTx, ivms101 } = componentResponseToTxRequests(
|
|
418
450
|
* result.response,
|
|
419
|
-
*
|
|
420
|
-
* { originator:
|
|
451
|
+
* delegateToken,
|
|
452
|
+
* { originator: customerIvmsData }
|
|
421
453
|
* );
|
|
454
|
+
* });
|
|
422
455
|
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
* const txId = txResponse.transfer['@id'];
|
|
431
|
-
* await fetch(`/entity/${vaspDid}/tx/${txId}/append`, {
|
|
432
|
-
* method: 'POST',
|
|
433
|
-
* body: JSON.stringify(ivms101)
|
|
434
|
-
* });
|
|
435
|
-
*
|
|
436
|
-
* // Finally, confirm relationship
|
|
437
|
-
* if (confirmRelationship) {
|
|
438
|
-
* await fetch(`/entity/${vaspDid}/relationship?to=${to}&from=${from}`, {
|
|
439
|
-
* method: 'PATCH',
|
|
440
|
-
* body: JSON.stringify({ proof: confirmRelationship.proof })
|
|
441
|
-
* });
|
|
442
|
-
* }
|
|
456
|
+
* // For deposits: pass beneficiary (customer is receiving)
|
|
457
|
+
* deposit.on('complete', async (result) => {
|
|
458
|
+
* const { createTx, ivms101 } = componentResponseToTxRequests(
|
|
459
|
+
* result.response,
|
|
460
|
+
* delegateToken,
|
|
461
|
+
* { beneficiary: customerIvmsData }
|
|
462
|
+
* );
|
|
443
463
|
* });
|
|
444
464
|
* ```
|
|
445
465
|
*/
|
|
446
|
-
export declare function componentResponseToTxRequests(response: TransactionResponse<Withdrawal>, delegateToken: string, config?: ResponseToTxRequestConfig): {
|
|
466
|
+
export declare function componentResponseToTxRequests(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToTxRequestConfig): {
|
|
447
467
|
createTx: TransactionCreateRequestV2;
|
|
448
468
|
ivms101: TransactionIVMS101Request;
|
|
449
469
|
confirmRelationship?: {
|
|
@@ -1612,7 +1632,6 @@ export declare enum ProofStatus {
|
|
|
1612
1632
|
* - ED25519: Ed25519 signature (used in Solana)
|
|
1613
1633
|
* - XRP_ED25519: Ed25519 signature (used in XRP)
|
|
1614
1634
|
* - XLM_ED25519: Ed25519 signature (used in Stellar)
|
|
1615
|
-
* - XPUB: Extended public key signature for HD wallets
|
|
1616
1635
|
* - MicroTransfer: Proof via small blockchain transaction
|
|
1617
1636
|
* - Screenshot: Image proof of ownership/access
|
|
1618
1637
|
* - CIP8: Cardano message signing standard (CIP-8)
|
|
@@ -1633,7 +1652,6 @@ export declare enum ProofTypes {
|
|
|
1633
1652
|
EIP1271 = "eip-1271",
|
|
1634
1653
|
BIP137 = "bip-137",
|
|
1635
1654
|
BIP322 = "bip-322",
|
|
1636
|
-
BIP137_XPUB = "xpub",
|
|
1637
1655
|
TIP191 = "tip-191",
|
|
1638
1656
|
ED25519 = "ed25519",
|
|
1639
1657
|
XRP_ED25519 = "xrp-ed25519",
|
|
@@ -1674,13 +1692,18 @@ export declare type ResizeRequest = {
|
|
|
1674
1692
|
height: number;
|
|
1675
1693
|
};
|
|
1676
1694
|
|
|
1677
|
-
|
|
1678
|
-
originatorId?: DID_2;
|
|
1679
|
-
beneficiaryId?: DID_2;
|
|
1680
|
-
referenceId?: string;
|
|
1695
|
+
declare interface ResponseToIVMS101RequestConfig extends BaseRequestConfig {
|
|
1681
1696
|
originator?: OriginatorV2;
|
|
1697
|
+
beneficiary?: BeneficiaryV2;
|
|
1682
1698
|
}
|
|
1683
1699
|
|
|
1700
|
+
declare interface ResponseToTxCreateRequestConfig extends BaseRequestConfig {
|
|
1701
|
+
referenceId?: string;
|
|
1702
|
+
settlementAddress?: string;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
export declare type ResponseToTxRequestConfig = ResponseToTxCreateRequestConfig & ResponseToIVMS101RequestConfig;
|
|
1706
|
+
|
|
1684
1707
|
/**
|
|
1685
1708
|
* Ownership Proof using Screenshot
|
|
1686
1709
|
* @public
|
|
@@ -1708,7 +1731,7 @@ export declare interface ScreenshotProof extends OwnershipProof {
|
|
|
1708
1731
|
* @public
|
|
1709
1732
|
*/
|
|
1710
1733
|
export declare interface SignatureProof extends OwnershipProof {
|
|
1711
|
-
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.
|
|
1734
|
+
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519 | ProofTypes.COSMOS;
|
|
1712
1735
|
proof: string;
|
|
1713
1736
|
attestation: string;
|
|
1714
1737
|
wallet_provider: string;
|
|
@@ -1923,6 +1946,7 @@ export declare interface TransactionOptions {
|
|
|
1923
1946
|
vasps?: VASPOptions;
|
|
1924
1947
|
hide?: ValidationSections[];
|
|
1925
1948
|
counterpartyAssist?: CounterpartyAssistConfig;
|
|
1949
|
+
autoSubmit?: boolean;
|
|
1926
1950
|
}
|
|
1927
1951
|
|
|
1928
1952
|
/**
|
package/dist/cjs/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.14.
|
|
13
|
+
"version": "2.14.1-next.2",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
package/dist/esm/notabene.d.ts
CHANGED
|
@@ -82,6 +82,11 @@ export declare enum AgentType {
|
|
|
82
82
|
VASP = "VASP"
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
declare interface BaseRequestConfig {
|
|
86
|
+
originatorId?: DID_2;
|
|
87
|
+
beneficiaryId?: DID_2;
|
|
88
|
+
}
|
|
89
|
+
|
|
85
90
|
/**
|
|
86
91
|
* Beneficiary
|
|
87
92
|
* Represents the receiver of the requested VA transfer
|
|
@@ -331,32 +336,45 @@ export declare interface ComponentResponse {
|
|
|
331
336
|
/**
|
|
332
337
|
* Transforms a Notabene component response to IVMS101 format
|
|
333
338
|
*
|
|
339
|
+
* ## IVMS101 Config by Transaction Type
|
|
340
|
+
*
|
|
341
|
+
* The `originator` and `beneficiary` config options provide the customer's PII data.
|
|
342
|
+
* Which one to use depends on the transaction type:
|
|
343
|
+
*
|
|
344
|
+
* - **Withdrawals**: Pass `originator` - the customer is sending funds (customer = originator)
|
|
345
|
+
* - **Deposits**: Pass `beneficiary` - the customer is receiving funds (customer = beneficiary)
|
|
346
|
+
*
|
|
347
|
+
* For self-transfers, the provided data is automatically reused for both parties.
|
|
348
|
+
*
|
|
334
349
|
* @param response - The response from the Notabene Embedded Component
|
|
335
|
-
* @param delegateToken - The JWT delegate token for extracting the
|
|
350
|
+
* @param delegateToken - The JWT delegate token for extracting the customer ID
|
|
336
351
|
* @param config - Configuration object with optional IDs
|
|
337
|
-
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken
|
|
338
|
-
* @param config.beneficiaryId - Optional beneficiary ID (auto-
|
|
339
|
-
* @param config.
|
|
340
|
-
* @param config.
|
|
352
|
+
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken for withdrawals)
|
|
353
|
+
* @param config.beneficiaryId - Optional beneficiary ID (auto-extracted from delegateToken for deposits)
|
|
354
|
+
* @param config.originator - Customer's IVMS101 data for withdrawals (customer is the sender)
|
|
355
|
+
* @param config.beneficiary - Customer's IVMS101 data for deposits (customer is the receiver)
|
|
341
356
|
* @returns The transformed request body in IVMS101 format
|
|
342
357
|
*
|
|
343
358
|
* @example
|
|
344
359
|
* ```typescript
|
|
345
360
|
* import { componentResponseToIVMS101 } from '$lib/notabene-tx-transformer';
|
|
346
361
|
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
362
|
+
* // For withdrawals: pass originator (customer is sending)
|
|
363
|
+
* const withdrawalIvms = componentResponseToIVMS101(
|
|
364
|
+
* withdrawalResponse,
|
|
365
|
+
* delegateToken,
|
|
366
|
+
* { originator: customerIvmsData }
|
|
351
367
|
* );
|
|
352
368
|
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
369
|
+
* // For deposits: pass beneficiary (customer is receiving)
|
|
370
|
+
* const depositIvms = componentResponseToIVMS101(
|
|
371
|
+
* depositResponse,
|
|
372
|
+
* delegateToken,
|
|
373
|
+
* { beneficiary: customerIvmsData }
|
|
374
|
+
* );
|
|
357
375
|
* ```
|
|
358
376
|
*/
|
|
359
|
-
export declare function componentResponseToIVMS101(response: TransactionResponse<Withdrawal>, delegateToken: string, config?:
|
|
377
|
+
export declare function componentResponseToIVMS101(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToIVMS101RequestConfig): TransactionIVMS101Request;
|
|
360
378
|
|
|
361
379
|
/**
|
|
362
380
|
* Transforms a Notabene component response to a Version 2 transaction create API request body
|
|
@@ -373,9 +391,11 @@ export declare function componentResponseToIVMS101(response: TransactionResponse
|
|
|
373
391
|
* ```typescript
|
|
374
392
|
* import { componentResponseToTxCreateRequest } from '$lib/notabene-tx-transformer';
|
|
375
393
|
*
|
|
376
|
-
* withdrawal
|
|
394
|
+
* // Works with both withdrawal and deposit responses
|
|
395
|
+
* transaction.on('complete', async (result) => {
|
|
377
396
|
* const requestBody = componentResponseToTxCreateRequest(
|
|
378
397
|
* result.response,
|
|
398
|
+
* delegateToken,
|
|
379
399
|
* {
|
|
380
400
|
* originatorId: 'mailto:user@example.com',
|
|
381
401
|
* beneficiaryId: 'urn:beneficiary:recipient',
|
|
@@ -390,7 +410,7 @@ export declare function componentResponseToIVMS101(response: TransactionResponse
|
|
|
390
410
|
* });
|
|
391
411
|
* ```
|
|
392
412
|
*/
|
|
393
|
-
export declare function componentResponseToTxCreateRequest(response: TransactionResponse<Withdrawal>, delegateToken: string, config?:
|
|
413
|
+
export declare function componentResponseToTxCreateRequest(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToTxCreateRequestConfig): TransactionCreateRequestV2;
|
|
394
414
|
|
|
395
415
|
/**
|
|
396
416
|
* Transforms a Notabene component response into txCreate, IVMS101, and confirmRelationship request bodies
|
|
@@ -400,50 +420,50 @@ export declare function componentResponseToTxCreateRequest(response: Transaction
|
|
|
400
420
|
* which is useful for V2 workflows where you need to create a transaction first,
|
|
401
421
|
* then append IVMS101 data to it, and finally confirm the relationship.
|
|
402
422
|
*
|
|
423
|
+
* ## IVMS101 Config by Transaction Type
|
|
424
|
+
*
|
|
425
|
+
* The `originator` and `beneficiary` config options provide the customer's PII data.
|
|
426
|
+
* Which one to use depends on the transaction type:
|
|
427
|
+
*
|
|
428
|
+
* - **Withdrawals**: Pass `originator` - the customer is sending funds (customer = originator)
|
|
429
|
+
* - **Deposits**: Pass `beneficiary` - the customer is receiving funds (customer = beneficiary)
|
|
430
|
+
*
|
|
431
|
+
* For self-transfers, the provided data is automatically reused for both parties.
|
|
432
|
+
*
|
|
403
433
|
* @param response - The response from the Notabene Embedded Component
|
|
404
|
-
* @param delegateToken - The JWT delegate token for extracting the
|
|
434
|
+
* @param delegateToken - The JWT delegate token for extracting the customer ID
|
|
405
435
|
* @param config - Optional configuration for IDs and reference
|
|
406
|
-
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken
|
|
407
|
-
* @param config.beneficiaryId - Optional beneficiary ID (auto-
|
|
436
|
+
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken for withdrawals)
|
|
437
|
+
* @param config.beneficiaryId - Optional beneficiary ID (auto-extracted from delegateToken for deposits)
|
|
408
438
|
* @param config.referenceId - Optional reference ID (auto-generated if not provided)
|
|
409
|
-
* @param config.originator -
|
|
439
|
+
* @param config.originator - Customer's IVMS101 data for withdrawals (customer is the sender)
|
|
440
|
+
* @param config.beneficiary - Customer's IVMS101 data for deposits (customer is the receiver)
|
|
410
441
|
* @returns Object with `createTx`, `ivms101`, and optional `confirmRelationship` properties containing the respective request bodies
|
|
411
442
|
*
|
|
412
443
|
* @example
|
|
413
444
|
* ```typescript
|
|
414
445
|
* import { componentResponseToTxRequests } from '$lib/notabene-tx-transformer';
|
|
415
446
|
*
|
|
447
|
+
* // For withdrawals: pass originator (customer is sending)
|
|
416
448
|
* withdrawal.on('complete', async (result) => {
|
|
417
|
-
* const { createTx, ivms101
|
|
449
|
+
* const { createTx, ivms101 } = componentResponseToTxRequests(
|
|
418
450
|
* result.response,
|
|
419
|
-
*
|
|
420
|
-
* { originator:
|
|
451
|
+
* delegateToken,
|
|
452
|
+
* { originator: customerIvmsData }
|
|
421
453
|
* );
|
|
454
|
+
* });
|
|
422
455
|
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
* const txId = txResponse.transfer['@id'];
|
|
431
|
-
* await fetch(`/entity/${vaspDid}/tx/${txId}/append`, {
|
|
432
|
-
* method: 'POST',
|
|
433
|
-
* body: JSON.stringify(ivms101)
|
|
434
|
-
* });
|
|
435
|
-
*
|
|
436
|
-
* // Finally, confirm relationship
|
|
437
|
-
* if (confirmRelationship) {
|
|
438
|
-
* await fetch(`/entity/${vaspDid}/relationship?to=${to}&from=${from}`, {
|
|
439
|
-
* method: 'PATCH',
|
|
440
|
-
* body: JSON.stringify({ proof: confirmRelationship.proof })
|
|
441
|
-
* });
|
|
442
|
-
* }
|
|
456
|
+
* // For deposits: pass beneficiary (customer is receiving)
|
|
457
|
+
* deposit.on('complete', async (result) => {
|
|
458
|
+
* const { createTx, ivms101 } = componentResponseToTxRequests(
|
|
459
|
+
* result.response,
|
|
460
|
+
* delegateToken,
|
|
461
|
+
* { beneficiary: customerIvmsData }
|
|
462
|
+
* );
|
|
443
463
|
* });
|
|
444
464
|
* ```
|
|
445
465
|
*/
|
|
446
|
-
export declare function componentResponseToTxRequests(response: TransactionResponse<Withdrawal>, delegateToken: string, config?: ResponseToTxRequestConfig): {
|
|
466
|
+
export declare function componentResponseToTxRequests(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToTxRequestConfig): {
|
|
447
467
|
createTx: TransactionCreateRequestV2;
|
|
448
468
|
ivms101: TransactionIVMS101Request;
|
|
449
469
|
confirmRelationship?: {
|
|
@@ -1612,7 +1632,6 @@ export declare enum ProofStatus {
|
|
|
1612
1632
|
* - ED25519: Ed25519 signature (used in Solana)
|
|
1613
1633
|
* - XRP_ED25519: Ed25519 signature (used in XRP)
|
|
1614
1634
|
* - XLM_ED25519: Ed25519 signature (used in Stellar)
|
|
1615
|
-
* - XPUB: Extended public key signature for HD wallets
|
|
1616
1635
|
* - MicroTransfer: Proof via small blockchain transaction
|
|
1617
1636
|
* - Screenshot: Image proof of ownership/access
|
|
1618
1637
|
* - CIP8: Cardano message signing standard (CIP-8)
|
|
@@ -1633,7 +1652,6 @@ export declare enum ProofTypes {
|
|
|
1633
1652
|
EIP1271 = "eip-1271",
|
|
1634
1653
|
BIP137 = "bip-137",
|
|
1635
1654
|
BIP322 = "bip-322",
|
|
1636
|
-
BIP137_XPUB = "xpub",
|
|
1637
1655
|
TIP191 = "tip-191",
|
|
1638
1656
|
ED25519 = "ed25519",
|
|
1639
1657
|
XRP_ED25519 = "xrp-ed25519",
|
|
@@ -1674,13 +1692,18 @@ export declare type ResizeRequest = {
|
|
|
1674
1692
|
height: number;
|
|
1675
1693
|
};
|
|
1676
1694
|
|
|
1677
|
-
|
|
1678
|
-
originatorId?: DID_2;
|
|
1679
|
-
beneficiaryId?: DID_2;
|
|
1680
|
-
referenceId?: string;
|
|
1695
|
+
declare interface ResponseToIVMS101RequestConfig extends BaseRequestConfig {
|
|
1681
1696
|
originator?: OriginatorV2;
|
|
1697
|
+
beneficiary?: BeneficiaryV2;
|
|
1682
1698
|
}
|
|
1683
1699
|
|
|
1700
|
+
declare interface ResponseToTxCreateRequestConfig extends BaseRequestConfig {
|
|
1701
|
+
referenceId?: string;
|
|
1702
|
+
settlementAddress?: string;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
export declare type ResponseToTxRequestConfig = ResponseToTxCreateRequestConfig & ResponseToIVMS101RequestConfig;
|
|
1706
|
+
|
|
1684
1707
|
/**
|
|
1685
1708
|
* Ownership Proof using Screenshot
|
|
1686
1709
|
* @public
|
|
@@ -1708,7 +1731,7 @@ export declare interface ScreenshotProof extends OwnershipProof {
|
|
|
1708
1731
|
* @public
|
|
1709
1732
|
*/
|
|
1710
1733
|
export declare interface SignatureProof extends OwnershipProof {
|
|
1711
|
-
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.
|
|
1734
|
+
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519 | ProofTypes.COSMOS;
|
|
1712
1735
|
proof: string;
|
|
1713
1736
|
attestation: string;
|
|
1714
1737
|
wallet_provider: string;
|
|
@@ -1923,6 +1946,7 @@ export declare interface TransactionOptions {
|
|
|
1923
1946
|
vasps?: VASPOptions;
|
|
1924
1947
|
hide?: ValidationSections[];
|
|
1925
1948
|
counterpartyAssist?: CounterpartyAssistConfig;
|
|
1949
|
+
autoSubmit?: boolean;
|
|
1926
1950
|
}
|
|
1927
1951
|
|
|
1928
1952
|
/**
|