@notabene/javascript-sdk 2.21.0 → 2.22.0-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 CHANGED
@@ -377,15 +377,19 @@ The Connect Wallet component helps you collect and verify the address of your us
377
377
  ### Parameters
378
378
 
379
379
  - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
380
+ - `address`: Optional account to collect a proof for, as a blockchain address or CAIP-10 identifier. When set, the component narrows the connected wallet to this account and only offers to verify that one; connecting fails if the wallet does not hold it. When omitted, the user chooses which of their addresses to prove.
380
381
 
381
382
  ```js
382
383
  const connect = notabene.createConnectWallet({
383
384
  asset: 'ETH',
385
+ address: '0x...',
384
386
  });
385
387
 
386
388
  const { proof, txCreate } = await connect.openModal();
387
389
  ```
388
390
 
391
+ The proved account is returned on `proof.address` as a CAIP-10 identifier.
392
+
389
393
  ## Deposit Request
390
394
 
391
395
  The Deposit Request lets your customers request deposits that are fully Travel Rule compliant.
@@ -894,7 +898,7 @@ const options: TransactionOptions = {
894
898
  contactSupport: { // Configures the contact support button (enabled via agentSections)
895
899
  supportUrl: 'https://support.example.com',
896
900
  },
897
- hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
901
+ hide: ['asset', 'destination'], // Don't show specific sections of component. Also accepts 'header' to drop the card header (icon, title, description, participant logo)
898
902
  autoSubmit: false // Automatically sends the complete event and hides the complete button - Default false
899
903
  };
900
904
 
@@ -710,6 +710,20 @@ export declare type ConnectionOptions = Omit<TransactionOptions, 'allowedAgentTy
710
710
  */
711
711
  export declare interface ConnectionRequest extends ComponentRequest {
712
712
  asset: TransactionAsset;
713
+ /**
714
+ * The account to collect a proof for.
715
+ *
716
+ * @remarks
717
+ * When set, the component narrows the connected wallet to this account and
718
+ * only offers to verify that one, instead of letting the user pick any
719
+ * address the wallet reports. Connecting fails if the wallet does not hold
720
+ * it. When omitted, the user chooses which of their addresses to prove.
721
+ *
722
+ * A bare blockchain address is resolved against the chain of {@link ConnectionRequest.asset}.
723
+ *
724
+ * @see {@link OwnershipProof.address} For the proved account on the response
725
+ */
726
+ address?: BlockchainAddress | CAIP10;
713
727
  }
714
728
 
715
729
  export declare interface ConnectionResponse<T extends ComponentRequest> {
@@ -1149,6 +1163,18 @@ export declare type FieldTypes = {
1149
1163
  */
1150
1164
  export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: Pick<RefreshSource, 'url' | 'key'>): Promise<ConnectionResult<T>>;
1151
1165
 
1166
+ /**
1167
+ * A section of a WithdrawalAssist or DepositAssist screen that can be left out,
1168
+ * via {@link TransactionOptions.hide}.
1169
+ *
1170
+ * `'header'` is the card header — its status icon, title, description and
1171
+ * participant logo. The card body and footer are unaffected, so the Notabene
1172
+ * attribution in the footer still shows.
1173
+ *
1174
+ * @public
1175
+ */
1176
+ export declare type HideSection = 'asset' | 'destination' | 'counterparty' | 'agent' | 'header';
1177
+
1152
1178
  /**
1153
1179
  * Host Message Type enum representing different message types that can be sent
1154
1180
  * from the host application.
@@ -3342,7 +3368,12 @@ export declare interface TransactionOptions {
3342
3368
  allowedCounterpartyTypes?: PersonType[];
3343
3369
  fields?: FieldTypes;
3344
3370
  vasps?: VASPOptions;
3345
- hide?: ValidationSections[];
3371
+ /**
3372
+ * Sections of the component to leave out. Hiding `'header'` is useful when the
3373
+ * surrounding page already states what the user is being asked to do, so ours
3374
+ * would repeat or contradict it.
3375
+ */
3376
+ hide?: HideSection[];
3346
3377
  counterpartyAssist?: CounterpartyAssistConfig;
3347
3378
  contactSupport?: ContactSupportConfig;
3348
3379
  consent?: ConsentConfig;
@@ -3598,6 +3629,9 @@ export declare type ValidationError = {
3598
3629
  /**
3599
3630
  * Sections in a WithdrawalAssist screen
3600
3631
  *
3632
+ * @deprecated Use {@link HideSection} instead. Members stay assignable to their
3633
+ * literals, so existing callers keep compiling.
3634
+ *
3601
3635
  * @alpha
3602
3636
  */
3603
3637
  export declare enum ValidationSections {
@@ -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.21.0",
13
+ "version": "2.22.0-next.2",
14
14
  "source": "src/notabene.ts",
15
15
  "main": "dist/cjs/notabene.cjs",
16
16
  "module": "dist/esm/notabene.js",
@@ -710,6 +710,20 @@ export declare type ConnectionOptions = Omit<TransactionOptions, 'allowedAgentTy
710
710
  */
711
711
  export declare interface ConnectionRequest extends ComponentRequest {
712
712
  asset: TransactionAsset;
713
+ /**
714
+ * The account to collect a proof for.
715
+ *
716
+ * @remarks
717
+ * When set, the component narrows the connected wallet to this account and
718
+ * only offers to verify that one, instead of letting the user pick any
719
+ * address the wallet reports. Connecting fails if the wallet does not hold
720
+ * it. When omitted, the user chooses which of their addresses to prove.
721
+ *
722
+ * A bare blockchain address is resolved against the chain of {@link ConnectionRequest.asset}.
723
+ *
724
+ * @see {@link OwnershipProof.address} For the proved account on the response
725
+ */
726
+ address?: BlockchainAddress | CAIP10;
713
727
  }
714
728
 
715
729
  export declare interface ConnectionResponse<T extends ComponentRequest> {
@@ -1149,6 +1163,18 @@ export declare type FieldTypes = {
1149
1163
  */
1150
1164
  export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: Pick<RefreshSource, 'url' | 'key'>): Promise<ConnectionResult<T>>;
1151
1165
 
1166
+ /**
1167
+ * A section of a WithdrawalAssist or DepositAssist screen that can be left out,
1168
+ * via {@link TransactionOptions.hide}.
1169
+ *
1170
+ * `'header'` is the card header — its status icon, title, description and
1171
+ * participant logo. The card body and footer are unaffected, so the Notabene
1172
+ * attribution in the footer still shows.
1173
+ *
1174
+ * @public
1175
+ */
1176
+ export declare type HideSection = 'asset' | 'destination' | 'counterparty' | 'agent' | 'header';
1177
+
1152
1178
  /**
1153
1179
  * Host Message Type enum representing different message types that can be sent
1154
1180
  * from the host application.
@@ -3342,7 +3368,12 @@ export declare interface TransactionOptions {
3342
3368
  allowedCounterpartyTypes?: PersonType[];
3343
3369
  fields?: FieldTypes;
3344
3370
  vasps?: VASPOptions;
3345
- hide?: ValidationSections[];
3371
+ /**
3372
+ * Sections of the component to leave out. Hiding `'header'` is useful when the
3373
+ * surrounding page already states what the user is being asked to do, so ours
3374
+ * would repeat or contradict it.
3375
+ */
3376
+ hide?: HideSection[];
3346
3377
  counterpartyAssist?: CounterpartyAssistConfig;
3347
3378
  contactSupport?: ContactSupportConfig;
3348
3379
  consent?: ConsentConfig;
@@ -3598,6 +3629,9 @@ export declare type ValidationError = {
3598
3629
  /**
3599
3630
  * Sections in a WithdrawalAssist screen
3600
3631
  *
3632
+ * @deprecated Use {@link HideSection} instead. Members stay assignable to their
3633
+ * literals, so existing callers keep compiling.
3634
+ *
3601
3635
  * @alpha
3602
3636
  */
3603
3637
  export declare enum ValidationSections {
@@ -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.21.0",
13
+ "version": "2.22.0-next.2",
14
14
  "source": "src/notabene.ts",
15
15
  "main": "dist/cjs/notabene.cjs",
16
16
  "module": "dist/esm/notabene.js",
@@ -710,6 +710,20 @@ export declare type ConnectionOptions = Omit<TransactionOptions, 'allowedAgentTy
710
710
  */
711
711
  export declare interface ConnectionRequest extends ComponentRequest {
712
712
  asset: TransactionAsset;
713
+ /**
714
+ * The account to collect a proof for.
715
+ *
716
+ * @remarks
717
+ * When set, the component narrows the connected wallet to this account and
718
+ * only offers to verify that one, instead of letting the user pick any
719
+ * address the wallet reports. Connecting fails if the wallet does not hold
720
+ * it. When omitted, the user chooses which of their addresses to prove.
721
+ *
722
+ * A bare blockchain address is resolved against the chain of {@link ConnectionRequest.asset}.
723
+ *
724
+ * @see {@link OwnershipProof.address} For the proved account on the response
725
+ */
726
+ address?: BlockchainAddress | CAIP10;
713
727
  }
714
728
 
715
729
  export declare interface ConnectionResponse<T extends ComponentRequest> {
@@ -1149,6 +1163,18 @@ export declare type FieldTypes = {
1149
1163
  */
1150
1164
  export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: Pick<RefreshSource, 'url' | 'key'>): Promise<ConnectionResult<T>>;
1151
1165
 
1166
+ /**
1167
+ * A section of a WithdrawalAssist or DepositAssist screen that can be left out,
1168
+ * via {@link TransactionOptions.hide}.
1169
+ *
1170
+ * `'header'` is the card header — its status icon, title, description and
1171
+ * participant logo. The card body and footer are unaffected, so the Notabene
1172
+ * attribution in the footer still shows.
1173
+ *
1174
+ * @public
1175
+ */
1176
+ export declare type HideSection = 'asset' | 'destination' | 'counterparty' | 'agent' | 'header';
1177
+
1152
1178
  /**
1153
1179
  * Host Message Type enum representing different message types that can be sent
1154
1180
  * from the host application.
@@ -3342,7 +3368,12 @@ export declare interface TransactionOptions {
3342
3368
  allowedCounterpartyTypes?: PersonType[];
3343
3369
  fields?: FieldTypes;
3344
3370
  vasps?: VASPOptions;
3345
- hide?: ValidationSections[];
3371
+ /**
3372
+ * Sections of the component to leave out. Hiding `'header'` is useful when the
3373
+ * surrounding page already states what the user is being asked to do, so ours
3374
+ * would repeat or contradict it.
3375
+ */
3376
+ hide?: HideSection[];
3346
3377
  counterpartyAssist?: CounterpartyAssistConfig;
3347
3378
  contactSupport?: ContactSupportConfig;
3348
3379
  consent?: ConsentConfig;
@@ -3598,6 +3629,9 @@ export declare type ValidationError = {
3598
3629
  /**
3599
3630
  * Sections in a WithdrawalAssist screen
3600
3631
  *
3632
+ * @deprecated Use {@link HideSection} instead. Members stay assignable to their
3633
+ * literals, so existing callers keep compiling.
3634
+ *
3601
3635
  * @alpha
3602
3636
  */
3603
3637
  export declare enum ValidationSections {
package/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.21.0",
13
+ "version": "2.22.0-next.2",
14
14
  "source": "src/notabene.ts",
15
15
  "main": "dist/cjs/notabene.cjs",
16
16
  "module": "dist/esm/notabene.js",
package/src/notabene.ts CHANGED
@@ -30,6 +30,7 @@ import type {
30
30
  Error,
31
31
  FieldOptions,
32
32
  FieldTypes,
33
+ HideSection,
33
34
  HostMessage,
34
35
  InvalidValue,
35
36
  InvoiceReaderResponse,
@@ -159,6 +160,7 @@ export type {
159
160
  Error,
160
161
  FieldOptions,
161
162
  FieldTypes,
163
+ HideSection,
162
164
  HostMessage,
163
165
  InvalidValue,
164
166
  InvoiceReaderResponse,
package/src/types.ts CHANGED
@@ -641,6 +641,20 @@ export interface InvoiceReaderResponse {
641
641
  */
642
642
  export interface ConnectionRequest extends ComponentRequest {
643
643
  asset: TransactionAsset;
644
+ /**
645
+ * The account to collect a proof for.
646
+ *
647
+ * @remarks
648
+ * When set, the component narrows the connected wallet to this account and
649
+ * only offers to verify that one, instead of letting the user pick any
650
+ * address the wallet reports. Connecting fails if the wallet does not hold
651
+ * it. When omitted, the user chooses which of their addresses to prove.
652
+ *
653
+ * A bare blockchain address is resolved against the chain of {@link ConnectionRequest.asset}.
654
+ *
655
+ * @see {@link OwnershipProof.address} For the proved account on the response
656
+ */
657
+ address?: BlockchainAddress | CAIP10;
644
658
  }
645
659
 
646
660
  /**
@@ -900,9 +914,29 @@ export type CounterpartyAssistConfig =
900
914
  webhookUrl?: string;
901
915
  };
902
916
 
917
+ /**
918
+ * A section of a WithdrawalAssist or DepositAssist screen that can be left out,
919
+ * via {@link TransactionOptions.hide}.
920
+ *
921
+ * `'header'` is the card header — its status icon, title, description and
922
+ * participant logo. The card body and footer are unaffected, so the Notabene
923
+ * attribution in the footer still shows.
924
+ *
925
+ * @public
926
+ */
927
+ export type HideSection =
928
+ | 'asset'
929
+ | 'destination'
930
+ | 'counterparty'
931
+ | 'agent'
932
+ | 'header';
933
+
903
934
  /**
904
935
  * Sections in a WithdrawalAssist screen
905
936
  *
937
+ * @deprecated Use {@link HideSection} instead. Members stay assignable to their
938
+ * literals, so existing callers keep compiling.
939
+ *
906
940
  * @alpha
907
941
  */
908
942
  export enum ValidationSections {
@@ -1039,7 +1073,12 @@ export interface TransactionOptions {
1039
1073
  allowedCounterpartyTypes?: PersonType[]; // Defaults to All
1040
1074
  fields?: FieldTypes;
1041
1075
  vasps?: VASPOptions;
1042
- hide?: ValidationSections[]; // You can hide a specific section of the component by listing it here
1076
+ /**
1077
+ * Sections of the component to leave out. Hiding `'header'` is useful when the
1078
+ * surrounding page already states what the user is being asked to do, so ours
1079
+ * would repeat or contradict it.
1080
+ */
1081
+ hide?: HideSection[];
1043
1082
  counterpartyAssist?: CounterpartyAssistConfig;
1044
1083
  contactSupport?: ContactSupportConfig; // Requires 'contact-support' in agentSections
1045
1084
  consent?: ConsentConfig; // Defaults to true
@@ -18,6 +18,7 @@ import type {
18
18
  DepositRequestOptions,
19
19
  DID,
20
20
  FieldTypes,
21
+ HideSection,
21
22
  ISOCurrency,
22
23
  ISODate,
23
24
  NaturalPerson,
@@ -30,13 +31,7 @@ import type {
30
31
  VASPTrustStatus,
31
32
  Withdrawal,
32
33
  } from '../types';
33
- import {
34
- AgentType,
35
- PersonType,
36
- ProofTypes,
37
- ValidationSections,
38
- VASPSearchControl,
39
- } from '../types';
34
+ import { AgentType, PersonType, ProofTypes, VASPSearchControl } from '../types';
40
35
  import {
41
36
  CAIP10_MATCHER,
42
37
  CAIP19_MATCHER,
@@ -125,6 +120,9 @@ export const arbitraryConnectionRequest = (): fc.Arbitrary<ConnectionRequest> =>
125
120
  asset: arbitraryTransactionAsset(),
126
121
  requestId: fc.option(fc.uuid()),
127
122
  customer: fc.option(arbitraryCounterparty()),
123
+ address: fc.option(
124
+ fc.oneof(arbitraryBlockchainAddress(), arbitraryCAIP10()),
125
+ ),
128
126
  });
129
127
 
130
128
  // Helper for ISO date format
@@ -292,7 +290,15 @@ export const arbitraryTransactionOptions =
292
290
  fields: fc.option(arbitraryFieldTypes()),
293
291
  vasps: fc.option(arbitraryVASPOptions()),
294
292
  hide: fc.option(
295
- fc.array(fc.constantFrom(...Object.values(ValidationSections))),
293
+ fc.array(
294
+ fc.constantFrom<HideSection>(
295
+ 'asset',
296
+ 'destination',
297
+ 'counterparty',
298
+ 'agent',
299
+ 'header',
300
+ ),
301
+ ),
296
302
  ),
297
303
  contactSupport: fc.option(arbitraryContactSupportConfig()),
298
304
  });