@v3finance/core-sdk 0.7.0 → 0.8.0

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.
@@ -1,6 +1,6 @@
1
1
  import { type HttpClient } from '../core/http.js';
2
2
  import { type Gated } from '../core/gated.js';
3
- import type { AmlCheck, AmlOfficers, AmlRecheckBody, AmlSettings, AmlVisibilityGrant, AmlVisibilityGrants, ApprovalRequestCreated, CreateAmlVisibilityGrantBody, UpdateAmlSettingsBody } from '../generated/types.js';
3
+ import type { AddAmlStopListBody, AmlDepositReview, AmlRule, AmlRuleEvaluateBody, AmlRuleEvaluation, AmlRules, AmlStopList, AmlStopListEntry, CreateAmlRuleBody, PatchAmlRuleBody, AmlCheck, AmlOfficers, AmlRecheckBody, AmlSettings, AmlVisibilityGrant, AmlVisibilityGrants, ApprovalRequestCreated, CreateAmlVisibilityGrantBody, UpdateAmlSettingsBody } from '../generated/types.js';
4
4
  /**
5
5
  * AML checks of a vault, in the typed model (AML v2).
6
6
  *
@@ -103,5 +103,46 @@ export declare class AmlResource {
103
103
  * carries the check; `'pending'` — the request awaiting approval.
104
104
  */
105
105
  checkInternal(addressId: string): Promise<Gated<AmlCheck, ApprovalRequestCreated>>;
106
+ /**
107
+ * The vault's AML rules. A rule applies to the WHOLE vault, admins
108
+ * included, after the policies: it only ADDS — a block (`AML_BLOCKED`) or
109
+ * an AML officer's approval. It never allows what policies denied and never
110
+ * drops their approvals. Unknown risk leads to an officer, never to a
111
+ * block or a pass. Admins and officers only.
112
+ */
113
+ rules(): Promise<AmlRules>;
114
+ /**
115
+ * Creates a rule. `scope` — which transfers (transfer selectors plus
116
+ * `destinationPattern`, the derivation path of OUR recipient address);
117
+ * `risk` — on what risk (`null` — always); `subject: 'provenance'` judges
118
+ * where the sender's funds came from instead of the recipient. A condition
119
+ * the provider cannot serve is a 400 `AML_PROVIDER_CAPABILITY`.
120
+ */
121
+ createRule(input: CreateAmlRuleBody): Promise<AmlRule>;
122
+ getRule(ruleId: string): Promise<AmlRule>;
123
+ /** Absent fields stay; the RESULTING rule is validated. Every change is a new `version`. */
124
+ updateRule(ruleId: string, patch: PatchAmlRuleBody): Promise<AmlRule>;
125
+ /**
126
+ * Dry run of the AML rules only (not the caller's policies) for a transfer
127
+ * from `fromAddressId` to `address`. `ruleIds` runs exactly those rules,
128
+ * DISABLED ones included — to see a rule before switching it on. `amount`
129
+ * is a decimal string, as in `transfers.create`.
130
+ */
131
+ evaluateRules(input: AmlRuleEvaluateBody): Promise<AmlRuleEvaluation>;
132
+ /** Addresses the vault considers unacceptable. Acts only through a rule with a `stopList` leaf. */
133
+ stopList(params?: {
134
+ includeRevoked?: boolean | undefined;
135
+ }): Promise<AmlStopList>;
136
+ /** Idempotent: the same address again updates the reason or brings it back. EVM — stored lowercase. */
137
+ addToStopList(input: AddAmlStopListBody): Promise<AmlStopListEntry>;
138
+ /** Soft; repeating it is not an error. */
139
+ removeFromStopList(entryId: string): Promise<AmlStopListEntry>;
140
+ /**
141
+ * An AML officer marks a past deposit as reviewed: it stops being a source
142
+ * of risk for provenance rules (they have no time window). AML officers
143
+ * only, and only from the PHONE — web sessions get 403
144
+ * `WEB_SESSION_CANNOT_SIGN`. One mark per deposit; a repeat returns it.
145
+ */
146
+ markDepositReviewed(depositId: string, comment: string): Promise<AmlDepositReview>;
106
147
  }
107
148
  //# sourceMappingURL=aml.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aml.d.ts","sourceRoot":"","sources":["../../../src/resources/aml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAW,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAAK,EACV,QAAQ,EACR,WAAW,EACX,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,EACtB,MAAM,uBAAuB,CAAA;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E,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAEpF;IAED,uGAAuG;IACvG,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAElE;IAED,0CAA0C;IAC1C,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAE7D;IAED;;;;;OAKG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAIjF;CAEF"}
@@ -133,5 +133,66 @@ export class AmlResource {
133
133
  });
134
134
  return toGated(res.status, res.data);
135
135
  }
136
+ // ---------- AML rules (A3) ----------
137
+ /**
138
+ * The vault's AML rules. A rule applies to the WHOLE vault, admins
139
+ * included, after the policies: it only ADDS — a block (`AML_BLOCKED`) or
140
+ * an AML officer's approval. It never allows what policies denied and never
141
+ * drops their approvals. Unknown risk leads to an officer, never to a
142
+ * block or a pass. Admins and officers only.
143
+ */
144
+ rules() {
145
+ return this.#http.request('GET', `${this.#base}/rules`);
146
+ }
147
+ /**
148
+ * Creates a rule. `scope` — which transfers (transfer selectors plus
149
+ * `destinationPattern`, the derivation path of OUR recipient address);
150
+ * `risk` — on what risk (`null` — always); `subject: 'provenance'` judges
151
+ * where the sender's funds came from instead of the recipient. A condition
152
+ * the provider cannot serve is a 400 `AML_PROVIDER_CAPABILITY`.
153
+ */
154
+ createRule(input) {
155
+ return this.#http.request('POST', `${this.#base}/rules`, { body: input });
156
+ }
157
+ getRule(ruleId) {
158
+ return this.#http.request('GET', `${this.#base}/rules/${seg(ruleId)}`);
159
+ }
160
+ /** Absent fields stay; the RESULTING rule is validated. Every change is a new `version`. */
161
+ updateRule(ruleId, patch) {
162
+ return this.#http.request('PATCH', `${this.#base}/rules/${seg(ruleId)}`, { body: patch });
163
+ }
164
+ /**
165
+ * Dry run of the AML rules only (not the caller's policies) for a transfer
166
+ * from `fromAddressId` to `address`. `ruleIds` runs exactly those rules,
167
+ * DISABLED ones included — to see a rule before switching it on. `amount`
168
+ * is a decimal string, as in `transfers.create`.
169
+ */
170
+ evaluateRules(input) {
171
+ return this.#http.request('POST', `${this.#base}/rules/evaluate`, { body: input });
172
+ }
173
+ // ---------- Stop list (A3) ----------
174
+ /** Addresses the vault considers unacceptable. Acts only through a rule with a `stopList` leaf. */
175
+ stopList(params = {}) {
176
+ return this.#http.request('GET', `${this.#base}/stop-list`, { query: { ...params } });
177
+ }
178
+ /** Idempotent: the same address again updates the reason or brings it back. EVM — stored lowercase. */
179
+ addToStopList(input) {
180
+ return this.#http.request('POST', `${this.#base}/stop-list`, { body: input });
181
+ }
182
+ /** Soft; repeating it is not an error. */
183
+ removeFromStopList(entryId) {
184
+ return this.#http.request('DELETE', `${this.#base}/stop-list/${seg(entryId)}`);
185
+ }
186
+ /**
187
+ * An AML officer marks a past deposit as reviewed: it stops being a source
188
+ * of risk for provenance rules (they have no time window). AML officers
189
+ * only, and only from the PHONE — web sessions get 403
190
+ * `WEB_SESSION_CANNOT_SIGN`. One mark per deposit; a repeat returns it.
191
+ */
192
+ markDepositReviewed(depositId, comment) {
193
+ return this.#http.request('POST', `${this.#base}/deposits/${seg(depositId)}/reviewed`, {
194
+ body: { comment },
195
+ });
196
+ }
136
197
  }
137
198
  //# sourceMappingURL=aml.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"aml.js","sourceRoot":"","sources":["../../../src/resources/aml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAc,MAAM,kBAAkB,CAAA;AAatD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,WAAW;IACb,KAAK,CAAY;IACjB,KAAK,CAAQ;IAEtB,YAAY,IAAgB,EAAE,SAAiB;QAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,CA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AEvC,mGAAmG;IACnG,QAAQ,CAAC,MAAM,GAA6C,EAAE;QAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAc,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAA;IACpG,CAAC;IAED,uGAAuG;IACvG,aAAa,CAAC,KAAyB;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAmB,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IACjG,CAAC;IAED,0CAA0C;IAC1C,kBAAkB,CAAC,OAAe;QAChC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAmB,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,cAAc,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAClG,CAAC;IAED;;;;;OAKG;IACH,mBAAmB,CAAC,SAAiB,EAAE,OAAe;QACpD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAmB,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,aAAa,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE;YACvG,IAAI,EAAE,EAAE,OAAO,EAAE;SAClB,CAAC,CAAA;IACJ,CAAC;CAEF"}
@@ -1,5 +1,5 @@
1
1
  /** SDK version, sent in the `user-agent` header. */
2
- export declare const SDK_VERSION = "0.7.0";
2
+ export declare const SDK_VERSION = "0.8.0";
3
3
  /** Default API base URL. */
4
4
  export declare const DEFAULT_BASE_URL = "https://policy-engine-rest.ezig.workers.dev";
5
5
  //# sourceMappingURL=version.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /** SDK version, sent in the `user-agent` header. */
2
- export const SDK_VERSION = '0.7.0';
2
+ export const SDK_VERSION = '0.8.0';
3
3
  /** Default API base URL. */
4
4
  export const DEFAULT_BASE_URL = 'https://policy-engine-rest.ezig.workers.dev';
5
5
  //# sourceMappingURL=version.js.map
package/docs/errors.md CHANGED
@@ -484,6 +484,15 @@ The public invitation lookup (`GET /invitations/by-token/{token}`) signals a dea
484
484
  | `AML_DEFAULT_PROVIDER_REQUIRED` | 400 | `aml.updateSettings()` would leave the vault without exactly one enabled default provider. | Its check is recorded on every operation, so there must be one: keep a default enabled, or switch `isDefault` to another enabled provider in the same call. |
485
485
  | `AML_MAX_AGE_OUT_OF_RANGE` | 400 | `maxAgeSeconds` is not an integer from 0 to 30 days. | 0 means every check calls the (paid) provider. |
486
486
  | `GRANT_NOT_FOUND` | 404 | `aml.revokeVisibility(id)` for a grant that is not in this vault. | Refresh the list from `aml.visibilityGrants()`. |
487
+ | `AML_BLOCKED` | 403 | Creating a transfer: an AML rule of the vault blocks it (the recipient's risk). `message` says which rule and why. | Not a policy setting — the vault's AML officer decides. Do not retry. |
488
+ | `AML_NO_ELIGIBLE_OFFICER` | 409 | Creating a transfer: an AML rule needs an officer's approval and nobody can give it (no officers, or the only one is the initiator). | Ask an admin to appoint another AML officer. |
489
+ | `AML_RULE_INVALID` | 400 | `aml.createRule` / `updateRule`: the rule's shape is wrong (code, scope, risk, appliesTo, subject, provenance). | Fix the field named in `message`. |
490
+ | `AML_PROVIDER_CAPABILITY` | 400 | The rule needs data the provider does not report (shares of funds, the address's own entity, sanction authorities). | Offer only conditions listed in `registries.amlProviders()` → `capabilities`. |
491
+ | `AML_NO_OFFICERS` | 400 | Enabling a rule that can require an officer's approval (outcome `officer`, any risk condition, or `subject: provenance`) in a vault without AML officers. | Appoint an officer first, or save the rule disabled. |
492
+ | `AML_RULE_CODE_TAKEN` | 409 | `aml.createRule` with a code that exists in this vault. | Codes are unique per vault and immutable. |
493
+ | `AML_RULE_NOT_FOUND` | 404 | `aml.getRule` / `updateRule` for an id not in this vault. | — |
494
+ | `STOP_LIST_ENTRY_NOT_FOUND` | 404 | `aml.removeFromStopList` for an entry not in this vault. | Refresh from `aml.stopList()`. |
495
+ | `DEPOSIT_NOT_FOUND` | 404 | `aml.markDepositReviewed` for a deposit that is not a posted deposit of this vault. | — |
487
496
 
488
497
  Two rules the API enforces and your interface has to mirror:
489
498
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v3finance/core-sdk",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "The official TypeScript SDK for the V3 Finance Core API — custodial addresses, transfers under policy control, approvals, shared access, labelling and reports",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -8,8 +8,8 @@
8
8
  // resource method calls an operation that exists, and that a new endpoint in
9
9
  // the API does not slip in unclassified.
10
10
  //
11
- // Operations: 216 · admin: 45 · both: 1 · member: 167 · service: 3
12
- // Spec sha256: 51de70cf70e9653ef56004c8f349e82933b0ca999e8a2092a7e4a18cb053f287
11
+ // Operations: 225 · admin: 45 · both: 1 · member: 176 · service: 3
12
+ // Spec sha256: 2ca6199aca901659f35a0674b2847f6513d88294ab036cf543b6fe9c4fa2d403
13
13
 
14
14
  export type Audience = 'member' | 'admin' | 'service' | 'both' | 'unknown'
15
15
 
@@ -96,6 +96,14 @@ export const OPERATIONS = {
96
96
  "summary": "Отозвать доступ (soft)",
97
97
  "audience": "member"
98
98
  },
99
+ "DELETE /api/v1/vaults/{code}/aml/stop-list/{entryId}": {
100
+ "method": "delete",
101
+ "path": "/api/v1/vaults/{code}/aml/stop-list/{entryId}",
102
+ "operationId": "deleteApiV1VaultsByCodeAmlStopListByEntryId",
103
+ "tag": "AML",
104
+ "summary": "Убрать адрес из стоп-листа",
105
+ "audience": "member"
106
+ },
99
107
  "DELETE /api/v1/vaults/{code}/aml/visibility-grants/{grantId}": {
100
108
  "method": "delete",
101
109
  "path": "/api/v1/vaults/{code}/aml/visibility-grants/{grantId}",
@@ -576,6 +584,22 @@ export const OPERATIONS = {
576
584
  "summary": "AML-офицеры",
577
585
  "audience": "member"
578
586
  },
587
+ "GET /api/v1/vaults/{code}/aml/rules": {
588
+ "method": "get",
589
+ "path": "/api/v1/vaults/{code}/aml/rules",
590
+ "operationId": "getApiV1VaultsByCodeAmlRules",
591
+ "tag": "AML",
592
+ "summary": "AML-правила Vault'а",
593
+ "audience": "member"
594
+ },
595
+ "GET /api/v1/vaults/{code}/aml/rules/{ruleId}": {
596
+ "method": "get",
597
+ "path": "/api/v1/vaults/{code}/aml/rules/{ruleId}",
598
+ "operationId": "getApiV1VaultsByCodeAmlRulesByRuleId",
599
+ "tag": "AML",
600
+ "summary": "AML-правило",
601
+ "audience": "member"
602
+ },
579
603
  "GET /api/v1/vaults/{code}/aml/settings": {
580
604
  "method": "get",
581
605
  "path": "/api/v1/vaults/{code}/aml/settings",
@@ -584,6 +608,14 @@ export const OPERATIONS = {
584
608
  "summary": "Настройки AML Vault'а",
585
609
  "audience": "member"
586
610
  },
611
+ "GET /api/v1/vaults/{code}/aml/stop-list": {
612
+ "method": "get",
613
+ "path": "/api/v1/vaults/{code}/aml/stop-list",
614
+ "operationId": "getApiV1VaultsByCodeAmlStopList",
615
+ "tag": "AML",
616
+ "summary": "Стоп-лист AML",
617
+ "audience": "member"
618
+ },
587
619
  "GET /api/v1/vaults/{code}/aml/visibility-grants": {
588
620
  "method": "get",
589
621
  "path": "/api/v1/vaults/{code}/aml/visibility-grants",
@@ -1168,6 +1200,14 @@ export const OPERATIONS = {
1168
1200
  "summary": "Изменить права гранта",
1169
1201
  "audience": "member"
1170
1202
  },
1203
+ "PATCH /api/v1/vaults/{code}/aml/rules/{ruleId}": {
1204
+ "method": "patch",
1205
+ "path": "/api/v1/vaults/{code}/aml/rules/{ruleId}",
1206
+ "operationId": "patchApiV1VaultsByCodeAmlRulesByRuleId",
1207
+ "tag": "AML",
1208
+ "summary": "Изменить AML-правило",
1209
+ "audience": "member"
1210
+ },
1171
1211
  "PATCH /api/v1/vaults/{code}/counterparties/{id}": {
1172
1212
  "method": "patch",
1173
1213
  "path": "/api/v1/vaults/{code}/counterparties/{id}",
@@ -1456,6 +1496,14 @@ export const OPERATIONS = {
1456
1496
  "summary": "Перепроверить адрес",
1457
1497
  "audience": "admin"
1458
1498
  },
1499
+ "POST /api/v1/vaults/{code}/aml/deposits/{depositId}/reviewed": {
1500
+ "method": "post",
1501
+ "path": "/api/v1/vaults/{code}/aml/deposits/{depositId}/reviewed",
1502
+ "operationId": "postApiV1VaultsByCodeAmlDepositsByDepositIdReviewed",
1503
+ "tag": "AML",
1504
+ "summary": "Отметить прошлый депозит «проверено»",
1505
+ "audience": "member"
1506
+ },
1459
1507
  "POST /api/v1/vaults/{code}/aml/internal-checks": {
1460
1508
  "method": "post",
1461
1509
  "path": "/api/v1/vaults/{code}/aml/internal-checks",
@@ -1464,6 +1512,30 @@ export const OPERATIONS = {
1464
1512
  "summary": "Проверить наш адрес",
1465
1513
  "audience": "member"
1466
1514
  },
1515
+ "POST /api/v1/vaults/{code}/aml/rules": {
1516
+ "method": "post",
1517
+ "path": "/api/v1/vaults/{code}/aml/rules",
1518
+ "operationId": "postApiV1VaultsByCodeAmlRules",
1519
+ "tag": "AML",
1520
+ "summary": "Создать AML-правило",
1521
+ "audience": "member"
1522
+ },
1523
+ "POST /api/v1/vaults/{code}/aml/rules/evaluate": {
1524
+ "method": "post",
1525
+ "path": "/api/v1/vaults/{code}/aml/rules/evaluate",
1526
+ "operationId": "postApiV1VaultsByCodeAmlRulesEvaluate",
1527
+ "tag": "AML",
1528
+ "summary": "Сухой прогон AML-правил",
1529
+ "audience": "member"
1530
+ },
1531
+ "POST /api/v1/vaults/{code}/aml/stop-list": {
1532
+ "method": "post",
1533
+ "path": "/api/v1/vaults/{code}/aml/stop-list",
1534
+ "operationId": "postApiV1VaultsByCodeAmlStopList",
1535
+ "tag": "AML",
1536
+ "summary": "Добавить адрес в стоп-лист",
1537
+ "audience": "member"
1538
+ },
1467
1539
  "POST /api/v1/vaults/{code}/aml/visibility-grants": {
1468
1540
  "method": "post",
1469
1541
  "path": "/api/v1/vaults/{code}/aml/visibility-grants",
@@ -667,7 +667,21 @@ export interface AmlOfficers {
667
667
  items: AmlOfficer[]
668
668
  }
669
669
 
670
- /** Риск второй стороны по данным AML-провайдера. ВАЖНО: уровень на операции — СНИМОК на момент решения, а не живая ссылка; текущий риск берётся отдельно через GET /aml/score */
670
+ export interface AmlRuleTrace {
671
+ ruleId: string
672
+ ruleCode: string
673
+ ruleName: string
674
+ /** range: -9007199254740991..9007199254740991 */
675
+ version: number
676
+ /** skipped — не по этой операции; clear — риск не совпал; fired — сработало */
677
+ result: "skipped" | "clear" | "fired"
678
+ /** match — риск совпал; unknown — проверки нет или нечем вычислить (→ подпись офицера) */
679
+ why?: "match" | "unknown"
680
+ outcome?: "block" | "officer"
681
+ detail?: string
682
+ }
683
+
684
+ /** УСТАРЕЛО: новые политики с этим селектором не принимаются (400) — риск задаётся AML-правилами Vault'а (/vaults/{code}/aml/rules). Риск второй стороны по данным AML-провайдера. ВАЖНО: уровень на операции — СНИМОК на момент решения, а не живая ссылка; текущий риск берётся отдельно через GET /aml/score */
671
685
  export interface AmlValue {
672
686
  /** Порог «не ниже чем» по УРОВНЮ риска второй стороны (у перевода — получателя). Уровень, а не числовой score: score калибруется провайдером и приходит вместе со своими thresholds, поэтому политика, написанная в числах, поехала бы вместе с их калибровкой */
673
687
  minLevel: "critical" | "high" | "medium" | "low" | "minimal"
@@ -1825,11 +1839,11 @@ export interface RuleInput {
1825
1839
 
1826
1840
  /**
1827
1841
  * Атомарное условие. Валидность типа зависит от actionType политики (селектор вне своей строки → 400 при создании):
1828
- * - transfer → senderPattern | destination | counterparty | counterpartyGroup | amount | token | aml
1842
+ * - transfer → senderPattern | destination | counterparty | counterpartyGroup | amount | token
1829
1843
  * - create_address → senderPattern
1830
1844
  * - counterparty_* / counterparty_group_* → actorRole
1831
1845
  *
1832
- * Ретайрнуты: actorType (был no-op — единственный фактический тип инициатора «user», миграция 0043), signers (мультиподписи нет, контекст не заполнялся и селектор никогда бы не совпал)
1846
+ * Снят с записи: aml (AML v2) — риск теперь условие AML-правил Vault'а (/vaults/{code}/aml/rules); в схеме остаётся только для чтения старых политик. Ретайрнуты: actorType (был no-op — единственный фактический тип инициатора «user», миграция 0043), signers (мультиподписи нет, контекст не заполнялся и селектор никогда бы не совпал)
1833
1847
  */
1834
1848
  export type SelectorInput = {
1835
1849
  type: "senderPattern"
@@ -2155,11 +2169,13 @@ export interface EvaluationRequest {
2155
2169
  context: EvaluationContext
2156
2170
  }
2157
2171
 
2158
- /** Решение движка. Порядок резолюции (Ф2): block → нарушенный лимит (отказ или эскалация в подпись) → требования подписи → allow → default-deny. requireApproval — это РЕШЕНИЕ движка, а не эффект политики */
2172
+ /** Решение движка. Порядок резолюции (Ф2): block → нарушенный лимит (отказ или эскалация в подпись) → требования подписи → allow → default-deny. requireApproval — это РЕШЕНИЕ движка, а не эффект политики. После политик — AML-правила Vault'а (AML v2): только добавляют запрет (AML_BLOCKED) или требование подписи AML-офицера (policyCode aml:<code> в requirements[]); разрешить запрещённое они не могут */
2159
2173
  export type EvaluationResult = {
2160
2174
  decision: "allow"
2161
2175
  matchedPolicyIds: string[]
2162
2176
  trace?: PolicyTrace[]
2177
+ /** AML-правила Vault'а на этой операции — при ?explain=true и если правила есть */
2178
+ amlRules?: AmlRuleTrace[]
2163
2179
  } | {
2164
2180
  decision: "block"
2165
2181
  reason: string
@@ -2170,7 +2186,11 @@ export type EvaluationResult = {
2170
2186
  policyVersionId: string | null
2171
2187
  /** Для лимита — «потрачено X из Y»; у явного block отсутствует */
2172
2188
  detail?: string
2189
+ /** Запрет поставило AML-правило Vault'а (reason AML_BLOCKED, policyId — id правила, policyCode — aml:<code>), а не политика группы */
2190
+ amlRuleId?: string
2173
2191
  trace?: PolicyTrace[]
2192
+ /** AML-правила Vault'а на этой операции — при ?explain=true и если правила есть */
2193
+ amlRules?: AmlRuleTrace[]
2174
2194
  } | {
2175
2195
  decision: "requireApproval"
2176
2196
  /** ИСТОЧНИК ИСТИНЫ: ВСЕ требования подписи от применимых политик. Их может быть несколько («CFO И комплаенс»), и каждое набирает свой порог отдельно. Поля ниже дублируют лишь САМОЕ СТРОГОЕ требование ради совместимости — показывать пользователю только их значит занизить, сколько подписей ему предстоит собрать */
@@ -2189,11 +2209,15 @@ export type EvaluationResult = {
2189
2209
  /** Инициатор остаётся среди approvers и может голосовать */
2190
2210
  allowInitiatorApproval: boolean
2191
2211
  trace?: PolicyTrace[]
2212
+ /** AML-правила Vault'а на этой операции — при ?explain=true и если правила есть */
2213
+ amlRules?: AmlRuleTrace[]
2192
2214
  } | {
2193
2215
  decision: "deny"
2194
2216
  reason: "no_applicable_policies"
2195
2217
  /** При ?explain=true — почему не применилась ни одна политика */
2196
2218
  trace?: PolicyTrace[]
2219
+ /** AML-правила Vault'а на этой операции — при ?explain=true и если правила есть */
2220
+ amlRules?: AmlRuleTrace[]
2197
2221
  }
2198
2222
 
2199
2223
  export interface PolicyTrace {
@@ -5855,6 +5879,15 @@ export interface ReportTemplate {
5855
5879
  updatedAt: string
5856
5880
  }
5857
5881
 
5882
+ export interface AddAmlStopListBody {
5883
+ /** length: 1..∞ */
5884
+ address: string
5885
+ /** По умолчанию — по формату адреса */
5886
+ network?: "tron" | "ethereum"
5887
+ /** length: 0..500 */
5888
+ reason?: string
5889
+ }
5890
+
5858
5891
  export interface AmlCheck {
5859
5892
  /** Запись проверки (неизменяемая). null — запись не сохранилась, ответ провайдера при этом валиден */
5860
5893
  id: string | null
@@ -5878,6 +5911,8 @@ export interface AmlCheck {
5878
5911
  categories: AmlLinkCategory[]
5879
5912
  /** Категории вне известного списка провайдера: метку переименовали или завели новую */
5880
5913
  unrecognizedCategories: string[]
5914
+ /** Часть связей провайдер прислал битыми: «категории нет» тогда не ответ, а «неизвестно» */
5915
+ linksIncomplete?: boolean
5881
5916
  /** Есть при view = links | full. null у стороны — её нет в ответе провайдера */
5882
5917
  links?: {
5883
5918
  incoming: AmlLinks | null
@@ -5921,6 +5956,19 @@ export interface AmlLinkCategory {
5921
5956
  * range: -9007199254740991..9007199254740991
5922
5957
  */
5923
5958
  count: number
5959
+ /** Связей категории по уровням. Нет у проверок, снятых до AML-правил (A3) */
5960
+ countByLevel?: {
5961
+ /** range: -9007199254740991..9007199254740991 */
5962
+ critical?: number
5963
+ /** range: -9007199254740991..9007199254740991 */
5964
+ high?: number
5965
+ /** range: -9007199254740991..9007199254740991 */
5966
+ medium?: number
5967
+ /** range: -9007199254740991..9007199254740991 */
5968
+ low?: number
5969
+ /** range: -9007199254740991..9007199254740991 */
5970
+ minimal?: number
5971
+ }
5924
5972
  /** Самый высокий уровень среди связей категории */
5925
5973
  maxLevel: AmlLevel | null
5926
5974
  share: number | null
@@ -6011,6 +6059,25 @@ export interface ScorechainLinkNative {
6011
6059
  address: string
6012
6060
  }
6013
6061
 
6062
+ export interface AmlDepositReviewBody {
6063
+ /**
6064
+ * Почему депозит признан проверенным
6065
+ *
6066
+ * length: 1..1000
6067
+ */
6068
+ comment: string
6069
+ }
6070
+
6071
+ export interface AmlDepositReview {
6072
+ id: string
6073
+ vaultId: string
6074
+ depositId: string
6075
+ reviewedById: string
6076
+ comment: string
6077
+ /** format: date-time */
6078
+ createdAt: string
6079
+ }
6080
+
6014
6081
  export interface AmlInternalCheckBody {
6015
6082
  /**
6016
6083
  * Наш адрес Vault'а
@@ -6050,6 +6117,107 @@ export interface AmlRecheckBody {
6050
6117
  provider?: "scorechain"
6051
6118
  }
6052
6119
 
6120
+ /** При каком риске срабатывает правило: {and}|{or}|{not}|лист {selector,value}. Листья: level {min}; score {op: gte|lte, value} в родной шкале провайдера; category {categories[], side?: incoming|outgoing|any, minCount?, minLinkLevel?} — все ограничители необязательны; unknown — проверки нет (→ подпись офицера, не запрет; под not — тоже); stopList — адрес в стоп-листе Vault'а; unrecognizedCategory — у провайдера незнакомая категория. Лист, которого провайдер не умеет (доли, сущность адреса, санкционные органы), отвергается при записи. Вычисляется в трёхзначной логике: «неизвестно» ведёт к подписи AML-офицера, а не к запрету */
6121
+ export type AmlRiskCondition = {
6122
+ and: AmlRiskCondition[]
6123
+ } | {
6124
+ or: AmlRiskCondition[]
6125
+ } | {
6126
+ not: AmlRiskCondition
6127
+ } | {
6128
+ selector: "level" | "score" | "category" | "sanctions" | "unknown" | "stopList" | "unrecognizedCategory"
6129
+ value?: unknown
6130
+ }
6131
+
6132
+ export interface AmlRuleEvaluateBody {
6133
+ /**
6134
+ * Получатель
6135
+ *
6136
+ * length: 1..∞
6137
+ */
6138
+ address: string
6139
+ /**
6140
+ * Наш адрес-отправитель (для senderPattern и сети)
6141
+ *
6142
+ * length: 1..∞
6143
+ */
6144
+ fromAddressId: string
6145
+ /** DECIMAL строка, как в POST /transfers (для селектора amount) */
6146
+ amount?: string
6147
+ /** Код токена; по умолчанию — токен адреса */
6148
+ asset?: string
6149
+ /**
6150
+ * Прогнать ровно эти правила — в том числе ВЫКЛЮЧЕННЫЕ: так правило видно до включения. Без поля — все включённые правила Vault'а
6151
+ *
6152
+ * items: 0..50
6153
+ */
6154
+ ruleIds?: string[]
6155
+ }
6156
+
6157
+ export interface AmlRuleEvaluation {
6158
+ /** Итог только по AML-правилам: clear — ни одно не сработало */
6159
+ decision: "clear" | "officer" | "block"
6160
+ /** Проверка получателя, по которой считали; null — не удалась */
6161
+ check: AmlCheck | null
6162
+ rules: Array<{
6163
+ ruleId: string
6164
+ ruleCode: string
6165
+ ruleName: string
6166
+ /** range: -9007199254740991..9007199254740991 */
6167
+ version: number
6168
+ result: "skipped" | "clear" | "fired"
6169
+ why?: "match" | "unknown"
6170
+ outcome?: "block" | "officer"
6171
+ detail?: string
6172
+ }>
6173
+ }
6174
+
6175
+ export interface AmlRule {
6176
+ id: string
6177
+ vaultId: string
6178
+ code: string
6179
+ name: string
6180
+ description: string | null
6181
+ enabled: boolean
6182
+ enabledAt: string | null
6183
+ /**
6184
+ * Растёт на каждой правке
6185
+ *
6186
+ * range: -9007199254740991..9007199254740991
6187
+ */
6188
+ version: number
6189
+ provider: "scorechain"
6190
+ appliesTo: "transfer"[]
6191
+ /** К каким операциям: селекторы перевода (senderPattern, destination, counterparty, counterpartyGroup, amount perTx, token) и destinationPattern — путь деривации НАШЕГО адреса-получателя. null — ко всем */
6192
+ scope: PolicyCondition | null
6193
+ /** Чей риск: counterparty — получателя перевода; provenance — источников средств адреса-отправителя (внешние депозиты за всю историю, через внутренние переводы до provenance.depth); совпадение хотя бы одного источника — срабатывание */
6194
+ subject: "counterparty" | "provenance"
6195
+ /** null — срабатывает всегда */
6196
+ risk: AmlRiskCondition | null
6197
+ /** Только для subject = provenance */
6198
+ provenance: {
6199
+ /**
6200
+ * 0..3 внутренних перевода назад
6201
+ *
6202
+ * range: -9007199254740991..9007199254740991
6203
+ */
6204
+ depth: number
6205
+ } | null
6206
+ outcome: "block" | "officer"
6207
+ /** Может ли офицер подтвердить собственный перевод (по умолчанию нет) */
6208
+ allowInitiatorApproval: boolean
6209
+ createdById: string
6210
+ updatedById: string | null
6211
+ /** format: date-time */
6212
+ createdAt: string
6213
+ /** format: date-time */
6214
+ updatedAt: string
6215
+ }
6216
+
6217
+ export interface AmlRules {
6218
+ items: AmlRule[]
6219
+ }
6220
+
6053
6221
  export interface AmlSettings {
6054
6222
  /** Что видит ЛЮБОЙ участник Vault'а без гранта. Гранты только расширяют */
6055
6223
  memberDefaultView: AmlView
@@ -6074,6 +6242,26 @@ export interface VaultAmlProvider {
6074
6242
  maxAgeSeconds: number
6075
6243
  }
6076
6244
 
6245
+ export interface AmlStopListEntry {
6246
+ id: string
6247
+ vaultId: string
6248
+ network: string
6249
+ address: string
6250
+ reason: string | null
6251
+ addedById: string
6252
+ status: "active" | "revoked"
6253
+ revokedAt: string | null
6254
+ revokedById: string | null
6255
+ /** format: date-time */
6256
+ createdAt: string
6257
+ /** format: date-time */
6258
+ updatedAt: string
6259
+ }
6260
+
6261
+ export interface AmlStopList {
6262
+ items: AmlStopListEntry[]
6263
+ }
6264
+
6077
6265
  export interface AmlVisibilityGrant {
6078
6266
  id: string
6079
6267
  vaultId: string
@@ -6099,6 +6287,26 @@ export interface AmlVisibilityGrants {
6099
6287
  items: AmlVisibilityGrant[]
6100
6288
  }
6101
6289
 
6290
+ export interface CreateAmlRuleBody {
6291
+ /** length: 1..∞ */
6292
+ code: string
6293
+ /** length: 1..∞ */
6294
+ name: string
6295
+ description?: string | null
6296
+ enabled?: boolean
6297
+ provider?: "scorechain"
6298
+ appliesTo?: string[]
6299
+ scope?: PolicyCondition | null
6300
+ subject?: string
6301
+ risk?: AmlRiskCondition | null
6302
+ provenance?: {
6303
+ /** range: -9007199254740991..9007199254740991 */
6304
+ depth?: number
6305
+ } | null
6306
+ outcome: "block" | "officer"
6307
+ allowInitiatorApproval?: boolean
6308
+ }
6309
+
6102
6310
  export interface CreateAmlVisibilityGrantBody {
6103
6311
  subjectType: "user" | "group"
6104
6312
  /** length: 1..∞ */
@@ -6108,6 +6316,24 @@ export interface CreateAmlVisibilityGrantBody {
6108
6316
  role: "links" | "full"
6109
6317
  }
6110
6318
 
6319
+ export interface PatchAmlRuleBody {
6320
+ /** length: 1..∞ */
6321
+ name?: string
6322
+ description?: string | null
6323
+ enabled?: boolean
6324
+ provider?: "scorechain"
6325
+ appliesTo?: string[]
6326
+ scope?: PolicyCondition | null
6327
+ subject?: string
6328
+ risk?: AmlRiskCondition | null
6329
+ provenance?: {
6330
+ /** range: -9007199254740991..9007199254740991 */
6331
+ depth?: number
6332
+ } | null
6333
+ outcome?: "block" | "officer"
6334
+ allowInitiatorApproval?: boolean
6335
+ }
6336
+
6111
6337
  export interface UpdateAmlSettingsBody {
6112
6338
  memberDefaultView?: AmlView
6113
6339
  providers?: Array<{