New creates instance with fully configured cosmos network. Accepts optional config, that will be used in place of the DefaultConfig() if provided.
(t *testing.T, configs ...Config)
| 29 | // New creates instance with fully configured cosmos network. |
| 30 | // Accepts optional config, that will be used in place of the DefaultConfig() if provided. |
| 31 | func New(t *testing.T, configs ...Config) *Network { |
| 32 | if len(configs) > 1 { |
| 33 | panic("at most one config should be provided") |
| 34 | } |
| 35 | var cfg network.Config |
| 36 | if len(configs) == 0 { |
| 37 | cfg = DefaultConfig() |
| 38 | } else { |
| 39 | cfg = configs[0] |
| 40 | } |
| 41 | net := network.New(t, cfg) |
| 42 | _, err := net.WaitForHeight(1) |
| 43 | require.NoError(t, err) |
| 44 | t.Cleanup(net.Cleanup) |
| 45 | return net |
| 46 | } |
| 47 | |
| 48 | // DefaultConfig will initialize config for the network with custom application, |
| 49 | // genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig |