forked from Vero-protocol/vero-guardian-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstellar.js
More file actions
36 lines (28 loc) · 1.11 KB
/
Copy pathstellar.js
File metadata and controls
36 lines (28 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const { getVaultSecretStatus } = require('./src/services/vault-node');
async function registerTaskOnChain(githubId) {
const keyStatus = getVaultSecretStatus('STELLAR_SECRET_KEY');
const network = process.env.STELLAR_NETWORK || 'testnet';
console.log(`[stellar] Registering PR #${githubId} on ${network}`);
if (keyStatus.warning) {
console.warn(`[stellar] ${keyStatus.warning}`);
}
console.log(`[stellar] Source key loaded: ${formatVaultStatus(keyStatus)}`);
// Simulate transaction compilation
const txPayload = {
operation: 'manageData',
key: `task_${githubId}`,
value: 'wave-contribution',
network,
fee: 100,
};
console.log('[stellar] Transaction compiled:', JSON.stringify(txPayload, null, 2));
console.log(`[stellar] ✓ Task PR #${githubId} registered — awaiting submission`);
return { txPayload, status: 'simulated' };
}
function formatVaultStatus(keyStatus) {
if (!keyStatus.configured) {
return 'NO (vault entry missing)';
}
return keyStatus.hardwareBacked ? 'YES (hardware-backed vault)' : 'YES (encrypted vault)';
}
module.exports = { registerTaskOnChain };