diff --git a/keychain-sdk/keychain.go b/keychain-sdk/keychain.go index 2091946ae..75c5a94d5 100644 --- a/keychain-sdk/keychain.go +++ b/keychain-sdk/keychain.go @@ -137,7 +137,7 @@ func (a *App) ConnectionState() map[string]connectivity.State { } func (a *App) initConnections() error { - initConnection := func(logger *slog.Logger, grpcNodeConfig GrpcNodeConfig, config BasicConfig) (*AppClient, error) { + initConnection := func(logger *slog.Logger, grpcNodeConfig GrpcNodeConfig, config BasicConfig, identity client.Identity) (*AppClient, error) { appClient := &AppClient{ batchSize: config.BatchSize, keychainId: config.KeychainID, @@ -155,11 +155,6 @@ func (a *App) initConnections() error { conn := query.Conn() - identity, err := client.NewIdentityFromSeed(a.config.Mnemonic) - if err != nil { - return nil, fmt.Errorf("failed to create identity: %w", err) - } - logger.Info("keychain writer identity", "address", identity.Address.String()) appClient.txClient = client.NewTxClient(identity, config.ChainID, conn, query) @@ -167,8 +162,13 @@ func (a *App) initConnections() error { return appClient, nil } + identity, err := client.NewIdentityFromSeed(a.config.Mnemonic) + if err != nil { + return fmt.Errorf("failed to create identity: %w", err) + } + for _, grpcUrl := range a.config.GRPCConfigs { - appClient, err := initConnection(a.logger(), grpcUrl, a.config.BasicConfig) + appClient, err := initConnection(a.logger(), grpcUrl, a.config.BasicConfig, identity) if err != nil { return err }