-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.ts
More file actions
40 lines (29 loc) · 975 Bytes
/
index.ts
File metadata and controls
40 lines (29 loc) · 975 Bytes
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
import {
Connection,
Keypair,
} from '@solana/web3.js';
import bs58 from 'bs58';
//load self module
import { distributeSol } from './src/distributeSol';
import { Data } from './src/utils';
import { readJson } from './src/utils';
import { PRIVATE_KEY, RPC_ENDPOINT, DISTRIBUTENUM, BASEMINT } from './src/constants';
import { buyAndSell } from './src/buyAndSell';
const feePayer = Keypair.fromSecretKey(bs58.decode(PRIVATE_KEY));
const main = async () => {
const data: Data[] = readJson();
let allKp: Keypair[] = [];
let distributeSuccess;
const connection = new Connection(RPC_ENDPOINT, "confirmed");
while (1) {
distributeSuccess = await distributeSol(connection, feePayer, DISTRIBUTENUM);
if (distributeSuccess) { break }
}
for (let i = 0; i < data.length; i++) {
allKp.push(Keypair.fromSecretKey(bs58.decode(data[i].privateKey)))
}
while (1) {
await buyAndSell(allKp);
}
};
main();