@saviours/check 0.1.2 → 0.1.3
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 +35 -13
- package/package.json +11 -5
- package/scripts/smoke.mjs +47 -0
package/README.md
CHANGED
|
@@ -1,20 +1,43 @@
|
|
|
1
1
|
# `@saviours/check`
|
|
2
2
|
|
|
3
|
+
<p align="left">
|
|
4
|
+
<img src="https://www.saviours.xyz/brand/saviours-mark-ink.png" alt="saviours" width="40" height="40" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
3
7
|
[](https://www.npmjs.com/package/@saviours/check)
|
|
4
8
|
|
|
5
9
|
Two-line counterparty check for wallets and agents.
|
|
6
10
|
Default path reads Sepolia ENS only — **$0**, no Saviours server.
|
|
7
11
|
|
|
12
|
+
## Install (fresh project)
|
|
13
|
+
|
|
14
|
+
**Do not run `npm i` / `pnpm add` inside the Saviours git monorepo.**
|
|
15
|
+
That tree is pnpm-managed; mixing `npm` there crashes arborist (`Cannot read properties of null (reading 'matches')`).
|
|
16
|
+
|
|
8
17
|
```bash
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
mkdir saviours-demo && cd saviours-demo
|
|
19
|
+
npm init -y
|
|
20
|
+
npm i @saviours/check
|
|
21
|
+
# or: pnpm init && pnpm add @saviours/check
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Package is **ESM-only** (`"type": "module"`). Use `import`, not `require`.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
node --input-type=module -e "
|
|
28
|
+
import { check } from '@saviours/check';
|
|
29
|
+
const r = await check('0x935bfb495e33f74d2e9735df1da66ace442ede48');
|
|
30
|
+
console.log(r.decision, r.status); // named → BLOCK|WARN · TAINTED|WATCH
|
|
31
|
+
"
|
|
11
32
|
```
|
|
12
33
|
|
|
13
34
|
```ts
|
|
14
35
|
import { check, guard } from "@saviours/check";
|
|
15
36
|
|
|
16
37
|
const r = await check("0x935bfb495e33f74d2e9735df1da66ace442ede48");
|
|
17
|
-
if (r.decision === "BLOCK"
|
|
38
|
+
if (r.decision === "BLOCK" || r.decision === "WARN") {
|
|
39
|
+
throw new Error(\`named \${r.status}\`);
|
|
40
|
+
}
|
|
18
41
|
|
|
19
42
|
await guard(addr); // throws SavioursBlockedError on BLOCK
|
|
20
43
|
```
|
|
@@ -36,6 +59,15 @@ Also exported: `BAZANTIC_GATEWAY`, `BAZANTIC_MCP`, `SAVIOURS_APP_URL`.
|
|
|
36
59
|
|
|
37
60
|
Also: `castCommand(address)`, React helper `@saviours/check/react`.
|
|
38
61
|
|
|
62
|
+
### Inside this monorepo
|
|
63
|
+
|
|
64
|
+
Workspace already wires the package — no npm install needed:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pnpm --filter @saviours/check build
|
|
68
|
+
pnpm --filter @saviours/check smoke
|
|
69
|
+
```
|
|
70
|
+
|
|
39
71
|
## Product law
|
|
40
72
|
|
|
41
73
|
- Memory hit is always **$0**.
|
|
@@ -69,13 +101,3 @@ Never bind in agent recipes: `dispute` · `revoke` · `eacProbe`.
|
|
|
69
101
|
- Email: [b4harshit01@gmail.com](mailto:b4harshit01@gmail.com)
|
|
70
102
|
- Twitter: [@harshitb01](https://twitter.com/harshitb01)
|
|
71
103
|
- GitHub: [devhb1](https://github.com/devhb1) · [issues](https://github.com/devhb1/Saviour/issues)
|
|
72
|
-
|
|
73
|
-
## Smoke
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
node --input-type=module -e "
|
|
77
|
-
import { check } from '@saviours/check';
|
|
78
|
-
console.log(await check('0x935bfb495e33f74d2e9735df1da66ace442ede48'));
|
|
79
|
-
"
|
|
80
|
-
# → decision BLOCK · status TAINTED
|
|
81
|
-
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saviours/check",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Two-line counterparty check — ENS first, Bazantic Shield/investigate gateway",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,26 +30,32 @@
|
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
+
"main": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
33
35
|
"exports": {
|
|
34
36
|
".": {
|
|
35
37
|
"types": "./dist/index.d.ts",
|
|
36
|
-
"import": "./dist/index.js"
|
|
38
|
+
"import": "./dist/index.js",
|
|
39
|
+
"default": "./dist/index.js"
|
|
37
40
|
},
|
|
38
41
|
"./react": {
|
|
39
42
|
"types": "./dist/react.d.ts",
|
|
40
|
-
"import": "./dist/react.js"
|
|
43
|
+
"import": "./dist/react.js",
|
|
44
|
+
"default": "./dist/react.js"
|
|
41
45
|
}
|
|
42
46
|
},
|
|
43
47
|
"files": [
|
|
44
48
|
"dist",
|
|
45
49
|
"examples",
|
|
46
|
-
"README.md"
|
|
50
|
+
"README.md",
|
|
51
|
+
"scripts"
|
|
47
52
|
],
|
|
48
53
|
"scripts": {
|
|
49
54
|
"build": "tsc -p tsconfig.json",
|
|
50
55
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
51
56
|
"prepare": "tsc -p tsconfig.json",
|
|
52
|
-
"prepublishOnly": "tsc -p tsconfig.json"
|
|
57
|
+
"prepublishOnly": "tsc -p tsconfig.json",
|
|
58
|
+
"smoke": "node ./scripts/smoke.mjs"
|
|
53
59
|
},
|
|
54
60
|
"peerDependencies": {
|
|
55
61
|
"react": ">=18"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Integrator smoke — after `npm i @saviours/check` in a fresh project:
|
|
4
|
+
* node node_modules/@saviours/check/scripts/smoke.mjs
|
|
5
|
+
* From this monorepo:
|
|
6
|
+
* pnpm --filter @saviours/check smoke
|
|
7
|
+
*/
|
|
8
|
+
let check;
|
|
9
|
+
try {
|
|
10
|
+
({ check } = await import("@saviours/check"));
|
|
11
|
+
} catch {
|
|
12
|
+
({ check } = await import("../dist/index.js"));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const ATTACK_1 = "0x935bfb495e33f74d2e9735df1da66ace442ede48";
|
|
16
|
+
|
|
17
|
+
const r = await check(ATTACK_1);
|
|
18
|
+
const named =
|
|
19
|
+
r.decision === "BLOCK" ||
|
|
20
|
+
r.decision === "WARN" ||
|
|
21
|
+
r.status === "TAINTED" ||
|
|
22
|
+
r.status === "WATCH";
|
|
23
|
+
|
|
24
|
+
console.log(
|
|
25
|
+
JSON.stringify(
|
|
26
|
+
{
|
|
27
|
+
address: ATTACK_1,
|
|
28
|
+
decision: r.decision,
|
|
29
|
+
status: r.status,
|
|
30
|
+
source: r.source,
|
|
31
|
+
ensName: r.ensName ?? null,
|
|
32
|
+
},
|
|
33
|
+
null,
|
|
34
|
+
2,
|
|
35
|
+
),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (!named) {
|
|
39
|
+
console.error(
|
|
40
|
+
"Expected ATTACK-1 to be named (BLOCK/WARN · TAINTED/WATCH). Got",
|
|
41
|
+
r.decision,
|
|
42
|
+
r.status,
|
|
43
|
+
);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
console.log("smoke ok · named threat · ENS resolve path");
|