@v3finance/core-sdk 0.5.0 → 0.6.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 +31 -0
- package/dist/cjs/client.d.ts +3 -0
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +2 -0
- package/dist/cjs/client.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 +182 -0
- package/dist/cjs/generated/types.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/resources/aml.d.ts +56 -0
- package/dist/cjs/resources/aml.d.ts.map +1 -0
- package/dist/cjs/resources/aml.js +71 -0
- package/dist/cjs/resources/aml.js.map +1 -0
- package/dist/cjs/resources/registries.d.ts +10 -1
- package/dist/cjs/resources/registries.d.ts.map +1 -1
- package/dist/cjs/resources/registries.js +11 -0
- package/dist/cjs/resources/registries.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client.d.ts +3 -0
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +2 -0
- package/dist/esm/client.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 +182 -0
- package/dist/esm/generated/types.d.ts.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/resources/aml.d.ts +56 -0
- package/dist/esm/resources/aml.d.ts.map +1 -0
- package/dist/esm/resources/aml.js +67 -0
- package/dist/esm/resources/aml.js.map +1 -0
- package/dist/esm/resources/registries.d.ts +10 -1
- package/dist/esm/resources/registries.d.ts.map +1 -1
- package/dist/esm/resources/registries.js +11 -0
- package/dist/esm/resources/registries.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/errors.md +3 -0
- package/package.json +1 -1
- package/src/client.ts +4 -0
- package/src/generated/operations.ts +42 -2
- package/src/generated/types.ts +194 -0
- package/src/index.ts +1 -0
- package/src/resources/aml.ts +76 -0
- package/src/resources/registries.ts +13 -0
- package/src/version.ts +1 -1
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAmB,MAAM,aAAa,CAAA;AAezD,OAAO,EACL,UAAU,EACV,cAAc,EACd,GAAG,GAOJ,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,SAAS,EACT,WAAW,EACX,OAAO,EACP,cAAc,EACd,cAAc,GAGf,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,WAAW,EACX,MAAM,EACN,YAAY,EACZ,eAAe,EACf,MAAM,EACN,GAAG,EACH,GAAG,EACH,OAAO,EACP,MAAM,EACN,UAAU,GAEX,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAiC,MAAM,iBAAiB,CAAA;AAE9F,OAAO,EAAE,QAAQ,EAAE,UAAU,EAA8B,MAAM,sBAAsB,CAAA;AAEvF,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAiB5D,OAAO,EACL,iBAAiB,GAMlB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,iBAAiB,EAAkB,MAAM,0B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B,GASjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAK3B,MAAM,+BAA+B,CAAA;AAEtC,0EAA0E;AAC1E,OAAO,EACL,UAAU,EACV,gBAAgB,GAIjB,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type HttpClient } from '../core/http.js';
|
|
2
|
+
import type { AmlCheck, AmlRecheckBody } from '../generated/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* AML checks of a vault, in the typed model (AML v2).
|
|
5
|
+
*
|
|
6
|
+
* WHAT YOU GET DEPENDS ON WHO YOU ARE, and `view` on the answer says which:
|
|
7
|
+
* `summary` (any member) — level, score, categories; `links` (a vault or
|
|
8
|
+
* platform admin) — plus the address's links; `full` (`getCheck` only) —
|
|
9
|
+
* plus the provider's own response, typed. The server decides; reading
|
|
10
|
+
* `links` from a `summary` answer gets `undefined`, not an error.
|
|
11
|
+
*
|
|
12
|
+
* `level` is what to branch on. `null` means NOT CHECKED, never "clean" —
|
|
13
|
+
* draw it as a third, neutral state. `share` and `amountUsd` are `null` for
|
|
14
|
+
* Scorechain because the provider sends no amounts: show "no data", not
|
|
15
|
+
* "0 %". What a provider can do at all is in `registries.amlProviders()`.
|
|
16
|
+
*
|
|
17
|
+
* Not to be confused with `registries.amlScore()`: that one keeps the
|
|
18
|
+
* earlier shape for the transfer form; this one is the model decisions are
|
|
19
|
+
* made on, with a record id you can come back to.
|
|
20
|
+
*/
|
|
21
|
+
export declare class AmlResource {
|
|
22
|
+
#private;
|
|
23
|
+
constructor(http: HttpClient, vaultCode: string);
|
|
24
|
+
/**
|
|
25
|
+
* A check of the address. A stored one younger than 24 hours is returned
|
|
26
|
+
* as is (`cached: true`); otherwise the provider is called and a new
|
|
27
|
+
* record is written. 502 `AML_UNAVAILABLE` — the provider is down: show
|
|
28
|
+
* "could not check", not a green badge.
|
|
29
|
+
*/
|
|
30
|
+
check(address: string, options?: {
|
|
31
|
+
provider?: AmlCheck['provider'] | undefined;
|
|
32
|
+
signal?: AbortSignal | undefined;
|
|
33
|
+
}): Promise<AmlCheck>;
|
|
34
|
+
/**
|
|
35
|
+
* A fresh check, always calling the provider. Paid per call — only on an
|
|
36
|
+
* explicit action of a person. Admins only (403 for a member).
|
|
37
|
+
*/
|
|
38
|
+
recheck(input: AmlRecheckBody): Promise<AmlCheck>;
|
|
39
|
+
/**
|
|
40
|
+
* One record, whole (`view: full`). This is how an operation's snapshot is
|
|
41
|
+
* opened: pass its `amlCheckId` — what was known at the moment of the
|
|
42
|
+
* transfer or deposit. Records never change. `native: null` — the full
|
|
43
|
+
* provider response is not in the archive. Admins only.
|
|
44
|
+
*/
|
|
45
|
+
getCheck(id: string): Promise<AmlCheck>;
|
|
46
|
+
/**
|
|
47
|
+
* The provider's response byte for byte, for audit (hundreds of kilobytes
|
|
48
|
+
* for an active address). Returns the untouched `Response`. 404
|
|
49
|
+
* `AML_RAW_NOT_FOUND` — not archived for this record; 501
|
|
50
|
+
* `AML_ARCHIVE_DISABLED` — no archive on the server. Admins only.
|
|
51
|
+
*/
|
|
52
|
+
rawCheck(id: string, options?: {
|
|
53
|
+
signal?: AbortSignal | undefined;
|
|
54
|
+
}): Promise<Response>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=aml.d.ts.map
|
|
@@ -0,0 +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,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAErE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,WAAW;;IAItB,YAAY,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAG9C;IAED;;;;;OAKG;IACH,KAAK,CACH,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;KAAO,GAC9F,OAAO,CAAC,QAAQ,CAAC,CAKnB;IAED;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEhD;IAED;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEtC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;KAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAI1F;CACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { seg } from '../core/http.js';
|
|
2
|
+
/**
|
|
3
|
+
* AML checks of a vault, in the typed model (AML v2).
|
|
4
|
+
*
|
|
5
|
+
* WHAT YOU GET DEPENDS ON WHO YOU ARE, and `view` on the answer says which:
|
|
6
|
+
* `summary` (any member) — level, score, categories; `links` (a vault or
|
|
7
|
+
* platform admin) — plus the address's links; `full` (`getCheck` only) —
|
|
8
|
+
* plus the provider's own response, typed. The server decides; reading
|
|
9
|
+
* `links` from a `summary` answer gets `undefined`, not an error.
|
|
10
|
+
*
|
|
11
|
+
* `level` is what to branch on. `null` means NOT CHECKED, never "clean" —
|
|
12
|
+
* draw it as a third, neutral state. `share` and `amountUsd` are `null` for
|
|
13
|
+
* Scorechain because the provider sends no amounts: show "no data", not
|
|
14
|
+
* "0 %". What a provider can do at all is in `registries.amlProviders()`.
|
|
15
|
+
*
|
|
16
|
+
* Not to be confused with `registries.amlScore()`: that one keeps the
|
|
17
|
+
* earlier shape for the transfer form; this one is the model decisions are
|
|
18
|
+
* made on, with a record id you can come back to.
|
|
19
|
+
*/
|
|
20
|
+
export class AmlResource {
|
|
21
|
+
#http;
|
|
22
|
+
#base;
|
|
23
|
+
constructor(http, vaultCode) {
|
|
24
|
+
this.#http = http;
|
|
25
|
+
this.#base = `/api/v1/vaults/${seg(vaultCode)}/aml`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A check of the address. A stored one younger than 24 hours is returned
|
|
29
|
+
* as is (`cached: true`); otherwise the provider is called and a new
|
|
30
|
+
* record is written. 502 `AML_UNAVAILABLE` — the provider is down: show
|
|
31
|
+
* "could not check", not a green badge.
|
|
32
|
+
*/
|
|
33
|
+
check(address, options = {}) {
|
|
34
|
+
return this.#http.request('GET', `${this.#base}/checks`, {
|
|
35
|
+
query: { address, provider: options.provider },
|
|
36
|
+
signal: options.signal,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A fresh check, always calling the provider. Paid per call — only on an
|
|
41
|
+
* explicit action of a person. Admins only (403 for a member).
|
|
42
|
+
*/
|
|
43
|
+
recheck(input) {
|
|
44
|
+
return this.#http.request('POST', `${this.#base}/checks`, { body: input });
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* One record, whole (`view: full`). This is how an operation's snapshot is
|
|
48
|
+
* opened: pass its `amlCheckId` — what was known at the moment of the
|
|
49
|
+
* transfer or deposit. Records never change. `native: null` — the full
|
|
50
|
+
* provider response is not in the archive. Admins only.
|
|
51
|
+
*/
|
|
52
|
+
getCheck(id) {
|
|
53
|
+
return this.#http.request('GET', `${this.#base}/checks/${seg(id)}`);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The provider's response byte for byte, for audit (hundreds of kilobytes
|
|
57
|
+
* for an active address). Returns the untouched `Response`. 404
|
|
58
|
+
* `AML_RAW_NOT_FOUND` — not archived for this record; 501
|
|
59
|
+
* `AML_ARCHIVE_DISABLED` — no archive on the server. Admins only.
|
|
60
|
+
*/
|
|
61
|
+
rawCheck(id, options = {}) {
|
|
62
|
+
return this.#http.fetchRaw('GET', `${this.#base}/checks/${seg(id)}/raw`, {
|
|
63
|
+
signal: options.signal,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=aml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aml.js","sourceRoot":"","sources":["../../../src/resources/aml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,iBAAiB,CAAA;AAGtD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,WAAW;IACb,KAAK,CAAY;IACjB,KAAK,CAAQ;IAEtB,YAAY,IAAgB,EAAE,SAAiB;QAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,KAAK,GAAG,kBAAkB,GAAG,CAAC,SAAS,CAAC,MAAM,CAAA;IACrD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CACH,OAAe,EACf,OAAO,GAAsF,EAAE;QAE/F,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAW,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,SAAS,EAAE;YACjE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE;YAC9C,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAA;IACJ,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,KAAqB;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAW,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,SAAS,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IACtF,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAW,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,WAAW,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IAC/E,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAO,GAAyC,EAAE;QACrE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,WAAW,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE;YACvE,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HttpClient } from '../core/http.js';
|
|
2
|
-
import type { AmlValue, CreateNetworkBody, CreateTokenBody, EvaluationRequest, EvaluationResult, FiatCurrency, Network, PatchNetworkBody, PatchTokenBody, RatesResponse, RegistryNetwork, TokenWithNetwork } from '../generated/types.js';
|
|
2
|
+
import type { AmlProviders, AmlValue, CreateNetworkBody, CreateTokenBody, EvaluationRequest, EvaluationResult, FiatCurrency, Network, PatchNetworkBody, PatchTokenBody, RatesResponse, RegistryNetwork, TokenWithNetwork } from '../generated/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* The AML risk of one address, as `amlScore` returns it.
|
|
5
5
|
*
|
|
@@ -135,6 +135,15 @@ export declare class RegistriesResource {
|
|
|
135
135
|
amlScore(address: string, options?: {
|
|
136
136
|
refresh?: boolean | undefined;
|
|
137
137
|
}): Promise<AmlScore>;
|
|
138
|
+
/**
|
|
139
|
+
* AML providers and what each can do. `capabilities` decides which rule
|
|
140
|
+
* conditions a provider can serve: Scorechain has no shares of funds, no
|
|
141
|
+
* entity of the address itself and no separate sanction authorities, and
|
|
142
|
+
* the server will refuse a rule that needs them — so do not offer those
|
|
143
|
+
* conditions in a rule builder. The registry is code, the same for every
|
|
144
|
+
* vault.
|
|
145
|
+
*/
|
|
146
|
+
amlProviders(): Promise<AmlProviders>;
|
|
138
147
|
/**
|
|
139
148
|
* Registering a network. Administrators only.
|
|
140
149
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../../../src/resources/registries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,iBAAiB,EACxB,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAO,GAC9C,OAAO,CAAC,gBAAgB,CAAC,CAK3B;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAI5F;IAED;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,CAEpC;IAED;;;;;;OAMG;IACH,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAExD;IAED,2BAA2B;IAC3B,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAI1E;IAED;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAE7D;IAED;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAI7E;CACF"}
|
|
@@ -106,6 +106,17 @@ export class RegistriesResource {
|
|
|
106
106
|
query: { address, ...options },
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* AML providers and what each can do. `capabilities` decides which rule
|
|
111
|
+
* conditions a provider can serve: Scorechain has no shares of funds, no
|
|
112
|
+
* entity of the address itself and no separate sanction authorities, and
|
|
113
|
+
* the server will refuse a rule that needs them — so do not offer those
|
|
114
|
+
* conditions in a rule builder. The registry is code, the same for every
|
|
115
|
+
* vault.
|
|
116
|
+
*/
|
|
117
|
+
amlProviders() {
|
|
118
|
+
return this.#http.request('GET', '/api/v1/aml/providers');
|
|
119
|
+
}
|
|
109
120
|
/**
|
|
110
121
|
* Registering a network. Administrators only.
|
|
111
122
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registries.js","sourceRoot":"","sources":["../../../src/resources/registries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registries.js","sourceRoot":"","sources":["../../../src/resources/registries.ts"],"names":[],"mappings":"AAiDA;;;;;;;GAOG;AACH,MAAM,OAAO,kBAAkB;IACpB,KAAK,CAAY;IAE1B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACnB,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAoB,KAAK,EAAE,kBAAkB,CAAC,CAAA;IACzE,CAAC;IAED,mFAAmF;IACnF,MAAM,CAAC,MAAM,GAA4C,EAAE;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAqB,KAAK,EAAE,gBAAgB,EAAE,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAA;IAClG,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CACH,MAAM,GAGF,EAAE;QAEN,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAgB,KAAK,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAA;IAC5F,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,QAAQ,CACN,KAAwB,EACxB,OAAO,GAAsC,EAAE;QAE/C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAmB,MAAM,EAAE,kBAAkB,EAAE;YACtE,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE;SACtB,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,OAAe,EAAE,OAAO,GAAsC,EAAE;QACvE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAW,KAAK,EAAE,mBAAmB,EAAE;YAC9D,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE;SAC/B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAe,KAAK,EAAE,uBAAuB,CAAC,CAAA;IACzE,CAAC;IAED;;;;;;OAMG;IACH,aAAa,CAAC,KAAwB;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU,MAAM,EAAE,kBAAkB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IACjF,CAAC;IAED,2BAA2B;IAC3B,aAAa,CAAC,SAAiB,EAAE,KAAuB;QACtD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU,OAAO,EAAE,oBAAoB,kBAAkB,CAAC,SAAS,CAAC,EAAE,EAAE;YAC/F,IAAI,EAAE,KAAK;SACZ,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,KAAsB;QAChC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAmB,MAAM,EAAE,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IACxF,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,OAAe,EAAE,KAAqB;QAChD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAmB,OAAO,EAAE,kBAAkB,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAAE;YACpG,IAAI,EAAE,KAAK;SACZ,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** SDK version, sent in the `user-agent` header. */
|
|
2
|
-
export declare const SDK_VERSION = "0.
|
|
2
|
+
export declare const SDK_VERSION = "0.6.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
|
package/dist/esm/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** SDK version, sent in the `user-agent` header. */
|
|
2
|
-
export const SDK_VERSION = '0.
|
|
2
|
+
export const SDK_VERSION = '0.6.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
|
@@ -474,6 +474,9 @@ The public invitation lookup (`GET /invitations/by-token/{token}`) signals a dea
|
|
|
474
474
|
|---|---|---|---|
|
|
475
475
|
| `AML_ADDRESS_UNRECOGNISED` | 400 | The address format matches no supported network (TRON `T`+33, Ethereum `0x`+40). `details.address` echoes it. | Normal validation. Do not call the endpoint for addresses you cannot classify. |
|
|
476
476
|
| `AML_UNAVAILABLE` | 502 | The provider timed out, returned an error, or no API key is configured. `details.providerStatus` carries the upstream status. | **Show "could not check", never a clean result.** The status is always 502 regardless of what the provider returned — read `details.providerStatus` if you need the real one. Retrying immediately rarely helps; a successful answer is cached for 24 h. |
|
|
477
|
+
| `AML_CHECK_NOT_FOUND` | 404 | `aml.getCheck(id)` for an id that is no check record. | Records never disappear, so this is a wrong id — usually not an `amlCheckId` of an operation. |
|
|
478
|
+
| `AML_RAW_NOT_FOUND` | 404 | `aml.rawCheck(id)` for a record whose full provider response was not archived (archive write failed, or the record predates the archive). `hasRaw: false` on the record says so in advance. | Use the typed record from `aml.getCheck(id)`; the full response will not appear later. |
|
|
479
|
+
| `AML_ARCHIVE_DISABLED` | 501 | `aml.rawCheck(id)` on a server without the archive configured. | Server configuration, not a client error. The typed record still works. |
|
|
477
480
|
|
|
478
481
|
Two rules the API enforces and your interface has to mirror:
|
|
479
482
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v3finance/core-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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/client.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { CategoriesResource } from './resources/categories.js'
|
|
|
23
23
|
import { FoldersResource } from './resources/folders.js'
|
|
24
24
|
import { HistoryResource } from './resources/history.js'
|
|
25
25
|
import { MembersResource } from './resources/members.js'
|
|
26
|
+
import { AmlResource } from './resources/aml.js'
|
|
26
27
|
import { OperationsResource } from './resources/operations.js'
|
|
27
28
|
import { RegistriesResource } from './resources/registries.js'
|
|
28
29
|
import { ReportsResource } from './resources/reports.js'
|
|
@@ -90,6 +91,8 @@ export interface VaultScope {
|
|
|
90
91
|
readonly categories: CategoriesResource
|
|
91
92
|
readonly reports: ReportsResource
|
|
92
93
|
readonly operations: OperationsResource
|
|
94
|
+
/** AML checks in the typed model; what you see depends on your role. */
|
|
95
|
+
readonly aml: AmlResource
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
/**
|
|
@@ -149,6 +152,7 @@ export class CoreClient {
|
|
|
149
152
|
categories: new CategoriesResource(this.http, code),
|
|
150
153
|
reports: new ReportsResource(this.http, code),
|
|
151
154
|
operations: new OperationsResource(this.http, code),
|
|
155
|
+
aml: new AmlResource(this.http, code),
|
|
152
156
|
}
|
|
153
157
|
}
|
|
154
158
|
|
|
@@ -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: 208 · admin: 46 · both: 1 · member: 158 · service: 3
|
|
12
|
+
// Spec sha256: 4769a975d503ca1ea50be83ed906e010fca519ba999af7fe2d70853f288639ff
|
|
13
13
|
|
|
14
14
|
export type Audience = 'member' | 'admin' | 'service' | 'both' | 'unknown'
|
|
15
15
|
|
|
@@ -240,6 +240,14 @@ export const OPERATIONS = {
|
|
|
240
240
|
"summary": "On-chain адреса, заведённые в нескольких Vault'ах",
|
|
241
241
|
"audience": "admin"
|
|
242
242
|
},
|
|
243
|
+
"GET /api/v1/aml/providers": {
|
|
244
|
+
"method": "get",
|
|
245
|
+
"path": "/api/v1/aml/providers",
|
|
246
|
+
"operationId": "getApiV1AmlProviders",
|
|
247
|
+
"tag": "AML",
|
|
248
|
+
"summary": "Провайдеры AML",
|
|
249
|
+
"audience": "member"
|
|
250
|
+
},
|
|
243
251
|
"GET /api/v1/aml/score": {
|
|
244
252
|
"method": "get",
|
|
245
253
|
"path": "/api/v1/aml/score",
|
|
@@ -528,6 +536,30 @@ export const OPERATIONS = {
|
|
|
528
536
|
"summary": "Итоги и фасеты списка адресов",
|
|
529
537
|
"audience": "member"
|
|
530
538
|
},
|
|
539
|
+
"GET /api/v1/vaults/{code}/aml/checks": {
|
|
540
|
+
"method": "get",
|
|
541
|
+
"path": "/api/v1/vaults/{code}/aml/checks",
|
|
542
|
+
"operationId": "getApiV1VaultsByCodeAmlChecks",
|
|
543
|
+
"tag": "AML",
|
|
544
|
+
"summary": "Проверка адреса",
|
|
545
|
+
"audience": "member"
|
|
546
|
+
},
|
|
547
|
+
"GET /api/v1/vaults/{code}/aml/checks/{id}": {
|
|
548
|
+
"method": "get",
|
|
549
|
+
"path": "/api/v1/vaults/{code}/aml/checks/{id}",
|
|
550
|
+
"operationId": "getApiV1VaultsByCodeAmlChecksById",
|
|
551
|
+
"tag": "AML",
|
|
552
|
+
"summary": "Запись проверки",
|
|
553
|
+
"audience": "admin"
|
|
554
|
+
},
|
|
555
|
+
"GET /api/v1/vaults/{code}/aml/checks/{id}/raw": {
|
|
556
|
+
"method": "get",
|
|
557
|
+
"path": "/api/v1/vaults/{code}/aml/checks/{id}/raw",
|
|
558
|
+
"operationId": "getApiV1VaultsByCodeAmlChecksByIdRaw",
|
|
559
|
+
"tag": "AML",
|
|
560
|
+
"summary": "Полный ответ провайдера",
|
|
561
|
+
"audience": "admin"
|
|
562
|
+
},
|
|
531
563
|
"GET /api/v1/vaults/{code}/approval-relations": {
|
|
532
564
|
"method": "get",
|
|
533
565
|
"path": "/api/v1/vaults/{code}/approval-relations",
|
|
@@ -1376,6 +1408,14 @@ export const OPERATIONS = {
|
|
|
1376
1408
|
"summary": "Выдать доступ к адресу (владелец/admin)",
|
|
1377
1409
|
"audience": "member"
|
|
1378
1410
|
},
|
|
1411
|
+
"POST /api/v1/vaults/{code}/aml/checks": {
|
|
1412
|
+
"method": "post",
|
|
1413
|
+
"path": "/api/v1/vaults/{code}/aml/checks",
|
|
1414
|
+
"operationId": "postApiV1VaultsByCodeAmlChecks",
|
|
1415
|
+
"tag": "AML",
|
|
1416
|
+
"summary": "Перепроверить адрес",
|
|
1417
|
+
"audience": "admin"
|
|
1418
|
+
},
|
|
1379
1419
|
"POST /api/v1/vaults/{code}/approval-requests/{id}/approvals": {
|
|
1380
1420
|
"method": "post",
|
|
1381
1421
|
"path": "/api/v1/vaults/{code}/approval-requests/{id}/approvals",
|
package/src/generated/types.ts
CHANGED
|
@@ -2297,6 +2297,8 @@ export interface HistoryInItem {
|
|
|
2297
2297
|
/** 0–10; решения — по amlLevel */
|
|
2298
2298
|
amlScore: number | null
|
|
2299
2299
|
amlCheckedAt: string | null
|
|
2300
|
+
/** Запись AML-проверки на момент операции (AML v2) — GET /vaults/{code}/aml/checks/{id}. null — нет записи */
|
|
2301
|
+
amlCheckId: string | null
|
|
2300
2302
|
/** Старая разметка операции (то же, что GET …/metadata: назначение системной категории general, видно каждому, кто видит строку; sensitive-поле general без права — null); null — не заполнена */
|
|
2301
2303
|
metadata: {
|
|
2302
2304
|
category: string | null
|
|
@@ -2385,6 +2387,8 @@ export interface HistoryOutItem {
|
|
|
2385
2387
|
/** 0–10; решения — по amlLevel */
|
|
2386
2388
|
amlScore: number | null
|
|
2387
2389
|
amlCheckedAt: string | null
|
|
2390
|
+
/** Запись AML-проверки на момент операции (AML v2) — GET /vaults/{code}/aml/checks/{id}. null — нет записи */
|
|
2391
|
+
amlCheckId: string | null
|
|
2388
2392
|
/** Старая разметка операции (то же, что GET …/metadata: назначение системной категории general, видно каждому, кто видит строку; sensitive-поле general без права — null); null — не заполнена */
|
|
2389
2393
|
metadata: {
|
|
2390
2394
|
category: string | null
|
|
@@ -2619,6 +2623,8 @@ export interface IncomingTransactionDetail {
|
|
|
2619
2623
|
amlScore: number | null
|
|
2620
2624
|
/** Когда провайдер сделал проверку */
|
|
2621
2625
|
amlCheckedAt: string | null
|
|
2626
|
+
/** Запись AML-проверки, по которой снят снимок (AML v2): всё, что знали в момент операции, включая связи. Открывается через GET /vaults/{code}/aml/checks/{id}. null — не проверяли или запись не сохранилась; у операций до AML v2 — всегда null */
|
|
2627
|
+
amlCheckId: string | null
|
|
2622
2628
|
/** Курс токена к USD на момент депозита (USD за 1 единицу); null — недоступен */
|
|
2623
2629
|
usdRate: string | null
|
|
2624
2630
|
usdRateAsOf: string | null
|
|
@@ -4204,6 +4210,8 @@ export interface TransactionDetail {
|
|
|
4204
4210
|
amlScore: number | null
|
|
4205
4211
|
/** Когда провайдер сделал проверку */
|
|
4206
4212
|
amlCheckedAt: string | null
|
|
4213
|
+
/** Запись AML-проверки, по которой снят снимок (AML v2): всё, что знали в момент операции, включая связи. Открывается через GET /vaults/{code}/aml/checks/{id}. null — не проверяли или запись не сохранилась; у операций до AML v2 — всегда null */
|
|
4214
|
+
amlCheckId: string | null
|
|
4207
4215
|
/** USD-оценка перевода: amountDecimal × usdRate, decimal-СТРОКА. Считается один раз при создании и live-курсом не пересчитывается; null — курс был недоступен */
|
|
4208
4216
|
usdValue: string | null
|
|
4209
4217
|
/** Редакция политики, принявшая решение (PolicyVersion.id, Ф4). ЕДИНСТВЕННЫЙ способ связать перевод с правилами, которые действовали в момент решения: `decisionPolicyId` ведёт на политику, а её с тех пор могли переписать. Снимок — GET /policies/{id}/versions. null — решение принято до введения версий */
|
|
@@ -5815,3 +5823,189 @@ export interface ReportTemplate {
|
|
|
5815
5823
|
createdAt: string
|
|
5816
5824
|
updatedAt: string
|
|
5817
5825
|
}
|
|
5826
|
+
|
|
5827
|
+
export interface AmlCheck {
|
|
5828
|
+
/** Запись проверки (неизменяемая). null — запись не сохранилась, ответ провайдера при этом валиден */
|
|
5829
|
+
id: string | null
|
|
5830
|
+
provider: "scorechain"
|
|
5831
|
+
network: "tron" | "ethereum"
|
|
5832
|
+
address: string
|
|
5833
|
+
/** external — адрес контрагента; internal — наш адрес */
|
|
5834
|
+
subject: "external" | "internal"
|
|
5835
|
+
/** Какой объём отдан вызывающему. summary — уровень, балл, категории (любой участник); links — плюс связи; full — плюс родной блок провайдера (только GET …/checks/{id}) */
|
|
5836
|
+
view: "summary" | "links" | "full"
|
|
5837
|
+
/** null — провайдер ответил без оценки. Это «неизвестно», а НЕ «риска нет» */
|
|
5838
|
+
level: AmlLevel | null
|
|
5839
|
+
/** Балл в РОДНОЙ шкале провайдера; шкала рядом */
|
|
5840
|
+
score: {
|
|
5841
|
+
value: number
|
|
5842
|
+
scale: AmlScoreScale
|
|
5843
|
+
} | null
|
|
5844
|
+
/** 0..100, больше = рискованнее. Только сортировка и показ; решения — по level */
|
|
5845
|
+
riskIndex: number | null
|
|
5846
|
+
/** Категории обеих сторон вместе, по уникальным адресам */
|
|
5847
|
+
categories: AmlLinkCategory[]
|
|
5848
|
+
/** Категории вне известного списка провайдера: метку переименовали или завели новую */
|
|
5849
|
+
unrecognizedCategories: string[]
|
|
5850
|
+
/** Есть при view = links | full. null у стороны — её нет в ответе провайдера */
|
|
5851
|
+
links?: {
|
|
5852
|
+
incoming: AmlLinks | null
|
|
5853
|
+
outgoing: AmlLinks | null
|
|
5854
|
+
}
|
|
5855
|
+
/** Есть при view = full. null — полного ответа нет в архиве */
|
|
5856
|
+
native?: AmlNative | null
|
|
5857
|
+
/**
|
|
5858
|
+
* Когда проверку сделал провайдер
|
|
5859
|
+
*
|
|
5860
|
+
* format: date-time
|
|
5861
|
+
*/
|
|
5862
|
+
checkedAt: string
|
|
5863
|
+
/**
|
|
5864
|
+
* Когда её получили мы
|
|
5865
|
+
*
|
|
5866
|
+
* format: date-time
|
|
5867
|
+
*/
|
|
5868
|
+
fetchedAt: string
|
|
5869
|
+
/** true — отдана сохранённая проверка, внешнего вызова не было */
|
|
5870
|
+
cached: boolean
|
|
5871
|
+
/** Полный ответ провайдера лежит в архиве */
|
|
5872
|
+
hasRaw: boolean
|
|
5873
|
+
}
|
|
5874
|
+
|
|
5875
|
+
/** critical | high | medium | low | minimal. Решения — ПО НЕМУ, не по score: пороги провайдера могут измениться, уровень стабилен */
|
|
5876
|
+
export type AmlLevel = "critical" | "high" | "medium" | "low" | "minimal"
|
|
5877
|
+
|
|
5878
|
+
export interface AmlScoreScale {
|
|
5879
|
+
min: number
|
|
5880
|
+
max: number
|
|
5881
|
+
/** true — больше = рискованнее (Scorechain 0–10). У других провайдеров шкала может быть обратной */
|
|
5882
|
+
higherIsRiskier: boolean
|
|
5883
|
+
}
|
|
5884
|
+
|
|
5885
|
+
export interface AmlLinkCategory {
|
|
5886
|
+
category: string
|
|
5887
|
+
/**
|
|
5888
|
+
* Связей категории по УНИКАЛЬНЫМ адресам — провайдер повторяет одну сущность
|
|
5889
|
+
*
|
|
5890
|
+
* range: -9007199254740991..9007199254740991
|
|
5891
|
+
*/
|
|
5892
|
+
count: number
|
|
5893
|
+
/** Самый высокий уровень среди связей категории */
|
|
5894
|
+
maxLevel: AmlLevel | null
|
|
5895
|
+
share: number | null
|
|
5896
|
+
amountUsd: string | null
|
|
5897
|
+
}
|
|
5898
|
+
|
|
5899
|
+
export interface AmlLinks {
|
|
5900
|
+
/**
|
|
5901
|
+
* Уникальных адресов на этой стороне
|
|
5902
|
+
*
|
|
5903
|
+
* range: -9007199254740991..9007199254740991
|
|
5904
|
+
*/
|
|
5905
|
+
total: number
|
|
5906
|
+
byCategory: AmlLinkCategory[]
|
|
5907
|
+
/** Топ-50 связей по риску. Полный список — в архиве (GET …/checks/{id}/raw) */
|
|
5908
|
+
top: AmlLink[]
|
|
5909
|
+
}
|
|
5910
|
+
|
|
5911
|
+
export interface AmlLink {
|
|
5912
|
+
address: string
|
|
5913
|
+
/** Имя сущности: «Binance.com», «… (OFAC)» */
|
|
5914
|
+
name: string
|
|
5915
|
+
/** Родная строка провайдера: Exchange, Sanction list, Terrorism… */
|
|
5916
|
+
category: string
|
|
5917
|
+
level: AmlLevel | null
|
|
5918
|
+
/** Балл самой связи в родной шкале провайдера */
|
|
5919
|
+
score: number | null
|
|
5920
|
+
/** Доля средств, 0..100. null — провайдер не даёт сумм (у Scorechain всегда null) */
|
|
5921
|
+
share: number | null
|
|
5922
|
+
/** Сумма в USD, decimal-строка. null — провайдер не даёт сумм (у Scorechain всегда null) */
|
|
5923
|
+
amountUsd: string | null
|
|
5924
|
+
}
|
|
5925
|
+
|
|
5926
|
+
export type AmlNative = ScorechainNative
|
|
5927
|
+
|
|
5928
|
+
export interface ScorechainNative {
|
|
5929
|
+
provider: "scorechain"
|
|
5930
|
+
address: string
|
|
5931
|
+
network: string
|
|
5932
|
+
/** 0–10, больше = рискованнее */
|
|
5933
|
+
score: number
|
|
5934
|
+
level: AmlLevel
|
|
5935
|
+
thresholds: {
|
|
5936
|
+
critical: number
|
|
5937
|
+
high: number
|
|
5938
|
+
medium: number
|
|
5939
|
+
low: number
|
|
5940
|
+
} | null
|
|
5941
|
+
summary: {
|
|
5942
|
+
critical?: number
|
|
5943
|
+
high?: number
|
|
5944
|
+
medium?: number
|
|
5945
|
+
low?: number
|
|
5946
|
+
minimal?: number
|
|
5947
|
+
incoming?: number
|
|
5948
|
+
outgoing?: number
|
|
5949
|
+
total?: number
|
|
5950
|
+
avgIncoming?: number
|
|
5951
|
+
avgOutgoing?: number
|
|
5952
|
+
} | null
|
|
5953
|
+
/** Счётчики категорий так, как их считает сервис (без дедупликации) */
|
|
5954
|
+
categories: Array<{
|
|
5955
|
+
name: string
|
|
5956
|
+
count: number
|
|
5957
|
+
}>
|
|
5958
|
+
risk: {
|
|
5959
|
+
incoming: ScorechainLinkNative[] | null
|
|
5960
|
+
outgoing: ScorechainLinkNative[] | null
|
|
5961
|
+
}
|
|
5962
|
+
checkedAt: string | null
|
|
5963
|
+
/**
|
|
5964
|
+
* Связей, которые не удалось разобрать; они есть в архиве
|
|
5965
|
+
*
|
|
5966
|
+
* range: -9007199254740991..9007199254740991
|
|
5967
|
+
*/
|
|
5968
|
+
malformedLinks: number
|
|
5969
|
+
/** Поля ответа, которых мы не знаем, — сохраняются как есть */
|
|
5970
|
+
extra: {
|
|
5971
|
+
[key: string]: unknown
|
|
5972
|
+
}
|
|
5973
|
+
}
|
|
5974
|
+
|
|
5975
|
+
export interface ScorechainLinkNative {
|
|
5976
|
+
score: number
|
|
5977
|
+
name: string
|
|
5978
|
+
/** Категория — родная строка Scorechain */
|
|
5979
|
+
description: string
|
|
5980
|
+
address: string
|
|
5981
|
+
}
|
|
5982
|
+
|
|
5983
|
+
export interface AmlProvider {
|
|
5984
|
+
id: "scorechain"
|
|
5985
|
+
displayName: string
|
|
5986
|
+
networks: Array<"tron" | "ethereum">
|
|
5987
|
+
scoreScale: AmlScoreScale
|
|
5988
|
+
capabilities: {
|
|
5989
|
+
links: Array<"incoming" | "outgoing">
|
|
5990
|
+
/** Балл у каждой связи */
|
|
5991
|
+
linkScore: boolean
|
|
5992
|
+
/** Доли и суммы средств по связям */
|
|
5993
|
+
exposureShare: boolean
|
|
5994
|
+
/** Сущность самого адреса */
|
|
5995
|
+
selfEntity: boolean
|
|
5996
|
+
/** Санкционные органы (OFAC / EU / UN) по отдельности */
|
|
5997
|
+
sanctionsAuthorities: boolean
|
|
5998
|
+
}
|
|
5999
|
+
/** Известные категории — родные строки провайдера */
|
|
6000
|
+
categories: string[]
|
|
6001
|
+
}
|
|
6002
|
+
|
|
6003
|
+
export interface AmlProviders {
|
|
6004
|
+
items: AmlProvider[]
|
|
6005
|
+
}
|
|
6006
|
+
|
|
6007
|
+
export interface AmlRecheckBody {
|
|
6008
|
+
/** length: 1..∞ */
|
|
6009
|
+
address: string
|
|
6010
|
+
provider?: "scorechain"
|
|
6011
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -112,6 +112,7 @@ export { MeResource } from './resources/me.js'
|
|
|
112
112
|
export { SharingResource } from './resources/sharing.js'
|
|
113
113
|
export { FoldersResource } from './resources/folders.js'
|
|
114
114
|
export { MembersResource, type PolicyDirectoryParams } from './resources/members.js'
|
|
115
|
+
export { AmlResource } from './resources/aml.js'
|
|
115
116
|
export { RegistriesResource, type AmlScore } from './resources/registries.js'
|
|
116
117
|
export { CategoriesResource, type OperationType } from './resources/categories.js'
|
|
117
118
|
/**
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { seg, type HttpClient } from '../core/http.js'
|
|
2
|
+
import type { AmlCheck, AmlRecheckBody } from '../generated/types.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AML checks of a vault, in the typed model (AML v2).
|
|
6
|
+
*
|
|
7
|
+
* WHAT YOU GET DEPENDS ON WHO YOU ARE, and `view` on the answer says which:
|
|
8
|
+
* `summary` (any member) — level, score, categories; `links` (a vault or
|
|
9
|
+
* platform admin) — plus the address's links; `full` (`getCheck` only) —
|
|
10
|
+
* plus the provider's own response, typed. The server decides; reading
|
|
11
|
+
* `links` from a `summary` answer gets `undefined`, not an error.
|
|
12
|
+
*
|
|
13
|
+
* `level` is what to branch on. `null` means NOT CHECKED, never "clean" —
|
|
14
|
+
* draw it as a third, neutral state. `share` and `amountUsd` are `null` for
|
|
15
|
+
* Scorechain because the provider sends no amounts: show "no data", not
|
|
16
|
+
* "0 %". What a provider can do at all is in `registries.amlProviders()`.
|
|
17
|
+
*
|
|
18
|
+
* Not to be confused with `registries.amlScore()`: that one keeps the
|
|
19
|
+
* earlier shape for the transfer form; this one is the model decisions are
|
|
20
|
+
* made on, with a record id you can come back to.
|
|
21
|
+
*/
|
|
22
|
+
export class AmlResource {
|
|
23
|
+
readonly #http: HttpClient
|
|
24
|
+
readonly #base: string
|
|
25
|
+
|
|
26
|
+
constructor(http: HttpClient, vaultCode: string) {
|
|
27
|
+
this.#http = http
|
|
28
|
+
this.#base = `/api/v1/vaults/${seg(vaultCode)}/aml`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A check of the address. A stored one younger than 24 hours is returned
|
|
33
|
+
* as is (`cached: true`); otherwise the provider is called and a new
|
|
34
|
+
* record is written. 502 `AML_UNAVAILABLE` — the provider is down: show
|
|
35
|
+
* "could not check", not a green badge.
|
|
36
|
+
*/
|
|
37
|
+
check(
|
|
38
|
+
address: string,
|
|
39
|
+
options: { provider?: AmlCheck['provider'] | undefined; signal?: AbortSignal | undefined } = {},
|
|
40
|
+
): Promise<AmlCheck> {
|
|
41
|
+
return this.#http.request<AmlCheck>('GET', `${this.#base}/checks`, {
|
|
42
|
+
query: { address, provider: options.provider },
|
|
43
|
+
signal: options.signal,
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A fresh check, always calling the provider. Paid per call — only on an
|
|
49
|
+
* explicit action of a person. Admins only (403 for a member).
|
|
50
|
+
*/
|
|
51
|
+
recheck(input: AmlRecheckBody): Promise<AmlCheck> {
|
|
52
|
+
return this.#http.request<AmlCheck>('POST', `${this.#base}/checks`, { body: input })
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* One record, whole (`view: full`). This is how an operation's snapshot is
|
|
57
|
+
* opened: pass its `amlCheckId` — what was known at the moment of the
|
|
58
|
+
* transfer or deposit. Records never change. `native: null` — the full
|
|
59
|
+
* provider response is not in the archive. Admins only.
|
|
60
|
+
*/
|
|
61
|
+
getCheck(id: string): Promise<AmlCheck> {
|
|
62
|
+
return this.#http.request<AmlCheck>('GET', `${this.#base}/checks/${seg(id)}`)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The provider's response byte for byte, for audit (hundreds of kilobytes
|
|
67
|
+
* for an active address). Returns the untouched `Response`. 404
|
|
68
|
+
* `AML_RAW_NOT_FOUND` — not archived for this record; 501
|
|
69
|
+
* `AML_ARCHIVE_DISABLED` — no archive on the server. Admins only.
|
|
70
|
+
*/
|
|
71
|
+
rawCheck(id: string, options: { signal?: AbortSignal | undefined } = {}): Promise<Response> {
|
|
72
|
+
return this.#http.fetchRaw('GET', `${this.#base}/checks/${seg(id)}/raw`, {
|
|
73
|
+
signal: options.signal,
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
}
|