forked from web3-monitor/web3tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
command.js
121 lines (105 loc) · 3.25 KB
/
command.js
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
const { Command } = require('commander');
const program = new Command();
const solanaJs = require('./scripts/chain/solana/main.js');
const solana = program.command('solana');
solana
.command('faucet')
.description('faucet, get test SOL from testnet/devnet faucet')
.action(async () => {
try {
await solanaJs.faucet();
} catch (error) {
console.error(error);
}
});
solana
.command('create <num> [type]')
.description('create wallets')
.action(async (num, type = 'bs58') => {
try {
await solanaJs.createWallets(num, type);
} catch (error) {
console.error(error);
}
});
solana
.command('createPretty <prefix> <suffix> <numThreads>')
.description('create pretty accounts')
.action(async (prefix, suffix, numThreads) => {
try {
await solanaJs.createPrettyAccount(prefix, suffix, numThreads);
} catch (error) {
console.error(error);
}
});
solana
.command('distribute <amount>')
.description('distribute SOL to sonWallets')
.action(async (amount) => {
try {
await solanaJs.distributeSol(amount);
} catch (error) {
console.error(error);
}
});
solana
.command('collect <amount> [type]')
.description('collect SOL from sonWallets, type defaults to "part" if not provided.')
.action(async (amount, type = 'part') => {
try {
await solanaJs.colletSol(amount, type);
} catch (error) {
console.error(error);
}
});
solana
.command('distributeSpl <tokenAddress> <amount>')
.description('distribute SPL token to sonWallets')
.action(async (tokenAddress, amount) => {
try {
await solanaJs.distributeSplToken(tokenAddress, amount);
} catch (error) {
console.error(error);
}
});
solana
.command('collectSpl <tokenAddress> <amount> [type]')
.description('collect SPL token from sonWallets, type defaults to "part" if not provided.')
.action(async (tokenAddress, amount, type = 'part') => {
try {
await solanaJs.collectSplToken(tokenAddress, amount, type);
} catch (error) {
console.error(error);
}
});
solana
.command('createSplTokenAccount <tokenAddress>')
.description('create spl Token address')
.action(async (tokenAddress) => {
try {
await solanaJs.createSplTokenAccount(tokenAddress);
} catch (error) {
console.error(error);
}
});
solana
.command('closeSplTokenAccount <tokenAddress>')
.description('close spl Token address to resume sol to mainWallet')
.action(async (tokenAddress) => {
try {
await solanaJs.closeAccount(tokenAddress);
} catch (error) {
console.error(error);
}
});
solana
.command('swap <inputMint> <outputMint> <amount> <slippageBps>')
.description('swap token')
.action(async (inputMint, outputMint, amount, slippageBps) => {
try {
await solanaJs.swap(inputMint, outputMint, amount, slippageBps);
} catch (error) {
console.error(error);
}
});
program.parse(process.argv);