fix(token-service): use known DID for jeff seed instead of cross-container API call
The directory API only returns space members, and jeff isn't in demo space. Hardcode the known DID with SEED_JEFF_DID env var override support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
df453d9e00
commit
36931b2d30
|
|
@ -139,26 +139,8 @@ export async function seedCUSDC() {
|
|||
});
|
||||
}
|
||||
|
||||
// Look up jeff's DID via EncryptID user directory API
|
||||
let jeffDid: string | null = null;
|
||||
try {
|
||||
const authBase = process.env.ENCRYPTID_URL || 'http://encryptid:3000';
|
||||
const res = await fetch(`${authBase}/api/users/directory?space=demo`, {
|
||||
signal: AbortSignal.timeout(5000),
|
||||
});
|
||||
if (res.ok) {
|
||||
const data = await res.json() as { users?: Array<{ did?: string; username?: string }> };
|
||||
const jeff = (data.users || []).find((u) => u.username === 'jeff');
|
||||
jeffDid = jeff?.did || null;
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('[TokenService] EncryptID not reachable, will retry next startup:', (e as Error).message);
|
||||
}
|
||||
|
||||
if (!jeffDid) {
|
||||
console.warn('[TokenService] Could not resolve jeff DID — will retry next startup');
|
||||
return;
|
||||
}
|
||||
// Resolve jeff's DID — use known DID with env override support
|
||||
const jeffDid = process.env.SEED_JEFF_DID || 'did:key:jAV6y4tg8UbKJEkN0npvX8CTdJkSCGpU';
|
||||
|
||||
// Mint 5 cUSDC (5 × 10^6 base units)
|
||||
const success = mintTokens(tokenId, jeffDid, 'jeff', 5_000_000, 'Initial seed mint', 'system');
|
||||
|
|
|
|||
Loading…
Reference in New Issue