@redditech/agent-protocol 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/LICENSE +21 -0
- package/README.md +394 -2
- package/dist/adl.d.ts +141 -0
- package/dist/adl.js +3601 -0
- package/dist/agent-stack-fixtures.d.ts +743 -0
- package/dist/agent-stack-fixtures.js +1554 -0
- package/dist/ai-catalog.d.ts +128 -0
- package/dist/ai-catalog.js +373 -0
- package/dist/attestation-reputation.d.ts +102 -0
- package/dist/attestation-reputation.js +279 -0
- package/dist/audd-rail-config.d.ts +102 -0
- package/dist/audd-rail-config.js +294 -0
- package/dist/browser-wallet-approval.d.ts +293 -0
- package/dist/browser-wallet-approval.js +1201 -0
- package/dist/discovery-source.d.ts +115 -0
- package/dist/discovery-source.js +251 -0
- package/dist/evidence-archive.d.ts +73 -0
- package/dist/evidence-archive.js +238 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +23 -0
- package/dist/mpp-tempo-receipt-shapes.d.ts +201 -0
- package/dist/mpp-tempo-receipt-shapes.js +330 -0
- package/dist/okf-adapter.d.ts +229 -0
- package/dist/okf-adapter.js +556 -0
- package/dist/okf-conformance.d.ts +208 -0
- package/dist/okf-conformance.js +651 -0
- package/dist/okf-instruction-safety.d.ts +192 -0
- package/dist/okf-instruction-safety.js +509 -0
- package/dist/onboarding-analyser-handoff.d.ts +391 -0
- package/dist/onboarding-analyser-handoff.js +959 -0
- package/dist/onboarding-state-machine.d.ts +228 -0
- package/dist/onboarding-state-machine.js +432 -0
- package/dist/payment-records.d.ts +181 -0
- package/dist/payment-records.js +599 -0
- package/dist/policy.d.ts +33 -0
- package/dist/policy.js +45 -0
- package/dist/provider-trust.d.ts +113 -0
- package/dist/provider-trust.js +346 -0
- package/dist/quasar-registry-compatibility.d.ts +113 -0
- package/dist/quasar-registry-compatibility.js +214 -0
- package/dist/ranking-explainability.d.ts +202 -0
- package/dist/ranking-explainability.js +302 -0
- package/dist/receipt-v2.d.ts +202 -0
- package/dist/receipt-v2.js +418 -0
- package/dist/repo-explorer-evidence-manifest.d.ts +387 -0
- package/dist/repo-explorer-evidence-manifest.js +1187 -0
- package/dist/source-diagnostics.d.ts +84 -0
- package/dist/source-diagnostics.js +193 -0
- package/dist/source-trust-conformance-matrix.d.ts +207 -0
- package/dist/source-trust-conformance-matrix.js +672 -0
- package/examples/ard-no-spend-ai-catalog.json +51 -0
- package/examples/ard-no-spend-demo.mjs +355 -0
- package/examples/interpretation-guide-scenarios.mjs +302 -0
- package/package.json +144 -4
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
export const ATTESTATION_RECORD_SCHEMA_VERSION = 'reddi.attestation.v1';
|
|
2
|
+
export const REPUTATION_EVENT_SCHEMA_VERSION = 'reddi.reputation-event.v1';
|
|
3
|
+
export const REPUTATION_STATE_SCHEMA_VERSION = 'reddi.reputation-state.v1';
|
|
4
|
+
export const DEFAULT_ATTESTATION_RUBRIC_DIMENSIONS = [
|
|
5
|
+
'evidence_integrity',
|
|
6
|
+
'policy_compliance',
|
|
7
|
+
'delivery_quality',
|
|
8
|
+
];
|
|
9
|
+
const HASH_PATTERN = /^sha256:[a-f0-9]{64}$/;
|
|
10
|
+
const SENSITIVE_KEY_PATTERN = /(^|[_-])(api[_-]?key|authorization|bearer|cookie|credential|mnemonic|password|private[_-]?key|refresh[_-]?token|secret|seed|session[_-]?token|signature|sig|signed|token)($|[_-])|apiKey|accessToken|refreshToken|sessionToken|privateKey|X-Goog-Signature|X-Amz-Signature/i;
|
|
11
|
+
const SENSITIVE_VALUE_PATTERN = /(-----BEGIN [A-Z ]*PRIVATE KEY-----|authorization:\s*bearer\s+|bearer\s+[a-z0-9._-]{8,}|sk-[a-z0-9_-]{8,})/i;
|
|
12
|
+
function error(code, path, message) {
|
|
13
|
+
return { code, path, message };
|
|
14
|
+
}
|
|
15
|
+
function isPlainObject(value) {
|
|
16
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
17
|
+
return false;
|
|
18
|
+
const prototype = Object.getPrototypeOf(value);
|
|
19
|
+
return prototype === Object.prototype || prototype === null;
|
|
20
|
+
}
|
|
21
|
+
function isNonEmptyString(value) {
|
|
22
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
23
|
+
}
|
|
24
|
+
function requireString(value, path, errors) {
|
|
25
|
+
if (!isNonEmptyString(value))
|
|
26
|
+
errors.push(error('malformed_attestation', path, 'required string is missing'));
|
|
27
|
+
}
|
|
28
|
+
function requireHash(value, path, errors) {
|
|
29
|
+
if (!isNonEmptyString(value) || !HASH_PATTERN.test(value)) {
|
|
30
|
+
errors.push(error('malformed_attestation', path, 'hash must be a sha256:<hex> reference'));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function validatePublicReference(value, path, errors) {
|
|
34
|
+
if (!isNonEmptyString(value))
|
|
35
|
+
return;
|
|
36
|
+
if (SENSITIVE_VALUE_PATTERN.test(value)) {
|
|
37
|
+
errors.push(error('credential_leakage_rejected', path, 'public attestation references must not include credential-shaped values'));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let parsed;
|
|
41
|
+
try {
|
|
42
|
+
parsed = new URL(value);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (parsed.username || parsed.password) {
|
|
48
|
+
errors.push(error('credential_leakage_rejected', path, 'public attestation references must not embed credentials'));
|
|
49
|
+
}
|
|
50
|
+
for (const key of parsed.searchParams.keys()) {
|
|
51
|
+
if (SENSITIVE_KEY_PATTERN.test(key)) {
|
|
52
|
+
errors.push(error('credential_leakage_rejected', `${path}.${key}`, 'public attestation references must not include credential-shaped query keys'));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
for (const queryValue of parsed.searchParams.values()) {
|
|
56
|
+
if (SENSITIVE_VALUE_PATTERN.test(queryValue)) {
|
|
57
|
+
errors.push(error('credential_leakage_rejected', path, 'public attestation references must not include credential-shaped query values'));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function findCredentialMaterial(value, path = '$') {
|
|
62
|
+
if (typeof value === 'string')
|
|
63
|
+
return SENSITIVE_VALUE_PATTERN.test(value) ? path : undefined;
|
|
64
|
+
if (!value || typeof value !== 'object')
|
|
65
|
+
return undefined;
|
|
66
|
+
if (Array.isArray(value)) {
|
|
67
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
68
|
+
const found = findCredentialMaterial(value[index], `${path}[${index}]`);
|
|
69
|
+
if (found)
|
|
70
|
+
return found;
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
75
|
+
const nextPath = `${path}.${key}`;
|
|
76
|
+
if (SENSITIVE_KEY_PATTERN.test(key))
|
|
77
|
+
return nextPath;
|
|
78
|
+
const found = findCredentialMaterial(nested, nextPath);
|
|
79
|
+
if (found)
|
|
80
|
+
return found;
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
function weightedRubricScore(dimensions) {
|
|
85
|
+
const totalWeight = dimensions.reduce((sum, dimension) => sum + dimension.weight, 0);
|
|
86
|
+
if (totalWeight <= 0)
|
|
87
|
+
return 0;
|
|
88
|
+
const weighted = dimensions.reduce((sum, dimension) => sum + (dimension.score * dimension.weight), 0);
|
|
89
|
+
return Math.round(weighted / totalWeight);
|
|
90
|
+
}
|
|
91
|
+
function clampScore(score) {
|
|
92
|
+
return Math.max(0, Math.min(1000, score));
|
|
93
|
+
}
|
|
94
|
+
function routingImpact(score) {
|
|
95
|
+
if (score >= 750)
|
|
96
|
+
return 'preferred';
|
|
97
|
+
if (score >= 500)
|
|
98
|
+
return 'eligible';
|
|
99
|
+
if (score >= 350)
|
|
100
|
+
return 'watch';
|
|
101
|
+
if (score > 0)
|
|
102
|
+
return 'deprioritized';
|
|
103
|
+
return 'blocked';
|
|
104
|
+
}
|
|
105
|
+
function baseDelta(attestation, rubricScore) {
|
|
106
|
+
if (attestation.workStatus === 'failed' || attestation.verdict === 'failed')
|
|
107
|
+
return -80;
|
|
108
|
+
if (attestation.workStatus === 'disputed' || attestation.verdict === 'disputed')
|
|
109
|
+
return -50;
|
|
110
|
+
if (attestation.workStatus === 'refunded' || attestation.verdict === 'refunded')
|
|
111
|
+
return -35;
|
|
112
|
+
if (rubricScore < 60)
|
|
113
|
+
return -25;
|
|
114
|
+
if (rubricScore < 75)
|
|
115
|
+
return 5;
|
|
116
|
+
if (rubricScore < 90)
|
|
117
|
+
return 18;
|
|
118
|
+
return 30;
|
|
119
|
+
}
|
|
120
|
+
function eventReasonCodes(attestation, rubricScore) {
|
|
121
|
+
const codes = ['evidence_attached'];
|
|
122
|
+
if (attestation.verdict === 'passed')
|
|
123
|
+
codes.push('attestation_passed');
|
|
124
|
+
if (attestation.verdict === 'failed')
|
|
125
|
+
codes.push('attestation_failed');
|
|
126
|
+
if (attestation.workStatus === 'disputed' || attestation.verdict === 'disputed')
|
|
127
|
+
codes.push('work_disputed');
|
|
128
|
+
if (attestation.workStatus === 'refunded' || attestation.verdict === 'refunded')
|
|
129
|
+
codes.push('work_refunded');
|
|
130
|
+
if (attestation.confidence < 70)
|
|
131
|
+
codes.push('low_confidence');
|
|
132
|
+
if (rubricScore < 75)
|
|
133
|
+
codes.push('rubric_below_threshold');
|
|
134
|
+
return codes;
|
|
135
|
+
}
|
|
136
|
+
export function validateAttestationRecord(input) {
|
|
137
|
+
const errors = [];
|
|
138
|
+
if (!isPlainObject(input)) {
|
|
139
|
+
return { ok: false, errors: [error('malformed_attestation', '$', 'attestation record must be a plain object')] };
|
|
140
|
+
}
|
|
141
|
+
const attestation = input;
|
|
142
|
+
if (attestation.schemaVersion !== ATTESTATION_RECORD_SCHEMA_VERSION) {
|
|
143
|
+
errors.push(error('malformed_attestation', '$.schemaVersion', `expected ${ATTESTATION_RECORD_SCHEMA_VERSION}`));
|
|
144
|
+
}
|
|
145
|
+
requireString(attestation.id, '$.id', errors);
|
|
146
|
+
requireString(attestation.receiptId, '$.receiptId', errors);
|
|
147
|
+
requireString(attestation.evidenceId, '$.evidenceId', errors);
|
|
148
|
+
requireString(attestation.evidenceRef, '$.evidenceRef', errors);
|
|
149
|
+
validatePublicReference(attestation.evidenceRef, '$.evidenceRef', errors);
|
|
150
|
+
requireHash(attestation.evidenceHash, '$.evidenceHash', errors);
|
|
151
|
+
requireString(attestation.attestor?.id, '$.attestor.id', errors);
|
|
152
|
+
if (!['self', 'external', 'reddi', 'local-fixture'].includes(String(attestation.attestor?.type))) {
|
|
153
|
+
errors.push(error('malformed_attestation', '$.attestor.type', 'attestor type is unsupported'));
|
|
154
|
+
}
|
|
155
|
+
if (!['self_attested', 'external_attested', 'reddi_attested', 'verified'].includes(String(attestation.trustBoundary))) {
|
|
156
|
+
errors.push(error('malformed_attestation', '$.trustBoundary', 'trust boundary is unsupported'));
|
|
157
|
+
}
|
|
158
|
+
if (!['passed', 'failed', 'disputed', 'refunded'].includes(String(attestation.verdict))) {
|
|
159
|
+
errors.push(error('malformed_attestation', '$.verdict', 'verdict is unsupported'));
|
|
160
|
+
}
|
|
161
|
+
if (!['completed', 'failed', 'disputed', 'refunded'].includes(String(attestation.workStatus))) {
|
|
162
|
+
errors.push(error('malformed_attestation', '$.workStatus', 'work status is unsupported'));
|
|
163
|
+
}
|
|
164
|
+
if (!Number.isInteger(attestation.confidence) || attestation.confidence < 0 || attestation.confidence > 100) {
|
|
165
|
+
errors.push(error('malformed_attestation', '$.confidence', 'confidence must be an integer from 0 to 100'));
|
|
166
|
+
}
|
|
167
|
+
if (!isNonEmptyString(attestation.createdAt) || Number.isNaN(Date.parse(attestation.createdAt))) {
|
|
168
|
+
errors.push(error('malformed_attestation', '$.createdAt', 'createdAt must be an ISO timestamp'));
|
|
169
|
+
}
|
|
170
|
+
if (!isPlainObject(attestation.rubric) || !Array.isArray(attestation.rubric.dimensions)) {
|
|
171
|
+
errors.push(error('missing_rubric_dimension', '$.rubric.dimensions', 'rubric dimensions are required'));
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const seen = new Set();
|
|
175
|
+
for (const [index, dimension] of attestation.rubric.dimensions.entries()) {
|
|
176
|
+
const path = `$.rubric.dimensions[${index}]`;
|
|
177
|
+
if (!isPlainObject(dimension)) {
|
|
178
|
+
errors.push(error('invalid_rubric_dimension', path, 'rubric dimension must be an object'));
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
requireString(dimension.id, `${path}.id`, errors);
|
|
182
|
+
if (isNonEmptyString(dimension.id))
|
|
183
|
+
seen.add(dimension.id);
|
|
184
|
+
if (!Number.isInteger(dimension.score) || dimension.score < 0 || dimension.score > 100) {
|
|
185
|
+
errors.push(error('invalid_rubric_dimension', `${path}.score`, 'rubric score must be an integer from 0 to 100'));
|
|
186
|
+
}
|
|
187
|
+
if (!Number.isInteger(dimension.weight) || dimension.weight <= 0) {
|
|
188
|
+
errors.push(error('invalid_rubric_dimension', `${path}.weight`, 'rubric weight must be a positive integer'));
|
|
189
|
+
}
|
|
190
|
+
requireString(dimension.summary, `${path}.summary`, errors);
|
|
191
|
+
if (!Array.isArray(dimension.reasonCodes) || dimension.reasonCodes.some((code) => typeof code !== 'string' || code.trim().length === 0)) {
|
|
192
|
+
errors.push(error('invalid_rubric_dimension', `${path}.reasonCodes`, 'reasonCodes must be a non-empty string array'));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
for (const dimensionId of DEFAULT_ATTESTATION_RUBRIC_DIMENSIONS) {
|
|
196
|
+
if (!seen.has(dimensionId)) {
|
|
197
|
+
errors.push(error('missing_rubric_dimension', '$.rubric.dimensions', `missing required rubric dimension ${dimensionId}`));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const credentialPath = findCredentialMaterial(attestation.metadata);
|
|
202
|
+
if (credentialPath) {
|
|
203
|
+
errors.push(error('credential_leakage_rejected', `$.metadata${credentialPath.slice(1)}`, 'attestation metadata contains credential-shaped material'));
|
|
204
|
+
}
|
|
205
|
+
return errors.length === 0 ? { ok: true, attestation } : { ok: false, errors };
|
|
206
|
+
}
|
|
207
|
+
export function createAttestationRecord(input) {
|
|
208
|
+
const result = validateAttestationRecord(input);
|
|
209
|
+
if (!result.ok) {
|
|
210
|
+
throw new Error(`invalid_attestation_record:${result.errors.map((item) => `${item.code}:${item.path}`).join(',')}`);
|
|
211
|
+
}
|
|
212
|
+
return result.attestation;
|
|
213
|
+
}
|
|
214
|
+
export function createInitialReputationState(subject, updatedAt = '1970-01-01T00:00:00.000Z') {
|
|
215
|
+
return {
|
|
216
|
+
schemaVersion: REPUTATION_STATE_SCHEMA_VERSION,
|
|
217
|
+
subject,
|
|
218
|
+
score: 500,
|
|
219
|
+
routingImpact: 'unproven',
|
|
220
|
+
completedJobs: 0,
|
|
221
|
+
attestedJobs: 0,
|
|
222
|
+
failedJobs: 0,
|
|
223
|
+
disputedJobs: 0,
|
|
224
|
+
refundedJobs: 0,
|
|
225
|
+
updatedAt,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
export function applyAttestationToReputation(attestationInput, previousState, options = {}) {
|
|
229
|
+
const validation = validateAttestationRecord(attestationInput);
|
|
230
|
+
const state = previousState ?? createInitialReputationState(options.subject ?? { id: 'unknown', type: 'specialist' }, options.now ?? '1970-01-01T00:00:00.000Z');
|
|
231
|
+
if (!validation.ok) {
|
|
232
|
+
return { ok: false, errors: validation.errors, state };
|
|
233
|
+
}
|
|
234
|
+
const attestation = validation.attestation;
|
|
235
|
+
const subject = previousState?.subject ?? options.subject ?? { id: attestation.receiptId, type: 'specialist' };
|
|
236
|
+
const rubricScore = weightedRubricScore(attestation.rubric.dimensions);
|
|
237
|
+
const rawDelta = baseDelta(attestation, rubricScore);
|
|
238
|
+
const delta = Math.round((rawDelta * attestation.confidence) / 100);
|
|
239
|
+
const previousScore = state.score;
|
|
240
|
+
const nextScore = clampScore(previousScore + delta);
|
|
241
|
+
const nextImpact = routingImpact(nextScore);
|
|
242
|
+
const createdAt = options.now ?? attestation.createdAt;
|
|
243
|
+
const event = {
|
|
244
|
+
schemaVersion: REPUTATION_EVENT_SCHEMA_VERSION,
|
|
245
|
+
id: `reputation:${attestation.id}`,
|
|
246
|
+
subjectId: subject.id,
|
|
247
|
+
receiptId: attestation.receiptId,
|
|
248
|
+
attestationId: attestation.id,
|
|
249
|
+
evidenceId: attestation.evidenceId,
|
|
250
|
+
verdict: attestation.verdict,
|
|
251
|
+
workStatus: attestation.workStatus,
|
|
252
|
+
trustBoundary: attestation.trustBoundary,
|
|
253
|
+
confidence: attestation.confidence,
|
|
254
|
+
rubricScore,
|
|
255
|
+
delta,
|
|
256
|
+
previousScore,
|
|
257
|
+
nextScore,
|
|
258
|
+
routingImpact: nextImpact,
|
|
259
|
+
reasonCodes: eventReasonCodes(attestation, rubricScore),
|
|
260
|
+
createdAt,
|
|
261
|
+
};
|
|
262
|
+
return {
|
|
263
|
+
ok: true,
|
|
264
|
+
event,
|
|
265
|
+
state: {
|
|
266
|
+
...state,
|
|
267
|
+
subject,
|
|
268
|
+
score: nextScore,
|
|
269
|
+
routingImpact: nextImpact,
|
|
270
|
+
completedJobs: state.completedJobs + (attestation.workStatus === 'completed' ? 1 : 0),
|
|
271
|
+
attestedJobs: state.attestedJobs + 1,
|
|
272
|
+
failedJobs: state.failedJobs + (attestation.workStatus === 'failed' ? 1 : 0),
|
|
273
|
+
disputedJobs: state.disputedJobs + (attestation.workStatus === 'disputed' ? 1 : 0),
|
|
274
|
+
refundedJobs: state.refundedJobs + (attestation.workStatus === 'refunded' ? 1 : 0),
|
|
275
|
+
lastEventId: event.id,
|
|
276
|
+
updatedAt: createdAt,
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { ReddiPaymentEligibilityLabel, ReddiPaymentEnvironmentLabel } from './payment-records.js';
|
|
2
|
+
export declare const AUDD_RAIL_CONFIG_SCHEMA_VERSION: "reddi.audd-rail-config.v1";
|
|
3
|
+
export declare const AUDD_ASSET: "AUDD";
|
|
4
|
+
export declare function isAuddAsset(value: unknown): value is string;
|
|
5
|
+
export declare const AUDD_DECIMALS: 6;
|
|
6
|
+
export declare const AUDD_DETERMINISTIC_FIXTURE_MINT: "AUDDdev111111111111111111111111111111111111";
|
|
7
|
+
export declare const AUDD_OFFICIAL_SOLANA_MAINNET_MINT: "AUDDttiEpCydTm7joUMbYddm72jAWXZnCpPZtDoxqBSw";
|
|
8
|
+
export declare const SPL_TOKEN_PROGRAM_ID: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
9
|
+
export declare const SOLANA_MAINNET_BETA_CAIP2: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
10
|
+
export declare const SOLANA_DEVNET_CAIP2: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
|
|
11
|
+
export declare const SOLANA_TESTNET_CAIP2: "solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z";
|
|
12
|
+
export type AuddRailEnvironment = 'deterministic-fixture' | 'local-test-mint' | 'devnet-unverified' | 'mainnet-gated';
|
|
13
|
+
export type AuddRailStatus = 'deterministic-fixture-only' | 'generated-local-test-mint' | 'unverified-blocked-devnet' | 'gated-mainnet-disabled-by-default';
|
|
14
|
+
export type AuddRailIdentityValidationReasonCode = 'audd_rail_identity_allowed' | 'malformed_audd_rail_identity' | 'unknown_audd_rail_environment' | 'wrong_network' | 'wrong_caip2_network' | 'wrong_mint' | 'wrong_token_program' | 'wrong_decimals' | 'local_test_mint_required' | 'devnet_unverified_blocked' | 'mainnet_audd_disabled_by_default';
|
|
15
|
+
export type AuddRailProvenance = {
|
|
16
|
+
verifiedAt: string;
|
|
17
|
+
confidence: 'fixture' | 'local-generated' | 'unverified' | 'verified-public-mainnet';
|
|
18
|
+
sources: string[];
|
|
19
|
+
facts: string[];
|
|
20
|
+
};
|
|
21
|
+
export type AuddRailEnvironmentConfig = {
|
|
22
|
+
environment: AuddRailEnvironment;
|
|
23
|
+
status: AuddRailStatus;
|
|
24
|
+
networkAlias: string;
|
|
25
|
+
caip2?: string;
|
|
26
|
+
defaultEnabled: boolean;
|
|
27
|
+
grantEligibility: ReddiPaymentEligibilityLabel;
|
|
28
|
+
evidenceEnvironment: ReddiPaymentEnvironmentLabel;
|
|
29
|
+
mint?: string;
|
|
30
|
+
mints?: string[];
|
|
31
|
+
mintPolicy?: string;
|
|
32
|
+
tokenProgram?: string | null;
|
|
33
|
+
decimals: typeof AUDD_DECIMALS;
|
|
34
|
+
provenance: AuddRailProvenance[];
|
|
35
|
+
activationRequires?: string[];
|
|
36
|
+
notes: string[];
|
|
37
|
+
};
|
|
38
|
+
export type AuddRailConfig = {
|
|
39
|
+
schemaVersion: typeof AUDD_RAIL_CONFIG_SCHEMA_VERSION;
|
|
40
|
+
asset: typeof AUDD_ASSET;
|
|
41
|
+
decimals: typeof AUDD_DECIMALS;
|
|
42
|
+
tokenPrograms: {
|
|
43
|
+
splToken: typeof SPL_TOKEN_PROGRAM_ID;
|
|
44
|
+
};
|
|
45
|
+
caip2Networks: {
|
|
46
|
+
'solana-devnet': typeof SOLANA_DEVNET_CAIP2;
|
|
47
|
+
'solana-mainnet-beta': typeof SOLANA_MAINNET_BETA_CAIP2;
|
|
48
|
+
'solana-testnet': typeof SOLANA_TESTNET_CAIP2;
|
|
49
|
+
};
|
|
50
|
+
environments: Record<AuddRailEnvironment, AuddRailEnvironmentConfig>;
|
|
51
|
+
};
|
|
52
|
+
export type AuddRailIdentityInput = {
|
|
53
|
+
environment: AuddRailEnvironment | string;
|
|
54
|
+
network?: string;
|
|
55
|
+
caip2?: string;
|
|
56
|
+
mint?: string;
|
|
57
|
+
tokenProgram?: string | null;
|
|
58
|
+
decimals?: number;
|
|
59
|
+
/** Explicit approval flag for identity validation only; it does not submit, sign, or activate live payments. */
|
|
60
|
+
enableGatedMainnet?: boolean;
|
|
61
|
+
};
|
|
62
|
+
export type AuddRailIdentityRefInput = {
|
|
63
|
+
network?: string;
|
|
64
|
+
caip2Network?: string;
|
|
65
|
+
mint?: string;
|
|
66
|
+
};
|
|
67
|
+
export type AuddRailIdentity = {
|
|
68
|
+
asset: typeof AUDD_ASSET;
|
|
69
|
+
environment: AuddRailEnvironment;
|
|
70
|
+
status: AuddRailStatus;
|
|
71
|
+
network: string;
|
|
72
|
+
caip2?: string;
|
|
73
|
+
mint?: string;
|
|
74
|
+
tokenProgram?: string | null;
|
|
75
|
+
decimals: typeof AUDD_DECIMALS;
|
|
76
|
+
defaultEnabled: boolean;
|
|
77
|
+
grantEligibility: ReddiPaymentEligibilityLabel;
|
|
78
|
+
evidenceEnvironment: ReddiPaymentEnvironmentLabel;
|
|
79
|
+
provenance: AuddRailProvenance[];
|
|
80
|
+
activationRequires?: string[];
|
|
81
|
+
notes: string[];
|
|
82
|
+
};
|
|
83
|
+
export type AuddRailIdentityValidationResult = {
|
|
84
|
+
ok: true;
|
|
85
|
+
identity: AuddRailIdentity;
|
|
86
|
+
reasonCodes: ['audd_rail_identity_allowed'];
|
|
87
|
+
auditNotes: string[];
|
|
88
|
+
} | {
|
|
89
|
+
ok: false;
|
|
90
|
+
identity?: AuddRailIdentity;
|
|
91
|
+
reasonCodes: AuddRailIdentityValidationReasonCode[];
|
|
92
|
+
auditNotes: string[];
|
|
93
|
+
};
|
|
94
|
+
export declare const AUDD_RAIL_CONFIG: AuddRailConfig;
|
|
95
|
+
export declare function isKnownAuddMint(mint: unknown): boolean;
|
|
96
|
+
export declare function canonicalSolanaNetworkAlias(network: unknown): string | undefined;
|
|
97
|
+
export declare function caip2ForSolanaNetwork(network: string): string | undefined;
|
|
98
|
+
export declare function networkAliasForCaip2(caip2: string): string | undefined;
|
|
99
|
+
export declare function getAuddRailEnvironmentConfig(environment: AuddRailEnvironment): AuddRailEnvironmentConfig;
|
|
100
|
+
export declare function auddRailIdentityTargetsMainnet(input: AuddRailIdentityRefInput): boolean;
|
|
101
|
+
export declare function deriveCanonicalAuddRailEnvironment(input: AuddRailIdentityRefInput): AuddRailEnvironment | undefined;
|
|
102
|
+
export declare function validateAuddRailIdentity(input: AuddRailIdentityInput): AuddRailIdentityValidationResult;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
export const AUDD_RAIL_CONFIG_SCHEMA_VERSION = 'reddi.audd-rail-config.v1';
|
|
2
|
+
export const AUDD_ASSET = 'AUDD';
|
|
3
|
+
export function isAuddAsset(value) {
|
|
4
|
+
return typeof value === 'string' && value.toUpperCase() === AUDD_ASSET;
|
|
5
|
+
}
|
|
6
|
+
export const AUDD_DECIMALS = 6;
|
|
7
|
+
export const AUDD_DETERMINISTIC_FIXTURE_MINT = 'AUDDdev111111111111111111111111111111111111';
|
|
8
|
+
export const AUDD_OFFICIAL_SOLANA_MAINNET_MINT = 'AUDDttiEpCydTm7joUMbYddm72jAWXZnCpPZtDoxqBSw';
|
|
9
|
+
export const SPL_TOKEN_PROGRAM_ID = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
10
|
+
export const SOLANA_MAINNET_BETA_CAIP2 = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';
|
|
11
|
+
export const SOLANA_DEVNET_CAIP2 = 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1';
|
|
12
|
+
export const SOLANA_TESTNET_CAIP2 = 'solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z';
|
|
13
|
+
export const AUDD_RAIL_CONFIG = {
|
|
14
|
+
schemaVersion: AUDD_RAIL_CONFIG_SCHEMA_VERSION,
|
|
15
|
+
asset: AUDD_ASSET,
|
|
16
|
+
decimals: AUDD_DECIMALS,
|
|
17
|
+
tokenPrograms: {
|
|
18
|
+
splToken: SPL_TOKEN_PROGRAM_ID,
|
|
19
|
+
},
|
|
20
|
+
caip2Networks: {
|
|
21
|
+
'solana-devnet': SOLANA_DEVNET_CAIP2,
|
|
22
|
+
'solana-mainnet-beta': SOLANA_MAINNET_BETA_CAIP2,
|
|
23
|
+
'solana-testnet': SOLANA_TESTNET_CAIP2,
|
|
24
|
+
},
|
|
25
|
+
environments: {
|
|
26
|
+
'deterministic-fixture': {
|
|
27
|
+
environment: 'deterministic-fixture',
|
|
28
|
+
status: 'deterministic-fixture-only',
|
|
29
|
+
networkAlias: 'solana-devnet',
|
|
30
|
+
caip2: SOLANA_DEVNET_CAIP2,
|
|
31
|
+
defaultEnabled: true,
|
|
32
|
+
grantEligibility: 'non_eligible',
|
|
33
|
+
evidenceEnvironment: 'deterministic-fixture',
|
|
34
|
+
mint: AUDD_DETERMINISTIC_FIXTURE_MINT,
|
|
35
|
+
tokenProgram: SPL_TOKEN_PROGRAM_ID,
|
|
36
|
+
decimals: AUDD_DECIMALS,
|
|
37
|
+
provenance: [
|
|
38
|
+
{
|
|
39
|
+
verifiedAt: '2026-09-01T00:00:00.000Z',
|
|
40
|
+
confidence: 'fixture',
|
|
41
|
+
sources: ['data/audd-solana-implementation-design/report.md §5.1'],
|
|
42
|
+
facts: [
|
|
43
|
+
'Deterministic AUDD fixture sentinel for unit tests only.',
|
|
44
|
+
'The sentinel mint must never be presented as an official AUDD devnet mint or sent to live RPC.',
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
notes: [
|
|
49
|
+
'Offline deterministic fixture rail only; it is not a devnet settlement asset.',
|
|
50
|
+
'Grant-volume eligibility is always false for fixture evidence.',
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
'local-test-mint': {
|
|
54
|
+
environment: 'local-test-mint',
|
|
55
|
+
status: 'generated-local-test-mint',
|
|
56
|
+
networkAlias: 'local-surfpool',
|
|
57
|
+
defaultEnabled: true,
|
|
58
|
+
grantEligibility: 'non_eligible',
|
|
59
|
+
evidenceEnvironment: 'local-test-mint',
|
|
60
|
+
mintPolicy: 'Generated per local test run as AUDD_TEST with six decimals; not an AUDD official mint.',
|
|
61
|
+
tokenProgram: SPL_TOKEN_PROGRAM_ID,
|
|
62
|
+
decimals: AUDD_DECIMALS,
|
|
63
|
+
provenance: [
|
|
64
|
+
{
|
|
65
|
+
verifiedAt: '2026-09-01T00:00:00.000Z',
|
|
66
|
+
confidence: 'local-generated',
|
|
67
|
+
sources: ['data/audd-solana-implementation-design/report.md §5.1'],
|
|
68
|
+
facts: ['Local generated mints are test assets and are ineligible for grant volume.'],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
notes: ['Use only for local validator/LiteSVM/Surfpool style tests with generated token accounts.'],
|
|
72
|
+
},
|
|
73
|
+
'devnet-unverified': {
|
|
74
|
+
environment: 'devnet-unverified',
|
|
75
|
+
status: 'unverified-blocked-devnet',
|
|
76
|
+
networkAlias: 'solana-devnet',
|
|
77
|
+
caip2: SOLANA_DEVNET_CAIP2,
|
|
78
|
+
defaultEnabled: false,
|
|
79
|
+
grantEligibility: 'non_eligible',
|
|
80
|
+
evidenceEnvironment: 'devnet-unverified',
|
|
81
|
+
mints: [],
|
|
82
|
+
tokenProgram: SPL_TOKEN_PROGRAM_ID,
|
|
83
|
+
decimals: AUDD_DECIMALS,
|
|
84
|
+
provenance: [
|
|
85
|
+
{
|
|
86
|
+
verifiedAt: '2026-09-01T00:00:00.000Z',
|
|
87
|
+
confidence: 'unverified',
|
|
88
|
+
sources: ['data/audd-solana-implementation-design/report.md §2.7, §5.1'],
|
|
89
|
+
facts: ['No official AUDD devnet mint was verified; no devnet mint is implied by this config.'],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
activationRequires: ['written AUDD/partner source for a test mint', 'captain approval', 'operator approval'],
|
|
93
|
+
notes: ['Devnet AUDD is explicitly blocked until an exact test mint is approved with provenance.'],
|
|
94
|
+
},
|
|
95
|
+
'mainnet-gated': {
|
|
96
|
+
environment: 'mainnet-gated',
|
|
97
|
+
status: 'gated-mainnet-disabled-by-default',
|
|
98
|
+
networkAlias: 'solana-mainnet-beta',
|
|
99
|
+
caip2: SOLANA_MAINNET_BETA_CAIP2,
|
|
100
|
+
defaultEnabled: false,
|
|
101
|
+
grantEligibility: 'pending_partner_acceptance',
|
|
102
|
+
evidenceEnvironment: 'mainnet-gated',
|
|
103
|
+
mint: AUDD_OFFICIAL_SOLANA_MAINNET_MINT,
|
|
104
|
+
tokenProgram: SPL_TOKEN_PROGRAM_ID,
|
|
105
|
+
decimals: AUDD_DECIMALS,
|
|
106
|
+
provenance: [
|
|
107
|
+
{
|
|
108
|
+
verifiedAt: '2026-09-01T00:00:00.000Z',
|
|
109
|
+
confidence: 'verified-public-mainnet',
|
|
110
|
+
sources: [
|
|
111
|
+
'https://www.audd.digital/faq/',
|
|
112
|
+
'read-only Solana mainnet RPC getAccountInfo/getTokenSupply recorded in data/audd-solana-implementation-design/report.md §2.7',
|
|
113
|
+
],
|
|
114
|
+
facts: [
|
|
115
|
+
`Official AUDD Solana mainnet mint: ${AUDD_OFFICIAL_SOLANA_MAINNET_MINT}`,
|
|
116
|
+
`Mint account owner / SPL Token program: ${SPL_TOKEN_PROGRAM_ID}`,
|
|
117
|
+
'Decimals: 6',
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
activationRequires: [
|
|
122
|
+
'separate exact captain approval naming mainnet AUDD',
|
|
123
|
+
'operator signer approval and spend caps',
|
|
124
|
+
'legal/compliance review',
|
|
125
|
+
'written AUDD milestone/evidence alignment',
|
|
126
|
+
'readiness/audit gates including the PR #646 workback',
|
|
127
|
+
],
|
|
128
|
+
notes: [
|
|
129
|
+
'Public token identity only. Mainnet is disabled by default and this config does not authorize live transfers.',
|
|
130
|
+
'Grant eligibility remains pending partner acceptance even after a future approved live observation.',
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
export function isKnownAuddMint(mint) {
|
|
136
|
+
if (typeof mint !== 'string')
|
|
137
|
+
return false;
|
|
138
|
+
const candidate = mint.trim().toLowerCase();
|
|
139
|
+
return candidate === AUDD_OFFICIAL_SOLANA_MAINNET_MINT.toLowerCase()
|
|
140
|
+
|| candidate === AUDD_DETERMINISTIC_FIXTURE_MINT.toLowerCase();
|
|
141
|
+
}
|
|
142
|
+
export function canonicalSolanaNetworkAlias(network) {
|
|
143
|
+
if (typeof network !== 'string')
|
|
144
|
+
return undefined;
|
|
145
|
+
const alias = network.trim().toLowerCase();
|
|
146
|
+
return Object.prototype.hasOwnProperty.call(AUDD_RAIL_CONFIG.caip2Networks, alias) ? alias : undefined;
|
|
147
|
+
}
|
|
148
|
+
export function caip2ForSolanaNetwork(network) {
|
|
149
|
+
const alias = canonicalSolanaNetworkAlias(network);
|
|
150
|
+
return alias === undefined
|
|
151
|
+
? undefined
|
|
152
|
+
: AUDD_RAIL_CONFIG.caip2Networks[alias];
|
|
153
|
+
}
|
|
154
|
+
export function networkAliasForCaip2(caip2) {
|
|
155
|
+
for (const [alias, value] of Object.entries(AUDD_RAIL_CONFIG.caip2Networks)) {
|
|
156
|
+
if (value === caip2)
|
|
157
|
+
return alias;
|
|
158
|
+
}
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
export function getAuddRailEnvironmentConfig(environment) {
|
|
162
|
+
return AUDD_RAIL_CONFIG.environments[environment];
|
|
163
|
+
}
|
|
164
|
+
export function auddRailIdentityTargetsMainnet(input) {
|
|
165
|
+
return canonicalSolanaNetworkAlias(input.network) === 'solana-mainnet-beta'
|
|
166
|
+
|| input.caip2Network === SOLANA_MAINNET_BETA_CAIP2
|
|
167
|
+
|| (typeof input.mint === 'string' && normalized(input.mint) === normalized(AUDD_OFFICIAL_SOLANA_MAINNET_MINT));
|
|
168
|
+
}
|
|
169
|
+
export function deriveCanonicalAuddRailEnvironment(input) {
|
|
170
|
+
if (auddRailIdentityTargetsMainnet(input))
|
|
171
|
+
return 'mainnet-gated';
|
|
172
|
+
if (typeof input.mint === 'string' && normalized(input.mint) === normalized(AUDD_DETERMINISTIC_FIXTURE_MINT))
|
|
173
|
+
return 'deterministic-fixture';
|
|
174
|
+
const alias = canonicalSolanaNetworkAlias(input.network);
|
|
175
|
+
if (alias === 'solana-devnet' || input.caip2Network === SOLANA_DEVNET_CAIP2)
|
|
176
|
+
return 'devnet-unverified';
|
|
177
|
+
if (typeof input.network === 'string' && normalized(input.network) === getAuddRailEnvironmentConfig('local-test-mint').networkAlias)
|
|
178
|
+
return 'local-test-mint';
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
export function validateAuddRailIdentity(input) {
|
|
182
|
+
const errors = [];
|
|
183
|
+
const auditNotes = [];
|
|
184
|
+
if (!input || typeof input !== 'object' || Array.isArray(input)) {
|
|
185
|
+
return {
|
|
186
|
+
ok: false,
|
|
187
|
+
reasonCodes: ['malformed_audd_rail_identity'],
|
|
188
|
+
auditNotes: ['Denied: AUDD rail identity input must be an object.'],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
if (!isAuddRailEnvironment(input.environment)) {
|
|
192
|
+
return {
|
|
193
|
+
ok: false,
|
|
194
|
+
reasonCodes: ['unknown_audd_rail_environment'],
|
|
195
|
+
auditNotes: [`Denied: ${String(input.environment)} is not a known AUDD rail environment.`],
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
const config = AUDD_RAIL_CONFIG.environments[input.environment];
|
|
199
|
+
const identity = buildIdentity(config, input);
|
|
200
|
+
if (input.network !== undefined && input.network !== config.networkAlias) {
|
|
201
|
+
errors.push('wrong_network');
|
|
202
|
+
auditNotes.push(`Denied: network ${input.network} does not match ${config.networkAlias} for ${config.environment}.`);
|
|
203
|
+
}
|
|
204
|
+
if (input.caip2 !== undefined && input.caip2 !== config.caip2) {
|
|
205
|
+
errors.push('wrong_caip2_network');
|
|
206
|
+
auditNotes.push(`Denied: CAIP-2 network ${input.caip2} does not match ${config.caip2 ?? 'none'} for ${config.environment}.`);
|
|
207
|
+
}
|
|
208
|
+
if (input.decimals !== undefined && input.decimals !== AUDD_DECIMALS) {
|
|
209
|
+
errors.push('wrong_decimals');
|
|
210
|
+
auditNotes.push('Denied: AUDD rail identity must use six decimals.');
|
|
211
|
+
}
|
|
212
|
+
switch (config.environment) {
|
|
213
|
+
case 'deterministic-fixture':
|
|
214
|
+
if (input.mint !== undefined && input.mint !== AUDD_DETERMINISTIC_FIXTURE_MINT) {
|
|
215
|
+
errors.push('wrong_mint');
|
|
216
|
+
auditNotes.push('Denied: deterministic fixture identity must use the AUDD fixture sentinel mint.');
|
|
217
|
+
}
|
|
218
|
+
if (input.tokenProgram !== undefined && input.tokenProgram !== null && input.tokenProgram !== SPL_TOKEN_PROGRAM_ID) {
|
|
219
|
+
errors.push('wrong_token_program');
|
|
220
|
+
auditNotes.push('Denied: deterministic SPL fixtures must name the SPL Token program when a token program is present.');
|
|
221
|
+
}
|
|
222
|
+
break;
|
|
223
|
+
case 'local-test-mint':
|
|
224
|
+
if (!isNonEmptyString(input.mint)) {
|
|
225
|
+
errors.push('local_test_mint_required');
|
|
226
|
+
auditNotes.push('Denied: local-test-mint identity requires the generated test mint address for this run.');
|
|
227
|
+
}
|
|
228
|
+
else if (input.mint === AUDD_OFFICIAL_SOLANA_MAINNET_MINT || input.mint === AUDD_DETERMINISTIC_FIXTURE_MINT) {
|
|
229
|
+
errors.push('wrong_mint');
|
|
230
|
+
auditNotes.push('Denied: local test mints must be generated per run and must not reuse the official or fixture AUDD mint.');
|
|
231
|
+
}
|
|
232
|
+
if (input.tokenProgram !== undefined && input.tokenProgram !== SPL_TOKEN_PROGRAM_ID) {
|
|
233
|
+
errors.push('wrong_token_program');
|
|
234
|
+
auditNotes.push('Denied: local test mints must use the SPL Token program.');
|
|
235
|
+
}
|
|
236
|
+
break;
|
|
237
|
+
case 'devnet-unverified':
|
|
238
|
+
errors.push('devnet_unverified_blocked');
|
|
239
|
+
auditNotes.push('Denied: no official AUDD devnet mint is configured or implied; devnet AUDD remains blocked.');
|
|
240
|
+
break;
|
|
241
|
+
case 'mainnet-gated':
|
|
242
|
+
if (input.mint !== undefined && input.mint !== AUDD_OFFICIAL_SOLANA_MAINNET_MINT) {
|
|
243
|
+
errors.push('wrong_mint');
|
|
244
|
+
auditNotes.push('Denied: mainnet-gated AUDD identity must use the verified official AUDD Solana mint.');
|
|
245
|
+
}
|
|
246
|
+
if (input.tokenProgram !== undefined && input.tokenProgram !== SPL_TOKEN_PROGRAM_ID) {
|
|
247
|
+
errors.push('wrong_token_program');
|
|
248
|
+
auditNotes.push('Denied: mainnet-gated AUDD identity must use the SPL Token program recorded in provenance.');
|
|
249
|
+
}
|
|
250
|
+
if (input.enableGatedMainnet !== true) {
|
|
251
|
+
errors.push('mainnet_audd_disabled_by_default');
|
|
252
|
+
auditNotes.push('Denied: mainnet AUDD identity is public configuration only and is disabled by default.');
|
|
253
|
+
}
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
if (errors.length > 0)
|
|
257
|
+
return { ok: false, identity, reasonCodes: unique(errors), auditNotes };
|
|
258
|
+
return {
|
|
259
|
+
ok: true,
|
|
260
|
+
identity,
|
|
261
|
+
reasonCodes: ['audd_rail_identity_allowed'],
|
|
262
|
+
auditNotes: [`Allowed: ${config.environment} AUDD rail identity is valid for non-live configuration use.`],
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function buildIdentity(config, input) {
|
|
266
|
+
return {
|
|
267
|
+
asset: AUDD_ASSET,
|
|
268
|
+
environment: config.environment,
|
|
269
|
+
status: config.status,
|
|
270
|
+
network: config.networkAlias,
|
|
271
|
+
caip2: config.caip2,
|
|
272
|
+
mint: input.mint ?? config.mint,
|
|
273
|
+
tokenProgram: input.tokenProgram ?? config.tokenProgram,
|
|
274
|
+
decimals: AUDD_DECIMALS,
|
|
275
|
+
defaultEnabled: config.defaultEnabled,
|
|
276
|
+
grantEligibility: config.grantEligibility,
|
|
277
|
+
evidenceEnvironment: config.evidenceEnvironment,
|
|
278
|
+
provenance: config.provenance,
|
|
279
|
+
activationRequires: config.activationRequires,
|
|
280
|
+
notes: config.notes,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function unique(items) {
|
|
284
|
+
return Array.from(new Set(items));
|
|
285
|
+
}
|
|
286
|
+
function normalized(value) {
|
|
287
|
+
return value.trim().toLowerCase();
|
|
288
|
+
}
|
|
289
|
+
function isAuddRailEnvironment(value) {
|
|
290
|
+
return ['deterministic-fixture', 'local-test-mint', 'devnet-unverified', 'mainnet-gated'].includes(String(value));
|
|
291
|
+
}
|
|
292
|
+
function isNonEmptyString(value) {
|
|
293
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
294
|
+
}
|