@notabene/javascript-sdk 2.16.0-next.4 → 2.16.0-next.5

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
@@ -806,6 +806,7 @@ const options: TransactionOptions = {
806
806
  },
807
807
  },
808
808
  vasps: {
809
+ // V1 options — `searchable` is mutually exclusive with V2 `showTrustStatus` below
809
810
  addUnknown: true, // Allow users to add a missing VASP - Defaults to false
810
811
  onlyActive: true, // Only list active VASPs - Default false
811
812
  searchable: [
@@ -813,6 +814,13 @@ const options: TransactionOptions = {
813
814
  VASPSearchControl.PENDING, // JS: 'pending'
814
815
  ], // Control searches for VASPs - Defaults to undefined
815
816
  },
817
+ // V2 alternative — filter by trust status instead of `searchable`. `addUnknown`
818
+ // and `onlyActive` remain valid; `searchable` cannot be combined with `showTrustStatus`:
819
+ // vasps: {
820
+ // addUnknown: true,
821
+ // onlyActive: true,
822
+ // showTrustStatus: ['TRUSTED', 'NEW'], // 'TRUSTED' | 'NEW' | 'FLAGGED' | 'BANNED'
823
+ // },
816
824
  counterpartyAssist: { // Allows users to share a link to collect counterparty data
817
825
  counterpartyTypes: [
818
826
  PersonType.LEGAL, // JS: 'legal'
@@ -3516,13 +3516,37 @@ export declare interface VASP extends Agent {
3516
3516
  }
3517
3517
 
3518
3518
  /**
3519
- * Options for which VASPs to be searchable
3519
+ * Options controlling which VASPs are listed and searchable in the picker.
3520
+ *
3521
+ * Two mutually exclusive variants:
3522
+ *
3523
+ * - **V1** — `addUnknown`, `onlyActive`, `searchable` (filters by {@link VASPSearchControl} status).
3524
+ * - **V2** — `addUnknown`, `onlyActive`, `showTrustStatus` (filters by {@link VASPTrustStatus}).
3525
+ *
3526
+ * `searchable` (V1-only) cannot be combined with `showTrustStatus` (V2-only);
3527
+ * TypeScript will reject the mix at compile time. `addUnknown` and `onlyActive` are valid in both variants.
3528
+ *
3529
+ * @example V1
3530
+ * ```ts
3531
+ * { addUnknown: true, onlyActive: true, searchable: [VASPSearchControl.ALLOWED] }
3532
+ * ```
3533
+ *
3534
+ * @example V2
3535
+ * ```ts
3536
+ * { addUnknown: true, onlyActive: true, showTrustStatus: ['TRUSTED', 'NEW'] }
3537
+ * ```
3538
+ *
3520
3539
  * @public
3521
3540
  */
3522
3541
  export declare type VASPOptions = {
3523
3542
  addUnknown?: boolean;
3524
3543
  onlyActive?: boolean;
3525
3544
  searchable?: VASPSearchControl[];
3545
+ } | {
3546
+ searchable?: undefined;
3547
+ addUnknown?: boolean;
3548
+ onlyActive?: boolean;
3549
+ showTrustStatus?: VASPTrustStatus[];
3526
3550
  };
3527
3551
 
3528
3552
  /**
@@ -3538,6 +3562,15 @@ export declare enum VASPSearchControl {
3538
3562
  PENDING = "pending"
3539
3563
  }
3540
3564
 
3565
+ /**
3566
+ * Trust status assigned to a VASP in the Notabene network.
3567
+ *
3568
+ * Used by {@link VASPOptions.showTrustStatus} to filter which VASPs are listed in the picker.
3569
+ *
3570
+ * @public
3571
+ */
3572
+ export declare type VASPTrustStatus = 'TRUSTED' | 'NEW' | 'FLAGGED' | 'BANNED';
3573
+
3541
3574
  /**
3542
3575
  * A wallet agent acting on behalf of the counterparty
3543
3576
  * @public
@@ -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.16.0-next.4",
13
+ "version": "2.16.0-next.5",
14
14
  "source": "src/notabene.ts",
15
15
  "main": "dist/cjs/notabene.cjs",
16
16
  "module": "dist/esm/notabene.js",
@@ -3516,13 +3516,37 @@ export declare interface VASP extends Agent {
3516
3516
  }
3517
3517
 
3518
3518
  /**
3519
- * Options for which VASPs to be searchable
3519
+ * Options controlling which VASPs are listed and searchable in the picker.
3520
+ *
3521
+ * Two mutually exclusive variants:
3522
+ *
3523
+ * - **V1** — `addUnknown`, `onlyActive`, `searchable` (filters by {@link VASPSearchControl} status).
3524
+ * - **V2** — `addUnknown`, `onlyActive`, `showTrustStatus` (filters by {@link VASPTrustStatus}).
3525
+ *
3526
+ * `searchable` (V1-only) cannot be combined with `showTrustStatus` (V2-only);
3527
+ * TypeScript will reject the mix at compile time. `addUnknown` and `onlyActive` are valid in both variants.
3528
+ *
3529
+ * @example V1
3530
+ * ```ts
3531
+ * { addUnknown: true, onlyActive: true, searchable: [VASPSearchControl.ALLOWED] }
3532
+ * ```
3533
+ *
3534
+ * @example V2
3535
+ * ```ts
3536
+ * { addUnknown: true, onlyActive: true, showTrustStatus: ['TRUSTED', 'NEW'] }
3537
+ * ```
3538
+ *
3520
3539
  * @public
3521
3540
  */
3522
3541
  export declare type VASPOptions = {
3523
3542
  addUnknown?: boolean;
3524
3543
  onlyActive?: boolean;
3525
3544
  searchable?: VASPSearchControl[];
3545
+ } | {
3546
+ searchable?: undefined;
3547
+ addUnknown?: boolean;
3548
+ onlyActive?: boolean;
3549
+ showTrustStatus?: VASPTrustStatus[];
3526
3550
  };
3527
3551
 
3528
3552
  /**
@@ -3538,6 +3562,15 @@ export declare enum VASPSearchControl {
3538
3562
  PENDING = "pending"
3539
3563
  }
3540
3564
 
3565
+ /**
3566
+ * Trust status assigned to a VASP in the Notabene network.
3567
+ *
3568
+ * Used by {@link VASPOptions.showTrustStatus} to filter which VASPs are listed in the picker.
3569
+ *
3570
+ * @public
3571
+ */
3572
+ export declare type VASPTrustStatus = 'TRUSTED' | 'NEW' | 'FLAGGED' | 'BANNED';
3573
+
3541
3574
  /**
3542
3575
  * A wallet agent acting on behalf of the counterparty
3543
3576
  * @public
@@ -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.16.0-next.4",
13
+ "version": "2.16.0-next.5",
14
14
  "source": "src/notabene.ts",
15
15
  "main": "dist/cjs/notabene.cjs",
16
16
  "module": "dist/esm/notabene.js",
@@ -3516,13 +3516,37 @@ export declare interface VASP extends Agent {
3516
3516
  }
3517
3517
 
3518
3518
  /**
3519
- * Options for which VASPs to be searchable
3519
+ * Options controlling which VASPs are listed and searchable in the picker.
3520
+ *
3521
+ * Two mutually exclusive variants:
3522
+ *
3523
+ * - **V1** — `addUnknown`, `onlyActive`, `searchable` (filters by {@link VASPSearchControl} status).
3524
+ * - **V2** — `addUnknown`, `onlyActive`, `showTrustStatus` (filters by {@link VASPTrustStatus}).
3525
+ *
3526
+ * `searchable` (V1-only) cannot be combined with `showTrustStatus` (V2-only);
3527
+ * TypeScript will reject the mix at compile time. `addUnknown` and `onlyActive` are valid in both variants.
3528
+ *
3529
+ * @example V1
3530
+ * ```ts
3531
+ * { addUnknown: true, onlyActive: true, searchable: [VASPSearchControl.ALLOWED] }
3532
+ * ```
3533
+ *
3534
+ * @example V2
3535
+ * ```ts
3536
+ * { addUnknown: true, onlyActive: true, showTrustStatus: ['TRUSTED', 'NEW'] }
3537
+ * ```
3538
+ *
3520
3539
  * @public
3521
3540
  */
3522
3541
  export declare type VASPOptions = {
3523
3542
  addUnknown?: boolean;
3524
3543
  onlyActive?: boolean;
3525
3544
  searchable?: VASPSearchControl[];
3545
+ } | {
3546
+ searchable?: undefined;
3547
+ addUnknown?: boolean;
3548
+ onlyActive?: boolean;
3549
+ showTrustStatus?: VASPTrustStatus[];
3526
3550
  };
3527
3551
 
3528
3552
  /**
@@ -3538,6 +3562,15 @@ export declare enum VASPSearchControl {
3538
3562
  PENDING = "pending"
3539
3563
  }
3540
3564
 
3565
+ /**
3566
+ * Trust status assigned to a VASP in the Notabene network.
3567
+ *
3568
+ * Used by {@link VASPOptions.showTrustStatus} to filter which VASPs are listed in the picker.
3569
+ *
3570
+ * @public
3571
+ */
3572
+ export declare type VASPTrustStatus = 'TRUSTED' | 'NEW' | 'FLAGGED' | 'BANNED';
3573
+
3541
3574
  /**
3542
3575
  * A wallet agent acting on behalf of the counterparty
3543
3576
  * @public
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.16.0-next.4",
13
+ "version": "2.16.0-next.5",
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
@@ -63,6 +63,7 @@ import type {
63
63
  ValidationError,
64
64
  VASP,
65
65
  VASPOptions,
66
+ VASPTrustStatus,
66
67
  Wallet,
67
68
  Withdrawal,
68
69
  } from './types';
@@ -189,6 +190,7 @@ export type {
189
190
  ValidationError,
190
191
  VASP,
191
192
  VASPOptions,
193
+ VASPTrustStatus,
192
194
  Wallet,
193
195
  Withdrawal,
194
196
  };
package/src/types.ts CHANGED
@@ -789,14 +789,53 @@ export enum VASPSearchControl {
789
789
  }
790
790
 
791
791
  /**
792
- * Options for which VASPs to be searchable
792
+ * Trust status assigned to a VASP in the Notabene network.
793
+ *
794
+ * Used by {@link VASPOptions.showTrustStatus} to filter which VASPs are listed in the picker.
795
+ *
793
796
  * @public
794
797
  */
795
- export type VASPOptions = {
796
- addUnknown?: boolean;
797
- onlyActive?: boolean;
798
- searchable?: VASPSearchControl[]; // If array left empty all VASPs will be searchable
799
- };
798
+ export type VASPTrustStatus = 'TRUSTED' | 'NEW' | 'FLAGGED' | 'BANNED';
799
+
800
+ /**
801
+ * Options controlling which VASPs are listed and searchable in the picker.
802
+ *
803
+ * Two mutually exclusive variants:
804
+ *
805
+ * - **V1** — `addUnknown`, `onlyActive`, `searchable` (filters by {@link VASPSearchControl} status).
806
+ * - **V2** — `addUnknown`, `onlyActive`, `showTrustStatus` (filters by {@link VASPTrustStatus}).
807
+ *
808
+ * `searchable` (V1-only) cannot be combined with `showTrustStatus` (V2-only);
809
+ * TypeScript will reject the mix at compile time. `addUnknown` and `onlyActive` are valid in both variants.
810
+ *
811
+ * @example V1
812
+ * ```ts
813
+ * { addUnknown: true, onlyActive: true, searchable: [VASPSearchControl.ALLOWED] }
814
+ * ```
815
+ *
816
+ * @example V2
817
+ * ```ts
818
+ * { addUnknown: true, onlyActive: true, showTrustStatus: ['TRUSTED', 'NEW'] }
819
+ * ```
820
+ *
821
+ * @public
822
+ */
823
+ export type VASPOptions =
824
+ // V1 vasps options
825
+ | {
826
+ addUnknown?: boolean;
827
+ onlyActive?: boolean;
828
+ searchable?: VASPSearchControl[]; // If array left empty all VASPs will be searchable
829
+ }
830
+ // V2 vasps options
831
+ | {
832
+ // Typing `searchable` as `undefined` (rather than omitting it) makes TS reject
833
+ // mixing V1 and V2 options, e.g. { searchable: [...], showTrustStatus: [...] }.
834
+ searchable?: undefined;
835
+ addUnknown?: boolean;
836
+ onlyActive?: boolean;
837
+ showTrustStatus?: VASPTrustStatus[];
838
+ };
800
839
 
801
840
  /**
802
841
  * Available methods for identity verification
@@ -24,6 +24,7 @@ import type {
24
24
  TransactionOptions,
25
25
  TravelAddress,
26
26
  VASPOptions,
27
+ VASPTrustStatus,
27
28
  Withdrawal,
28
29
  } from '../types';
29
30
  import {
@@ -31,6 +32,7 @@ import {
31
32
  PersonType,
32
33
  ProofTypes,
33
34
  ValidationSections,
35
+ VASPSearchControl,
34
36
  } from '../types';
35
37
  import {
36
38
  CAIP10_MATCHER,
@@ -194,10 +196,33 @@ export const arbitraryFieldTypes = (): fc.Arbitrary<FieldTypes> =>
194
196
  });
195
197
 
196
198
  export const arbitraryVASPOptions = (): fc.Arbitrary<VASPOptions> =>
197
- fc.record({
198
- addUnknown: fc.option(fc.boolean()),
199
- onlyActive: fc.option(fc.boolean()),
200
- });
199
+ fc.oneof(
200
+ fc.record({
201
+ addUnknown: fc.option(fc.boolean(), { nil: undefined }),
202
+ onlyActive: fc.option(fc.boolean(), { nil: undefined }),
203
+ searchable: fc.option(
204
+ fc.array(
205
+ fc.constantFrom(VASPSearchControl.ALLOWED, VASPSearchControl.PENDING),
206
+ ),
207
+ { nil: undefined },
208
+ ),
209
+ }),
210
+ fc.record({
211
+ addUnknown: fc.option(fc.boolean(), { nil: undefined }),
212
+ onlyActive: fc.option(fc.boolean(), { nil: undefined }),
213
+ showTrustStatus: fc.option(
214
+ fc.array(
215
+ fc.constantFrom<VASPTrustStatus>(
216
+ 'TRUSTED',
217
+ 'NEW',
218
+ 'FLAGGED',
219
+ 'BANNED',
220
+ ),
221
+ ),
222
+ { nil: undefined },
223
+ ),
224
+ }),
225
+ );
201
226
 
202
227
  export const arbitraryTransactionOptions =
203
228
  (): fc.Arbitrary<TransactionOptions> =>