Skip to content

Commit

Permalink
fix: eibc client config settings (#1118)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemijspavlovs authored Nov 20, 2024
1 parent f3c20ac commit 1013fdf
Showing 1 changed file with 38 additions and 22 deletions.
60 changes: 38 additions & 22 deletions cmd/eibc/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func Cmd() *cobra.Command {
pterm.Info.Printfln("policies already present for %s", kc.ID)

printPolicyAddress(pol.GroupPolicies[0].Address)

updates := map[string]interface{}{
"fulfillers.policy_address": pol.GroupPolicies[0].Address,
"operator.group_id": groupID,
Expand Down Expand Up @@ -227,7 +228,6 @@ func Cmd() *cobra.Command {
pterm.Error.Printf("failed to create whale account: %v\n", err)
return
}

}
} else {
deps := dependencies.DefaultEibcClientPrebuiltDependencies()
Expand All @@ -254,30 +254,42 @@ func Cmd() *cobra.Command {
}
}

cqc := keys.ChainQueryConfig{
Binary: consts.Executables.Dymension,
Denom: consts.Denoms.Hub,
RPC: hd.RpcUrl,
}
balance, err := keys.QueryBalance(cqc, ki.Address)
if err != nil {
pterm.Error.Println("failed to get balance: ", err)
return
}
pterm.Info.Println(
"you are about to run the eibc client for the following Dymension network:",
)
fmt.Println("network ID:",
pterm.DefaultBasicText.WithStyle(pterm.FgYellow.ToStyle()).
Sprint(hd.ID),
)

if !balance.Amount.IsPositive() {
pterm.Info.Println(
"please fund the addresses below to run the eibc client. this address will be the operator address of the client.",
)
ki.Print(keys.WithName(), keys.WithMnemonic())
proceed, _ := pterm.DefaultInteractiveConfirm.WithDefaultValue(false).
WithDefaultText(
"press 'y' when the wallets are funded",
).Show()
if !proceed {
pterm.Error.Println("cancelled by user")
for {
cqc := keys.ChainQueryConfig{
Binary: consts.Executables.Dymension,
Denom: consts.Denoms.Hub,
RPC: hd.RpcUrl,
}
balance, err := keys.QueryBalance(cqc, ki.Address)
if err != nil {
pterm.Error.Println("failed to get balance: ", err)
return
}

if !balance.Amount.IsPositive() {
pterm.Info.Println(
"please fund the addresses below to run the eibc client. this address will be the operator address of the client.",
)
ki.Print(keys.WithName(), keys.WithMnemonic())
proceed, _ := pterm.DefaultInteractiveConfirm.WithDefaultValue(false).
WithDefaultText(
"press 'y' when the wallets are funded",
).Show()
if !proceed {
pterm.Error.Println("cancelled by user")
return
}
} else {
break
}
}

var runForExisting bool
Expand Down Expand Up @@ -572,6 +584,10 @@ func updateEibcConfig(eibcConfigPath string, hd consts.HubData) error {
"node_address": hd.RpcUrl,
"order_polling.indexer_url": consts.DefaultIndexer,
"operator.account_name": consts.KeysIds.Eibc,
"gas.fees": "4000000000000000adym",
"rollapps.example_1234-1": nil,
"validation.interval": "5m0s",
"validation.wait_time": "61m0s",
}
err := yamlconfig.UpdateNestedYAML(eibcConfigPath, updates)
if err != nil {
Expand Down

0 comments on commit 1013fdf

Please sign in to comment.