-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-abi-references.js
More file actions
executable file
·70 lines (58 loc) · 1.66 KB
/
Copy pathfix-abi-references.js
File metadata and controls
executable file
·70 lines (58 loc) · 1.66 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env node
/**
* Fix ABI References Script
*
* This script fixes all .abi references in the frontend code
* since the ABI files are arrays directly, not objects with .abi property
*/
const fs = require('fs');
const path = require('path');
// Files to fix
const filesToFix = [
'services/contractAnalyticsService.ts',
'services/oddyssey-contract.ts',
'services/poolStateService.ts',
'services/reputationService.ts',
'hooks/useOddyssey.ts'
];
// ABI imports to fix
const abiImports = [
'PredinexTokenABI',
'PrixFaucetABI',
'GuidedOracleABI',
'OptimisticOracleABI',
'PredinexPoolCoreABI',
'PredinexBoostSystemABI',
'PredinexComboPoolsABI',
'PredinexPoolFactoryABI',
'PredinexStakingABI',
'ReputationSystemABI',
'OddysseyABI'
];
function fixFile(filePath) {
const fullPath = path.join(__dirname, filePath);
if (!fs.existsSync(fullPath)) {
console.log(`⚠️ File not found: ${filePath}`);
return;
}
let content = fs.readFileSync(fullPath, 'utf8');
let modified = false;
// Fix .abi references
abiImports.forEach(abiName => {
const pattern = new RegExp(`\\b${abiName}\\.abi\\b`, 'g');
if (content.includes(`${abiName}.abi`)) {
content = content.replace(pattern, abiName);
modified = true;
console.log(` ✅ Fixed ${abiName}.abi → ${abiName}`);
}
});
if (modified) {
fs.writeFileSync(fullPath, content);
console.log(`✅ Fixed file: ${filePath}`);
} else {
console.log(`ℹ️ No changes needed: ${filePath}`);
}
}
console.log('🔧 Fixing ABI references in frontend files...\n');
filesToFix.forEach(fixFile);
console.log('\n🎉 ABI reference fixes complete!');