-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli.js
executable file
·88 lines (73 loc) · 2.83 KB
/
cli.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
#!/usr/bin/env node --experimental-repl-await
const repl = require('repl');
const ethers = require('ethers');
const mainnet = new ethers.getDefaultProvider();
const arbmain = new ethers.providers.StaticJsonRpcProvider(
'https://arb-mainnet.g.alchemy.com/v2/gh1-tm4X9f0pxljEGsnFnPe693FZ-gim'
);
const arbgoerli = new ethers.providers.StaticJsonRpcProvider(
'https://arb-goerli.g.alchemy.com/v2/gh1-tm4X9f0pxljEGsnFnPe693FZ-gim'
);
const state = {
...require('ethers-repl/loaders/ethers')(),
...require('ethers-repl/loaders/wallet')(),
// ...require('ethers-repl/loaders/provider')(),
...require('ethers-repl/loaders/contract')(),
mainnet,
arbmain,
arbgoerli,
sdk: require('./'),
...require('./'),
addressesOf: (obj) => Object.keys(obj).map((key) => [key, obj[key].address]),
};
const myRepl = repl.start('rage> ');
Object.assign(myRepl.context, state);
// mainnet
state.sdk.core.getContracts(arbmain).then((coreMain) => {
const _state = { ...myRepl.context, coreMain };
Object.assign(myRepl.context, _state);
});
state.sdk.tricryptoVault.getContracts(arbmain).then((vaultMain) => {
const _state = { ...myRepl.context, vaultMain };
Object.assign(myRepl.context, _state);
});
state.sdk.tokens.getContracts(arbmain).then((tokenMain) => {
const _state = { ...myRepl.context, tokenMain };
Object.assign(myRepl.context, _state);
});
// testnet
state.sdk.core.getContracts(arbgoerli).then((coreTest) => {
const _state = { ...myRepl.context, coreTest };
Object.assign(myRepl.context, _state);
});
state.sdk.tricryptoVault.getContracts(arbgoerli).then((vaultTest) => {
const _state = { ...myRepl.context, vaultTest };
Object.assign(myRepl.context, _state);
});
state.sdk.gmxVault.getContracts(arbgoerli).then((gmxTest) => {
const _state = { ...myRepl.context, gmxTest };
Object.assign(myRepl.context, _state);
});
state.sdk.tokens.getContracts(arbgoerli).then((tokenTest) => {
const _state = { ...myRepl.context, tokenTest };
Object.assign(myRepl.context, _state);
});
// arbgoerli
state.sdk.core.getContracts(arbgoerli).then((coreGo) => {
const _state = { ...myRepl.context, coreGo };
Object.assign(myRepl.context, _state);
});
state.sdk.tricryptoVault.getContracts(arbgoerli).then((vaultGo) => {
const _state = { ...myRepl.context, vaultGo };
Object.assign(myRepl.context, _state);
});
state.sdk.gmxVault.getContracts(arbgoerli).then((gmxGo) => {
const _state = { ...myRepl.context, gmxGo };
Object.assign(myRepl.context, _state);
});
state.sdk.tokens.getContracts(arbgoerli).then((tokenGo) => {
const _state = { ...myRepl.context, tokenGo };
Object.assign(myRepl.context, _state);
});
// # node -i -e "ethers = require('ethers'); p = new ethers.providers.StaticJsonRpcProvider('https://arb-rinkeby.g.alchemy.com/v2/gh1-tm4X9f0pxljEGsnFnPe693FZ-gim');sdk = require('./');"
// node -i -e "require('./cli.initializers.js')"