@oobe-protocol-labs/synapse-sap-sdk 0.10.1 → 0.11.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/dist/cjs/core/client.js +46 -0
- package/dist/cjs/core/client.js.map +1 -1
- package/dist/cjs/registries/fairscale.js +639 -0
- package/dist/cjs/registries/fairscale.js.map +1 -0
- package/dist/cjs/registries/index.js +6 -1
- package/dist/cjs/registries/index.js.map +1 -1
- package/dist/esm/core/client.js +46 -0
- package/dist/esm/core/client.js.map +1 -1
- package/dist/esm/registries/fairscale.js +633 -0
- package/dist/esm/registries/fairscale.js.map +1 -0
- package/dist/esm/registries/index.js +1 -0
- package/dist/esm/registries/index.js.map +1 -1
- package/dist/types/core/client.d.ts +39 -0
- package/dist/types/core/client.d.ts.map +1 -1
- package/dist/types/registries/fairscale.d.ts +680 -0
- package/dist/types/registries/fairscale.d.ts.map +1 -0
- package/dist/types/registries/index.d.ts +2 -0
- package/dist/types/registries/index.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/core/client.ts +51 -0
- package/src/registries/fairscale.ts +1278 -0
- package/src/registries/index.ts +46 -0
|
@@ -0,0 +1,639 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module registries/fairscale
|
|
4
|
+
* @description FairScale reputation aggregation registry.
|
|
5
|
+
*
|
|
6
|
+
* Wraps both FairScale REST APIs:
|
|
7
|
+
* - **Agent & Credit API** (`agent-api.fairscale.xyz`) — agent trust score,
|
|
8
|
+
* trust gate, batch scoring, composable score, agent profile, score
|
|
9
|
+
* history, directory, leaderboard, credit assessment.
|
|
10
|
+
* - **Human Score API** (`api.fairscale.xyz`) — human wallet fingerprint,
|
|
11
|
+
* FairScore, on-chain features, badges.
|
|
12
|
+
*
|
|
13
|
+
* The killer feature is {@link FairScaleRegistry.aggregate}: it merges
|
|
14
|
+
* SAP's **on-chain** reputation (`AgentAccount.reputationScore` +
|
|
15
|
+
* feedback count + activity signals) with FairScale's **off-chain**
|
|
16
|
+
* trust score into a single normalised, weight-tunable signal. Apps
|
|
17
|
+
* therefore get a multi-source reputation rather than relying on either
|
|
18
|
+
* registry alone.
|
|
19
|
+
*
|
|
20
|
+
* Zero runtime dependencies — uses native `fetch` (Node ≥18, browsers,
|
|
21
|
+
* Edge runtimes). Auth via `fairkey` (or `X-Api-Key` for credit).
|
|
22
|
+
*
|
|
23
|
+
* @category Registries
|
|
24
|
+
* @since v0.11.0
|
|
25
|
+
*
|
|
26
|
+
* @example Standalone usage (just the FairScale wrapper)
|
|
27
|
+
* ```ts
|
|
28
|
+
* const fs = client.fairscale;
|
|
29
|
+
* const score = await fs.score(agentWallet);
|
|
30
|
+
* const allowed = await fs.trustGate(agentWallet, { minScore: 60 });
|
|
31
|
+
* const profile = await fs.agentProfile(agentWallet);
|
|
32
|
+
* const human = await fs.human.score(userWallet);
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Aggregated reputation (SAP + FairScale)
|
|
36
|
+
* ```ts
|
|
37
|
+
* const merged = await client.fairscale.aggregate(agentWallet, {
|
|
38
|
+
* weights: { sap: 0.4, fairscale: 0.6 },
|
|
39
|
+
* require: { sapMinFeedbacks: 1 },
|
|
40
|
+
* });
|
|
41
|
+
* console.log(merged.combined.score, merged.combined.tier);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.HumanScoreNamespace = exports.FairScaleRegistry = exports.FAIRSCALE = exports.FairScaleError = void 0;
|
|
46
|
+
const errors_1 = require("../errors");
|
|
47
|
+
const discovery_1 = require("./discovery");
|
|
48
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
49
|
+
// Errors
|
|
50
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
51
|
+
/**
|
|
52
|
+
* @name FairScaleError
|
|
53
|
+
* @description Thrown for any non-2xx response from a FairScale endpoint
|
|
54
|
+
* or for client-side validation failures (missing API key, invalid
|
|
55
|
+
* weights, etc.).
|
|
56
|
+
* @category Errors
|
|
57
|
+
* @since v0.11.0
|
|
58
|
+
* @extends SapError
|
|
59
|
+
*/
|
|
60
|
+
class FairScaleError extends errors_1.SapError {
|
|
61
|
+
/** HTTP status from FairScale (0 for client-side errors). */
|
|
62
|
+
status;
|
|
63
|
+
/** FairScale error code from the response body, if any. */
|
|
64
|
+
upstreamCode;
|
|
65
|
+
constructor(message, status, upstreamCode) {
|
|
66
|
+
super(message, "FAIRSCALE_ERROR");
|
|
67
|
+
this.name = "FairScaleError";
|
|
68
|
+
this.status = status;
|
|
69
|
+
this.upstreamCode = upstreamCode;
|
|
70
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.FairScaleError = FairScaleError;
|
|
74
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
75
|
+
// Constants — verified against docs.fairscale.xyz
|
|
76
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
77
|
+
/**
|
|
78
|
+
* @name FAIRSCALE
|
|
79
|
+
* @description Public, documented constants for the FairScale platform.
|
|
80
|
+
* Verified against the docs at https://docs.fairscale.xyz on 2026-04-17.
|
|
81
|
+
* Use these instead of hard-coding strings — guarantees consistency across
|
|
82
|
+
* the SDK and any consumer code.
|
|
83
|
+
* @category Registries
|
|
84
|
+
* @since v0.11.0
|
|
85
|
+
*/
|
|
86
|
+
exports.FAIRSCALE = Object.freeze({
|
|
87
|
+
/** Agent & Credit API host. */
|
|
88
|
+
AGENT_API: "https://agent-api.fairscale.xyz",
|
|
89
|
+
/** Human Score API host. */
|
|
90
|
+
HUMAN_API: "https://api.fairscale.xyz",
|
|
91
|
+
/** Default request timeout matching the official SDK (10s). */
|
|
92
|
+
DEFAULT_TIMEOUT_MS: 10_000,
|
|
93
|
+
/** Server-side cache TTL on every endpoint (15 min). */
|
|
94
|
+
CACHE_TTL_SECONDS: 15 * 60,
|
|
95
|
+
/** Max wallets per `POST /v1/score/batch` request. */
|
|
96
|
+
BATCH_MAX_WALLETS: 25,
|
|
97
|
+
/** API key prefix. */
|
|
98
|
+
API_KEY_PREFIX: "zpka_",
|
|
99
|
+
/** Default `min_score` for `/v1/trust-gate`. */
|
|
100
|
+
DEFAULT_TRUST_GATE_MIN_SCORE: 40,
|
|
101
|
+
/** x402 micropayment metadata (Solana mainnet). */
|
|
102
|
+
X402: Object.freeze({
|
|
103
|
+
/** USDC mint on Solana mainnet. */
|
|
104
|
+
USDC_MINT: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
105
|
+
/** Wallet receiving x402 payments. */
|
|
106
|
+
PAY_TO: "fairAUEuR1SCcHL254Vb3F3XpUWLruJ2a11f6QfANEN",
|
|
107
|
+
/** Solana mainnet x402 network slug. */
|
|
108
|
+
NETWORK: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
|
|
109
|
+
/** Facilitator host. */
|
|
110
|
+
FACILITATOR: "https://x402.dexter.cash",
|
|
111
|
+
/** Price in USDC base units (micro-USDC) per agent / trust call. */
|
|
112
|
+
PRICE_AGENT_USDC_BASE: 5_000,
|
|
113
|
+
/** Price in USDC base units (micro-USDC) per credit assessment. */
|
|
114
|
+
PRICE_CREDIT_USDC_BASE: 500_000,
|
|
115
|
+
/** Default x402 settlement timeout (seconds). */
|
|
116
|
+
MAX_TIMEOUT_SECONDS: 60,
|
|
117
|
+
}),
|
|
118
|
+
/** Documented agent-tier ranges (inclusive). */
|
|
119
|
+
AGENT_TIER_RANGES: Object.freeze({
|
|
120
|
+
bronze: [0, 39],
|
|
121
|
+
silver: [40, 54],
|
|
122
|
+
gold: [55, 69],
|
|
123
|
+
platinum: [70, 84],
|
|
124
|
+
diamond: [85, 100],
|
|
125
|
+
}),
|
|
126
|
+
/** Documented credit `risk_band` ranges (inclusive). */
|
|
127
|
+
RISK_BAND_RANGES: Object.freeze({
|
|
128
|
+
decline: [0, 24],
|
|
129
|
+
deep_subprime: [25, 44],
|
|
130
|
+
subprime: [45, 59],
|
|
131
|
+
near_prime: [60, 74],
|
|
132
|
+
prime: [75, 100],
|
|
133
|
+
}),
|
|
134
|
+
/** Plan tiers — daily request quota / per-minute rate limit. */
|
|
135
|
+
PLAN_QUOTAS: Object.freeze({
|
|
136
|
+
free: { dailyRequests: 1_000, rpm: 10 },
|
|
137
|
+
builder: { dailyRequests: 20_000, rpm: 100 },
|
|
138
|
+
scale: { dailyRequests: 50_000, rpm: 300 },
|
|
139
|
+
pro: { dailyRequests: 100_000, rpm: 600 },
|
|
140
|
+
}),
|
|
141
|
+
/** Pillar weights for `/v1/score/ai` presets, exactly as documented. */
|
|
142
|
+
PRESET_WEIGHTS: Object.freeze({
|
|
143
|
+
default: { verification: 0.30, wallet_history: 0.25, work_history: 0.10, network_quality: 0.25, peer_reputation: 0.10 },
|
|
144
|
+
trust_focused: { verification: 0.50, wallet_history: 0.20, work_history: 0.10, network_quality: 0.10, peer_reputation: 0.10 },
|
|
145
|
+
work_focused: { verification: 0.20, wallet_history: 0.15, work_history: 0.40, network_quality: 0.15, peer_reputation: 0.10 },
|
|
146
|
+
defi: { verification: 0.25, wallet_history: 0.30, work_history: 0.10, network_quality: 0.25, peer_reputation: 0.10 },
|
|
147
|
+
hiring: { verification: 0.35, wallet_history: 0.15, work_history: 0.25, network_quality: 0.15, peer_reputation: 0.10 },
|
|
148
|
+
}),
|
|
149
|
+
/** Allowed sort fields for `/v1/directory` and `/v1/leaderboard`. */
|
|
150
|
+
DIRECTORY_SORT_FIELDS: [
|
|
151
|
+
"agent_fairscore",
|
|
152
|
+
"verification",
|
|
153
|
+
"wallet_history",
|
|
154
|
+
"work_history",
|
|
155
|
+
"network_quality",
|
|
156
|
+
"peer_reputation",
|
|
157
|
+
"reliability",
|
|
158
|
+
"track_record",
|
|
159
|
+
"economic_stake",
|
|
160
|
+
"ecosystem",
|
|
161
|
+
],
|
|
162
|
+
/** Documented machine-readable error codes. */
|
|
163
|
+
ERROR_CODES: [
|
|
164
|
+
"missing_wallet",
|
|
165
|
+
"invalid_wallet",
|
|
166
|
+
"invalid_preset",
|
|
167
|
+
"weights_must_sum_to_1",
|
|
168
|
+
"missing_weights",
|
|
169
|
+
"too_many_wallets",
|
|
170
|
+
"daily_limit_exceeded",
|
|
171
|
+
"upstream_error",
|
|
172
|
+
],
|
|
173
|
+
});
|
|
174
|
+
const DEFAULT_BASE_URL = "https://agent-api.fairscale.xyz";
|
|
175
|
+
const DEFAULT_HUMAN_BASE_URL = "https://api.fairscale.xyz";
|
|
176
|
+
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
177
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
178
|
+
// Registry
|
|
179
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
180
|
+
/**
|
|
181
|
+
* @name FairScaleRegistry
|
|
182
|
+
* @description High-level FairScale client + SAP reputation aggregator.
|
|
183
|
+
* Exposed lazily as `client.fairscale`.
|
|
184
|
+
* @category Registries
|
|
185
|
+
* @since v0.11.0
|
|
186
|
+
*/
|
|
187
|
+
class FairScaleRegistry {
|
|
188
|
+
#program;
|
|
189
|
+
#apiKey;
|
|
190
|
+
#baseUrl;
|
|
191
|
+
#humanBaseUrl;
|
|
192
|
+
#timeoutMs;
|
|
193
|
+
#fetch;
|
|
194
|
+
#discovery;
|
|
195
|
+
#human;
|
|
196
|
+
constructor(program, config = {}) {
|
|
197
|
+
this.#program = program;
|
|
198
|
+
this.#apiKey =
|
|
199
|
+
config.apiKey ??
|
|
200
|
+
(typeof process !== "undefined"
|
|
201
|
+
? process.env?.FAIRSCALE_API_KEY
|
|
202
|
+
: undefined);
|
|
203
|
+
this.#baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
204
|
+
this.#humanBaseUrl = (config.humanBaseUrl ?? DEFAULT_HUMAN_BASE_URL).replace(/\/+$/, "");
|
|
205
|
+
this.#timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
206
|
+
if (config.fetch) {
|
|
207
|
+
this.#fetch = config.fetch;
|
|
208
|
+
}
|
|
209
|
+
else if (typeof fetch !== "undefined") {
|
|
210
|
+
this.#fetch = fetch.bind(globalThis);
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
throw new FairScaleError("global `fetch` not available — pass `config.fetch`", 0, "no_fetch");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/** Lazy DiscoveryRegistry, used by `aggregate()` to read on-chain SAP state. */
|
|
217
|
+
get #disc() {
|
|
218
|
+
return (this.#discovery ??= new discovery_1.DiscoveryRegistry(this.#program));
|
|
219
|
+
}
|
|
220
|
+
/** Human Score API namespace (`client.fairscale.human.*`). */
|
|
221
|
+
get human() {
|
|
222
|
+
return (this.#human ??= new HumanScoreNamespace(this.#humanBaseUrl, this.#apiKey, this.#timeoutMs, this.#fetch));
|
|
223
|
+
}
|
|
224
|
+
// ── Agent & Credit API ────────────────────────────────────────────
|
|
225
|
+
/**
|
|
226
|
+
* @description `GET /v1/score` — composite trust score.
|
|
227
|
+
*/
|
|
228
|
+
score(agent, opts = {}) {
|
|
229
|
+
const wallet = toWallet(agent);
|
|
230
|
+
const url = this.#url("/v1/score", { wallet, task: opts.task });
|
|
231
|
+
return this.#getJson(url, opts);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* @description `GET /v1/trust-gate` — binary allow/deny.
|
|
235
|
+
*/
|
|
236
|
+
trustGate(agent, opts = {}) {
|
|
237
|
+
const wallet = toWallet(agent);
|
|
238
|
+
const url = this.#url("/v1/trust-gate", {
|
|
239
|
+
wallet,
|
|
240
|
+
task: opts.task,
|
|
241
|
+
min_score: opts.minScore,
|
|
242
|
+
require_verification: opts.requireVerification,
|
|
243
|
+
});
|
|
244
|
+
return this.#getJson(url, opts);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* @description `POST /v1/score/batch` — up to 25 wallets per call.
|
|
248
|
+
* Splits larger inputs into chunks of 25 and merges results.
|
|
249
|
+
*/
|
|
250
|
+
async scoreBatch(agents, opts = {}) {
|
|
251
|
+
const wallets = agents.map(toWallet);
|
|
252
|
+
if (wallets.length === 0) {
|
|
253
|
+
return { total: 0, scored: 0, results: [] };
|
|
254
|
+
}
|
|
255
|
+
const chunks = [];
|
|
256
|
+
for (let i = 0; i < wallets.length; i += 25) {
|
|
257
|
+
chunks.push(wallets.slice(i, i + 25));
|
|
258
|
+
}
|
|
259
|
+
const responses = await Promise.all(chunks.map((chunk) => this.#postJson(this.#url("/v1/score/batch"), opts, {
|
|
260
|
+
wallets: chunk,
|
|
261
|
+
task: opts.task,
|
|
262
|
+
})));
|
|
263
|
+
const merged = {
|
|
264
|
+
total: wallets.length,
|
|
265
|
+
scored: responses.reduce((acc, r) => acc + r.scored, 0),
|
|
266
|
+
results: responses.flatMap((r) => r.results),
|
|
267
|
+
meta: responses[0]?.meta,
|
|
268
|
+
};
|
|
269
|
+
return merged;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* @description `GET /v1/score/ai` — composable score with preset or custom weights.
|
|
273
|
+
*/
|
|
274
|
+
scoreAI(agent, opts) {
|
|
275
|
+
if (!opts.preset && !opts.weights) {
|
|
276
|
+
throw new FairScaleError("scoreAI requires either `preset` or `weights`", 0, "missing_preset_or_weights");
|
|
277
|
+
}
|
|
278
|
+
if (opts.weights) {
|
|
279
|
+
const sum = Object.values(opts.weights).reduce((a, b) => a + (b ?? 0), 0);
|
|
280
|
+
if (Math.abs(sum - 1) > 0.02) {
|
|
281
|
+
throw new FairScaleError(`custom weights must sum to 1.0 (±0.02), got ${sum}`, 0, "weights_must_sum_to_1");
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
const url = this.#url("/v1/score/ai", {
|
|
285
|
+
wallet: toWallet(agent),
|
|
286
|
+
preset: opts.preset,
|
|
287
|
+
...(opts.weights ?? {}),
|
|
288
|
+
});
|
|
289
|
+
return this.#getJson(url, opts);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* @description `GET /v1/agent` — full agent profile (registry details + scoring data).
|
|
293
|
+
*/
|
|
294
|
+
agentProfile(agent, opts = {}) {
|
|
295
|
+
const url = this.#url("/v1/agent", { wallet: toWallet(agent) });
|
|
296
|
+
return this.#getJson(url, opts);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* @description `GET /v1/score-history` — score trend over time.
|
|
300
|
+
*/
|
|
301
|
+
scoreHistory(agent, opts = {}) {
|
|
302
|
+
const url = this.#url("/v1/score-history", { wallet: toWallet(agent) });
|
|
303
|
+
return this.#getJson(url, opts);
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* @description `GET /v1/directory` — query the indexed agent directory.
|
|
307
|
+
*/
|
|
308
|
+
directory(opts = {}) {
|
|
309
|
+
const url = this.#url("/v1/directory", {
|
|
310
|
+
page: opts.page,
|
|
311
|
+
limit: opts.limit,
|
|
312
|
+
sort: opts.sort,
|
|
313
|
+
min_score: opts.minScore,
|
|
314
|
+
verified_only: opts.verifiedOnly,
|
|
315
|
+
recommendation: opts.recommendation,
|
|
316
|
+
source: opts.source,
|
|
317
|
+
search: opts.search,
|
|
318
|
+
has_attestations: opts.hasAttestations,
|
|
319
|
+
});
|
|
320
|
+
return this.#getJson(url, opts);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* @description `GET /v1/leaderboard` — top-scoring agents by metric.
|
|
324
|
+
*/
|
|
325
|
+
leaderboard(opts = {}) {
|
|
326
|
+
const url = this.#url("/v1/leaderboard", {
|
|
327
|
+
metric: opts.metric,
|
|
328
|
+
limit: opts.limit,
|
|
329
|
+
});
|
|
330
|
+
return this.#getJson(url, opts);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* @description `GET /v1/credit` — full credit assessment ($0.50 USDC per call).
|
|
334
|
+
* Uses `X-Api-Key` header instead of `fairkey`. Wire-format for `nocache`
|
|
335
|
+
* is `0|1` per the docs; the SDK accepts a boolean and converts it.
|
|
336
|
+
*/
|
|
337
|
+
credit(agent, opts = {}) {
|
|
338
|
+
const url = this.#url("/v1/credit", {
|
|
339
|
+
wallet: toWallet(agent),
|
|
340
|
+
amount: opts.amount,
|
|
341
|
+
nocache: opts.nocache === undefined ? undefined : opts.nocache ? 1 : 0,
|
|
342
|
+
});
|
|
343
|
+
return this.#getJson(url, opts, {
|
|
344
|
+
authHeader: "X-Api-Key",
|
|
345
|
+
extraHeaders: opts.socialIdentity
|
|
346
|
+
? { "x-social-identity": opts.socialIdentity }
|
|
347
|
+
: undefined,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
// ── Aggregation (SAP + FairScale) ─────────────────────────────────
|
|
351
|
+
/**
|
|
352
|
+
* @description Merge SAP on-chain reputation with FairScale into a single
|
|
353
|
+
* weighted signal. Falls back gracefully if either source is unavailable.
|
|
354
|
+
*
|
|
355
|
+
* @param agentWallet - The agent's owner wallet (NOT the agent PDA).
|
|
356
|
+
* @param opts - Weights, gating rules, and per-call overrides.
|
|
357
|
+
* @returns {Promise<AggregatedReputation>}
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```ts
|
|
361
|
+
* const r = await client.fairscale.aggregate(agentWallet, {
|
|
362
|
+
* weights: { sap: 0.4, fairscale: 0.6 },
|
|
363
|
+
* require: { sapMinFeedbacks: 2 },
|
|
364
|
+
* });
|
|
365
|
+
* if (r.combined.tier === "high" || r.combined.tier === "elite") accept();
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
async aggregate(agentWallet, opts = {}) {
|
|
369
|
+
const w = opts.weights ?? { sap: 0.5, fairscale: 0.5 };
|
|
370
|
+
if (Math.abs(w.sap + w.fairscale - 1) > 0.01) {
|
|
371
|
+
throw new FairScaleError(`aggregate weights must sum to 1.0 (±0.01), got ${w.sap + w.fairscale}`, 0, "weights_must_sum_to_1");
|
|
372
|
+
}
|
|
373
|
+
const minFeedbacks = opts.require?.sapMinFeedbacks ?? 0;
|
|
374
|
+
const [sapProfile, fsScore] = await Promise.allSettled([
|
|
375
|
+
this.#disc.getAgentProfile(agentWallet),
|
|
376
|
+
this.score(agentWallet, opts),
|
|
377
|
+
]);
|
|
378
|
+
const notes = [];
|
|
379
|
+
// ── SAP slice ───────────────────────────────────────────────
|
|
380
|
+
const sapResult = sapProfile.status === "fulfilled" ? sapProfile.value : null;
|
|
381
|
+
const sapScore = extractSapScore(sapResult, minFeedbacks, notes);
|
|
382
|
+
// ── FairScale slice ─────────────────────────────────────────
|
|
383
|
+
const fairscale = fsScore.status === "fulfilled" ? fsScore.value : null;
|
|
384
|
+
if (fsScore.status === "rejected") {
|
|
385
|
+
notes.push(`fairscale_unavailable:${fsScore.reason?.message ?? "unknown"}`);
|
|
386
|
+
}
|
|
387
|
+
if (fairscale?.red_flags?.length) {
|
|
388
|
+
notes.push(`red_flags:${fairscale.red_flags.length}`);
|
|
389
|
+
}
|
|
390
|
+
if (fairscale?.meta?.from_cache)
|
|
391
|
+
notes.push("fairscale_cache_hit");
|
|
392
|
+
// ── Blend ───────────────────────────────────────────────────
|
|
393
|
+
const sapAvail = sapScore !== null ? w.sap : 0;
|
|
394
|
+
const fsAvail = fairscale ? w.fairscale : 0;
|
|
395
|
+
const totalW = sapAvail + fsAvail;
|
|
396
|
+
let combinedScore = 0;
|
|
397
|
+
let weights = { sap: 0, fairscale: 0 };
|
|
398
|
+
if (totalW === 0) {
|
|
399
|
+
if (opts.strict) {
|
|
400
|
+
throw new FairScaleError("no reputation source available (strict mode)", 0, "no_source");
|
|
401
|
+
}
|
|
402
|
+
notes.push("no_source");
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
const sapNorm = sapAvail / totalW;
|
|
406
|
+
const fsNorm = fsAvail / totalW;
|
|
407
|
+
combinedScore =
|
|
408
|
+
(sapScore ?? 0) * sapNorm + (fairscale?.score ?? 0) * fsNorm;
|
|
409
|
+
weights = { sap: round2(sapNorm), fairscale: round2(fsNorm) };
|
|
410
|
+
}
|
|
411
|
+
// ── Confidence ──────────────────────────────────────────────
|
|
412
|
+
let confidence = 1;
|
|
413
|
+
if (sapScore === null)
|
|
414
|
+
confidence -= 0.35;
|
|
415
|
+
if (!fairscale)
|
|
416
|
+
confidence -= 0.35;
|
|
417
|
+
if (sapResult && sapResult.identity.totalFeedbacks < 3)
|
|
418
|
+
confidence -= 0.1;
|
|
419
|
+
if (fairscale?.meta?.from_cache)
|
|
420
|
+
confidence -= 0.05;
|
|
421
|
+
if (fairscale?.red_flags?.length) {
|
|
422
|
+
confidence -= Math.min(0.2, fairscale.red_flags.length * 0.05);
|
|
423
|
+
}
|
|
424
|
+
confidence = Math.max(0, Math.min(1, confidence));
|
|
425
|
+
return {
|
|
426
|
+
wallet: agentWallet.toBase58(),
|
|
427
|
+
sap: {
|
|
428
|
+
registered: sapResult !== null,
|
|
429
|
+
score: sapScore,
|
|
430
|
+
totalFeedbacks: sapResult?.identity.totalFeedbacks ?? 0,
|
|
431
|
+
totalCallsServed: sapResult?.identity.totalCallsServed.toString() ?? "0",
|
|
432
|
+
isActive: sapResult?.identity.isActive ?? false,
|
|
433
|
+
},
|
|
434
|
+
fairscale,
|
|
435
|
+
combined: {
|
|
436
|
+
score: round2(Math.max(0, Math.min(100, combinedScore))),
|
|
437
|
+
tier: bucketTier(combinedScore),
|
|
438
|
+
confidence: round2(confidence),
|
|
439
|
+
weights,
|
|
440
|
+
notes,
|
|
441
|
+
},
|
|
442
|
+
meta: {
|
|
443
|
+
provider: "SAP+FairScale",
|
|
444
|
+
computedAt: new Date().toISOString(),
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
// ── HTTP plumbing ─────────────────────────────────────────────────
|
|
449
|
+
#url(path, params) {
|
|
450
|
+
const u = new URL(this.#baseUrl + path);
|
|
451
|
+
if (params) {
|
|
452
|
+
for (const [k, v] of Object.entries(params)) {
|
|
453
|
+
if (v === undefined || v === null)
|
|
454
|
+
continue;
|
|
455
|
+
u.searchParams.set(k, String(v));
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return u.toString();
|
|
459
|
+
}
|
|
460
|
+
async #getJson(url, opts, extra = {}) {
|
|
461
|
+
return this.#request(url, "GET", undefined, opts, extra.authHeader, extra.extraHeaders);
|
|
462
|
+
}
|
|
463
|
+
async #postJson(url, opts, body) {
|
|
464
|
+
return this.#request(url, "POST", body, opts);
|
|
465
|
+
}
|
|
466
|
+
async #request(url, method, body, opts, authHeader = "fairkey", extraHeaders) {
|
|
467
|
+
const apiKey = opts.apiKey ?? this.#apiKey;
|
|
468
|
+
const headers = { Accept: "application/json" };
|
|
469
|
+
if (apiKey)
|
|
470
|
+
headers[authHeader] = apiKey;
|
|
471
|
+
if (body !== undefined)
|
|
472
|
+
headers["Content-Type"] = "application/json";
|
|
473
|
+
if (extraHeaders)
|
|
474
|
+
Object.assign(headers, extraHeaders);
|
|
475
|
+
const ctrl = new AbortController();
|
|
476
|
+
const timeoutMs = opts.timeoutMs ?? this.#timeoutMs;
|
|
477
|
+
const timeout = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
478
|
+
if (opts.signal) {
|
|
479
|
+
if (opts.signal.aborted)
|
|
480
|
+
ctrl.abort();
|
|
481
|
+
else
|
|
482
|
+
opts.signal.addEventListener("abort", () => ctrl.abort(), { once: true });
|
|
483
|
+
}
|
|
484
|
+
let res;
|
|
485
|
+
try {
|
|
486
|
+
res = await this.#fetch(url, {
|
|
487
|
+
method,
|
|
488
|
+
headers,
|
|
489
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
490
|
+
signal: ctrl.signal,
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
catch (err) {
|
|
494
|
+
throw new FairScaleError(`network error: ${err.message}`, 0, "network_error");
|
|
495
|
+
}
|
|
496
|
+
finally {
|
|
497
|
+
clearTimeout(timeout);
|
|
498
|
+
}
|
|
499
|
+
const text = await res.text();
|
|
500
|
+
let json;
|
|
501
|
+
try {
|
|
502
|
+
json = text ? JSON.parse(text) : {};
|
|
503
|
+
}
|
|
504
|
+
catch {
|
|
505
|
+
throw new FairScaleError(`invalid JSON from FairScale (${res.status})`, res.status, "invalid_json");
|
|
506
|
+
}
|
|
507
|
+
if (!res.ok) {
|
|
508
|
+
const errCode = json?.code ??
|
|
509
|
+
json?.error ??
|
|
510
|
+
`http_${res.status}`;
|
|
511
|
+
throw new FairScaleError(`FairScale ${method} ${url} → ${res.status}: ${errCode}`, res.status, errCode);
|
|
512
|
+
}
|
|
513
|
+
return json;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
exports.FairScaleRegistry = FairScaleRegistry;
|
|
517
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
518
|
+
// Human Score namespace
|
|
519
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
520
|
+
/**
|
|
521
|
+
* @name HumanScoreNamespace
|
|
522
|
+
* @description Wraps `api.fairscale.xyz` (Human Score API). Accessed via
|
|
523
|
+
* `client.fairscale.human`.
|
|
524
|
+
* @category Registries
|
|
525
|
+
* @since v0.11.0
|
|
526
|
+
*/
|
|
527
|
+
class HumanScoreNamespace {
|
|
528
|
+
#baseUrl;
|
|
529
|
+
#apiKey;
|
|
530
|
+
#timeoutMs;
|
|
531
|
+
#fetch;
|
|
532
|
+
constructor(baseUrl, apiKey, timeoutMs, fetchImpl) {
|
|
533
|
+
this.#baseUrl = baseUrl;
|
|
534
|
+
this.#apiKey = apiKey;
|
|
535
|
+
this.#timeoutMs = timeoutMs;
|
|
536
|
+
this.#fetch = fetchImpl;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* @description `GET /score` — full human wallet analysis.
|
|
540
|
+
*/
|
|
541
|
+
score(wallet, opts = {}) {
|
|
542
|
+
return this.#get("/score", { wallet: toWallet(wallet), twitter: opts.twitter, nocache: opts.nocache }, opts);
|
|
543
|
+
}
|
|
544
|
+
/** `GET /fairScore` — blended 0–1000 integer. */
|
|
545
|
+
fairScoreOnly(wallet, opts = {}) {
|
|
546
|
+
return this.#get("/fairScore", { wallet: toWallet(wallet) }, opts);
|
|
547
|
+
}
|
|
548
|
+
/** `GET /walletScore` — on-chain only 0–1000 integer. */
|
|
549
|
+
walletScoreOnly(wallet, opts = {}) {
|
|
550
|
+
return this.#get("/walletScore", { wallet: toWallet(wallet) }, opts);
|
|
551
|
+
}
|
|
552
|
+
/** `GET /socialScore` — social only 0–1000 integer. */
|
|
553
|
+
socialScoreOnly(wallet, opts = {}) {
|
|
554
|
+
return this.#get("/socialScore", { wallet: toWallet(wallet), twitter: opts.twitter }, opts);
|
|
555
|
+
}
|
|
556
|
+
async #get(path, params, opts) {
|
|
557
|
+
const url = new URL(this.#baseUrl + path);
|
|
558
|
+
for (const [k, v] of Object.entries(params)) {
|
|
559
|
+
if (v === undefined || v === null)
|
|
560
|
+
continue;
|
|
561
|
+
url.searchParams.set(k, String(v));
|
|
562
|
+
}
|
|
563
|
+
const apiKey = opts.apiKey ?? this.#apiKey;
|
|
564
|
+
const headers = { Accept: "application/json" };
|
|
565
|
+
if (apiKey)
|
|
566
|
+
headers["fairkey"] = apiKey;
|
|
567
|
+
const ctrl = new AbortController();
|
|
568
|
+
const timeout = setTimeout(() => ctrl.abort(), opts.timeoutMs ?? this.#timeoutMs);
|
|
569
|
+
if (opts.signal) {
|
|
570
|
+
if (opts.signal.aborted)
|
|
571
|
+
ctrl.abort();
|
|
572
|
+
else
|
|
573
|
+
opts.signal.addEventListener("abort", () => ctrl.abort(), { once: true });
|
|
574
|
+
}
|
|
575
|
+
let res;
|
|
576
|
+
try {
|
|
577
|
+
res = await this.#fetch(url.toString(), { method: "GET", headers, signal: ctrl.signal });
|
|
578
|
+
}
|
|
579
|
+
catch (err) {
|
|
580
|
+
throw new FairScaleError(`network error: ${err.message}`, 0, "network_error");
|
|
581
|
+
}
|
|
582
|
+
finally {
|
|
583
|
+
clearTimeout(timeout);
|
|
584
|
+
}
|
|
585
|
+
const text = await res.text();
|
|
586
|
+
let json;
|
|
587
|
+
try {
|
|
588
|
+
json = text ? JSON.parse(text) : {};
|
|
589
|
+
}
|
|
590
|
+
catch {
|
|
591
|
+
throw new FairScaleError(`invalid JSON from FairScale Human API (${res.status})`, res.status, "invalid_json");
|
|
592
|
+
}
|
|
593
|
+
if (!res.ok) {
|
|
594
|
+
const code = json?.code ??
|
|
595
|
+
json?.error ??
|
|
596
|
+
`http_${res.status}`;
|
|
597
|
+
throw new FairScaleError(`FairScale Human GET ${path} → ${res.status}: ${code}`, res.status, code);
|
|
598
|
+
}
|
|
599
|
+
return json;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
exports.HumanScoreNamespace = HumanScoreNamespace;
|
|
603
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
604
|
+
// Helpers
|
|
605
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
606
|
+
function toWallet(input) {
|
|
607
|
+
return typeof input === "string" ? input : input.toBase58();
|
|
608
|
+
}
|
|
609
|
+
function round2(n) {
|
|
610
|
+
return Math.round(n * 100) / 100;
|
|
611
|
+
}
|
|
612
|
+
function bucketTier(score) {
|
|
613
|
+
if (score >= 80)
|
|
614
|
+
return "elite";
|
|
615
|
+
if (score >= 60)
|
|
616
|
+
return "high";
|
|
617
|
+
if (score >= 40)
|
|
618
|
+
return "medium";
|
|
619
|
+
return "low";
|
|
620
|
+
}
|
|
621
|
+
function extractSapScore(profile, minFeedbacks, notes) {
|
|
622
|
+
if (!profile) {
|
|
623
|
+
notes.push("sap_unregistered");
|
|
624
|
+
return null;
|
|
625
|
+
}
|
|
626
|
+
const fb = profile.identity.totalFeedbacks;
|
|
627
|
+
if (fb < minFeedbacks) {
|
|
628
|
+
notes.push(`sap_below_min_feedbacks(${fb}/${minFeedbacks})`);
|
|
629
|
+
return null;
|
|
630
|
+
}
|
|
631
|
+
if (fb === 0) {
|
|
632
|
+
notes.push("sap_no_feedback_yet");
|
|
633
|
+
return null;
|
|
634
|
+
}
|
|
635
|
+
if (!profile.identity.isActive)
|
|
636
|
+
notes.push("sap_inactive");
|
|
637
|
+
return profile.identity.reputationScore;
|
|
638
|
+
}
|
|
639
|
+
//# sourceMappingURL=fairscale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fairscale.js","sourceRoot":"","sources":["../../../src/registries/fairscale.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;;;AAGH,sCAAqC;AAErC,2CAAmE;AAEnE,sEAAsE;AACtE,UAAU;AACV,sEAAsE;AAEtE;;;;;;;;GAQG;AACH,MAAa,cAAe,SAAQ,iBAAQ;IAC1C,6DAA6D;IACpD,MAAM,CAAS;IACxB,2DAA2D;IAClD,YAAY,CAAU;IAE/B,YAAY,OAAe,EAAE,MAAc,EAAE,YAAqB;QAChE,KAAK,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF;AAbD,wCAaC;AAED,sEAAsE;AACtE,mDAAmD;AACnD,sEAAsE;AAEtE;;;;;;;;GAQG;AACU,QAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,+BAA+B;IAC/B,SAAS,EAAE,iCAAiC;IAC5C,4BAA4B;IAC5B,SAAS,EAAE,2BAA2B;IACtC,+DAA+D;IAC/D,kBAAkB,EAAE,MAAM;IAC1B,wDAAwD;IACxD,iBAAiB,EAAE,EAAE,GAAG,EAAE;IAC1B,sDAAsD;IACtD,iBAAiB,EAAE,EAAE;IACrB,sBAAsB;IACtB,cAAc,EAAE,OAAO;IACvB,gDAAgD;IAChD,4BAA4B,EAAE,EAAE;IAEhC,mD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