From 594a7af0aa8c23ace5be805cb8efd46b9440df94 Mon Sep 17 00:00:00 2001 From: Jordan Ribbink <17958158+jribbink@users.noreply.github.com> Date: Thu, 3 Oct 2024 10:15:53 -0700 Subject: [PATCH] Fix output of `flow accounts create` (#1779) --- internal/accounts/create-interactive.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/accounts/create-interactive.go b/internal/accounts/create-interactive.go index 8611ef4e8..0dd64890c 100644 --- a/internal/accounts/create-interactive.go +++ b/internal/accounts/create-interactive.go @@ -50,7 +50,9 @@ import ( // // This process takes the user through couple of steps with prompts asking for them to provide name and network, // and it then uses account creation APIs to automatically create the account on the network as well as save it. -func createInteractive(state *flowkit.State) (*accountResult, error) { +func createInteractive( + state *flowkit.State, +) (*accountResult, error) { log := output.NewStdoutLogger(output.InfoLog) name := prompt.AccountNamePrompt(state.Accounts().Names()) networkName, selectedNetwork := prompt.CreateAccountNetworkPrompt() @@ -110,12 +112,14 @@ func createInteractive(state *flowkit.State) (*accountResult, error) { } outputList(log, items, false) + // Get account details from the network + networkAccount, err := flow.GetAccount(context.Background(), account.Address) + if err != nil { + return nil, fmt.Errorf("failed to get details for created account %s: %w", account.Address, err) + } + return &accountResult{ - Account: &flowsdk.Account{ - Address: account.Address, - Balance: 0, - Keys: []*flowsdk.AccountKey{flowsdk.NewAccountKey().FromPrivateKey(key)}, - }, + Account: networkAccount, include: nil, }, nil }