@antseed/node 0.2.118 → 0.2.120

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.
Files changed (82) hide show
  1. package/dist/discovery/display-name.d.ts +8 -0
  2. package/dist/discovery/display-name.d.ts.map +1 -0
  3. package/dist/discovery/display-name.js +17 -0
  4. package/dist/discovery/display-name.js.map +1 -0
  5. package/dist/discovery/domain-verification.d.ts.map +1 -1
  6. package/dist/discovery/domain-verification.js +2 -1
  7. package/dist/discovery/domain-verification.js.map +1 -1
  8. package/dist/discovery/github-verification.d.ts.map +1 -1
  9. package/dist/discovery/github-verification.js +5 -1
  10. package/dist/discovery/github-verification.js.map +1 -1
  11. package/dist/discovery/index.d.ts +1 -0
  12. package/dist/discovery/index.d.ts.map +1 -1
  13. package/dist/discovery/index.js +1 -0
  14. package/dist/discovery/index.js.map +1 -1
  15. package/dist/discovery/service-catalog.d.ts +2 -1
  16. package/dist/discovery/service-catalog.d.ts.map +1 -1
  17. package/dist/discovery/service-catalog.js +2 -0
  18. package/dist/discovery/service-catalog.js.map +1 -1
  19. package/dist/discovery/verifier-capabilities.d.ts +9 -0
  20. package/dist/discovery/verifier-capabilities.d.ts.map +1 -0
  21. package/dist/discovery/verifier-capabilities.js +35 -0
  22. package/dist/discovery/verifier-capabilities.js.map +1 -0
  23. package/dist/index.d.ts +6 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +6 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/node.d.ts +15 -3
  28. package/dist/node.d.ts.map +1 -1
  29. package/dist/node.js +114 -82
  30. package/dist/node.js.map +1 -1
  31. package/dist/p2p/identity.js +1 -1
  32. package/dist/p2p/identity.js.map +1 -1
  33. package/dist/payments/evm/multicall.d.ts +2 -1
  34. package/dist/payments/evm/multicall.d.ts.map +1 -1
  35. package/dist/payments/evm/multicall.js +1 -1
  36. package/dist/payments/evm/multicall.js.map +1 -1
  37. package/dist/payments/evm/trust-signals-client.d.ts +54 -0
  38. package/dist/payments/evm/trust-signals-client.d.ts.map +1 -0
  39. package/dist/payments/evm/trust-signals-client.js +162 -0
  40. package/dist/payments/evm/trust-signals-client.js.map +1 -0
  41. package/dist/payments/generated-contract-addresses.d.ts +14 -4
  42. package/dist/payments/generated-contract-addresses.d.ts.map +1 -1
  43. package/dist/payments/generated-contract-addresses.js +14 -4
  44. package/dist/payments/generated-contract-addresses.js.map +1 -1
  45. package/dist/reputation/identity-history.d.ts +75 -0
  46. package/dist/reputation/identity-history.d.ts.map +1 -0
  47. package/dist/reputation/identity-history.js +258 -0
  48. package/dist/reputation/identity-history.js.map +1 -0
  49. package/dist/reputation/model-reputation.d.ts +3 -2
  50. package/dist/reputation/model-reputation.d.ts.map +1 -1
  51. package/dist/reputation/model-reputation.js +2 -9
  52. package/dist/reputation/model-reputation.js.map +1 -1
  53. package/dist/reputation/public-json.d.ts +9 -0
  54. package/dist/reputation/public-json.d.ts.map +1 -0
  55. package/dist/reputation/public-json.js +98 -0
  56. package/dist/reputation/public-json.js.map +1 -0
  57. package/dist/reputation/sybil-risk.d.ts +35 -0
  58. package/dist/reputation/sybil-risk.d.ts.map +1 -0
  59. package/dist/reputation/sybil-risk.js +136 -0
  60. package/dist/reputation/sybil-risk.js.map +1 -0
  61. package/dist/reputation/trust-score.d.ts +83 -0
  62. package/dist/reputation/trust-score.d.ts.map +1 -0
  63. package/dist/reputation/trust-score.js +91 -0
  64. package/dist/reputation/trust-score.js.map +1 -0
  65. package/dist/routing/default-router.d.ts +0 -1
  66. package/dist/routing/default-router.d.ts.map +1 -1
  67. package/dist/routing/default-router.js +2 -12
  68. package/dist/routing/default-router.js.map +1 -1
  69. package/dist/routing/model-route-ranking.d.ts +0 -1
  70. package/dist/routing/model-route-ranking.d.ts.map +1 -1
  71. package/dist/routing/model-route-ranking.js.map +1 -1
  72. package/dist/types/peer.d.ts +27 -18
  73. package/dist/types/peer.d.ts.map +1 -1
  74. package/dist/verification/tee-status.d.ts +35 -0
  75. package/dist/verification/tee-status.d.ts.map +1 -0
  76. package/dist/verification/tee-status.js +21 -0
  77. package/dist/verification/tee-status.js.map +1 -0
  78. package/package.json +14 -6
  79. package/dist/reputation/on-chain-reputation.d.ts +0 -84
  80. package/dist/reputation/on-chain-reputation.d.ts.map +0 -1
  81. package/dist/reputation/on-chain-reputation.js +0 -290
  82. package/dist/reputation/on-chain-reputation.js.map +0 -1
@@ -0,0 +1,162 @@
1
+ import { Interface } from 'ethers';
2
+ import { multicallRead, MULTICALL3_ADDRESS } from './multicall.js';
3
+ const REGISTRY_IFACE = new Interface(['function getAgentId(address seller) view returns (uint256)']);
4
+ const CHANNELS_IFACE = new Interface(['function getAgentStats(uint256 agentId) view returns (uint64 channelCount, uint64 ghostCount, uint256 totalVolumeUsdc, uint64 lastSettledAt)']);
5
+ const POOLS_IFACE = new Interface([
6
+ 'function poolWeightAtEpoch(uint256 agentId, uint256 epoch) view returns (uint256)',
7
+ 'function poolActiveStakeAtEpoch(uint256 agentId, uint256 epoch) view returns (uint256)',
8
+ 'function totalPowerWeightAtEpoch(uint256 epoch) view returns (uint256)',
9
+ ]);
10
+ const USAGE_IFACE = new Interface([
11
+ 'function currentEpoch() view returns (uint256)',
12
+ 'function sellerPointsByEpoch(uint256 epoch, address seller) view returns (uint256)',
13
+ 'function totalPoolPointsByEpoch(uint256 epoch) view returns (uint256)',
14
+ ]);
15
+ const WASH_IFACE = new Interface([
16
+ 'function isProvenWashTrader(address seller) view returns (bool)',
17
+ 'function provenWashShareBps(address seller) view returns (uint256)',
18
+ ]);
19
+ const ANTS_WEI = 10n ** 18n;
20
+ function toSafeNumber(value) {
21
+ if (typeof value !== 'bigint')
22
+ return undefined;
23
+ return value <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(value) : Number.MAX_SAFE_INTEGER;
24
+ }
25
+ function shareBps(part, total) {
26
+ return total > 0n ? Number((part * 10000n) / total) : 0;
27
+ }
28
+ function weiToAnts(wei) {
29
+ return Number(wei / ANTS_WEI) + Number(wei % ANTS_WEI) / 1e18;
30
+ }
31
+ /**
32
+ * Collects the calls of one round and hands back a lookup for their results,
33
+ * so callers address results by the handle they got when queueing instead of
34
+ * by computed offsets.
35
+ */
36
+ class Round {
37
+ requests = [];
38
+ results = [];
39
+ add(target, iface, method, args = []) {
40
+ this.requests.push({ target, iface, method, args });
41
+ return this.requests.length - 1;
42
+ }
43
+ async run(read) {
44
+ this.results = this.requests.length > 0 ? await read(this.requests) : [];
45
+ }
46
+ /** First decoded return value of a call, or `undefined` when it failed or was not queued. */
47
+ value(handle) {
48
+ if (handle === undefined)
49
+ return undefined;
50
+ const result = this.results[handle];
51
+ return result && result.length > 0 ? result[0] : undefined;
52
+ }
53
+ /** All decoded return values of a call, or `undefined` when it failed. */
54
+ values(handle) {
55
+ return this.results[handle] ?? undefined;
56
+ }
57
+ }
58
+ export class TrustSignalsClient {
59
+ _provider;
60
+ _addresses;
61
+ _multicallAvailable;
62
+ constructor(_provider, _addresses) {
63
+ this._provider = _provider;
64
+ this._addresses = _addresses;
65
+ }
66
+ async _read(requests) {
67
+ // `multicallRead` probes for Multicall3 with `eth_getCode` on every call;
68
+ // remember the answer so a discovery cycle costs only the batched reads.
69
+ this._multicallAvailable ??= this._provider.getCode(MULTICALL3_ADDRESS).then((code) => code !== '0x').catch(() => false);
70
+ if (await this._multicallAvailable)
71
+ return multicallRead(this._provider, requests, { assumeDeployed: true });
72
+ return Promise.all(requests.map(async (request) => {
73
+ try {
74
+ const data = await this._provider.call({ to: request.target, data: request.iface.encodeFunctionData(request.method, request.args ?? []) });
75
+ return [...request.iface.decodeFunctionResult(request.method, data)];
76
+ }
77
+ catch {
78
+ return null;
79
+ }
80
+ }));
81
+ }
82
+ /**
83
+ * Read trust signals for `sellers` (EVM addresses). Sellers without an agent
84
+ * id are omitted from the result.
85
+ */
86
+ async read(sellers) {
87
+ const out = new Map();
88
+ if (sellers.length === 0)
89
+ return out;
90
+ const { sellerRegistry, channels, sellerPools, usageAccounting, washTradingRegistry } = this._addresses;
91
+ // Round 1: agent ids, wash verdicts, current epoch.
92
+ const round1 = new Round();
93
+ const epochCall = usageAccounting ? round1.add(usageAccounting, USAGE_IFACE, 'currentEpoch') : undefined;
94
+ const round1Calls = sellers.map((seller) => ({
95
+ seller,
96
+ agentId: round1.add(sellerRegistry, REGISTRY_IFACE, 'getAgentId', [seller]),
97
+ washFlagged: washTradingRegistry ? round1.add(washTradingRegistry, WASH_IFACE, 'isProvenWashTrader', [seller]) : undefined,
98
+ washShare: washTradingRegistry ? round1.add(washTradingRegistry, WASH_IFACE, 'provenWashShareBps', [seller]) : undefined,
99
+ }));
100
+ await round1.run((requests) => this._read(requests));
101
+ const epoch = toSafeNumber(round1.value(epochCall));
102
+ const agentIds = new Map();
103
+ for (const call of round1Calls) {
104
+ const agentId = toSafeNumber(round1.value(call.agentId));
105
+ if (!agentId || agentId <= 0)
106
+ continue;
107
+ agentIds.set(call.seller, agentId);
108
+ const signals = { agentId };
109
+ const flagged = round1.value(call.washFlagged);
110
+ if (typeof flagged === 'boolean')
111
+ signals.washFlagged = flagged;
112
+ const share = toSafeNumber(round1.value(call.washShare));
113
+ if (share !== undefined)
114
+ signals.washShareBps = share;
115
+ out.set(call.seller, signals);
116
+ }
117
+ if (agentIds.size === 0)
118
+ return out;
119
+ // Round 2: channel stats, pool power, last epoch's recognized usage.
120
+ const poolsEnabled = Boolean(sellerPools) && epoch !== undefined;
121
+ const usageEnabled = Boolean(usageAccounting) && epoch !== undefined;
122
+ const lastEpoch = epoch === undefined ? 0 : Math.max(0, epoch - 1);
123
+ const round2 = new Round();
124
+ const totalPowerCall = poolsEnabled ? round2.add(sellerPools, POOLS_IFACE, 'totalPowerWeightAtEpoch', [epoch]) : undefined;
125
+ const totalPointsCall = usageEnabled ? round2.add(usageAccounting, USAGE_IFACE, 'totalPoolPointsByEpoch', [lastEpoch]) : undefined;
126
+ const round2Calls = [...agentIds].map(([seller, agentId]) => ({
127
+ seller,
128
+ stats: round2.add(channels, CHANNELS_IFACE, 'getAgentStats', [agentId]),
129
+ power: poolsEnabled ? round2.add(sellerPools, POOLS_IFACE, 'poolWeightAtEpoch', [agentId, epoch]) : undefined,
130
+ stake: poolsEnabled ? round2.add(sellerPools, POOLS_IFACE, 'poolActiveStakeAtEpoch', [agentId, epoch]) : undefined,
131
+ points: usageEnabled ? round2.add(usageAccounting, USAGE_IFACE, 'sellerPointsByEpoch', [lastEpoch, seller]) : undefined,
132
+ }));
133
+ await round2.run((requests) => this._read(requests));
134
+ const totalPower = round2.value(totalPowerCall);
135
+ const totalPoints = round2.value(totalPointsCall);
136
+ for (const call of round2Calls) {
137
+ const signals = out.get(call.seller);
138
+ const stats = round2.values(call.stats);
139
+ if (stats && stats.length >= 4) {
140
+ signals.channelCount = toSafeNumber(stats[0]);
141
+ signals.ghostCount = toSafeNumber(stats[1]);
142
+ signals.totalVolumeUsdcMicros = toSafeNumber(stats[2]);
143
+ signals.lastSettledAtSec = toSafeNumber(stats[3]);
144
+ }
145
+ const power = round2.value(call.power);
146
+ if (typeof power === 'bigint' && typeof totalPower === 'bigint')
147
+ signals.poolPowerShareBps = shareBps(power, totalPower);
148
+ const stake = round2.value(call.stake);
149
+ if (typeof stake === 'bigint')
150
+ signals.poolStakeAnts = weiToAnts(stake);
151
+ const points = round2.value(call.points);
152
+ if (typeof points === 'bigint' && typeof totalPoints === 'bigint' && epoch !== undefined) {
153
+ signals.usageEpoch = epoch;
154
+ // Epoch 0 has no previous epoch to score.
155
+ signals.usageLastEpochUsdcMicros = epoch === 0 ? 0 : toSafeNumber(points);
156
+ signals.usageShareBps = epoch === 0 ? 0 : shareBps(points, totalPoints);
157
+ }
158
+ }
159
+ return out;
160
+ }
161
+ }
162
+ //# sourceMappingURL=trust-signals-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust-signals-client.js","sourceRoot":"","sources":["../../../src/payments/evm/trust-signals-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,QAA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AC;YAC1E,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
@@ -6,17 +6,27 @@ export declare const DEPLOYED_CONTRACT_ADDRESSES: {
6
6
  readonly depositsContractAddress: "0x0F7a3a8f4Da01637d1202bb5443fcF7F88F99fD2";
7
7
  readonly channelsContractAddress: "0xBA66d3b4fbCf472F6F11D6F9F96aaCE96516F09d";
8
8
  readonly freeUsageContractAddress: "0xB24DcDE777C4ad9AC385Ec9500b3Dc527a4F91Ad";
9
- readonly stakingContractAddress: "0x3652E6B22919bd322A25723B94BB207602E5c8e6";
10
- readonly emissionsContractAddress: "0xF13bE52c4A3afC6AE29536f073588d01A0564088";
11
- readonly legacyEmissionsContractAddress: "0x36877fBa8Fa333aa46a1c57b66D132E4995C86b5";
9
+ readonly stakingContractAddress: "0x99c533bcc6ca646e543dba835fdbb9c2ee02cb60";
10
+ readonly emissionsContractAddress: "0xadd2d85316153d7bfaf7921ee9bf1bb6c7a1cbc9";
11
+ readonly legacyEmissionsContractAddress: "0xF13bE52c4A3afC6AE29536f073588d01A0564088";
12
+ readonly legacyStakingContractAddress: "0x3652E6B22919bd322A25723B94BB207602E5c8e6";
13
+ readonly legacyEmissionsV1ContractAddress: "0x36877fBa8Fa333aa46a1c57b66D132E4995C86b5";
12
14
  readonly antsTokenAddress: "0xa87EE81b2C0Bc659307ca2D9ffdC38514DD85263";
13
15
  readonly identityRegistryAddress: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
14
16
  readonly statsContractAddress: "0x15649ff076BFa5e37e24EE3154a00503149954Fd";
15
17
  readonly depositRelayAddress: "0x34a44542e76f9b4cff3a31902eDF14AbF2C3B3DD";
18
+ readonly emissionsGateAddress: "0xe60a31e6cd2f8455503ca0b3f6545dd3ddf543bd";
19
+ readonly sellerPoolsAddress: "0x8bf4d39aa13f3cb03f87d9500767fbc4d0940652";
20
+ readonly sellerRegistryAddress: "0x99c533bcc6ca646e543dba835fdbb9c2ee02cb60";
21
+ readonly positionInitAddress: "0xb68ad13b681319fceb6b0a640c2fd96c0138cbc8";
22
+ readonly usageAccountingAddress: "0xadd2d85316153d7bfaf7921ee9bf1bb6c7a1cbc9";
23
+ readonly usageRewardsAddress: "0x78330bf154172f1137219bb559d4f3a270b3201f";
24
+ readonly sellerPoolsRewardsAddress: "0x83cc5b9aa0c8cb8683f35462c385a5baaa755ee5";
25
+ readonly legacyEmissionsEscrowAddress: "0x4d0fc3c0bbb5233af6c4ce33223e5330c34db9ab";
16
26
  readonly channelsDeployBlock: 44469557;
17
27
  readonly statsDeployBlock: 44469557;
18
28
  readonly recognizedUsage: {
19
- readonly status: "deployed";
29
+ readonly status: "active";
20
30
  readonly effectiveEpoch: 22;
21
31
  readonly deploymentBlock: 50955026;
22
32
  readonly contracts: {
@@ -1 +1 @@
1
- {"version":3,"file":"generated-contract-addresses.d.ts","sourceRoot":"","sources":["../../src/payments/generated-contract-addresses.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+C9B,CAAC"}
1
+ {"version":3,"file":"generated-contract-addresses.d.ts","sourceRoot":"","sources":["../../src/payments/generated-contract-addresses.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyD9B,CAAC"}
@@ -7,17 +7,27 @@ export const DEPLOYED_CONTRACT_ADDRESSES = {
7
7
  depositsContractAddress: '0x0F7a3a8f4Da01637d1202bb5443fcF7F88F99fD2',
8
8
  channelsContractAddress: '0xBA66d3b4fbCf472F6F11D6F9F96aaCE96516F09d',
9
9
  freeUsageContractAddress: '0xB24DcDE777C4ad9AC385Ec9500b3Dc527a4F91Ad',
10
- stakingContractAddress: '0x3652E6B22919bd322A25723B94BB207602E5c8e6',
11
- emissionsContractAddress: '0xF13bE52c4A3afC6AE29536f073588d01A0564088',
12
- legacyEmissionsContractAddress: '0x36877fBa8Fa333aa46a1c57b66D132E4995C86b5',
10
+ stakingContractAddress: '0x99c533bcc6ca646e543dba835fdbb9c2ee02cb60',
11
+ emissionsContractAddress: '0xadd2d85316153d7bfaf7921ee9bf1bb6c7a1cbc9',
12
+ legacyEmissionsContractAddress: '0xF13bE52c4A3afC6AE29536f073588d01A0564088',
13
+ legacyStakingContractAddress: '0x3652E6B22919bd322A25723B94BB207602E5c8e6',
14
+ legacyEmissionsV1ContractAddress: '0x36877fBa8Fa333aa46a1c57b66D132E4995C86b5',
13
15
  antsTokenAddress: '0xa87EE81b2C0Bc659307ca2D9ffdC38514DD85263',
14
16
  identityRegistryAddress: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432',
15
17
  statsContractAddress: '0x15649ff076BFa5e37e24EE3154a00503149954Fd',
16
18
  depositRelayAddress: '0x34a44542e76f9b4cff3a31902eDF14AbF2C3B3DD',
19
+ emissionsGateAddress: '0xe60a31e6cd2f8455503ca0b3f6545dd3ddf543bd',
20
+ sellerPoolsAddress: '0x8bf4d39aa13f3cb03f87d9500767fbc4d0940652',
21
+ sellerRegistryAddress: '0x99c533bcc6ca646e543dba835fdbb9c2ee02cb60',
22
+ positionInitAddress: '0xb68ad13b681319fceb6b0a640c2fd96c0138cbc8',
23
+ usageAccountingAddress: '0xadd2d85316153d7bfaf7921ee9bf1bb6c7a1cbc9',
24
+ usageRewardsAddress: '0x78330bf154172f1137219bb559d4f3a270b3201f',
25
+ sellerPoolsRewardsAddress: '0x83cc5b9aa0c8cb8683f35462c385a5baaa755ee5',
26
+ legacyEmissionsEscrowAddress: '0x4d0fc3c0bbb5233af6c4ce33223e5330c34db9ab',
17
27
  channelsDeployBlock: 44469557,
18
28
  statsDeployBlock: 44469557,
19
29
  recognizedUsage: {
20
- "status": "deployed",
30
+ "status": "active",
21
31
  "effectiveEpoch": 22,
22
32
  "deploymentBlock": 50955026,
23
33
  "contracts": {
@@ -1 +1 @@
1
- {"version":3,"file":"generated-contract-addresses.js","sourceRoot":"","sources":["../../src/payments/generated-contract-addresses.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,cAAc,EAAE;QACd,UAAU,EAAE,IAAI;QAChB,uBAAuB,EAAE,4CAA4C;QACrE,mBAAmB,EAAE,4CAA4C;QACjE,uBAAuB,EAAE,4CAA4C;QACrE,uBAAuB,EAAE,4CAA4C;QACrE,wBAAwB,EAAE,4CAA4C;QACtE,sBAAsB,EAAE,4CAA4C;QACpE,wBAAwB,EAAE,4CAA4C;QACtE,8BAA8B,EAAE,4CAA4C;QAC5E,gBAAgB,EAAE,4CAA4C;QAC9D,uBAAuB,EAAE,4CAA4C;QACrE,oBAAoB,EAAE,4CAA4C;QAClE,mBAAmB,EAAE,4CAA4C;QACjE,mBAAmB,EAAE,QAAQ;QAC7B,gBAAgB,EAAE,QAAQ;QAC1B,eAAe,EAAE;YACf,QAAQ,EAAE,UAAU;YACpB,gBAAgB,EAAE,EAAE;YACpB,iBAAiB,EAAE,QAAQ;YAC3B,WAAW,EAAE;gBACX,qBAAqB,EAAE,4CAA4C;gBACnE,eAAe,EAAE,4CAA4C;gBAC7D,aAAa,EAAE,4CAA4C;gBAC3D,gBAAgB,EAAE,4CAA4C;gBAC9D,cAAc,EAAE,4CAA4C;gBAC5D,iBAAiB,EAAE,4CAA4C;gBAC/D,sBAAsB,EAAE,4CAA4C;gBACpE,yBAAyB,EAAE,4CAA4C;gBACvE,oBAAoB,EAAE,4CAA4C;gBAClE,cAAc,EAAE,4CAA4C;gBAC5D,uBAAuB,EAAE,4CAA4C;aACtE;SACF;KACF;IACD,cAAc,EAAE;QACd,UAAU,EAAE,KAAK;QACjB,uBAAuB,EAAE,4CAA4C;QACrE,mBAAmB,EAAE,4CAA4C;QACjE,uBAAuB,EAAE,4CAA4C;QACrE,uBAAuB,EAAE,4CAA4C;QACrE,sBAAsB,EAAE,4CAA4C;QACpE,wBAAwB,EAAE,4CAA4C;QACtE,gBAAgB,EAAE,4CAA4C;QAC9D,uBAAuB,EAAE,4CAA4C;KACtE;CACO,CAAC"}
1
+ {"version":3,"file":"generated-contract-addresses.js","sourceRoot":"","sources":["../../src/payments/generated-contract-addresses.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,cAAc,EAAE;QACd,UAAU,EAAE,IAAI;QAChB,uBAAuB,EAAE,4CAA4C;QACrE,mBAAmB,EAAE,4CAA4C;QACjE,uBAAuB,EAAE,4CAA4C;QACrE,uBAAuB,EAAE,4CAA4C;QACrE,wBAAwB,EAAE,4CAA4C;QACtE,sBAAsB,EAAE,4CAA4C;QACpE,wBAAwB,EAAE,4CAA4C;QACtE,8BAA8B,EAAE,4CAA4C;QAC5E,4BAA4B,EAAE,4CAA4C;QAC1E,gCAAgC,EAAE,4CAA4C;QAC9E,gBAAgB,EAAE,4CAA4C;QAC9D,uBAAuB,EAAE,4CAA4C;QACrE,oBAAoB,EAAE,4CAA4C;QAClE,mBAAmB,EAAE,4CAA4C;QACjE,oBAAoB,EAAE,4CAA4C;QAClE,kBAAkB,EAAE,4CAA4C;QAChE,qBAAqB,EAAE,4CAA4C;QACnE,mBAAmB,EAAE,4CAA4C;QACjE,sBAAsB,EAAE,4CAA4C;QACpE,mBAAmB,EAAE,4CAA4C;QACjE,yBAAyB,EAAE,4CAA4C;QACvE,4BAA4B,EAAE,4CAA4C;QAC1E,mBAAmB,EAAE,QAAQ;QAC7B,gBAAgB,EAAE,QAAQ;QAC1B,eAAe,EAAE;YACf,QAAQ,EAAE,QAAQ;YAClB,gBAAgB,EAAE,EAAE;YACpB,iBAAiB,EAAE,QAAQ;YAC3B,WAAW,EAAE;gBACX,qBAAqB,EAAE,4CAA4C;gBACnE,eAAe,EAAE,4CAA4C;gBAC7D,aAAa,EAAE,4CAA4C;gBAC3D,gBAAgB,EAAE,4CAA4C;gBAC9D,cAAc,EAAE,4CAA4C;gBAC5D,iBAAiB,EAAE,4CAA4C;gBAC/D,sBAAsB,EAAE,4CAA4C;gBACpE,yBAAyB,EAAE,4CAA4C;gBACvE,oBAAoB,EAAE,4CAA4C;gBAClE,cAAc,EAAE,4CAA4C;gBAC5D,uBAAuB,EAAE,4CAA4C;aACtE;SACF;KACF;IACD,cAAc,EAAE;QACd,UAAU,EAAE,KAAK;QACjB,uBAAuB,EAAE,4CAA4C;QACrE,mBAAmB,EAAE,4CAA4C;QACjE,uBAAuB,EAAE,4CAA4C;QACrE,uBAAuB,EAAE,4CAA4C;QACrE,sBAAsB,EAAE,4CAA4C;QACpE,wBAAwB,EAAE,4CAA4C;QACtE,gBAAgB,EAAE,4CAA4C;QAC9D,uBAAuB,EAAE,4CAA4C;KACtE;CACO,CAAC"}
@@ -0,0 +1,75 @@
1
+ import type { PeerInfo, PeerVerificationResults } from '../types/peer.js';
2
+ import { fetchPublicJson } from './public-json.js';
3
+ /**
4
+ * Public history for a peer's verified identities, collected buyer-locally.
5
+ *
6
+ * Only identities whose ownership proof verified (see `discovery/*-verification`)
7
+ * are looked up: a GitHub account's public repositories and creation date, or a
8
+ * domain's registration date via the authoritative RDAP registry. The result
9
+ * is the `identity` part of the trust score (see `trust-score.ts`).
10
+ */
11
+ export declare const IDENTITY_HISTORY_VERSION = 1;
12
+ /** Evidence and the ownership verification behind it are usable for seven days. */
13
+ export declare const IDENTITY_HISTORY_TTL_MS: number;
14
+ /** Maximum points a verified GitHub portfolio can earn. */
15
+ export declare const IDENTITY_GITHUB_MAX_POINTS = 70;
16
+ /** Maximum points a verified domain's registration age can earn. */
17
+ export declare const IDENTITY_DOMAIN_MAX_POINTS = 12;
18
+ export interface GithubProjectHistory {
19
+ id: number;
20
+ name: string;
21
+ createdAtMs: number;
22
+ stars: number;
23
+ archived: boolean;
24
+ }
25
+ export interface IdentityHistory {
26
+ kind: 'github' | 'domain';
27
+ claim: string;
28
+ status: 'available' | 'unavailable';
29
+ fetchedAtMs: number;
30
+ /** `github:<numeric account id>` or `domain:<name>`; stable across renames. */
31
+ identityId?: string;
32
+ createdAtMs?: number;
33
+ projects?: GithubProjectHistory[];
34
+ truncated?: boolean;
35
+ source?: string;
36
+ }
37
+ export interface IdentityHistoryEvidence {
38
+ version: typeof IDENTITY_HISTORY_VERSION;
39
+ identities: IdentityHistory[];
40
+ }
41
+ export declare class IdentityHistoryCollector {
42
+ private readonly getJson;
43
+ private readonly now;
44
+ private cache;
45
+ private bootstrap;
46
+ constructor(getJson?: typeof fetchPublicJson, now?: () => number);
47
+ collect(results: PeerVerificationResults): Promise<IdentityHistoryEvidence>;
48
+ private load;
49
+ /** One account lookup (done by the caller) plus at most four pages of repositories. */
50
+ private github;
51
+ /** IANA RDAP bootstrap (cached) plus one registry query; the registration must match the exact domain. */
52
+ private domain;
53
+ }
54
+ export interface IdentityScore {
55
+ kind: 'github' | 'domain';
56
+ claim: string;
57
+ identityId: string;
58
+ points: number;
59
+ }
60
+ /**
61
+ * Score the strongest verified identity, or `null` when none has usable
62
+ * evidence. Identities never add up: several accounts or domains owned by one
63
+ * operator are not independent evidence.
64
+ *
65
+ * GitHub (max 70): original, non-fork repositories at least three months old
66
+ * with at least five stars, excluding the ownership-proof repository.
67
+ * 40 * min(1, sum(log2(1 + min(stars, 500))) / 40) stars
68
+ * + 20 * min(1, projects / 8) breadth
69
+ * + 10 * min(1, oldest project years / 3) age
70
+ * Archived repositories count at 20%. An empty or zero-star account earns 0.
71
+ *
72
+ * Domain (max 12): 12 * min(1, registration years / 5).
73
+ */
74
+ export declare function scoreIdentityHistory(peer: Pick<PeerInfo, 'peerId' | 'metadata' | 'verificationResults'>, nowMs?: number): IdentityScore | null;
75
+ //# sourceMappingURL=identity-history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-history.d.ts","sourceRoot":"","sources":["../../src/reputation/identity-history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,C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CnE,IAAI;IASlB,uFAAuF;YACzE,MAAM;IAuBpB,0GAA0G;YAC5F,MAAM;CAwBrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAQD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,qBAAqB,CAAC,EAAE,KAAK,SAAa,GAAG,aAAa,GAAG,IAAI,CA4BlJ"}
@@ -0,0 +1,258 @@
1
+ import { fetchPublicJson, publicHttpsUrl } from './public-json.js';
2
+ /**
3
+ * Public history for a peer's verified identities, collected buyer-locally.
4
+ *
5
+ * Only identities whose ownership proof verified (see `discovery/*-verification`)
6
+ * are looked up: a GitHub account's public repositories and creation date, or a
7
+ * domain's registration date via the authoritative RDAP registry. The result
8
+ * is the `identity` part of the trust score (see `trust-score.ts`).
9
+ */
10
+ export const IDENTITY_HISTORY_VERSION = 1;
11
+ /** Evidence and the ownership verification behind it are usable for seven days. */
12
+ export const IDENTITY_HISTORY_TTL_MS = 7 * 86_400_000;
13
+ /** Maximum points a verified GitHub portfolio can earn. */
14
+ export const IDENTITY_GITHUB_MAX_POINTS = 70;
15
+ /** Maximum points a verified domain's registration age can earn. */
16
+ export const IDENTITY_DOMAIN_MAX_POINTS = 12;
17
+ const RETRY_MS = 60 * 60_000;
18
+ const MAX_IDENTITIES = 8;
19
+ const MAX_CACHE_ENTRIES = 512;
20
+ function record(value) {
21
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
22
+ }
23
+ function timestamp(value) {
24
+ return typeof value === 'string' ? Date.parse(value) : NaN;
25
+ }
26
+ function id(value) {
27
+ return typeof value === 'number' && Number.isSafeInteger(value) && value > 0;
28
+ }
29
+ export class IdentityHistoryCollector {
30
+ getJson;
31
+ now;
32
+ cache = new Map();
33
+ bootstrap;
34
+ constructor(getJson = fetchPublicJson, now = Date.now) {
35
+ this.getJson = getJson;
36
+ this.now = now;
37
+ }
38
+ async collect(results) {
39
+ const claims = new Map();
40
+ for (const result of results.github) {
41
+ if (result.verified && /^[a-z0-9-]{1,39}$/i.test(result.username)) {
42
+ const claim = result.username.toLowerCase();
43
+ claims.set(`github:${claim}`, { kind: 'github', claim });
44
+ }
45
+ }
46
+ for (const result of results.domains) {
47
+ if (result.verified && /^[a-z0-9.-]{1,253}$/i.test(result.domain)) {
48
+ const claim = result.domain.toLowerCase();
49
+ claims.set(`domain:${claim}`, { kind: 'domain', claim });
50
+ }
51
+ }
52
+ const identities = [];
53
+ for (const [claimKey, { kind, claim }] of [...claims].slice(0, MAX_IDENTITIES)) {
54
+ // Resolve the username to its numeric account id on every pass so a
55
+ // reassigned username cannot inherit the previous owner's cached history.
56
+ let account;
57
+ if (kind === 'github') {
58
+ try {
59
+ account = record(await this.getJson(`https://api.github.com/users/${claim}`));
60
+ if (!id(account.id) || typeof account.login !== 'string' || account.login.toLowerCase() !== claim
61
+ || !Number.isFinite(timestamp(account.created_at)))
62
+ throw new Error('Invalid account');
63
+ }
64
+ catch {
65
+ identities.push({ kind, claim, status: 'unavailable', fetchedAtMs: this.now() });
66
+ continue;
67
+ }
68
+ }
69
+ const key = account ? `github:${account.id}` : claimKey;
70
+ let cached = this.cache.get(key);
71
+ if (!cached || cached.expiresAt <= this.now()) {
72
+ const result = this.load(kind, claim, account);
73
+ cached = { expiresAt: this.now() + RETRY_MS, result };
74
+ if (this.cache.size >= MAX_CACHE_ENTRIES)
75
+ this.cache.delete(this.cache.keys().next().value);
76
+ this.cache.set(key, cached);
77
+ const entry = cached;
78
+ void result.then((evidence) => { entry.expiresAt = evidence.fetchedAtMs + (evidence.status === 'available' ? IDENTITY_HISTORY_TTL_MS : RETRY_MS); });
79
+ }
80
+ identities.push({ ...await cached.result, claim });
81
+ }
82
+ return { version: IDENTITY_HISTORY_VERSION, identities };
83
+ }
84
+ async load(kind, claim, account) {
85
+ try {
86
+ const evidence = kind === 'github' ? await this.github(claim, account) : await this.domain(claim);
87
+ return { ...evidence, kind, claim, status: 'available', fetchedAtMs: this.now() };
88
+ }
89
+ catch {
90
+ return { kind, claim, status: 'unavailable', fetchedAtMs: this.now() };
91
+ }
92
+ }
93
+ /** One account lookup (done by the caller) plus at most four pages of repositories. */
94
+ async github(claim, account) {
95
+ const source = `https://api.github.com/users/${claim}`;
96
+ const projects = new Map();
97
+ let truncated = false;
98
+ for (let page = 1; page <= 4; page++) {
99
+ const data = await this.getJson(`https://api.github.com/users/${claim}/repos?per_page=100&page=${page}&sort=created&direction=asc`);
100
+ if (!Array.isArray(data) || data.length > 100)
101
+ throw new Error('Invalid repository page');
102
+ for (const value of data) {
103
+ const repo = record(value);
104
+ if (record(repo.owner).id !== account.id || repo.fork !== false || !id(repo.id)
105
+ || typeof repo.size !== 'number' || !Number.isFinite(repo.size) || repo.size <= 0 || repo.disabled === true
106
+ || typeof repo.name !== 'string' || !Number.isFinite(timestamp(repo.created_at))
107
+ || typeof repo.stargazers_count !== 'number' || !Number.isSafeInteger(repo.stargazers_count)
108
+ || repo.stargazers_count < 0 || typeof repo.archived !== 'boolean')
109
+ continue;
110
+ projects.set(repo.id, { id: repo.id, name: repo.name, createdAtMs: timestamp(repo.created_at),
111
+ stars: repo.stargazers_count, archived: repo.archived });
112
+ }
113
+ truncated = data.length === 100;
114
+ if (!truncated)
115
+ break;
116
+ }
117
+ return { identityId: `github:${account.id}`, createdAtMs: timestamp(account.created_at), projects: [...projects.values()], truncated, source };
118
+ }
119
+ /** IANA RDAP bootstrap (cached) plus one registry query; the registration must match the exact domain. */
120
+ async domain(claim) {
121
+ if (!this.bootstrap || this.bootstrap.expiresAt <= this.now()) {
122
+ this.bootstrap = { expiresAt: this.now() + RETRY_MS, result: this.getJson('https://data.iana.org/rdap/dns.json') };
123
+ }
124
+ const services = record(await this.bootstrap.result).services;
125
+ if (!Array.isArray(services))
126
+ throw new Error('Invalid RDAP bootstrap');
127
+ const tld = claim.split('.').at(-1);
128
+ const service = services.find((entry) => Array.isArray(entry) && Array.isArray(entry[0]) && entry[0].includes(tld));
129
+ if (!Array.isArray(service) || !Array.isArray(service[1]))
130
+ throw new Error('No authoritative RDAP service');
131
+ const base = service[1].find((value) => typeof value === 'string' && value.startsWith('https://'));
132
+ if (typeof base !== 'string')
133
+ throw new Error('No HTTPS RDAP service');
134
+ const url = publicHttpsUrl(base);
135
+ url.pathname = `${url.pathname.replace(/\/$/, '')}/domain/${encodeURIComponent(claim)}`;
136
+ url.search = '';
137
+ url.hash = '';
138
+ const domain = record(await this.getJson(url.href));
139
+ if (domain.objectClassName !== 'domain' || typeof domain.ldhName !== 'string' || domain.ldhName.toLowerCase() !== claim) {
140
+ throw new Error('RDAP registration does not match verified domain');
141
+ }
142
+ const events = Array.isArray(domain.events) ? domain.events : [];
143
+ const dates = events.map(record).filter((event) => event.eventAction === 'registration').map((event) => timestamp(event.eventDate));
144
+ if (dates.length !== 1 || !Number.isFinite(dates[0]))
145
+ throw new Error('Missing unambiguous registration');
146
+ return { identityId: `domain:${claim}`, createdAtMs: dates[0], source: url.href };
147
+ }
148
+ }
149
+ const YEAR_MS = 365.25 * 86_400_000;
150
+ const MAX_PROJECTS_SCORED = 400;
151
+ const MIN_PROJECT_STARS = 5;
152
+ const MIN_PROJECT_AGE_YEARS = 0.25;
153
+ const ARCHIVED_PROJECT_WEIGHT = 0.2;
154
+ /**
155
+ * Score the strongest verified identity, or `null` when none has usable
156
+ * evidence. Identities never add up: several accounts or domains owned by one
157
+ * operator are not independent evidence.
158
+ *
159
+ * GitHub (max 70): original, non-fork repositories at least three months old
160
+ * with at least five stars, excluding the ownership-proof repository.
161
+ * 40 * min(1, sum(log2(1 + min(stars, 500))) / 40) stars
162
+ * + 20 * min(1, projects / 8) breadth
163
+ * + 10 * min(1, oldest project years / 3) age
164
+ * Archived repositories count at 20%. An empty or zero-star account earns 0.
165
+ *
166
+ * Domain (max 12): 12 * min(1, registration years / 5).
167
+ */
168
+ export function scoreIdentityHistory(peer, nowMs = Date.now()) {
169
+ const results = peer.verificationResults;
170
+ const evidence = results?.identityHistory;
171
+ const fresh = (time) => Number.isFinite(time) && time <= nowMs && nowMs - time <= IDENTITY_HISTORY_TTL_MS;
172
+ if (!results || !fresh(results.checkedAtMs) || !Array.isArray(results.github) || !Array.isArray(results.domains)
173
+ || evidence?.version !== IDENTITY_HISTORY_VERSION || !Array.isArray(evidence.identities)) {
174
+ return null;
175
+ }
176
+ const years = (time) => Number.isFinite(time) && time > 0 && time <= nowMs ? (nowMs - time) / YEAR_MS : 0;
177
+ let best = null;
178
+ const seen = new Set();
179
+ for (const item of evidence.identities.slice(0, MAX_IDENTITIES)) {
180
+ if (!item || item.status !== 'available' || !fresh(item.fetchedAtMs) || !item.identityId || seen.has(item.identityId))
181
+ continue;
182
+ if (!isStillClaimed(peer, item) || !isOwnershipVerified(peer.peerId, results, item, fresh))
183
+ continue;
184
+ let points;
185
+ if (item.kind === 'github' && /^github:[1-9]\d*$/.test(item.identityId)) {
186
+ points = scoreGithubPortfolio(item, results, years);
187
+ }
188
+ else if (item.kind === 'domain' && item.identityId === `domain:${item.claim}`) {
189
+ points = IDENTITY_DOMAIN_MAX_POINTS * Math.min(1, years(item.createdAtMs ?? NaN) / 5);
190
+ }
191
+ else {
192
+ continue;
193
+ }
194
+ seen.add(item.identityId);
195
+ if (!best || points > best.points)
196
+ best = { kind: item.kind, claim: item.claim, identityId: item.identityId, points };
197
+ }
198
+ return best;
199
+ }
200
+ /** The seller still announces this claim in its current metadata (or metadata is unavailable). */
201
+ function isStillClaimed(peer, item) {
202
+ const announced = peer.metadata?.verifications;
203
+ if (!announced)
204
+ return true;
205
+ if (item.kind === 'github') {
206
+ return Array.isArray(announced.github)
207
+ && announced.github.some((entry) => typeof entry?.username === 'string' && entry.username.toLowerCase() === item.claim);
208
+ }
209
+ return Array.isArray(announced.domains)
210
+ && announced.domains.some((entry) => typeof entry?.domain === 'string' && entry.domain.toLowerCase() === item.claim);
211
+ }
212
+ /** This peer's ownership proof for the claim verified recently. */
213
+ function isOwnershipVerified(peerId, results, item, fresh) {
214
+ if (item.kind === 'github') {
215
+ return results.github.some((result) => result?.verified && result.peerId === peerId
216
+ && typeof result.username === 'string' && result.username.toLowerCase() === item.claim && fresh(result.checkedAtMs));
217
+ }
218
+ return results.domains.some((result) => result?.verified && result.peerId === peerId
219
+ && typeof result.domain === 'string' && result.domain.toLowerCase() === item.claim && fresh(result.checkedAtMs));
220
+ }
221
+ /** The repository that hosts the ownership proof never counts as a project. */
222
+ function isProofRepository(results, claim, name) {
223
+ return results.github.some((result) => typeof result?.username === 'string' && result.username.toLowerCase() === claim
224
+ && typeof result.repository === 'string' && result.repository.toLowerCase() === name.toLowerCase());
225
+ }
226
+ function scoreGithubPortfolio(item, results, years) {
227
+ const projects = Array.isArray(item.projects) ? item.projects.slice(0, MAX_PROJECTS_SCORED) : [];
228
+ const accountCreatedAtMs = item.createdAtMs ?? Infinity;
229
+ const seenIds = new Set();
230
+ let starWeight = 0;
231
+ let projectWeight = 0;
232
+ let oldestYears = 0;
233
+ for (const project of projects) {
234
+ if (!project || !id(project.id) || seenIds.has(project.id))
235
+ continue;
236
+ if (!Number.isFinite(project.stars) || project.stars < MIN_PROJECT_STARS)
237
+ continue;
238
+ if (typeof project.name !== 'string' || typeof project.archived !== 'boolean')
239
+ continue;
240
+ if (isProofRepository(results, item.claim, project.name))
241
+ continue;
242
+ // A project older than the account was transferred in, not built here.
243
+ if (project.createdAtMs < accountCreatedAtMs || years(project.createdAtMs) < MIN_PROJECT_AGE_YEARS)
244
+ continue;
245
+ seenIds.add(project.id);
246
+ const weight = project.archived ? ARCHIVED_PROJECT_WEIGHT : 1;
247
+ starWeight += Math.log2(1 + Math.min(500, project.stars)) * weight;
248
+ projectWeight += weight;
249
+ oldestYears = Math.max(oldestYears, years(project.createdAtMs) * weight);
250
+ }
251
+ if (projectWeight === 0)
252
+ return 0;
253
+ const starPoints = 40 * Math.min(1, starWeight / 40);
254
+ const breadthPoints = 20 * Math.min(1, projectWeight / 8);
255
+ const agePoints = 10 * Math.min(1, oldestYears / 3);
256
+ return Math.min(IDENTITY_GITHUB_MAX_POINTS, starPoints + breadthPoints + agePoints);
257
+ }
258
+ //# sourceMappingURL=identity-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-history.js","sourceRoot":"","sources":["../../src/reputation/identity-history.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEnE;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAC1C,mFAAmF;AACnF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAG,UAAU,CAAC;AACtD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAC7C,oEAAoE;AACpE,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE7C,MAAM,QAAQ,GAAG,EAAE,GAAG,MAAM,CAAC;AAC7B,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,iBAAiB,GAAG,GAAG,CAAC;AA4B9B,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAgC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7G,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC7D,CAAC;AAED,SAAS,EAAE,CAAC,KAAc;IACxB,OAAO,OAAO,KAAK,KAA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,UAAU,GAAG,aAAa,GAAG,SAAS,CAAC,CAAC;AACtF,CAAC"}
@@ -1,10 +1,11 @@
1
1
  export declare const MISSING_CACHED_INPUT_PRICE_REPUTATION_MULTIPLIER = 0.5;
2
2
  export type ModelReputationSource = {
3
+ /** Buyer-computed trust score (0-100). */
3
4
  onChainReputationScore?: number | null;
4
- onChainTrustScore?: number | null;
5
+ /** Seller-reported score; only used when the buyer has not scored the peer. */
5
6
  reputationScore?: number | null;
6
7
  };
7
- /** Normalize every reputation source to the protocol's 0-100 score. */
8
+ /** The buyer's trust score when available, otherwise the seller-reported score. */
8
9
  export declare function normalizedModelReputationScore(source: ModelReputationSource): number | null;
9
10
  /**
10
11
  * Apply model-specific pricing completeness to a normalized reputation.