@xyz17711/sanctions-check 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -2
- package/dist/index.d.ts +71 -0
- package/dist/index.js +11 -0
- package/dist/langchain.d.ts +22 -0
- package/dist/langchain.js +19 -0
- package/package.json +68 -4
package/README.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @xyz17711/sanctions-check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/17711-services/clients/actions/workflows/publish-node.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@xyz17711/sanctions-check)
|
|
5
|
+
[](https://github.com/17711-services/clients/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
Typed TypeScript client for **sanctions-check-service**, part of the
|
|
8
|
+
[17711.xyz](https://api.17711.xyz) microservice fleet -- pay-per-call APIs settled in USDC via
|
|
9
|
+
[x402](https://x402.org), listed on [x402scan](https://www.x402scan.com/server/f1c7b972-3405-4b75-8b4f-d1bfbd6305ff).
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @xyz17711/sanctions-check
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Methods
|
|
18
|
+
|
|
19
|
+
| Method | Description |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `screenName` | Sanctions check: OFAC list check and sanctions screening of a person or company name against OFAC SDN, EU and UN lists (AML KYC) ($0.01, x402) |
|
|
22
|
+
|
|
23
|
+
## Quickstart
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { Client } from "@xyz17711/sanctions-check";
|
|
27
|
+
|
|
28
|
+
const client = new Client("https://api.17711.xyz/registry/sanctions-check-service");
|
|
29
|
+
// see the Methods table above for every available call and its request/response type
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Paying past the free quota
|
|
33
|
+
|
|
34
|
+
Every gated tool allows a small number of free calls per day; beyond that it returns a 402
|
|
35
|
+
challenge. Without a wallet configured, this client throws `PaymentRequiredError` with the price,
|
|
36
|
+
network, and payee address attached:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { Client, PaymentRequiredError } from "@xyz17711/sanctions-check";
|
|
40
|
+
|
|
41
|
+
const client = new Client("https://api.17711.xyz/registry/sanctions-check-service");
|
|
42
|
+
try {
|
|
43
|
+
await client.screenName(/* ... */);
|
|
44
|
+
} catch (e) {
|
|
45
|
+
if (e instanceof PaymentRequiredError) {
|
|
46
|
+
console.log(`needs ${e.priceUsdc} USDC on ${e.network}, payable to ${e.payTo}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
To pay automatically, configure a wallet on the client -- the private key should come from your
|
|
52
|
+
own environment/secrets manager, never a literal string in source code:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { Client } from "@xyz17711/sanctions-check";
|
|
56
|
+
|
|
57
|
+
const client = new Client("https://api.17711.xyz/registry/sanctions-check-service", {
|
|
58
|
+
x402PrivateKey: process.env.X402_PRIVATE_KEY,
|
|
59
|
+
x402ExpectedNetwork: "eip155:8453", // Base mainnet; use eip155:84532 for Base Sepolia testnet
|
|
60
|
+
x402MaxPaymentUsdc: 0.01, // refuse any single call above this
|
|
61
|
+
x402MaxTotalSpendUsdc: 1.0, // refuse once this WALLET's lifetime spend would exceed it
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Never commit a private key.** Both spend caps are required together with the key -- a wallet
|
|
66
|
+
with real funds and no explicit caps refuses to construct at all (`WalletConfigError`), on
|
|
67
|
+
purpose. The cumulative cap is tracked per wallet address, shared by every `Client` you construct
|
|
68
|
+
with that same key in this process.
|
|
69
|
+
|
|
70
|
+
## LangChain.js
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { Client } from "@xyz17711/sanctions-check";
|
|
74
|
+
import { SanctionsCheckToolkit } from "@xyz17711/sanctions-check/langchain";
|
|
75
|
+
|
|
76
|
+
const client = new Client("https://api.17711.xyz/registry/sanctions-check-service", { /* ...wallet options... */ });
|
|
77
|
+
const tools = new SanctionsCheckToolkit(client).getTools();
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Requires the optional `@langchain/core`+`zod` peer dependencies (`npm install @langchain/core
|
|
81
|
+
zod`) -- importing the base package above never requires them; only `@xyz17711/sanctions-check/langchain`
|
|
82
|
+
does.
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT -- see [`LICENSE`](../../LICENSE), shared by every language's client library in the
|
|
87
|
+
`clients` repo this package lives in.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed HTTP client and request/response interfaces for sanctions-check-service.
|
|
3
|
+
*/
|
|
4
|
+
import { Client as BaseClient, type ClientOptions } from "@xyz17711/core";
|
|
5
|
+
export interface ListStatus {
|
|
6
|
+
entries: number;
|
|
7
|
+
/** When this service last downloaded the list (UTC). */
|
|
8
|
+
fetched_at: string;
|
|
9
|
+
list: string;
|
|
10
|
+
/** Publication date announced by the list itself, when it states one. */
|
|
11
|
+
published?: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface SanctionMatch {
|
|
14
|
+
/** Other names the entry is listed under (at most 5). */
|
|
15
|
+
aliases: string[];
|
|
16
|
+
/** `true`/`false` when a `birth_year` was given and the entry publishes birth years. */
|
|
17
|
+
birth_year_consistent?: boolean | null;
|
|
18
|
+
/** Published years of birth. */
|
|
19
|
+
birth_years: number[];
|
|
20
|
+
/** Nationalities or countries, when published. */
|
|
21
|
+
countries: string[];
|
|
22
|
+
/** The entry's identifier in that list. */
|
|
23
|
+
entry_id: string;
|
|
24
|
+
/** `person`, `entity`, `vessel` or `aircraft`. */
|
|
25
|
+
kind: string;
|
|
26
|
+
/** `OFAC SDN`, `EU consolidated` or `UN Security Council`. */
|
|
27
|
+
list: string;
|
|
28
|
+
/** The listed primary name. */
|
|
29
|
+
listed_name: string;
|
|
30
|
+
/** Date of listing, when published. */
|
|
31
|
+
listed_on?: string | null;
|
|
32
|
+
/** `exact`, `close` or `possible`. */
|
|
33
|
+
match_type: string;
|
|
34
|
+
/** The name or alias that matched, when it is not the primary name. */
|
|
35
|
+
matched_alias?: string | null;
|
|
36
|
+
/** Sanctions programmes or regimes. */
|
|
37
|
+
programs: string[];
|
|
38
|
+
/** Published remarks (truncated). */
|
|
39
|
+
remarks?: string | null;
|
|
40
|
+
/** 0 to 1: 1 means the same words (any order); lower means a partial or approximate match. */
|
|
41
|
+
score: number;
|
|
42
|
+
}
|
|
43
|
+
export interface ScreenNameResponse {
|
|
44
|
+
disclaimer: string;
|
|
45
|
+
/** Lists that could not be loaded: the screening did not cover them. */
|
|
46
|
+
lists_missing: string[];
|
|
47
|
+
/** The lists that were screened, with their size and freshness. */
|
|
48
|
+
lists_screened: ListStatus[];
|
|
49
|
+
/** The best matches, highest score first (at most 10). */
|
|
50
|
+
matches: SanctionMatch[];
|
|
51
|
+
/** The name as screened. */
|
|
52
|
+
name: string;
|
|
53
|
+
/** When the screening ran (UTC). */
|
|
54
|
+
screened_at: string;
|
|
55
|
+
/** `match` (an exact or close match), `possible_match` (a partial match to review) or `no_match`. */
|
|
56
|
+
verdict: string;
|
|
57
|
+
}
|
|
58
|
+
export interface ScreenNameRequest {
|
|
59
|
+
/** A person's year of birth. Listed people whose published birth years do not include it are ranked lower and marked `birth_year_consistent: false`. */
|
|
60
|
+
birth_year?: number | null;
|
|
61
|
+
/** The name to screen: a person (`Vladimir Putin`, `Putin, Vladimir`) or a company, vessel or organisation. Word order, accents, capitalisation and small spelling variants do not matter. */
|
|
62
|
+
name: string;
|
|
63
|
+
/** Restrict the screening to `person`, `entity`, `vessel` or `aircraft`. Omit it to screen everything. */
|
|
64
|
+
type?: string | null;
|
|
65
|
+
}
|
|
66
|
+
/** Typed client for sanctions-check-service, e.g. `client.screenName(...)`. */
|
|
67
|
+
export declare class Client extends BaseClient {
|
|
68
|
+
/** Sanctions check: OFAC list check and sanctions screening of a person or company name against OFAC SDN, EU and UN lists (AML KYC) ($0.01, x402) */
|
|
69
|
+
screenName(request: ScreenNameRequest): Promise<ScreenNameResponse>;
|
|
70
|
+
}
|
|
71
|
+
export { ClientOptions };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed HTTP client and request/response interfaces for sanctions-check-service.
|
|
3
|
+
*/
|
|
4
|
+
import { Client as BaseClient } from "@xyz17711/core";
|
|
5
|
+
/** Typed client for sanctions-check-service, e.g. `client.screenName(...)`. */
|
|
6
|
+
export class Client extends BaseClient {
|
|
7
|
+
/** Sanctions check: OFAC list check and sanctions screening of a person or company name against OFAC SDN, EU and UN lists (AML KYC) ($0.01, x402) */
|
|
8
|
+
async screenName(request) {
|
|
9
|
+
return this.post("/v1/sanctions-check/screen_name", request);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LangChain.js tools for sanctions-check-service, grouped in one Toolkit -- one tool per operation, each just an async function (JS has no separate sync form to generate). Requires the `@langchain/core`+`zod` peer dependencies declared in this package's own package.json -- imported from `sanctions-check/langchain`, never from the package root, so importing the base client never requires them installed.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { Client } from "./index.js";
|
|
6
|
+
export declare class SanctionsCheckToolkit {
|
|
7
|
+
private client;
|
|
8
|
+
constructor(client: Client);
|
|
9
|
+
getTools(): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
|
|
10
|
+
birth_year: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
}, z.core.$strip>, {
|
|
14
|
+
name: string;
|
|
15
|
+
birth_year?: number | null | undefined;
|
|
16
|
+
type?: string | null | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
name: string;
|
|
19
|
+
birth_year?: number | null | undefined;
|
|
20
|
+
type?: string | null | undefined;
|
|
21
|
+
}, import("./index.js").ScreenNameResponse, unknown, "screenName">[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LangChain.js tools for sanctions-check-service, grouped in one Toolkit -- one tool per operation, each just an async function (JS has no separate sync form to generate). Requires the `@langchain/core`+`zod` peer dependencies declared in this package's own package.json -- imported from `sanctions-check/langchain`, never from the package root, so importing the base client never requires them installed.
|
|
3
|
+
*/
|
|
4
|
+
import { tool } from "@langchain/core/tools";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
export class SanctionsCheckToolkit {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
getTools() {
|
|
11
|
+
return [
|
|
12
|
+
tool(async (input) => this.client.screenName(input), {
|
|
13
|
+
name: "screenName",
|
|
14
|
+
description: "Sanctions check: OFAC list check and sanctions screening of a person or company name against OFAC SDN, EU and UN lists (AML KYC) ($0.01, x402)",
|
|
15
|
+
schema: z.object({ birth_year: z.number().nullable().optional(), name: z.string(), type: z.string().nullable().optional() }),
|
|
16
|
+
}),
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyz17711/sanctions-check",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Typed TypeScript client for the 17711.xyz Sanctions Check API: pay-per-call, settled in USDC via x402.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "17711 Services",
|
|
7
|
+
"homepage": "https://api.17711.xyz",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/17711-services/clients.git",
|
|
11
|
+
"directory": "node/packages/sanctions-check"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/17711-services/clients/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"x402",
|
|
18
|
+
"usdc",
|
|
19
|
+
"api-client",
|
|
20
|
+
"pay-per-call",
|
|
21
|
+
"ai-agents",
|
|
22
|
+
"mcp",
|
|
23
|
+
"langchain",
|
|
24
|
+
"sanctions-check"
|
|
25
|
+
],
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"type": "module",
|
|
34
|
+
"main": "dist/index.js",
|
|
35
|
+
"types": "dist/index.d.ts",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"default": "./dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./langchain": {
|
|
42
|
+
"types": "./dist/langchain.d.ts",
|
|
43
|
+
"default": "./dist/langchain.js"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc -p .",
|
|
48
|
+
"test": "npm run build && node --test test/*.test.mjs"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@xyz17711/core": "^0.1.0"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@langchain/core": ">=0.3",
|
|
55
|
+
"zod": "^3 || ^4"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"@langchain/core": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"zod": {
|
|
62
|
+
"optional": true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"typescript": "^5",
|
|
67
|
+
"@langchain/core": "^1.2",
|
|
68
|
+
"zod": "^4"
|
|
69
|
+
}
|
|
70
|
+
}
|