forked from strangelove-ventures/lens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
155 lines (144 loc) · 5.91 KB
/
config.go
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
package client
import (
"time"
"github.com/CosmWasm/wasmd/x/wasm"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
authz "github.com/cosmos/cosmos-sdk/x/authz/module"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/capability"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/distribution"
// distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client/cli"
feegrant "github.com/cosmos/cosmos-sdk/x/feegrant/module"
"github.com/cosmos/cosmos-sdk/x/gov"
"github.com/cosmos/cosmos-sdk/x/mint"
"github.com/cosmos/cosmos-sdk/x/params"
// paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/upgrade"
// upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
ibcInterchainAccounts "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v7/modules/core"
ibcClient "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
osmosisConcentratedLiquidity "github.com/osmosis-labs/osmosis/v21/x/concentrated-liquidity/clmodule"
osmosisCosmWasmPool "github.com/osmosis-labs/osmosis/v21/x/cosmwasmpool/module"
osmosisGamm "github.com/osmosis-labs/osmosis/v21/x/gamm"
osmosisIncentives "github.com/osmosis-labs/osmosis/v21/x/incentives"
osmosisLockup "github.com/osmosis-labs/osmosis/v21/x/lockup"
osmosisMint "github.com/osmosis-labs/osmosis/v21/x/mint"
osmosisPoolIncentives "github.com/osmosis-labs/osmosis/v21/x/pool-incentives"
osmosisPoolManager "github.com/osmosis-labs/osmosis/v21/x/poolmanager/module"
osmosisProtorev "github.com/osmosis-labs/osmosis/v21/x/protorev"
osmosisSuperfluid "github.com/osmosis-labs/osmosis/v21/x/superfluid"
osmosisTokenFactory "github.com/osmosis-labs/osmosis/v21/x/tokenfactory"
osmosisTxFees "github.com/osmosis-labs/osmosis/v21/x/txfees"
osmosisValsetPref "github.com/osmosis-labs/osmosis/v21/x/valset-pref/valpref-module"
osmosisEpochs "github.com/osmosis-labs/osmosis/x/epochs"
)
var (
ModuleBasics = []module.AppModuleBasic{
auth.AppModuleBasic{},
authz.AppModuleBasic{},
bank.AppModuleBasic{},
capability.AppModuleBasic{},
// TODO: add osmosis governance proposal types here
// TODO: add other proposal types here
gov.AppModuleBasic{},
// gov.NewAppModuleBasic(
// paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler,
// ),
crisis.AppModuleBasic{},
distribution.AppModuleBasic{},
feegrant.AppModuleBasic{},
mint.AppModuleBasic{},
params.AppModuleBasic{},
slashing.AppModuleBasic{},
staking.AppModuleBasic{},
upgrade.AppModuleBasic{},
transfer.AppModuleBasic{},
ibc.AppModuleBasic{},
ibcClient.AppModuleBasic{},
ibcInterchainAccounts.AppModuleBasic{},
wasm.AppModuleBasic{},
osmosisGamm.AppModuleBasic{},
osmosisEpochs.AppModuleBasic{},
osmosisIncentives.AppModuleBasic{},
osmosisLockup.AppModuleBasic{},
osmosisMint.AppModuleBasic{},
osmosisPoolIncentives.AppModuleBasic{},
osmosisSuperfluid.AppModuleBasic{},
osmosisTokenFactory.AppModuleBasic{},
osmosisTxFees.AppModuleBasic{},
osmosisPoolManager.AppModuleBasic{},
osmosisProtorev.AppModuleBasic{},
osmosisConcentratedLiquidity.AppModuleBasic{},
vesting.AppModuleBasic{},
osmosisValsetPref.AppModuleBasic{},
osmosisCosmWasmPool.AppModuleBasic{},
}
)
type ChainClientConfig struct {
Key string `json:"key" yaml:"key"`
ChainID string `json:"chain-id" yaml:"chain-id"`
RPCAddr string `json:"rpc-addr" yaml:"rpc-addr"`
GRPCAddr string `json:"grpc-addr" yaml:"grpc-addr"`
AccountPrefix string `json:"account-prefix" yaml:"account-prefix"`
KeyringBackend string `json:"keyring-backend" yaml:"keyring-backend"`
GasAdjustment float64 `json:"gas-adjustment" yaml:"gas-adjustment"`
GasPrices string `json:"gas-prices" yaml:"gas-prices"`
KeyDirectory string `json:"key-directory" yaml:"key-directory"`
Debug bool `json:"debug" yaml:"debug"`
Timeout string `json:"timeout" yaml:"timeout"`
OutputFormat string `json:"output-format" yaml:"output-format"`
SignModeStr string `json:"sign-mode" yaml:"sign-mode"`
Modules []module.AppModuleBasic `json:"-" yaml:"-"`
}
func (ccc *ChainClientConfig) Validate() error {
if _, err := time.ParseDuration(ccc.Timeout); err != nil {
return err
}
return nil
}
func GetCosmosHubConfig(keyHome string, debug bool) *ChainClientConfig {
return &ChainClientConfig{
Key: "default",
ChainID: "cosmoshub-4",
RPCAddr: "https://cosmoshub-4.technofractal.com:443",
GRPCAddr: "https://gprc.cosmoshub-4.technofractal.com:443",
AccountPrefix: "cosmos",
KeyringBackend: "test",
GasAdjustment: 1.2,
GasPrices: "0.01uatom",
KeyDirectory: keyHome,
Debug: debug,
Timeout: "20s",
OutputFormat: "json",
SignModeStr: "direct",
}
}
func GetOsmosisConfig(keyHome string, debug bool) *ChainClientConfig {
return &ChainClientConfig{
Key: "default",
ChainID: "osmosis-1",
RPCAddr: "https://osmosis-1.technofractal.com:443",
GRPCAddr: "https://gprc.osmosis-1.technofractal.com:443",
AccountPrefix: "osmo",
KeyringBackend: "test",
GasAdjustment: 1.2,
GasPrices: "0.01uosmo",
KeyDirectory: keyHome,
Debug: debug,
Timeout: "20s",
OutputFormat: "json",
SignModeStr: "direct",
}
}
func GetTestClient() *ChainClient {
homepath := "/tmp"
cl, _ := NewChainClient(GetCosmosHubConfig(homepath, true), homepath, nil, nil)
return cl
}