Skip to content

Commit 0a0af97

Browse files
authored
make ictt to accept home private key flags (#2750)
1 parent d344382 commit 0a0af97

File tree

1 file changed

+20
-13
lines changed
  • cmd/interchaincmd/tokentransferrercmd

1 file changed

+20
-13
lines changed

cmd/interchaincmd/tokentransferrercmd/deploy.go

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,29 @@ func getHomeKeyAndAddress(app *application.Avalanche, network models.Network, ho
111111
return "", "", err
112112
}
113113

114-
// Propmt for the key to be used.
115-
// Note that this key must have enough funds to cover gas cost on the
116-
// home chain, and also enough of the token on the home chain to collateralize
117-
// the remote chain if it is a native token remote.
118-
homeKey, err := prompts.PromptPrivateKey(
119-
app.Prompt,
120-
"pay for home deployment fees, and collateralization (if necessary)",
121-
app.GetKeyDir(),
122-
app.GetKey,
123-
genesisAddress,
124-
genesisPrivateKey,
125-
)
114+
homeKey, err := homeFlags.privateKeyFlags.GetPrivateKey(app, genesisPrivateKey)
126115
if err != nil {
127116
return "", "", err
128117
}
129118

119+
if homeKey == "" {
120+
// Propmt for the key to be used.
121+
// Note that this key must have enough funds to cover gas cost on the
122+
// home chain, and also enough of the token on the home chain to collateralize
123+
// the remote chain if it is a native token remote.
124+
homeKey, err = prompts.PromptPrivateKey(
125+
app.Prompt,
126+
"pay for home deployment fees, and collateralization (if necessary)",
127+
app.GetKeyDir(),
128+
app.GetKey,
129+
genesisAddress,
130+
genesisPrivateKey,
131+
)
132+
if err != nil {
133+
return "", "", err
134+
}
135+
}
136+
130137
// Calculate the address for the key.
131138
pk, err := crypto.HexToECDSA(homeKey)
132139
if err != nil {
@@ -408,7 +415,7 @@ func CallDeploy(_ []string, flags DeployFlags) error {
408415
if remoteKey == "" {
409416
remoteKey, err = prompts.PromptPrivateKey(
410417
app.Prompt,
411-
"pay for home deploy fees",
418+
"pay for remote deploy fees",
412419
app.GetKeyDir(),
413420
app.GetKey,
414421
genesisAddress,

0 commit comments

Comments
 (0)