@rempart/sdk 0.1.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 +5 -0
- package/README.md +52 -0
- package/dist/contract.d.ts +227 -0
- package/dist/contract.js +110 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +99 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @rempart/sdk
|
|
2
|
+
|
|
3
|
+
Signed anti-scam verdicts for Solana tokens. One call → score 0-100, verdict, confidence, machine-readable reasons, ed25519 signature you can verify offline.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm i @rempart/sdk
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Sniper bot in 30 lines
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Rempart } from '@rempart/sdk';
|
|
13
|
+
|
|
14
|
+
const rempart = new Rempart({
|
|
15
|
+
apiKey: process.env.REMPART_KEY, // prepaid key — or use the x402 payer below
|
|
16
|
+
baseUrl: 'https://api.rempart.example',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export async function shouldBuy(mint: string): Promise<boolean> {
|
|
20
|
+
let verdict;
|
|
21
|
+
try {
|
|
22
|
+
verdict = await rempart.score(mint); // $0.05, p95 < 2s
|
|
23
|
+
} catch {
|
|
24
|
+
return false; // API down = unknown = do NOT treat as safe
|
|
25
|
+
}
|
|
26
|
+
// never trust the wire blindly: verify the signature offline
|
|
27
|
+
if (!(await rempart.verifySignature(verdict))) return false;
|
|
28
|
+
if (verdict.verdict !== 'safe') return false;
|
|
29
|
+
if (verdict.confidence < 0.7) return false;
|
|
30
|
+
// machine-readable reasons let you apply your own policy:
|
|
31
|
+
const hardStops = ['DEPLOYER_PRIOR_RUG', 'T22_PERMANENT_DELEGATE'];
|
|
32
|
+
if (verdict.reasons.some((r) => hardStops.includes(r.code))) return false;
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// agent-native alternative: pay per call in USDC via x402, no account at all
|
|
37
|
+
const agent = new Rempart({
|
|
38
|
+
payer: async (accepts) => signUsdcPayment(accepts), // your wallet logic (e.g. @solana/web3.js)
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Responses are `data-not-advice`: an input to your decision logic, not financial advice.
|
|
43
|
+
|
|
44
|
+
## API
|
|
45
|
+
|
|
46
|
+
- `score(mint)` — standard verdict ($0.05)
|
|
47
|
+
- `scoreDeep(mint)` — + full deployer funding graph ($0.15)
|
|
48
|
+
- `verifySignature(response, publicKeyHex?)` — offline ed25519 check (pubkey auto-fetched from `/.well-known/rempart-pubkey.json` and cached)
|
|
49
|
+
- `account()` — prepaid balance & 30-day usage
|
|
50
|
+
- `pricing()` — machine-readable pricing
|
|
51
|
+
|
|
52
|
+
Retries: automatic with backoff on 429/5xx. Never on 402.
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ReasonSchema: z.ZodObject<{
|
|
3
|
+
code: z.ZodString;
|
|
4
|
+
weight: z.ZodNumber;
|
|
5
|
+
detail: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
code: string;
|
|
8
|
+
weight: number;
|
|
9
|
+
detail: string;
|
|
10
|
+
}, {
|
|
11
|
+
code: string;
|
|
12
|
+
weight: number;
|
|
13
|
+
detail: string;
|
|
14
|
+
}>;
|
|
15
|
+
export type Reason = z.infer<typeof ReasonSchema>;
|
|
16
|
+
export declare const VerdictSchema: z.ZodEnum<["danger", "caution", "safe"]>;
|
|
17
|
+
export type Verdict = z.infer<typeof VerdictSchema>;
|
|
18
|
+
export declare const ScoreResponseSchema: z.ZodObject<{
|
|
19
|
+
mint: z.ZodString;
|
|
20
|
+
score: z.ZodNumber;
|
|
21
|
+
verdict: z.ZodEnum<["danger", "caution", "safe"]>;
|
|
22
|
+
confidence: z.ZodNumber;
|
|
23
|
+
reasons: z.ZodArray<z.ZodObject<{
|
|
24
|
+
code: z.ZodString;
|
|
25
|
+
weight: z.ZodNumber;
|
|
26
|
+
detail: z.ZodString;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
code: string;
|
|
29
|
+
weight: number;
|
|
30
|
+
detail: string;
|
|
31
|
+
}, {
|
|
32
|
+
code: string;
|
|
33
|
+
weight: number;
|
|
34
|
+
detail: string;
|
|
35
|
+
}>, "many">;
|
|
36
|
+
model_version: z.ZodString;
|
|
37
|
+
features_at: z.ZodString;
|
|
38
|
+
key_id: z.ZodOptional<z.ZodString>;
|
|
39
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
40
|
+
disclaimer: z.ZodLiteral<"data-not-advice">;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
mint: string;
|
|
43
|
+
score: number;
|
|
44
|
+
verdict: "danger" | "caution" | "safe";
|
|
45
|
+
confidence: number;
|
|
46
|
+
reasons: {
|
|
47
|
+
code: string;
|
|
48
|
+
weight: number;
|
|
49
|
+
detail: string;
|
|
50
|
+
}[];
|
|
51
|
+
model_version: string;
|
|
52
|
+
features_at: string;
|
|
53
|
+
disclaimer: "data-not-advice";
|
|
54
|
+
key_id?: string | undefined;
|
|
55
|
+
signature?: string | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
mint: string;
|
|
58
|
+
score: number;
|
|
59
|
+
verdict: "danger" | "caution" | "safe";
|
|
60
|
+
confidence: number;
|
|
61
|
+
reasons: {
|
|
62
|
+
code: string;
|
|
63
|
+
weight: number;
|
|
64
|
+
detail: string;
|
|
65
|
+
}[];
|
|
66
|
+
model_version: string;
|
|
67
|
+
features_at: string;
|
|
68
|
+
disclaimer: "data-not-advice";
|
|
69
|
+
key_id?: string | undefined;
|
|
70
|
+
signature?: string | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
export type ScoreResponse = z.infer<typeof ScoreResponseSchema>;
|
|
73
|
+
/** Forme des features telle qu'exposée dans les rapports deep (sous-ensemble public). */
|
|
74
|
+
export declare const FeaturesSchema: z.ZodObject<{
|
|
75
|
+
mint: z.ZodString;
|
|
76
|
+
programOrigin: z.ZodOptional<z.ZodEnum<["pumpfun", "raydium", "spl"]>>;
|
|
77
|
+
mintAuthorityRevoked: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
freezeAuthorityRevoked: z.ZodOptional<z.ZodBoolean>;
|
|
79
|
+
lp: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
exists: z.ZodBoolean;
|
|
81
|
+
lockedOrBurned: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
solValue: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
pctSupply: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
exists: boolean;
|
|
86
|
+
lockedOrBurned?: boolean | undefined;
|
|
87
|
+
solValue?: number | undefined;
|
|
88
|
+
pctSupply?: number | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
exists: boolean;
|
|
91
|
+
lockedOrBurned?: boolean | undefined;
|
|
92
|
+
solValue?: number | undefined;
|
|
93
|
+
pctSupply?: number | undefined;
|
|
94
|
+
}>>;
|
|
95
|
+
holders: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
top10Pct: z.ZodNumber;
|
|
97
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
top10Pct: number;
|
|
100
|
+
count?: number | undefined;
|
|
101
|
+
}, {
|
|
102
|
+
top10Pct: number;
|
|
103
|
+
count?: number | undefined;
|
|
104
|
+
}>>;
|
|
105
|
+
deployer: z.ZodOptional<z.ZodObject<{
|
|
106
|
+
wallet: z.ZodOptional<z.ZodString>;
|
|
107
|
+
ageDays: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
tokensDeployed30d: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
priorRugs: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
fundedByRugger: z.ZodOptional<z.ZodBoolean>;
|
|
111
|
+
cleanHistory: z.ZodOptional<z.ZodBoolean>;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
wallet?: string | undefined;
|
|
114
|
+
ageDays?: number | undefined;
|
|
115
|
+
tokensDeployed30d?: number | undefined;
|
|
116
|
+
priorRugs?: number | undefined;
|
|
117
|
+
fundedByRugger?: boolean | undefined;
|
|
118
|
+
cleanHistory?: boolean | undefined;
|
|
119
|
+
}, {
|
|
120
|
+
wallet?: string | undefined;
|
|
121
|
+
ageDays?: number | undefined;
|
|
122
|
+
tokensDeployed30d?: number | undefined;
|
|
123
|
+
priorRugs?: number | undefined;
|
|
124
|
+
fundedByRugger?: boolean | undefined;
|
|
125
|
+
cleanHistory?: boolean | undefined;
|
|
126
|
+
}>>;
|
|
127
|
+
token2022: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
transferFeePct: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
permanentDelegate: z.ZodOptional<z.ZodBoolean>;
|
|
130
|
+
unknownTransferHook: z.ZodOptional<z.ZodBoolean>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
transferFeePct?: number | undefined;
|
|
133
|
+
permanentDelegate?: boolean | undefined;
|
|
134
|
+
unknownTransferHook?: boolean | undefined;
|
|
135
|
+
}, {
|
|
136
|
+
transferFeePct?: number | undefined;
|
|
137
|
+
permanentDelegate?: boolean | undefined;
|
|
138
|
+
unknownTransferHook?: boolean | undefined;
|
|
139
|
+
}>>;
|
|
140
|
+
externalVerdicts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
141
|
+
source: z.ZodString;
|
|
142
|
+
risky: z.ZodBoolean;
|
|
143
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
source: string;
|
|
146
|
+
risky: boolean;
|
|
147
|
+
detail?: string | undefined;
|
|
148
|
+
}, {
|
|
149
|
+
source: string;
|
|
150
|
+
risky: boolean;
|
|
151
|
+
detail?: string | undefined;
|
|
152
|
+
}>, "many">>;
|
|
153
|
+
featuresAt: z.ZodString;
|
|
154
|
+
}, "strip", z.ZodTypeAny, {
|
|
155
|
+
mint: string;
|
|
156
|
+
featuresAt: string;
|
|
157
|
+
programOrigin?: "pumpfun" | "raydium" | "spl" | undefined;
|
|
158
|
+
mintAuthorityRevoked?: boolean | undefined;
|
|
159
|
+
freezeAuthorityRevoked?: boolean | undefined;
|
|
160
|
+
lp?: {
|
|
161
|
+
exists: boolean;
|
|
162
|
+
lockedOrBurned?: boolean | undefined;
|
|
163
|
+
solValue?: number | undefined;
|
|
164
|
+
pctSupply?: number | undefined;
|
|
165
|
+
} | undefined;
|
|
166
|
+
holders?: {
|
|
167
|
+
top10Pct: number;
|
|
168
|
+
count?: number | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
deployer?: {
|
|
171
|
+
wallet?: string | undefined;
|
|
172
|
+
ageDays?: number | undefined;
|
|
173
|
+
tokensDeployed30d?: number | undefined;
|
|
174
|
+
priorRugs?: number | undefined;
|
|
175
|
+
fundedByRugger?: boolean | undefined;
|
|
176
|
+
cleanHistory?: boolean | undefined;
|
|
177
|
+
} | undefined;
|
|
178
|
+
token2022?: {
|
|
179
|
+
transferFeePct?: number | undefined;
|
|
180
|
+
permanentDelegate?: boolean | undefined;
|
|
181
|
+
unknownTransferHook?: boolean | undefined;
|
|
182
|
+
} | undefined;
|
|
183
|
+
externalVerdicts?: {
|
|
184
|
+
source: string;
|
|
185
|
+
risky: boolean;
|
|
186
|
+
detail?: string | undefined;
|
|
187
|
+
}[] | undefined;
|
|
188
|
+
}, {
|
|
189
|
+
mint: string;
|
|
190
|
+
featuresAt: string;
|
|
191
|
+
programOrigin?: "pumpfun" | "raydium" | "spl" | undefined;
|
|
192
|
+
mintAuthorityRevoked?: boolean | undefined;
|
|
193
|
+
freezeAuthorityRevoked?: boolean | undefined;
|
|
194
|
+
lp?: {
|
|
195
|
+
exists: boolean;
|
|
196
|
+
lockedOrBurned?: boolean | undefined;
|
|
197
|
+
solValue?: number | undefined;
|
|
198
|
+
pctSupply?: number | undefined;
|
|
199
|
+
} | undefined;
|
|
200
|
+
holders?: {
|
|
201
|
+
top10Pct: number;
|
|
202
|
+
count?: number | undefined;
|
|
203
|
+
} | undefined;
|
|
204
|
+
deployer?: {
|
|
205
|
+
wallet?: string | undefined;
|
|
206
|
+
ageDays?: number | undefined;
|
|
207
|
+
tokensDeployed30d?: number | undefined;
|
|
208
|
+
priorRugs?: number | undefined;
|
|
209
|
+
fundedByRugger?: boolean | undefined;
|
|
210
|
+
cleanHistory?: boolean | undefined;
|
|
211
|
+
} | undefined;
|
|
212
|
+
token2022?: {
|
|
213
|
+
transferFeePct?: number | undefined;
|
|
214
|
+
permanentDelegate?: boolean | undefined;
|
|
215
|
+
unknownTransferHook?: boolean | undefined;
|
|
216
|
+
} | undefined;
|
|
217
|
+
externalVerdicts?: {
|
|
218
|
+
source: string;
|
|
219
|
+
risky: boolean;
|
|
220
|
+
detail?: string | undefined;
|
|
221
|
+
}[] | undefined;
|
|
222
|
+
}>;
|
|
223
|
+
export type Features = z.infer<typeof FeaturesSchema>;
|
|
224
|
+
/** JSON canonique: clés triées récursivement, sans espaces — la signature porte sur cette forme. */
|
|
225
|
+
export declare function canonicalStringify(value: unknown): string;
|
|
226
|
+
/** Vérification hors ligne d'un verdict signé, contre la pubkey publiée à /.well-known/rempart-pubkey.json. */
|
|
227
|
+
export declare function verifyScoreResponse(response: ScoreResponse, publicKeyHex: string): boolean;
|
package/dist/contract.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contrat public de l'API Rempart — copie contrôlée de la surface PUBLIQUE de
|
|
3
|
+
* @rempart/core (schemas de réponse, JSON canonique, vérification ed25519).
|
|
4
|
+
*
|
|
5
|
+
* Pourquoi une copie et pas une dépendance: @rempart/core contient le modèle de
|
|
6
|
+
* scoring (règles + poids), qui est le moat du produit et ne doit JAMAIS être
|
|
7
|
+
* publié sur npm (ROADMAP §9 risque D). Le SDK n'embarque que le contrat.
|
|
8
|
+
* La non-dérive est garantie par un test de parité dans test/contract-sync.test.ts
|
|
9
|
+
* (core reste devDependency workspace, jamais dans le tarball publié).
|
|
10
|
+
*/
|
|
11
|
+
import * as ed from '@noble/ed25519';
|
|
12
|
+
import { sha512 } from '@noble/hashes/sha512';
|
|
13
|
+
import { bytesToHex, hexToBytes, utf8ToBytes } from '@noble/hashes/utils';
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
ed.etc.sha512Sync = (...m) => sha512(ed.etc.concatBytes(...m));
|
|
16
|
+
export const ReasonSchema = z.object({
|
|
17
|
+
code: z.string(),
|
|
18
|
+
weight: z.number(),
|
|
19
|
+
detail: z.string(),
|
|
20
|
+
});
|
|
21
|
+
export const VerdictSchema = z.enum(['danger', 'caution', 'safe']);
|
|
22
|
+
export const ScoreResponseSchema = z.object({
|
|
23
|
+
mint: z.string(),
|
|
24
|
+
score: z.number().int().min(0).max(100),
|
|
25
|
+
verdict: VerdictSchema,
|
|
26
|
+
confidence: z.number().min(0).max(1),
|
|
27
|
+
reasons: z.array(ReasonSchema),
|
|
28
|
+
model_version: z.string(),
|
|
29
|
+
features_at: z.string(),
|
|
30
|
+
key_id: z.string().optional(),
|
|
31
|
+
signature: z.string().optional(),
|
|
32
|
+
disclaimer: z.literal('data-not-advice'),
|
|
33
|
+
});
|
|
34
|
+
/** Forme des features telle qu'exposée dans les rapports deep (sous-ensemble public). */
|
|
35
|
+
export const FeaturesSchema = z.object({
|
|
36
|
+
mint: z.string().min(32).max(44),
|
|
37
|
+
programOrigin: z.enum(['pumpfun', 'raydium', 'spl']).optional(),
|
|
38
|
+
mintAuthorityRevoked: z.boolean().optional(),
|
|
39
|
+
freezeAuthorityRevoked: z.boolean().optional(),
|
|
40
|
+
lp: z
|
|
41
|
+
.object({
|
|
42
|
+
exists: z.boolean(),
|
|
43
|
+
lockedOrBurned: z.boolean().optional(),
|
|
44
|
+
solValue: z.number().nonnegative().optional(),
|
|
45
|
+
pctSupply: z.number().min(0).max(100).optional(),
|
|
46
|
+
})
|
|
47
|
+
.optional(),
|
|
48
|
+
holders: z
|
|
49
|
+
.object({
|
|
50
|
+
top10Pct: z.number().min(0).max(100),
|
|
51
|
+
count: z.number().int().nonnegative().optional(),
|
|
52
|
+
})
|
|
53
|
+
.optional(),
|
|
54
|
+
deployer: z
|
|
55
|
+
.object({
|
|
56
|
+
wallet: z.string().optional(),
|
|
57
|
+
ageDays: z.number().nonnegative().optional(),
|
|
58
|
+
tokensDeployed30d: z.number().int().nonnegative().optional(),
|
|
59
|
+
priorRugs: z.number().int().nonnegative().optional(),
|
|
60
|
+
fundedByRugger: z.boolean().optional(),
|
|
61
|
+
cleanHistory: z.boolean().optional(),
|
|
62
|
+
})
|
|
63
|
+
.optional(),
|
|
64
|
+
token2022: z
|
|
65
|
+
.object({
|
|
66
|
+
transferFeePct: z.number().min(0).max(100).optional(),
|
|
67
|
+
permanentDelegate: z.boolean().optional(),
|
|
68
|
+
unknownTransferHook: z.boolean().optional(),
|
|
69
|
+
})
|
|
70
|
+
.optional(),
|
|
71
|
+
externalVerdicts: z
|
|
72
|
+
.array(z.object({
|
|
73
|
+
source: z.string(),
|
|
74
|
+
risky: z.boolean(),
|
|
75
|
+
detail: z.string().optional(),
|
|
76
|
+
}))
|
|
77
|
+
.optional(),
|
|
78
|
+
featuresAt: z.string().datetime(),
|
|
79
|
+
});
|
|
80
|
+
/** JSON canonique: clés triées récursivement, sans espaces — la signature porte sur cette forme. */
|
|
81
|
+
export function canonicalStringify(value) {
|
|
82
|
+
return JSON.stringify(sortValue(value));
|
|
83
|
+
}
|
|
84
|
+
function sortValue(value) {
|
|
85
|
+
if (Array.isArray(value))
|
|
86
|
+
return value.map(sortValue);
|
|
87
|
+
if (value !== null && typeof value === 'object') {
|
|
88
|
+
const out = {};
|
|
89
|
+
for (const key of Object.keys(value).sort()) {
|
|
90
|
+
const v = value[key];
|
|
91
|
+
if (v !== undefined)
|
|
92
|
+
out[key] = sortValue(v);
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
/** Vérification hors ligne d'un verdict signé, contre la pubkey publiée à /.well-known/rempart-pubkey.json. */
|
|
99
|
+
export function verifyScoreResponse(response, publicKeyHex) {
|
|
100
|
+
const { signature, key_id: _keyId, ...unsigned } = response;
|
|
101
|
+
if (!signature)
|
|
102
|
+
return false;
|
|
103
|
+
try {
|
|
104
|
+
return ed.verify(hexToBytes(signature), utf8ToBytes(canonicalStringify(unsigned)), hexToBytes(publicKeyHex));
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,EAAE,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,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AC;YAClD,IAAI,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,mBAAmB,CAAC,QAAuB,EAAE,YAAoB;IAC/E,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,GAAG,QAAQ,CAAC;IAC5D,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IAC7B,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/G,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ScoreResponse } from './contract.js';
|
|
2
|
+
export { canonicalStringify, FeaturesSchema, ReasonSchema, ScoreResponseSchema, VerdictSchema, verifyScoreResponse, } from './contract.js';
|
|
3
|
+
export type { Features, Reason, ScoreResponse, Verdict } from './contract.js';
|
|
4
|
+
/**
|
|
5
|
+
* Callback x402: reçoit les exigences de paiement du 402 (accepts[0]) et retourne
|
|
6
|
+
* la preuve encodée base64 pour l'en-tête X-PAYMENT. L'injection évite toute
|
|
7
|
+
* dépendance lourde: @solana/web3.js reste chez l'appelant (peer optionnelle).
|
|
8
|
+
*/
|
|
9
|
+
export type X402Payer = (accepts: Record<string, unknown>) => Promise<string>;
|
|
10
|
+
export interface RempartOptions {
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
payer?: X402Payer;
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
maxRetries?: number;
|
|
15
|
+
fetchImpl?: typeof fetch;
|
|
16
|
+
}
|
|
17
|
+
export declare class RempartError extends Error {
|
|
18
|
+
readonly status: number;
|
|
19
|
+
readonly body: unknown;
|
|
20
|
+
constructor(message: string, status: number, body: unknown);
|
|
21
|
+
}
|
|
22
|
+
export declare class Rempart {
|
|
23
|
+
private readonly baseUrl;
|
|
24
|
+
private readonly apiKey;
|
|
25
|
+
private readonly payer;
|
|
26
|
+
private readonly maxRetries;
|
|
27
|
+
private readonly fetchImpl;
|
|
28
|
+
private pubkeyCache;
|
|
29
|
+
constructor(opts?: RempartOptions);
|
|
30
|
+
/** Verdict standard (0.05 $). */
|
|
31
|
+
score(mint: string): Promise<ScoreResponse>;
|
|
32
|
+
/** Verdict + funding graph complet (0.15 $). */
|
|
33
|
+
scoreDeep(mint: string): Promise<ScoreResponse & {
|
|
34
|
+
funding_graph?: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
/** Solde et conso (rail clé prépayée uniquement). */
|
|
37
|
+
account(): Promise<Record<string, unknown>>;
|
|
38
|
+
pricing(): Promise<Record<string, unknown>>;
|
|
39
|
+
/** Vérification ed25519 hors ligne contre la pubkey publiée (mise en cache). */
|
|
40
|
+
verifySignature(response: ScoreResponse, publicKeyHex?: string): Promise<boolean>;
|
|
41
|
+
private publishedKey;
|
|
42
|
+
private paidGet;
|
|
43
|
+
/** Retries: 429 et 5xx avec backoff exponentiel. Jamais sur 402 ni 4xx. */
|
|
44
|
+
private request;
|
|
45
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ScoreResponseSchema, verifyScoreResponse, } from './contract.js';
|
|
2
|
+
export { canonicalStringify, FeaturesSchema, ReasonSchema, ScoreResponseSchema, VerdictSchema, verifyScoreResponse, } from './contract.js';
|
|
3
|
+
export class RempartError extends Error {
|
|
4
|
+
status;
|
|
5
|
+
body;
|
|
6
|
+
constructor(message, status, body) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.body = body;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class Rempart {
|
|
13
|
+
baseUrl;
|
|
14
|
+
apiKey;
|
|
15
|
+
payer;
|
|
16
|
+
maxRetries;
|
|
17
|
+
fetchImpl;
|
|
18
|
+
pubkeyCache = null;
|
|
19
|
+
constructor(opts = {}) {
|
|
20
|
+
this.baseUrl = (opts.baseUrl ?? 'https://api.rempart.example').replace(/\/$/, '');
|
|
21
|
+
this.apiKey = opts.apiKey;
|
|
22
|
+
this.payer = opts.payer;
|
|
23
|
+
this.maxRetries = opts.maxRetries ?? 3;
|
|
24
|
+
this.fetchImpl = opts.fetchImpl ?? fetch;
|
|
25
|
+
}
|
|
26
|
+
/** Verdict standard (0.05 $). */
|
|
27
|
+
score(mint) {
|
|
28
|
+
return this.paidGet(`/v1/score/${mint}`).then((b) => ScoreResponseSchema.passthrough().parse(b));
|
|
29
|
+
}
|
|
30
|
+
/** Verdict + funding graph complet (0.15 $). */
|
|
31
|
+
scoreDeep(mint) {
|
|
32
|
+
return this.paidGet(`/v1/score/${mint}/deep`).then((b) => ScoreResponseSchema.passthrough().parse(b));
|
|
33
|
+
}
|
|
34
|
+
/** Solde et conso (rail clé prépayée uniquement). */
|
|
35
|
+
async account() {
|
|
36
|
+
if (!this.apiKey)
|
|
37
|
+
throw new Error('account() nécessite une apiKey (les payeurs x402 n’ont pas de solde chez nous)');
|
|
38
|
+
const res = await this.request(`${this.baseUrl}/v1/account`, { headers: { Authorization: `Bearer ${this.apiKey}` } });
|
|
39
|
+
return (await res.json());
|
|
40
|
+
}
|
|
41
|
+
async pricing() {
|
|
42
|
+
const res = await this.request(`${this.baseUrl}/pricing`, {});
|
|
43
|
+
return (await res.json());
|
|
44
|
+
}
|
|
45
|
+
/** Vérification ed25519 hors ligne contre la pubkey publiée (mise en cache). */
|
|
46
|
+
async verifySignature(response, publicKeyHex) {
|
|
47
|
+
const pub = publicKeyHex ?? (await this.publishedKey());
|
|
48
|
+
return verifyScoreResponse(response, pub);
|
|
49
|
+
}
|
|
50
|
+
async publishedKey() {
|
|
51
|
+
if (this.pubkeyCache)
|
|
52
|
+
return this.pubkeyCache;
|
|
53
|
+
const res = await this.request(`${this.baseUrl}/.well-known/rempart-pubkey.json`, {});
|
|
54
|
+
const body = (await res.json());
|
|
55
|
+
this.pubkeyCache = body.public_key_hex;
|
|
56
|
+
return this.pubkeyCache;
|
|
57
|
+
}
|
|
58
|
+
async paidGet(path) {
|
|
59
|
+
const url = `${this.baseUrl}${path}`;
|
|
60
|
+
const headers = {};
|
|
61
|
+
if (this.apiKey)
|
|
62
|
+
headers.Authorization = `Bearer ${this.apiKey}`;
|
|
63
|
+
let res = await this.request(url, { headers }, { allow402: true });
|
|
64
|
+
if (res.status === 402 && this.payer) {
|
|
65
|
+
// mode x402: payer puis rejouer avec la preuve. Jamais de retry automatique sur 402 (spec plan-06).
|
|
66
|
+
const body = (await res.json());
|
|
67
|
+
const accepts = body.accepts?.[0];
|
|
68
|
+
if (!accepts)
|
|
69
|
+
throw new RempartError('402 sans accepts[]', 402, body);
|
|
70
|
+
const proof = await this.payer(accepts);
|
|
71
|
+
res = await this.request(url, { headers: { ...headers, 'X-PAYMENT': proof } }, { allow402: true });
|
|
72
|
+
}
|
|
73
|
+
if (res.status === 402) {
|
|
74
|
+
throw new RempartError('payment required: fournir apiKey (créditée) ou payer x402', 402, await res.json());
|
|
75
|
+
}
|
|
76
|
+
if (!res.ok)
|
|
77
|
+
throw new RempartError(`HTTP ${res.status}`, res.status, await res.json().catch(() => null));
|
|
78
|
+
return res.json();
|
|
79
|
+
}
|
|
80
|
+
/** Retries: 429 et 5xx avec backoff exponentiel. Jamais sur 402 ni 4xx. */
|
|
81
|
+
async request(url, init, opts = {}) {
|
|
82
|
+
let last = null;
|
|
83
|
+
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
84
|
+
const res = await this.fetchImpl(url, init);
|
|
85
|
+
if (res.status === 429 || res.status >= 500) {
|
|
86
|
+
last = res;
|
|
87
|
+
const retryAfter = Number(res.headers.get('Retry-After') ?? 0);
|
|
88
|
+
const delay = retryAfter > 0 ? retryAfter * 1000 : 250 * 2 ** attempt;
|
|
89
|
+
await new Promise((r) => setTimeout(r, Math.min(delay, 5000)));
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (!opts.allow402 && res.status === 402)
|
|
93
|
+
return res;
|
|
94
|
+
return res;
|
|
95
|
+
}
|
|
96
|
+
return last;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,GAEpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAkBvB,MAAM,OAAO,YAAa,SAAQ,KAAK;IAGnB;IACA;IAHlB,YACE,OAAe,EACC,MAAc,EACd,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAS;IAG/B,CAAC;CACF;AAED,MAAM,OAAO,OAAO;IACD,OAAO,CAAS;IAChB,MAAM,CAAqB;IAC3B,KAAK,CAAwB;IAC7B,UAAU,CAAS;IACnB,SAAS,CAAe;IACjC,WAAW,GAAkB,IAAI,CAAC;IAE1C,YAAY,OAAuB,EAAE;QACnC,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,6BAA6B,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,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CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC/D,MAAM,KAAK,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,OAAO,CAAC;gBACtE,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC/D,SAAS;YACX,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;gBAAE,OAAO,GAAG,CAAC;YACrD,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,IAAgB,CAAC;IAC1B,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rempart/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Signed anti-scam verdicts for Solana tokens. One call, one USDC micropayment (x402) or prepaid key.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"CHANGELOG.md"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://rempart.app",
|
|
24
|
+
"keywords": [
|
|
25
|
+
"solana",
|
|
26
|
+
"anti-scam",
|
|
27
|
+
"rug-check",
|
|
28
|
+
"x402",
|
|
29
|
+
"trading-bot",
|
|
30
|
+
"token-security"
|
|
31
|
+
],
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@noble/ed25519": "^2.2.3",
|
|
34
|
+
"@noble/hashes": "^1.7.1",
|
|
35
|
+
"zod": "^3.25.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^22.10.0",
|
|
39
|
+
"typescript": "^5.9.3",
|
|
40
|
+
"vitest": "^3.2.4",
|
|
41
|
+
"@rempart/core": "0.1.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.json",
|
|
45
|
+
"test": "vitest run"
|
|
46
|
+
}
|
|
47
|
+
}
|