@darksol/terminal 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +198 -0
- package/assets/darksol-banner.png +0 -0
- package/bin/darksol.js +5 -0
- package/package.json +39 -0
- package/src/cli.js +434 -0
- package/src/config/store.js +75 -0
- package/src/scripts/engine.js +718 -0
- package/src/services/builders.js +70 -0
- package/src/services/cards.js +67 -0
- package/src/services/casino.js +94 -0
- package/src/services/facilitator.js +60 -0
- package/src/services/market.js +179 -0
- package/src/services/oracle.js +92 -0
- package/src/trading/dca.js +249 -0
- package/src/trading/index.js +3 -0
- package/src/trading/snipe.js +195 -0
- package/src/trading/swap.js +233 -0
- package/src/ui/banner.js +60 -0
- package/src/ui/components.js +126 -0
- package/src/ui/theme.js +46 -0
- package/src/wallet/keystore.js +127 -0
- package/src/wallet/manager.js +287 -0
- package/tests/cli.test.js +72 -0
- package/tests/config.test.js +75 -0
- package/tests/dca.test.js +141 -0
- package/tests/keystore.test.js +94 -0
- package/tests/scripts.test.js +136 -0
- package/tests/trading.test.js +21 -0
- package/tests/ui.test.js +27 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import Conf from 'conf';
|
|
2
|
+
import { theme } from '../ui/theme.js';
|
|
3
|
+
|
|
4
|
+
const config = new Conf({
|
|
5
|
+
projectName: 'darksol-terminal',
|
|
6
|
+
schema: {
|
|
7
|
+
activeWallet: { type: 'string', default: '' },
|
|
8
|
+
chain: { type: 'string', default: 'base' },
|
|
9
|
+
output: { type: 'string', default: 'pretty', enum: ['pretty', 'json', 'table'] },
|
|
10
|
+
rpcs: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
default: {
|
|
13
|
+
base: 'https://mainnet.base.org',
|
|
14
|
+
ethereum: 'https://eth.llamarpc.com',
|
|
15
|
+
polygon: 'https://polygon-rpc.com',
|
|
16
|
+
arbitrum: 'https://arb1.arbitrum.io/rpc',
|
|
17
|
+
optimism: 'https://mainnet.optimism.io',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
slippage: { type: 'number', default: 0.5 },
|
|
21
|
+
gasMultiplier: { type: 'number', default: 1.1 },
|
|
22
|
+
dca: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
default: {
|
|
25
|
+
defaultInterval: 3600, // 1 hour in seconds
|
|
26
|
+
maxOrders: 100,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
services: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
default: {
|
|
32
|
+
oracle: 'https://acp.darksol.net/oracle',
|
|
33
|
+
casino: 'https://casino.darksol.net',
|
|
34
|
+
cards: 'https://acp.darksol.net/cards',
|
|
35
|
+
facilitator: 'https://facilitator.darksol.net',
|
|
36
|
+
builders: 'https://builders.darksol.net',
|
|
37
|
+
market: 'https://acp.darksol.net/market',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export function getConfig(key) {
|
|
44
|
+
return config.get(key);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function setConfig(key, value) {
|
|
48
|
+
config.set(key, value);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function getAllConfig() {
|
|
52
|
+
return config.store;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getRPC(chain) {
|
|
56
|
+
const rpcs = config.get('rpcs');
|
|
57
|
+
return rpcs[chain || config.get('chain')];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function setRPC(chain, url) {
|
|
61
|
+
const rpcs = config.get('rpcs');
|
|
62
|
+
rpcs[chain] = url;
|
|
63
|
+
config.set('rpcs', rpcs);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function getServiceURL(service) {
|
|
67
|
+
const services = config.get('services');
|
|
68
|
+
return services[service];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function configPath() {
|
|
72
|
+
return config.path;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default config;
|