@v3finance/core-sdk 0.18.0 → 0.20.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.
- package/CHANGELOG.md +69 -0
- package/README.md +6 -3
- package/dist/cjs/core/gated.d.ts +11 -2
- package/dist/cjs/core/gated.d.ts.map +1 -1
- package/dist/cjs/core/gated.js +11 -2
- package/dist/cjs/core/gated.js.map +1 -1
- package/dist/cjs/core/pagination.d.ts +4 -3
- package/dist/cjs/core/pagination.d.ts.map +1 -1
- package/dist/cjs/core/pagination.js +4 -3
- package/dist/cjs/core/pagination.js.map +1 -1
- package/dist/cjs/generated/operations.d.ts +40 -0
- package/dist/cjs/generated/operations.d.ts.map +1 -1
- package/dist/cjs/generated/operations.js +42 -2
- package/dist/cjs/generated/operations.js.map +1 -1
- package/dist/cjs/generated/types.d.ts +160 -23
- package/dist/cjs/generated/types.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/resources/aml.d.ts +175 -7
- package/dist/cjs/resources/aml.d.ts.map +1 -1
- package/dist/cjs/resources/aml.js +165 -10
- package/dist/cjs/resources/aml.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/core/gated.d.ts +11 -2
- package/dist/esm/core/gated.d.ts.map +1 -1
- package/dist/esm/core/gated.js +11 -2
- package/dist/esm/core/gated.js.map +1 -1
- package/dist/esm/core/pagination.d.ts +4 -3
- package/dist/esm/core/pagination.d.ts.map +1 -1
- package/dist/esm/core/pagination.js +4 -3
- package/dist/esm/core/pagination.js.map +1 -1
- package/dist/esm/generated/operations.d.ts +40 -0
- package/dist/esm/generated/operations.d.ts.map +1 -1
- package/dist/esm/generated/operations.js +42 -2
- package/dist/esm/generated/operations.js.map +1 -1
- package/dist/esm/generated/types.d.ts +160 -23
- package/dist/esm/generated/types.d.ts.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/resources/aml.d.ts +175 -7
- package/dist/esm/resources/aml.d.ts.map +1 -1
- package/dist/esm/resources/aml.js +165 -10
- package/dist/esm/resources/aml.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/concepts.md +11 -0
- package/docs/errors.md +28 -7
- package/package.json +1 -1
- package/src/core/gated.ts +11 -2
- package/src/core/pagination.ts +4 -3
- package/src/generated/operations.ts +42 -2
- package/src/generated/types.ts +167 -26
- package/src/index.ts +6 -1
- package/src/resources/aml.ts +217 -10
- package/src/version.ts +1 -1
package/docs/errors.md
CHANGED
|
@@ -111,7 +111,7 @@ the authentication middleware with `UNAUTHENTICATED`.
|
|
|
111
111
|
| `ADDRESS_NOT_FOUND` | 404 | No such address id. | Refresh the address list; the address was deleted or the id is stale. |
|
|
112
112
|
| `ADDRESS_NOT_IN_VAULT` | 400 | The address exists but belongs to another vault. | A client bug: the vault scope and the address id disagree. |
|
|
113
113
|
| `ADDRESS_TRANSFER_FORBIDDEN` | 403 | You are neither the owner nor an admin, and you hold no grant with transfer rights on this address. Checked before the policy engine. | Show the address as view-only. The remedy is a `contributor` grant from the owner — direct the user there, not to a retry. |
|
|
114
|
-
| `WEB_SESSION_CANNOT_SIGN` | 403 | The session may not send money or sign. That depends on how it was obtained: the mobile app may (the email link verified by the app itself, with no http(s) `callbackURL`), and so may an older session, issued before the API told sessions apart; a browser signed in by the email link — the admin panel — only for a platform administrator; a web login — nobody, a platform administrator included. Refused on `transfers.send`, `transfers.vote`, `approvals.vote` and `
|
|
114
|
+
| `WEB_SESSION_CANNOT_SIGN` | 403 | The session may not send money or sign. That depends on how it was obtained: the mobile app may (the email link verified by the app itself, with no http(s) `callbackURL`), and so may an older session, issued before the API told sessions apart; a browser signed in by the email link — the admin panel — only for a platform administrator; a web login — nobody, a platform administrator included. Refused on `transfers.send`, `transfers.vote`, `approvals.vote`, `transferDrafts.send`, and on an AML officer's `aml.sendDraft`, `aml.markDepositReviewed` and `aml.unblockDeposit`, before anything else is checked, and on `transfers.reconcile` (platform administrators only) in a web-login session. Nothing was created, reserved or recorded. Cancelling your own transfer or request is not refused. | Terminal in that session. In a web client do not offer these actions: create a draft instead (`transferDrafts.create`, `aml.createDecisionDraft`), which the author sends from the app. |
|
|
115
115
|
| `POLICY_DENIED` | 403 | The policy engine said `block`, or no policy permits the action (default-deny). `details` carries the full decision, including `trace`. | Terminal for this request. Show `message` — it already names the rule that fired. Changing the amount or the destination may make the same request pass; retrying it unchanged will not. |
|
|
116
116
|
| `APPROVAL_UNSATISFIABLE` | 409 | Signatures are required but cannot be gathered: fewer eligible approvers than the threshold. `details` has `{threshold, eligibleApprovers}`. | **Do not retry.** Nobody can approve this. Tell the user to contact an administrator — the policy or the approver group has to change. See [Easily confused](#easily-confused). |
|
|
117
117
|
| `IDEMPOTENCY_KEY_REUSED` | 409 | The `idempotencyKey` already belongs to a different transfer: another sending address, recipient, amount, asset or network — their names are in `details.fields` (the amount is compared by value, `1.5` equals `1.50`); or it was used by another person or in another vault, and then there is no `details`. Nothing was created or moved. | Not a replay — a key reused for a new attempt. A new transfer needs a new key; a retry of the same transfer needs the old key with the same body. |
|
|
@@ -527,25 +527,27 @@ The public invitation lookup (`GET /invitations/by-token/{token}`) signals a dea
|
|
|
527
527
|
| `AML_PROVIDER_UNKNOWN` | 400 | `aml.updateSettings()` names a provider that is not in the registry. | Take ids from `registries.amlProviders()`. |
|
|
528
528
|
| `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. |
|
|
529
529
|
| `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. |
|
|
530
|
+
| `AML_CHECK_RATE_LIMITED` | 429 | `aml.recheck`, or an immediate `aml.checkInternal`: this person has made 60 paid checks in this vault within the last hour, the two counted together. A stored check (`aml.check`) does not count, nor does creating a request for `checkInternal`. `details` is `{retryAfterSeconds, limit, windowSeconds}`, and the `Retry-After` header carries the same seconds. The provider was not called. | Show when it is possible again, from `details.retryAfterSeconds`. Do not retry automatically before that. |
|
|
530
531
|
| `GRANT_NOT_FOUND` | 404 | `aml.revokeVisibility(id)` for a grant that is not in this vault. | Refresh the list from `aml.visibilityGrants()`. |
|
|
531
532
|
| `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. |
|
|
532
533
|
| `AML_NO_ELIGIBLE_OFFICER` | 409 | Creating a transfer, or editing the counterparty directory: 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. |
|
|
533
534
|
| `AML_DEPOSIT_RULES_DISABLED` | 409 | Switching on an AML rule with `appliesTo: ["deposit"]` in a vault where deposit holding is not enabled yet. | Save the rule with `enabled: false`; holding is enabled per vault by the service. |
|
|
534
535
|
| `AML_REJECT_REASON_REQUIRED` | 400 | An AML officer rejects without a comment: a held deposit (`aml_deposit_review`) — always; other requests with `rejectCommentRequired: true` too. Nothing was recorded. | Ask the officer for the reason and repeat. |
|
|
535
536
|
| `AML_REVIEW_NOT_CANCELLABLE` | 409 | Cancelling an `aml_deposit_review` request — by the address owner or an admin. | Do not offer cancel for this action: only an AML officer decides. |
|
|
536
|
-
| `AML_OWN_DEPOSIT` | 403 | `aml.unblockDeposit` for a deposit to the officer's own address
|
|
537
|
-
| `DEPOSIT_ALREADY_DECIDED` | 409 | Another officer has already decided this held deposit the other way; your vote was not kept. | Reload the request. |
|
|
538
|
-
| `DEPOSIT_NOT_BLOCKED` | 409 | `aml.unblockDeposit` for a deposit that was not rejected. | Reload the deposit. |
|
|
537
|
+
| `AML_OWN_DEPOSIT` | 403 | `aml.unblockDeposit` or marking a deposit reviewed, for a deposit to the officer's own address. Unblock is allowed only when the hold's rule allows it; marking reviewed only when every provenance rule of the vault (disabled ones too) allows it. `aml.createDecisionDraft` refuses the same decisions on the officer's own deposit, and `release` / `block` of it with this code instead of `NOT_APPROVER`. | Another AML officer must do it. |
|
|
538
|
+
| `DEPOSIT_ALREADY_DECIDED` | 409 | Another officer has already decided this held deposit the other way; your vote was not kept. From `aml.createDecisionDraft`: the deposit is already decided, `details.decidedById` says by whom — possibly you. | Reload the request. |
|
|
539
|
+
| `DEPOSIT_NOT_BLOCKED` | 409 | `aml.unblockDeposit`, or `aml.createDecisionDraft` with `unblock`, for a deposit that was not rejected. | Reload the deposit. |
|
|
540
|
+
| `DEPOSIT_NOT_HELD` | 409 | `aml.createDecisionDraft` with `release` or `block` for a deposit that is not on hold awaiting a decision. | Reload the deposit. |
|
|
539
541
|
| `DEPOSIT_MONEY_MISSING` | 409, 500 | The deposit's money is not on the hold account yet (409: the credit is still being retried), or the hold balance does not cover it (500: a ledger discrepancy). Nothing moved. | 409 — retry later; 500 — report it. |
|
|
540
542
|
| `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`. |
|
|
541
543
|
| `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`. |
|
|
542
544
|
| `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. |
|
|
543
545
|
| `AML_RULE_CODE_TAKEN` | 409 | `aml.createRule` with a code that exists in this vault. | Codes are unique per vault and immutable. |
|
|
544
|
-
| `AML_RULE_CONFLICT` | 409 | `aml.updateRule` while someone else changed the same rule. Nothing was saved. | Reload the rule and repeat the edit. |
|
|
546
|
+
| `AML_RULE_CONFLICT` | 409 | `aml.updateRule` with an `expectedVersion` that is no longer current, or while someone else changed the same rule. Nothing was saved. `details.currentVersion` is the version now. | Reload the rule, show what changed and let the person repeat the edit. Send the version the person saw as `expectedVersion`. |
|
|
545
547
|
| `AML_INTERNAL_CHECK_REQUIRED` | 403 | A member checks an address of their own vault with `aml.check` (or `GET /aml/score`). | Use `aml.checkInternal(addressId)`: it needs an AML officer's permission. |
|
|
546
548
|
| `AML_RULE_NOT_FOUND` | 404 | `aml.getRule` / `updateRule` for an id not in this vault. | — |
|
|
547
549
|
| `STOP_LIST_ENTRY_NOT_FOUND` | 404 | `aml.removeFromStopList` for an entry not in this vault. | Refresh from `aml.stopList()`. |
|
|
548
|
-
| `DEPOSIT_NOT_FOUND` | 404 | `aml.markDepositReviewed` for a deposit that is not a posted deposit of this vault. | — |
|
|
550
|
+
| `DEPOSIT_NOT_FOUND` | 404 | `aml.markDepositReviewed` or `aml.createDecisionDraft` for a deposit that is not a posted deposit of this vault. | — |
|
|
549
551
|
|
|
550
552
|
Two rules the API enforces and your interface has to mirror:
|
|
551
553
|
|
|
@@ -554,6 +556,25 @@ Two rules the API enforces and your interface has to mirror:
|
|
|
554
556
|
|
|
555
557
|
A risk threshold in a policy is expressed as a **level**, not a numeric score, and unknown counts as a match by default — a provider outage must not silently remove a control.
|
|
556
558
|
|
|
559
|
+
### Officer's drafts
|
|
560
|
+
|
|
561
|
+
`/aml/drafts` and `aml.createDecisionDraft`, plus the four edits that answer 202 with a draft when they weaken AML and come from a session that may not sign (`aml.updateRule`, `aml.removeFromStopList`, `aml.grantVisibility`, `aml.updateSettings`). A draft is seen only by its author, an administrator included. Creating a decision draft fails with the codes of the direct action, above; a weakening edit runs its own checks first (`AML_RULE_INVALID`, `AML_RULE_CONFLICT`, `STOP_LIST_ENTRY_NOT_FOUND`, `NOT_VISIBLE` and the rest) and becomes a draft only after them. Confirming one (`aml.sendDraft`) is refused to such a session with `WEB_SESSION_CANNOT_SIGN`. Their own codes:
|
|
562
|
+
|
|
563
|
+
| Code | Status | When | What to do |
|
|
564
|
+
|---|---|---|---|
|
|
565
|
+
| `AML_DRAFT_EXISTS` | 409 | Creating a draft — a decision on a deposit or a weakening edit — while another draft of yours for the same target is waiting with a different decision, comment or body. The same one again is not refused: it returns the waiting draft. `details.draftId` is the waiting one. | Offer to open it (`aml.draft(details.draftId)`): confirm it from the phone, or discard it and repeat. |
|
|
566
|
+
| `AML_DRAFT_NOT_FOUND` | 404 | No such draft, someone else's, or one from another vault — the three are not told apart, an administrator included. Reading, discarding and confirming. | Refresh the list from `aml.drafts()`. |
|
|
567
|
+
| `AML_DRAFT_STALE` | 409 | Confirming a draft that can no longer be applied. `details.staleReason` says why — `decided_by_other`, `officer_revoked`, `own_deposit`, `state_changed`, `version_changed`, `target_deleted` or `apply_failed`; `details.cause` is the `{code, message}` the direct action gave, when there is one; `details.draftId`. Nothing was applied, and the draft is recorded as `stale`. | Show the reason and the target as it is now. Another decision or edit is a new draft. |
|
|
568
|
+
| `AML_DRAFT_EXPIRED` | 409 | Confirming a draft past its `expiresAt` — 24 hours after it was made. Nothing was applied. `details.expiresAt`. | Terminal. Make a new draft. |
|
|
569
|
+
| `AML_DRAFT_DISCARDED` | 409 | Confirming a discarded draft. Nothing was applied. | Terminal. |
|
|
570
|
+
| `AML_DRAFT_ALREADY_SENT` | 409 | Discarding a confirmed draft — also when its action is in force but the draft is not marked `sent` yet (a confirmation from a phone is under way or broke off; the mark is written now). `details.draftId`, `details.result`. | It is in force, and discarding does not undo it. Show the outcome from `details.result`. |
|
|
571
|
+
|
|
572
|
+
`details.cause.code` of a stale draft is a code of the direct action — `DEPOSIT_NOT_HELD`, `ALREADY_VOTED`, `NOT_APPROVER`, `AML_RULE_CONFLICT`, `AML_NO_OFFICERS` and the like — or one of four that appear only there, naming what changed under a waiting edit: `STOP_LIST_ENTRY_REVOKED` (the address was already removed by someone else), `STOP_LIST_ENTRY_CHANGED` (the entry changed after the draft was made), `AML_GRANT_CHANGED` (the subject's visibility changed) and `AML_SETTINGS_CHANGED` (the settings changed). The same `{code, message}` is kept in the draft's `result.error`. Branch on `staleReason`, show the cause.
|
|
573
|
+
|
|
574
|
+
A temporary refusal of the path a draft is applied by — 409 `DEPOSIT_MONEY_MISSING`, the money is not on hold yet — leaves it a `draft`: confirm it again later. Confirming again after a timeout is safe as well: a confirmed draft answers 200 with itself and is never applied twice.
|
|
575
|
+
|
|
576
|
+
An unexpected failure on the drafts endpoints, or while one of the four edits stores its draft, is a 500 with the code `INTERNAL` rather than the `INTERNAL_ERROR` of the rest of the API. Branch on `status`, not on either name.
|
|
577
|
+
|
|
557
578
|
## Authentication and access
|
|
558
579
|
|
|
559
580
|
| Code | Status | When | What to do |
|
|
@@ -582,7 +603,7 @@ Three refusals the API puts **in front of** the library are its own: they arrive
|
|
|
582
603
|
|
|
583
604
|
The same sessions are also refused the money and signature endpoints of the API itself, with 403 `WEB_SESSION_CANNOT_SIGN` — see [Money and transfers](#money-and-transfers).
|
|
584
605
|
|
|
585
|
-
|
|
606
|
+
Outside `/api/auth/*` the API limits two things itself, each with its own code: export files (`EXPORT_RATE_LIMITED`) and paid AML checks (`AML_CHECK_RATE_LIMITED`, with `details.retryAfterSeconds`). Any other 429 there comes from the platform in front of it, usually without a JSON body, which means `code: "RATE_LIMITED"` and no `details`. Inside `/api/auth/*` a 429 can also come from the library's own limiter, as a bare `{message}`; and requesting a web-login code (`/api/auth/device/code`) is limited by the API itself, with a 429 in the API's envelope and `code: "RATE_LIMITED"`. Whichever answered, back off — for `X-Retry-After` seconds when the header is there — and retry.
|
|
586
607
|
|
|
587
608
|
## Easily confused
|
|
588
609
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v3finance/core-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.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": {
|
package/src/core/gated.ts
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
* ways, and only the HTTP status tells them apart:
|
|
4
4
|
*
|
|
5
5
|
* 201 — applied immediately (policy allowed it without signatures);
|
|
6
|
-
* 202 — queued for approval, funds are reserved, nothing has moved yet
|
|
6
|
+
* 202 — queued for approval, funds are reserved, nothing has moved yet.
|
|
7
|
+
* On the four AML edits (`aml.updateRule`, `removeFromStopList`,
|
|
8
|
+
* `grantVisibility`, `updateSettings`) it is a different wait: the
|
|
9
|
+
* edit weakens AML and came from a session that may not sign, so it
|
|
10
|
+
* became a draft its author confirms from the phone — nothing was
|
|
11
|
+
* applied, and the body is `{draft}`, not the edited object;
|
|
7
12
|
* 200 — on a transfer or an address: a replay of the same idempotency
|
|
8
13
|
* key, nothing happened now and the existing operation came back (no
|
|
9
14
|
* second broadcast, no second address). Everywhere else: an ordinary
|
|
@@ -90,7 +95,11 @@ export function isApplied<A, P>(
|
|
|
90
95
|
return r.outcome === 'applied' || r.outcome === 'replayed'
|
|
91
96
|
}
|
|
92
97
|
|
|
93
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* Narrowing: the operation was not applied and waits — for signatures, with
|
|
100
|
+
* funds reserved on a money path, or, on an AML edit, for its author to
|
|
101
|
+
* confirm the draft from the phone.
|
|
102
|
+
*/
|
|
94
103
|
export function isPending<A, P>(
|
|
95
104
|
r: Gated<A, P>,
|
|
96
105
|
): r is Extract<Gated<A, P>, { outcome: 'pending' }> {
|
package/src/core/pagination.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Keyset pagination — for the
|
|
2
|
+
* Keyset pagination — for the eighteen endpoints that have it.
|
|
3
3
|
*
|
|
4
4
|
* "Every list returns `{items, nextCursor}`" is what this file used to claim,
|
|
5
5
|
* and it is not what the API does. Counted over the spec snapshot
|
|
6
6
|
* (`openapi/spec.json`), the reading endpoints fall into three shapes:
|
|
7
7
|
*
|
|
8
|
-
* •
|
|
8
|
+
* • 18 GETs take `cursor`/`limit` and answer a `nextCursor` — addresses,
|
|
9
9
|
* history, approval requests, members, counterparties, counterparty
|
|
10
10
|
* groups, operation categories, operation relations, ledger entries, a
|
|
11
|
-
* vault's policies, balances, transfer drafts,
|
|
11
|
+
* vault's policies, balances, transfer drafts, expected payments, deals,
|
|
12
|
+
* the AML officer's operations and AML drafts, the policy directory and
|
|
12
13
|
* your own sessions (`me.sessions`). These are what `paginate` is for;
|
|
13
14
|
* • 20 answer `{items}` with NO cursor parameter at all — folders and their
|
|
14
15
|
* grants, address shares, shared-with-me / shared-by-me, visibility
|
|
@@ -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:
|
|
12
|
-
// Spec sha256:
|
|
11
|
+
// Operations: 255 · admin: 45 · both: 1 · member: 206 · service: 3
|
|
12
|
+
// Spec sha256: 66c8b7ac70659c7261b12a697cd90a59fb65c318fd9e5881ba2f523f94080a9e
|
|
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/drafts/{id}": {
|
|
100
|
+
"method": "delete",
|
|
101
|
+
"path": "/api/v1/vaults/{code}/aml/drafts/{id}",
|
|
102
|
+
"operationId": "deleteApiV1VaultsByCodeAmlDraftsById",
|
|
103
|
+
"tag": "AML",
|
|
104
|
+
"summary": "Удалить черновик AML",
|
|
105
|
+
"audience": "member"
|
|
106
|
+
},
|
|
99
107
|
"DELETE /api/v1/vaults/{code}/aml/stop-list/{entryId}": {
|
|
100
108
|
"method": "delete",
|
|
101
109
|
"path": "/api/v1/vaults/{code}/aml/stop-list/{entryId}",
|
|
@@ -600,6 +608,22 @@ export const OPERATIONS = {
|
|
|
600
608
|
"summary": "Полный ответ провайдера",
|
|
601
609
|
"audience": "member"
|
|
602
610
|
},
|
|
611
|
+
"GET /api/v1/vaults/{code}/aml/drafts": {
|
|
612
|
+
"method": "get",
|
|
613
|
+
"path": "/api/v1/vaults/{code}/aml/drafts",
|
|
614
|
+
"operationId": "getApiV1VaultsByCodeAmlDrafts",
|
|
615
|
+
"tag": "AML",
|
|
616
|
+
"summary": "Мои черновики AML",
|
|
617
|
+
"audience": "member"
|
|
618
|
+
},
|
|
619
|
+
"GET /api/v1/vaults/{code}/aml/drafts/{id}": {
|
|
620
|
+
"method": "get",
|
|
621
|
+
"path": "/api/v1/vaults/{code}/aml/drafts/{id}",
|
|
622
|
+
"operationId": "getApiV1VaultsByCodeAmlDraftsById",
|
|
623
|
+
"tag": "AML",
|
|
624
|
+
"summary": "Черновик AML",
|
|
625
|
+
"audience": "member"
|
|
626
|
+
},
|
|
603
627
|
"GET /api/v1/vaults/{code}/aml/officers": {
|
|
604
628
|
"method": "get",
|
|
605
629
|
"path": "/api/v1/vaults/{code}/aml/officers",
|
|
@@ -1632,6 +1656,14 @@ export const OPERATIONS = {
|
|
|
1632
1656
|
"summary": "Перепроверить адрес",
|
|
1633
1657
|
"audience": "admin"
|
|
1634
1658
|
},
|
|
1659
|
+
"POST /api/v1/vaults/{code}/aml/deposits/{depositId}/decision-drafts": {
|
|
1660
|
+
"method": "post",
|
|
1661
|
+
"path": "/api/v1/vaults/{code}/aml/deposits/{depositId}/decision-drafts",
|
|
1662
|
+
"operationId": "postApiV1VaultsByCodeAmlDepositsByDepositIdDecisionDrafts",
|
|
1663
|
+
"tag": "AML",
|
|
1664
|
+
"summary": "Черновик решения по поступлению (принять на Mac, подтвердить на телефоне)",
|
|
1665
|
+
"audience": "member"
|
|
1666
|
+
},
|
|
1635
1667
|
"POST /api/v1/vaults/{code}/aml/deposits/{depositId}/reviewed": {
|
|
1636
1668
|
"method": "post",
|
|
1637
1669
|
"path": "/api/v1/vaults/{code}/aml/deposits/{depositId}/reviewed",
|
|
@@ -1648,6 +1680,14 @@ export const OPERATIONS = {
|
|
|
1648
1680
|
"summary": "Выпустить отклонённый депозит",
|
|
1649
1681
|
"audience": "member"
|
|
1650
1682
|
},
|
|
1683
|
+
"POST /api/v1/vaults/{code}/aml/drafts/{id}/send": {
|
|
1684
|
+
"method": "post",
|
|
1685
|
+
"path": "/api/v1/vaults/{code}/aml/drafts/{id}/send",
|
|
1686
|
+
"operationId": "postApiV1VaultsByCodeAmlDraftsByIdSend",
|
|
1687
|
+
"tag": "AML",
|
|
1688
|
+
"summary": "Подтвердить черновик AML (только из мобильного приложения)",
|
|
1689
|
+
"audience": "member"
|
|
1690
|
+
},
|
|
1651
1691
|
"POST /api/v1/vaults/{code}/aml/internal-checks": {
|
|
1652
1692
|
"method": "post",
|
|
1653
1693
|
"path": "/api/v1/vaults/{code}/aml/internal-checks",
|
package/src/generated/types.ts
CHANGED
|
@@ -6481,8 +6481,8 @@ export interface AddAmlStopListBody {
|
|
|
6481
6481
|
address: string
|
|
6482
6482
|
/** По умолчанию — по формату адреса */
|
|
6483
6483
|
network?: "tron" | "ethereum"
|
|
6484
|
-
/**
|
|
6485
|
-
reason?: string
|
|
6484
|
+
/** Нет в теле — у существующей записи прежняя причина остаётся; null — стереть */
|
|
6485
|
+
reason?: string | null
|
|
6486
6486
|
}
|
|
6487
6487
|
|
|
6488
6488
|
export interface AmlCheck {
|
|
@@ -6680,6 +6680,150 @@ export interface AmlDepositReview {
|
|
|
6680
6680
|
createdAt: string
|
|
6681
6681
|
}
|
|
6682
6682
|
|
|
6683
|
+
export interface AmlDraftResult {
|
|
6684
|
+
draft: AmlDraft
|
|
6685
|
+
}
|
|
6686
|
+
|
|
6687
|
+
export interface AmlDraft {
|
|
6688
|
+
id: string
|
|
6689
|
+
/** deposit_decision — решение по поступлению; rule_update — PATCH правила; stop_list_remove — снятие из стоп-листа; visibility_grant — выдача/расширение гранта видимости; settings_update — PUT настроек */
|
|
6690
|
+
kind: "deposit_decision" | "rule_update" | "stop_list_remove" | "visibility_grant" | "settings_update"
|
|
6691
|
+
/** Депозит | правило | запись стоп-листа | `user:<id>` / `group:<id>` (субъект гранта) | `settings` */
|
|
6692
|
+
targetId: string
|
|
6693
|
+
/** draft — ждёт подтверждения с телефона; sent — исполнен (итог — result); discarded — удалён; stale — устарел (staleReason), ничего не применено; expired — срок вышел (expiresAt), ничего не применено. stale и expired вычисляются при чтении */
|
|
6694
|
+
status: "draft" | "sent" | "discarded" | "stale" | "expired"
|
|
6695
|
+
/** Только у stale. decided_by_other — решил другой офицер (снял другой); officer_revoked — автор больше не офицер (у правок — не офицер и не админ); own_deposit — поступление на свой адрес; state_changed — состояние цели другое (не удержан/не отклонён, вы уже голосовали иначе, запись или настройки менялись); version_changed — правило изменили; target_deleted — цели нет; apply_failed — правку отверг сервер (result.error) */
|
|
6696
|
+
staleReason: "decided_by_other" | "officer_revoked" | "own_deposit" | "state_changed" | "version_changed" | "target_deleted" | "apply_failed" | null
|
|
6697
|
+
/** Только у deposit_decision */
|
|
6698
|
+
decision: "release" | "block" | "unblock" | "reviewed" | null
|
|
6699
|
+
/** Комментарий решения (deposit_decision) */
|
|
6700
|
+
comment: string | null
|
|
6701
|
+
deposit: {
|
|
6702
|
+
id: string
|
|
6703
|
+
/**
|
|
6704
|
+
* Когда пришло поступление
|
|
6705
|
+
*
|
|
6706
|
+
* format: date-time
|
|
6707
|
+
*/
|
|
6708
|
+
createdAt: string
|
|
6709
|
+
/** raw smallest units */
|
|
6710
|
+
amount: string
|
|
6711
|
+
amountDecimal: string | null
|
|
6712
|
+
asset: string
|
|
6713
|
+
assetSymbol: string | null
|
|
6714
|
+
network: string
|
|
6715
|
+
/** Отправитель (внешний адрес) */
|
|
6716
|
+
from: string
|
|
6717
|
+
toAddress: {
|
|
6718
|
+
id: string
|
|
6719
|
+
address: string
|
|
6720
|
+
label: string | null
|
|
6721
|
+
}
|
|
6722
|
+
amlHoldStatus: "held" | "released" | "blocked" | "unblocked" | "missed" | null
|
|
6723
|
+
/** Сколько удержано (raw); меньше amount — удержали не всё */
|
|
6724
|
+
heldAmount: string | null
|
|
6725
|
+
heldAmountDecimal: string | null
|
|
6726
|
+
/** Риск отправителя на момент поступления; null — не проверяли */
|
|
6727
|
+
amlLevel: AmlLevel | null
|
|
6728
|
+
/** Запись проверки — GET …/aml/checks/{id} */
|
|
6729
|
+
amlCheckId: string | null
|
|
6730
|
+
/** Правило, удержавшее поступление, и почему; null — не удерживалось */
|
|
6731
|
+
rule: {
|
|
6732
|
+
id: string
|
|
6733
|
+
code: string
|
|
6734
|
+
name: string
|
|
6735
|
+
detail: string
|
|
6736
|
+
} | null
|
|
6737
|
+
} | null
|
|
6738
|
+
/** Цель правки (у deposit_decision — null) */
|
|
6739
|
+
target: {
|
|
6740
|
+
type: "rule" | "stop_list_entry" | "visibility_subject" | "settings"
|
|
6741
|
+
id: string
|
|
6742
|
+
/** Имя правила, адрес, имя участника/группы, «Настройки AML» */
|
|
6743
|
+
label: string
|
|
6744
|
+
} | null
|
|
6745
|
+
/** Что меняется — было → станет (у deposit_decision пусто) */
|
|
6746
|
+
changes: Array<{
|
|
6747
|
+
/** Поле: у правила — enabled, outcome, allowInitiatorApproval, appliesTo, scope, subject, risk, provenance, provider, name, description; у настроек — memberDefaultView, defaultProvider, providers.<id>.enabled, providers.<id>.maxAgeSeconds; у гранта — role; у стоп-листа — status */
|
|
6748
|
+
field: string
|
|
6749
|
+
/** Было (JSON-значение поля; null — не было) */
|
|
6750
|
+
from: unknown
|
|
6751
|
+
/** Станет */
|
|
6752
|
+
to: unknown
|
|
6753
|
+
/** Это изменение ослабляет защиту — из-за него правка и ждёт телефона */
|
|
6754
|
+
weakens: boolean
|
|
6755
|
+
}>
|
|
6756
|
+
createdFrom: {
|
|
6757
|
+
/** Вид входа, как в GET /me/sessions */
|
|
6758
|
+
kind: "mobile" | "web" | "desktop" | "browser" | "unknown"
|
|
6759
|
+
client: "web-client" | "macos-desktop" | "windows-desktop" | null
|
|
6760
|
+
/** Грубо, по user-agent сессии */
|
|
6761
|
+
platform: "ios" | "android" | "macos" | "windows" | "linux" | null
|
|
6762
|
+
/** Сессия, создавшая черновик (сверить с GET /me/sessions) */
|
|
6763
|
+
sessionId: string | null
|
|
6764
|
+
/** format: date-time */
|
|
6765
|
+
at: string
|
|
6766
|
+
}
|
|
6767
|
+
/** У sent — итог: deposit_decision {depositId, amlHoldStatus, reviewId}; rule_update {ruleId, version}; stop_list_remove {entryId}; visibility_grant {grantId, role}; settings_update {settings}. У stale, зафиксированного при подтверждении, — {error}: код и текст прямой ручки (при apply_failed — почему сервер отверг правку). У draft, discarded, expired и вычисленного stale — null */
|
|
6768
|
+
result: {
|
|
6769
|
+
depositId?: string
|
|
6770
|
+
amlHoldStatus?: "held" | "released" | "blocked" | "unblocked" | "missed" | null
|
|
6771
|
+
reviewId?: string | null
|
|
6772
|
+
ruleId?: string
|
|
6773
|
+
/** range: -9007199254740991..9007199254740991 */
|
|
6774
|
+
version?: number
|
|
6775
|
+
entryId?: string
|
|
6776
|
+
grantId?: string
|
|
6777
|
+
role?: "links" | "full"
|
|
6778
|
+
settings?: AmlSettings
|
|
6779
|
+
error?: {
|
|
6780
|
+
code: string
|
|
6781
|
+
message: string
|
|
6782
|
+
}
|
|
6783
|
+
} | null
|
|
6784
|
+
/** format: date-time */
|
|
6785
|
+
createdAt: string
|
|
6786
|
+
/** format: date-time */
|
|
6787
|
+
updatedAt: string
|
|
6788
|
+
/**
|
|
6789
|
+
* Через 24 часа после создания
|
|
6790
|
+
*
|
|
6791
|
+
* format: date-time
|
|
6792
|
+
*/
|
|
6793
|
+
expiresAt: string
|
|
6794
|
+
sentAt: string | null
|
|
6795
|
+
discardedAt: string | null
|
|
6796
|
+
}
|
|
6797
|
+
|
|
6798
|
+
export interface AmlSettings {
|
|
6799
|
+
/** Что видит ЛЮБОЙ участник Vault'а без гранта. Гранты только расширяют */
|
|
6800
|
+
memberDefaultView: AmlView
|
|
6801
|
+
providers: VaultAmlProvider[]
|
|
6802
|
+
defaultProvider: "scorechain"
|
|
6803
|
+
}
|
|
6804
|
+
|
|
6805
|
+
/** Объём проверки: summary — уровень, балл, категории; links — плюс связи; full — плюс родной блок провайдера и полный ответ из архива */
|
|
6806
|
+
export type AmlView = "summary" | "links" | "full"
|
|
6807
|
+
|
|
6808
|
+
export interface VaultAmlProvider {
|
|
6809
|
+
provider: "scorechain"
|
|
6810
|
+
displayName: string
|
|
6811
|
+
enabled: boolean
|
|
6812
|
+
/** Его проверка пишется в amlLevel операции. Ровно один включённый */
|
|
6813
|
+
isDefault: boolean
|
|
6814
|
+
/**
|
|
6815
|
+
* Свежесть сохранённой проверки; 0 — всегда новый вызов провайдера (каждый платный)
|
|
6816
|
+
*
|
|
6817
|
+
* range: -9007199254740991..9007199254740991
|
|
6818
|
+
*/
|
|
6819
|
+
maxAgeSeconds: number
|
|
6820
|
+
}
|
|
6821
|
+
|
|
6822
|
+
export interface AmlDraftsPage {
|
|
6823
|
+
items: AmlDraft[]
|
|
6824
|
+
nextCursor: string | null
|
|
6825
|
+
}
|
|
6826
|
+
|
|
6683
6827
|
export interface AmlInternalCheckBody {
|
|
6684
6828
|
/**
|
|
6685
6829
|
* Наш адрес Vault'а
|
|
@@ -6980,30 +7124,6 @@ export interface AmlRules {
|
|
|
6980
7124
|
items: AmlRule[]
|
|
6981
7125
|
}
|
|
6982
7126
|
|
|
6983
|
-
export interface AmlSettings {
|
|
6984
|
-
/** Что видит ЛЮБОЙ участник Vault'а без гранта. Гранты только расширяют */
|
|
6985
|
-
memberDefaultView: AmlView
|
|
6986
|
-
providers: VaultAmlProvider[]
|
|
6987
|
-
defaultProvider: "scorechain"
|
|
6988
|
-
}
|
|
6989
|
-
|
|
6990
|
-
/** Объём проверки: summary — уровень, балл, категории; links — плюс связи; full — плюс родной блок провайдера и полный ответ из архива */
|
|
6991
|
-
export type AmlView = "summary" | "links" | "full"
|
|
6992
|
-
|
|
6993
|
-
export interface VaultAmlProvider {
|
|
6994
|
-
provider: "scorechain"
|
|
6995
|
-
displayName: string
|
|
6996
|
-
enabled: boolean
|
|
6997
|
-
/** Его проверка пишется в amlLevel операции. Ровно один включённый */
|
|
6998
|
-
isDefault: boolean
|
|
6999
|
-
/**
|
|
7000
|
-
* Свежесть сохранённой проверки; 0 — всегда новый вызов провайдера (каждый платный)
|
|
7001
|
-
*
|
|
7002
|
-
* range: -9007199254740991..9007199254740991
|
|
7003
|
-
*/
|
|
7004
|
-
maxAgeSeconds: number
|
|
7005
|
-
}
|
|
7006
|
-
|
|
7007
7127
|
export interface AmlStopListEntry {
|
|
7008
7128
|
id: string
|
|
7009
7129
|
vaultId: string
|
|
@@ -7014,6 +7134,9 @@ export interface AmlStopListEntry {
|
|
|
7014
7134
|
status: "active" | "revoked"
|
|
7015
7135
|
revokedAt: string | null
|
|
7016
7136
|
revokedById: string | null
|
|
7137
|
+
/** Кто вернул снятый адрес повторным добавлением (когда — restoredAt); null — не возвращали. addedById и createdAt — первое добавление, не меняются */
|
|
7138
|
+
restoredById: string | null
|
|
7139
|
+
restoredAt: string | null
|
|
7017
7140
|
/** format: date-time */
|
|
7018
7141
|
createdAt: string
|
|
7019
7142
|
/** format: date-time */
|
|
@@ -7049,6 +7172,17 @@ export interface AmlVisibilityGrants {
|
|
|
7049
7172
|
items: AmlVisibilityGrant[]
|
|
7050
7173
|
}
|
|
7051
7174
|
|
|
7175
|
+
export interface CreateAmlDecisionDraftBody {
|
|
7176
|
+
/** release / block — удержанное поступление (`held`): выпустить или отклонить (голос по заявке `amlrev_<depositId>`); unblock — выпустить отклонённое (`blocked`); reviewed — отметить прошлое поступление «проверено» (снимает его из источников для правил происхождения средств) */
|
|
7177
|
+
decision: "release" | "block" | "unblock" | "reviewed"
|
|
7178
|
+
/**
|
|
7179
|
+
* Обязателен для любого решения: телефон покажет его при подтверждении
|
|
7180
|
+
*
|
|
7181
|
+
* length: 1..1000
|
|
7182
|
+
*/
|
|
7183
|
+
comment: string
|
|
7184
|
+
}
|
|
7185
|
+
|
|
7052
7186
|
export interface CreateAmlRuleBody {
|
|
7053
7187
|
/** length: 1..∞ */
|
|
7054
7188
|
code: string
|
|
@@ -7078,6 +7212,7 @@ export interface CreateAmlVisibilityGrantBody {
|
|
|
7078
7212
|
role: "links" | "full"
|
|
7079
7213
|
}
|
|
7080
7214
|
|
|
7215
|
+
/** Меняется только присланное. Без полей правила — ничего не пишется, version та же */
|
|
7081
7216
|
export interface PatchAmlRuleBody {
|
|
7082
7217
|
/** length: 1..∞ */
|
|
7083
7218
|
name?: string
|
|
@@ -7094,6 +7229,12 @@ export interface PatchAmlRuleBody {
|
|
|
7094
7229
|
} | null
|
|
7095
7230
|
outcome?: "block" | "officer"
|
|
7096
7231
|
allowInitiatorApproval?: boolean
|
|
7232
|
+
/**
|
|
7233
|
+
* Версия, которую видел человек; другая — 409 AML_RULE_CONFLICT с details.currentVersion
|
|
7234
|
+
*
|
|
7235
|
+
* range: 1..9007199254740991
|
|
7236
|
+
*/
|
|
7237
|
+
expectedVersion?: number
|
|
7097
7238
|
}
|
|
7098
7239
|
|
|
7099
7240
|
export interface UpdateAmlSettingsBody {
|
package/src/index.ts
CHANGED
|
@@ -129,7 +129,12 @@ export type {
|
|
|
129
129
|
ExportLang,
|
|
130
130
|
ExportOptions,
|
|
131
131
|
} from './resources/exports.js'
|
|
132
|
-
export type {
|
|
132
|
+
export type {
|
|
133
|
+
AmlDraftKind,
|
|
134
|
+
AmlDraftStatus,
|
|
135
|
+
AmlOperationsFilter,
|
|
136
|
+
ListAmlDraftsParams,
|
|
137
|
+
} from './resources/aml.js'
|
|
133
138
|
export { RegistriesResource, type AmlScore } from './resources/registries.js'
|
|
134
139
|
export { CategoriesResource, type OperationType } from './resources/categories.js'
|
|
135
140
|
/**
|