-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.js
More file actions
35 lines (28 loc) · 1.14 KB
/
start.js
File metadata and controls
35 lines (28 loc) · 1.14 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
import { Connection, Keypair } from '@solana/web3.js';
import { ArbitrageManager } from './index.js';
import * as dotenv from 'dotenv';
import fs from 'fs';
import bs58 from 'bs58';
dotenv.config();
async function main() {
try {
// Load configuration
const connection = new Connection(process.env.SOLANA_RPC_URL, {
commitment: process.env.COMMITMENT_LEVEL || 'confirmed'
});
// Load keypair from JSON file
const keypairData = JSON.parse(fs.readFileSync('keypair.json', 'utf-8'));
const privateKeyBase58 = keypairData.privateKey;
const privateKeyBytes = bs58.decode(privateKeyBase58);
const keypair = Keypair.fromSecretKey(privateKeyBytes);
console.log('Starting arbitrage bot...');
console.log('Wallet public key:', keypair.publicKey.toString());
const arbitrageManager = new ArbitrageManager(connection, keypair);
// Start monitoring with 1 second interval
await arbitrageManager.startMonitoring(1000);
} catch (error) {
console.error('Error starting arbitrage bot:', error);
process.exit(1);
}
}
main();